zincjs 1.14.1 → 1.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see zinc.frontend.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Zinc=t():e.Zinc=t()}(this,(()=>(()=>{var e={164:function(e,t,r){"use strict";var i,n;"undefined"==typeof window||window,void 0===(n="function"==typeof(i=function(){function e(e,t){var r=Object.prototype.toString.call(e),i="[object Array]"===r||"[object NodeList]"===r||"[object HTMLCollection]"===r||"[object Object]"===r||"undefined"!=typeof jQuery&&e instanceof jQuery||"undefined"!=typeof Elements&&e instanceof Elements,n=0,a=e.length;if(i)for(;n<a;n++)t(e[n]);else t(e)}function t(e){if(!e.getBoundingClientRect)return{width:e.offsetWidth,height:e.offsetHeight};var t=e.getBoundingClientRect();return{width:Math.round(t.width),height:Math.round(t.height)}}function r(e,t){Object.keys(t).forEach((function(r){e.style[r]=t[r]}))}if("undefined"==typeof window)return null;var i="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),n=i.requestAnimationFrame||i.mozRequestAnimationFrame||i.webkitRequestAnimationFrame||function(e){return i.setTimeout(e,20)},a=i.cancelAnimationFrame||i.mozCancelAnimationFrame||i.webkitCancelAnimationFrame||function(e){i.clearTimeout(e)},s=function(i,o){function l(){var e,t,r=[];this.add=function(e){r.push(e)},this.call=function(i){for(e=0,t=r.length;e<t;e++)r[e].call(this,i)},this.remove=function(i){var n=[];for(e=0,t=r.length;e<t;e++)r[e]!==i&&n.push(r[e]);r=n},this.length=function(){return r.length}}function h(e,i){if(e){if(e.resizedAttached)return void e.resizedAttached.add(i);e.resizedAttached=new l,e.resizedAttached.add(i),e.resizeSensor=document.createElement("div"),e.resizeSensor.dir="ltr",e.resizeSensor.className="resize-sensor";var a={pointerEvents:"none",position:"absolute",left:"0px",top:"0px",right:"0px",bottom:"0px",overflow:"hidden",zIndex:"-1",visibility:"hidden",maxWidth:"100%"},s={position:"absolute",left:"0px",top:"0px",transition:"0s"};r(e.resizeSensor,a);var o=document.createElement("div");o.className="resize-sensor-expand",r(o,a);var h=document.createElement("div");r(h,s),o.appendChild(h);var u=document.createElement("div");u.className="resize-sensor-shrink",r(u,a);var d=document.createElement("div");r(d,s),r(d,{width:"200%",height:"200%"}),u.appendChild(d),e.resizeSensor.appendChild(o),e.resizeSensor.appendChild(u),e.appendChild(e.resizeSensor);var p=window.getComputedStyle(e),m=p?p.getPropertyValue("position"):null;"absolute"!==m&&"relative"!==m&&"fixed"!==m&&"sticky"!==m&&(e.style.position="relative");var f=!1,v=0,g=t(e),y=0,x=0,b=!0;c=0;var w=function t(){if(b){if(0===e.offsetWidth&&0===e.offsetHeight)return void(c||(c=n((function(){c=0,t()}))));b=!1}var r,i;r=e.offsetWidth,i=e.offsetHeight,h.style.width=r+10+"px",h.style.height=i+10+"px",o.scrollLeft=r+10,o.scrollTop=i+10,u.scrollLeft=r+10,u.scrollTop=i+10};e.resizeSensor.resetSensor=w;var _=function(){v=0,f&&(y=g.width,x=g.height,e.resizedAttached&&e.resizedAttached.call(g))},M=function(){g=t(e),(f=g.width!==y||g.height!==x)&&!v&&(v=n(_)),w()},S=function(e,t,r){e.attachEvent?e.attachEvent("on"+t,r):e.addEventListener(t,r)};S(o,"scroll",M),S(u,"scroll",M),c=n((function(){c=0,w()}))}}var c=0;e(i,(function(e){h(e,o)})),this.detach=function(e){c||(a(c),c=0),s.detach(i,e)},this.reset=function(){i.resizeSensor.resetSensor()}};if(s.reset=function(t){e(t,(function(e){e.resizeSensor.resetSensor()}))},s.detach=function(t,r){e(t,(function(e){!e||e.resizedAttached&&"function"==typeof r&&(e.resizedAttached.remove(r),e.resizedAttached.length())||e.resizeSensor&&(e.contains(e.resizeSensor)&&e.removeChild(e.resizeSensor),delete e.resizeSensor,delete e.resizedAttached)}))},"undefined"!=typeof MutationObserver){var o=new MutationObserver((function(e){for(var t in e)if(e.hasOwnProperty(t))for(var r=e[t].addedNodes,i=0;i<r.length;i++)r[i].resizeSensor&&s.reset(r[i])}));document.addEventListener("DOMContentLoaded",(function(e){o.observe(document.body,{childList:!0,subtree:!0})}))}return s})?i.call(t,r,t,e):i)||(e.exports=n)},7846:(e,t,r)=>{"use strict";r.d(t,{A:()=>m});function i(e,t){this.name="AggregateError",this.errors=e,this.message=t||""}i.prototype=Error.prototype;var n=setTimeout;function a(e){return!(!e||void 0===e.length)}function s(){}function o(e){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],p(e,this)}function l(e,t){for(;3===e._state;)e=e._value;return 0===e._state?void e._deferreds.push(t):(e._handled=!0,void o._immediateFn((function(){var r=1===e._state?t.onFulfilled:t.onRejected;if(null!==r){var i;try{i=r(e._value)}catch(e){return void c(t.promise,e)}h(t.promise,i)}else(1===e._state?h:c)(t.promise,e._value)})))}function h(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var r=t.then;if(t instanceof o)return e._state=3,e._value=t,void u(e);if("function"==typeof r)return void p((i=r,n=t,function(){i.apply(n,arguments)}),e)}e._state=1,e._value=t,u(e)}catch(t){c(e,t)}var i,n}function c(e,t){e._state=2,e._value=t,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&o._immediateFn((function(){e._handled||o._unhandledRejectionFn(e._value)}));for(var t=0,r=e._deferreds.length;t<r;t++)l(e,e._deferreds[t]);e._deferreds=null}function d(e,t,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=r}function p(e,t){var r=!1;try{e((function(e){r||(r=!0,h(t,e))}),(function(e){r||(r=!0,c(t,e))}))}catch(e){if(r)return;r=!0,c(t,e)}}o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){var r=new this.constructor(s);return l(this,new d(e,t,r)),r},o.prototype.finally=function(e){var t=this.constructor;return this.then((function(r){return t.resolve(e()).then((function(){return r}))}),(function(r){return t.resolve(e()).then((function(){return t.reject(r)}))}))},o.all=function(e){return new o((function(t,r){function i(e,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var o=a.then;if("function"==typeof o)return void o.call(a,(function(t){i(e,t)}),r)}n[e]=a,0==--s&&t(n)}catch(e){r(e)}}if(!a(e))return r(new TypeError("Promise.all accepts an array"));var n=Array.prototype.slice.call(e);if(0===n.length)return t([]);for(var s=n.length,o=0;o<n.length;o++)i(o,n[o])}))},o.any=function(e){var t=this;return new t((function(r,n){if(!e||void 0===e.length)return n(new TypeError("Promise.any accepts an array"));var a=Array.prototype.slice.call(e);if(0===a.length)return n();for(var s=[],o=0;o<a.length;o++)try{t.resolve(a[o]).then(r).catch((function(e){s.push(e),s.length===a.length&&n(new i(s,"All promises were rejected"))}))}catch(e){n(e)}}))},o.allSettled=function(e){return new this((function(t,r){function i(e,r){if(r&&("object"==typeof r||"function"==typeof r)){var s=r.then;if("function"==typeof s)return void s.call(r,(function(t){i(e,t)}),(function(r){n[e]={status:"rejected",reason:r},0==--a&&t(n)}))}n[e]={status:"fulfilled",value:r},0==--a&&t(n)}if(!e||void 0===e.length)return r(new TypeError(typeof e+" "+e+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var n=Array.prototype.slice.call(e);if(0===n.length)return t([]);for(var a=n.length,s=0;s<n.length;s++)i(s,n[s])}))},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o((function(t){t(e)}))},o.reject=function(e){return new o((function(t,r){r(e)}))},o.race=function(e){return new o((function(t,r){if(!a(e))return r(new TypeError("Promise.race accepts an array"));for(var i=0,n=e.length;i<n;i++)o.resolve(e[i]).then(t,r)}))},o._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){n(e,0)},o._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};const m=o},8221:(e,t,r)=>{"use strict";r.d(t,{A:()=>p});var i=r(1515);function n(e,t){for(var r,i=0;i<t.length;i++)(r=t[i]).enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=a(e);if(t){var n=a(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return function(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,r)}}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=r){var i,n,a=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(i=r.next()).done)&&(a.push(i.value),!t||a.length!==t);s=!0);}catch(e){o=!0,n=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw n}}return a}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}var d="undefined"!=typeof window&&window.THREE?window.THREE:{LinearFilter:i.LinearFilter,Sprite:i.Sprite,SpriteMaterial:i.SpriteMaterial,Texture:i.Texture};const p=function(e){function t(){var e,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:10,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"rgba(255, 255, 255, 1)";return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=a.call(this,new d.SpriteMaterial({map:new d.Texture})))._text="".concat(r),e._textHeight=i,e._color=n,e._backgroundColor=!1,e._padding=0,e._borderWidth=0,e._borderRadius=0,e._borderColor="white",e._strokeWidth=0,e._strokeColor="white",e._fontFace="Arial",e._fontSize=90,e._fontWeight="normal",e._canvas=document.createElement("canvas"),e._texture=e.material.map,e._texture.minFilter=d.LinearFilter,e._genCanvas(),e}!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(t,e);var r,i,a=o(t);return r=t,(i=[{key:"text",get:function(){return this._text},set:function(e){this._text=e,this._genCanvas()}},{key:"textHeight",get:function(){return this._textHeight},set:function(e){this._textHeight=e,this._genCanvas()}},{key:"color",get:function(){return this._color},set:function(e){this._color=e,this._genCanvas()}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=e,this._genCanvas()}},{key:"padding",get:function(){return this._padding},set:function(e){this._padding=e,this._genCanvas()}},{key:"borderWidth",get:function(){return this._borderWidth},set:function(e){this._borderWidth=e,this._genCanvas()}},{key:"borderRadius",get:function(){return this._borderRadius},set:function(e){this._borderRadius=e,this._genCanvas()}},{key:"borderColor",get:function(){return this._borderColor},set:function(e){this._borderColor=e,this._genCanvas()}},{key:"fontFace",get:function(){return this._fontFace},set:function(e){this._fontFace=e,this._genCanvas()}},{key:"fontSize",get:function(){return this._fontSize},set:function(e){this._fontSize=e,this._genCanvas()}},{key:"fontWeight",get:function(){return this._fontWeight},set:function(e){this._fontWeight=e,this._genCanvas()}},{key:"strokeWidth",get:function(){return this._strokeWidth},set:function(e){this._strokeWidth=e,this._genCanvas()}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(e){this._strokeColor=e,this._genCanvas()}},{key:"_genCanvas",value:function(){var e=this,t=this._canvas,r=t.getContext("2d"),i=Array.isArray(this.borderWidth)?this.borderWidth:[this.borderWidth,this.borderWidth],n=i.map((function(t){return t*e.fontSize*.1})),a=(Array.isArray(this.borderRadius)?this.borderRadius:[this.borderRadius,this.borderRadius,this.borderRadius,this.borderRadius]).map((function(t){return t*e.fontSize*.1})),s=Array.isArray(this.padding)?this.padding:[this.padding,this.padding],o=s.map((function(t){return t*e.fontSize*.1})),c=this.text.split("\n"),u="".concat(this.fontWeight," ").concat(this.fontSize,"px ").concat(this.fontFace);r.font=u;var d=Math.max.apply(Math,h(c.map((function(e){return r.measureText(e).width})))),p=this.fontSize*c.length;if(t.width=d+2*n[0]+2*o[0],t.height=p+2*n[1]+2*o[1],this.borderWidth){if(r.strokeStyle=this.borderColor,n[0]){var m=n[0]/2;r.lineWidth=n[0],r.beginPath(),r.moveTo(m,a[0]),r.lineTo(m,t.height-a[3]),r.moveTo(t.width-m,a[1]),r.lineTo(t.width-m,t.height-a[2]),r.stroke()}if(n[1]){var f=n[1]/2;r.lineWidth=n[1],r.beginPath(),r.moveTo(Math.max(n[0],a[0]),f),r.lineTo(t.width-Math.max(n[0],a[1]),f),r.moveTo(Math.max(n[0],a[3]),t.height-f),r.lineTo(t.width-Math.max(n[0],a[2]),t.height-f),r.stroke()}if(this.borderRadius){var v=Math.max.apply(Math,h(n)),g=v/2;r.lineWidth=v,r.beginPath(),[!!a[0]&&[a[0],g,g,a[0]],!!a[1]&&[t.width-a[1],t.width-g,g,a[1]],!!a[2]&&[t.width-a[2],t.width-g,t.height-g,t.height-a[2]],!!a[3]&&[a[3],g,t.height-g,t.height-a[3]]].filter((function(e){return e})).forEach((function(e){var t=l(e,4),i=t[0],n=t[1],a=t[2],s=t[3];r.moveTo(i,a),r.quadraticCurveTo(n,a,n,s)})),r.stroke()}}this.backgroundColor&&(r.fillStyle=this.backgroundColor,this.borderRadius?(r.beginPath(),r.moveTo(n[0],a[0]),[[n[0],a[0],t.width-a[1],n[1],n[1],n[1]],[t.width-n[0],t.width-n[0],t.width-n[0],n[1],a[1],t.height-a[2]],[t.width-n[0],t.width-a[2],a[3],t.height-n[1],t.height-n[1],t.height-n[1]],[n[0],n[0],n[0],t.height-n[1],t.height-a[3],a[0]]].forEach((function(e){var t=l(e,6),i=t[0],n=t[1],a=t[2],s=t[3],o=t[4],h=t[5];r.quadraticCurveTo(i,s,n,o),r.lineTo(a,h)})),r.closePath(),r.fill()):r.fillRect(n[0],n[1],t.width-2*n[0],t.height-2*n[1])),r.translate.apply(r,h(n)),r.translate.apply(r,h(o)),r.font=u,r.fillStyle=this.color,r.textBaseline="bottom";var y=0<this.strokeWidth;y&&(r.lineWidth=this.strokeWidth*this.fontSize/10,r.strokeStyle=this.strokeColor),c.forEach((function(t,i){var n=(d-r.measureText(t).width)/2,a=(i+1)*e.fontSize;y&&r.strokeText(t,n,a),r.fillText(t,n,a)})),this._texture.image=t,this._texture.needsUpdate=!0;var x=this.textHeight*c.length+2*i[1]+2*s[1];this.scale.set(x*t.width/t.height,x,0)}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(e){return d.Sprite.prototype.copy.call(this,e),this.color=e.color,this.backgroundColor=e.backgroundColor,this.padding=e.padding,this.borderWidth=e.borderWidth,this.borderColor=e.borderColor,this.fontFace=e.fontFace,this.fontSize=e.fontSize,this.fontWeight=e.fontWeight,this.strokeWidth=e.strokeWidth,this.strokeColor=e.strokeColor,this}}])&&n(r.prototype,i),t}(d.Sprite)},1515:(e,t,r)=>{"use strict";function i(e,t,r,i,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(i,n)}function n(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){function s(e){i(l,n,a,s,o,"next",e)}function o(e){i(l,n,a,s,o,"throw",e)}var l=e.apply(t,r);s(void 0)}))}}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}r.r(t),r.d(t,{ACESFilmicToneMapping:()=>ae,AddEquation:()=>L,AddOperation:()=>ee,AdditiveAnimationBlendMode:()=>Yt,AdditiveBlending:()=>S,AlphaFormat:()=>Fe,AlwaysDepth:()=>W,AlwaysStencilFunc:()=>Er,AmbientLight:()=>Uu,AmbientLightProbe:()=>ad,AnimationClip:()=>nu,AnimationLoader:()=>du,AnimationMixer:()=>Ud,AnimationObjectGroup:()=>Nd,AnimationUtils:()=>Wc,ArcCurve:()=>Ah,ArrayCamera:()=>Qo,ArrowHelper:()=>Ap,Audio:()=>vd,AudioAnalyser:()=>_d,AudioContext:()=>rd,AudioListener:()=>fd,AudioLoader:()=>id,AxesHelper:()=>Lp,AxisHelper:()=>Tm,BackSide:()=>y,BasicDepthPacking:()=>or,BasicShadowMap:()=>p,BinaryTextureLoader:()=>Cm,Bone:()=>Ul,BooleanKeyframeTrack:()=>Kc,BoundingBoxHelper:()=>Em,Box2:()=>qd,Box3:()=>pi,Box3Helper:()=>_p,BoxBufferGeometry:()=>Sa,BoxGeometry:()=>Sa,BoxHelper:()=>wp,BufferAttribute:()=>Un,BufferGeometry:()=>na,BufferGeometryLoader:()=>Wu,ByteType:()=>Le,Cache:()=>su,Camera:()=>Ra,CameraHelper:()=>yp,CanvasRenderer:()=>Im,CanvasTexture:()=>ph,CatmullRomCurve3:()=>Oh,CineonToneMapping:()=>ne,CircleBufferGeometry:()=>fh,CircleGeometry:()=>fh,ClampToEdgeWrapping:()=>fe,Clock:()=>hd,Color:()=>On,ColorKeyframeTrack:()=>Qc,CompressedTexture:()=>dh,CompressedTextureLoader:()=>pu,ConeBufferGeometry:()=>gh,ConeGeometry:()=>gh,CubeCamera:()=>Ia,CubeReflectionMapping:()=>le,CubeRefractionMapping:()=>he,CubeTexture:()=>Oa,CubeTextureLoader:()=>fu,CubeUVReflectionMapping:()=>de,CubeUVRefractionMapping:()=>pe,CubicBezierCurve:()=>Uh,CubicBezierCurve3:()=>zh,CubicInterpolant:()=>qc,CullFaceBack:()=>c,CullFaceFront:()=>u,CullFaceFrontBack:()=>d,CullFaceNone:()=>h,Curve:()=>Th,CurvePath:()=>yu,CustomBlending:()=>A,CustomToneMapping:()=>se,CylinderBufferGeometry:()=>vh,CylinderGeometry:()=>vh,Cylindrical:()=>Wd,DataTexture:()=>zl,DataTexture2DArray:()=>ls,DataTexture3D:()=>hs,DataTextureLoader:()=>vu,DataUtils:()=>Pp,DecrementStencilOp:()=>fr,DecrementWrapStencilOp:()=>gr,DefaultLoadingManager:()=>lu,DepthFormat:()=>We,DepthStencilFormat:()=>Ze,DepthTexture:()=>mh,DirectionalLight:()=>Bu,DirectionalLightHelper:()=>fp,DiscreteInterpolant:()=>Yc,DodecahedronBufferGeometry:()=>xh,DodecahedronGeometry:()=>xh,DoubleSide:()=>x,DstAlphaFactor:()=>F,DstColorFactor:()=>V,DynamicBufferAttribute:()=>fm,DynamicCopyUsage:()=>Dr,DynamicDrawUsage:()=>Lr,DynamicReadUsage:()=>Pr,EdgesGeometry:()=>Sh,EdgesHelper:()=>Am,EllipseCurve:()=>Eh,EqualDepth:()=>X,EqualStencilFunc:()=>wr,EquirectangularReflectionMapping:()=>ce,EquirectangularRefractionMapping:()=>ue,Euler:()=>Ki,EventDispatcher:()=>zr,ExtrudeBufferGeometry:()=>yc,ExtrudeGeometry:()=>yc,FaceColors:()=>nm,FileLoader:()=>uu,FlatShading:()=>b,Float16BufferAttribute:()=>Wn,Float32Attribute:()=>Mm,Float32BufferAttribute:()=>Zn,Float64Attribute:()=>Sm,Float64BufferAttribute:()=>qn,FloatType:()=>Oe,Fog:()=>ol,FogExp2:()=>sl,Font:()=>Qu,FontLoader:()=>ed,FrontSide:()=>g,Frustum:()=>Va,GLBufferAttribute:()=>Gd,GLSL1:()=>Br,GLSL3:()=>Ur,GammaEncoding:()=>tr,GreaterDepth:()=>J,GreaterEqualDepth:()=>Y,GreaterEqualStencilFunc:()=>Tr,GreaterStencilFunc:()=>Mr,GridHelper:()=>cp,Group:()=>$o,HalfFloatType:()=>De,HemisphereLight:()=>_u,HemisphereLightHelper:()=>hp,HemisphereLightProbe:()=>nd,IcosahedronBufferGeometry:()=>bc,IcosahedronGeometry:()=>bc,ImageBitmapLoader:()=>Ju,ImageLoader:()=>mu,ImageUtils:()=>ti,ImmediateRenderObject:()=>Kd,IncrementStencilOp:()=>mr,IncrementWrapStencilOp:()=>vr,InstancedBufferAttribute:()=>ju,InstancedBufferGeometry:()=>ku,InstancedInterleavedBuffer:()=>Fd,InstancedMesh:()=>Zl,Int16Attribute:()=>xm,Int16BufferAttribute:()=>Vn,Int32Attribute:()=>wm,Int32BufferAttribute:()=>kn,Int8Attribute:()=>vm,Int8BufferAttribute:()=>zn,IntType:()=>Pe,InterleavedBuffer:()=>hl,InterleavedBufferAttribute:()=>ul,Interpolant:()=>Zc,InterpolateDiscrete:()=>Ht,InterpolateLinear:()=>kt,InterpolateSmooth:()=>jt,InvertStencilOp:()=>yr,JSONLoader:()=>Om,KeepStencilOp:()=>dr,KeyframeTrack:()=>Jc,LOD:()=>Cl,LatheBufferGeometry:()=>wc,LatheGeometry:()=>wc,Layers:()=>Qi,LensFlare:()=>Nm,LessDepth:()=>Z,LessEqualDepth:()=>q,LessEqualStencilFunc:()=>_r,LessStencilFunc:()=>br,Light:()=>wu,LightProbe:()=>Gu,Line:()=>$l,Line3:()=>Jd,LineBasicMaterial:()=>ql,LineCurve:()=>Fh,LineCurve3:()=>Gh,LineDashedMaterial:()=>kc,LineLoop:()=>ih,LinePieces:()=>rm,LineSegments:()=>rh,LineStrip:()=>tm,LinearEncoding:()=>$t,LinearFilter:()=>_e,LinearInterpolant:()=>Xc,LinearMipMapLinearFilter:()=>Ee,LinearMipMapNearestFilter:()=>Se,LinearMipmapLinearFilter:()=>Te,LinearMipmapNearestFilter:()=>Me,LinearToneMapping:()=>re,Loader:()=>hu,LoaderUtils:()=>Hu,LoadingManager:()=>ou,LogLuvEncoding:()=>ir,LoopOnce:()=>Ft,LoopPingPong:()=>Vt,LoopRepeat:()=>Gt,LuminanceAlphaFormat:()=>ke,LuminanceFormat:()=>He,MOUSE:()=>o,Material:()=>En,MaterialLoader:()=>Vu,Math:()=>Qr,MathUtils:()=>Qr,Matrix3:()=>ei,Matrix4:()=>Vi,MaxEquation:()=>I,Mesh:()=>_a,MeshBasicMaterial:()=>Dn,MeshDepthMaterial:()=>jo,MeshDistanceMaterial:()=>Wo,MeshFaceMaterial:()=>sm,MeshLambertMaterial:()=>Vc,MeshMatcapMaterial:()=>Hc,MeshNormalMaterial:()=>Gc,MeshPhongMaterial:()=>zc,MeshPhysicalMaterial:()=>Uc,MeshStandardMaterial:()=>Bc,MeshToonMaterial:()=>Fc,MinEquation:()=>P,MirroredRepeatWrapping:()=>ve,MixOperation:()=>$,MultiMaterial:()=>om,MultiplyBlending:()=>E,MultiplyOperation:()=>Q,NearestFilter:()=>ge,NearestMipMapLinearFilter:()=>we,NearestMipMapNearestFilter:()=>xe,NearestMipmapLinearFilter:()=>be,NearestMipmapNearestFilter:()=>ye,NeverDepth:()=>j,NeverStencilFunc:()=>xr,NoBlending:()=>_,NoColors:()=>im,NoToneMapping:()=>te,NormalAnimationBlendMode:()=>Xt,NormalBlending:()=>M,NotEqualDepth:()=>K,NotEqualStencilFunc:()=>Sr,NumberKeyframeTrack:()=>$c,Object3D:()=>pn,ObjectLoader:()=>Zu,ObjectSpaceNormalMap:()=>cr,OctahedronBufferGeometry:()=>_c,OctahedronGeometry:()=>_c,OneFactor:()=>D,OneMinusDstAlphaFactor:()=>G,OneMinusDstColorFactor:()=>H,OneMinusSrcAlphaFactor:()=>z,OneMinusSrcColorFactor:()=>B,OrthographicCamera:()=>Du,PCFShadowMap:()=>m,PCFSoftShadowMap:()=>f,PMREMGenerator:()=>Xp,ParametricBufferGeometry:()=>Mc,ParametricGeometry:()=>Mc,Particle:()=>hm,ParticleBasicMaterial:()=>dm,ParticleSystem:()=>cm,ParticleSystemMaterial:()=>pm,Path:()=>xu,PerspectiveCamera:()=>Ca,Plane:()=>za,PlaneBufferGeometry:()=>ja,PlaneGeometry:()=>ja,PlaneHelper:()=>Mp,PointCloud:()=>lm,PointCloudMaterial:()=>um,PointLight:()=>Ou,PointLightHelper:()=>ap,Points:()=>hh,PointsMaterial:()=>nh,PolarGridHelper:()=>up,PolyhedronBufferGeometry:()=>yh,PolyhedronGeometry:()=>yh,PositionalAudio:()=>wd,PropertyBinding:()=>Dd,PropertyMixer:()=>Md,QuadraticBezierCurve:()=>Vh,QuadraticBezierCurve3:()=>Hh,Quaternion:()=>hi,QuaternionKeyframeTrack:()=>tu,QuaternionLinearInterpolant:()=>eu,REVISION:()=>s,RGBADepthPacking:()=>lr,RGBAFormat:()=>Ve,RGBAIntegerFormat:()=>Qe,RGBA_ASTC_10x10_Format:()=>wt,RGBA_ASTC_10x5_Format:()=>yt,RGBA_ASTC_10x6_Format:()=>xt,RGBA_ASTC_10x8_Format:()=>bt,RGBA_ASTC_12x10_Format:()=>_t,RGBA_ASTC_12x12_Format:()=>Mt,RGBA_ASTC_4x4_Format:()=>ct,RGBA_ASTC_5x4_Format:()=>ut,RGBA_ASTC_5x5_Format:()=>dt,RGBA_ASTC_6x5_Format:()=>pt,RGBA_ASTC_6x6_Format:()=>mt,RGBA_ASTC_8x5_Format:()=>ft,RGBA_ASTC_8x6_Format:()=>vt,RGBA_ASTC_8x8_Format:()=>gt,RGBA_BPTC_Format:()=>St,RGBA_ETC2_EAC_Format:()=>ht,RGBA_PVRTC_2BPPV1_Format:()=>st,RGBA_PVRTC_4BPPV1_Format:()=>at,RGBA_S3TC_DXT1_Format:()=>et,RGBA_S3TC_DXT3_Format:()=>tt,RGBA_S3TC_DXT5_Format:()=>rt,RGBDEncoding:()=>sr,RGBEEncoding:()=>rr,RGBEFormat:()=>je,RGBFormat:()=>Ge,RGBIntegerFormat:()=>Ke,RGBM16Encoding:()=>ar,RGBM7Encoding:()=>nr,RGB_ETC1_Format:()=>ot,RGB_ETC2_Format:()=>lt,RGB_PVRTC_2BPPV1_Format:()=>nt,RGB_PVRTC_4BPPV1_Format:()=>it,RGB_S3TC_DXT1_Format:()=>$e,RGFormat:()=>Ye,RGIntegerFormat:()=>Je,RawShaderMaterial:()=>Nc,Ray:()=>Gi,Raycaster:()=>Vd,RectAreaLight:()=>zu,RedFormat:()=>qe,RedIntegerFormat:()=>Xe,ReinhardToneMapping:()=>ie,RepeatWrapping:()=>me,ReplaceStencilOp:()=>pr,ReverseSubtractEquation:()=>C,RingBufferGeometry:()=>Sc,RingGeometry:()=>Sc,SRGB8_ALPHA8_ASTC_10x10_Format:()=>Bt,SRGB8_ALPHA8_ASTC_10x5_Format:()=>Ot,SRGB8_ALPHA8_ASTC_10x6_Format:()=>Dt,SRGB8_ALPHA8_ASTC_10x8_Format:()=>Nt,SRGB8_ALPHA8_ASTC_12x10_Format:()=>Ut,SRGB8_ALPHA8_ASTC_12x12_Format:()=>zt,SRGB8_ALPHA8_ASTC_4x4_Format:()=>Tt,SRGB8_ALPHA8_ASTC_5x4_Format:()=>Et,SRGB8_ALPHA8_ASTC_5x5_Format:()=>At,SRGB8_ALPHA8_ASTC_6x5_Format:()=>Lt,SRGB8_ALPHA8_ASTC_6x6_Format:()=>Rt,SRGB8_ALPHA8_ASTC_8x5_Format:()=>Ct,SRGB8_ALPHA8_ASTC_8x6_Format:()=>Pt,SRGB8_ALPHA8_ASTC_8x8_Format:()=>It,Scene:()=>ll,SceneUtils:()=>Dm,ShaderChunk:()=>Wa,ShaderLib:()=>qa,ShaderMaterial:()=>La,ShadowMaterial:()=>Dc,Shape:()=>bu,ShapeBufferGeometry:()=>Tc,ShapeGeometry:()=>Tc,ShapePath:()=>Ku,ShapeUtils:()=>fc,ShortType:()=>Re,Skeleton:()=>Vl,SkeletonHelper:()=>ip,SkinnedMesh:()=>Bl,SmoothShading:()=>w,Sphere:()=>Ii,SphereBufferGeometry:()=>Ec,SphereGeometry:()=>Ec,Spherical:()=>jd,SphericalHarmonics3:()=>Fu,SplineCurve:()=>kh,SpotLight:()=>Lu,SpotLightHelper:()=>$d,Sprite:()=>El,SpriteMaterial:()=>dl,SrcAlphaFactor:()=>U,SrcAlphaSaturateFactor:()=>k,SrcColorFactor:()=>N,StaticCopyUsage:()=>Or,StaticDrawUsage:()=>Ar,StaticReadUsage:()=>Cr,StereoCamera:()=>ld,StreamCopyUsage:()=>Nr,StreamDrawUsage:()=>Rr,StreamReadUsage:()=>Ir,StringKeyframeTrack:()=>ru,SubtractEquation:()=>R,SubtractiveBlending:()=>T,TOUCH:()=>l,TangentSpaceNormalMap:()=>hr,TetrahedronBufferGeometry:()=>Ac,TetrahedronGeometry:()=>Ac,TextBufferGeometry:()=>Lc,TextGeometry:()=>Lc,Texture:()=>ii,TextureLoader:()=>gu,TorusBufferGeometry:()=>Rc,TorusGeometry:()=>Rc,TorusKnotBufferGeometry:()=>Cc,TorusKnotGeometry:()=>Cc,Triangle:()=>Sn,TriangleFanDrawMode:()=>Qt,TriangleStripDrawMode:()=>Kt,TrianglesDrawMode:()=>Jt,TubeBufferGeometry:()=>Pc,TubeGeometry:()=>Pc,UVMapping:()=>oe,Uint16Attribute:()=>bm,Uint16BufferAttribute:()=>Hn,Uint32Attribute:()=>_m,Uint32BufferAttribute:()=>jn,Uint8Attribute:()=>gm,Uint8BufferAttribute:()=>Fn,Uint8ClampedAttribute:()=>ym,Uint8ClampedBufferAttribute:()=>Gn,Uniform:()=>zd,UniformsLib:()=>Za,UniformsUtils:()=>Aa,UnsignedByteType:()=>Ae,UnsignedInt248Type:()=>ze,UnsignedIntType:()=>Ie,UnsignedShort4444Type:()=>Ne,UnsignedShort5551Type:()=>Be,UnsignedShort565Type:()=>Ue,UnsignedShortType:()=>Ce,VSMShadowMap:()=>v,Vector2:()=>$r,Vector3:()=>ci,Vector4:()=>ai,VectorKeyframeTrack:()=>iu,Vertex:()=>mm,VertexColors:()=>am,VideoTexture:()=>uh,WebGL1Renderer:()=>al,WebGLCubeRenderTarget:()=>Da,WebGLMultipleRenderTargets:()=>oi,WebGLMultisampleRenderTarget:()=>li,WebGLRenderTarget:()=>si,WebGLRenderTargetCube:()=>Pm,WebGLRenderer:()=>nl,WebGLUtils:()=>Ko,WireframeGeometry:()=>Ic,WireframeHelper:()=>Lm,WrapAroundEnding:()=>qt,XHRLoader:()=>Rm,ZeroCurvatureEnding:()=>Wt,ZeroFactor:()=>O,ZeroSlopeEnding:()=>Zt,ZeroStencilOp:()=>ur,sRGBEncoding:()=>er});var s="130",o={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},l={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},h=0,c=1,u=2,d=3,p=0,m=1,f=2,v=3,g=0,y=1,x=2,b=1,w=2,_=0,M=1,S=2,T=3,E=4,A=5,L=100,R=101,C=102,P=103,I=104,O=200,D=201,N=202,B=203,U=204,z=205,F=206,G=207,V=208,H=209,k=210,j=0,W=1,Z=2,q=3,X=4,Y=5,J=6,K=7,Q=0,$=1,ee=2,te=0,re=1,ie=2,ne=3,ae=4,se=5,oe=300,le=301,he=302,ce=303,ue=304,de=306,pe=307,me=1e3,fe=1001,ve=1002,ge=1003,ye=1004,xe=1004,be=1005,we=1005,_e=1006,Me=1007,Se=1007,Te=1008,Ee=1008,Ae=1009,Le=1010,Re=1011,Ce=1012,Pe=1013,Ie=1014,Oe=1015,De=1016,Ne=1017,Be=1018,Ue=1019,ze=1020,Fe=1021,Ge=1022,Ve=1023,He=1024,ke=1025,je=Ve,We=1026,Ze=1027,qe=1028,Xe=1029,Ye=1030,Je=1031,Ke=1032,Qe=1033,$e=33776,et=33777,tt=33778,rt=33779,it=35840,nt=35841,at=35842,st=35843,ot=36196,lt=37492,ht=37496,ct=37808,ut=37809,dt=37810,pt=37811,mt=37812,ft=37813,vt=37814,gt=37815,yt=37816,xt=37817,bt=37818,wt=37819,_t=37820,Mt=37821,St=36492,Tt=37840,Et=37841,At=37842,Lt=37843,Rt=37844,Ct=37845,Pt=37846,It=37847,Ot=37848,Dt=37849,Nt=37850,Bt=37851,Ut=37852,zt=37853,Ft=2200,Gt=2201,Vt=2202,Ht=2300,kt=2301,jt=2302,Wt=2400,Zt=2401,qt=2402,Xt=2500,Yt=2501,Jt=0,Kt=1,Qt=2,$t=3e3,er=3001,tr=3007,rr=3002,ir=3003,nr=3004,ar=3005,sr=3006,or=3200,lr=3201,hr=0,cr=1,ur=0,dr=7680,pr=7681,mr=7682,fr=7683,vr=34055,gr=34056,yr=5386,xr=512,br=513,wr=514,_r=515,Mr=516,Sr=517,Tr=518,Er=519,Ar=35044,Lr=35048,Rr=35040,Cr=35045,Pr=35049,Ir=35041,Or=35046,Dr=35050,Nr=35042,Br="100",Ur="300 es";class zr{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0!==this._listeners){var r=this._listeners[e];if(void 0!==r){var i=r.indexOf(t);-1!==i&&r.splice(i,1)}}}dispatchEvent(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var r=t.slice(0),i=0,n=r.length;i<n;i++)r[i].call(this,e);e.target=null}}}}for(var Fr=[],Gr=0;256>Gr;Gr++)Fr[Gr]=(16>Gr?"0":"")+Gr.toString(16);var Vr=1234567,Hr=Math.PI/180,kr=180/Math.PI;function jr(){var e=0|4294967295*Math.random(),t=0|4294967295*Math.random(),r=0|4294967295*Math.random(),i=0|4294967295*Math.random();return(Fr[255&e]+Fr[255&e>>8]+Fr[255&e>>16]+Fr[255&e>>24]+"-"+Fr[255&t]+Fr[255&t>>8]+"-"+Fr[64|15&t>>16]+Fr[255&t>>24]+"-"+Fr[128|63&r]+Fr[255&r>>8]+"-"+Fr[255&r>>16]+Fr[255&r>>24]+Fr[255&i]+Fr[255&i>>8]+Fr[255&i>>16]+Fr[255&i>>24]).toUpperCase()}function Wr(e,t,r){return Math.max(t,Math.min(r,e))}function Zr(e,t){return(e%t+t)%t}function qr(e,t,r){return(1-r)*e+r*t}function Xr(e){return 0==(e&e-1)&&0!==e}function Yr(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Jr(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var Kr,Qr=Object.freeze({__proto__:null,DEG2RAD:Hr,RAD2DEG:kr,generateUUID:jr,clamp:Wr,euclideanModulo:Zr,mapLinear:function(e,t,r,i,n){return i+(e-t)*(n-i)/(r-t)},inverseLerp:function(e,t,r){return e===t?0:(r-e)/(t-e)},lerp:qr,damp:function(e,t,r,i){return qr(e,t,1-Math.exp(-r*i))},pingpong:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(Zr(e,2*t)-t)},smoothstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t))*e*(3-2*e)},smootherstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-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&&(Vr=e%2147483647),((Vr=16807*Vr%2147483647)-1)/2147483646},degToRad:function(e){return e*Hr},radToDeg:function(e){return e*kr},isPowerOfTwo:Xr,ceilPowerOfTwo:Yr,floorPowerOfTwo:Jr,setQuaternionFromProperEuler:function(e,t,r,i,n){var a=Math.cos,s=Math.sin,o=a(r/2),l=s(r/2),h=a((t+i)/2),c=s((t+i)/2),u=a((t-i)/2),d=s((t-i)/2),p=a((i-t)/2),m=s((i-t)/2);"XYX"===n?e.set(o*c,l*u,l*d,o*h):"YZY"===n?e.set(l*d,o*c,l*u,o*h):"ZXZ"===n?e.set(l*u,l*d,o*c,o*h):"XZX"===n?e.set(o*c,l*m,l*p,o*h):"YXY"===n?e.set(l*p,o*c,l*m,o*h):"ZYZ"===n?e.set(l*m,l*p,o*c,o*h):console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}});class $r{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return void 0===t?(this.x+=e.x,this.y+=e.y,this):(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t))}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return void 0===t?(this.x-=e.x,this.y-=e.y,this):(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t))}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){var t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,r){return void 0!==r&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){var r=Math.cos(t),i=Math.sin(t),n=this.x-e.x,a=this.y-e.y;return this.x=n*r-a*i+e.x,this.y=n*i+a*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}$r.prototype.isVector2=!0;class ei{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,r,i,n,a,s,o,l){var h=this.elements;return h[0]=e,h[1]=i,h[2]=s,h[3]=t,h[4]=n,h[5]=o,h[6]=r,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){var t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){var r=e.elements,i=t.elements,n=this.elements,a=r[0],s=r[3],o=r[6],l=r[1],h=r[4],c=r[7],u=r[2],d=r[5],p=r[8],m=i[0],f=i[3],v=i[6],g=i[1],y=i[4],x=i[7],b=i[2],w=i[5],_=i[8];return n[0]=a*m+s*g+o*b,n[3]=a*f+s*y+o*w,n[6]=a*v+s*x+o*_,n[1]=l*m+h*g+c*b,n[4]=l*f+h*y+c*w,n[7]=l*v+h*x+c*_,n[2]=u*m+d*g+p*b,n[5]=u*f+d*y+p*w,n[8]=u*v+d*x+p*_,this}multiplyScalar(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){var e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8];return t*a*h-t*s*l-r*n*h+r*s*o+i*n*l-i*a*o}invert(){var e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],c=h*a-s*l,u=s*o-h*n,d=l*n-a*o,p=t*c+r*u+i*d;if(0==p)return this.set(0,0,0,0,0,0,0,0,0);var m=1/p;return e[0]=c*m,e[1]=(i*l-h*r)*m,e[2]=(s*r-i*a)*m,e[3]=u*m,e[4]=(h*t-i*o)*m,e[5]=(i*n-s*t)*m,e[6]=d*m,e[7]=(r*o-l*t)*m,e[8]=(a*t-r*n)*m,this}transpose(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,i,n,a,s){var o=Math.cos(n),l=Math.sin(n);return this.set(r*o,r*l,-r*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){var r=this.elements;return r[0]*=e,r[3]*=e,r[6]*=e,r[1]*=t,r[4]*=t,r[7]*=t,this}rotate(e){var t=Math.cos(e),r=Math.sin(e),i=this.elements,n=i[0],a=i[3],s=i[6],o=i[1],l=i[4],h=i[7];return i[0]=t*n+r*o,i[3]=t*a+r*l,i[6]=t*s+r*h,i[1]=-r*n+t*o,i[4]=-r*a+t*l,i[7]=-r*s+t*h,this}translate(e,t){var r=this.elements;return r[0]+=e*r[2],r[3]+=e*r[5],r[6]+=e*r[8],r[1]+=t*r[2],r[4]+=t*r[5],r[7]+=t*r[8],this}equals(e){for(var t=this.elements,r=e.elements,i=0;9>i;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=0;9>r;r++)this.elements[r]=e[r+t];return this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}ei.prototype.isMatrix3=!0;class ti{static getDataURL(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===Kr&&(Kr=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Kr.width=e.width,Kr.height=e.height;var r=Kr.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=Kr}return 2048<t.width||2048<t.height?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}}var ri=0;class ii extends zr{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:ii.DEFAULT_IMAGE,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:ii.DEFAULT_MAPPING,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:fe,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:fe,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:_e,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:Te,s=6<arguments.length&&void 0!==arguments[6]?arguments[6]:Ve,o=7<arguments.length&&void 0!==arguments[7]?arguments[7]:Ae,l=8<arguments.length&&void 0!==arguments[8]?arguments[8]:1,h=9<arguments.length&&void 0!==arguments[9]?arguments[9]:$t;super(),Object.defineProperty(this,"id",{value:ri++}),this.uuid=jr(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=r,this.wrapT=i,this.magFilter=n,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new $r(0,0),this.repeat=new $r(1,1),this.center=new $r(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ei,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(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(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var r={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=jr()),!t&&void 0===e.images[i.uuid]){var n;if(Array.isArray(i)){n=[];for(var a=0,s=i.length;a<s;a++)i[a].isDataTexture?n.push(ni(i[a].image)):n.push(ni(i[a]))}else n=ni(i);e.images[i.uuid]={uuid:i.uuid,url:n}}r.image=i.uuid}return t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==oe)return e;if(e.applyMatrix3(this.matrix),0>e.x||1<e.x)switch(this.wrapS){case me:e.x-=Math.floor(e.x);break;case fe:e.x=0>e.x?0:1;break;case ve:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(0>e.y||1<e.y)switch(this.wrapT){case me:e.y-=Math.floor(e.y);break;case fe:e.y=0>e.y?0:1;break;case ve:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&this.version++}}function ni(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?ti.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}ii.DEFAULT_IMAGE=void 0,ii.DEFAULT_MAPPING=oe,ii.prototype.isTexture=!0;class ai{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0===e.w?1:e.w,this}add(e,t){return void 0===t?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this):(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t))}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return void 0===t?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this):(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t))}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(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}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){var t=this.x,r=this.y,i=this.z,n=this.w,a=e.elements;return this.x=a[0]*t+a[4]*r+a[8]*i+a[12]*n,this.y=a[1]*t+a[5]*r+a[9]*i+a[13]*n,this.z=a[2]*t+a[6]*r+a[10]*i+a[14]*n,this.w=a[3]*t+a[7]*r+a[11]*i+a[15]*n,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){var t,r,i,n,a=.01,s=.1,o=e.elements,l=o[0],h=o[4],c=o[8],u=o[1],d=o[5],p=o[9],m=o[2],f=o[6],v=o[10];if(Math.abs(h-u)<a&&Math.abs(c-m)<a&&Math.abs(p-f)<a){if(Math.abs(h+u)<s&&Math.abs(c+m)<s&&Math.abs(p+f)<s&&Math.abs(l+d+v-3)<s)return this.set(1,0,0,0),this;t=Math.PI;var g=(l+1)/2,y=(d+1)/2,x=(v+1)/2,b=(h+u)/4,w=(c+m)/4,_=(p+f)/4;return g>y&&g>x?g<a?(r=0,i=.707106781,n=.707106781):(i=b/(r=Math.sqrt(g)),n=w/r):y>x?y<a?(r=.707106781,i=0,n=.707106781):(r=b/(i=Math.sqrt(y)),n=_/i):x<a?(r=.707106781,i=.707106781,n=0):(r=w/(n=Math.sqrt(x)),i=_/n),this.set(r,i,n,t),this}var M=Math.sqrt((f-p)*(f-p)+(c-m)*(c-m)+(u-h)*(u-h));return.001>Math.abs(M)&&(M=1),this.x=(f-p)/M,this.y=(c-m)/M,this.z=(u-h)/M,this.w=Math.acos((l+d+v-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t,r){return void 0!==r&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}ai.prototype.isVector4=!0;class si extends zr{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};super(),this.width=e,this.height=t,this.depth=1,this.scissor=new ai(0,0,e,t),this.scissorTest=!1,this.viewport=new ai(0,0,e,t),this.texture=new ii(void 0,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.image={width:e,height:t,depth:1},this.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,this.texture.minFilter=void 0===r.minFilter?_e:r.minFilter,this.depthBuffer=!(void 0!==r.depthBuffer)||r.depthBuffer,this.stencilBuffer=void 0!==r.stencilBuffer&&r.stencilBuffer,this.depthTexture=void 0===r.depthTexture?null:r.depthTexture}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.image=function(e){for(var t,r=1;r<arguments.length;r++)t=null==arguments[r]?{}:arguments[r],r%2?a(Object(t),!0).forEach((function(r){var i,n,a;i=e,n=r,a=t[r],n=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(n),n in i?Object.defineProperty(i,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[n]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}));return e}({},this.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}si.prototype.isWebGLRenderTarget=!0;class oi extends si{constructor(e,t,r){super(e,t);var i=this.texture;this.texture=[];for(var n=0;n<r;n++)this.texture[n]=i.clone()}setSize(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(var i=0,n=this.texture.length;i<n;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=r;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this.texture.length=0;for(var t=0,r=e.texture.length;t<r;t++)this.texture[t]=e.texture[t].clone();return this}}oi.prototype.isWebGLMultipleRenderTargets=!0;class li extends si{constructor(e,t,r){super(e,t,r),this.samples=4}copy(e){return super.copy.call(this,e),this.samples=e.samples,this}}li.prototype.isWebGLMultisampleRenderTarget=!0;class hi{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;this._x=e,this._y=t,this._z=r,this._w=i}static slerp(e,t,r,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),r.slerpQuaternions(e,t,i)}static slerpFlat(e,t,r,i,n,a,s){var o=r[i+0],l=r[i+1],h=r[i+2],c=r[i+3],u=n[a+0],d=n[a+1],p=n[a+2],m=n[a+3];if(0===s)return e[t+0]=o,e[t+1]=l,e[t+2]=h,void(e[t+3]=c);if(1===s)return e[t+0]=u,e[t+1]=d,e[t+2]=p,void(e[t+3]=m);if(c!==m||o!==u||l!==d||h!==p){var f=1-s,v=o*u+l*d+h*p+c*m,g=0<=v?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);f=Math.sin(f*b)/x,s=Math.sin(s*b)/x}var w=s*g;if(o=o*f+u*w,l=l*f+d*w,h=h*f+p*w,c=c*f+m*w,f==1-s){var _=1/Math.sqrt(o*o+l*l+h*h+c*c);o*=_,l*=_,h*=_,c*=_}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=c}static multiplyQuaternionsFlat(e,t,r,i,n,a){var s=r[i],o=r[i+1],l=r[i+2],h=r[i+3],c=n[a],u=n[a+1],d=n[a+2],p=n[a+3];return e[t]=s*p+h*c+o*d-l*u,e[t+1]=o*p+h*u+l*c-s*d,e[t+2]=l*p+h*d+s*u-o*c,e[t+3]=h*p-s*c-o*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var r=e._x,i=e._y,n=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(r/2),h=s(i/2),c=s(n/2),u=o(r/2),d=o(i/2),p=o(n/2);return"XYZ"===a?(this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p):"YXZ"===a?(this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p):"ZXY"===a?(this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p):"ZYX"===a?(this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p):"YZX"===a?(this._x=u*h*c+l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c-u*d*p):"XZY"===a?(this._x=u*h*c-l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c+u*d*p):console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a),!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){var r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){var t=e.elements,r=t[0],i=t[4],n=t[8],a=t[1],s=t[5],o=t[9],l=t[2],h=t[6],c=t[10],u=r+s+c;if(0<u){var d=.5/Math.sqrt(u+1);this._w=.25/d,this._x=(h-o)*d,this._y=(n-l)*d,this._z=(a-i)*d}else if(r>s&&r>c){var p=2*Math.sqrt(1+r-s-c);this._w=(h-o)/p,this._x=.25*p,this._y=(i+a)/p,this._z=(n+l)/p}else if(s>c){var m=2*Math.sqrt(1+s-r-c);this._w=(n-l)/m,this._x=(i+a)/m,this._y=.25*m,this._z=(o+h)/m}else{var f=2*Math.sqrt(1+c-r-s);this._w=(a-i)/f,this._x=(n+l)/f,this._y=(o+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){var r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(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=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Wr(this.dot(e),-1,1)))}rotateTowards(e,t){var r=this.angleTo(e);if(0===r)return this;var i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e,t){return void 0===t?this.multiplyQuaternions(this,e):(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t))}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){var r=e._x,i=e._y,n=e._z,a=e._w,s=t._x,o=t._y,l=t._z,h=t._w;return this._x=r*h+a*s+i*l-n*o,this._y=i*h+a*o+n*s-r*l,this._z=n*h+a*l+r*o-i*s,this._w=a*h-r*s-i*o-n*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,i=this._y,n=this._z,a=this._w,s=a*e._w+r*e._x+i*e._y+n*e._z;if(0>s?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),1<=s)return this._w=a,this._x=r,this._y=i,this._z=n,this;var o=1-s*s;if(o<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*r+t*this._x,this._y=l*i+t*this._y,this._z=l*n+t*this._z,this.normalize(),this._onChangeCallback(),this}var h=Math.sqrt(o),c=Math.atan2(h,s),u=Math.sin((1-t)*c)/h,d=Math.sin(t*c)/h;return this._w=a*u+this._w*d,this._x=r*u+this._x*d,this._y=i*u+this._y*d,this._z=n*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,r){this.copy(e).slerp(t,r)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}hi.prototype.isQuaternion=!0;class ci{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;this.x=e,this.y=t,this.z=r}set(e,t,r){return void 0===r&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return void 0===t?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this):(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t))}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return void 0===t?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this):(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t))}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return void 0===t?(this.x*=e.x,this.y*=e.y,this.z*=e.z,this):(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t))}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(di.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(di.setFromAxisAngle(e,t))}applyMatrix3(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6]*i,this.y=n[1]*t+n[4]*r+n[7]*i,this.z=n[2]*t+n[5]*r+n[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){var t=this.x,r=this.y,i=this.z,n=e.elements,a=1/(n[3]*t+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*t+n[4]*r+n[8]*i+n[12])*a,this.y=(n[1]*t+n[5]*r+n[9]*i+n[13])*a,this.z=(n[2]*t+n[6]*r+n[10]*i+n[14])*a,this}applyQuaternion(e){var t=this.x,r=this.y,i=this.z,n=e.x,a=e.y,s=e.z,o=e.w,l=o*t+a*i-s*r,h=o*r+s*t-n*i,c=o*i+n*r-a*t,u=-n*t-a*r-s*i;return this.x=l*o+u*-n+h*-s-c*-a,this.y=h*o+u*-a+c*-n-l*-s,this.z=c*o+u*-s+l*-a-h*-n,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i,this.y=n[1]*t+n[5]*r+n[9]*i,this.z=n[2]*t+n[6]*r+n[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e,t){return void 0===t?this.crossVectors(this,e):(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t))}crossVectors(e,t){var r=e.x,i=e.y,n=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-n*s,this.y=n*a-r*o,this.z=r*s-i*a,this}projectOnVector(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return ui.copy(this).projectOnVector(e),this.sub(ui)}reflect(e){return this.sub(ui.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var r=this.dot(e)/t;return Math.acos(Wr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){var t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){var i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){var t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,r){return void 0!==r&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}ci.prototype.isVector3=!0;var ui=new ci,di=new hi;class pi{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci(1/0,1/0,1/0),t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci(-1/0,-1/0,-1/0);this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){for(var t=1/0,r=1/0,i=1/0,n=-1/0,a=-1/0,s=-1/0,o=0,l=e.length;o<l;o+=3){var h=e[o],c=e[o+1],u=e[o+2];h<t&&(t=h),c<r&&(r=c),u<i&&(i=u),h>n&&(n=h),c>a&&(a=c),u>s&&(s=u)}return this.min.set(t,r,i),this.max.set(n,a,s),this}setFromBufferAttribute(e){for(var t=1/0,r=1/0,i=1/0,n=-1/0,a=-1/0,s=-1/0,o=0,l=e.count;o<l;o++){var h=e.getX(o),c=e.getY(o),u=e.getZ(o);h<t&&(t=h),c<r&&(r=c),u<i&&(i=u),h>n&&(n=h),c>a&&(a=c),u>s&&(s=u)}return this.min.set(t,r,i),this.max.set(n,a,s),this}setFromPoints(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){var r=fi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e){return this.makeEmpty(),this.expandByObject(e)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),vi.copy(t.boundingBox),vi.applyMatrix4(e.matrixWorld),this.union(vi));for(var r=e.children,i=0,n=r.length;i<n;i++)this.expandByObject(r[i]);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,fi),fi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){var t,r;return 0<e.normal.x?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),0<e.normal.y?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),0<e.normal.z?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Mi),Si.subVectors(this.max,Mi),gi.subVectors(e.a,Mi),yi.subVectors(e.b,Mi),xi.subVectors(e.c,Mi),bi.subVectors(yi,gi),wi.subVectors(xi,yi),_i.subVectors(gi,xi);var t=[0,-bi.z,bi.y,0,-wi.z,wi.y,0,-_i.z,_i.y,bi.z,0,-bi.x,wi.z,0,-wi.x,_i.z,0,-_i.x,-bi.y,bi.x,0,-wi.y,wi.x,0,-_i.y,_i.x,0];return!!Ai(t,gi,yi,xi,Si)&&!!Ai(t=[1,0,0,0,1,0,0,0,1],gi,yi,xi,Si)&&(Ti.crossVectors(bi,wi),Ai(t=[Ti.x,Ti.y,Ti.z],gi,yi,xi,Si))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return fi.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(fi).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(mi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),mi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),mi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),mi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),mi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),mi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),mi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),mi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(mi)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}pi.prototype.isBox3=!0;var mi=[new ci,new ci,new ci,new ci,new ci,new ci,new ci,new ci],fi=new ci,vi=new pi,gi=new ci,yi=new ci,xi=new ci,bi=new ci,wi=new ci,_i=new ci,Mi=new ci,Si=new ci,Ti=new ci,Ei=new ci;function Ai(e,t,r,i,n){for(var a=0,s=e.length-3;a<=s;a+=3){Ei.fromArray(e,a);var o=n.x*Math.abs(Ei.x)+n.y*Math.abs(Ei.y)+n.z*Math.abs(Ei.z),l=t.dot(Ei),h=r.dot(Ei),c=i.dot(Ei);if(Math.max(-Math.max(l,h,c),Math.min(l,h,c))>o)return!1}return!0}var Li=new pi,Ri=new ci,Ci=new ci,Pi=new ci;class Ii{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1;this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){var r=this.center;void 0===t?Li.setFromPoints(e).getCenter(r):r.copy(t);for(var i=0,n=0,a=e.length;n<a;n++)i=Math.max(i,r.distanceToSquared(e[n]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return 0>this.radius}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){var r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Pi.subVectors(e,this.center);var t=Pi.lengthSq();if(t>this.radius*this.radius){var r=Math.sqrt(t),i=.5*(r-this.radius);this.center.add(Pi.multiplyScalar(i/r)),this.radius+=i}return this}union(e){return Ci.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Ri.copy(e.center).add(Ci)),this.expandByPoint(Ri.copy(e.center).sub(Ci)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}var Oi=new ci,Di=new ci,Ni=new ci,Bi=new ci,Ui=new ci,zi=new ci,Fi=new ci;class Gi{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci(0,0,-1);this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Oi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);var r=t.dot(this.direction);return 0>r?t.copy(this.origin):t.copy(this.direction).multiplyScalar(r).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){var t=Oi.subVectors(e,this.origin).dot(this.direction);return 0>t?this.origin.distanceToSquared(e):(Oi.copy(this.direction).multiplyScalar(t).add(this.origin),Oi.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){Di.copy(e).add(t).multiplyScalar(.5),Ni.copy(t).sub(e).normalize(),Bi.copy(this.origin).sub(Di);var n,a,s,o,l=.5*e.distanceTo(t),h=-this.direction.dot(Ni),c=Bi.dot(this.direction),u=-Bi.dot(Ni),d=Bi.lengthSq(),p=Math.abs(1-h*h);if(0<p)if(a=h*c-u,o=l*p,0<=(n=h*u-c))if(a>=-o)if(a<=o){var m=1/p;s=(n*=m)*(n+h*(a*=m)+2*c)+a*(h*n+a+2*u)+d}else a=l,s=-(n=Math.max(0,-(h*a+c)))*n+a*(a+2*u)+d;else a=-l,s=-(n=Math.max(0,-(h*a+c)))*n+a*(a+2*u)+d;else a<=-o?s=-(n=Math.max(0,-(-h*l+c)))*n+(a=0<n?-l:Math.min(Math.max(-l,-u),l))*(a+2*u)+d:a<=o?(n=0,s=(a=Math.min(Math.max(-l,-u),l))*(a+2*u)+d):s=-(n=Math.max(0,-(h*l+c)))*n+(a=0<n?l:Math.min(Math.max(-l,-u),l))*(a+2*u)+d;else a=0<h?-l:l,s=-(n=Math.max(0,-(h*a+c)))*n+a*(a+2*u)+d;return r&&r.copy(this.direction).multiplyScalar(n).add(this.origin),i&&i.copy(Ni).multiplyScalar(a).add(Di),s}intersectSphere(e,t){Oi.subVectors(e.center,this.origin);var r=Oi.dot(this.direction),i=Oi.dot(Oi)-r*r,n=e.radius*e.radius;if(i>n)return null;var a=Math.sqrt(n-i),s=r-a,o=r+a;return 0>s&&0>o?null:0>s?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(e.normal)+e.constant)/t;return 0<=r?r:null}intersectPlane(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)}intersectsPlane(e){var t=e.distanceToPoint(this.origin);return 0===t||!!(0>e.normal.dot(this.direction)*t)}intersectBox(e,t){var r,i,n,a,s,o,l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,u=this.origin;return 0<=l?(r=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l):(r=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l),0<=h?(n=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(n=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),r>a||n>i?null:((n>r||r!=r)&&(r=n),(a<i||i!=i)&&(i=a),0<=c?(s=(e.min.z-u.z)*c,o=(e.max.z-u.z)*c):(s=(e.max.z-u.z)*c,o=(e.min.z-u.z)*c),r>o||s>i?null:((s>r||r!=r)&&(r=s),(o<i||i!=i)&&(i=o),0>i?null:this.at(0<=r?r:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Oi)}intersectTriangle(e,t,r,i,n){Ui.subVectors(t,e),zi.subVectors(r,e),Fi.crossVectors(Ui,zi);var a,s=this.direction.dot(Fi);if(0<s){if(i)return null;a=1}else{if(!(0>s))return null;a=-1,s=-s}Bi.subVectors(this.origin,e);var o=a*this.direction.dot(zi.crossVectors(Bi,zi));if(0>o)return null;var l=a*this.direction.dot(Ui.cross(Bi));if(0>l)return null;if(o+l>s)return null;var h=-a*Bi.dot(Fi);return 0>h?null:this.at(h/s,n)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Vi{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,r,i,n,a,s,o,l,h,c,u,d,p,m,f){var v=this.elements;return v[0]=e,v[4]=t,v[8]=r,v[12]=i,v[1]=n,v[5]=a,v[9]=s,v[13]=o,v[2]=l,v[6]=h,v[10]=c,v[14]=u,v[3]=d,v[7]=p,v[11]=m,v[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Vi).fromArray(this.elements)}copy(e){var t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){var t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){var t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){var t=this.elements,r=e.elements,i=1/Hi.setFromMatrixColumn(e,0).length(),n=1/Hi.setFromMatrixColumn(e,1).length(),a=1/Hi.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*n,t[5]=r[5]*n,t[6]=r[6]*n,t[7]=0,t[8]=r[8]*a,t[9]=r[9]*a,t[10]=r[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,i=e.y,n=e.z,a=Math.cos(r),s=Math.sin(r),o=Math.cos(i),l=Math.sin(i),h=Math.cos(n),c=Math.sin(n);if("XYZ"===e.order){var u=a*h,d=a*c,p=s*h,m=s*c;t[0]=o*h,t[4]=-o*c,t[8]=l,t[1]=d+p*l,t[5]=u-m*l,t[9]=-s*o,t[2]=m-u*l,t[6]=p+d*l,t[10]=a*o}else if("YXZ"===e.order){var f=o*h,v=o*c,g=l*h,y=l*c;t[0]=f+y*s,t[4]=g*s-v,t[8]=a*l,t[1]=a*c,t[5]=a*h,t[9]=-s,t[2]=v*s-g,t[6]=y+f*s,t[10]=a*o}else if("ZXY"===e.order){var x=o*h,b=o*c,w=l*h,_=l*c;t[0]=x-_*s,t[4]=-a*c,t[8]=w+b*s,t[1]=b+w*s,t[5]=a*h,t[9]=_-x*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){var M=a*h,S=a*c,T=s*h,E=s*c;t[0]=o*h,t[4]=T*l-S,t[8]=M*l+E,t[1]=o*c,t[5]=E*l+M,t[9]=S*l-T,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){var A=a*o,L=a*l,R=s*o,C=s*l;t[0]=o*h,t[4]=C-A*c,t[8]=R*c+L,t[1]=c,t[5]=a*h,t[9]=-s*h,t[2]=-l*h,t[6]=L*c+R,t[10]=A-C*c}else if("XZY"===e.order){var P=a*o,I=a*l,O=s*o,D=s*l;t[0]=o*h,t[4]=-c,t[8]=l*h,t[1]=P*c+D,t[5]=a*h,t[9]=I*c-O,t[2]=O*c-I,t[6]=s*h,t[10]=D*c+P}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ji,e,Wi)}lookAt(e,t,r){var i=this.elements;return Xi.subVectors(e,t),0===Xi.lengthSq()&&(Xi.z=1),Xi.normalize(),Zi.crossVectors(r,Xi),0===Zi.lengthSq()&&(1===Math.abs(r.z)?Xi.x+=1e-4:Xi.z+=1e-4,Xi.normalize(),Zi.crossVectors(r,Xi)),Zi.normalize(),qi.crossVectors(Xi,Zi),i[0]=Zi.x,i[4]=qi.x,i[8]=Xi.x,i[1]=Zi.y,i[5]=qi.y,i[9]=Xi.y,i[2]=Zi.z,i[6]=qi.z,i[10]=Xi.z,this}multiply(e,t){return void 0===t?this.multiplyMatrices(this,e):(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t))}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){var r=e.elements,i=t.elements,n=this.elements,a=r[0],s=r[4],o=r[8],l=r[12],h=r[1],c=r[5],u=r[9],d=r[13],p=r[2],m=r[6],f=r[10],v=r[14],g=r[3],y=r[7],x=r[11],b=r[15],w=i[0],_=i[4],M=i[8],S=i[12],T=i[1],E=i[5],A=i[9],L=i[13],R=i[2],C=i[6],P=i[10],I=i[14],O=i[3],D=i[7],N=i[11],B=i[15];return n[0]=a*w+s*T+o*R+l*O,n[4]=a*_+s*E+o*C+l*D,n[8]=a*M+s*A+o*P+l*N,n[12]=a*S+s*L+o*I+l*B,n[1]=h*w+c*T+u*R+d*O,n[5]=h*_+c*E+u*C+d*D,n[9]=h*M+c*A+u*P+d*N,n[13]=h*S+c*L+u*I+d*B,n[2]=p*w+m*T+f*R+v*O,n[6]=p*_+m*E+f*C+v*D,n[10]=p*M+m*A+f*P+v*N,n[14]=p*S+m*L+f*I+v*B,n[3]=g*w+y*T+x*R+b*O,n[7]=g*_+y*E+x*C+b*D,n[11]=g*M+y*A+x*P+b*N,n[15]=g*S+y*L+x*I+b*B,this}multiplyScalar(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){var e=this.elements,t=e[0],r=e[4],i=e[8],n=e[12],a=e[1],s=e[5],o=e[9],l=e[13],h=e[2],c=e[6],u=e[10],d=e[14];return e[3]*(+n*o*c-i*l*c-n*s*u+r*l*u+i*s*d-r*o*d)+e[7]*(+t*o*d-t*l*u+n*a*u-i*a*d+i*l*h-n*o*h)+e[11]*(+t*l*c-t*s*d-n*a*c+r*a*d+n*s*h-r*l*h)+e[15]*(-i*s*h-t*o*c+t*s*u+i*a*c-r*a*u+r*o*h)}transpose(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,r){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]=r),this}invert(){var e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=e[11],p=e[12],m=e[13],f=e[14],v=e[15],g=c*f*l-m*u*l+m*o*d-s*f*d-c*o*v+s*u*v,y=p*u*l-h*f*l-p*o*d+a*f*d+h*o*v-a*u*v,x=h*m*l-p*c*l+p*s*d-a*m*d-h*s*v+a*c*v,b=p*c*o-h*m*o-p*s*u+a*m*u+h*s*f-a*c*f,w=t*g+r*y+i*x+n*b;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var _=1/w;return e[0]=g*_,e[1]=(m*u*n-c*f*n-m*i*d+r*f*d+c*i*v-r*u*v)*_,e[2]=(s*f*n-m*o*n+m*i*l-r*f*l-s*i*v+r*o*v)*_,e[3]=(c*o*n-s*u*n-c*i*l+r*u*l+s*i*d-r*o*d)*_,e[4]=y*_,e[5]=(h*f*n-p*u*n+p*i*d-t*f*d-h*i*v+t*u*v)*_,e[6]=(p*o*n-a*f*n-p*i*l+t*f*l+a*i*v-t*o*v)*_,e[7]=(a*u*n-h*o*n+h*i*l-t*u*l-a*i*d+t*o*d)*_,e[8]=x*_,e[9]=(p*c*n-h*m*n-p*r*d+t*m*d+h*r*v-t*c*v)*_,e[10]=(a*m*n-p*s*n+p*r*l-t*m*l-a*r*v+t*s*v)*_,e[11]=(h*s*n-a*c*n-h*r*l+t*c*l+a*r*d-t*s*d)*_,e[12]=b*_,e[13]=(h*m*i-p*c*i+p*r*u-t*m*u-h*r*f+t*c*f)*_,e[14]=(p*s*i-a*m*i-p*r*o+t*m*o+a*r*f-t*s*f)*_,e[15]=(a*c*i-h*s*i+h*r*o-t*c*o-a*r*u+t*s*u)*_,this}scale(e){var t=this.elements,r=e.x,i=e.y,n=e.z;return t[0]*=r,t[4]*=i,t[8]*=n,t[1]*=r,t[5]*=i,t[9]*=n,t[2]*=r,t[6]*=i,t[10]*=n,t[3]*=r,t[7]*=i,t[11]*=n,this}getMaxScaleOnAxis(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=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,r,i))}makeTranslation(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){var t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){var r=Math.cos(t),i=Math.sin(t),n=1-r,a=e.x,s=e.y,o=e.z,l=n*a,h=n*s;return this.set(l*a+r,l*s-i*o,l*o+i*s,0,l*s+i*o,h*s+r,h*o-i*a,0,l*o-i*s,h*o+i*a,n*o*o+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,n,a){return this.set(1,r,n,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){var i=this.elements,n=t._x,a=t._y,s=t._z,o=t._w,l=n+n,h=a+a,c=s+s,u=n*l,d=n*h,p=n*c,m=a*h,f=a*c,v=s*c,g=o*l,y=o*h,x=o*c,b=r.x,w=r.y,_=r.z;return i[0]=(1-(m+v))*b,i[1]=(d+x)*b,i[2]=(p-y)*b,i[3]=0,i[4]=(d-x)*w,i[5]=(1-(u+v))*w,i[6]=(f+g)*w,i[7]=0,i[8]=(p+y)*_,i[9]=(f-g)*_,i[10]=(1-(u+m))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){var i=this.elements,n=Hi.set(i[0],i[1],i[2]).length(),a=Hi.set(i[4],i[5],i[6]).length(),s=Hi.set(i[8],i[9],i[10]).length();0>this.determinant()&&(n=-n),e.x=i[12],e.y=i[13],e.z=i[14],ki.copy(this);var o=1/n,l=1/a,h=1/s;return ki.elements[0]*=o,ki.elements[1]*=o,ki.elements[2]*=o,ki.elements[4]*=l,ki.elements[5]*=l,ki.elements[6]*=l,ki.elements[8]*=h,ki.elements[9]*=h,ki.elements[10]*=h,t.setFromRotationMatrix(ki),r.x=n,r.y=a,r.z=s,this}makePerspective(e,t,r,i,n,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var s=this.elements;return s[0]=2*n/(t-e),s[4]=0,s[8]=(t+e)/(t-e),s[12]=0,s[1]=0,s[5]=2*n/(r-i),s[9]=(r+i)/(r-i),s[13]=0,s[2]=0,s[6]=0,s[10]=-(a+n)/(a-n),s[14]=-2*a*n/(a-n),s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,r,i,n,a){var s=this.elements,o=1/(t-e),l=1/(r-i),h=1/(a-n);return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-(t+e)*o,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-(r+i)*l,s[2]=0,s[6]=0,s[10]=-2*h,s[14]=-(a+n)*h,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){for(var t=this.elements,r=e.elements,i=0;16>i;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=0;16>r;r++)this.elements[r]=e[r+t];return this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}Vi.prototype.isMatrix4=!0;var Hi=new ci,ki=new Vi,ji=new ci(0,0,0),Wi=new ci(1,1,1),Zi=new ci,qi=new ci,Xi=new ci,Yi=new Vi,Ji=new hi;class Ki{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:Ki.DefaultOrder;this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this._order,r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],i=e.elements,n=i[0],a=i[4],s=i[8],o=i[1],l=i[5],h=i[9],c=i[2],u=i[6],d=i[10];return"XYZ"===t?(this._y=Math.asin(Wr(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,n)):(this._x=Math.atan2(u,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-Wr(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,n),this._z=0)):"ZXY"===t?(this._x=Math.asin(Wr(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,n))):"ZYX"===t?(this._y=Math.asin(-Wr(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,n)):(this._x=0,this._z=Math.atan2(-a,l))):"YZX"===t?(this._z=Math.asin(Wr(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-c,n)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===t?(this._z=Math.asin(-Wr(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(u,l),this._y=Math.atan2(s,n)):(this._x=Math.atan2(-h,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t),this._order=t,!0===r&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return Yi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Yi,t,r)}setFromVector3(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}reorder(e){return Ji.setFromEuler(this),this.setFromQuaternion(Ji,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new ci(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Ki.prototype.isEuler=!0,Ki.DefaultOrder="XYZ",Ki.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Qi{constructor(){this.mask=1}set(e){this.mask=0|1<<e}enable(e){this.mask|=0|1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=0|1<<e}disable(e){this.mask&=~(0|1<<e)}disableAll(){this.mask=0}test(e){return 0!=(this.mask&e.mask)}}var $i=0,en=new ci,tn=new hi,rn=new Vi,nn=new ci,an=new ci,sn=new ci,on=new hi,ln=new ci(1,0,0),hn=new ci(0,1,0),cn=new ci(0,0,1),un={type:"added"},dn={type:"removed"};class pn extends zr{constructor(){super(),Object.defineProperty(this,"id",{value:$i++}),this.uuid=jr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=pn.DefaultUp.clone();var e=new ci,t=new Ki,r=new hi,i=new ci(1,1,1);t._onChange((function(){r.setFromEuler(t,!1)})),r._onChange((function(){t.setFromQuaternion(r,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:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Vi},normalMatrix:{value:new ei}}),this.matrix=new Vi,this.matrixWorld=new Vi,this.matrixAutoUpdate=pn.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Qi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return tn.setFromAxisAngle(e,t),this.quaternion.multiply(tn),this}rotateOnWorldAxis(e,t){return tn.setFromAxisAngle(e,t),this.quaternion.premultiply(tn),this}rotateX(e){return this.rotateOnAxis(ln,e)}rotateY(e){return this.rotateOnAxis(hn,e)}rotateZ(e){return this.rotateOnAxis(cn,e)}translateOnAxis(e,t){return en.copy(e).applyQuaternion(this.quaternion),this.position.add(en.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ln,e)}translateY(e){return this.translateOnAxis(hn,e)}translateZ(e){return this.translateOnAxis(cn,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(rn.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?nn.copy(e):nn.set(e,t,r);var i=this.parent;this.updateWorldMatrix(!0,!1),an.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?rn.lookAt(an,nn,this.up):rn.lookAt(nn,an,this.up),this.quaternion.setFromRotationMatrix(rn),i&&(rn.extractRotation(i.matrixWorld),tn.setFromRotationMatrix(rn),this.quaternion.premultiply(tn.invert()))}add(e){if(1<arguments.length){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(un)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var r=this.children.indexOf(e);return-1!==r&&(e.parent=null,this.children.splice(r,1),e.dispatchEvent(dn)),this}removeFromParent(){var e=this.parent;return null!==e&&e.remove(this),this}clear(){for(var e,t=0;t<this.children.length;t++)(e=this.children[t]).parent=null,e.dispatchEvent(dn);return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),rn.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),rn.multiply(e.parent.matrixWorld)),e.applyMatrix4(rn),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(var r=0,i=this.children.length;r<i;r++){var n=this.children[r].getObjectByProperty(e,t);if(void 0!==n)return n}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(an,e,sn),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(an,on,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);for(var t=this.children,r=0,i=t.length;r<i;r++)t[r].traverse(e)}traverseVisible(e){if(!1!==this.visible){e(this);for(var t=this.children,r=0,i=t.length;r<i;r++)t[r].traverseVisible(e)}}traverseAncestors(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(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,r=0,i=t.length;r<i;r++)t[r].updateMatrixWorld(e)}updateWorldMatrix(e,t){var r=this.parent;if(!0===e&&null!==r&&r.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,n=0,a=i.length;n<a;n++)i[n].updateWorldMatrix(!1,!0)}toJSON(e){function t(t,r){return void 0===t[r.uuid]&&(t[r.uuid]=r.toJSON(e)),r.uuid}function r(e){var t=[];for(var r in e){var i=e[r];delete i.metadata,t.push(i)}return t}var i=void 0===e||"string"==typeof e,n={};i&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var a={};if(a.uuid=this.uuid,a.type=this.type,""!==this.name&&(a.name=this.name),!0===this.castShadow&&(a.castShadow=!0),!0===this.receiveShadow&&(a.receiveShadow=!0),!1===this.visible&&(a.visible=!1),!1===this.frustumCulled&&(a.frustumCulled=!1),0!==this.renderOrder&&(a.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(a.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(a.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=t(e.geometries,this.geometry);var s=this.geometry.parameters;if(void 0!==s&&void 0!==s.shapes){var o=s.shapes;if(Array.isArray(o))for(var l,h=0,c=o.length;h<c;h++)l=o[h],t(e.shapes,l);else t(e.shapes,o)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(t(e.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var u=[],d=0,p=this.material.length;d<p;d++)u.push(t(e.materials,this.material[d]));a.material=u}else a.material=t(e.materials,this.material);if(0<this.children.length){a.children=[];for(var m=0;m<this.children.length;m++)a.children.push(this.children[m].toJSON(e).object)}if(0<this.animations.length){a.animations=[];for(var f,v=0;v<this.animations.length;v++)f=this.animations[v],a.animations.push(t(e.animations,f))}if(i){var g=r(e.geometries),y=r(e.materials),x=r(e.textures),b=r(e.images),w=r(e.shapes),_=r(e.skeletons),M=r(e.animations);0<g.length&&(n.geometries=g),0<y.length&&(n.materials=y),0<x.length&&(n.textures=x),0<b.length&&(n.images=b),0<w.length&&(n.shapes=w),0<_.length&&(n.skeletons=_),0<M.length&&(n.animations=M)}return n.object=a,n}clone(e){return(new this.constructor).copy(this,e)}copy(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var r,i=0;i<e.children.length;i++)r=e.children[i],this.add(r.clone());return this}}pn.DefaultUp=new ci(0,1,0),pn.DefaultMatrixAutoUpdate=!0,pn.prototype.isObject3D=!0;var mn=new ci,fn=new ci,vn=new ci,gn=new ci,yn=new ci,xn=new ci,bn=new ci,wn=new ci,_n=new ci,Mn=new ci;class Sn{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new ci;this.a=e,this.b=t,this.c=r}static getNormal(e,t,r,i){i.subVectors(r,t),mn.subVectors(e,t),i.cross(mn);var n=i.lengthSq();return 0<n?i.multiplyScalar(1/Math.sqrt(n)):i.set(0,0,0)}static getBarycoord(e,t,r,i,n){mn.subVectors(i,t),fn.subVectors(r,t),vn.subVectors(e,t);var a=mn.dot(mn),s=mn.dot(fn),o=mn.dot(vn),l=fn.dot(fn),h=fn.dot(vn),c=a*l-s*s;if(0===c)return n.set(-2,-1,-1);var u=1/c,d=(l*o-s*h)*u,p=(a*h-s*o)*u;return n.set(1-d-p,p,d)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,gn),0<=gn.x&&0<=gn.y&&1>=gn.x+gn.y}static getUV(e,t,r,i,n,a,s,o){return this.getBarycoord(e,t,r,i,gn),o.set(0,0),o.addScaledVector(n,gn.x),o.addScaledVector(a,gn.y),o.addScaledVector(s,gn.z),o}static isFrontFacing(e,t,r,i){return mn.subVectors(r,t),fn.subVectors(e,t),!!(0>mn.cross(fn).dot(i))}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return mn.subVectors(this.c,this.b),fn.subVectors(this.a,this.b),.5*mn.cross(fn).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Sn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Sn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,n){return Sn.getUV(e,this.a,this.b,this.c,t,r,i,n)}containsPoint(e){return Sn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Sn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){var r,i,n=this.a,a=this.b,s=this.c;yn.subVectors(a,n),xn.subVectors(s,n),wn.subVectors(e,n);var o=yn.dot(wn),l=xn.dot(wn);if(0>=o&&0>=l)return t.copy(n);_n.subVectors(e,a);var h=yn.dot(_n),c=xn.dot(_n);if(0<=h&&c<=h)return t.copy(a);var u=o*c-h*l;if(0>=u&&0<=o&&0>=h)return r=o/(o-h),t.copy(n).addScaledVector(yn,r);Mn.subVectors(e,s);var d=yn.dot(Mn),p=xn.dot(Mn);if(0<=p&&d<=p)return t.copy(s);var m=d*l-o*p;if(0>=m&&0<=l&&0>=p)return i=l/(l-p),t.copy(n).addScaledVector(xn,i);var f=h*p-d*c;if(0>=f&&0<=c-h&&0<=d-p)return bn.subVectors(s,a),i=(c-h)/(c-h+(d-p)),t.copy(a).addScaledVector(bn,i);var v=1/(f+m+u);return r=m*v,i=u*v,t.copy(n).addScaledVector(yn,r).addScaledVector(xn,i)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}var Tn=0;class En extends zr{constructor(){super(),Object.defineProperty(this,"id",{value:Tn++}),this.uuid=jr(),this.name="",this.type="Material",this.fog=!0,this.blending=M,this.side=g,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=U,this.blendDst=z,this.blendEquation=L,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=q,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Er,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=dr,this.stencilZFail=dr,this.stencilZPass=dr,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.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}onBuild(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(var t in e){var r=e[t];if(void 0!==r)if("shading"!=t){var i=this[t];void 0!==i?i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r: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=r===b;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}}toJSON(e){function t(e){var t=[];for(var r in e){var i=e[r];delete i.metadata,t.push(i)}return t}var r=void 0===e||"string"==typeof e;r&&(e={textures:{},images:{}});var i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(i.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==M&&(i.blending=this.blending),this.side!==g&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),1>this.opacity&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),0<this.alphaTest&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),1<this.wireframeLinewidth&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.morphNormals&&(i.morphNormals=!0),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),r){var n=t(e.textures),a=t(e.images);0<n.length&&(i.textures=n),0<a.length&&(i.images=a)}return i}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,r=null;if(null!==t){var i=t.length;r=Array(i);for(var n=0;n!==i;++n)r[n]=t[n].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}En.prototype.isMaterial=!0;var An={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},Ln={h:0,s:0,l:0},Rn={h:0,s:0,l:0};function Cn(e,t,r){return 0>r&&(r+=1),1<r&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+6*(t-e)*(2/3-r):e}function Pn(e){return.04045>e?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function In(e){return.0031308>e?12.92*e:1.055*Math.pow(e,.41666)-.055}class On{constructor(e,t,r){return void 0===t&&void 0===r?this.set(e):this.setRGB(e,t,r)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(255&e>>16)/255,this.g=(255&e>>8)/255,this.b=(255&e)/255,this}setRGB(e,t,r){return this.r=e,this.g=t,this.b=r,this}setHSL(e,t,r){if(e=Zr(e,1),t=Wr(t,0,1),r=Wr(r,0,1),0===t)this.r=this.g=this.b=r;else{var i=.5>=r?r*(1+t):r+t-r*t,n=2*r-i;this.r=Cn(n,i,e+1/3),this.g=Cn(n,i,e),this.b=Cn(n,i,e-1/3)}return this}setStyle(e){function t(t){void 0===t||1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){var i,n=r[1],a=r[2];switch(n){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\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[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\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[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){var s=parseFloat(i[1])/360,o=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[4]),this.setHSL(s,o,l)}}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){var h=r[1],c=h.length;if(3===c)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===c)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}return e&&0<e.length?this.setColorName(e):this}setColorName(e){var t=An[e.toLowerCase()];return void 0===t?console.warn("THREE.Color: Unknown color "+e):this.setHex(t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyGammaToLinear(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:2;return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}copyLinearToGamma(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:2,r=0<t?1/t:1;return this.r=Math.pow(e.r,r),this.g=Math.pow(e.g,r),this.b=Math.pow(e.b,r),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.r=Pn(e.r),this.g=Pn(e.g),this.b=Pn(e.b),this}copyLinearToSRGB(e){return this.r=In(e.r),this.g=In(e.g),this.b=In(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){var t,r,i=this.r,n=this.g,a=this.b,s=Math.max(i,n,a),o=Math.min(i,n,a),l=(o+s)/2;if(o===s)t=0,r=0;else{var h=s-o;r=.5>=l?h/(s+o):h/(2-s-o),s===i?t=(n-a)/h+(n<a?6:0):s===n?t=(a-i)/h+2:s===a&&(t=(i-n)/h+4),t/=6}return e.h=t,e.s=r,e.l=l,e}getStyle(){return"rgb("+(0|255*this.r)+","+(0|255*this.g)+","+(0|255*this.b)+")"}offsetHSL(e,t,r){return this.getHSL(Ln),Ln.h+=e,Ln.s+=t,Ln.l+=r,this.setHSL(Ln.h,Ln.s,Ln.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(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}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(Ln),e.getHSL(Rn);var r=qr(Ln.h,Rn.h,t),i=qr(Ln.s,Rn.s,t),n=qr(Ln.l,Rn.l,t);return this.setHSL(r,i,n),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(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}toJSON(){return this.getHex()}}On.NAMES=An,On.prototype.isColor=!0,On.prototype.r=1,On.prototype.g=1,On.prototype.b=1;class Dn extends En{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new On(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Q,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this}}Dn.prototype.isMeshBasicMaterial=!0;var Nn=new ci,Bn=new $r;class Un{constructor(e,t,r){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?0:e.length/t,this.normalized=!0===r,this.usage=Ar,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(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(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var i=0,n=this.itemSize;i<n;i++)this.array[e+i]=t.array[r+i];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){for(var t,r=this.array,i=0,n=0,a=e.length;n<a;n++)void 0===(t=e[n])&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),t=new On),r[i++]=t.r,r[i++]=t.g,r[i++]=t.b;return this}copyVector2sArray(e){for(var t,r=this.array,i=0,n=0,a=e.length;n<a;n++)void 0===(t=e[n])&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),t=new $r),r[i++]=t.x,r[i++]=t.y;return this}copyVector3sArray(e){for(var t,r=this.array,i=0,n=0,a=e.length;n<a;n++)void 0===(t=e[n])&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),t=new ci),r[i++]=t.x,r[i++]=t.y,r[i++]=t.z;return this}copyVector4sArray(e){for(var t,r=this.array,i=0,n=0,a=e.length;n<a;n++)void 0===(t=e[n])&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),t=new ai),r[i++]=t.x,r[i++]=t.y,r[i++]=t.z,r[i++]=t.w;return this}applyMatrix3(e){if(2===this.itemSize)for(var t=0,r=this.count;t<r;t++)Bn.fromBufferAttribute(this,t),Bn.applyMatrix3(e),this.setXY(t,Bn.x,Bn.y);else if(3===this.itemSize)for(var i=0,n=this.count;i<n;i++)Nn.fromBufferAttribute(this,i),Nn.applyMatrix3(e),this.setXYZ(i,Nn.x,Nn.y,Nn.z);return this}applyMatrix4(e){for(var t=0,r=this.count;t<r;t++)Nn.x=this.getX(t),Nn.y=this.getY(t),Nn.z=this.getZ(t),Nn.applyMatrix4(e),this.setXYZ(t,Nn.x,Nn.y,Nn.z);return this}applyNormalMatrix(e){for(var t=0,r=this.count;t<r;t++)Nn.x=this.getX(t),Nn.y=this.getY(t),Nn.z=this.getZ(t),Nn.applyNormalMatrix(e),this.setXYZ(t,Nn.x,Nn.y,Nn.z);return this}transformDirection(e){for(var t=0,r=this.count;t<r;t++)Nn.x=this.getX(t),Nn.y=this.getY(t),Nn.z=this.getZ(t),Nn.transformDirection(e),this.setXYZ(t,Nn.x,Nn.y,Nn.z);return this}set(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,t,r,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=n,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){var e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Ar&&(e.usage=this.usage),(0!==this.updateRange.offset||-1!==this.updateRange.count)&&(e.updateRange=this.updateRange),e}}Un.prototype.isBufferAttribute=!0;class zn extends Un{constructor(e,t,r){super(new Int8Array(e),t,r)}}class Fn extends Un{constructor(e,t,r){super(new Uint8Array(e),t,r)}}class Gn extends Un{constructor(e,t,r){super(new Uint8ClampedArray(e),t,r)}}class Vn extends Un{constructor(e,t,r){super(new Int16Array(e),t,r)}}class Hn extends Un{constructor(e,t,r){super(new Uint16Array(e),t,r)}}class kn extends Un{constructor(e,t,r){super(new Int32Array(e),t,r)}}class jn extends Un{constructor(e,t,r){super(new Uint32Array(e),t,r)}}class Wn extends Un{constructor(e,t,r){super(new Uint16Array(e),t,r)}}Wn.prototype.isFloat16BufferAttribute=!0;class Zn extends Un{constructor(e,t,r){super(new Float32Array(e),t,r)}}class qn extends Un{constructor(e,t,r){super(new Float64Array(e),t,r)}}function Xn(e){if(0===e.length)return-1/0;for(var t=e[0],r=1,i=e.length;r<i;++r)e[r]>t&&(t=e[r]);return t}var Yn={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Jn(e,t){return new Yn[e](t)}var Kn=0,Qn=new Vi,$n=new pn,ea=new ci,ta=new pi,ra=new pi,ia=new ci;class na extends zr{constructor(){super(),Object.defineProperty(this,"id",{value:Kn++}),this.uuid=jr(),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={}}getIndex(){return this.index}setIndex(e){return this.index=Array.isArray(e)?new(65535<Xn(e)?jn:Hn)(e,1):e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var r=this.attributes.normal;if(void 0!==r){var i=(new ei).getNormalMatrix(e);r.applyNormalMatrix(i),r.needsUpdate=!0}var n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(e),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return Qn.makeRotationFromQuaternion(e),this.applyMatrix4(Qn),this}rotateX(e){return Qn.makeRotationX(e),this.applyMatrix4(Qn),this}rotateY(e){return Qn.makeRotationY(e),this.applyMatrix4(Qn),this}rotateZ(e){return Qn.makeRotationZ(e),this.applyMatrix4(Qn),this}translate(e,t,r){return Qn.makeTranslation(e,t,r),this.applyMatrix4(Qn),this}scale(e,t,r){return Qn.makeScale(e,t,r),this.applyMatrix4(Qn),this}lookAt(e){return $n.lookAt(e),$n.updateMatrix(),this.applyMatrix4($n.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ea).negate(),this.translate(ea.x,ea.y,ea.z),this}setFromPoints(e){for(var t,r=[],i=0,n=e.length;i<n;i++)t=e[i],r.push(t.x,t.y,t.z||0);return this.setAttribute("position",new Zn(r,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new pi);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 ci(-1/0,-1/0,-1/0),new ci(1/0,1/0,1/0));if(void 0===e)this.boundingBox.makeEmpty();else if(this.boundingBox.setFromBufferAttribute(e),t)for(var r,i=0,n=t.length;i<n;i++)r=t[i],ta.setFromBufferAttribute(r),this.morphTargetsRelative?(ia.addVectors(this.boundingBox.min,ta.min),this.boundingBox.expandByPoint(ia),ia.addVectors(this.boundingBox.max,ta.max),this.boundingBox.expandByPoint(ia)):(this.boundingBox.expandByPoint(ta.min),this.boundingBox.expandByPoint(ta.max));(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(){null===this.boundingSphere&&(this.boundingSphere=new Ii);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 ci,1/0);if(e){var r=this.boundingSphere.center;if(ta.setFromBufferAttribute(e),t)for(var i,n=0,a=t.length;n<a;n++)i=t[n],ra.setFromBufferAttribute(i),this.morphTargetsRelative?(ia.addVectors(ta.min,ra.min),ta.expandByPoint(ia),ia.addVectors(ta.max,ra.max),ta.expandByPoint(ia)):(ta.expandByPoint(ra.min),ta.expandByPoint(ra.max));ta.getCenter(r);for(var s=0,o=0,l=e.count;o<l;o++)ia.fromBufferAttribute(e,o),s=Math.max(s,r.distanceToSquared(ia));if(t)for(var h=0,c=t.length;h<c;h++)for(var u=t[h],d=this.morphTargetsRelative,p=0,m=u.count;p<m;p++)ia.fromBufferAttribute(u,p),d&&(ea.fromBufferAttribute(e,p),ia.add(ea)),s=Math.max(s,r.distanceToSquared(ia));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeFaceNormals(){}computeTangents(){function e(e,t,r){p.fromArray(a,3*e),m.fromArray(a,3*t),f.fromArray(a,3*r),v.fromArray(o,2*e),g.fromArray(o,2*t),y.fromArray(o,2*r),m.sub(p),f.sub(p),g.sub(v),y.sub(v);var i=1/(g.x*y.y-y.x*g.y);isFinite(i)&&(x.copy(m).multiplyScalar(y.y).addScaledVector(f,-g.y).multiplyScalar(i),b.copy(f).multiplyScalar(g.x).addScaledVector(m,-y.x).multiplyScalar(i),c[e].add(x),c[t].add(x),c[r].add(x),u[e].add(b),u[t].add(b),u[r].add(b))}function t(e){C.fromArray(s,3*e),P.copy(C);var t=c[e];L.copy(t),L.sub(C.multiplyScalar(C.dot(t))).normalize(),R.crossVectors(P,t);var r=0>R.dot(u[e])?-1:1;h[4*e]=L.x,h[4*e+1]=L.y,h[4*e+2]=L.z,h[4*e+3]=r}var r=this.index,i=this.attributes;if(null!==r&&void 0!==i.position&&void 0!==i.normal&&void 0!==i.uv){var n=r.array,a=i.position.array,s=i.normal.array,o=i.uv.array,l=a.length/3;void 0===i.tangent&&this.setAttribute("tangent",new Un(new Float32Array(4*l),4));for(var h=i.tangent.array,c=[],u=[],d=0;d<l;d++)c[d]=new ci,u[d]=new ci;var p=new ci,m=new ci,f=new ci,v=new $r,g=new $r,y=new $r,x=new ci,b=new ci,w=this.groups;0===w.length&&(w=[{start:0,count:n.length}]);for(var _=0,M=w.length;_<M;++_)for(var S=w[_],T=S.start,E=T,A=T+S.count;E<A;E+=3)e(n[E+0],n[E+1],n[E+2]);for(var L=new ci,R=new ci,C=new ci,P=new ci,I=0,O=w.length;I<O;++I)for(var D=w[I],N=D.start,B=N,U=N+D.count;B<U;B+=3)t(n[B+0]),t(n[B+1]),t(n[B+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)")}computeVertexNormals(){var e=this.index,t=this.getAttribute("position");if(void 0!==t){var r=this.getAttribute("normal");if(void 0===r)r=new Un(new Float32Array(3*t.count),3),this.setAttribute("normal",r);else for(var i=0,n=r.count;i<n;i++)r.setXYZ(i,0,0,0);var a=new ci,s=new ci,o=new ci,l=new ci,h=new ci,c=new ci,u=new ci,d=new ci;if(e)for(var p=0,m=e.count;p<m;p+=3){var f=e.getX(p+0),v=e.getX(p+1),g=e.getX(p+2);a.fromBufferAttribute(t,f),s.fromBufferAttribute(t,v),o.fromBufferAttribute(t,g),u.subVectors(o,s),d.subVectors(a,s),u.cross(d),l.fromBufferAttribute(r,f),h.fromBufferAttribute(r,v),c.fromBufferAttribute(r,g),l.add(u),h.add(u),c.add(u),r.setXYZ(f,l.x,l.y,l.z),r.setXYZ(v,h.x,h.y,h.z),r.setXYZ(g,c.x,c.y,c.z)}else for(var y=0,x=t.count;y<x;y+=3)a.fromBufferAttribute(t,y+0),s.fromBufferAttribute(t,y+1),o.fromBufferAttribute(t,y+2),u.subVectors(o,s),d.subVectors(a,s),u.cross(d),r.setXYZ(y+0,u.x,u.y,u.z),r.setXYZ(y+1,u.x,u.y,u.z),r.setXYZ(y+2,u.x,u.y,u.z);this.normalizeNormals(),r.needsUpdate=!0}}merge(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 r=this.attributes;for(var i in r)if(void 0!==e.attributes[i])for(var n=r[i].array,a=e.attributes[i],s=a.array,o=a.itemSize*t,l=Math.min(s.length,n.length-o),h=0,c=o;h<l;h++,c++)n[c]=s[h];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)}normalizeNormals(){for(var e=this.attributes.normal,t=0,r=e.count;t<r;t++)ia.fromBufferAttribute(e,t),ia.normalize(),e.setXYZ(t,ia.x,ia.y,ia.z)}toNonIndexed(){function e(e,t){for(var r=e.array,i=e.itemSize,n=e.normalized,a=new r.constructor(t.length*i),s=0,o=0,l=0,h=t.length;l<h;l++){s=e.isInterleavedBufferAttribute?t[l]*e.data.stride+e.offset:t[l]*i;for(var c=0;c<i;c++)a[o++]=r[s++]}return new Un(a,i,n)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var t=new na,r=this.index.array,i=this.attributes;for(var n in i){var a=e(i[n],r);t.setAttribute(n,a)}var s=this.morphAttributes;for(var o in s){for(var l=[],h=s[o],c=0,u=h.length;c<u;c++){var d=e(h[c],r);l.push(d)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;for(var p,m=this.groups,f=0,v=m.length;f<v;f++)p=m[f],t.addGroup(p.start,p.count,p.materialIndex);return t}toJSON(){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),0<Object.keys(this.userData).length&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var r in t)void 0!==t[r]&&(e[r]=t[r]);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 n=this.attributes;for(var a in n){var s=n[a];e.data.attributes[a]=s.toJSON(e.data)}var o={},l=!1;for(var h in this.morphAttributes){for(var c,u=this.morphAttributes[h],d=[],p=0,m=u.length;p<m;p++)c=u[p],d.push(c.toJSON(e.data));0<d.length&&(o[h]=d,l=!0)}l&&(e.data.morphAttributes=o,e.data.morphTargetsRelative=this.morphTargetsRelative);var f=this.groups;0<f.length&&(e.data.groups=JSON.parse(JSON.stringify(f)));var v=this.boundingSphere;return null!==v&&(e.data.boundingSphere={center:v.center.toArray(),radius:v.radius}),e}clone(){return(new na).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone(t));var i=e.attributes;for(var n in i){var a=i[n];this.setAttribute(n,a.clone(t))}var s=e.morphAttributes;for(var o in s){for(var l=[],h=s[o],c=0,u=h.length;c<u;c++)l.push(h[c].clone(t));this.morphAttributes[o]=l}this.morphTargetsRelative=e.morphTargetsRelative;for(var d,p=e.groups,m=0,f=p.length;m<f;m++)d=p[m],this.addGroup(d.start,d.count,d.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(){this.dispatchEvent({type:"dispose"})}}na.prototype.isBufferGeometry=!0;var aa=new Vi,sa=new Gi,oa=new Ii,la=new ci,ha=new ci,ca=new ci,ua=new ci,da=new ci,pa=new ci,ma=new ci,fa=new ci,va=new ci,ga=new $r,ya=new $r,xa=new $r,ba=new ci,wa=new ci;class _a extends pn{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new na,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Dn;super(),this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(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(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,r=Object.keys(t);if(0<r.length){var i=t[r[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var n,a=0,s=i.length;a<s;a++)n=i[a].name||a+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=a}}}else{var o=e.morphTargets;void 0!==o&&0<o.length&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){var r,i=this.geometry,n=this.material,a=this.matrixWorld;if(void 0!==n&&(null===i.boundingSphere&&i.computeBoundingSphere(),oa.copy(i.boundingSphere),oa.applyMatrix4(a),!1!==e.ray.intersectsSphere(oa))&&(aa.copy(a).invert(),sa.copy(e.ray).applyMatrix4(aa),null===i.boundingBox||!1!==sa.intersectsBox(i.boundingBox)))if(i.isBufferGeometry){var s=i.index,o=i.attributes.position,l=i.morphAttributes.position,h=i.morphTargetsRelative,c=i.attributes.uv,u=i.attributes.uv2,d=i.groups,p=i.drawRange;if(null!==s)if(Array.isArray(n))for(var m=0,f=d.length;m<f;m++)for(var v=d[m],g=n[v.materialIndex],y=Math.max(v.start,p.start),x=Math.min(v.start+v.count,p.start+p.count);y<x;y+=3){var b=s.getX(y),w=s.getX(y+1),_=s.getX(y+2);(r=Ma(this,g,e,sa,o,l,h,c,u,b,w,_))&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=v.materialIndex,t.push(r))}else for(var M=Math.max(0,p.start),S=Math.min(s.count,p.start+p.count),T=M;T<S;T+=3){var E=s.getX(T),A=s.getX(T+1),L=s.getX(T+2);(r=Ma(this,n,e,sa,o,l,h,c,u,E,A,L))&&(r.faceIndex=Math.floor(T/3),t.push(r))}else if(void 0!==o)if(Array.isArray(n))for(var R=0,C=d.length;R<C;R++)for(var P=d[R],I=n[P.materialIndex],O=Math.max(P.start,p.start),D=Math.min(P.start+P.count,p.start+p.count);O<D;O+=3)(r=Ma(this,I,e,sa,o,l,h,c,u,O,O+1,O+2))&&(r.faceIndex=Math.floor(O/3),r.face.materialIndex=P.materialIndex,t.push(r));else for(var N=Math.max(0,p.start),B=Math.min(o.count,p.start+p.count),U=N;U<B;U+=3)(r=Ma(this,n,e,sa,o,l,h,c,u,U,U+1,U+2))&&(r.faceIndex=Math.floor(U/3),t.push(r))}else i.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function Ma(e,t,r,i,n,a,s,o,l,h,c,u){la.fromBufferAttribute(n,h),ha.fromBufferAttribute(n,c),ca.fromBufferAttribute(n,u);var d=e.morphTargetInfluences;if(t.morphTargets&&a&&d){ma.set(0,0,0),fa.set(0,0,0),va.set(0,0,0);for(var p=0,m=a.length;p<m;p++){var f=d[p],v=a[p];0!==f&&(ua.fromBufferAttribute(v,h),da.fromBufferAttribute(v,c),pa.fromBufferAttribute(v,u),s?(ma.addScaledVector(ua,f),fa.addScaledVector(da,f),va.addScaledVector(pa,f)):(ma.addScaledVector(ua.sub(la),f),fa.addScaledVector(da.sub(ha),f),va.addScaledVector(pa.sub(ca),f)))}la.add(ma),ha.add(fa),ca.add(va)}e.isSkinnedMesh&&(e.boneTransform(h,la),e.boneTransform(c,ha),e.boneTransform(u,ca));var g=function(e,t,r,i,n,a,s,o){if(null===(t.side===y?i.intersectTriangle(s,a,n,!0,o):i.intersectTriangle(n,a,s,t.side!==x,o)))return null;wa.copy(o),wa.applyMatrix4(e.matrixWorld);var l=r.ray.origin.distanceTo(wa);return l<r.near||l>r.far?null:{distance:l,point:wa.clone(),object:e}}(e,t,r,i,la,ha,ca,ba);if(g){o&&(ga.fromBufferAttribute(o,h),ya.fromBufferAttribute(o,c),xa.fromBufferAttribute(o,u),g.uv=Sn.getUV(ba,la,ha,ca,ga,ya,xa,new $r)),l&&(ga.fromBufferAttribute(l,h),ya.fromBufferAttribute(l,c),xa.fromBufferAttribute(l,u),g.uv2=Sn.getUV(ba,la,ha,ca,ga,ya,xa,new $r));var b={a:h,b:c,c:u,normal:new ci,materialIndex:0};Sn.getNormal(la,ha,ca,b.normal),g.face=b}return g}_a.prototype.isMesh=!0;class Sa extends na{constructor(){function e(e,t,r,i,n,a,s,m,f,v,g){for(var y,x=f+1,b=0,w=0,_=new ci,M=0;M<v+1;M++){y=M*(s/v)-s/2;for(var S,T=0;T<x;T++)S=T*(a/f)-a/2,_[e]=S*i,_[t]=y*n,_[r]=m/2,h.push(_.x,_.y,_.z),_[e]=0,_[t]=0,_[r]=0<m?1:-1,c.push(_.x,_.y,_.z),u.push(T/f),u.push(1-M/v),b+=1}for(var E=0;E<v;E++)for(var A=0;A<f;A++){var L=d+A+x*E,R=d+A+x*(E+1),C=d+(A+1)+x*(E+1),P=d+(A+1)+x*E;l.push(L,R,P),l.push(R,C,P),w+=6}o.addGroup(p,w,g),p+=w,d+=b}var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,s=5<arguments.length&&void 0!==arguments[5]?arguments[5]:1;super(),this.type="BoxGeometry",this.parameters={width:t,height:r,depth:i,widthSegments:n,heightSegments:a,depthSegments:s};var o=this;n=Math.floor(n),a=Math.floor(a),s=Math.floor(s);var l=[],h=[],c=[],u=[],d=0,p=0;e("z","y","x",-1,-1,i,r,t,s,a,0),e("z","y","x",1,-1,i,r,-t,s,a,1),e("x","z","y",1,1,t,i,r,n,s,2),e("x","z","y",1,-1,t,i,-r,n,s,3),e("x","y","z",1,-1,t,r,i,n,a,4),e("x","y","z",-1,-1,t,r,-i,n,a,5),this.setIndex(l),this.setAttribute("position",new Zn(h,3)),this.setAttribute("normal",new Zn(c,3)),this.setAttribute("uv",new Zn(u,2))}static fromJSON(e){return new Sa(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ta(e){var t={};for(var r in e)for(var i in t[r]={},e[r]){var n=e[r][i];t[r][i]=n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?n.clone():Array.isArray(n)?n.slice():n}return t}function Ea(e){for(var t,r={},i=0;i<e.length;i++)for(var n in t=Ta(e[i]))r[n]=t[n];return r}var Aa={clone:Ta,merge:Ea};class La extends En{constructor(e){super(),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.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))}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ta(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){var t=super.toJSON(e);for(var r in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){var i=this.uniforms[r].value;t.uniforms[r]=i&&i.isTexture?{type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?{type:"c",value:i.getHex()}:i&&i.isVector2?{type:"v2",value:i.toArray()}:i&&i.isVector3?{type:"v3",value:i.toArray()}:i&&i.isVector4?{type:"v4",value:i.toArray()}:i&&i.isMatrix3?{type:"m3",value:i.toArray()}:i&&i.isMatrix4?{type:"m4",value:i.toArray()}:{value:i}}0<Object.keys(this.defines).length&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var n={};for(var a in this.extensions)!0===this.extensions[a]&&(n[a]=!0);return 0<Object.keys(n).length&&(t.extensions=n),t}}La.prototype.isShaderMaterial=!0;class Ra extends pn{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Vi,this.projectionMatrix=new Vi,this.projectionMatrixInverse=new Vi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}Ra.prototype.isCamera=!0;class Ca extends Ra{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:50,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:2e3;super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(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(e){var t=.5*this.getFilmHeight()/e;this.fov=2*kr*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){var e=Math.tan(.5*Hr*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*kr*Math.atan(Math.tan(.5*Hr*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,r,i,n,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=r,this.view.offsetY=i,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){var e=this.near,t=e*Math.tan(.5*Hr*this.fov)/this.zoom,r=2*t,i=this.aspect*r,n=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var s=a.fullWidth,o=a.fullHeight;n+=a.offsetX*i/s,t-=a.offsetY*r/o,i*=a.width/s,r*=a.height/o}var l=this.filmOffset;0!==l&&(n+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+i,t,t-r,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){var t=super.toJSON(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}}Ca.prototype.isPerspectiveCamera=!0;var Pa=90;class Ia extends pn{constructor(e,t,r){if(super(),this.type="CubeCamera",!0===r.isWebGLCubeRenderTarget){this.renderTarget=r;var i=new Ca(Pa,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new ci(1,0,0)),this.add(i);var n=new Ca(Pa,1,e,t);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new ci(-1,0,0)),this.add(n);var a=new Ca(Pa,1,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new ci(0,1,0)),this.add(a);var s=new Ca(Pa,1,e,t);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new ci(0,-1,0)),this.add(s);var o=new Ca(Pa,1,e,t);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new ci(0,0,1)),this.add(o);var l=new Ca(Pa,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new ci(0,0,-1)),this.add(l)}else console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.")}update(e,t){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,[i,n,a,s,o,l]=this.children,h=e.xr.enabled,c=e.getRenderTarget();e.xr.enabled=!1;var u=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,i),e.setRenderTarget(r,1),e.render(t,n),e.setRenderTarget(r,2),e.render(t,a),e.setRenderTarget(r,3),e.render(t,s),e.setRenderTarget(r,4),e.render(t,o),r.texture.generateMipmaps=u,e.setRenderTarget(r,5),e.render(t,l),e.setRenderTarget(c),e.xr.enabled=h}}class Oa extends ii{constructor(e,t,r,i,n,a,s,o,l,h){super(e=void 0===e?[]:e,t=void 0===t?le:t,r,i,n,a,s=void 0===s?Ge:s,o,l,h),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}Oa.prototype.isCubeTexture=!0;class Da extends si{constructor(e,t,r){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=r),super(e,e,t),t=t||{},this.texture=new Oa(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0===t.minFilter?_e:t.minFilter,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=Ve,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;var r=new Sa(5,5,5),i=new La({name:"CubemapFromEquirect",uniforms:Ta({tEquirect:{value:null}}),vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",side:y,blending:_});i.uniforms.tEquirect.value=t;var n=new _a(r,i),a=t.minFilter;return t.minFilter===Te&&(t.minFilter=_e),new Ia(1,10,this).update(e,n),t.minFilter=a,n.geometry.dispose(),n.material.dispose(),this}clear(e,t,r,i){for(var n=e.getRenderTarget(),a=0;6>a;a++)e.setRenderTarget(this,a),e.clear(t,r,i);e.setRenderTarget(n)}}Da.prototype.isWebGLCubeRenderTarget=!0;var Na=new ci,Ba=new ci,Ua=new ei;class za{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci(1,0,0),t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){var i=Na.subVectors(r,t).cross(Ba.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){var r=e.delta(Na),i=this.normal.dot(r);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;var n=-(e.start.dot(this.normal)+this.constant)/i;return 0>n||1<n?null:t.copy(r).multiplyScalar(n).add(e.start)}intersectsLine(e){var t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return 0>t&&0<r||0>r&&0<t}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){var r=t||Ua.getNormalMatrix(e),i=this.coplanarPoint(Na).applyMatrix4(e),n=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(n),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}za.prototype.isPlane=!0;var Fa=new Ii,Ga=new ci;class Va{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new za,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new za,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new za,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new za,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:new za,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:new za;this.planes=[e,t,r,i,n,a]}set(e,t,r,i,n,a){var s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(r),s[3].copy(i),s[4].copy(n),s[5].copy(a),this}copy(e){for(var t=this.planes,r=0;6>r;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e){var t=this.planes,r=e.elements,i=r[0],n=r[1],a=r[2],s=r[3],o=r[4],l=r[5],h=r[6],c=r[7],u=r[8],d=r[9],p=r[10],m=r[11],f=r[12],v=r[13],g=r[14],y=r[15];return t[0].setComponents(s-i,c-o,m-u,y-f).normalize(),t[1].setComponents(s+i,c+o,m+u,y+f).normalize(),t[2].setComponents(s+n,c+l,m+d,y+v).normalize(),t[3].setComponents(s-n,c-l,m-d,y-v).normalize(),t[4].setComponents(s-a,c-h,m-p,y-g).normalize(),t[5].setComponents(s+a,c+h,m+p,y+g).normalize(),this}intersectsObject(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Fa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Fa)}intersectsSprite(e){return Fa.center.set(0,0,0),Fa.radius=.7071067811865476,Fa.applyMatrix4(e.matrixWorld),this.intersectsSphere(Fa)}intersectsSphere(e){for(var t=this.planes,r=e.center,i=-e.radius,n=0;6>n;n++)if(t[n].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){for(var t,r=this.planes,i=0;6>i;i++)if(t=r[i],Ga.x=0<t.normal.x?e.max.x:e.min.x,Ga.y=0<t.normal.y?e.max.y:e.min.y,Ga.z=0<t.normal.z?e.max.z:e.min.z,0>t.distanceToPoint(Ga))return!1;return!0}containsPoint(e){for(var t=this.planes,r=0;6>r;r++)if(0>t[r].distanceToPoint(e))return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Ha(){function e(r,a){i(r,a),n=t.requestAnimationFrame(e)}var t=null,r=!1,i=null,n=null;return{start:function(){!0===r||null===i||(n=t.requestAnimationFrame(e),r=!0)},stop:function(){t.cancelAnimationFrame(n),r=!1},setAnimationLoop:function(e){i=e},setContext:function(e){t=e}}}function ka(e,t){var r=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 r=i.get(t);r&&(e.deleteBuffer(r.buffer),i.delete(t))},update:function(t,n){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 s=i.get(t);void 0===s?i.set(t,function(t,i){var n=t.array,a=t.usage,s=e.createBuffer();e.bindBuffer(i,s),e.bufferData(i,n,a),t.onUploadCallback();var o=5126;return n instanceof Float32Array?o=5126:n instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):n instanceof Uint16Array?t.isFloat16BufferAttribute?r?o=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):o=5123:n instanceof Int16Array?o=5122:n instanceof Uint32Array?o=5125:n instanceof Int32Array?o=5124:n instanceof Int8Array?o=5120:(n instanceof Uint8Array||n instanceof Uint8ClampedArray)&&(o=5121),{buffer:s,type:o,bytesPerElement:n.BYTES_PER_ELEMENT,version:t.version}}(t,n)):s.version<t.version&&(function(t,i,n){var a=i.array,s=i.updateRange;e.bindBuffer(n,t),-1===s.count?e.bufferSubData(n,0,a):(r?e.bufferSubData(n,s.offset*a.BYTES_PER_ELEMENT,a,s.offset,s.count):e.bufferSubData(n,s.offset*a.BYTES_PER_ELEMENT,a.subarray(s.offset,s.offset+s.count)),s.count=-1)}(s.buffer,t,n),s.version=t.version)}}}}class ja extends na{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i};for(var n,a=Math.floor(r),s=Math.floor(i),o=a+1,l=[],h=[],c=[],u=[],d=0;d<s+1;d++){n=d*(t/s)-t/2;for(var p,m=0;m<o;m++)p=m*(e/a)-e/2,h.push(p,-n,0),c.push(0,0,1),u.push(m/a),u.push(1-d/s)}for(var f=0;f<s;f++)for(var v=0;v<a;v++){var g=v+o*f,y=v+o*(f+1),x=v+1+o*(f+1),b=v+1+o*f;l.push(g,y,b),l.push(y,x,b)}this.setIndex(l),this.setAttribute("position",new Zn(h,3)),this.setAttribute("normal",new Zn(c,3)),this.setAttribute("uv",new Zn(u,2))}static fromJSON(e){return new ja(e.width,e.height,e.widthSegments,e.heightSegments)}}var Wa={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 dotVH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotVH - 6.98316 ) * dotVH );\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, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat 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:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSNMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition.xyz / vWorldPosition.w;\n\tvec3 v = normalize( cameraPosition - pos );\n\tfloat ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity );\n\tvec3 transmission = transmissionFactor * getIBLVolumeRefraction(\n\t\tnormal, v, roughnessFactor, material.diffuseColor, totalSpecular,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec4 vWorldPosition;\n\tvec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix) {\n\t\tvec3 refractionVector = refract(-v, normalize(n), 1.0 / ior);\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length(vec3(modelMatrix[0].xyz));\n\t\tmodelScale.y = length(vec3(modelMatrix[1].xyz));\n\t\tmodelScale.z = length(vec3(modelMatrix[2].xyz));\n\t\treturn normalize(refractionVector) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness(float roughness, float ior) {\n\t\treturn roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0);\n\t}\n\tvec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) {\n\t\tfloat framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior);\n\t\treturn texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb;\n\t}\n\tvec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance) {\n\t\tif (attenuationDistance == 0.0) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log(attenuationColor) / attenuationDistance;\n\t\t\tvec3 transmittance = exp(-attenuationCoefficient * transmissionDistance);\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 specularColor,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay(n, v, thickness, ior, modelMatrix);\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4(refractedRayExit, 1.0);\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior);\n\t\tvec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance);\n\t\treturn (1.0 - specularColor) * attenuatedColor * baseColor;\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_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#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform vec3 attenuationColor;\n\tuniform float attenuationDistance;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <transmission_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define 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#ifdef USE_TRANSMISSION\n\tvarying vec4 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <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#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition;\n#endif\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}"},Za={common:{diffuse:{value:new On(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new ei},uv2Transform:{value:new ei},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 $r(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new On(16777215)}},lights:{ambientLightColor:{value:[]},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 On(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ei}},sprite:{diffuse:{value:new On(16777215)},opacity:{value:1},center:{value:new $r(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ei}}},qa={basic:{uniforms:Ea([Za.common,Za.specularmap,Za.envmap,Za.aomap,Za.lightmap,Za.fog]),vertexShader:Wa.meshbasic_vert,fragmentShader:Wa.meshbasic_frag},lambert:{uniforms:Ea([Za.common,Za.specularmap,Za.envmap,Za.aomap,Za.lightmap,Za.emissivemap,Za.fog,Za.lights,{emissive:{value:new On(0)}}]),vertexShader:Wa.meshlambert_vert,fragmentShader:Wa.meshlambert_frag},phong:{uniforms:Ea([Za.common,Za.specularmap,Za.envmap,Za.aomap,Za.lightmap,Za.emissivemap,Za.bumpmap,Za.normalmap,Za.displacementmap,Za.fog,Za.lights,{emissive:{value:new On(0)},specular:{value:new On(1118481)},shininess:{value:30}}]),vertexShader:Wa.meshphong_vert,fragmentShader:Wa.meshphong_frag},standard:{uniforms:Ea([Za.common,Za.envmap,Za.aomap,Za.lightmap,Za.emissivemap,Za.bumpmap,Za.normalmap,Za.displacementmap,Za.roughnessmap,Za.metalnessmap,Za.fog,Za.lights,{emissive:{value:new On(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Wa.meshphysical_vert,fragmentShader:Wa.meshphysical_frag},toon:{uniforms:Ea([Za.common,Za.aomap,Za.lightmap,Za.emissivemap,Za.bumpmap,Za.normalmap,Za.displacementmap,Za.gradientmap,Za.fog,Za.lights,{emissive:{value:new On(0)}}]),vertexShader:Wa.meshtoon_vert,fragmentShader:Wa.meshtoon_frag},matcap:{uniforms:Ea([Za.common,Za.bumpmap,Za.normalmap,Za.displacementmap,Za.fog,{matcap:{value:null}}]),vertexShader:Wa.meshmatcap_vert,fragmentShader:Wa.meshmatcap_frag},points:{uniforms:Ea([Za.points,Za.fog]),vertexShader:Wa.points_vert,fragmentShader:Wa.points_frag},dashed:{uniforms:Ea([Za.common,Za.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Wa.linedashed_vert,fragmentShader:Wa.linedashed_frag},depth:{uniforms:Ea([Za.common,Za.displacementmap]),vertexShader:Wa.depth_vert,fragmentShader:Wa.depth_frag},normal:{uniforms:Ea([Za.common,Za.bumpmap,Za.normalmap,Za.displacementmap,{opacity:{value:1}}]),vertexShader:Wa.normal_vert,fragmentShader:Wa.normal_frag},sprite:{uniforms:Ea([Za.sprite,Za.fog]),vertexShader:Wa.sprite_vert,fragmentShader:Wa.sprite_frag},background:{uniforms:{uvTransform:{value:new ei},t2D:{value:null}},vertexShader:Wa.background_vert,fragmentShader:Wa.background_frag},cube:{uniforms:Ea([Za.envmap,{opacity:{value:1}}]),vertexShader:Wa.cube_vert,fragmentShader:Wa.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Wa.equirect_vert,fragmentShader:Wa.equirect_frag},distanceRGBA:{uniforms:Ea([Za.common,Za.displacementmap,{referencePosition:{value:new ci},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Wa.distanceRGBA_vert,fragmentShader:Wa.distanceRGBA_frag},shadow:{uniforms:Ea([Za.lights,Za.fog,{color:{value:new On(0)},opacity:{value:1}}]),vertexShader:Wa.shadow_vert,fragmentShader:Wa.shadow_frag}};function Xa(e,t,r,i,n){function a(e,t){r.buffers.color.setClear(e.r,e.g,e.b,t,n)}var s,o,l=new On(0),h=0,c=null,u=0,d=null;return{getClearColor:function(){return l},setClearColor:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;l.set(e),a(l,h=t)},getClearAlpha:function(){return h},setClearAlpha:function(e){a(l,h=e)},render:function(r,n){var p=!1,m=!0===n.isScene?n.background:null;m&&m.isTexture&&(m=t.get(m));var f=e.xr,v=f.getSession&&f.getSession();v&&"additive"===v.environmentBlendMode&&(m=null),null===m?a(l,h):m&&m.isColor&&(a(m,1),p=!0),(e.autoClear||p)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.mapping===de)?(void 0===o&&((o=new _a(new Sa(1,1,1),new La({name:"BackgroundCubeMaterial",uniforms:Ta(qa.cube.uniforms),vertexShader:qa.cube.vertexShader,fragmentShader:qa.cube.fragmentShader,side:y,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(e,t,r){this.matrixWorld.copyPosition(r.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(o)),o.material.uniforms.envMap.value=m,o.material.uniforms.flipEnvMap.value=m.isCubeTexture&&m._needsFlipEnvMap?-1:1,(c!==m||u!==m.version||d!==e.toneMapping)&&(o.material.needsUpdate=!0,c=m,u=m.version,d=e.toneMapping),r.unshift(o,o.geometry,o.material,0,0,null)):m&&m.isTexture&&(void 0===s&&((s=new _a(new ja(2,2),new La({name:"BackgroundMaterial",uniforms:Ta(qa.background.uniforms),vertexShader:qa.background.vertexShader,fragmentShader:qa.background.fragmentShader,side:g,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(s)),s.material.uniforms.t2D.value=m,!0===m.matrixAutoUpdate&&m.updateMatrix(),s.material.uniforms.uvTransform.value.copy(m.matrix),(c!==m||u!==m.version||d!==e.toneMapping)&&(s.material.needsUpdate=!0,c=m,u=m.version,d=e.toneMapping),r.unshift(s,s.geometry,s.material,0,0,null))}}}function Ya(e,t,r,i){function n(t){return i.isWebGL2?e.bindVertexArray(t):f.bindVertexArrayOES(t)}function a(t){return i.isWebGL2?e.deleteVertexArray(t):f.deleteVertexArrayOES(t)}function s(e){for(var t=[],r=[],i=[],n=0;n<m;n++)t[n]=0,r[n]=0,i[n]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:i,object:e,attributes:{},index:null}}function o(){for(var e=x.newAttributes,t=0,r=e.length;t<r;t++)e[t]=0}function l(e){h(e,0)}function h(r,n){var a=x.newAttributes,s=x.enabledAttributes,o=x.attributeDivisors;a[r]=1,0===s[r]&&(e.enableVertexAttribArray(r),s[r]=1),o[r]!==n&&((i.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](r,n),o[r]=n)}function c(){for(var t=x.newAttributes,r=x.enabledAttributes,i=0,n=r.length;i<n;i++)r[i]!==t[i]&&(e.disableVertexAttribArray(i),r[i]=0)}function u(t,r,n,a,s,o){!0!==i.isWebGL2||5124!==n&&5125!==n?e.vertexAttribPointer(t,r,n,a,s,o):e.vertexAttribIPointer(t,r,n,s,o)}function d(){p(),x===y||n((x=y).object)}function p(){y.geometry=null,y.program=null,y.wireframe=!1}var m=e.getParameter(34921),f=i.isWebGL2?null:t.get("OES_vertex_array_object"),v=i.isWebGL2||null!==f,g={},y=s(null),x=y;return{setup:function(a,d,p,m,y){var b=!1;if(v){var w=function(t,r,n){var a=!0===n.wireframe,o=g[t.id];void 0===o&&(o={},g[t.id]=o);var l=o[r.id];void 0===l&&(l={},o[r.id]=l);var h=l[a];return void 0===h&&(h=s(i.isWebGL2?e.createVertexArray():f.createVertexArrayOES()),l[a]=h),h}(m,p,d);x!==w&&n((x=w).object),b=function(e,t){var r=x.attributes,i=e.attributes,n=0;for(var a in i){var s=r[a],o=i[a];if(void 0===s)return!0;if(s.attribute!==o)return!0;if(s.data!==o.data)return!0;n++}return x.attributesNum!==n||x.index!==t}(m,y),b&&function(e,t){var r={},i=e.attributes,n=0;for(var a in i){var s=i[a],o={};o.attribute=s,s.data&&(o.data=s.data),r[a]=o,n++}x.attributes=r,x.attributesNum=n,x.index=t}(m,y)}else{var _=!0===d.wireframe;(x.geometry!==m.id||x.program!==p.id||x.wireframe!==_)&&(x.geometry=m.id,x.program=p.id,x.wireframe=_,b=!0)}!0===a.isInstancedMesh&&(b=!0),null!==y&&r.update(y,34963),b&&(function(n,a,s,d){if(!1!==i.isWebGL2||!n.isInstancedMesh&&!d.isInstancedBufferGeometry||null!==t.get("ANGLE_instanced_arrays")){o();var p=d.attributes,m=s.getAttributes(),f=a.defaultAttributeValues;for(var v in m){var g=m[v];if(0<=g){var y=p[v];if(void 0!==y){var x=y.normalized,b=y.itemSize,w=r.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?(h(g,T.meshPerAttribute),void 0===d._maxInstanceCount&&(d._maxInstanceCount=T.meshPerAttribute*T.count)):l(g),e.bindBuffer(34962,_),u(g,b,M,x,E*S,A*S)}else y.isInstancedBufferAttribute?(h(g,y.meshPerAttribute),void 0===d._maxInstanceCount&&(d._maxInstanceCount=y.meshPerAttribute*y.count)):l(g),e.bindBuffer(34962,_),u(g,b,M,x,0,0)}else if("instanceMatrix"===v){var L=r.get(n.instanceMatrix);if(void 0===L)continue;var R=L.buffer,C=L.type;h(g+0,1),h(g+1,1),h(g+2,1),h(g+3,1),e.bindBuffer(34962,R),e.vertexAttribPointer(g+0,4,C,!1,64,0),e.vertexAttribPointer(g+1,4,C,!1,64,16),e.vertexAttribPointer(g+2,4,C,!1,64,32),e.vertexAttribPointer(g+3,4,C,!1,64,48)}else if("instanceColor"===v){var P=r.get(n.instanceColor);if(void 0===P)continue;var I=P.buffer,O=P.type;h(g,1),e.bindBuffer(34962,I),e.vertexAttribPointer(g,3,O,!1,12,0)}else if(void 0!==f){var D=f[v];if(void 0!==D)switch(D.length){case 2:e.vertexAttrib2fv(g,D);break;case 3:e.vertexAttrib3fv(g,D);break;case 4:e.vertexAttrib4fv(g,D);break;default:e.vertexAttrib1fv(g,D)}}}}c()}}(a,d,p,m),null!==y&&e.bindBuffer(34963,r.get(y).buffer))},reset:d,resetDefaultState:p,dispose:function(){for(var e in d(),g){var t=g[e];for(var r in t){var i=t[r];for(var n in i)a(i[n].object),delete i[n];delete t[r]}delete g[e]}},releaseStatesOfGeometry:function(e){if(void 0!==g[e.id]){var t=g[e.id];for(var r in t){var i=t[r];for(var n in i)a(i[n].object),delete i[n];delete t[r]}delete g[e.id]}},releaseStatesOfProgram:function(e){for(var t in g){var r=g[t];if(void 0!==r[e.id]){var i=r[e.id];for(var n in i)a(i[n].object),delete i[n];delete r[e.id]}}},initAttributes:o,enableAttribute:l,disableUnusedAttributes:c}}function Ja(e,t,r,i){var n,a=i.isWebGL2;this.setMode=function(e){n=e},this.render=function(t,i){e.drawArrays(n,t,i),r.update(i,n,1)},this.renderInstances=function(i,s,o){if(0!==o){var l,h;if(a)l=e,h="drawArraysInstanced";else if(h="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[h](n,i,s,o),r.update(s,n,o)}}}function Ka(e,t,r){function i(t){if("highp"===t){if(0<e.getShaderPrecisionFormat(35633,36338).precision&&0<e.getShaderPrecisionFormat(35632,36338).precision)return"highp";t="mediump"}return"mediump"===t&&0<e.getShaderPrecisionFormat(35633,36337).precision&&0<e.getShaderPrecisionFormat(35632,36337).precision?"mediump":"lowp"}var n,a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,s=void 0===r.precision?"highp":r.precision,o=i(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);var l=a||t.has("WEBGL_draw_buffers"),h=!0===r.logarithmicDepthBuffer,c=e.getParameter(34930),u=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),m=e.getParameter(34921),f=e.getParameter(36347),v=e.getParameter(36348),g=e.getParameter(36349),y=0<u,x=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===t.has("EXT_texture_filter_anisotropic")){var r=t.get("EXT_texture_filter_anisotropic");n=e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:i,precision:s,logarithmicDepthBuffer:h,maxTextures:c,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:v,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:a?e.getParameter(36183):0}}function Qa(e){function t(){c.value!==n&&(c.value=n,c.needsUpdate=0<a),i.numPlanes=a,i.numIntersection=0}function r(e,t,r,n){var a=null===e?0:e.length,s=null;if(0!==a){if(s=c.value,!0!==n||null===s){var o=r+4*a,u=t.matrixWorldInverse;h.getNormalMatrix(u),(null===s||s.length<o)&&(s=new Float32Array(o));for(var d=0,p=r;d!==a;++d,p+=4)l.copy(e[d]).applyMatrix4(u,h),l.normal.toArray(s,p),s[p+3]=l.constant}c.value=s,c.needsUpdate=!0}return i.numPlanes=a,i.numIntersection=0,s}var i=this,n=null,a=0,s=!1,o=!1,l=new za,h=new ei,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,i){var o=0!==e.length||t||0!==a||s;return s=t,n=r(e,i,0),a=e.length,o},this.beginShadows=function(){o=!0,r(null)},this.endShadows=function(){o=!1,t()},this.setState=function(i,l,h){var u=i.clippingPlanes,d=i.clipIntersection,p=i.clipShadows,m=e.get(i);if(!s||null===u||0===u.length||o&&!p)o?r(null):t();else{var f=o?0:a,v=4*f,g=m.clippingState||null;c.value=g,g=r(u,l,v,h);for(var y=0;y!=v;++y)g[y]=n[y];m.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=f}}}function $a(e){function t(e,t){return t===ce?e.mapping=le:t===ue&&(e.mapping=he),e}function r(e){var t=e.target;t.removeEventListener("dispose",r);var n=i.get(t);void 0!==n&&(i.delete(t),n.dispose())}var i=new WeakMap;return{get:function(n){if(n&&n.isTexture){var a=n.mapping;if(a===ce||a===ue){if(i.has(n))return t(i.get(n).texture,n.mapping);var s=n.image;if(s&&0<s.height){var o=e.getRenderTarget(),l=new Da(s.height/2);return l.fromEquirectangularTexture(e,n),i.set(n,l),e.setRenderTarget(o),n.addEventListener("dispose",r),t(l.texture,n.mapping)}return null}}return n},dispose:function(){i=new WeakMap}}}function es(e){function t(t){return void 0!==r[t]?r[t]:(i="WEBGL_depth_texture"===t?e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture"):"EXT_texture_filter_anisotropic"===t?e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"):"WEBGL_compressed_texture_s3tc"===t?e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"):"WEBGL_compressed_texture_pvrtc"===t?e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"):e.getExtension(t),r[t]=i,i);var i}var r={};return{has:function(e){return null!==t(e)},init:function(e){e.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float")},get:function(e){var r=t(e);return null===r&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),r}}}function ts(e,t,r,i){function n(e){var a=e.target;for(var l in null!==a.index&&t.remove(a.index),a.attributes)t.remove(a.attributes[l]);a.removeEventListener("dispose",n),delete s[a.id];var h=o.get(a);h&&(t.remove(h),o.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,r.memory.geometries--}function a(e){var r=[],i=e.index,n=e.attributes.position,a=0;if(null!==i){var s=i.array;a=i.version;for(var l=0,h=s.length;l<h;l+=3){var c=s[l+0],u=s[l+1],d=s[l+2];r.push(c,u,u,d,d,c)}}else{var p=n.array;a=n.version;for(var m=0,f=p.length/3-1;m<f;m+=3){var v=m+0,g=m+1,y=m+2;r.push(v,g,g,y,y,v)}}var x=new(65535<Xn(r)?jn:Hn)(r,1);x.version=a;var b=o.get(e);b&&t.remove(b),o.set(e,x)}var s={},o=new WeakMap;return{get:function(e,t){return!0===s[t.id]||(t.addEventListener("dispose",n),s[t.id]=!0,r.memory.geometries++),t},update:function(e){var r=e.attributes;for(var i in r)t.update(r[i],34962);var n=e.morphAttributes;for(var a in n)for(var s=n[a],o=0,l=s.length;o<l;o++)t.update(s[o],34962)},getWireframeAttribute:function(e){var t=o.get(e);if(t){var r=e.index;null!==r&&t.version<r.version&&a(e)}else a(e);return o.get(e)}}}function rs(e,t,r,i){var n,a,s,o=i.isWebGL2;this.setMode=function(e){n=e},this.setIndex=function(e){a=e.type,s=e.bytesPerElement},this.render=function(t,i){e.drawElements(n,i,a,t*s),r.update(i,n,1)},this.renderInstances=function(i,l,h){if(0!==h){var c,u;if(o)c=e,u="drawElementsInstanced";else if(u="drawElementsInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[u](n,l,a,i*s,h),r.update(l,n,h)}}}function is(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,r,i){switch(t.calls++,r){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:",r)}}}}function ns(e,t){return e[0]-t[0]}function as(e,t){return Math.abs(t[1])-Math.abs(e[1])}function ss(e){for(var t={},r=new Float32Array(8),i=[],n=0;8>n;n++)i[n]=[n,0];return{update:function(n,a,s,o){var l=n.morphTargetInfluences,h=void 0===l?0:l.length,c=t[a.id];if(void 0===c||c.length!==h){c=[];for(var u=0;u<h;u++)c[u]=[u,0];t[a.id]=c}for(var d,p=0;p<h;p++)(d=c[p])[0]=p,d[1]=l[p];c.sort(as);for(var m=0;8>m;m++)m<h&&c[m][1]?(i[m][0]=c[m][0],i[m][1]=c[m][1]):(i[m][0]=Number.MAX_SAFE_INTEGER,i[m][1]=0);i.sort(ns);for(var f=s.morphTargets&&a.morphAttributes.position,v=s.morphNormals&&a.morphAttributes.normal,g=0,y=0;8>y;y++){var x=i[y],b=x[0],w=x[1];b!==Number.MAX_SAFE_INTEGER&&w?(f&&a.getAttribute("morphTarget"+y)!==f[b]&&a.setAttribute("morphTarget"+y,f[b]),v&&a.getAttribute("morphNormal"+y)!==v[b]&&a.setAttribute("morphNormal"+y,v[b]),r[y]=w,g+=w):(f&&!0===a.hasAttribute("morphTarget"+y)&&a.deleteAttribute("morphTarget"+y),v&&!0===a.hasAttribute("morphNormal"+y)&&a.deleteAttribute("morphNormal"+y),r[y]=0)}var _=a.morphTargetsRelative?1:1-g;o.getUniforms().setValue(e,"morphTargetBaseInfluence",_),o.getUniforms().setValue(e,"morphTargetInfluences",r)}}}function os(e,t,r,i){function n(e){var t=e.target;t.removeEventListener("dispose",n),r.remove(t.instanceMatrix),null!==t.instanceColor&&r.remove(t.instanceColor)}var a=new WeakMap;return{update:function(e){var s=i.render.frame,o=e.geometry,l=t.get(e,o);return a.get(l)!==s&&(t.update(l),a.set(l,s)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",n)&&e.addEventListener("dispose",n),r.update(e.instanceMatrix,34962),null!==e.instanceColor&&r.update(e.instanceColor,34962)),l},dispose:function(){a=new WeakMap}}}qa.physical={uniforms:Ea([qa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new $r(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new On(0)},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new $r},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new On(0)}}]),vertexShader:Wa.meshphysical_vert,fragmentShader:Wa.meshphysical_frag};class ls extends ii{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;super(null),this.image={data:e,width:t,height:r,depth:i},this.magFilter=ge,this.minFilter=ge,this.wrapR=fe,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}ls.prototype.isDataTexture2DArray=!0;class hs extends ii{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;super(null),this.image={data:e,width:t,height:r,depth:i},this.magFilter=ge,this.minFilter=ge,this.wrapR=fe,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}hs.prototype.isDataTexture3D=!0;var cs=new ii,us=new ls,ds=new hs,ps=new Oa,ms=[],fs=[],vs=new Float32Array(16),gs=new Float32Array(9),ys=new Float32Array(4);function xs(e,t,r){var i=e[0];if(0>=i||0<i)return e;var n=t*r,a=ms[n];if(void 0===a&&(a=new Float32Array(n),ms[n]=a),0!==t){i.toArray(a,0);for(var s=1,o=0;s!==t;++s)o+=r,e[s].toArray(a,o)}return a}function bs(e,t){if(e.length!==t.length)return!1;for(var r=0,i=e.length;r<i;r++)if(e[r]!==t[r])return!1;return!0}function ws(e,t){for(var r=0,i=t.length;r<i;r++)e[r]=t[r]}function _s(e,t){var r=fs[t];void 0===r&&(r=new Int32Array(t),fs[t]=r);for(var i=0;i!==t;++i)r[i]=e.allocateTextureUnit();return r}function Ms(e,t){var r=this.cache;r[0]===t||(e.uniform1f(this.addr,t),r[0]=t)}function Ss(e,t){var r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(bs(r,t))return;e.uniform2fv(this.addr,t),ws(r,t)}}function Ts(e,t){var r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else if(void 0!==t.r)(r[0]!==t.r||r[1]!==t.g||r[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),r[0]=t.r,r[1]=t.g,r[2]=t.b);else{if(bs(r,t))return;e.uniform3fv(this.addr,t),ws(r,t)}}function Es(e,t){var r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(bs(r,t))return;e.uniform4fv(this.addr,t),ws(r,t)}}function As(e,t){var r=this.cache,i=t.elements;if(void 0===i){if(bs(r,t))return;e.uniformMatrix2fv(this.addr,!1,t),ws(r,t)}else{if(bs(r,i))return;ys.set(i),e.uniformMatrix2fv(this.addr,!1,ys),ws(r,i)}}function Ls(e,t){var r=this.cache,i=t.elements;if(void 0===i){if(bs(r,t))return;e.uniformMatrix3fv(this.addr,!1,t),ws(r,t)}else{if(bs(r,i))return;gs.set(i),e.uniformMatrix3fv(this.addr,!1,gs),ws(r,i)}}function Rs(e,t){var r=this.cache,i=t.elements;if(void 0===i){if(bs(r,t))return;e.uniformMatrix4fv(this.addr,!1,t),ws(r,t)}else{if(bs(r,i))return;vs.set(i),e.uniformMatrix4fv(this.addr,!1,vs),ws(r,i)}}function Cs(e,t){var r=this.cache;r[0]===t||(e.uniform1i(this.addr,t),r[0]=t)}function Ps(e,t){var r=this.cache;bs(r,t)||(e.uniform2iv(this.addr,t),ws(r,t))}function Is(e,t){var r=this.cache;bs(r,t)||(e.uniform3iv(this.addr,t),ws(r,t))}function Os(e,t){var r=this.cache;bs(r,t)||(e.uniform4iv(this.addr,t),ws(r,t))}function Ds(e,t){var r=this.cache;r[0]===t||(e.uniform1ui(this.addr,t),r[0]=t)}function Ns(e,t){var r=this.cache;bs(r,t)||(e.uniform2uiv(this.addr,t),ws(r,t))}function Bs(e,t){var r=this.cache;bs(r,t)||(e.uniform3uiv(this.addr,t),ws(r,t))}function Us(e,t){var r=this.cache;bs(r,t)||(e.uniform4uiv(this.addr,t),ws(r,t))}function zs(e,t,r){var i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.safeSetTexture2D(t||cs,n)}function Fs(e,t,r){var i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.setTexture3D(t||ds,n)}function Gs(e,t,r){var i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.safeSetTextureCube(t||ps,n)}function Vs(e,t,r){var i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.setTexture2DArray(t||us,n)}function Hs(e,t){e.uniform1fv(this.addr,t)}function ks(e,t){var r=xs(t,this.size,2);e.uniform2fv(this.addr,r)}function js(e,t){var r=xs(t,this.size,3);e.uniform3fv(this.addr,r)}function Ws(e,t){var r=xs(t,this.size,4);e.uniform4fv(this.addr,r)}function Zs(e,t){var r=xs(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,r)}function qs(e,t){var r=xs(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,r)}function Xs(e,t){var r=xs(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,r)}function Ys(e,t){e.uniform1iv(this.addr,t)}function Js(e,t){e.uniform2iv(this.addr,t)}function Ks(e,t){e.uniform3iv(this.addr,t)}function Qs(e,t){e.uniform4iv(this.addr,t)}function $s(e,t){e.uniform1uiv(this.addr,t)}function eo(e,t){e.uniform2uiv(this.addr,t)}function to(e,t){e.uniform3uiv(this.addr,t)}function ro(e,t){e.uniform4uiv(this.addr,t)}function io(e,t,r){var i=t.length,n=_s(r,i);e.uniform1iv(this.addr,n);for(var a=0;a!==i;++a)r.safeSetTexture2D(t[a]||cs,n[a])}function no(e,t,r){var i=t.length,n=_s(r,i);e.uniform1iv(this.addr,n);for(var a=0;a!==i;++a)r.safeSetTextureCube(t[a]||ps,n[a])}function ao(e,t,r){var i;this.id=e,this.addr=r,this.cache=[],this.setValue=5126===(i=t.type)?Ms:35664===i?Ss:35665===i?Ts:35666===i?Es:35674===i?As:35675===i?Ls:35676===i?Rs:5124===i||35670===i?Cs:35667===i||35671===i?Ps:35668===i||35672===i?Is:35669===i||35673===i?Os:5125===i?Ds:36294===i?Ns:36295===i?Bs:36296===i?Us:35678===i||36198===i||36298===i||36306===i||35682===i?zs:35679===i||36299===i||36307===i?Fs:35680===i||36300===i||36308===i||36293===i?Gs:36289===i||36303===i||36311===i||36292===i?Vs:void 0}function so(e,t,r){var i;this.id=e,this.addr=r,this.cache=[],this.size=t.size,this.setValue=5126===(i=t.type)?Hs:35664===i?ks:35665===i?js:35666===i?Ws:35674===i?Zs:35675===i?qs:35676===i?Xs:5124===i||35670===i?Ys:35667===i||35671===i?Js:35668===i||35672===i?Ks:35669===i||35673===i?Qs:5125===i?$s:36294===i?eo:36295===i?to:36296===i?ro:35678===i||36198===i||36298===i||36306===i||35682===i?io:35680===i||36300===i||36308===i||36293===i?no:void 0}function oo(e){this.id=e,this.seq=[],this.map={}}so.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),ws(t,e)},oo.prototype.setValue=function(e,t,r){for(var i,n=this.seq,a=0,s=n.length;a!==s;++a)(i=n[a]).setValue(e,t[i.id],r)};var lo=/(\w+)(\])?(\[|\.)?/g;function ho(e,t){e.seq.push(t),e.map[t.id]=t}function co(e,t,r){var i=e.name,n=i.length;for(lo.lastIndex=0;;){var a=lo.exec(i),s=lo.lastIndex,o=a[1],l="]"===a[2],h=a[3];if(l&&(o|=0),void 0===h||"["===h&&s+2===n){ho(r,void 0===h?new ao(o,e,t):new so(o,e,t));break}var c=r.map[o];void 0===c&&ho(r,c=new oo(o)),r=c}}function uo(e,t){this.seq=[],this.map={};for(var r=e.getProgramParameter(t,35718),i=0;i<r;++i){var n=e.getActiveUniform(t,i);co(n,e.getUniformLocation(t,n.name),this)}}function po(e,t,r){var i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),i}uo.prototype.setValue=function(e,t,r,i){var n=this.map[t];void 0!==n&&n.setValue(e,r,i)},uo.prototype.setOptional=function(e,t,r){var i=t[r];void 0!==i&&this.setValue(e,r,i)},uo.upload=function(e,t,r,i){for(var n=0,a=t.length;n!==a;++n){var s=t[n],o=r[s.id];!1!==o.needsUpdate&&s.setValue(e,o.value,i)}},uo.seqWithValue=function(e,t){for(var r,i=[],n=0,a=e.length;n!==a;++n)(r=e[n]).id in t&&i.push(r);return i};var mo=0;function fo(e){return e===$t?["Linear","( value )"]:e===er?["sRGB","( value )"]:e===rr?["RGBE","( value )"]:e===nr?["RGBM","( value, 7.0 )"]:e===ar?["RGBM","( value, 16.0 )"]:e===sr?["RGBD","( value, 256.0 )"]:e===tr?["Gamma","( value, float( GAMMA_FACTOR ) )"]:e===ir?["LogLuv","( value )"]:(console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"])}function vo(e,t,r){var i=e.getShaderParameter(t,35713),n=e.getShaderInfoLog(t).trim();return i&&""===n?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+r+"\n"+n+function(e){for(var t=e.split("\n"),r=0;r<t.length;r++)t[r]=r+1+": "+t[r];return t.join("\n")}(e.getShaderSource(t))}function go(e,t){var r=fo(t);return"vec4 "+e+"( vec4 value ) { return "+r[0]+"ToLinear"+r[1]+"; }"}function yo(e,t){var r=fo(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+r[0]+r[1]+"; }"}function xo(e){return""!==e}function bo(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 wo(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var _o=/^[ \t]*#include +<([\w\d./]+)>/gm;function Mo(e){return e.replace(_o,So)}function So(e,t){var r=Wa[t];if(void 0===r)throw new Error("Can not resolve #include <"+t+">");return Mo(r)}var To=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Eo=/#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 Ao(e){return e.replace(Eo,Ro).replace(To,Lo)}function Lo(e,t,r,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ro(0,t,r,i)}function Ro(e,t,r,i){for(var n="",a=parseInt(t);a<parseInt(r);a++)n+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return n}function Co(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 Po(e,t,r,i){var n,a,s,o,l=e.getContext(),h=r.defines,c=r.vertexShader,u=r.fragmentShader,d=function(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===m?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===f?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===v&&(t="SHADOWMAP_TYPE_VSM"),t}(r),p=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case le:case he:t="ENVMAP_TYPE_CUBE";break;case de:case pe:t="ENVMAP_TYPE_CUBE_UV"}return t}(r),g=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case he:case pe:t="ENVMAP_MODE_REFRACTION"}return t}(r),y=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case Q:t="ENVMAP_BLENDING_MULTIPLY";break;case $:t="ENVMAP_BLENDING_MIX";break;case ee:t="ENVMAP_BLENDING_ADD"}return t}(r),x=0<e.gammaFactor?e.gammaFactor:1,b=r.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||0<e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(xo).join("\n")}(r),w=function(e){var t=[];for(var r in e){var i=e[r];!1!==i&&t.push("#define "+r+" "+i)}return t.join("\n")}(h),_=l.createProgram(),M=r.glslVersion?"#version "+r.glslVersion+"\n":"";r.isRawShaderMaterial?(0<(n=[w].filter(xo).join("\n")).length&&(n+="\n"),0<(a=[b,w].filter(xo).join("\n")).length&&(a+="\n")):(n=[Co(r),"#define SHADER_NAME "+r.shaderName,w,r.instancing?"#define USE_INSTANCING":"",r.instancingColor?"#define USE_INSTANCING_COLOR":"",r.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+x,"#define MAX_BONES "+r.maxBones,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+g:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMap&&r.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",r.normalMap&&r.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.displacementMap&&r.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.vertexTangents?"#define USE_TANGENT":"",r.vertexColors?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUvs?"#define USE_UV":"",r.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.useVertexTexture?"#define BONE_TEXTURE":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+d:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#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(xo).join("\n"),a=[b,Co(r),"#define SHADER_NAME "+r.shaderName,w,r.alphaTest?"#define ALPHATEST "+r.alphaTest+(r.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+x,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.matcap?"#define USE_MATCAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+p:"",r.envMap?"#define "+g:"",r.envMap?"#define "+y:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMap&&r.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",r.normalMap&&r.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.sheen?"#define USE_SHEEN":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.vertexTangents?"#define USE_TANGENT":"",r.vertexColors||r.instancingColor?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUvs?"#define USE_UV":"",r.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+d:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(r.extensionShaderTextureLOD||r.envMap)&&r.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",r.toneMapping===te?"":"#define TONE_MAPPING",r.toneMapping===te?"":Wa.tonemapping_pars_fragment,r.toneMapping===te?"":("toneMapping",s=r.toneMapping,s===re?o="Linear":s===ie?o="Reinhard":s===ne?o="OptimizedCineon":s===ae?o="ACESFilmic":s===se?o="Custom":(console.warn("THREE.WebGLProgram: Unsupported toneMapping:",s),o="Linear"),"vec3 toneMapping( vec3 color ) { return "+o+"ToneMapping( color ); }"),r.dithering?"#define DITHERING":"",Wa.encodings_pars_fragment,r.map?go("mapTexelToLinear",r.mapEncoding):"",r.matcap?go("matcapTexelToLinear",r.matcapEncoding):"",r.envMap?go("envMapTexelToLinear",r.envMapEncoding):"",r.emissiveMap?go("emissiveMapTexelToLinear",r.emissiveMapEncoding):"",r.lightMap?go("lightMapTexelToLinear",r.lightMapEncoding):"",yo("linearToOutputTexel",r.outputEncoding),r.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(xo).join("\n")),c=wo(c=bo(c=Mo(c),r),r),u=wo(u=bo(u=Mo(u),r),r),c=Ao(c),u=Ao(u),r.isWebGL2&&!0!==r.isRawShaderMaterial&&(M="#version 300 es\n",n=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+n,a=["#define varying in",r.glslVersion===Ur?"":"out highp vec4 pc_fragColor;",r.glslVersion===Ur?"":"#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 S,T,E=M+a+u,A=po(l,35633,M+n+c),L=po(l,35632,E);if(l.attachShader(_,A),l.attachShader(_,L),void 0===r.index0AttributeName?!0===r.morphTargets&&l.bindAttribLocation(_,0,"position"):l.bindAttribLocation(_,0,r.index0AttributeName),l.linkProgram(_),e.debug.checkShaderErrors){var R=l.getProgramInfoLog(_).trim(),C=l.getShaderInfoLog(A).trim(),P=l.getShaderInfoLog(L).trim(),I=!0,O=!0;if(!1===l.getProgramParameter(_,35714)){I=!1;var D=vo(l,A,"vertex"),N=vo(l,L,"fragment");console.error("THREE.WebGLProgram: shader error: ",l.getError(),"35715",l.getProgramParameter(_,35715),"gl.getProgramInfoLog",R,D,N)}else""===R?(""===C||""===P)&&(O=!1):console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",R);O&&(this.diagnostics={runnable:I,programLog:R,vertexShader:{log:C,prefix:n},fragmentShader:{log:P,prefix:a}})}return l.deleteShader(A),l.deleteShader(L),this.getUniforms=function(){return void 0===S&&(S=new uo(l,_)),S},this.getAttributes=function(){return void 0===T&&(T=function(e,t){for(var r={},i=e.getProgramParameter(t,35721),n=0;n<i;n++){var a=e.getActiveAttrib(t,n).name;r[a]=e.getAttribLocation(t,a)}return r}(l,_)),T},this.destroy=function(){i.releaseStatesOfProgram(this),l.deleteProgram(_),this.program=void 0},this.name=r.shaderName,this.id=mo++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=A,this.fragmentShader=L,this}function Io(e,t,r,i,n,a){function s(e){var t;return e&&e.isTexture?t=e.encoding:e&&e.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=$t,t}var o=[],l=i.isWebGL2,h=i.logarithmicDepthBuffer,c=i.floatVertexTextures,u=i.maxVertexUniforms,d=i.vertexTextures,p=i.precision,m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},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","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmission","transmissionMap","thicknessMap"];return{getParameters:function(n,o,f,v,g){var b,w,_=v.fog,M=n.isMeshStandardMaterial?v.environment:null,S=t.get(n.envMap||M),T=m[n.type],E=g.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(c)return 1024;var r=u,i=Math.floor((r-20)/4),n=Math.min(i,t.length);return n<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+n+"."),0):n}(g):0;if(null!==n.precision&&(p=i.getMaxPrecision(n.precision))!==n.precision&&console.warn("THREE.WebGLProgram.getParameters:",n.precision,"not supported, using",p,"instead."),T){var A=qa[T];b=A.vertexShader,w=A.fragmentShader}else b=n.vertexShader,w=n.fragmentShader;var L=e.getRenderTarget();return{isWebGL2:l,shaderID:T,shaderName:n.type,vertexShader:b,fragmentShader:w,defines:n.defines,isRawShaderMaterial:!0===n.isRawShaderMaterial,glslVersion:n.glslVersion,precision:p,instancing:!0===g.isInstancedMesh,instancingColor:!0===g.isInstancedMesh&&null!==g.instanceColor,supportsVertexTextures:d,outputEncoding:null===L?e.outputEncoding:s(L.texture),map:!!n.map,mapEncoding:s(n.map),matcap:!!n.matcap,matcapEncoding:s(n.matcap),envMap:!!S,envMapMode:S&&S.mapping,envMapEncoding:s(S),envMapCubeUV:!!S&&(S.mapping===de||S.mapping===pe),lightMap:!!n.lightMap,lightMapEncoding:s(n.lightMap),aoMap:!!n.aoMap,emissiveMap:!!n.emissiveMap,emissiveMapEncoding:s(n.emissiveMap),bumpMap:!!n.bumpMap,normalMap:!!n.normalMap,objectSpaceNormalMap:n.normalMapType===cr,tangentSpaceNormalMap:n.normalMapType===hr,clearcoatMap:!!n.clearcoatMap,clearcoatRoughnessMap:!!n.clearcoatRoughnessMap,clearcoatNormalMap:!!n.clearcoatNormalMap,displacementMap:!!n.displacementMap,roughnessMap:!!n.roughnessMap,metalnessMap:!!n.metalnessMap,specularMap:!!n.specularMap,alphaMap:!!n.alphaMap,gradientMap:!!n.gradientMap,sheen:!!n.sheen,transmission:!!n.transmission,transmissionMap:!!n.transmissionMap,thicknessMap:!!n.thicknessMap,combine:n.combine,vertexTangents:n.normalMap&&n.vertexTangents,vertexColors:n.vertexColors,vertexAlphas:!0===n.vertexColors&&g.geometry&&g.geometry.attributes.color&&4===g.geometry.attributes.color.itemSize,vertexUvs:!!(n.map||n.bumpMap||n.normalMap||n.specularMap||n.alphaMap||n.emissiveMap||n.roughnessMap||n.metalnessMap||n.clearcoatMap||n.clearcoatRoughnessMap||n.clearcoatNormalMap||n.displacementMap||n.transmissionMap||n.thicknessMap),uvsVertexOnly:!(n.map||n.bumpMap||n.normalMap||n.specularMap||n.alphaMap||n.emissiveMap||n.roughnessMap||n.metalnessMap||n.clearcoatNormalMap||n.transmission||n.transmissionMap||n.thicknessMap||!n.displacementMap),fog:!!_,useFog:n.fog,fogExp2:_&&_.isFogExp2,flatShading:!!n.flatShading,sizeAttenuation:n.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===g.isSkinnedMesh&&0<E,maxBones:E,useVertexTexture:c,morphTargets:n.morphTargets,morphNormals:n.morphNormals,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:n.dithering,shadowMapEnabled:e.shadowMap.enabled&&0<f.length,shadowMapType:e.shadowMap.type,toneMapping:n.toneMapped?e.toneMapping:te,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:n.premultipliedAlpha,alphaTest:n.alphaTest,doubleSided:n.side===x,flipSided:n.side===y,depthPacking:void 0!==n.depthPacking&&n.depthPacking,index0AttributeName:n.index0AttributeName,extensionDerivatives:n.extensions&&n.extensions.derivatives,extensionFragDepth:n.extensions&&n.extensions.fragDepth,extensionDrawBuffers:n.extensions&&n.extensions.drawBuffers,extensionShaderTextureLOD:n.extensions&&n.extensions.shaderTextureLOD,rendererExtensionFragDepth:l||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:l||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:l||r.has("EXT_shader_texture_lod"),customProgramCacheKey:n.customProgramCacheKey()}},getProgramCacheKey:function(t){var r=[];if(t.shaderID?r.push(t.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)r.push(i),r.push(t.defines[i]);if(!1===t.isRawShaderMaterial){for(var n=0;n<f.length;n++)r.push(t[f[n]]);r.push(e.outputEncoding),r.push(e.gammaFactor)}return r.push(t.customProgramCacheKey),r.join()},getUniforms:function(e){var t,r=m[e.type];if(r){var i=qa[r];t=Aa.clone(i.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,r){for(var i,a,s=0,l=o.length;s<l;s++)if((a=o[s]).cacheKey===r){++(i=a).usedTimes;break}return void 0===i&&(i=new Po(e,r,t,n),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 Oo(){var e=new WeakMap;return{get:function(t){var r=e.get(t);return void 0===r&&(r={},e.set(t,r)),r},remove:function(t){e.delete(t)},update:function(t,r,i){e.get(t)[r]=i},dispose:function(){e=new WeakMap}}}function Do(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.program===t.program?e.material.id===t.material.id?e.z===t.z?e.id-t.id:e.z-t.z:e.material.id-t.material.id:e.program.id-t.program.id:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function No(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.z===t.z?e.id-t.id:t.z-e.z:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function Bo(e){function t(t,n,a,s,l,h){var c=r[i],u=e.get(a);return void 0===c?(c={id:t.id,object:t,geometry:n,material:a,program:u.program||o,groupOrder:s,renderOrder:t.renderOrder,z:l,group:h},r[i]=c):(c.id=t.id,c.object=t,c.geometry=n,c.material=a,c.program=u.program||o,c.groupOrder=s,c.renderOrder=t.renderOrder,c.z=l,c.group=h),i++,c}var r=[],i=0,n=[],a=[],s=[],o={id:-1};return{opaque:n,transmissive:a,transparent:s,init:function(){i=0,n.length=0,a.length=0,s.length=0},push:function(e,r,i,o,l,h){var c=t(e,r,i,o,l,h);0<i.transmission?a.push(c):!0===i.transparent?s.push(c):n.push(c)},unshift:function(e,r,i,o,l,h){var c=t(e,r,i,o,l,h);0<i.transmission?a.unshift(c):!0===i.transparent?s.unshift(c):n.unshift(c)},finish:function(){for(var e,t=i,n=r.length;t<n&&null!==(e=r[t]).id;t++)e.id=null,e.object=null,e.geometry=null,e.material=null,e.program=null,e.group=null},sort:function(e,t){1<n.length&&n.sort(e||Do),1<a.length&&a.sort(t||No),1<s.length&&s.sort(t||No)}}}function Uo(e){var t=new WeakMap;return{get:function(r,i){var n;return!1===t.has(r)?(n=new Bo(e),t.set(r,[n])):i>=t.get(r).length?(n=new Bo(e),t.get(r).push(n)):n=t.get(r)[i],n},dispose:function(){t=new WeakMap}}}function zo(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var r;switch(t.type){case"DirectionalLight":r={direction:new ci,color:new On};break;case"SpotLight":r={position:new ci,direction:new ci,color:new On,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":r={position:new ci,color:new On,distance:0,decay:0};break;case"HemisphereLight":r={direction:new ci,skyColor:new On,groundColor:new On};break;case"RectAreaLight":r={color:new On,position:new ci,halfWidth:new ci,halfHeight:new ci}}return e[t.id]=r,r}}}var Fo=0;function Go(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Vo(e,t){for(var r=new zo,i=function(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var r;switch(t.type){case"DirectionalLight":case"SpotLight":r={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $r};break;case"PointLight":r={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $r,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=r,r}}}(),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:[]},a=0;9>a;a++)n.probe.push(new ci);var s=new ci,o=new Vi,l=new Vi;return{setup:function(a){for(var s=0,o=0,l=0,h=0;9>h;h++)n.probe[h].set(0,0,0);var c=0,u=0,d=0,p=0,m=0,f=0,v=0,g=0;a.sort(Go);for(var y=0,x=a.length;y<x;y++){var b=a[y],w=b.color,_=b.intensity,M=b.distance,S=b.shadow&&b.shadow.map?b.shadow.map.texture:null;if(b.isAmbientLight)s+=w.r*_,o+=w.g*_,l+=w.b*_;else if(b.isLightProbe)for(var T=0;9>T;T++)n.probe[T].addScaledVector(b.sh.coefficients[T],_);else if(b.isDirectionalLight){var E=r.get(b);if(E.color.copy(b.color).multiplyScalar(b.intensity),b.castShadow){var A=b.shadow,L=i.get(b);L.shadowBias=A.bias,L.shadowNormalBias=A.normalBias,L.shadowRadius=A.radius,L.shadowMapSize=A.mapSize,n.directionalShadow[c]=L,n.directionalShadowMap[c]=S,n.directionalShadowMatrix[c]=b.shadow.matrix,f++}n.directional[c]=E,c++}else if(b.isSpotLight){var R=r.get(b);if(R.position.setFromMatrixPosition(b.matrixWorld),R.color.copy(w).multiplyScalar(_),R.distance=M,R.coneCos=Math.cos(b.angle),R.penumbraCos=Math.cos(b.angle*(1-b.penumbra)),R.decay=b.decay,b.castShadow){var C=b.shadow,P=i.get(b);P.shadowBias=C.bias,P.shadowNormalBias=C.normalBias,P.shadowRadius=C.radius,P.shadowMapSize=C.mapSize,n.spotShadow[d]=P,n.spotShadowMap[d]=S,n.spotShadowMatrix[d]=b.shadow.matrix,g++}n.spot[d]=R,d++}else if(b.isRectAreaLight){var I=r.get(b);I.color.copy(w).multiplyScalar(_),I.halfWidth.set(.5*b.width,0,0),I.halfHeight.set(0,.5*b.height,0),n.rectArea[p]=I,p++}else if(b.isPointLight){var O=r.get(b);if(O.color.copy(b.color).multiplyScalar(b.intensity),O.distance=b.distance,O.decay=b.decay,b.castShadow){var D=b.shadow,N=i.get(b);N.shadowBias=D.bias,N.shadowNormalBias=D.normalBias,N.shadowRadius=D.radius,N.shadowMapSize=D.mapSize,N.shadowCameraNear=D.camera.near,N.shadowCameraFar=D.camera.far,n.pointShadow[u]=N,n.pointShadowMap[u]=S,n.pointShadowMatrix[u]=b.shadow.matrix,v++}n.point[u]=O,u++}else if(b.isHemisphereLight){var B=r.get(b);B.skyColor.copy(b.color).multiplyScalar(_),B.groundColor.copy(b.groundColor).multiplyScalar(_),n.hemi[m]=B,m++}}0<p&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(n.rectAreaLTC1=Za.LTC_FLOAT_1,n.rectAreaLTC2=Za.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(n.rectAreaLTC1=Za.LTC_HALF_1,n.rectAreaLTC2=Za.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),n.ambient[0]=s,n.ambient[1]=o,n.ambient[2]=l;var U=n.hash;(U.directionalLength!==c||U.pointLength!==u||U.spotLength!==d||U.rectAreaLength!==p||U.hemiLength!==m||U.numDirectionalShadows!==f||U.numPointShadows!==v||U.numSpotShadows!==g)&&(n.directional.length=c,n.spot.length=d,n.rectArea.length=p,n.point.length=u,n.hemi.length=m,n.directionalShadow.length=f,n.directionalShadowMap.length=f,n.pointShadow.length=v,n.pointShadowMap.length=v,n.spotShadow.length=g,n.spotShadowMap.length=g,n.directionalShadowMatrix.length=f,n.pointShadowMatrix.length=v,n.spotShadowMatrix.length=g,U.directionalLength=c,U.pointLength=u,U.spotLength=d,U.rectAreaLength=p,U.hemiLength=m,U.numDirectionalShadows=f,U.numPointShadows=v,U.numSpotShadows=g,n.version=Fo++)},setupView:function(e,t){for(var r,i=0,a=0,h=0,c=0,u=0,d=t.matrixWorldInverse,p=0,m=e.length;p<m;p++)if((r=e[p]).isDirectionalLight){var f=n.directional[i];f.direction.setFromMatrixPosition(r.matrixWorld),s.setFromMatrixPosition(r.target.matrixWorld),f.direction.sub(s),f.direction.transformDirection(d),i++}else if(r.isSpotLight){var v=n.spot[h];v.position.setFromMatrixPosition(r.matrixWorld),v.position.applyMatrix4(d),v.direction.setFromMatrixPosition(r.matrixWorld),s.setFromMatrixPosition(r.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(d),h++}else if(r.isRectAreaLight){var g=n.rectArea[c];g.position.setFromMatrixPosition(r.matrixWorld),g.position.applyMatrix4(d),l.identity(),o.copy(r.matrixWorld),o.premultiply(d),l.extractRotation(o),g.halfWidth.set(.5*r.width,0,0),g.halfHeight.set(0,.5*r.height,0),g.halfWidth.applyMatrix4(l),g.halfHeight.applyMatrix4(l),c++}else if(r.isPointLight){var y=n.point[a];y.position.setFromMatrixPosition(r.matrixWorld),y.position.applyMatrix4(d),a++}else if(r.isHemisphereLight){var x=n.hemi[u];x.direction.setFromMatrixPosition(r.matrixWorld),x.direction.transformDirection(d),x.direction.normalize(),u++}},state:n}}function Ho(e,t){var r=new Vo(e,t),i=[],n=[];return{init:function(){i.length=0,n.length=0},state:{lightsArray:i,shadowsArray:n,lights:r},setupLights:function(){r.setup(i)},setupLightsView:function(e){r.setupView(i,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){n.push(e)}}}function ko(e,t){var r=new WeakMap;return{get:function(i){var n,a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return!1===r.has(i)?(n=new Ho(e,t),r.set(i,[n])):a>=r.get(i).length?(n=new Ho(e,t),r.get(i).push(n)):n=r.get(i)[a],n},dispose:function(){r=new WeakMap}}}class jo extends En{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=or,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)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,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}}jo.prototype.isMeshDepthMaterial=!0;class Wo extends En{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new ci,this.nearDistance=1,this.farDistance=1e3,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,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}}Wo.prototype.isMeshDistanceMaterial=!0;var Zo="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 HORIZONTAL_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}",qo="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function Xo(e,t,r){function i(r,i){var n=t.update(E);M.uniforms.shadow_pass.value=r.map.texture,M.uniforms.resolution.value=r.mapSize,M.uniforms.radius.value=r.radius,e.setRenderTarget(r.mapPass),e.clear(),e.renderBufferDirect(i,null,n,M,E,null),S.uniforms.shadow_pass.value=r.mapPass.texture,S.uniforms.resolution.value=r.mapSize,S.uniforms.radius.value=r.radius,e.setRenderTarget(r.map),e.clear(),e.renderBufferDirect(i,null,n,S,E,null)}function n(e){var t=e<<0,r=d[t];return void 0===r&&(r=new jo({depthPacking:lr,morphTargets:e}),d[t]=r),r}function a(e){var t=e<<0,r=p[t];return void 0===r&&(r=new Wo({morphTargets:e}),p[t]=r),r}function s(t,r,i,s,o,l,h){var c=null,u=n,d=t.customDepthMaterial;if(!0===s.isPointLight&&(u=a,d=t.customDistanceMaterial),void 0===d){var p=!1;!0===i.morphTargets&&(p=r.morphAttributes&&r.morphAttributes.position&&0<r.morphAttributes.position.length),c=u(p)}else c=d;if(e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var m=c.uuid,g=i.uuid,y=f[m];void 0===y&&(y={},f[m]=y);var x=y[g];void 0===x&&(x=c.clone(),y[g]=x),c=x}return c.visible=i.visible,c.wireframe=i.wireframe,c.side=h===v?null===i.shadowSide?i.side:i.shadowSide:null===i.shadowSide?w[i.side]:i.shadowSide,c.clipShadows=i.clipShadows,c.clippingPlanes=i.clippingPlanes,c.clipIntersection=i.clipIntersection,c.wireframeLinewidth=i.wireframeLinewidth,c.linewidth=i.linewidth,!0===s.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(s.matrixWorld),c.nearDistance=o,c.farDistance=l),c}function o(r,i,n,a,h){if(!1!==r.visible){if(r.layers.test(i.layers)&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&h===v)&&(!r.frustumCulled||l.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,r.matrixWorld);var c=t.update(r),u=r.material;if(Array.isArray(u))for(var d=c.groups,p=0,m=d.length;p<m;p++){var f=d[p],g=u[f.materialIndex];if(g&&g.visible){var y=s(r,c,g,a,n.near,n.far,h);e.renderBufferDirect(n,null,c,y,r,f)}}else if(u.visible){var x=s(r,c,u,a,n.near,n.far,h);e.renderBufferDirect(n,null,c,x,r,null)}}for(var b=r.children,w=0,_=b.length;w<_;w++)o(b[w],i,n,a,h)}}var l=new Va,h=new $r,c=new $r,u=new ai,d=[],p=[],f={},b=r.maxTextureSize,w={0:y,1:g,2:x},M=new La({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new $r},radius:{value:4}},vertexShader:qo,fragmentShader:Zo}),S=M.clone();S.defines.HORIZONTAL_PASS=1;var T=new na;T.setAttribute("position",new Un(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var E=new _a(T,M),A=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=m,this.render=function(t,r,n){if(!1!==A.enabled&&(!1!==A.autoUpdate||!1!==A.needsUpdate)&&0!==t.length){var a=e.getRenderTarget(),s=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.state;p.setBlending(_),p.buffers.color.setClear(1,1,1,1),p.buffers.depth.setTest(!0),p.setScissorTest(!1);for(var m=0,f=t.length;m<f;m++){var g=t[m],y=g.shadow;if(void 0!==y){if(!1!==y.autoUpdate||!1!==y.needsUpdate){h.copy(y.mapSize);var x=y.getFrameExtents();if(h.multiply(x),c.copy(y.mapSize),(h.x>b||h.y>b)&&(h.x>b&&(c.x=Math.floor(b/x.x),h.x=c.x*x.x,y.mapSize.x=c.x),h.y>b&&(c.y=Math.floor(b/x.y),h.y=c.y*x.y,y.mapSize.y=c.y)),null===y.map&&!y.isPointLightShadow&&this.type===v){var w={minFilter:_e,magFilter:_e,format:Ve};y.map=new si(h.x,h.y,w),y.map.texture.name=g.name+".shadowMap",y.mapPass=new si(h.x,h.y,w),y.camera.updateProjectionMatrix()}if(null===y.map){var M={minFilter:ge,magFilter:ge,format:Ve};y.map=new si(h.x,h.y,M),y.map.texture.name=g.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var S,T=y.getViewportCount(),E=0;E<T;E++)S=y.getViewport(E),u.set(c.x*S.x,c.y*S.y,c.x*S.z,c.y*S.w),p.viewport(u),y.updateMatrices(g,E),l=y.getFrustum(),o(r,n,y.camera,g,this.type);y.isPointLightShadow||this.type!==v||i(y,n),y.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}A.needsUpdate=!1,e.setRenderTarget(a,s,d)}}}function Yo(e,t,r){function i(t,r,i){var n=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var s=0;s<i;s++)e.texImage2D(r+s,0,6408,1,1,0,6408,5121,n);return a}function n(t){!0!==b[t]&&(e.enable(t),b[t]=!0)}function a(t){!1!==b[t]&&(e.disable(t),b[t]=!1)}function s(t,r,i,s,o,l,h,c){return t===_?void(!0===ee&&(a(3042),ee=!1)):(!1===ee&&(n(3042),ee=!0),t===A?(o=o||r,l=l||i,h=h||s,(r!==re||o!==ae)&&(e.blendEquationSeparate(Te[r],Te[o]),re=r,ae=o),(i!==ie||s!==ne||l!==se||h!==oe)&&(e.blendFuncSeparate(Ae[i],Ae[s],Ae[l],Ae[h]),ie=i,ne=s,se=l,oe=h),te=t,void(le=null)):void((t!==te||c!==le)&&((re!==L||ae!==L)&&(e.blendEquation(32774),re=L,ae=L),c?t===M?e.blendFuncSeparate(1,771,1,771):t===S?e.blendFunc(1,1):t===T?e.blendFuncSeparate(0,0,769,771):t===E?e.blendFuncSeparate(0,768,0,770):console.error("THREE.WebGLState: Invalid blending: ",t):t===M?e.blendFuncSeparate(770,771,1,771):t===S?e.blendFunc(770,1):t===T?e.blendFunc(0,769):t===E?e.blendFunc(0,768):console.error("THREE.WebGLState: Invalid blending: ",t),ie=null,ne=null,se=null,oe=null,te=t,le=c)))}function o(t){he!==t&&(t?e.frontFace(2304):e.frontFace(2305),he=t)}function l(t){t===h?a(2884):(n(2884),t!==ce&&(t===c?e.cullFace(1029):t===u?e.cullFace(1028):e.cullFace(1032))),ce=t}function d(t,r,i){t?(n(32823),(de!==r||pe!==i)&&(e.polygonOffset(r,i),de=r,pe=i)):a(32823)}function p(t){void 0===t&&(t=33984+me-1),ye!==t&&(e.activeTexture(t),ye=t)}var m=r.isWebGL2,f=new function(){var t=!1,r=new ai,i=null,n=new ai(0,0,0,0);return{setMask:function(r){i===r||t||(e.colorMask(r,r,r,r),i=r)},setLocked:function(e){t=e},setClear:function(t,i,a,s,o){!0===o&&(t*=s,i*=s,a*=s),r.set(t,i,a,s),!1===n.equals(r)&&(e.clearColor(t,i,a,s),n.copy(r))},reset:function(){t=!1,i=null,n.set(-1,0,0,0)}}},v=new function(){var t=!1,r=null,i=null,s=null;return{setTest:function(e){e?n(2929):a(2929)},setMask:function(i){r===i||t||(e.depthMask(i),r=i)},setFunc:function(t){i!==t&&(t?t===j?e.depthFunc(512):t===W?e.depthFunc(519):t===Z?e.depthFunc(513):t===q?e.depthFunc(515):t===X?e.depthFunc(514):t===Y?e.depthFunc(518):t===J?e.depthFunc(516):t===K?e.depthFunc(517):e.depthFunc(515):e.depthFunc(515),i=t)},setLocked:function(e){t=e},setClear:function(t){s!==t&&(e.clearDepth(t),s=t)},reset:function(){t=!1,r=null,i=null,s=null}}},g=new function(){var t=!1,r=null,i=null,s=null,o=null,l=null,h=null,c=null,u=null;return{setTest:function(e){t||(e?n(2960):a(2960))},setMask:function(i){r===i||t||(e.stencilMask(i),r=i)},setFunc:function(t,r,n){(i!==t||s!==r||o!==n)&&(e.stencilFunc(t,r,n),i=t,s=r,o=n)},setOp:function(t,r,i){(l!==t||h!==r||c!==i)&&(e.stencilOp(t,r,i),l=t,h=r,c=i)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,r=null,i=null,s=null,o=null,l=null,h=null,c=null,u=null}}},b={},w=null,Q={},$=null,ee=!1,te=null,re=null,ie=null,ne=null,ae=null,se=null,oe=null,le=!1,he=null,ce=null,ue=null,de=null,pe=null,me=e.getParameter(35661),fe=!1,ve=0,ge=e.getParameter(7938);-1===ge.indexOf("WebGL")?-1!==ge.indexOf("OpenGL ES")&&(ve=parseFloat(/^OpenGL ES (\d)/.exec(ge)[1]),fe=2<=ve):(ve=parseFloat(/^WebGL (\d)/.exec(ge)[1]),fe=1<=ve);var ye=null,xe={},be=e.getParameter(3088),we=e.getParameter(2978),_e=(new ai).fromArray(be),Me=(new ai).fromArray(we),Se={};Se[3553]=i(3553,3553,1),Se[34067]=i(34067,34069,6),f.setClear(0,0,0,1),v.setClear(1),g.setClear(0),n(2929),v.setFunc(q),o(!1),l(c),n(2884),s(_);var Te={[L]:32774,[R]:32778,[C]:32779};if(m)Te[P]=32775,Te[I]=32776;else{var Ee=t.get("EXT_blend_minmax");null!==Ee&&(Te[P]=Ee.MIN_EXT,Te[I]=Ee.MAX_EXT)}var Ae={[O]:0,[D]:1,[N]:768,[U]:770,[k]:776,[V]:774,[F]:772,[B]:769,[z]:771,[H]:775,[G]:773};return{buffers:{color:f,depth:v,stencil:g},enable:n,disable:a,bindFramebuffer:function(t,r){return null===r&&null!==w&&(r=w),Q[t]!==r&&(e.bindFramebuffer(t,r),Q[t]=r,m&&(36009===t&&(Q[36160]=r),36160===t&&(Q[36009]=r)),!0)},bindXRFramebuffer:function(t){t!==w&&(e.bindFramebuffer(36160,t),w=t)},useProgram:function(t){return $!==t&&(e.useProgram(t),$=t,!0)},setBlending:s,setMaterial:function(e,t){e.side===x?a(2884):n(2884);var r=e.side===y;t&&(r=!r),o(r),e.blending===M&&!1===e.transparent?s(_):s(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),v.setFunc(e.depthFunc),v.setTest(e.depthTest),v.setMask(e.depthWrite),f.setMask(e.colorWrite);var i=e.stencilWrite;g.setTest(i),i&&(g.setMask(e.stencilWriteMask),g.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),g.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),d(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?n(32926):a(32926)},setFlipSided:o,setCullFace:l,setLineWidth:function(t){t!==ue&&(fe&&e.lineWidth(t),ue=t)},setPolygonOffset:d,setScissorTest:function(e){e?n(3089):a(3089)},activeTexture:p,bindTexture:function(t,r){null===ye&&p();var i=xe[ye];void 0===i&&(i={type:void 0,texture:void 0},xe[ye]=i),(i.type!==t||i.texture!==r)&&(e.bindTexture(t,r||Se[t]),i.type=t,i.texture=r)},unbindTexture:function(){var t=xe[ye];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===_e.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),_e.copy(t))},viewport:function(t){!1===Me.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),Me.copy(t))},reset:function(){e.disable(3042),e.disable(2884),e.disable(2929),e.disable(32823),e.disable(3089),e.disable(2960),e.disable(32926),e.blendEquation(32774),e.blendFunc(1,0),e.blendFuncSeparate(1,0,1,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(513),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(519,0,4294967295),e.stencilOp(7680,7680,7680),e.clearStencil(0),e.cullFace(1029),e.frontFace(2305),e.polygonOffset(0,0),e.activeTexture(33984),e.bindFramebuffer(36160,null),!0===m&&(e.bindFramebuffer(36009,null),e.bindFramebuffer(36008,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),b={},ye=null,xe={},w=null,Q={},$=null,ee=!1,te=null,re=null,ie=null,ne=null,ae=null,se=null,oe=null,le=!1,he=null,ce=null,ue=null,de=null,pe=null,_e.set(0,0,e.canvas.width,e.canvas.height),Me.set(0,0,e.canvas.width,e.canvas.height),f.reset(),v.reset(),g.reset()}}}function Jo(e,t,r,i,n,a,s){function o(e,t){return P?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function l(e,t,r,i){var n=1;if((e.width>i||e.height>i)&&(n=i/Math.max(e.width,e.height)),1>n||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Jr:Math.floor,s=a(n*e.width),l=a(n*e.height);void 0===S&&(S=o(s,l));var h=r?o(s,l):S;return h.width=s,h.height=l,h.getContext("2d").drawImage(e,0,0,s,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+l+")."),h}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function h(e){return Xr(e.width)&&Xr(e.height)}function c(e,t){return e.generateMipmaps&&t&&e.minFilter!==ge&&e.minFilter!==_e}function u(t,r,n,a){var s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1;e.generateMipmap(t),i.get(r).__maxMipLevel=Math.log2(Math.max(n,a,s))}function d(r,i,n){if(!1===T)return i;if(null!==r){if(void 0!==e[r])return e[r];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+r+"'")}var a=i;return 6403===i&&(5126===n&&(a=33326),5131===n&&(a=33325),5121===n&&(a=33321)),6407===i&&(5126===n&&(a=34837),5131===n&&(a=34843),5121===n&&(a=32849)),6408===i&&(5126===n&&(a=34836),5131===n&&(a=34842),5121===n&&(a=32856)),(33325===a||33326===a||34842===a||34836===a)&&t.get("EXT_color_buffer_float"),a}function p(e){return e===ge||e===ye||e===be?9728:9729}function m(t){var r=t.target;r.removeEventListener("dispose",m),function(t){var r=i.get(t);void 0===r.__webglInit||(e.deleteTexture(r.__webglTexture),i.remove(t))}(r),r.isVideoTexture&&C.delete(r),s.memory.textures--}function f(t){var r=t.target;r.removeEventListener("dispose",f),function(t){var r=t.texture,n=i.get(t),a=i.get(r);if(t){if(void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),s.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var o=0;6>o;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);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);if(t.isWebGLMultipleRenderTargets)for(var l,h=0,c=r.length;h<c;h++)(l=i.get(r[h])).__webglTexture&&(e.deleteTexture(l.__webglTexture),s.memory.textures--),i.remove(r[h]);i.remove(r),i.remove(t)}}(r)}function v(e,t){var n=i.get(e);if(e.isVideoTexture&&function(e){var t=s.render.frame;C.get(e)!==t&&(C.set(e,t),e.update())}(e),0<e.version&&n.__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 b(n,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}r.activeTexture(33984+t),r.bindTexture(3553,n.__webglTexture)}function g(t,n){var s=i.get(t);return 0<t.version&&s.__version!==t.version?void function(t,i,n){if(6===i.image.length){x(t,i),r.activeTexture(33984+n),r.bindTexture(34067,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);for(var s=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),o=i.image[0]&&i.image[0].isDataTexture,p=[],m=0;6>m;m++)p[m]=s||o?o?i.image[m].image:i.image[m]:l(i.image[m],!1,!0,A);var f,v=p[0],g=h(v)||T,b=a.convert(i.format),w=a.convert(i.type),_=d(i.internalFormat,b,w);if(y(34067,i,g),s){for(var M=0;6>M;M++){f=p[M].mipmaps;for(var S,E=0;E<f.length;E++)S=f[E],i.format!==Ve&&i.format!==Ge?null===b?console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):r.compressedTexImage2D(34069+M,E,_,S.width,S.height,0,S.data):r.texImage2D(34069+M,E,_,S.width,S.height,0,b,w,S.data)}t.__maxMipLevel=f.length-1}else{f=i.mipmaps;for(var L=0;6>L;L++)if(o){r.texImage2D(34069+L,0,_,p[L].width,p[L].height,0,b,w,p[L].data);for(var R=0;R<f.length;R++){var C=f[R].image[L].image;r.texImage2D(34069+L,R+1,_,C.width,C.height,0,b,w,C.data)}}else{r.texImage2D(34069+L,0,_,b,w,p[L]);for(var P,I=0;I<f.length;I++)P=f[I],r.texImage2D(34069+L,I+1,_,b,w,P.image[L])}t.__maxMipLevel=f.length}c(i,g)&&u(34067,i,v.width,v.height),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}}(s,t,n):(r.activeTexture(33984+n),void r.bindTexture(34067,s.__webglTexture))}function y(r,a,s){if(s?(e.texParameteri(r,10242,O[a.wrapS]),e.texParameteri(r,10243,O[a.wrapT]),(32879===r||35866===r)&&e.texParameteri(r,32882,O[a.wrapR]),e.texParameteri(r,10240,D[a.magFilter]),e.texParameteri(r,10241,D[a.minFilter])):(e.texParameteri(r,10242,33071),e.texParameteri(r,10243,33071),(32879===r||35866===r)&&e.texParameteri(r,32882,33071),(a.wrapS!==fe||a.wrapT!==fe)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(r,10240,p(a.magFilter)),e.texParameteri(r,10241,p(a.minFilter)),a.minFilter!==ge&&a.minFilter!==_e&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){var o=t.get("EXT_texture_filter_anisotropic");if(a.type===Oe&&!1===t.has("OES_texture_float_linear"))return;if(!1===T&&a.type===De&&!1===t.has("OES_texture_half_float_linear"))return;(1<a.anisotropy||i.get(a).__currentAnisotropy)&&(e.texParameterf(r,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,n.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function x(t,r){void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",m),t.__webglTexture=e.createTexture(),s.memory.textures++)}function b(t,i,n){var s=3553;i.isDataTexture2DArray&&(s=35866),i.isDataTexture3D&&(s=32879),x(t,i),r.activeTexture(33984+n),r.bindTexture(s,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);var o=function(e){return!T&&(e.wrapS!==fe||e.wrapT!==fe||e.minFilter!==ge&&e.minFilter!==_e)}(i)&&!1===h(i.image),p=l(i.image,o,!1,L),m=h(p)||T,f=a.convert(i.format),v=a.convert(i.type),g=d(i.internalFormat,f,v);y(s,i,m);var b,w=i.mipmaps;if(i.isDepthTexture)g=6402,T?g=i.type===Oe?36012:i.type===Ie?33190:i.type===ze?35056:33189:i.type===Oe&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===We&&6402===g&&i.type!==Ce&&i.type!==Ie&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Ce,v=a.convert(i.type)),i.format===Ze&&6402===g&&(g=34041,i.type!==ze&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=ze,v=a.convert(i.type))),r.texImage2D(3553,0,g,p.width,p.height,0,f,v,null);else if(i.isDataTexture)if(0<w.length&&m){for(var _=0,M=w.length;_<M;_++)b=w[_],r.texImage2D(3553,_,g,b.width,b.height,0,f,v,b.data);i.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else r.texImage2D(3553,0,g,p.width,p.height,0,f,v,p.data),t.__maxMipLevel=0;else if(i.isCompressedTexture){for(var S=0,E=w.length;S<E;S++)b=w[S],i.format!==Ve&&i.format!==Ge?null===f?console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):r.compressedTexImage2D(3553,S,g,b.width,b.height,0,b.data):r.texImage2D(3553,S,g,b.width,b.height,0,f,v,b.data);t.__maxMipLevel=w.length-1}else if(i.isDataTexture2DArray)r.texImage3D(35866,0,g,p.width,p.height,p.depth,0,f,v,p.data),t.__maxMipLevel=0;else if(i.isDataTexture3D)r.texImage3D(32879,0,g,p.width,p.height,p.depth,0,f,v,p.data),t.__maxMipLevel=0;else if(0<w.length&&m){for(var A=0,R=w.length;A<R;A++)b=w[A],r.texImage2D(3553,A,g,f,v,b);i.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else r.texImage2D(3553,0,g,f,v,p),t.__maxMipLevel=0;c(i,m)&&u(s,i,p.width,p.height),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}function w(t,n,s,o,l){var h=a.convert(s.format),c=a.convert(s.type),u=d(s.internalFormat,h,c);32879===l||35866===l?r.texImage3D(l,0,u,n.width,n.height,n.depth,0,h,c,null):r.texImage2D(l,0,u,n.width,n.height,0,h,c,null),r.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,l,i.get(s).__webglTexture,0),r.bindFramebuffer(36160,null)}function _(t,r,i){if(e.bindRenderbuffer(36161,t),r.depthBuffer&&!r.stencilBuffer){var n=33189;if(i){var s=r.depthTexture;s&&s.isDepthTexture&&(s.type===Oe?n=36012:s.type===Ie&&(n=33190));var o=M(r);e.renderbufferStorageMultisample(36161,o,n,r.width,r.height)}else e.renderbufferStorage(36161,n,r.width,r.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(r.depthBuffer&&r.stencilBuffer){if(i){var l=M(r);e.renderbufferStorageMultisample(36161,l,35056,r.width,r.height)}else e.renderbufferStorage(36161,34041,r.width,r.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var h=!0===r.isWebGLMultipleRenderTargets?r.texture[0]:r.texture,c=a.convert(h.format),u=a.convert(h.type),p=d(h.internalFormat,c,u);if(i){var m=M(r);e.renderbufferStorageMultisample(36161,m,p,r.width,r.height)}else e.renderbufferStorage(36161,p,r.width,r.height)}e.bindRenderbuffer(36161,null)}function M(e){return T&&e.isWebGLMultisampleRenderTarget?Math.min(R,e.samples):0}var S,T=n.isWebGL2,E=n.maxTextures,A=n.maxCubemapSize,L=n.maxTextureSize,R=n.maxSamples,C=new WeakMap,P=!1;try{P="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}var I=0,O={[me]:10497,[fe]:33071,[ve]:33648},D={[ge]:9728,[ye]:9984,[be]:9986,[_e]:9729,[Me]:9985,[Te]:9987},N=!1,B=!1;this.allocateTextureUnit=function(){var e=I;return e>=E&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+E),I+=1,e},this.resetTextureUnits=function(){I=0},this.setTexture2D=v,this.setTexture2DArray=function(e,t){var n=i.get(e);return 0<e.version&&n.__version!==e.version?void b(n,e,t):(r.activeTexture(33984+t),void r.bindTexture(35866,n.__webglTexture))},this.setTexture3D=function(e,t){var n=i.get(e);return 0<e.version&&n.__version!==e.version?void b(n,e,t):(r.activeTexture(33984+t),void r.bindTexture(32879,n.__webglTexture))},this.setTextureCube=g,this.setupRenderTarget=function(t){var o=t.texture,l=i.get(t),p=i.get(o);t.addEventListener("dispose",f),!0!==t.isWebGLMultipleRenderTargets&&(p.__webglTexture=e.createTexture(),p.__version=o.version,s.memory.textures++);var m=!0===t.isWebGLCubeRenderTarget,g=!0===t.isWebGLMultipleRenderTargets,x=!0===t.isWebGLMultisampleRenderTarget,b=o.isDataTexture3D||o.isDataTexture2DArray,S=h(t)||T;if(T&&o.format===Ge&&(o.type===Oe||o.type===De)&&(o.format=Ve,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),m){l.__webglFramebuffer=[];for(var E=0;6>E;E++)l.__webglFramebuffer[E]=e.createFramebuffer()}else if(l.__webglFramebuffer=e.createFramebuffer(),g)if(n.drawBuffers)for(var A,L=t.texture,R=0,C=L.length;R<C;R++)void 0===(A=i.get(L[R])).__webglTexture&&(A.__webglTexture=e.createTexture(),s.memory.textures++);else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(x)if(T){l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,l.__webglColorRenderbuffer);var P=a.convert(o.format),I=a.convert(o.type),O=d(o.internalFormat,P,I),D=M(t);e.renderbufferStorageMultisample(36161,D,O,t.width,t.height),r.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(l.__webglDepthRenderbuffer=e.createRenderbuffer(),_(l.__webglDepthRenderbuffer,t,!0)),r.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(m){r.bindTexture(34067,p.__webglTexture),y(34067,o,S);for(var N=0;6>N;N++)w(l.__webglFramebuffer[N],t,o,36064,34069+N);c(o,S)&&u(34067,o,t.width,t.height),r.bindTexture(34067,null)}else if(g){for(var B=t.texture,U=0,z=B.length;U<z;U++){var F=B[U],G=i.get(F);r.bindTexture(3553,G.__webglTexture),y(3553,F,S),w(l.__webglFramebuffer,t,F,36064+U,3553),c(F,S)&&u(3553,F,t.width,t.height)}r.bindTexture(3553,null)}else{var V=3553;b&&(T?V=o.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),r.bindTexture(V,p.__webglTexture),y(V,o,S),w(l.__webglFramebuffer,t,o,36064,V),c(o,S)&&u(V,o,t.width,t.height,t.depth),r.bindTexture(V,null)}t.depthBuffer&&function(t){var n=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(a)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(r.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),v(n.depthTexture,0);var a=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===We)e.framebufferTexture2D(36160,36096,3553,a,0);else{if(n.depthTexture.format!==Ze)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,a,0)}}(n.__webglFramebuffer,t)}else if(a){n.__webglDepthbuffer=[];for(var s=0;6>s;s++)r.bindFramebuffer(36160,n.__webglFramebuffer[s]),n.__webglDepthbuffer[s]=e.createRenderbuffer(),_(n.__webglDepthbuffer[s],t,!1)}else r.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),_(n.__webglDepthbuffer,t,!1);r.bindFramebuffer(36160,null)}(t)},this.updateRenderTargetMipmap=function(e){for(var t,n=h(e)||T,a=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture],s=0,o=a.length;s<o;s++)if(c(t=a[s],n)){var l=e.isWebGLCubeRenderTarget?34067:3553,d=i.get(t).__webglTexture;r.bindTexture(l,d),u(l,t,e.width,e.height),r.bindTexture(l,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(T){var n=t.width,a=t.height,s=16384;t.depthBuffer&&(s|=256),t.stencilBuffer&&(s|=1024);var o=i.get(t);r.bindFramebuffer(36008,o.__webglMultisampledFramebuffer),r.bindFramebuffer(36009,o.__webglFramebuffer),e.blitFramebuffer(0,0,n,a,0,0,n,a,s,9728),r.bindFramebuffer(36008,null),r.bindFramebuffer(36009,o.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===N&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),N=!0),e=e.texture),v(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),B=!0),e=e.texture),g(e,t)}}function Ko(e,t,r){var i=r.isWebGL2;return{convert:function(e){var r;if(e===Ae)return 5121;if(e===Ne)return 32819;if(e===Be)return 32820;if(e===Ue)return 33635;if(e===Le)return 5120;if(e===Re)return 5122;if(e===Ce)return 5123;if(e===Pe)return 5124;if(e===Ie)return 5125;if(e===Oe)return 5126;if(e===De)return i?5131:null===(r=t.get("OES_texture_half_float"))?null:r.HALF_FLOAT_OES;if(e===Fe)return 6406;if(e===Ge)return 6407;if(e===Ve)return 6408;if(e===He)return 6409;if(e===ke)return 6410;if(e===We)return 6402;if(e===Ze)return 34041;if(e===qe)return 6403;if(e===Xe)return 36244;if(e===Ye)return 33319;if(e===Je)return 33320;if(e===Ke)return 36248;if(e===Qe)return 36249;if(e===$e||e===et||e===tt||e===rt){if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(e===$e)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===et)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===tt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===rt)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e===it||e===nt||e===at||e===st){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(e===it)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===nt)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===at)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===st)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===ot)return null===(r=t.get("WEBGL_compressed_texture_etc1"))?null:r.COMPRESSED_RGB_ETC1_WEBGL;if((e===lt||e===ht)&&null!==(r=t.get("WEBGL_compressed_texture_etc"))){if(e===lt)return r.COMPRESSED_RGB8_ETC2;if(e===ht)return r.COMPRESSED_RGBA8_ETC2_EAC}return e===ct||e===ut||e===dt||e===pt||e===mt||e===ft||e===vt||e===gt||e===yt||e===xt||e===bt||e===wt||e===_t||e===Mt||e===Tt||e===Et||e===At||e===Lt||e===Rt||e===Ct||e===Pt||e===It||e===Ot||e===Dt||e===Nt||e===Bt||e===Ut||e===zt?null===(r=t.get("WEBGL_compressed_texture_astc"))?null:e:e===St?null===(r=t.get("EXT_texture_compression_bptc"))?null:e:e===ze?i?34042:null===(r=t.get("WEBGL_depth_texture"))?null:r.UNSIGNED_INT_24_8_WEBGL:void 0}}}class Qo extends Ca{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];super(),this.cameras=e}}Qo.prototype.isArrayCamera=!0;class $o extends pn{constructor(){super(),this.type="Group"}}$o.prototype.isGroup=!0;var el={type:"move"};class tl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new $o,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new $o,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ci,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ci),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new $o,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ci,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ci),this._grip}dispatchEvent(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(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(e,t,r){var i=null,n=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState)if(null!==s&&null!==(i=t.getPose(e.targetRaySpace,r))&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(el)),l&&e.hand){for(var h of(a=!0,e.hand.values())){var c=t.getJointPose(h,r);if(void 0===l.joints[h.jointName]){var u=new $o;u.matrixAutoUpdate=!1,u.visible=!1,l.joints[h.jointName]=u,l.add(u)}var d=l.joints[h.jointName];null!==c&&(d.matrix.fromArray(c.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.jointRadius=c.radius),d.visible=null!==c}var p=l.joints["index-finger-tip"],m=l.joints["thumb-tip"],f=p.position.distanceTo(m.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&&e.gripSpace&&null!==(n=t.getPose(e.gripSpace,r))&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1);return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==n),null!==l&&(l.visible=null!==a),this}}class rl extends zr{constructor(e,t){function r(e){var t=y.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function i(){y.forEach((function(e,t){e.disconnect(t)})),y.clear(),M=null,S=null,l.bindXRFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),L.stop(),o.isPresenting=!1,o.dispatchEvent({type:"sessionend"})}function a(e){for(var t=h.inputSources,r=0;r<g.length;r++)y.set(t[r],g[r]);for(var i=0;i<e.removed.length;i++){var n=e.removed[i],a=y.get(n);a&&(a.dispatchEvent({type:"disconnected",data:n}),y.delete(n))}for(var s=0;s<e.added.length;s++){var o=e.added[s],l=y.get(o);l&&l.dispatchEvent({type:"connected",data:o})}}function s(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}super();var o=this,l=e.state,h=null,c=1,u=null,d="local-floor",p=null,m=null,f=null,v=null,g=[],y=new Map,x=new Ca;x.layers.enable(1),x.viewport=new ai;var b=new Ca;b.layers.enable(2),b.viewport=new ai;var w=[x,b],_=new Qo;_.layers.enable(1),_.layers.enable(2);var M=null,S=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=g[e];return void 0===t&&(t=new tl,g[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=g[e];return void 0===t&&(t=new tl,g[e]=t),t.getGripSpace()},this.getHand=function(e){var t=g[e];return void 0===t&&(t=new tl,g[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){c=e,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){d=e,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u},this.getSession=function(){return h},this.setSession=function(){var e=n((function*(e){if(null!==(h=e)){h.addEventListener("select",r),h.addEventListener("selectstart",r),h.addEventListener("selectend",r),h.addEventListener("squeeze",r),h.addEventListener("squeezestart",r),h.addEventListener("squeezeend",r),h.addEventListener("end",i),h.addEventListener("inputsourceschange",a);var n=t.getContextAttributes();if(!0!==n.xrCompatible&&(yield t.makeXRCompatible()),void 0===h.renderState.layers){var s={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:c},l=new XRWebGLLayer(h,t,s);h.updateRenderState({baseLayer:l})}else{var p=0;n.depth&&(p=n.stencil?34041:6402);var g={colorFormat:n.alpha?6408:6407,depthFormat:p,scaleFactor:c};m=new XRWebGLBinding(h,t),v=m.createProjectionLayer(g),f=t.createFramebuffer(),h.updateRenderState({layers:[v]})}u=yield h.requestReferenceSpace(d),L.setContext(h),L.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}}));return function(t){return e.apply(this,arguments)}}();var T=new ci,E=new ci;this.updateCamera=function(e){if(null!==h){_.near=b.near=x.near=e.near,_.far=b.far=x.far=e.far,(M!==_.near||S!==_.far)&&(h.updateRenderState({depthNear:_.near,depthFar:_.far}),M=_.near,S=_.far);var t=e.parent,r=_.cameras;s(_,t);for(var i=0;i<r.length;i++)s(r[i],t);_.matrixWorld.decompose(_.position,_.quaternion,_.scale),e.position.copy(_.position),e.quaternion.copy(_.quaternion),e.scale.copy(_.scale),e.matrix.copy(_.matrix),e.matrixWorld.copy(_.matrixWorld);for(var n=e.children,a=0,o=n.length;a<o;a++)n[a].updateMatrixWorld(!0);2===r.length?function(e,t,r){T.setFromMatrixPosition(t.matrixWorld),E.setFromMatrixPosition(r.matrixWorld);var i=T.distanceTo(E),n=t.projectionMatrix.elements,a=r.projectionMatrix.elements,s=n[14]/(n[10]-1),o=n[14]/(n[10]+1),l=(n[9]+1)/n[5],h=(n[9]-1)/n[5],c=(n[8]-1)/n[0],u=(a[8]+1)/a[0],d=s*c,p=s*u,m=i/(-c+u),f=m*-c;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();var v=s+m,g=o+m,y=d-f,x=p+(i-f),b=l*o/g*v,w=h*o/g*v;e.projectionMatrix.makePerspective(y,x,b,w,v,g)}(_,x,b):_.projectionMatrix.copy(x.projectionMatrix)}},this.getCamera=function(){return _};var A=null,L=new Ha;L.setAnimationLoop((function(e,r){if(null!==(p=r.getViewerPose(u))){var i=p.views,n=h.renderState.baseLayer;void 0===h.renderState.layers&&l.bindXRFramebuffer(n.framebuffer);var a=!1;i.length!==_.cameras.length&&(_.cameras.length=0,a=!0);for(var s=0;s<i.length;s++){var o=i[s],c=null;if(void 0===h.renderState.layers)c=n.getViewport(o);else{var d=m.getViewSubImage(v,o);l.bindXRFramebuffer(f),t.framebufferTexture2D(36160,36064,3553,d.colorTexture,0),void 0!==d.depthStencilTexture&&t.framebufferTexture2D(36160,36096,3553,d.depthStencilTexture,0),c=d.viewport}var y=w[s];y.matrix.fromArray(o.transform.matrix),y.projectionMatrix.fromArray(o.projectionMatrix),y.viewport.set(c.x,c.y,c.width,c.height),0==s&&_.matrix.copy(y.matrix),!0===a&&_.cameras.push(y)}}for(var x=h.inputSources,b=0;b<g.length;b++){var M=g[b],S=x[b];M.update(S,r,u)}A&&A(e,r)})),this.setAnimationLoop=function(e){A=e},this.dispose=function(){}}}function il(e){function t(t,r){t.opacity.value=r.opacity,r.color&&t.diffuse.value.copy(r.color),r.emissive&&t.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(t.map.value=r.map),r.alphaMap&&(t.alphaMap.value=r.alphaMap),r.specularMap&&(t.specularMap.value=r.specularMap);var i,n,a=e.get(r).envMap;if(a){t.envMap.value=a,t.flipEnvMap.value=a.isCubeTexture&&a._needsFlipEnvMap?-1:1,t.reflectivity.value=r.reflectivity,t.refractionRatio.value=r.refractionRatio;var s=e.get(a).__maxMipLevel;void 0!==s&&(t.maxMipLevel.value=s)}r.lightMap&&(t.lightMap.value=r.lightMap,t.lightMapIntensity.value=r.lightMapIntensity),r.aoMap&&(t.aoMap.value=r.aoMap,t.aoMapIntensity.value=r.aoMapIntensity),r.map?i=r.map:r.specularMap?i=r.specularMap:r.displacementMap?i=r.displacementMap:r.normalMap?i=r.normalMap:r.bumpMap?i=r.bumpMap:r.roughnessMap?i=r.roughnessMap:r.metalnessMap?i=r.metalnessMap:r.alphaMap?i=r.alphaMap:r.emissiveMap?i=r.emissiveMap:r.clearcoatMap?i=r.clearcoatMap:r.clearcoatNormalMap?i=r.clearcoatNormalMap:r.clearcoatRoughnessMap&&(i=r.clearcoatRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix)),r.aoMap?n=r.aoMap:r.lightMap&&(n=r.lightMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uv2Transform.value.copy(n.matrix))}function r(t,r){t.roughness.value=r.roughness,t.metalness.value=r.metalness,r.roughnessMap&&(t.roughnessMap.value=r.roughnessMap),r.metalnessMap&&(t.metalnessMap.value=r.metalnessMap),r.emissiveMap&&(t.emissiveMap.value=r.emissiveMap),r.bumpMap&&(t.bumpMap.value=r.bumpMap,t.bumpScale.value=r.bumpScale,r.side===y&&(t.bumpScale.value*=-1)),r.normalMap&&(t.normalMap.value=r.normalMap,t.normalScale.value.copy(r.normalScale),r.side===y&&t.normalScale.value.negate()),r.displacementMap&&(t.displacementMap.value=r.displacementMap,t.displacementScale.value=r.displacementScale,t.displacementBias.value=r.displacementBias),e.get(r).envMap&&(t.envMapIntensity.value=r.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,n,a,s){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,t.side===y&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===y&&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,t.side===y&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===y&&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,i){r(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,t.side===y&&e.clearcoatNormalScale.value.negate()),e.transmission.value=t.transmission,t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),0<t.transmission&&(e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)}(e,i,s):r(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,t.side===y&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===y&&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,t.side===y&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===y&&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,r,i){var n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=.5*i,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,n,a):i.isSpriteMaterial?function(e,t){var r;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?r=t.map:t.alphaMap&&(r=t.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function nl(){function e(){return null===se?me:1}function t(e,t){for(var r=0;r<e.length;r++){var i=e[r],n=v.getContext(i,t);if(null!==n)return n}return null}function r(){O=new es(Ie),D=new Ka(Ie,O,f),O.init(D),$=new Ko(Ie,O,D),N=new Yo(Ie,O,D),_e[0]=1029,B=new is(Ie),U=new Oo,z=new Jo(Ie,O,N,U,D,$,B),F=new $a(re),G=new ka(Ie,D),ee=new Ya(Ie,O,G,D),V=new ts(Ie,G,B,ee),H=new os(Ie,V,G,B),J=new ss(Ie),q=new Qa(U),k=new Io(re,F,O,D,ee,q),j=new il(U),W=new Uo(U),Z=new ko(O,D),Y=new Xa(re,F,N,H,T),X=new Xo(re,H,D),K=new Ja(Ie,O,B,D),Q=new rs(Ie,O,B,D),B.programs=k.programs,re.capabilities=D,re.extensions=O,re.properties=U,re.renderLists=W,re.shadowMap=X,re.state=N,re.info=B}function i(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),ie=!0}function n(){console.log("THREE.WebGLRenderer: Context Restored."),ie=!1;var e=B.autoReset,t=X.enabled,i=X.autoUpdate,n=X.needsUpdate,a=X.type;r(),B.autoReset=e,X.enabled=t,X.autoUpdate=i,X.needsUpdate=n,X.type=a}function a(e){var t=e.target;t.removeEventListener("dispose",a),function(e){(function(e){var t=U.get(e).programs;void 0!==t&&t.forEach((function(e){k.releaseProgram(e)}))})(e),U.remove(e)}(t)}function s(){Fe.stop()}function o(){Fe.start()}function l(e,t,r,i){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)r=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)C.pushLight(e),e.castShadow&&C.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||Me.intersectsSprite(e)){i&&Ce.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Re);var n=H.update(e),a=e.material;a.visible&&R.push(e,n,a,r,Ce.z,null)}}else if(e.isImmediateRenderObject)i&&Ce.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Re),R.push(e,null,e.material,r,Ce.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==B.render.frame&&(e.skeleton.update(),e.skeleton.frame=B.render.frame),!e.frustumCulled||Me.intersectsObject(e))){i&&Ce.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Re);var s=H.update(e),o=e.material;if(Array.isArray(o))for(var h=s.groups,c=0,u=h.length;c<u;c++){var d=h[c],p=o[d.materialIndex];p&&p.visible&&R.push(e,s,p,r,Ce.z,d)}else o.visible&&R.push(e,s,o,r,Ce.z,null)}for(var m=e.children,f=0,v=m.length;f<v;f++)l(m[f],t,r,i)}}function h(e,t,r){for(var i=!0===t.isScene?t.overrideMaterial:null,n=0,a=e.length;n<a;n++){var s=e[n],o=s.object,l=s.geometry,h=null===i?s.material:i,u=s.group;if(r.isArrayCamera)for(var d,p=r.cameras,m=0,f=p.length;m<f;m++)d=p[m],o.layers.test(d.layers)&&(N.viewport(he.copy(d.viewport)),C.setupLightsView(d),c(o,t,d,l,h,u));else c(o,t,r,l,h,u)}}function c(e,t,r,i,n,a){if(e.onBeforeRender(re,t,r,i,n,a),e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var s=p(r,t,n,e);N.setMaterial(n),ee.reset(),function(e,t){e.render((function(e){re.renderBufferImmediate(e,t)}))}(e,s)}else!0===n.transparent&&n.side===x?(n.side=y,n.needsUpdate=!0,re.renderBufferDirect(r,t,i,n,e,a),n.side=g,n.needsUpdate=!0,re.renderBufferDirect(r,t,i,n,e,a),n.side=x):re.renderBufferDirect(r,t,i,n,e,a);e.onAfterRender(re,t,r,i,n,a)}function u(e,t,r){!0!==t.isScene&&(t=Pe);var i=U.get(e),n=C.state.lights,s=C.state.shadowsArray,o=n.state.version,l=k.getParameters(e,n.state,s,t,r),h=k.getProgramCacheKey(l),c=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=F.get(e.envMap||i.environment),void 0===c&&(e.addEventListener("dispose",a),c=new Map,i.programs=c);var u=c.get(h);if(void 0===u)l.uniforms=k.getUniforms(e),e.onBuild(l,re),e.onBeforeCompile(l,re),u=k.acquireProgram(l,h),c.set(h,u),i.uniforms=l.uniforms;else if(i.currentProgram===u&&i.lightsStateVersion===o)return d(e,l),u;var p=i.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(p.clippingPlanes=q.uniform),d(e,l),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&&(p.ambientLightColor.value=n.state.ambient,p.lightProbe.value=n.state.probe,p.directionalLights.value=n.state.directional,p.directionalLightShadows.value=n.state.directionalShadow,p.spotLights.value=n.state.spot,p.spotLightShadows.value=n.state.spotShadow,p.rectAreaLights.value=n.state.rectArea,p.ltc_1.value=n.state.rectAreaLTC1,p.ltc_2.value=n.state.rectAreaLTC2,p.pointLights.value=n.state.point,p.pointLightShadows.value=n.state.pointShadow,p.hemisphereLights.value=n.state.hemi,p.directionalShadowMap.value=n.state.directionalShadowMap,p.directionalShadowMatrix.value=n.state.directionalShadowMatrix,p.spotShadowMap.value=n.state.spotShadowMap,p.spotShadowMatrix.value=n.state.spotShadowMatrix,p.pointShadowMap.value=n.state.pointShadowMap,p.pointShadowMatrix.value=n.state.pointShadowMatrix);var m=u.getUniforms(),f=uo.seqWithValue(m.seq,p);return i.currentProgram=u,i.uniformsList=f,u}function d(e,t){var r=U.get(e);r.outputEncoding=t.outputEncoding,r.instancing=t.instancing,r.skinning=t.skinning,r.numClippingPlanes=t.numClippingPlanes,r.numIntersection=t.numClipIntersection,r.vertexAlphas=t.vertexAlphas}function p(e,t,r,i){!0!==t.isScene&&(t=Pe),z.resetTextureUnits();var n=t.fog,a=r.isMeshStandardMaterial?t.environment:null,s=null===se?re.outputEncoding:se.texture.encoding,o=F.get(r.envMap||a),l=!0===r.vertexColors&&i.geometry&&i.geometry.attributes.color&&4===i.geometry.attributes.color.itemSize,h=U.get(r),c=C.state.lights;if(!0===Se&&(!0===Ee||e!==le)){var d=e===le&&r.id===oe;q.setState(r,e,d)}var p=!1;r.version===h.__version?h.needsLights&&h.lightsStateVersion!==c.state.version?p=!0:h.outputEncoding===s?i.isInstancedMesh&&!1===h.instancing?p=!0:i.isInstancedMesh||!0!==h.instancing?i.isSkinnedMesh&&!1===h.skinning||!i.isSkinnedMesh&&!0===h.skinning||h.envMap!==o||r.fog&&h.fog!==n?p=!0:void 0===h.numClippingPlanes||h.numClippingPlanes===q.numPlanes&&h.numIntersection===q.numIntersection?h.vertexAlphas!==l&&(p=!0):p=!0:p=!0:p=!0:(p=!0,h.__version=r.version);var m=h.currentProgram;1==p&&(m=u(r,t,i));var f,v,g=!1,y=!1,x=!1,b=m.getUniforms(),w=h.uniforms;if(N.useProgram(m.program)&&(g=!0,y=!0,x=!0),r.id!==oe&&(oe=r.id,y=!0),g||le!==e){if(b.setValue(Ie,"projectionMatrix",e.projectionMatrix),D.logarithmicDepthBuffer&&b.setValue(Ie,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),le!==e&&(le=e,y=!0,x=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){var _=b.map.cameraPosition;void 0!==_&&_.setValue(Ie,Ce.setFromMatrixPosition(e.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&b.setValue(Ie,"isOrthographic",!0===e.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&b.setValue(Ie,"viewMatrix",e.matrixWorldInverse)}if(i.isSkinnedMesh){b.setOptional(Ie,i,"bindMatrix"),b.setOptional(Ie,i,"bindMatrixInverse");var M=i.skeleton;M&&(D.floatVertexTextures?(null===M.boneTexture&&M.computeBoneTexture(),b.setValue(Ie,"boneTexture",M.boneTexture,z),b.setValue(Ie,"boneTextureSize",M.boneTextureSize)):b.setOptional(Ie,M,"boneMatrices"))}return(y||h.receiveShadow!==i.receiveShadow)&&(h.receiveShadow=i.receiveShadow,b.setValue(Ie,"receiveShadow",i.receiveShadow)),y&&(b.setValue(Ie,"toneMappingExposure",re.toneMappingExposure),h.needsLights&&(v=x,(f=w).ambientLightColor.needsUpdate=v,f.lightProbe.needsUpdate=v,f.directionalLights.needsUpdate=v,f.directionalLightShadows.needsUpdate=v,f.pointLights.needsUpdate=v,f.pointLightShadows.needsUpdate=v,f.spotLights.needsUpdate=v,f.spotLightShadows.needsUpdate=v,f.rectAreaLights.needsUpdate=v,f.hemisphereLights.needsUpdate=v),n&&r.fog&&j.refreshFogUniforms(w,n),j.refreshMaterialUniforms(w,r,me,pe,Le),uo.upload(Ie,h.uniformsList,w,z)),r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(uo.upload(Ie,h.uniformsList,w,z),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&b.setValue(Ie,"center",i.center),b.setValue(Ie,"modelViewMatrix",i.modelViewMatrix),b.setValue(Ie,"normalMatrix",i.normalMatrix),b.setValue(Ie,"modelMatrix",i.matrixWorld),m}var m,f=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},v=void 0===f.canvas?((m=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).style.display="block",m):f.canvas,b=void 0===f.context?null:f.context,w=void 0!==f.alpha&&f.alpha,_=!(void 0!==f.depth)||f.depth,M=!(void 0!==f.stencil)||f.stencil,S=void 0!==f.antialias&&f.antialias,T=!(void 0!==f.premultipliedAlpha)||f.premultipliedAlpha,E=void 0!==f.preserveDrawingBuffer&&f.preserveDrawingBuffer,A=void 0===f.powerPreference?"default":f.powerPreference,L=void 0!==f.failIfMajorPerformanceCaveat&&f.failIfMajorPerformanceCaveat,R=null,C=null,P=[],I=[];this.domElement=v,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=$t,this.physicallyCorrectLights=!1,this.toneMapping=te,this.toneMappingExposure=1;var O,D,N,B,U,z,F,G,V,H,k,j,W,Z,q,X,Y,J,K,Q,$,ee,re=this,ie=!1,ne=0,ae=0,se=null,oe=-1,le=null,he=new ai,ce=new ai,ue=null,de=v.width,pe=v.height,me=1,ve=null,ye=null,xe=new ai(0,0,de,pe),be=new ai(0,0,de,pe),we=!1,_e=[],Me=new Va,Se=!1,Ee=!1,Le=null,Re=new Vi,Ce=new ci,Pe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Ie=b;try{var Ne={alpha:w,depth:_,stencil:M,antialias:S,premultipliedAlpha:T,preserveDrawingBuffer:E,powerPreference:A,failIfMajorPerformanceCaveat:L};if(v.addEventListener("webglcontextlost",i,!1),v.addEventListener("webglcontextrestored",n,!1),null===Ie){var Be=["webgl2","webgl","experimental-webgl"];if(!0===re.isWebGL1Renderer&&Be.shift(),null===(Ie=t(Be,Ne)))throw t(Be)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===Ie.getShaderPrecisionFormat&&(Ie.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}r();var Ue=new rl(re,Ie);this.xr=Ue,this.getContext=function(){return Ie},this.getContextAttributes=function(){return Ie.getContextAttributes()},this.forceContextLoss=function(){var e=O.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=O.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return me},this.setPixelRatio=function(e){void 0===e||(me=e,this.setSize(de,pe,!1))},this.getSize=function(e){return e.set(de,pe)},this.setSize=function(e,t,r){return Ue.isPresenting?void console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(de=e,pe=t,v.width=Math.floor(e*me),v.height=Math.floor(t*me),!1!==r&&(v.style.width=e+"px",v.style.height=t+"px"),void this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(de*me,pe*me).floor()},this.setDrawingBufferSize=function(e,t,r){de=e,pe=t,me=r,v.width=Math.floor(e*r),v.height=Math.floor(t*r),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(he)},this.getViewport=function(e){return e.copy(xe)},this.setViewport=function(e,t,r,i){e.isVector4?xe.set(e.x,e.y,e.z,e.w):xe.set(e,t,r,i),N.viewport(he.copy(xe).multiplyScalar(me).floor())},this.getScissor=function(e){return e.copy(be)},this.setScissor=function(e,t,r,i){e.isVector4?be.set(e.x,e.y,e.z,e.w):be.set(e,t,r,i),N.scissor(ce.copy(be).multiplyScalar(me).floor())},this.getScissorTest=function(){return we},this.setScissorTest=function(e){N.setScissorTest(we=e)},this.setOpaqueSort=function(e){ve=e},this.setTransparentSort=function(e){ye=e},this.getClearColor=function(e){return e.copy(Y.getClearColor())},this.setClearColor=function(){Y.setClearColor.apply(Y,arguments)},this.getClearAlpha=function(){return Y.getClearAlpha()},this.setClearAlpha=function(){Y.setClearAlpha.apply(Y,arguments)},this.clear=function(e,t,r){var i=0;(void 0===e||e)&&(i|=16384),(void 0===t||t)&&(i|=256),(void 0===r||r)&&(i|=1024),Ie.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(){v.removeEventListener("webglcontextlost",i,!1),v.removeEventListener("webglcontextrestored",n,!1),W.dispose(),Z.dispose(),U.dispose(),F.dispose(),H.dispose(),ee.dispose(),Ue.dispose(),Ue.removeEventListener("sessionstart",s),Ue.removeEventListener("sessionend",o),Le&&(Le.dispose(),Le=null),Fe.stop()},this.renderBufferImmediate=function(e,t){ee.initAttributes();var r=U.get(e);e.hasPositions&&!r.position&&(r.position=Ie.createBuffer()),e.hasNormals&&!r.normal&&(r.normal=Ie.createBuffer()),e.hasUvs&&!r.uv&&(r.uv=Ie.createBuffer()),e.hasColors&&!r.color&&(r.color=Ie.createBuffer());var i=t.getAttributes();e.hasPositions&&(Ie.bindBuffer(34962,r.position),Ie.bufferData(34962,e.positionArray,35048),ee.enableAttribute(i.position),Ie.vertexAttribPointer(i.position,3,5126,!1,0,0)),e.hasNormals&&(Ie.bindBuffer(34962,r.normal),Ie.bufferData(34962,e.normalArray,35048),ee.enableAttribute(i.normal),Ie.vertexAttribPointer(i.normal,3,5126,!1,0,0)),e.hasUvs&&(Ie.bindBuffer(34962,r.uv),Ie.bufferData(34962,e.uvArray,35048),ee.enableAttribute(i.uv),Ie.vertexAttribPointer(i.uv,2,5126,!1,0,0)),e.hasColors&&(Ie.bindBuffer(34962,r.color),Ie.bufferData(34962,e.colorArray,35048),ee.enableAttribute(i.color),Ie.vertexAttribPointer(i.color,3,5126,!1,0,0)),ee.disableUnusedAttributes(),Ie.drawArrays(4,0,e.count),e.count=0},this.renderBufferDirect=function(t,r,i,n,a,s){null===r&&(r=Pe);var o=a.isMesh&&0>a.matrixWorld.determinant(),l=p(t,r,n,a);N.setMaterial(n,o);var h=i.index,c=i.attributes.position;if(null===h){if(void 0===c||0===c.count)return}else if(0===h.count)return;var u=1;!0===n.wireframe&&(h=V.getWireframeAttribute(i),u=2),(n.morphTargets||n.morphNormals)&&J.update(a,i,n,l),ee.setup(a,n,l,i,h);var d,m=K;null!==h&&(d=G.get(h),(m=Q).setIndex(d));var f=null===h?c.count:h.count,v=i.drawRange.start*u,g=i.drawRange.count*u,y=null===s?0:s.start*u,x=null===s?1/0:s.count*u,b=Math.max(v,y),w=Math.min(f,v+g,y+x)-1,_=Math.max(0,w-b+1);if(0!==_){if(a.isMesh)!0===n.wireframe?(N.setLineWidth(n.wireframeLinewidth*e()),m.setMode(1)):m.setMode(4);else if(a.isLine){var M=n.linewidth;void 0===M&&(M=1),N.setLineWidth(M*e()),a.isLineSegments?m.setMode(1):a.isLineLoop?m.setMode(2):m.setMode(3)}else a.isPoints?m.setMode(0):a.isSprite&&m.setMode(4);if(a.isInstancedMesh)m.renderInstances(b,_,a.count);else if(i.isInstancedBufferGeometry){var S=Math.min(i.instanceCount,i._maxInstanceCount);m.renderInstances(b,_,S)}else m.render(b,_)}},this.compile=function(e,t){(C=Z.get(e)).init(),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(C.pushLight(e),e.castShadow&&C.pushShadow(e))})),C.setupLights(),e.traverse((function(t){var r=t.material;if(r)if(Array.isArray(r))for(var i=0;i<r.length;i++)u(r[i],e,t);else u(r,e,t)}))};var ze=null,Fe=new Ha;Fe.setAnimationLoop((function(e){ze&&ze(e)})),"undefined"!=typeof window&&Fe.setContext(window),this.setAnimationLoop=function(e){ze=e,Ue.setAnimationLoop(e),null===e?Fe.stop():Fe.start()},Ue.addEventListener("sessionstart",s),Ue.addEventListener("sessionend",o),this.render=function(e,t){if(void 0===t||!0===t.isCamera){if(!0!==ie){!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),!0===Ue.enabled&&!0===Ue.isPresenting&&(!0===Ue.cameraAutoUpdate&&Ue.updateCamera(t),t=Ue.getCamera()),!0===e.isScene&&e.onBeforeRender(re,e,t,se),(C=Z.get(e,I.length)).init(),I.push(C),Re.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Me.setFromProjectionMatrix(Re),Ee=this.localClippingEnabled,Se=q.init(this.clippingPlanes,Ee,t),(R=W.get(e,P.length)).init(),P.push(R),l(e,t,0,re.sortObjects),R.finish(),!0===re.sortObjects&&R.sort(ve,ye),!0===Se&&q.beginShadows();var r=C.state.shadowsArray;X.render(r,e,t),C.setupLights(),C.setupLightsView(t),!0===Se&&q.endShadows(),!0===this.info.autoReset&&this.info.reset(),Y.render(R,e);var i=R.opaque,n=R.transmissive,a=R.transparent;0<i.length&&h(i,e,t),0<n.length&&function(e,t,r,i){if(null===Le){var n=!0===S&&!0===D.isWebGL2;Le=new(n?li:si)(1024,1024,{generateMipmaps:!0,type:null===$.convert(De)?Ae:De,minFilter:Te,magFilter:ge,wrapS:fe,wrapT:fe})}var a=re.getRenderTarget();re.setRenderTarget(Le),re.clear();var s=re.toneMapping;re.toneMapping=te,h(e,r,i),re.toneMapping=s,z.updateMultisampleRenderTarget(Le),z.updateRenderTargetMipmap(Le),re.setRenderTarget(a),h(t,r,i)}(i,n,e,t),0<a.length&&h(a,e,t),null!==se&&(z.updateMultisampleRenderTarget(se),z.updateRenderTargetMipmap(se)),!0===e.isScene&&e.onAfterRender(re,e,t),N.buffers.depth.setTest(!0),N.buffers.depth.setMask(!0),N.buffers.color.setMask(!0),N.setPolygonOffset(!1),ee.resetDefaultState(),oe=-1,le=null,I.pop(),C=0<I.length?I[I.length-1]:null,P.pop(),R=0<P.length?P[P.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return ne},this.getActiveMipmapLevel=function(){return ae},this.getRenderTarget=function(){return se},this.setRenderTarget=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;se=e,ne=t,ae=r,e&&void 0===U.get(e).__webglFramebuffer&&z.setupRenderTarget(e);var i=null,n=!1,a=!1;if(e){var s=e.texture;(s.isDataTexture3D||s.isDataTexture2DArray)&&(a=!0);var o=U.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=o[t],n=!0):i=e.isWebGLMultisampleRenderTarget?U.get(e).__webglMultisampledFramebuffer:o,he.copy(e.viewport),ce.copy(e.scissor),ue=e.scissorTest}else he.copy(xe).multiplyScalar(me).floor(),ce.copy(be).multiplyScalar(me).floor(),ue=we;if(N.bindFramebuffer(36160,i)&&D.drawBuffers){var l=!1;if(e)if(e.isWebGLMultipleRenderTargets){var h=e.texture;if(_e.length!==h.length||36064!==_e[0]){for(var c=0,u=h.length;c<u;c++)_e[c]=36064+c;_e.length=h.length,l=!0}}else(1!==_e.length||36064!==_e[0])&&(_e[0]=36064,_e.length=1,l=!0);else(1!==_e.length||1029!==_e[0])&&(_e[0]=1029,_e.length=1,l=!0);l&&(D.isWebGL2?Ie.drawBuffers(_e):O.get("WEBGL_draw_buffers").drawBuffersWEBGL(_e))}if(N.viewport(he),N.scissor(ce),N.setScissorTest(ue),n){var d=U.get(e.texture);Ie.framebufferTexture2D(36160,36064,34069+t,d.__webglTexture,r)}else if(a){var p=U.get(e.texture),m=t||0;Ie.framebufferTextureLayer(36160,36064,p.__webglTexture,r||0,m)}},this.readRenderTargetPixels=function(e,t,r,i,n,a,s){if(e&&e.isWebGLRenderTarget){var o=U.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){N.bindFramebuffer(36160,o);try{var l=e.texture,h=l.format,c=l.type;if(h!==Ve&&$.convert(h)!==Ie.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var u=c===De&&(O.has("EXT_color_buffer_half_float")||D.isWebGL2&&O.has("EXT_color_buffer_float"));if(!(c===Ae||$.convert(c)===Ie.getParameter(35738)||c===Oe&&(D.isWebGL2||O.has("OES_texture_float")||O.has("WEBGL_color_buffer_float"))||u))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===Ie.checkFramebufferStatus(36160)?0<=t&&t<=e.width-i&&0<=r&&r<=e.height-n&&Ie.readPixels(t,r,i,n,$.convert(h),$.convert(c),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{var d=null===se?null:U.get(se).__webglFramebuffer;N.bindFramebuffer(36160,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=Math.pow(2,-r),n=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),s=$.convert(t.format);D.isWebGL2&&(6407===s&&(s=32849),6408===s&&(s=32856)),z.setTexture2D(t,0),Ie.copyTexImage2D(3553,r,s,e.x,e.y,n,a,0),N.unbindTexture()},this.copyTextureToTexture=function(e,t,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,n=t.image.width,a=t.image.height,s=$.convert(r.format),o=$.convert(r.type);z.setTexture2D(r,0),Ie.pixelStorei(37440,r.flipY),Ie.pixelStorei(37441,r.premultiplyAlpha),Ie.pixelStorei(3317,r.unpackAlignment),t.isDataTexture?Ie.texSubImage2D(3553,i,e.x,e.y,n,a,s,o,t.image.data):t.isCompressedTexture?Ie.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,s,t.mipmaps[0].data):Ie.texSubImage2D(3553,i,e.x,e.y,s,o,t.image),0===i&&r.generateMipmaps&&Ie.generateMipmap(3553),N.unbindTexture()},this.copyTextureToTexture3D=function(e,t,r,i){var n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0;if(re.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,s=e.max.x-e.min.x+1,o=e.max.y-e.min.y+1,l=e.max.z-e.min.z+1,h=$.convert(i.format),c=$.convert(i.type);if(i.isDataTexture3D)z.setTexture3D(i,0),a=32879;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");z.setTexture2DArray(i,0),a=35866}Ie.pixelStorei(37440,i.flipY),Ie.pixelStorei(37441,i.premultiplyAlpha),Ie.pixelStorei(3317,i.unpackAlignment);var u=Ie.getParameter(3314),d=Ie.getParameter(32878),p=Ie.getParameter(3316),m=Ie.getParameter(3315),f=Ie.getParameter(32877),v=r.isCompressedTexture?r.mipmaps[0]:r.image;Ie.pixelStorei(3314,v.width),Ie.pixelStorei(32878,v.height),Ie.pixelStorei(3316,e.min.x),Ie.pixelStorei(3315,e.min.y),Ie.pixelStorei(32877,e.min.z),r.isDataTexture||r.isDataTexture3D?Ie.texSubImage3D(a,n,t.x,t.y,t.z,s,o,l,h,c,v.data):r.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Ie.compressedTexSubImage3D(a,n,t.x,t.y,t.z,s,o,l,h,v.data)):Ie.texSubImage3D(a,n,t.x,t.y,t.z,s,o,l,h,c,v),Ie.pixelStorei(3314,u),Ie.pixelStorei(32878,d),Ie.pixelStorei(3316,p),Ie.pixelStorei(3315,m),Ie.pixelStorei(32877,f),0===n&&i.generateMipmaps&&Ie.generateMipmap(a),N.unbindTexture()}},this.initTexture=function(e){z.setTexture2D(e,0),N.unbindTexture()},this.resetState=function(){ne=0,ae=0,se=null,N.reset(),ee.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class al extends nl{}al.prototype.isWebGL1Renderer=!0;class sl{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:25e-5;this.name="",this.color=new On(e),this.density=t}clone(){return new sl(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}sl.prototype.isFogExp2=!0;class ol{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1e3;this.name="",this.color=new On(e),this.near=t,this.far=r}clone(){return new ol(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}ol.prototype.isFog=!0;class ll extends pn{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){var t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}ll.prototype.isScene=!0;class hl{constructor(e,t){this.array=e,this.stride=t,this.count=void 0===e?0:e.length/t,this.usage=Ar,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=jr()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(var i=0,n=this.stride;i<n;i++)this.array[e+i]=t.array[r+i];return this}set(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=jr()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=jr()),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}}}hl.prototype.isInterleavedBuffer=!0;var cl=new ci;class ul{constructor(e,t,r){var i=!!(3<arguments.length&&void 0!==arguments[3])&&arguments[3];this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=!0===i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(var t=0,r=this.data.count;t<r;t++)cl.x=this.getX(t),cl.y=this.getY(t),cl.z=this.getZ(t),cl.applyMatrix4(e),this.setXYZ(t,cl.x,cl.y,cl.z);return this}applyNormalMatrix(e){for(var t=0,r=this.count;t<r;t++)cl.x=this.getX(t),cl.y=this.getY(t),cl.z=this.getZ(t),cl.applyNormalMatrix(e),this.setXYZ(t,cl.x,cl.y,cl.z);return this}transformDirection(e){for(var t=0,r=this.count;t<r;t++)cl.x=this.getX(t),cl.y=this.getY(t),cl.z=this.getZ(t),cl.transformDirection(e),this.setXYZ(t,cl.x,cl.y,cl.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this}setXYZW(e,t,r,i,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=n,this}clone(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var t,r=[],i=0;i<this.count;i++){t=i*this.data.stride+this.offset;for(var n=0;n<this.itemSize;n++)r.push(this.data.array[t+n])}return new Un(new this.array.constructor(r),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 ul(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var t,r=[],i=0;i<this.count;i++){t=i*this.data.stride+this.offset;for(var n=0;n<this.itemSize;n++)r.push(this.data.array[t+n])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:r,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}}}ul.prototype.isInterleavedBufferAttribute=!0;class dl extends En{constructor(e){super(),this.type="SpriteMaterial",this.color=new On(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this}}dl.prototype.isSpriteMaterial=!0;var pl,ml=new ci,fl=new ci,vl=new ci,gl=new $r,yl=new $r,xl=new Vi,bl=new ci,wl=new ci,_l=new ci,Ml=new $r,Sl=new $r,Tl=new $r;class El extends pn{constructor(e){if(super(),this.type="Sprite",void 0===pl){pl=new na;var t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new hl(t,5);pl.setIndex([0,1,2,0,2,3]),pl.setAttribute("position",new ul(r,3,0,!1)),pl.setAttribute("uv",new ul(r,2,3,!1))}this.geometry=pl,this.material=void 0===e?new dl:e,this.center=new $r(.5,.5)}raycast(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),fl.setFromMatrixScale(this.matrixWorld),xl.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vl.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&fl.multiplyScalar(-vl.z);var r,i,n=this.material.rotation;0!==n&&(i=Math.cos(n),r=Math.sin(n));var a=this.center;Al(bl.set(-.5,-.5,0),vl,a,fl,r,i),Al(wl.set(.5,-.5,0),vl,a,fl,r,i),Al(_l.set(.5,.5,0),vl,a,fl,r,i),Ml.set(0,0),Sl.set(1,0),Tl.set(1,1);var s=e.ray.intersectTriangle(bl,wl,_l,!1,ml);if(null!==s||(Al(wl.set(-.5,.5,0),vl,a,fl,r,i),Sl.set(0,1),null!==(s=e.ray.intersectTriangle(bl,_l,wl,!1,ml)))){var o=e.ray.origin.distanceTo(ml);o<e.near||o>e.far||t.push({distance:o,point:ml.clone(),uv:Sn.getUV(ml,bl,wl,_l,Ml,Sl,Tl,new $r),face:null,object:this})}}copy(e){return super.copy(e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Al(e,t,r,i,n,a){gl.subVectors(e,r).addScalar(.5).multiply(i),void 0===n?yl.copy(gl):(yl.x=a*gl.x-n*gl.y,yl.y=n*gl.x+a*gl.y),e.copy(t),e.x+=yl.x,e.y+=yl.y,e.applyMatrix4(xl)}El.prototype.isSprite=!0;var Ll=new ci,Rl=new ci;class Cl extends pn{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);for(var t,r=e.levels,i=0,n=r.length;i<n;i++)t=r[i],this.addLevel(t.object.clone(),t.distance);return this.autoUpdate=e.autoUpdate,this}addLevel(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;t=Math.abs(t);var r,i=this.levels;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){var t=this.levels;if(0<t.length){var r,i;for(r=1,i=t.length;r<i&&!(e<t[r].distance);r++);return t[r-1].object}return null}raycast(e,t){if(0<this.levels.length){Ll.setFromMatrixPosition(this.matrixWorld);var r=e.ray.origin.distanceTo(Ll);this.getObjectForDistance(r).raycast(e,t)}}update(e){var t=this.levels;if(1<t.length){Ll.setFromMatrixPosition(e.matrixWorld),Rl.setFromMatrixPosition(this.matrixWorld);var r,i,n=Ll.distanceTo(Rl)/e.zoom;for(t[0].object.visible=!0,r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}}toJSON(e){var t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var r,i=this.levels,n=0,a=i.length;n<a;n++)r=i[n],t.object.levels.push({object:r.object.uuid,distance:r.distance});return t}}var Pl=new ci,Il=new ai,Ol=new ai,Dl=new ci,Nl=new Vi;class Bl extends _a{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Vi,this.bindMatrixInverse=new Vi}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){for(var e=new ai,t=this.geometry.attributes.skinWeight,r=0,i=t.count;r<i;r++){e.x=t.getX(r),e.y=t.getY(r),e.z=t.getZ(r),e.w=t.getW(r);var n=1/e.manhattanLength();n==1/0?e.set(1,0,0,0):e.multiplyScalar(n),t.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){var r=this.skeleton,i=this.geometry;Il.fromBufferAttribute(i.attributes.skinIndex,e),Ol.fromBufferAttribute(i.attributes.skinWeight,e),Pl.fromBufferAttribute(i.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var n,a=0;4>a;a++)if(0!==(n=Ol.getComponent(a))){var s=Il.getComponent(a);Nl.multiplyMatrices(r.bones[s].matrixWorld,r.boneInverses[s]),t.addScaledVector(Dl.copy(Pl).applyMatrix4(Nl),n)}return t.applyMatrix4(this.bindMatrixInverse)}}Bl.prototype.isSkinnedMesh=!0;class Ul extends pn{constructor(){super(),this.type="Bone"}}Ul.prototype.isBone=!0;class zl extends ii{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=8<arguments.length&&void 0!==arguments[8]?arguments[8]:ge,n=9<arguments.length&&void 0!==arguments[9]?arguments[9]:ge;super(null,5<arguments.length?arguments[5]:void 0,6<arguments.length?arguments[6]:void 0,7<arguments.length?arguments[7]:void 0,i,n,3<arguments.length?arguments[3]:void 0,4<arguments.length?arguments[4]:void 0,10<arguments.length?arguments[10]:void 0,11<arguments.length?arguments[11]:void 0),this.image={data:e,width:t,height:r},this.magFilter=i,this.minFilter=n,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}zl.prototype.isDataTexture=!0;var Fl=new Vi,Gl=new Vi;class Vl{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];this.uuid=jr(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){var e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var r=0,i=this.bones.length;r<i;r++)this.boneInverses.push(new Vi)}}calculateInverses(){this.boneInverses.length=0;for(var e,t=0,r=this.bones.length;t<r;t++)e=new Vi,this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}pose(){for(var e,t=0,r=this.bones.length;t<r;t++)(e=this.bones[t])&&e.matrixWorld.copy(this.boneInverses[t]).invert();for(var i,n=0,a=this.bones.length;n<a;n++)(i=this.bones[n])&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}update(){for(var e,t=this.bones,r=this.boneInverses,i=this.boneMatrices,n=this.boneTexture,a=0,s=t.length;a<s;a++)e=t[a]?t[a].matrixWorld:Gl,Fl.multiplyMatrices(e,r[a]),Fl.toArray(i,16*a);null!==n&&(n.needsUpdate=!0)}clone(){return new Vl(this.bones,this.boneInverses)}computeBoneTexture(){var e=Math.sqrt(4*this.bones.length);e=Yr(e),e=Math.max(e,4);var t=new Float32Array(e*e*4);t.set(this.boneMatrices);var r=new zl(t,e,e,Ve,Oe);return this.boneMatrices=t,this.boneTexture=r,this.boneTextureSize=e,this}getBoneByName(e){for(var t,r=0,i=this.bones.length;r<i;r++)if((t=this.bones[r]).name===e)return t}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(var r=0,i=e.bones.length;r<i;r++){var n=e.bones[r],a=t[n];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",n),a=new Ul),this.bones.push(a),this.boneInverses.push((new Vi).fromArray(e.boneInverses[r]))}return this.init(),this}toJSON(){for(var e,t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[],uuid:this.uuid},r=this.bones,i=this.boneInverses,n=0,a=r.length;n<a;n++){e=r[n],t.bones.push(e.uuid);var s=i[n];t.boneInverses.push(s.toArray())}return t}}var Hl=new Vi,kl=new Vi,jl=[],Wl=new _a;class Zl extends _a{constructor(e,t,r){super(e,t),this.instanceMatrix=new Un(new Float32Array(16*r),16),this.instanceColor=null,this.count=r,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}raycast(e,t){var r=this.matrixWorld,i=this.count;if(Wl.geometry=this.geometry,Wl.material=this.material,void 0!==Wl.material)for(var n=0;n<i;n++){this.getMatrixAt(n,Hl),kl.multiplyMatrices(r,Hl),Wl.matrixWorld=kl,Wl.raycast(e,jl);for(var a,s=0,o=jl.length;s<o;s++)(a=jl[s]).instanceId=n,a.object=this,t.push(a);jl.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new Un(new Float32Array(3*this.count),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}Zl.prototype.isInstancedMesh=!0;class ql extends En{constructor(e){super(),this.type="LineBasicMaterial",this.color=new On(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this}}ql.prototype.isLineBasicMaterial=!0;var Xl=new ci,Yl=new ci,Jl=new Vi,Kl=new Gi,Ql=new Ii;class $l extends pn{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new na,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ql;super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[0],i=1,n=t.count;i<n;i++)Xl.fromBufferAttribute(t,i-1),Yl.fromBufferAttribute(t,i),r[i]=r[i-1],r[i]+=Xl.distanceTo(Yl);e.setAttribute("lineDistance",new Zn(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){var r=this.geometry,i=this.matrixWorld,n=e.params.Line.threshold,a=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),Ql.copy(r.boundingSphere),Ql.applyMatrix4(i),Ql.radius+=n,!1!==e.ray.intersectsSphere(Ql)){Jl.copy(i).invert(),Kl.copy(e.ray).applyMatrix4(Jl);var s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=new ci,h=new ci,c=new ci,u=new ci,d=this.isLineSegments?2:1;if(r.isBufferGeometry){var p=r.index,m=r.attributes.position;if(null!==p)for(var f=Math.max(0,a.start),v=Math.min(p.count,a.start+a.count)-1;f<v;f+=d){var g=p.getX(f),y=p.getX(f+1);if(l.fromBufferAttribute(m,g),h.fromBufferAttribute(m,y),!(Kl.distanceSqToSegment(l,h,u,c)>o)){u.applyMatrix4(this.matrixWorld);var x=e.ray.origin.distanceTo(u);x<e.near||x>e.far||t.push({distance:x,point:c.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this})}}else for(var b=Math.max(0,a.start),w=Math.min(m.count,a.start+a.count)-1;b<w;b+=d)if(l.fromBufferAttribute(m,b),h.fromBufferAttribute(m,b+1),!(Kl.distanceSqToSegment(l,h,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:b,face:null,faceIndex:null,object:this})}}else r.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,r=Object.keys(t);if(0<r.length){var i=t[r[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var n,a=0,s=i.length;a<s;a++)n=i[a].name||a+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=a}}}else{var o=e.morphTargets;void 0!==o&&0<o.length&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}$l.prototype.isLine=!0;var eh=new ci,th=new ci;class rh extends $l{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[],i=0,n=t.count;i<n;i+=2)eh.fromBufferAttribute(t,i),th.fromBufferAttribute(t,i+1),r[i]=0==i?0:r[i-1],r[i+1]=r[i]+eh.distanceTo(th);e.setAttribute("lineDistance",new Zn(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}rh.prototype.isLineSegments=!0;class ih extends $l{constructor(e,t){super(e,t),this.type="LineLoop"}}ih.prototype.isLineLoop=!0;class nh extends En{constructor(e){super(),this.type="PointsMaterial",this.color=new On(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}copy(e){return super.copy(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}}nh.prototype.isPointsMaterial=!0;var ah=new Vi,sh=new Gi,oh=new Ii,lh=new ci;class hh extends pn{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new na,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new nh;super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){var r=this.geometry,i=this.matrixWorld,n=e.params.Points.threshold,a=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),oh.copy(r.boundingSphere),oh.applyMatrix4(i),oh.radius+=n,!1!==e.ray.intersectsSphere(oh)){ah.copy(i).invert(),sh.copy(e.ray).applyMatrix4(ah);var s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s;if(r.isBufferGeometry){var l=r.index,h=r.attributes.position;if(null!==l)for(var c,u=Math.max(0,a.start),d=Math.min(l.count,a.start+a.count);u<d;u++)c=l.getX(u),lh.fromBufferAttribute(h,c),ch(lh,c,o,i,e,t,this);else for(var p=Math.max(0,a.start),m=Math.min(h.count,a.start+a.count);p<m;p++)lh.fromBufferAttribute(h,p),ch(lh,p,o,i,e,t,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,r=Object.keys(t);if(0<r.length){var i=t[r[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var n,a=0,s=i.length;a<s;a++)n=i[a].name||a+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=a}}}else{var o=e.morphTargets;void 0!==o&&0<o.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function ch(e,t,r,i,n,a,s){var o=sh.distanceSqToPoint(e);if(o<r){var l=new ci;sh.closestPointToPoint(e,l),l.applyMatrix4(i);var h=n.ray.origin.distanceTo(l);if(h<n.near||h>n.far)return;a.push({distance:h,distanceToRay:Math.sqrt(o),point:l,index:t,face:null,object:s})}}hh.prototype.isPoints=!0;class uh extends ii{constructor(e,t,r,i,n,a,s,o,l){super(e,t,r,i,n,a,s,o,l),this.format=void 0===s?Ge:s,this.minFilter=void 0===a?_e:a,this.magFilter=void 0===n?_e:n,this.generateMipmaps=!1;var h=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){h.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){var e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}uh.prototype.isVideoTexture=!0;class dh extends ii{constructor(e,t,r,i,n,a,s,o,l,h,c,u){super(null,a,s,o,l,h,i,n,c,u),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}dh.prototype.isCompressedTexture=!0;class ph extends ii{constructor(e,t,r,i,n,a,s,o,l){super(e,t,r,i,n,a,s,o,l),this.needsUpdate=!0}}ph.prototype.isCanvasTexture=!0;class mh extends ii{constructor(e,t,r,i,n,a,s,o,l,h){if((h=void 0===h?We:h)!==We&&h!==Ze)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&h===We&&(r=Ce),void 0===r&&h===Ze&&(r=ze),super(null,i,n,a,s,o,h,r,l),this.image={width:e,height:t},this.magFilter=void 0===s?ge:s,this.minFilter=void 0===o?ge:o,this.flipY=!1,this.generateMipmaps=!1}}mh.prototype.isDepthTexture=!0;class fh extends na{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:8,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:2*Math.PI;super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},t=Math.max(3,t);var n=[],a=[],s=[],o=[],l=new ci,h=new $r;a.push(0,0,0),s.push(0,0,1),o.push(.5,.5);for(var c,u=0,d=3;u<=t;u++,d+=3)c=r+u/t*i,l.x=e*Math.cos(c),l.y=e*Math.sin(c),a.push(l.x,l.y,l.z),s.push(0,0,1),h.x=(a[d]/e+1)/2,h.y=(a[d+1]/e+1)/2,o.push(h.x,h.y);for(var p=1;p<=t;p++)n.push(p,p+1,0);this.setIndex(n),this.setAttribute("position",new Zn(a,3)),this.setAttribute("normal",new Zn(s,3)),this.setAttribute("uv",new Zn(o,2))}static fromJSON(e){return new fh(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class vh extends na{constructor(){function e(e){for(var i=m,a=new $r,s=new ci,f=0,y=!0===e?t:r,x=!0===e?1:-1,b=1;b<=n;b++)u.push(0,v*x,0),d.push(0,x,0),p.push(.5,.5),m++;for(var w=m,_=0;_<=n;_++){var M=_/n*l+o,S=Math.cos(M),T=Math.sin(M);s.x=y*T,s.y=v*x,s.z=y*S,u.push(s.x,s.y,s.z),d.push(0,x,0),a.x=.5*S+.5,a.y=.5*T*x+.5,p.push(a.x,a.y),m++}for(var E=0;E<n;E++){var A=i+E,L=w+E;!0===e?c.push(L,L+1,A):c.push(L+1,L,A),f+=3}h.addGroup(g,f,!0===e?1:2),g+=f}var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:8,a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,s=!!(5<arguments.length&&void 0!==arguments[5])&&arguments[5],o=6<arguments.length&&void 0!==arguments[6]?arguments[6]:0,l=7<arguments.length&&void 0!==arguments[7]?arguments[7]:2*Math.PI;super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:r,height:i,radialSegments:n,heightSegments:a,openEnded:s,thetaStart:o,thetaLength:l};var h=this;n=Math.floor(n),a=Math.floor(a);var c=[],u=[],d=[],p=[],m=0,f=[],v=i/2,g=0;(function(){for(var e=new ci,s=new ci,y=0,x=(r-t)/i,b=0;b<=a;b++){for(var w=[],_=b/a,M=_*(r-t)+t,S=0;S<=n;S++){var T=S/n,E=T*l+o,A=Math.sin(E),L=Math.cos(E);s.x=M*A,s.y=-_*i+v,s.z=M*L,u.push(s.x,s.y,s.z),e.set(A,x,L).normalize(),d.push(e.x,e.y,e.z),p.push(T,1-_),w.push(m++)}f.push(w)}for(var R=0;R<n;R++)for(var C=0;C<a;C++){var P=f[C][R],I=f[C+1][R],O=f[C+1][R+1],D=f[C][R+1];c.push(P,I,D),c.push(I,O,D),y+=6}h.addGroup(g,y,0),g+=y})(),!1===s&&(0<t&&e(!0),0<r&&e(!1)),this.setIndex(c),this.setAttribute("position",new Zn(u,3)),this.setAttribute("normal",new Zn(d,3)),this.setAttribute("uv",new Zn(p,2))}static fromJSON(e){return new vh(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class gh extends vh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:8,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,n=!!(4<arguments.length&&void 0!==arguments[4])&&arguments[4],a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0,s=6<arguments.length&&void 0!==arguments[6]?arguments[6]:2*Math.PI;super(0,e,t,r,i,n,a,s),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:i,openEnded:n,thetaStart:a,thetaLength:s}}static fromJSON(e){return new gh(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class yh extends na{constructor(e,t){function r(e,t,r,n){for(var a=n+1,s=[],o=0;o<=a;o++){s[o]=[];for(var l=e.clone().lerp(r,o/a),h=t.clone().lerp(r,o/a),c=a-o,u=0;u<=c;u++)s[o][u]=0==u&&o===a?l:l.clone().lerp(h,u/c)}for(var d=0;d<a;d++)for(var p,m=0;m<2*(a-d)-1;m++)p=Math.floor(m/2),0==m%2?(i(s[d][p+1]),i(s[d+1][p]),i(s[d][p])):(i(s[d][p+1]),i(s[d+1][p+1]),i(s[d+1][p]))}function i(e){h.push(e.x,e.y,e.z)}function n(t,r){var i=3*t;r.x=e[i+0],r.y=e[i+1],r.z=e[i+2]}function a(e,t,r,i){0>i&&1===e.x&&(c[t]=e.x-1),0===r.x&&0===r.z&&(c[t]=i/2/Math.PI+.5)}function s(e){return Math.atan2(e.z,-e.x)}var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,l=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:o,detail:l};var h=[],c=[];(function(e){for(var i=new ci,a=new ci,s=new ci,o=0;o<t.length;o+=3)n(t[o+0],i),n(t[o+1],a),n(t[o+2],s),r(i,a,s,e)})(l),function(e){for(var t=new ci,r=0;r<h.length;r+=3)t.x=h[r+0],t.y=h[r+1],t.z=h[r+2],t.normalize().multiplyScalar(e),h[r+0]=t.x,h[r+1]=t.y,h[r+2]=t.z}(o),function(){for(var e=new ci,t=0;t<h.length;t+=3){e.x=h[t+0],e.y=h[t+1],e.z=h[t+2];var r=s(e)/2/Math.PI+.5,i=(n=e,Math.atan2(-n.y,Math.sqrt(n.x*n.x+n.z*n.z))/Math.PI+.5);c.push(r,1-i)}var n;(function(){for(var e=new ci,t=new ci,r=new ci,i=new ci,n=new $r,o=new $r,l=new $r,u=0,d=0;u<h.length;u+=9,d+=6){e.set(h[u+0],h[u+1],h[u+2]),t.set(h[u+3],h[u+4],h[u+5]),r.set(h[u+6],h[u+7],h[u+8]),n.set(c[d+0],c[d+1]),o.set(c[d+2],c[d+3]),l.set(c[d+4],c[d+5]),i.copy(e).add(t).add(r).divideScalar(3);var p=s(i);a(n,d+0,e,p),a(o,d+2,t,p),a(l,d+4,r,p)}})(),function(){for(var e=0;e<c.length;e+=6){var t=c[e+0],r=c[e+2],i=c[e+4],n=Math.max(t,r,i),a=Math.min(t,r,i);.9<n&&.1>a&&(.2>t&&(c[e+0]+=1),.2>r&&(c[e+2]+=1),.2>i&&(c[e+4]+=1))}}()}(),this.setAttribute("position",new Zn(h,3)),this.setAttribute("normal",new Zn(h.slice(),3)),this.setAttribute("uv",new Zn(c,2)),0===l?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(e){return new yh(e.vertices,e.indices,e.radius,e.details)}}class xh extends yh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=(1+Math.sqrt(5))/2,i=1/r;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new xh(e.radius,e.detail)}}var bh=new ci,wh=new ci,_h=new ci,Mh=new Sn;class Sh extends na{constructor(e,t){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0===t?1:t,!0!==e.isGeometry){for(var r=Math.pow(10,4),i=Math.cos(Hr*t),n=e.getIndex(),a=e.getAttribute("position"),s=n?n.count:a.count,o=[0,0,0],l=["a","b","c"],h=[,,,],c={},u=[],d=0;d<s;d+=3){n?(o[0]=n.getX(d),o[1]=n.getX(d+1),o[2]=n.getX(d+2)):(o[0]=d,o[1]=d+1,o[2]=d+2);var{a:p,b:m,c:f}=Mh;if(p.fromBufferAttribute(a,o[0]),m.fromBufferAttribute(a,o[1]),f.fromBufferAttribute(a,o[2]),Mh.getNormal(_h),h[0]="".concat(Math.round(p.x*r),",").concat(Math.round(p.y*r),",").concat(Math.round(p.z*r)),h[1]="".concat(Math.round(m.x*r),",").concat(Math.round(m.y*r),",").concat(Math.round(m.z*r)),h[2]="".concat(Math.round(f.x*r),",").concat(Math.round(f.y*r),",").concat(Math.round(f.z*r)),h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(var v=0;3>v;v++){var g=(v+1)%3,y=h[v],x=h[g],b=Mh[l[v]],w=Mh[l[g]],_="".concat(y,"_").concat(x),M="".concat(x,"_").concat(y);M in c&&c[M]?(_h.dot(c[M].normal)<=i&&(u.push(b.x,b.y,b.z),u.push(w.x,w.y,w.z)),c[M]=null):!(_ in c)&&(c[_]={index0:o[v],index1:o[g],normal:_h.clone()})}}for(var S in c)if(c[S]){var{index0:T,index1:E}=c[S];bh.fromBufferAttribute(a,T),wh.fromBufferAttribute(a,E),u.push(bh.x,bh.y,bh.z),u.push(wh.x,wh.y,wh.z)}this.setAttribute("position",new Zn(u,3))}else console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}class Th{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){var r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:5,t=[],r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:5,t=[],r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){var e=this.getLengths();return e[e.length-1]}getLengths(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,r=[],i=this.getPoint(0),n=0;r.push(0);for(var a=1;a<=e;a++)n+=(t=this.getPoint(a/e)).distanceTo(i),r.push(n),i=t;return this.cacheArcLengths=r,r}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){var r,i=this.getLengths(),n=0,a=i.length;r=t||e*i[a-1];for(var s,o=0,l=a-1;o<=l;)if(0>(s=i[n=Math.floor(o+(l-o)/2)]-r))o=n+1;else{if(!(0<s)){l=n;break}l=n-1}if(i[n=l]===r)return n/(a-1);var h=i[n];return(n+(r-h)/(i[n+1]-h))/(a-1)}getTangent(e,t){var r=1e-4,i=e-r,n=e+r;0>i&&(i=0),1<n&&(n=1);var a=this.getPoint(i),s=this.getPoint(n),o=t||(a.isVector2?new $r:new ci);return o.copy(s).sub(a).normalize(),o}getTangentAt(e,t){var r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){for(var r,i=new ci,n=[],a=[],s=[],o=new ci,l=new Vi,h=0;h<=e;h++)r=h/e,n[h]=this.getTangentAt(r,new ci),n[h].normalize();a[0]=new ci,s[0]=new ci;var c=Number.MAX_VALUE,u=Math.abs(n[0].x),d=Math.abs(n[0].y),p=Math.abs(n[0].z);u<=c&&(c=u,i.set(1,0,0)),d<=c&&(c=d,i.set(0,1,0)),p<=c&&i.set(0,0,1),o.crossVectors(n[0],i).normalize(),a[0].crossVectors(n[0],o),s[0].crossVectors(n[0],a[0]);for(var m=1;m<=e;m++){if(a[m]=a[m-1].clone(),s[m]=s[m-1].clone(),o.crossVectors(n[m-1],n[m]),o.length()>Number.EPSILON){o.normalize();var f=Math.acos(Wr(n[m-1].dot(n[m]),-1,1));a[m].applyMatrix4(l.makeRotationAxis(o,f))}s[m].crossVectors(n[m],a[m])}if(!0===t){var v=Math.acos(Wr(a[0].dot(a[e]),-1,1));v/=e,0<n[0].dot(o.crossVectors(a[0],a[e]))&&(v=-v);for(var g=1;g<=e;g++)a[g].applyMatrix4(l.makeRotationAxis(n[g],v*g)),s[g].crossVectors(n[g],a[g])}return{tangents:n,normals:a,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){return{metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"},arcLengthDivisions:this.arcLengthDivisions,type:this.type}}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Eh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:2*Math.PI,s=!!(6<arguments.length&&void 0!==arguments[6])&&arguments[6],o=7<arguments.length&&void 0!==arguments[7]?arguments[7]:0;super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t){for(var r=t||new $r,i=2*Math.PI,n=this.aEndAngle-this.aStartAngle,a=Math.abs(n)<Number.EPSILON;0>n;)n+=i;for(;n>i;)n-=i;n<Number.EPSILON&&(n=a?0:i),!0!==this.aClockwise||a||(n===i?n=-i:n-=i);var s=this.aStartAngle+e*n,o=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){var h=Math.cos(this.aRotation),c=Math.sin(this.aRotation),u=o-this.aX,d=l-this.aY;o=u*h-d*c+this.aX,l=u*c+d*h+this.aY}return r.set(o,l)}copy(e){return super.copy(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}toJSON(){var e=super.toJSON();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}fromJSON(e){return super.fromJSON(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}}Eh.prototype.isEllipseCurve=!0;class Ah extends Eh{constructor(e,t,r,i,n,a){super(e,t,r,r,i,n,a),this.type="ArcCurve"}}function Lh(){function e(e,a,s,o){t=e,r=s,i=-3*e+3*a-2*s-o,n=2*e-2*a+s+o}var t=0,r=0,i=0,n=0;return{initCatmullRom:function(t,r,i,n,a){e(r,i,a*(i-t),a*(n-r))},initNonuniformCatmullRom:function(t,r,i,n,a,s,o){var l=(r-t)/a-(i-t)/(a+s)+(i-r)/s,h=(i-r)/s-(n-r)/(s+o)+(n-i)/o;e(r,i,l*=s,h*=s)},calc:function(e){var a=e*e;return t+r*e+i*a+n*(a*e)}}}Ah.prototype.isArcCurve=!0;var Rh=new ci,Ch=new Lh,Ph=new Lh,Ih=new Lh;class Oh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"centripetal",i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:.5;super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=i}getPoint(e){var t,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci,n=this.points,a=n.length,s=(a-(this.closed?0:1))*e,o=Math.floor(s),l=s-o;this.closed?o+=0<o?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||0<o?t=n[(o-1)%a]:(Rh.subVectors(n[0],n[1]).add(n[0]),t=Rh);var h=n[o%a],c=n[(o+1)%a];if(this.closed||o+2<a?r=n[(o+2)%a]:(Rh.subVectors(n[a-1],n[a-2]).add(n[a-1]),r=Rh),"centripetal"===this.curveType||"chordal"===this.curveType){var u="chordal"===this.curveType?.5:.25,d=Math.pow(t.distanceToSquared(h),u),p=Math.pow(h.distanceToSquared(c),u),m=Math.pow(c.distanceToSquared(r),u);1e-4>p&&(p=1),1e-4>d&&(d=p),1e-4>m&&(m=p),Ch.initNonuniformCatmullRom(t.x,h.x,c.x,r.x,d,p,m),Ph.initNonuniformCatmullRom(t.y,h.y,c.y,r.y,d,p,m),Ih.initNonuniformCatmullRom(t.z,h.z,c.z,r.z,d,p,m)}else"catmullrom"===this.curveType&&(Ch.initCatmullRom(t.x,h.x,c.x,r.x,this.tension),Ph.initCatmullRom(t.y,h.y,c.y,r.y,this.tension),Ih.initCatmullRom(t.z,h.z,c.z,r.z,this.tension));return i.set(Ch.calc(l),Ph.calc(l),Ih.calc(l)),i}copy(e){super.copy(e),this.points=[];for(var t,r=0,i=e.points.length;r<i;r++)t=e.points[r],this.points.push(t.clone());return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){var e=super.toJSON();e.points=[];for(var t,r=0,i=this.points.length;r<i;r++)t=this.points[r],e.points.push(t.toArray());return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(var t,r=0,i=e.points.length;r<i;r++)t=e.points[r],this.points.push((new ci).fromArray(t));return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Dh(e,t,r,i,n){var a=.5*(i-t),s=.5*(n-r),o=e*e;return(2*r-2*i+a+s)*(e*o)+(-3*r+3*i-2*a-s)*o+a*e+r}function Nh(e,t,r,i){return function(e,t){var r=1-e;return r*r*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,r)+function(e,t){return e*e*t}(e,i)}function Bh(e,t,r,i,n){return function(e,t){var r=1-e;return r*r*r*t}(e,t)+function(e,t){var r=1-e;return 3*r*r*e*t}(e,r)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,n)}Oh.prototype.isCatmullRomCurve3=!0;class Uh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new $r,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new $r,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new $r;super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=i}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r,r=this.v0,i=this.v1,n=this.v2,a=this.v3;return t.set(Bh(e,r.x,i.x,n.x,a.x),Bh(e,r.y,i.y,n.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){var e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}Uh.prototype.isCubicBezierCurve=!0;class zh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new ci,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new ci;super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=i}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci,r=this.v0,i=this.v1,n=this.v2,a=this.v3;return t.set(Bh(e,r.x,i.x,n.x,a.x),Bh(e,r.y,i.y,n.y,a.y),Bh(e,r.z,i.z,n.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){var e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}zh.prototype.isCubicBezierCurve3=!0;class Fh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new $r,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r;super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){var r=t||new $r;return r.copy(this.v2).sub(this.v1).normalize(),r}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){var e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}Fh.prototype.isLineCurve=!0;class Gh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci;super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){var e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Vh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new $r,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new $r;super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r,r=this.v0,i=this.v1,n=this.v2;return t.set(Nh(e,r.x,i.x,n.x),Nh(e,r.y,i.y,n.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){var e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}Vh.prototype.isQuadraticBezierCurve=!0;class Hh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new ci;super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci,r=this.v0,i=this.v1,n=this.v2;return t.set(Nh(e,r.x,i.x,n.x),Nh(e,r.y,i.y,n.y),Nh(e,r.z,i.z,n.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){var e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}Hh.prototype.isQuadraticBezierCurve3=!0;class kh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];super(),this.type="SplineCurve",this.points=e}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r,r=this.points,i=(r.length-1)*e,n=Math.floor(i),a=i-n,s=r[0===n?n:n-1],o=r[n],l=r[n>r.length-2?r.length-1:n+1],h=r[n>r.length-3?r.length-1:n+2];return t.set(Dh(a,s.x,o.x,l.x,h.x),Dh(a,s.y,o.y,l.y,h.y)),t}copy(e){super.copy(e),this.points=[];for(var t,r=0,i=e.points.length;r<i;r++)t=e.points[r],this.points.push(t.clone());return this}toJSON(){var e=super.toJSON();e.points=[];for(var t,r=0,i=this.points.length;r<i;r++)t=this.points[r],e.points.push(t.toArray());return e}fromJSON(e){super.fromJSON(e),this.points=[];for(var t,r=0,i=e.points.length;r<i;r++)t=e.points[r],this.points.push((new $r).fromArray(t));return this}}kh.prototype.isSplineCurve=!0;var jh=Object.freeze({__proto__:null,ArcCurve:Ah,CatmullRomCurve3:Oh,CubicBezierCurve:Uh,CubicBezierCurve3:zh,EllipseCurve:Eh,LineCurve:Fh,LineCurve3:Gh,QuadraticBezierCurve:Vh,QuadraticBezierCurve3:Hh,SplineCurve:kh});function Wh(e,t,r,i,n){var a,s;if(n===0<function(e,t,r,i){for(var n=0,a=t,s=r-i;a<r;a+=i)n+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return n}(e,t,r,i))for(a=t;a<r;a+=i)s=dc(a,e[a],e[a+1],s);else for(a=r-i;a>=t;a-=i)s=dc(a,e[a],e[a+1],s);return s&&sc(s,s.next)&&(pc(s),s=s.next),s}function Zh(e,t){if(!e)return e;t||(t=e);var r,i=e;do{if(r=!1,i.steiner||!sc(i,i.next)&&0!==ac(i.prev,i,i.next))i=i.next;else{if(pc(i),(i=t=i.prev)===i.next)break;r=!0}}while(r||i!==t);return t}function qh(e,t,r,i,n,a,s){if(e){!s&&a&&function(e,t,r,i){var n=e;do{null===n.z&&(n.z=tc(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,r,i,n,a,s,o,l,h=1;do{for(r=e,e=null,a=null,s=0;r;){for(s++,i=r,o=0,t=0;t<h&&(o++,i=i.nextZ);t++);for(l=h;0<o||0<l&&i;)0!==o&&(0===l||!i||r.z<=i.z)?(n=r,r=r.nextZ,o--):(n=i,i=i.nextZ,l--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;r=i}a.nextZ=null,h*=2}while(1<s)}(n)}(e,i,n,a);for(var o,l,h=e;e.prev!==e.next;)if(o=e.prev,l=e.next,a?Yh(e,i,n,a):Xh(e))t.push(o.i/r),t.push(e.i/r),t.push(l.i/r),pc(e),e=l.next,h=l.next;else if((e=l)===h){s?1===s?qh(e=Jh(Zh(e),t,r),t,r,i,n,a,2):2==s&&Kh(e,t,r,i,n,a):qh(Zh(e),t,r,i,n,a,1);break}}}function Xh(e){var t=e.prev,r=e,i=e.next;if(0<=ac(t,r,i))return!1;for(var n=e.next.next;n!==e.prev;){if(ic(t.x,t.y,r.x,r.y,i.x,i.y,n.x,n.y)&&0<=ac(n.prev,n,n.next))return!1;n=n.next}return!0}function Yh(e,t,r,i){var n=e.prev,a=e,s=e.next;if(0<=ac(n,a,s))return!1;for(var o=n.x<a.x?n.x<s.x?n.x:s.x:a.x<s.x?a.x:s.x,l=n.y<a.y?n.y<s.y?n.y:s.y:a.y<s.y?a.y:s.y,h=n.x>a.x?n.x>s.x?n.x:s.x:a.x>s.x?a.x:s.x,c=n.y>a.y?n.y>s.y?n.y:s.y:a.y>s.y?a.y:s.y,u=tc(o,l,t,r,i),d=tc(h,c,t,r,i),p=e.prevZ,m=e.nextZ;p&&p.z>=u&&m&&m.z<=d;){if(p!==e.prev&&p!==e.next&&ic(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&0<=ac(p.prev,p,p.next))return!1;if(p=p.prevZ,m!==e.prev&&m!==e.next&&ic(n.x,n.y,a.x,a.y,s.x,s.y,m.x,m.y)&&0<=ac(m.prev,m,m.next))return!1;m=m.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&ic(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&0<=ac(p.prev,p,p.next))return!1;p=p.prevZ}for(;m&&m.z<=d;){if(m!==e.prev&&m!==e.next&&ic(n.x,n.y,a.x,a.y,s.x,s.y,m.x,m.y)&&0<=ac(m.prev,m,m.next))return!1;m=m.nextZ}return!0}function Jh(e,t,r){var i=e;do{var n=i.prev,a=i.next.next;!sc(n,a)&&oc(n,i,i.next,a)&&cc(n,a)&&cc(a,n)&&(t.push(n.i/r),t.push(i.i/r),t.push(a.i/r),pc(i),pc(i.next),i=e=a),i=i.next}while(i!==e);return Zh(i)}function Kh(e,t,r,i,n,a){var s=e;do{for(var o=s.next.next;o!==s.prev;){if(s.i!==o.i&&nc(s,o)){var l=uc(s,o);return s=Zh(s,s.next),l=Zh(l,l.next),qh(s,t,r,i,n,a),void qh(l,t,r,i,n,a)}o=o.next}s=s.next}while(s!==e)}function Qh(e,t){return e.x-t.x}function $h(e,t){if(t=function(e,t){var r,i=t,n=e.x,a=e.y,s=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var o=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=n&&o>s){if(s=o,o===n){if(a===i.y)return i;if(a===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!r)return null;if(n===s)return r;var l,h=r,c=r.x,u=r.y,d=1/0;i=r;do{n>=i.x&&i.x>=c&&n!==i.x&&ic(a<u?n:s,a,c,u,a<u?s:n,a,i.x,i.y)&&(l=Math.abs(a-i.y)/(n-i.x),cc(i,e)&&(l<d||l===d&&(i.x>r.x||i.x===r.x&&ec(r,i)))&&(r=i,d=l)),i=i.next}while(i!==h);return r}(e,t),t){var r=uc(t,e);Zh(t,t.next),Zh(r,r.next)}}function ec(e,t){return 0>ac(e.prev,e,t.prev)&&0>ac(t.next,e,e.next)}function tc(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function rc(e){var t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function ic(e,t,r,i,n,a,s,o){return 0<=(n-s)*(t-o)-(e-s)*(a-o)&&0<=(e-s)*(i-o)-(r-s)*(t-o)&&0<=(r-s)*(a-o)-(n-s)*(i-o)}function nc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&oc(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(cc(e,t)&&cc(t,e)&&function(e,t){var r=e,i=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&n<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==e);return i}(e,t)&&(ac(e.prev,e,t.prev)||ac(e,t.prev,t))||sc(e,t)&&0<ac(e.prev,e,e.next)&&0<ac(t.prev,t,t.next))}function ac(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function sc(e,t){return e.x===t.x&&e.y===t.y}function oc(e,t,r,i){var n=hc(ac(e,t,r)),a=hc(ac(e,t,i)),s=hc(ac(r,i,e)),o=hc(ac(r,i,t));return!!(n!==a&&s!==o||0===n&&lc(e,r,t)||0===a&&lc(e,i,t)||0===s&&lc(r,e,i)||0===o&&lc(r,t,i))}function lc(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function hc(e){return 0<e?1:0>e?-1:0}function cc(e,t){return 0>ac(e.prev,e,e.next)?0<=ac(e,t,e.next)&&0<=ac(e,e.prev,t):0>ac(e,t,e.prev)||0>ac(e,e.next,t)}function uc(e,t){var r=new mc(e.i,e.x,e.y),i=new mc(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function dc(e,t,r,i){var n=new mc(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function pc(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 mc(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class fc{static area(e){for(var t=e.length,r=0,i=t-1,n=0;n<t;i=n++)r+=e[i].x*e[n].y-e[n].x*e[i].y;return.5*r}static isClockWise(e){return 0>fc.area(e)}static triangulateShape(e,t){var r=[],i=[],n=[];vc(e),gc(r,e);var a=e.length;t.forEach(vc);for(var s=0;s<t.length;s++)i.push(a),a+=t[s].length,gc(r,t[s]);for(var o=function(e,t){var r,i,n,a,s,o,l,h=2<arguments.length&&void 0!==arguments[2]?arguments[2]:2,c=t&&t.length,u=c?t[0]*h:e.length,d=Wh(e,0,u,h,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(e,t,r,i){var n,a,s,o=[];for(n=0,a=t.length;n<a;n++)(s=Wh(e,t[n]*i,n<a-1?t[n+1]*i:e.length,i,!1))===s.next&&(s.steiner=!0),o.push(rc(s));for(o.sort(Qh),n=0;n<o.length;n++)$h(o[n],r),r=Zh(r,r.next);return r}(e,t,d,h)),e.length>80*h){r=n=e[0],i=a=e[1];for(var m=h;m<u;m+=h)(s=e[m])<r&&(r=s),(o=e[m+1])<i&&(i=o),s>n&&(n=s),o>a&&(a=o);l=0===(l=Math.max(n-r,a-i))?0:1/l}return qh(d,p,h,r,i,l),p}(r,i),l=0;l<o.length;l+=3)n.push(o.slice(l,l+3));return n}}function vc(e){var t=e.length;2<t&&e[t-1].equals(e[0])&&e.pop()}function gc(e,t){for(var r=0;r<t.length;r++)e.push(t[r].x),e.push(t[r].y)}class yc extends na{constructor(e,t){function r(e){function r(e,t,r){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(r).add(e)}function s(e,t,r){var i,n,a,s=e.x-t.x,o=e.y-t.y,l=r.x-e.x,h=r.y-e.y,c=s*s+o*o,u=s*h-o*l;if(Math.abs(u)>Number.EPSILON){var d=Math.sqrt(c),p=Math.sqrt(l*l+h*h),m=t.x-o/d,f=t.y+s/d,v=((r.x-h/p-m)*h-(r.y+l/p-f)*l)/(s*h-o*l),g=(i=m+s*v-e.x)*i+(n=f+o*v-e.y)*n;if(2>=g)return new $r(i,n);a=Math.sqrt(g/2)}else{var y=!1;s>Number.EPSILON?l>Number.EPSILON&&(y=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(o)===Math.sign(h)&&(y=!0),y?(i=-o,n=s,a=Math.sqrt(c)):(i=s,n=o,a=Math.sqrt(c/2))}return new $r(i/a,n/a)}function o(e,t){for(var r=e.length;0<=--r;){var i=r,n=r-1;0>n&&(n=e.length-1);for(var a=0,s=f+2*w;a<s;a++){var o=V*a,l=V*(a+1);c(t+i+o,t+n+o,t+n+l,t+i+l)}}}function l(e,t,r){p.push(e),p.push(t),p.push(r)}function h(e,t,r){u(e),u(t),u(r);var a=n.length/3,s=M.generateTopUV(i,n,a-3,a-2,a-1);d(s[0]),d(s[1]),d(s[2])}function c(e,t,r,a){u(e),u(t),u(a),u(t),u(r),u(a);var s=n.length/3,o=M.generateSideWallUV(i,n,s-6,s-3,s-2,s-1);d(o[0]),d(o[1]),d(o[3]),d(o[1]),d(o[2]),d(o[3])}function u(e){n.push(p[3*e+0]),n.push(p[3*e+1]),n.push(p[3*e+2])}function d(e){a.push(e.x),a.push(e.y)}var p=[],m=void 0===t.curveSegments?12:t.curveSegments,f=void 0===t.steps?1:t.steps,v=void 0===t.depth?100:t.depth,g=!(void 0!==t.bevelEnabled)||t.bevelEnabled,y=void 0===t.bevelThickness?6:t.bevelThickness,x=void 0===t.bevelSize?y-2:t.bevelSize,b=void 0===t.bevelOffset?0:t.bevelOffset,w=void 0===t.bevelSegments?3:t.bevelSegments,_=t.extrudePath,M=void 0===t.UVGenerator?xc:t.UVGenerator;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),v=t.amount);var S,T,E,A,L,R=!1;_&&(S=_.getSpacedPoints(f),R=!0,g=!1,T=_.computeFrenetFrames(f,!1),E=new ci,A=new ci,L=new ci),g||(w=0,y=0,x=0,b=0);var C=e.extractPoints(m),P=C.shape,I=C.holes;if(!fc.isClockWise(P)){P=P.reverse();for(var O,D=0,N=I.length;D<N;D++)O=I[D],fc.isClockWise(O)&&(I[D]=O.reverse())}for(var B,U=fc.triangulateShape(P,I),z=P,F=0,G=I.length;F<G;F++)B=I[F],P=P.concat(B);for(var V=P.length,H=U.length,k=[],j=0,W=z.length,Z=W-1,q=j+1;j<W;j++,Z++,q++)Z===W&&(Z=0),q===W&&(q=0),k[j]=s(z[j],z[Z],z[q]);for(var X,Y,J=[],K=k.concat(),Q=0,$=I.length;Q<$;Q++){X=[];for(var ee=0,te=(Y=I[Q]).length,re=te-1,ie=ee+1;ee<te;ee++,re++,ie++)re===te&&(re=0),ie===te&&(ie=0),X[ee]=s(Y[ee],Y[re],Y[ie]);J.push(X),K=K.concat(X)}for(var ne=0;ne<w;ne++){for(var ae,se=ne/w,oe=y*Math.cos(se*Math.PI/2),le=x*Math.sin(se*Math.PI/2)+b,he=0,ce=z.length;he<ce;he++)l((ae=r(z[he],k[he],le)).x,ae.y,-oe);for(var ue,de=0,pe=I.length;de<pe;de++){ue=I[de],X=J[de];for(var me,fe=0,ve=ue.length;fe<ve;fe++)l((me=r(ue[fe],X[fe],le)).x,me.y,-oe)}}for(var ge,ye=x+b,xe=0;xe<V;xe++)ge=g?r(P[xe],K[xe],ye):P[xe],R?(A.copy(T.normals[0]).multiplyScalar(ge.x),E.copy(T.binormals[0]).multiplyScalar(ge.y),L.copy(S[0]).add(A).add(E),l(L.x,L.y,L.z)):l(ge.x,ge.y,0);for(var be=1;be<=f;be++)for(var we,_e=0;_e<V;_e++)we=g?r(P[_e],K[_e],ye):P[_e],R?(A.copy(T.normals[be]).multiplyScalar(we.x),E.copy(T.binormals[be]).multiplyScalar(we.y),L.copy(S[be]).add(A).add(E),l(L.x,L.y,L.z)):l(we.x,we.y,v/f*be);for(var Me=w-1;0<=Me;Me--){for(var Se,Te=Me/w,Ee=y*Math.cos(Te*Math.PI/2),Ae=x*Math.sin(Te*Math.PI/2)+b,Le=0,Re=z.length;Le<Re;Le++)l((Se=r(z[Le],k[Le],Ae)).x,Se.y,v+Ee);for(var Ce,Pe=0,Ie=I.length;Pe<Ie;Pe++){Ce=I[Pe],X=J[Pe];for(var Oe,De=0,Ne=Ce.length;De<Ne;De++)Oe=r(Ce[De],X[De],Ae),R?l(Oe.x,Oe.y+S[f-1].y,S[f-1].x+Ee):l(Oe.x,Oe.y,v+Ee)}}(function(){var e=n.length/3;if(g){for(var t,r=0,a=V*r,s=0;s<H;s++)h((t=U[s])[2]+a,t[1]+a,t[0]+a);a=V*(r=f+2*w);for(var o,l=0;l<H;l++)h((o=U[l])[0]+a,o[1]+a,o[2]+a)}else{for(var c,u=0;u<H;u++)h((c=U[u])[2],c[1],c[0]);for(var d,p=0;p<H;p++)h((d=U[p])[0]+V*f,d[1]+V*f,d[2]+V*f)}i.addGroup(e,n.length/3-e,0)})(),function(){var e=n.length/3,t=0;o(z,t),t+=z.length;for(var r,a=0,s=I.length;a<s;a++)o(r=I[a],t),t+=r.length;i.addGroup(e,n.length/3-e,1)}()}super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var i=this,n=[],a=[],s=0,o=e.length;s<o;s++)r(e[s]);this.setAttribute("position",new Zn(n,3)),this.setAttribute("uv",new Zn(a,2)),this.computeVertexNormals()}toJSON(){var e=super.toJSON();return function(e,t,r){if(r.shapes=[],Array.isArray(e))for(var i,n=0,a=e.length;n<a;n++)i=e[n],r.shapes.push(i.uuid);else r.shapes.push(e.uuid);return void 0!==t.extrudePath&&(r.options.extrudePath=t.extrudePath.toJSON()),r}(this.parameters.shapes,this.parameters.options,e)}static fromJSON(e,t){for(var r,i=[],n=0,a=e.shapes.length;n<a;n++)r=t[e.shapes[n]],i.push(r);var s=e.options.extrudePath;return void 0!==s&&(e.options.extrudePath=(new jh[s.type]).fromJSON(s)),new yc(i,e.options)}}var xc={generateTopUV:function(e,t,r,i,n){var a=t[3*r],s=t[3*r+1],o=t[3*i],l=t[3*i+1],h=t[3*n],c=t[3*n+1];return[new $r(a,s),new $r(o,l),new $r(h,c)]},generateSideWallUV:function(e,t,r,i,n,a){var s=t[3*r],o=t[3*r+1],l=t[3*r+2],h=t[3*i],c=t[3*i+1],u=t[3*i+2],d=t[3*n],p=t[3*n+1],m=t[3*n+2],f=t[3*a],v=t[3*a+1],g=t[3*a+2];return Math.abs(o-c)<Math.abs(s-h)?[new $r(s,1-l),new $r(h,1-u),new $r(d,1-m),new $r(f,1-g)]:[new $r(o,1-l),new $r(c,1-u),new $r(p,1-m),new $r(v,1-g)]}};class bc extends yh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=(1+Math.sqrt(5))/2;super([-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new bc(e.radius,e.detail)}}class wc extends na{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:12,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:2*Math.PI;super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},t=Math.floor(t),i=Wr(i,0,2*Math.PI);for(var n=[],a=[],s=[],o=1/t,l=new ci,h=new $r,c=0;c<=t;c++)for(var u=r+c*o*i,d=Math.sin(u),p=Math.cos(u),m=0;m<=e.length-1;m++)l.x=e[m].x*d,l.y=e[m].y,l.z=e[m].x*p,a.push(l.x,l.y,l.z),h.x=c/t,h.y=m/(e.length-1),s.push(h.x,h.y);for(var f=0;f<t;f++)for(var v=0;v<e.length-1;v++){var g=v+f*e.length,y=g,x=g+e.length,b=g+e.length+1,w=g+1;n.push(y,x,w),n.push(x,b,w)}if(this.setIndex(n),this.setAttribute("position",new Zn(a,3)),this.setAttribute("uv",new Zn(s,2)),this.computeVertexNormals(),i===2*Math.PI)for(var _=this.attributes.normal.array,M=new ci,S=new ci,T=new ci,E=t*e.length*3,A=0,L=0;A<e.length;A++,L+=3)M.x=_[L+0],M.y=_[L+1],M.z=_[L+2],S.x=_[E+L+0],S.y=_[E+L+1],S.z=_[E+L+2],T.addVectors(M,S).normalize(),_[L+0]=_[E+L+0]=T.x,_[L+1]=_[E+L+1]=T.y,_[L+2]=_[E+L+2]=T.z}static fromJSON(e){return new wc(e.points,e.segments,e.phiStart,e.phiLength)}}class _c extends yh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new _c(e.radius,e.detail)}}class Mc extends na{constructor(e,t,r){super(),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r};var i=[],n=[],a=[],s=[],o=1e-5,l=new ci,h=new ci,c=new ci,u=new ci,d=new ci;3>e.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");for(var p,m=t+1,f=0;f<=r;f++){p=f/r;for(var v,g=0;g<=t;g++)e(v=g/t,p,h),n.push(h.x,h.y,h.z),0<=v-o?(e(v-o,p,c),u.subVectors(h,c)):(e(v+o,p,c),u.subVectors(c,h)),0<=p-o?(e(v,p-o,c),d.subVectors(h,c)):(e(v,p+o,c),d.subVectors(c,h)),l.crossVectors(u,d).normalize(),a.push(l.x,l.y,l.z),s.push(v,p)}for(var y=0;y<r;y++)for(var x=0;x<t;x++){var b=y*m+x,w=y*m+x+1,_=(y+1)*m+x+1,M=(y+1)*m+x;i.push(b,w,M),i.push(w,_,M)}this.setIndex(i),this.setAttribute("position",new Zn(n,3)),this.setAttribute("normal",new Zn(a,3)),this.setAttribute("uv",new Zn(s,2))}}class Sc extends na{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:.5,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:8,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:2*Math.PI;super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:a},r=Math.max(3,r);for(var s=[],o=[],l=[],h=[],c=e,u=(t-e)/(i=Math.max(1,i)),d=new ci,p=new $r,m=0;m<=i;m++){for(var f,v=0;v<=r;v++)f=n+v/r*a,d.x=c*Math.cos(f),d.y=c*Math.sin(f),o.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,h.push(p.x,p.y);c+=u}for(var g,y=0;y<i;y++){g=y*(r+1);for(var x=0;x<r;x++){var b=x+g,w=b,_=b+r+1,M=b+r+2,S=b+1;s.push(w,_,S),s.push(_,M,S)}}this.setIndex(s),this.setAttribute("position",new Zn(o,3)),this.setAttribute("normal",new Zn(l,3)),this.setAttribute("uv",new Zn(h,2))}static fromJSON(e){return new Sc(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Tc extends na{constructor(e){function t(e){var t=n.length/3,o=e.extractPoints(r),h=o.shape,c=o.holes;!1===fc.isClockWise(h)&&(h=h.reverse());for(var u,d=0,p=c.length;d<p;d++)u=c[d],!0===fc.isClockWise(u)&&(c[d]=u.reverse());for(var m,f=fc.triangulateShape(h,c),v=0,g=c.length;v<g;v++)m=c[v],h=h.concat(m);for(var y,x=0,b=h.length;x<b;x++)y=h[x],n.push(y.x,y.y,0),a.push(0,0,1),s.push(y.x,y.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;i.push(S,T,E),l+=3}}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:12;super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:r};var i=[],n=[],a=[],s=[],o=0,l=0;if(!1===Array.isArray(e))t(e);else for(var h=0;h<e.length;h++)t(e[h]),this.addGroup(o,l,h),o+=l,l=0;this.setIndex(i),this.setAttribute("position",new Zn(n,3)),this.setAttribute("normal",new Zn(a,3)),this.setAttribute("uv",new Zn(s,2))}toJSON(){var e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(var r,i=0,n=e.length;i<n;i++)r=e[i],t.shapes.push(r.uuid);else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){for(var r,i=[],n=0,a=e.shapes.length;n<a;n++)r=t[e.shapes[n]],i.push(r);return new Tc(i,e.curveSegments)}}class Ec extends na{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:8,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:6,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:2*Math.PI,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0,s=6<arguments.length&&void 0!==arguments[6]?arguments[6]:Math.PI;super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:i,phiLength:n,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));for(var o=Math.min(a+s,Math.PI),l=0,h=[],c=new ci,u=new ci,d=[],p=[],m=[],f=[],v=0;v<=r;v++){var g=[],y=v/r,x=0;0==v&&0==a?x=.5/t:v==r&&o==Math.PI&&(x=-.5/t);for(var b,w=0;w<=t;w++)b=w/t,c.x=-e*Math.cos(i+b*n)*Math.sin(a+y*s),c.y=e*Math.cos(a+y*s),c.z=e*Math.sin(i+b*n)*Math.sin(a+y*s),p.push(c.x,c.y,c.z),u.copy(c).normalize(),m.push(u.x,u.y,u.z),f.push(b+x,1-y),g.push(l++);h.push(g)}for(var _=0;_<r;_++)for(var M=0;M<t;M++){var S=h[_][M+1],T=h[_][M],E=h[_+1][M],A=h[_+1][M+1];(0!==_||0<a)&&d.push(S,T,A),(_!==r-1||o<Math.PI)&&d.push(T,E,A)}this.setIndex(d),this.setAttribute("position",new Zn(p,3)),this.setAttribute("normal",new Zn(m,3)),this.setAttribute("uv",new Zn(f,2))}static fromJSON(e){return new Ec(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Ac extends yh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ac(e.radius,e.detail)}}class Lc extends yc{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=t.font;if(!r||!r.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new na;var i=r.generateShapes(e,t.size);t.depth=void 0===t.height?50:t.height,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),super(i,t),this.type="TextGeometry"}}class Rc extends na{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:.4,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:8,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:6,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:2*Math.PI;super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:i,arc:n},r=Math.floor(r),i=Math.floor(i);for(var a=[],s=[],o=[],l=[],h=new ci,c=new ci,u=new ci,d=0;d<=r;d++)for(var p=0;p<=i;p++){var m=p/i*n,f=d/r*Math.PI*2;c.x=(e+t*Math.cos(f))*Math.cos(m),c.y=(e+t*Math.cos(f))*Math.sin(m),c.z=t*Math.sin(f),s.push(c.x,c.y,c.z),h.x=e*Math.cos(m),h.y=e*Math.sin(m),u.subVectors(c,h).normalize(),o.push(u.x,u.y,u.z),l.push(p/i),l.push(d/r)}for(var v=1;v<=r;v++)for(var g=1;g<=i;g++){var y=(i+1)*v+g-1,x=(i+1)*(v-1)+g-1,b=(i+1)*(v-1)+g,w=(i+1)*v+g;a.push(y,x,w),a.push(x,b,w)}this.setIndex(a),this.setAttribute("position",new Zn(s,3)),this.setAttribute("normal",new Zn(o,3)),this.setAttribute("uv",new Zn(l,2))}static fromJSON(e){return new Rc(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Cc extends na{constructor(){function e(e,t,r,i,n){var a=Math.cos(e),s=Math.sin(e),o=r/t*e,l=Math.cos(o);n.x=i*(2+l)*.5*a,n.y=i*(2+l)*s*.5,n.z=i*Math.sin(o)*.5}var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:.4,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:64,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:8,a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:2,s=5<arguments.length&&void 0!==arguments[5]?arguments[5]:3;super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:r,tubularSegments:i,radialSegments:n,p:a,q:s},i=Math.floor(i),n=Math.floor(n);for(var o,l=[],h=[],c=[],u=[],d=new ci,p=new ci,m=new ci,f=new ci,v=new ci,g=new ci,y=new ci,x=0;x<=i;++x){e(o=x/i*a*Math.PI*2,a,s,t,m),e(o+.01,a,s,t,f),g.subVectors(f,m),y.addVectors(f,m),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize();for(var b=0;b<=n;++b){var w=b/n*Math.PI*2,_=-r*Math.cos(w),M=r*Math.sin(w);d.x=m.x+(_*y.x+M*v.x),d.y=m.y+(_*y.y+M*v.y),d.z=m.z+(_*y.z+M*v.z),h.push(d.x,d.y,d.z),p.subVectors(d,m).normalize(),c.push(p.x,p.y,p.z),u.push(x/i),u.push(b/n)}}for(var S=1;S<=i;S++)for(var T=1;T<=n;T++){var E=(n+1)*(S-1)+(T-1),A=(n+1)*S+(T-1),L=(n+1)*S+T,R=(n+1)*(S-1)+T;l.push(E,A,R),l.push(A,L,R)}this.setIndex(l),this.setAttribute("position",new Zn(h,3)),this.setAttribute("normal",new Zn(c,3)),this.setAttribute("uv",new Zn(u,2))}static fromJSON(e){return new Cc(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Pc extends na{constructor(e){function t(t){c=e.getPointAt(t/r,c);for(var a=s.normals[t],h=s.binormals[t],p=0;p<=n;p++){var m=p/n*Math.PI*2,f=Math.sin(m),v=-Math.cos(m);l.x=v*a.x+f*h.x,l.y=v*a.y+f*h.y,l.z=v*a.z+f*h.z,l.normalize(),d.push(l.x,l.y,l.z),o.x=c.x+i*l.x,o.y=c.y+i*l.y,o.z=c.z+i*l.z,u.push(o.x,o.y,o.z)}}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:64,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:8,a=!!(4<arguments.length&&void 0!==arguments[4])&&arguments[4];super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:r,radius:i,radialSegments:n,closed:a};var s=e.computeFrenetFrames(r,a);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;var o=new ci,l=new ci,h=new $r,c=new ci,u=[],d=[],p=[],m=[];(function(){for(var e=0;e<r;e++)t(e);t(!1===a?r:0),function(){for(var e=0;e<=r;e++)for(var t=0;t<=n;t++)h.x=e/r,h.y=t/n,p.push(h.x,h.y)}(),function(){for(var e=1;e<=r;e++)for(var t=1;t<=n;t++){var i=(n+1)*(e-1)+(t-1),a=(n+1)*e+(t-1),s=(n+1)*e+t,o=(n+1)*(e-1)+t;m.push(i,a,o),m.push(a,s,o)}}()})(),this.setIndex(m),this.setAttribute("position",new Zn(u,3)),this.setAttribute("normal",new Zn(d,3)),this.setAttribute("uv",new Zn(p,2))}toJSON(){var e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Pc((new jh[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Ic extends na{constructor(e){if(super(),this.type="WireframeGeometry",!0!==e.isGeometry){var t=[],r=[0,0],i={},n=new ci;if(null!==e.index){var a=e.attributes.position,s=e.index,o=e.groups;0===o.length&&(o=[{start:0,count:s.count,materialIndex:0}]);for(var l=0,h=o.length;l<h;++l)for(var c=o[l],u=c.start,d=u,p=u+c.count;d<p;d+=3)for(var m=0;3>m;m++){var f=s.getX(d+m),v=s.getX(d+(m+1)%3);r[0]=Math.min(f,v),r[1]=Math.max(f,v);var g=r[0]+","+r[1];void 0===i[g]&&(i[g]={index1:r[0],index2:r[1]})}for(var y in i){var x=i[y];n.fromBufferAttribute(a,x.index1),t.push(n.x,n.y,n.z),n.fromBufferAttribute(a,x.index2),t.push(n.x,n.y,n.z)}}else for(var b=e.attributes.position,w=0,_=b.count/3;w<_;w++)for(var M,S=0;3>S;S++){M=3*w+S,n.fromBufferAttribute(b,M),t.push(n.x,n.y,n.z);var T=3*w+(S+1)%3;n.fromBufferAttribute(b,T),t.push(n.x,n.y,n.z)}this.setAttribute("position",new Zn(t,3))}else console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}var Oc=Object.freeze({__proto__:null,BoxGeometry:Sa,BoxBufferGeometry:Sa,CircleGeometry:fh,CircleBufferGeometry:fh,ConeGeometry:gh,ConeBufferGeometry:gh,CylinderGeometry:vh,CylinderBufferGeometry:vh,DodecahedronGeometry:xh,DodecahedronBufferGeometry:xh,EdgesGeometry:Sh,ExtrudeGeometry:yc,ExtrudeBufferGeometry:yc,IcosahedronGeometry:bc,IcosahedronBufferGeometry:bc,LatheGeometry:wc,LatheBufferGeometry:wc,OctahedronGeometry:_c,OctahedronBufferGeometry:_c,ParametricGeometry:Mc,ParametricBufferGeometry:Mc,PlaneGeometry:ja,PlaneBufferGeometry:ja,PolyhedronGeometry:yh,PolyhedronBufferGeometry:yh,RingGeometry:Sc,RingBufferGeometry:Sc,ShapeGeometry:Tc,ShapeBufferGeometry:Tc,SphereGeometry:Ec,SphereBufferGeometry:Ec,TetrahedronGeometry:Ac,TetrahedronBufferGeometry:Ac,TextGeometry:Lc,TextBufferGeometry:Lc,TorusGeometry:Rc,TorusBufferGeometry:Rc,TorusKnotGeometry:Cc,TorusKnotBufferGeometry:Cc,TubeGeometry:Pc,TubeBufferGeometry:Pc,WireframeGeometry:Ic});class Dc extends En{constructor(e){super(),this.type="ShadowMaterial",this.color=new On(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}Dc.prototype.isShadowMaterial=!0;class Nc extends La{constructor(e){super(e),this.type="RawShaderMaterial"}}Nc.prototype.isRawShaderMaterial=!0;class Bc extends En{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new On(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 On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(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.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this.vertexTangents=e.vertexTangents,this}}Bc.prototype.isMeshStandardMaterial=!0;class Uc extends Bc{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new $r(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=Wr(2.5*(e-1)/(e+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new On(1,1,1),this.setValues(e)}copy(e){return super.copy(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,this.sheen=e.sheen?(this.sheen||new On).copy(e.sheen):null,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this}}Uc.prototype.isMeshPhysicalMaterial=!0;class zc extends En{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new On(16777215),this.specular=new On(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Q,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}zc.prototype.isMeshPhongMaterial=!0;class Fc extends En{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new On(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(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.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this}}Fc.prototype.isMeshToonMaterial=!0;class Gc extends En{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}Gc.prototype.isMeshNormalMaterial=!0;class Vc extends En{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new On(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Q,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this}}Vc.prototype.isMeshLambertMaterial=!0;class Hc extends En{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new On(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}Hc.prototype.isMeshMatcapMaterial=!0;class kc extends ql{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}kc.prototype.isLineDashedMaterial=!0;var jc=Object.freeze({__proto__:null,ShadowMaterial:Dc,SpriteMaterial:dl,RawShaderMaterial:Nc,ShaderMaterial:La,PointsMaterial:nh,MeshPhysicalMaterial:Uc,MeshStandardMaterial:Bc,MeshPhongMaterial:zc,MeshToonMaterial:Fc,MeshNormalMaterial:Gc,MeshLambertMaterial:Vc,MeshDepthMaterial:jo,MeshDistanceMaterial:Wo,MeshBasicMaterial:Dn,MeshMatcapMaterial:Hc,LineDashedMaterial:kc,LineBasicMaterial:ql,Material:En}),Wc={arraySlice:function(e,t,r){return Wc.isTypedArray(e)?new e.constructor(e.subarray(t,void 0===r?e.length:r)):e.slice(t,r)},convertArray:function(e,t,r){return e&&(r||e.constructor!==t)?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,r=Array(t),i=0;i!==t;++i)r[i]=i;return r.sort((function(t,r){return e[t]-e[r]})),r},sortedArray:function(e,t,r){for(var i,n=e.length,a=new e.constructor(n),s=0,o=0;o!==n;++s){i=r[s]*t;for(var l=0;l!==t;++l)a[o++]=e[i+l]}return a},flattenJSON:function(e,t,r,i){for(var n=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[n++];if(void 0!==a){var s=a[i];if(void 0!==s)if(Array.isArray(s))do{void 0!==(s=a[i])&&(t.push(a.time),r.push.apply(r,s)),a=e[n++]}while(void 0!==a);else if(void 0!==s.toArray)do{void 0!==(s=a[i])&&(t.push(a.time),s.toArray(r,r.length)),a=e[n++]}while(void 0!==a);else do{void 0!==(s=a[i])&&(t.push(a.time),r.push(s)),a=e[n++]}while(void 0!==a)}},subclip:function(e,t,r,i){var n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;for(var s=[],o=0;o<a.tracks.length;++o){for(var l,h=a.tracks[o],c=h.getValueSize(),u=[],d=[],p=0;p<h.times.length;++p)if(!((l=h.times[p]*n)<r||l>=i)){u.push(h.times[p]);for(var m=0;m<c;++m)d.push(h.values[p*c+m])}0!==u.length&&(h.times=Wc.convertArray(u,h.times.constructor),h.values=Wc.convertArray(d,h.values.constructor),s.push(h))}a.tracks=s;for(var f=1/0,v=0;v<a.tracks.length;++v)f>a.tracks[v].times[0]&&(f=a.tracks[v].times[0]);for(var g=0;g<a.tracks.length;++g)a.tracks[g].shift(-1*f);return a.resetDuration(),a},makeClipAdditive:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:e,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:30;0>=i&&(i=30);for(var n=r.tracks.length,a=t/i,s=function(){var t=r.tracks[o],i=t.ValueTypeName;if("bool"===i||"string"===i)return 0;var n=e.tracks.find((function(e){return e.name===t.name&&e.ValueTypeName===i}));if(void 0===n)return 0;var s=0,l=t.getValueSize();t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);var h=0,c=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=c/3);var u,d=t.times.length-1;if(a<=t.times[0]){var p=s,m=l-s;u=Wc.arraySlice(t.values,p,m)}else if(a>=t.times[d]){var f=d*l+s,v=f+l-s;u=Wc.arraySlice(t.values,f,v)}else{var g=t.createInterpolant(),y=s,x=l-s;g.evaluate(a),u=Wc.arraySlice(g.resultBuffer,y,x)}"quaternion"===i&&(new hi).fromArray(u).normalize().conjugate().toArray(u);for(var b,w=n.times.length,_=0;_<w;++_)if(b=_*c+h,"quaternion"===i)hi.multiplyQuaternionsFlat(n.values,b,u,0,n.values,b);else for(var M=c-2*h,S=0;S<M;++S)n.values[b+S]-=u[S]},o=0;o<n;++o)s();return e.blendMode=Yt,e}};class Zc{constructor(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0===i?new t.constructor(r):i,this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){var t=this.parameterPositions,r=this._cachedIndex,i=t[r],n=t[r-1];e:{t:{var a;r:{i:if(!(e<i)){for(var s=r+2;;){if(void 0===i){if(e<n)break i;return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,e,n)}if(r===s)break;if(n=i,e<(i=t[++r]))break t}a=t.length;break r}if(e>=n)break e;var o=t[1];e<o&&(r=2,n=o);for(var l=r-2;;){if(void 0===n)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(r===l)break;if(i=n,e>=(n=t[--r-1]))break t}a=r,r=0}for(;r<a;){var h=r+a>>>1;e<t[h]?a=h:r=h+1}if(i=t[r],void 0===(n=t[r-1]))return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,n,e)}this._cachedIndex=r,this.intervalChanged_(r,n,i)}return this.interpolate_(r,n,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){for(var t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=e*i,a=0;a!==i;++a)t[a]=r[n+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Zc.prototype.beforeStart_=Zc.prototype.copySampleValue_,Zc.prototype.afterEnd_=Zc.prototype.copySampleValue_;class qc extends Zc{constructor(e,t,r,i){super(e,t,r,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Wt,endingEnd:Wt}}intervalChanged_(e,t,r){var i=this.parameterPositions,n=e-2,a=e+1,s=i[n],o=i[a];if(void 0===s)switch(this.getSettings_().endingStart){case Zt:n=e,s=2*t-r;break;case qt:s=t+i[n=i.length-2]-i[n+1];break;default:n=e,s=r}if(void 0===o)switch(this.getSettings_().endingEnd){case Zt:a=e,o=2*r-t;break;case qt:a=1,o=r+i[1]-i[0];break;default:a=e-1,o=t}var l=.5*(r-t),h=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-r),this._offsetPrev=n*h,this._offsetNext=a*h}interpolate_(e,t,r,i){for(var n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(r-t)/(i-t),m=p*p,f=m*p,v=-u*f+2*u*m-u*p,g=(1+u)*f+(-1.5-2*u)*m+(-.5+u)*p+1,y=(-1-d)*f+(1.5+d)*m+.5*p,x=d*f-d*m,b=0;b!==s;++b)n[b]=v*a[h+b]+g*a[l+b]+y*a[o+b]+x*a[c+b];return n}}class Xc extends Zc{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){for(var n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=(r-t)/(i-t),c=1-h,u=0;u!==s;++u)n[u]=a[l+u]*c+a[o+u]*h;return n}}class Yc extends Zc{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Jc{constructor(e,t,r,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=Wc.convertArray(t,this.TimeBufferType),this.values=Wc.convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){var t,r=e.constructor;if(r.toJSON!==this.toJSON)t=r.toJSON(e);else{t={name:e.name,times:Wc.convertArray(e.times,Array),values:Wc.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new Yc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Xc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new qc(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){var t;if(e===Ht?t=this.InterpolantFactoryMethodDiscrete:e===kt?t=this.InterpolantFactoryMethodLinear:e===jt&&(t=this.InterpolantFactoryMethodSmooth),void 0===t){var r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(r);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ht;case this.InterpolantFactoryMethodLinear:return kt;case this.InterpolantFactoryMethodSmooth:return jt}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e)for(var t=this.times,r=0,i=t.length;r!==i;++r)t[r]+=e;return this}scale(e){if(1!==e)for(var t=this.times,r=0,i=t.length;r!==i;++r)t[r]*=e;return this}trim(e,t){for(var r=this.times,i=r.length,n=0,a=i-1;n!==i&&r[n]<e;)++n;for(;-1!==a&&r[a]>t;)--a;if(++a,0!==n||a!==i){n>=a&&(n=(a=Math.max(a,1))-1);var s=this.getValueSize();this.times=Wc.arraySlice(r,n,a),this.values=Wc.arraySlice(this.values,n*s,a*s)}return this}validate(){var e=!0,t=this.getValueSize();0!=t-Math.floor(t)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var r=this.times,i=this.values,n=r.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a,s=null,o=0;o!==n;o++){if("number"==typeof(a=r[o])&&isNaN(a)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,a),e=!1;break}if(null!==s&&s>a){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,a,s),e=!1;break}s=a}if(void 0!==i&&Wc.isTypedArray(i))for(var l,h=0,c=i.length;h!==c;++h)if(l=i[h],isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,h,l),e=!1;break}return e}optimize(){for(var e=Wc.arraySlice(this.times),t=Wc.arraySlice(this.values),r=this.getValueSize(),i=this.getInterpolation()===jt,n=e.length-1,a=1,s=1;s<n;++s){var o=!1,l=e[s];if(l!==e[s+1]&&(1!==s||l!==e[0]))if(i)o=!0;else for(var h,c=s*r,u=c-r,d=c+r,p=0;p!==r;++p)if((h=t[c+p])!==t[u+p]||h!==t[d+p]){o=!0;break}if(o){if(s!==a){e[a]=e[s];for(var m=s*r,f=a*r,v=0;v!==r;++v)t[f+v]=t[m+v]}++a}}if(0<n){e[a]=e[n];for(var g=n*r,y=a*r,x=0;x!==r;++x)t[y+x]=t[g+x];++a}return a===e.length?(this.times=e,this.values=t):(this.times=Wc.arraySlice(e,0,a),this.values=Wc.arraySlice(t,0,a*r)),this}clone(){var e=Wc.arraySlice(this.times,0),t=Wc.arraySlice(this.values,0),r=new(0,this.constructor)(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Jc.prototype.TimeBufferType=Float32Array,Jc.prototype.ValueBufferType=Float32Array,Jc.prototype.DefaultInterpolation=kt;class Kc extends Jc{}Kc.prototype.ValueTypeName="bool",Kc.prototype.ValueBufferType=Array,Kc.prototype.DefaultInterpolation=Ht,Kc.prototype.InterpolantFactoryMethodLinear=void 0,Kc.prototype.InterpolantFactoryMethodSmooth=void 0;class Qc extends Jc{}Qc.prototype.ValueTypeName="color";class $c extends Jc{}$c.prototype.ValueTypeName="number";class eu extends Zc{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){for(var n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(r-t)/(i-t),l=e*s,h=l+s;l!==h;l+=4)hi.slerpFlat(n,0,a,l-s,a,l,o);return n}}class tu extends Jc{InterpolantFactoryMethodLinear(e){return new eu(this.times,this.values,this.getValueSize(),e)}}tu.prototype.ValueTypeName="quaternion",tu.prototype.DefaultInterpolation=kt,tu.prototype.InterpolantFactoryMethodSmooth=void 0;class ru extends Jc{}ru.prototype.ValueTypeName="string",ru.prototype.ValueBufferType=Array,ru.prototype.DefaultInterpolation=Ht,ru.prototype.InterpolantFactoryMethodLinear=void 0,ru.prototype.InterpolantFactoryMethodSmooth=void 0;class iu extends Jc{}iu.prototype.ValueTypeName="vector";class nu{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1,r=2<arguments.length?arguments[2]:void 0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:Xt;this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=jr(),0>this.duration&&this.resetDuration()}static parse(e){for(var t=[],r=e.tracks,i=1/(e.fps||1),n=0,a=r.length;n!==a;++n)t.push(au(r[n]).scale(i));var s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){for(var t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},n=0,a=r.length;n!==a;++n)t.push(Jc.toJSON(r[n]));return i}static CreateFromMorphTargetSequence(e,t,r,i){for(var n=t.length,a=[],s=0;s<n;s++){var o=[],l=[];o.push((s+n-1)%n,s,(s+1)%n),l.push(0,1,0);var h=Wc.getKeyframeOrder(o);o=Wc.sortedArray(o,1,h),l=Wc.sortedArray(l,1,h),i||0!==o[0]||(o.push(n),l.push(l[0])),a.push(new $c(".morphTargetInfluences["+t[s].name+"]",o,l).scale(1/r))}return new this(e,-1,a)}static findByName(e,t){var r=e;if(!Array.isArray(e)){var i=e;r=i.geometry&&i.geometry.animations||i.animations}for(var n=0;n<r.length;n++)if(r[n].name===t)return r[n];return null}static CreateClipsFromMorphTargetSequences(e,t,r){for(var i={},n=/^([\w-]*?)([\d]+)$/,a=0,s=e.length;a<s;a++){var o=e[a],l=o.name.match(n);if(l&&1<l.length){var h=l[1],c=i[h];c||(i[h]=c=[]),c.push(o)}}var u=[];for(var d in i)u.push(this.CreateFromMorphTargetSequence(d,i[d],t,r));return u}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var r,i=function(e,t,r,i,n){if(0!==r.length){var a=[],s=[];Wc.flattenJSON(r,a,s,i),0!==a.length&&n.push(new e(t,a,s))}},n=[],a=e.name||"default",s=e.fps||30,o=e.blendMode,l=e.length||-1,h=e.hierarchy||[],c=0;c<h.length;c++)if((r=h[c].keys)&&0!==r.length)if(r[0].morphTargets){var u={},d=void 0;for(d=0;d<r.length;d++)if(r[d].morphTargets)for(var p=0;p<r[d].morphTargets.length;p++)u[r[d].morphTargets[p]]=-1;for(var m in u){for(var f,v=[],g=[],y=0;y!==r[d].morphTargets.length;++y)f=r[d],v.push(f.time),g.push(f.morphTarget===m?1:0);n.push(new $c(".morphTargetInfluence["+m+"]",v,g))}l=u.length*(s||1)}else{var x=".bones["+t[c].name+"]";i(iu,x+".position",r,"pos",n),i(tu,x+".quaternion",r,"rot",n),i(iu,x+".scale",r,"scl",n)}return 0===n.length?null:new this(a,l,n,o)}resetDuration(){for(var e,t=0,r=0,i=this.tracks.length;r!==i;++r)e=this.tracks[r],t=Math.max(t,e.times[e.times.length-1]);return this.duration=t,this}trim(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function au(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 $c;case"vector":case"vector2":case"vector3":case"vector4":return iu;case"color":return Qc;case"quaternion":return tu;case"bool":case"boolean":return Kc;case"string":return ru}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var r=[],i=[];Wc.flattenJSON(e.keys,r,i,"value"),e.times=r,e.values=i}return void 0===t.parse?new t(e.name,e.times,e.values,e.interpolation):t.parse(e)}var su={enabled:!1,files:{},add:function(e,t){!1===this.enabled||(this.files[e]=t)},get:function(e){return!1===this.enabled?void 0:this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class ou{constructor(e,t,r){var i=this,n=!1,a=0,s=0,o=void 0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){s++,!1===n&&void 0!==i.onStart&&i.onStart(e,a,s),n=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,s),a===s&&(n=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return o?o(e):e},this.setURLModifier=function(e){return o=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,r=l.length;t<r;t+=2){var i=l[t],n=l[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return n}return null}}}var lu=new ou;class hu{constructor(e){this.manager=void 0===e?lu:e,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){var r=this;return new Promise((function(i,n){r.load(e,i,t,n)}))}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}var cu={};class uu extends hu{constructor(e){super(e)}load(e,t,r,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var n=this,a=su.get(e);if(void 0!==a)return n.manager.itemStart(e),setTimeout((function(){t&&t(a),n.manager.itemEnd(e)}),0),a;if(void 0===cu[e]){var s,o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var l=o[1],h=!!o[2],c=o[3];c=decodeURIComponent(c),h&&(c=atob(c));try{var u,d=(this.responseType||"").toLowerCase();switch(d){case"arraybuffer":case"blob":for(var p=new Uint8Array(c.length),m=0;m<c.length;m++)p[m]=c.charCodeAt(m);u="blob"===d?new Blob([p.buffer],{type:l}):p.buffer;break;case"document":var f=new DOMParser;u=f.parseFromString(c,l);break;case"json":u=JSON.parse(c);break;default:u=c}setTimeout((function(){t&&t(u),n.manager.itemEnd(e)}),0)}catch(t){setTimeout((function(){i&&i(t),n.manager.itemError(e),n.manager.itemEnd(e)}),0)}}else{for(var v in cu[e]=[],cu[e].push({onLoad:t,onProgress:r,onError:i}),(s=new XMLHttpRequest).open("GET",e,!0),s.addEventListener("load",(function(t){var r=this.response,i=cu[e];if(delete cu[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),su.add(e,r);for(var a,s=0,o=i.length;s<o;s++)(a=i[s]).onLoad&&a.onLoad(r);n.manager.itemEnd(e)}else{for(var l,h=0,c=i.length;h<c;h++)(l=i[h]).onError&&l.onError(t);n.manager.itemError(e),n.manager.itemEnd(e)}}),!1),s.addEventListener("progress",(function(t){for(var r,i=cu[e],n=0,a=i.length;n<a;n++)(r=i[n]).onProgress&&r.onProgress(t)}),!1),s.addEventListener("error",(function(t){var r=cu[e];delete cu[e];for(var i,a=0,s=r.length;a<s;a++)(i=r[a]).onError&&i.onError(t);n.manager.itemError(e),n.manager.itemEnd(e)}),!1),s.addEventListener("abort",(function(t){var r=cu[e];delete cu[e];for(var i,a=0,s=r.length;a<s;a++)(i=r[a]).onError&&i.onError(t);n.manager.itemError(e),n.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.overrideMimeType&&s.overrideMimeType(void 0===this.mimeType?"text/plain":this.mimeType),this.requestHeader)s.setRequestHeader(v,this.requestHeader[v]);s.send(null)}return n.manager.itemStart(e),s}cu[e].push({onLoad:t,onProgress:r,onError:i})}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class du extends hu{constructor(e){super(e)}load(e,t,r,i){var n=this,a=new uu(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(r){try{t(n.parse(JSON.parse(r)))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}}),r,i)}parse(e){for(var t,r=[],i=0;i<e.length;i++)t=nu.parse(e[i]),r.push(t);return r}}class pu extends hu{constructor(e){super(e)}load(e,t,r,i){function n(n){l.load(e[n],(function(e){var r=a.parse(e,!0);s[n]={width:r.width,height:r.height,format:r.format,mipmaps:r.mipmaps},6===(h+=1)&&(1===r.mipmapCount&&(o.minFilter=_e),o.image=s,o.format=r.format,o.needsUpdate=!0,t&&t(o))}),r,i)}var a=this,s=[],o=new dh,l=new uu(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(a.withCredentials);var h=0;if(Array.isArray(e))for(var c=0,u=e.length;c<u;++c)n(c);else l.load(e,(function(e){var r=a.parse(e,!0);if(r.isCubemap){for(var i=r.mipmaps.length/r.mipmapCount,n=0;n<i;n++){s[n]={mipmaps:[]};for(var l=0;l<r.mipmapCount;l++)s[n].mipmaps.push(r.mipmaps[n*r.mipmapCount+l]),s[n].format=r.format,s[n].width=r.width,s[n].height=r.height}o.image=s}else o.image.width=r.width,o.image.height=r.height,o.mipmaps=r.mipmaps;1===r.mipmapCount&&(o.minFilter=_e),o.format=r.format,o.needsUpdate=!0,t&&t(o)}),r,i);return o}}class mu extends hu{constructor(e){super(e)}load(e,t,r,i){function n(){l.removeEventListener("load",n,!1),l.removeEventListener("error",a,!1),su.add(e,this),t&&t(this),s.manager.itemEnd(e)}function a(t){l.removeEventListener("load",n,!1),l.removeEventListener("error",a,!1),i&&i(t),s.manager.itemError(e),s.manager.itemEnd(e)}void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var s=this,o=su.get(e);if(void 0!==o)return s.manager.itemStart(e),setTimeout((function(){t&&t(o),s.manager.itemEnd(e)}),0),o;var l=document.createElementNS("http://www.w3.org/1999/xhtml","img");return l.addEventListener("load",n,!1),l.addEventListener("error",a,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(l.crossOrigin=this.crossOrigin),s.manager.itemStart(e),l.src=e,l}}class fu extends hu{constructor(e){super(e)}load(e,t,r,i){function n(r){s.load(e[r],(function(e){a.images[r]=e,6==++o&&(a.needsUpdate=!0,t&&t(a))}),void 0,i)}var a=new Oa,s=new mu(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);for(var o=0,l=0;l<e.length;++l)n(l);return a}}class vu extends hu{constructor(e){super(e)}load(e,t,r,i){var n=this,a=new zl,s=new uu(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(n.withCredentials),s.load(e,(function(e){var r=n.parse(e);r&&(void 0===r.image?void 0!==r.data&&(a.image.width=r.width,a.image.height=r.height,a.image.data=r.data):a.image=r.image,a.wrapS=void 0===r.wrapS?fe:r.wrapS,a.wrapT=void 0===r.wrapT?fe:r.wrapT,a.magFilter=void 0===r.magFilter?_e:r.magFilter,a.minFilter=void 0===r.minFilter?_e:r.minFilter,a.anisotropy=void 0===r.anisotropy?1:r.anisotropy,void 0!==r.encoding&&(a.encoding=r.encoding),void 0!==r.flipY&&(a.flipY=r.flipY),void 0!==r.format&&(a.format=r.format),void 0!==r.type&&(a.type=r.type),void 0!==r.mipmaps&&(a.mipmaps=r.mipmaps,a.minFilter=Te),1===r.mipmapCount&&(a.minFilter=_e),void 0!==r.generateMipmaps&&(a.generateMipmaps=r.generateMipmaps),a.needsUpdate=!0,t&&t(a,r))}),r,i),a}}class gu extends hu{constructor(e){super(e)}load(e,t,r,i){var n=new ii,a=new mu(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(r){n.image=r;var i=0<e.search(/\.jpe?g($|\?)/i)||0===e.search(/^data\:image\/jpeg/);n.format=i?Ge:Ve,n.needsUpdate=!0,void 0!==t&&t(n)}),r,i),n}}class yu extends Th{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Fh(t,e))}getPoint(e){for(var t=e*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=t){var n=r[i]-t,a=this.curves[i],s=a.getLength(),o=0===s?0:1-n/s;return a.getPointAt(o)}i++}return null}getLength(){var e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,i=this.curves.length;r<i;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:40,t=[],r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(){for(var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:12,r=[],i=0,n=this.curves;i<n.length;i++)for(var a,s=n[i],o=s&&s.isEllipseCurve?2*t:s&&(s.isLineCurve||s.isLineCurve3)?1:s&&s.isSplineCurve?t*s.points.length:t,l=s.getPoints(o),h=0;h<l.length;h++)a=l[h],e&&e.equals(a)||(r.push(a),e=a);return this.autoClose&&1<r.length&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r}copy(e){super.copy(e),this.curves=[];for(var t,r=0,i=e.curves.length;r<i;r++)t=e.curves[r],this.curves.push(t.clone());return this.autoClose=e.autoClose,this}toJSON(){var e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(var t,r=0,i=this.curves.length;r<i;r++)t=this.curves[r],e.curves.push(t.toJSON());return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(var t,r=0,i=e.curves.length;r<i;r++)t=e.curves[r],this.curves.push((new jh[t.type]).fromJSON(t));return this}}class xu extends yu{constructor(e){super(),this.type="Path",this.currentPoint=new $r,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){var r=new Fh(this.currentPoint.clone(),new $r(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,i){var n=new Vh(this.currentPoint.clone(),new $r(e,t),new $r(r,i));return this.curves.push(n),this.currentPoint.set(r,i),this}bezierCurveTo(e,t,r,i,n,a){var s=new Uh(this.currentPoint.clone(),new $r(e,t),new $r(r,i),new $r(n,a));return this.curves.push(s),this.currentPoint.set(n,a),this}splineThru(e){var t=[this.currentPoint.clone()].concat(e),r=new kh(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,i,n,a){var s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+s,t+o,r,i,n,a),this}absarc(e,t,r,i,n,a){return this.absellipse(e,t,r,r,i,n,a),this}ellipse(e,t,r,i,n,a,s,o){var l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,r,i,n,a,s,o),this}absellipse(e,t,r,i,n,a,s,o){var l=new Eh(e,t,r,i,n,a,s,o);if(0<this.curves.length){var h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);var c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){var e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class bu extends xu{constructor(e){super(e),this.uuid=jr(),this.type="Shape",this.holes=[]}getPointsHoles(e){for(var t=[],r=0,i=this.holes.length;r<i;r++)t[r]=this.holes[r].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(var t,r=0,i=e.holes.length;r<i;r++)t=e.holes[r],this.holes.push(t.clone());return this}toJSON(){var e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(var t,r=0,i=this.holes.length;r<i;r++)t=this.holes[r],e.holes.push(t.toJSON());return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(var t,r=0,i=e.holes.length;r<i;r++)t=e.holes[r],this.holes.push((new xu).fromJSON(t));return this}}class wu extends pn{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;super(),this.type="Light",this.color=new On(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){var t=super.toJSON(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}}wu.prototype.isLight=!0;class _u extends wu{constructor(e,t,r){super(e,r),this.type="HemisphereLight",this.position.copy(pn.DefaultUp),this.updateMatrix(),this.groundColor=new On(t)}copy(e){return wu.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}_u.prototype.isHemisphereLight=!0;var Mu=new Vi,Su=new ci,Tu=new ci;class Eu{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new $r(512,512),this.map=null,this.mapPass=null,this.matrix=new Vi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Va,this._frameExtents=new $r(1,1),this._viewportCount=1,this._viewports=[new ai(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){var t=this.camera,r=this.matrix;Su.setFromMatrixPosition(e.matrixWorld),t.position.copy(Su),Tu.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Tu),t.updateMatrixWorld(),Mu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Mu),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(t.projectionMatrix),r.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){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}}class Au extends Eu{constructor(){super(new Ca(50,1,.5,500)),this.focus=1}updateMatrices(e){var t=this.camera,r=2*kr*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,n=e.distance||t.far;(r!==t.fov||i!==t.aspect||n!==t.far)&&(t.fov=r,t.aspect=i,t.far=n,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}Au.prototype.isSpotLightShadow=!0;class Lu extends wu{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:Math.PI/3,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:1;super(e,t),this.type="SpotLight",this.position.copy(pn.DefaultUp),this.updateMatrix(),this.target=new pn,this.distance=r,this.angle=i,this.penumbra=n,this.decay=a,this.shadow=new Au}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(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}}Lu.prototype.isSpotLight=!0;var Ru=new Vi,Cu=new ci,Pu=new ci;class Iu extends Eu{constructor(){super(new Ca(90,1,.5,500)),this._frameExtents=new $r(4,2),this._viewportCount=6,this._viewports=[new ai(2,1,1,1),new ai(0,1,1,1),new ai(3,1,1,1),new ai(1,1,1,1),new ai(3,0,1,1),new ai(1,0,1,1)],this._cubeDirections=[new ci(1,0,0),new ci(-1,0,0),new ci(0,0,1),new ci(0,0,-1),new ci(0,1,0),new ci(0,-1,0)],this._cubeUps=[new ci(0,1,0),new ci(0,1,0),new ci(0,1,0),new ci(0,1,0),new ci(0,0,1),new ci(0,0,-1)]}updateMatrices(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=this.camera,i=this.matrix,n=e.distance||r.far;n!==r.far&&(r.far=n,r.updateProjectionMatrix()),Cu.setFromMatrixPosition(e.matrixWorld),r.position.copy(Cu),Pu.copy(r.position),Pu.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(Pu),r.updateMatrixWorld(),i.makeTranslation(-Cu.x,-Cu.y,-Cu.z),Ru.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ru)}}Iu.prototype.isPointLightShadow=!0;class Ou extends wu{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;super(e,t),this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new Iu}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}Ou.prototype.isPointLight=!0;class Du extends Ra{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:-1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-1,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:.1,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:2e3;super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=n,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(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(e,t,r,i,n,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=r,this.view.offsetY=i,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2,n=r-e,a=r+e,s=i+t,o=i-t;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(n+=l*this.view.offsetX)+l*this.view.width,o=(s-=h*this.view.offsetY)-h*this.view.height}this.projectionMatrix.makeOrthographic(n,a,s,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){var t=super.toJSON(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}}Du.prototype.isOrthographicCamera=!0;class Nu extends Eu{constructor(){super(new Du(-5,5,5,-5,.5,500))}}Nu.prototype.isDirectionalLightShadow=!0;class Bu extends wu{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(pn.DefaultUp),this.updateMatrix(),this.target=new pn,this.shadow=new Nu}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}Bu.prototype.isDirectionalLight=!0;class Uu extends wu{constructor(e,t){super(e,t),this.type="AmbientLight"}}Uu.prototype.isAmbientLight=!0;class zu extends wu{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:10,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:10;super(e,t),this.type="RectAreaLight",this.width=r,this.height=i}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){var t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}zu.prototype.isRectAreaLight=!0;class Fu{constructor(){this.coefficients=[];for(var e=0;9>e;e++)this.coefficients.push(new ci)}set(e){for(var t=0;9>t;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(var e=0;9>e;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){var r=e.x,i=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*n),t.addScaledVector(a[3],.488603*r),t.addScaledVector(a[4],r*i*1.092548),t.addScaledVector(a[5],i*n*1.092548),t.addScaledVector(a[6],.315392*(3*n*n-1)),t.addScaledVector(a[7],r*n*1.092548),t.addScaledVector(a[8],.546274*(r*r-i*i)),t}getIrradianceAt(e,t){var r=e.x,i=e.y,n=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*n),t.addScaledVector(a[3],1.023328*r),t.addScaledVector(a[4],.858086*r*i),t.addScaledVector(a[5],.858086*i*n),t.addScaledVector(a[6],.743125*n*n-.247708),t.addScaledVector(a[7],.858086*r*n),t.addScaledVector(a[8],.429043*(r*r-i*i)),t}add(e){for(var t=0;9>t;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(var r=0;9>r;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(var t=0;9>t;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(var r=0;9>r;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this}equals(e){for(var t=0;9>t;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=this.coefficients,i=0;9>i;i++)r[i].fromArray(e,t+3*i);return this}toArray(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=this.coefficients,i=0;9>i;i++)r[i].toArray(e,t+3*i);return e}static getBasisAt(e,t){var r=e.x,i=e.y,n=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*n,t[3]=.488603*r,t[4]=1.092548*r*i,t[5]=1.092548*i*n,t[6]=.315392*(3*n*n-1),t[7]=1.092548*r*n,t[8]=.546274*(r*r-i*i)}}Fu.prototype.isSphericalHarmonics3=!0;class Gu extends wu{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Fu;super(void 0,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1),this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){var t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}Gu.prototype.isLightProbe=!0;class Vu extends hu{constructor(e){super(e),this.textures={}}load(e,t,r,i){var n=this,a=new uu(n.manager);a.setPath(n.path),a.setRequestHeader(n.requestHeader),a.setWithCredentials(n.withCredentials),a.load(e,(function(r){try{t(n.parse(JSON.parse(r)))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}}),r,i)}parse(e){function t(e){return void 0===r[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),r[e]}var r=this.textures,i=new jc[e.type];if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.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 On).setHex(e.sheen)),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.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.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),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.shadowSide&&(i.shadowSide=e.shadowSide),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.morphTargets&&(i.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(i.morphNormals=e.morphNormals),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),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=!!(0<e.vertexColors):i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var n in e.uniforms){var a=e.uniforms[n];switch(i.uniforms[n]={},a.type){case"t":i.uniforms[n].value=t(a.value);break;case"c":i.uniforms[n].value=(new On).setHex(a.value);break;case"v2":i.uniforms[n].value=(new $r).fromArray(a.value);break;case"v3":i.uniforms[n].value=(new ci).fromArray(a.value);break;case"v4":i.uniforms[n].value=(new ai).fromArray(a.value);break;case"m3":i.uniforms[n].value=(new ei).fromArray(a.value);break;case"m4":i.uniforms[n].value=(new Vi).fromArray(a.value);break;default:i.uniforms[n].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 s in e.extensions)i.extensions[s]=e.extensions[s];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=t(e.map)),void 0!==e.matcap&&(i.matcap=t(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=t(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=t(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=t(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){var o=e.normalScale;!1===Array.isArray(o)&&(o=[o,o]),i.normalScale=(new $r).fromArray(o)}return void 0!==e.displacementMap&&(i.displacementMap=t(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=t(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=t(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=t(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=t(e.specularMap)),void 0!==e.envMap&&(i.envMap=t(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=t(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=t(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=t(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=t(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=t(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=t(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new $r).fromArray(e.clearcoatNormalScale)),void 0!==e.transmissionMap&&(i.transmissionMap=t(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=t(e.thicknessMap)),i}setTextures(e){return this.textures=e,this}}class Hu{static decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",r=0,i=e.length;r<i;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}}class ku extends na{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){var e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}ku.prototype.isInstancedBufferGeometry=!0;class ju extends Un{constructor(e,t,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;"number"==typeof r&&(i=r,r=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,r),this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){var e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}ju.prototype.isInstancedBufferAttribute=!0;class Wu extends hu{constructor(e){super(e)}load(e,t,r,i){var n=this,a=new uu(n.manager);a.setPath(n.path),a.setRequestHeader(n.requestHeader),a.setWithCredentials(n.withCredentials),a.load(e,(function(r){try{t(n.parse(JSON.parse(r)))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}}),r,i)}parse(e){function t(e,t){if(void 0!==r[t])return r[t];var n=e.interleavedBuffers[t],a=function(e,t){if(void 0!==i[t])return i[t];var r=e.arrayBuffers[t],n=new Uint32Array(r).buffer;return i[t]=n,n}(e,n.buffer),s=Jn(n.type,a),o=new hl(s,n.stride);return o.uuid=n.uuid,r[t]=o,o}var r={},i={},n=e.isInstancedBufferGeometry?new ku:new na,a=e.data.index;if(void 0!==a){var s=Jn(a.type,a.array);n.setIndex(new Un(s,1))}var o=e.data.attributes;for(var l in o){var h=o[l],c=void 0;if(h.isInterleavedBufferAttribute){var u=t(e.data,h.data);c=new ul(u,h.itemSize,h.offset,h.normalized)}else{var d=Jn(h.type,h.array);c=new(h.isInstancedBufferAttribute?ju:Un)(d,h.itemSize,h.normalized)}void 0!==h.name&&(c.name=h.name),void 0!==h.usage&&c.setUsage(h.usage),void 0!==h.updateRange&&(c.updateRange.offset=h.updateRange.offset,c.updateRange.count=h.updateRange.count),n.setAttribute(l,c)}var p=e.data.morphAttributes;if(p)for(var m in p){for(var f=p[m],v=[],g=0,y=f.length;g<y;g++){var x=f[g],b=void 0;if(x.isInterleavedBufferAttribute){var w=t(e.data,x.data);b=new ul(w,x.itemSize,x.offset,x.normalized)}else{var _=Jn(x.type,x.array);b=new Un(_,x.itemSize,x.normalized)}void 0!==x.name&&(b.name=x.name),v.push(b)}n.morphAttributes[m]=v}e.data.morphTargetsRelative&&(n.morphTargetsRelative=!0);var M=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==M)for(var S,T=0,E=M.length;T!==E;++T)S=M[T],n.addGroup(S.start,S.count,S.materialIndex);var A=e.data.boundingSphere;if(void 0!==A){var L=new ci;void 0!==A.center&&L.fromArray(A.center),n.boundingSphere=new Ii(L,A.radius)}return e.name&&(n.name=e.name),e.userData&&(n.userData=e.userData),n}}class Zu extends hu{constructor(e){super(e)}load(e,t,r,i){var n=this,a=""===this.path?Hu.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var s=new uu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(r){var a=null;try{a=JSON.parse(r)}catch(t){return void 0!==i&&i(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var s=a.metadata;return void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase()?void console.error("THREE.ObjectLoader: Can't load "+e):void n.parse(a,t)}),r,i)}loadAsync(e,t){var r=this;return n((function*(){var i=r,n=""===r.path?Hu.extractUrlBase(e):r.path;r.resourcePath=r.resourcePath||n;var a=new uu(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials);var s=yield a.loadAsync(e,t),o=JSON.parse(s),l=o.metadata;if(void 0===l||void 0===l.type||"geometry"===l.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+e);return yield i.parseAsync(o)}))()}parse(e,t){var r=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),n=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,(function(){void 0!==t&&t(l)})),s=this.parseTextures(e.textures,a),o=this.parseMaterials(e.materials,s),l=this.parseObject(e.object,n,o,s,r),h=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,h),void 0!==t){var c=!1;for(var u in a)if(a[u]instanceof HTMLImageElement){c=!0;break}0==c&&t(l)}return l}parseAsync(e){var t=this;return n((function*(){var r=t.parseAnimations(e.animations),i=t.parseShapes(e.shapes),n=t.parseGeometries(e.geometries,i),a=yield t.parseImagesAsync(e.images),s=t.parseTextures(e.textures,a),o=t.parseMaterials(e.materials,s),l=t.parseObject(e.object,n,o,s,r),h=t.parseSkeletons(e.skeletons,l);return t.bindSkeletons(l,h),l}))()}parseShapes(e){var t={};if(void 0!==e)for(var r,i=0,n=e.length;i<n;i++)t[(r=(new bu).fromJSON(e[i])).uuid]=r;return t}parseSkeletons(e,t){var r={},i={};if(t.traverse((function(e){e.isBone&&(i[e.uuid]=e)})),void 0!==e)for(var n,a=0,s=e.length;a<s;a++)r[(n=(new Vl).fromJSON(e[a],i)).uuid]=n;return r}parseGeometries(e,t){var r={};if(void 0!==e)for(var i=new Wu,n=0,a=e.length;n<a;n++){var s=void 0,o=e[n];switch(o.type){case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(o);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:o.type in Oc?s=Oc[o.type].fromJSON(o,t):console.warn('THREE.ObjectLoader: Unsupported geometry type "'.concat(o.type,'"'))}s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),!0===s.isBufferGeometry&&void 0!==o.userData&&(s.userData=o.userData),r[o.uuid]=s}return r}parseMaterials(e,t){var r={},i={};if(void 0!==e){var n=new Vu;n.setTextures(t);for(var a,s=0,o=e.length;s<o;s++)if("MultiMaterial"===(a=e[s]).type){for(var l,h=[],c=0;c<a.materials.length;c++)void 0===r[(l=a.materials[c]).uuid]&&(r[l.uuid]=n.parse(l)),h.push(r[l.uuid]);i[a.uuid]=h}else void 0===r[a.uuid]&&(r[a.uuid]=n.parse(a)),i[a.uuid]=r[a.uuid]}return i}parseAnimations(e){var t={};if(void 0!==e)for(var r=0;r<e.length;r++){var i=e[r],n=nu.parse(i);t[n.uuid]=n}return t}parseImages(e,t){function r(e){if("string"==typeof e){var t=e;return function(e){return n.manager.itemStart(e),i.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemError(e),n.manager.itemEnd(e)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:n.resourcePath+t)}return e.data?{data:Jn(e.type,e.data),width:e.width,height:e.height}:null}var i,n=this,a={};if(void 0!==e&&0<e.length){var s=new ou(t);(i=new mu(s)).setCrossOrigin(this.crossOrigin);for(var o=0,l=e.length;o<l;o++){var h=e[o],c=h.url;if(Array.isArray(c)){a[h.uuid]=[];for(var u=0,d=c.length;u<d;u++){var p=r(c[u]);null!==p&&(p instanceof HTMLImageElement?a[h.uuid].push(p):a[h.uuid].push(new zl(p.data,p.width,p.height)))}}else{var m=r(h.url);null!==m&&(a[h.uuid]=m)}}}return a}parseImagesAsync(e){var t=this;return n((function*(){function r(e){return i.apply(this,arguments)}function i(){return i=n((function*(e){if("string"==typeof e){var t=e,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:s.resourcePath+t;return yield a.loadAsync(r)}return e.data?{data:Jn(e.type,e.data),width:e.width,height:e.height}:null})),i.apply(this,arguments)}var a,s=t,o={};if(void 0!==e&&0<e.length){(a=new mu(t.manager)).setCrossOrigin(t.crossOrigin);for(var l=0,h=e.length;l<h;l++){var c=e[l],u=c.url;if(Array.isArray(u)){o[c.uuid]=[];for(var d=0,p=u.length;d<p;d++){var m=u[d],f=yield r(m);null!==f&&(f instanceof HTMLImageElement?o[c.uuid].push(f):o[c.uuid].push(new zl(f.data,f.width,f.height)))}}else{var v=yield r(c.url);null!==v&&(o[c.uuid]=v)}}}return o}))()}parseTextures(e,t){function r(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var i={};if(void 0!==e)for(var n,a=0,s=e.length;a<s;a++){void 0===(n=e[a]).image&&console.warn('THREE.ObjectLoader: No "image" specified for',n.uuid),void 0===t[n.image]&&console.warn("THREE.ObjectLoader: Undefined image",n.image);var o=void 0,l=t[n.image];Array.isArray(l)?(o=new Oa(l),6===l.length&&(o.needsUpdate=!0)):(o=l&&l.data?new zl(l.data,l.width,l.height):new ii(l),l&&(o.needsUpdate=!0)),o.uuid=n.uuid,void 0!==n.name&&(o.name=n.name),void 0!==n.mapping&&(o.mapping=r(n.mapping,qu)),void 0!==n.offset&&o.offset.fromArray(n.offset),void 0!==n.repeat&&o.repeat.fromArray(n.repeat),void 0!==n.center&&o.center.fromArray(n.center),void 0!==n.rotation&&(o.rotation=n.rotation),void 0!==n.wrap&&(o.wrapS=r(n.wrap[0],Xu),o.wrapT=r(n.wrap[1],Xu)),void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.encoding&&(o.encoding=n.encoding),void 0!==n.minFilter&&(o.minFilter=r(n.minFilter,Yu)),void 0!==n.magFilter&&(o.magFilter=r(n.magFilter,Yu)),void 0!==n.anisotropy&&(o.anisotropy=n.anisotropy),void 0!==n.flipY&&(o.flipY=n.flipY),void 0!==n.premultiplyAlpha&&(o.premultiplyAlpha=n.premultiplyAlpha),void 0!==n.unpackAlignment&&(o.unpackAlignment=n.unpackAlignment),i[n.uuid]=o}return i}parseObject(e,t,r,i,n){function a(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function s(e){if(void 0!==e){if(Array.isArray(e)){for(var t,i=[],n=0,a=e.length;n<a;n++)t=e[n],void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i.push(r[t]);return i}return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),r[e]}}function o(e){return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),i[e]}var l,h,c;switch(e.type){case"Scene":l=new ll,void 0!==e.background&&(Number.isInteger(e.background)?l.background=new On(e.background):l.background=o(e.background)),void 0!==e.environment&&(l.environment=o(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?l.fog=new ol(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(l.fog=new sl(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":l=new Ca(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(l.focus=e.focus),void 0!==e.zoom&&(l.zoom=e.zoom),void 0!==e.filmGauge&&(l.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(l.filmOffset=e.filmOffset),void 0!==e.view&&(l.view=Object.assign({},e.view));break;case"OrthographicCamera":l=new Du(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(l.zoom=e.zoom),void 0!==e.view&&(l.view=Object.assign({},e.view));break;case"AmbientLight":l=new Uu(e.color,e.intensity);break;case"DirectionalLight":l=new Bu(e.color,e.intensity);break;case"PointLight":l=new Ou(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":l=new zu(e.color,e.intensity,e.width,e.height);break;case"SpotLight":l=new Lu(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":l=new _u(e.color,e.groundColor,e.intensity);break;case"LightProbe":l=(new Gu).fromJSON(e);break;case"SkinnedMesh":h=a(e.geometry),c=s(e.material),l=new Bl(h,c),void 0!==e.bindMode&&(l.bindMode=e.bindMode),void 0!==e.bindMatrix&&l.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(l.skeleton=e.skeleton);break;case"Mesh":h=a(e.geometry),c=s(e.material),l=new _a(h,c);break;case"InstancedMesh":h=a(e.geometry),c=s(e.material);var u=e.count,d=e.instanceMatrix,p=e.instanceColor;(l=new Zl(h,c,u)).instanceMatrix=new Un(new Float32Array(d.array),16),void 0!==p&&(l.instanceColor=new Un(new Float32Array(p.array),p.itemSize));break;case"LOD":l=new Cl;break;case"Line":l=new $l(a(e.geometry),s(e.material));break;case"LineLoop":l=new ih(a(e.geometry),s(e.material));break;case"LineSegments":l=new rh(a(e.geometry),s(e.material));break;case"PointCloud":case"Points":l=new hh(a(e.geometry),s(e.material));break;case"Sprite":l=new El(s(e.material));break;case"Group":l=new $o;break;case"Bone":l=new Ul;break;default:l=new pn}if(l.uuid=e.uuid,void 0!==e.name&&(l.name=e.name),void 0===e.matrix?(void 0!==e.position&&l.position.fromArray(e.position),void 0!==e.rotation&&l.rotation.fromArray(e.rotation),void 0!==e.quaternion&&l.quaternion.fromArray(e.quaternion),void 0!==e.scale&&l.scale.fromArray(e.scale)):(l.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)),void 0!==e.castShadow&&(l.castShadow=e.castShadow),void 0!==e.receiveShadow&&(l.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(l.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(l.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(l.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&l.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(l.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(l.visible=e.visible),void 0!==e.frustumCulled&&(l.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(l.renderOrder=e.renderOrder),void 0!==e.userData&&(l.userData=e.userData),void 0!==e.layers&&(l.layers.mask=e.layers),void 0!==e.children)for(var m=e.children,f=0;f<m.length;f++)l.add(this.parseObject(m[f],t,r,i,n));if(void 0!==e.animations)for(var v,g=e.animations,y=0;y<g.length;y++)v=g[y],l.animations.push(n[v]);if("LOD"===e.type){void 0!==e.autoUpdate&&(l.autoUpdate=e.autoUpdate);for(var x=e.levels,b=0;b<x.length;b++){var w=x[b],_=l.getObjectByProperty("uuid",w.object);void 0!==_&&l.addLevel(_,w.distance)}}return l}bindSkeletons(e,t){0===Object.keys(t).length||e.traverse((function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){var r=t[e.skeleton];void 0===r?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(r,e.bindMatrix)}}))}setTexturePath(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}var qu={UVMapping:oe,CubeReflectionMapping:le,CubeRefractionMapping:he,EquirectangularReflectionMapping:ce,EquirectangularRefractionMapping:ue,CubeUVReflectionMapping:de,CubeUVRefractionMapping:pe},Xu={RepeatWrapping:me,ClampToEdgeWrapping:fe,MirroredRepeatWrapping:ve},Yu={NearestFilter:ge,NearestMipmapNearestFilter:ye,NearestMipmapLinearFilter:be,LinearFilter:_e,LinearMipmapNearestFilter:Me,LinearMipmapLinearFilter:Te};class Ju extends hu{constructor(e){super(e),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var n=this,a=su.get(e);if(void 0!==a)return n.manager.itemStart(e),setTimeout((function(){t&&t(a),n.manager.itemEnd(e)}),0),a;var s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(e,s).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(n.options,{colorSpaceConversion:"none"}))})).then((function(r){su.add(e,r),t&&t(r),n.manager.itemEnd(e)})).catch((function(t){i&&i(t),n.manager.itemError(e),n.manager.itemEnd(e)})),n.manager.itemStart(e)}}Ju.prototype.isImageBitmapLoader=!0;class Ku{constructor(){this.type="ShapePath",this.color=new On,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new xu,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,i){return this.currentPath.quadraticCurveTo(e,t,r,i),this}bezierCurveTo(e,t,r,i,n,a){return this.currentPath.bezierCurveTo(e,t,r,i,n,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function r(e){for(var t=[],r=0,i=e.length;r<i;r++){var n=e[r],a=new bu;a.curves=n.curves,t.push(a)}return t}function i(e,t){for(var r=t.length,i=!1,n=r-1,a=0;a<r;n=a++){var s=t[n],o=t[a],l=o.x-s.x,h=o.y-s.y;if(Math.abs(h)>Number.EPSILON){if(0>h&&(s=t[a],l=-l,o=t[n],h=-h),e.y<s.y||e.y>o.y)continue;if(e.y!==s.y){var c=h*(e.x-s.x)-l*(e.y-s.y);if(0==c)return!0;if(0>c)continue;i=!i}else if(e.x===s.x)return!0}else{if(e.y!==s.y)continue;if(o.x<=e.x&&e.x<=s.x||s.x<=e.x&&e.x<=o.x)return!0}}return i}var n=fc.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return r(a);var s,o,l,h=[];if(1===a.length)return o=a[0],(l=new bu).curves=o.curves,h.push(l),h;var c=!n(a[0].getPoints());c=e?!c:c;var u,d=[],p=[],m=[],f=0;p[f]=void 0,m[f]=[];for(var v=0,g=a.length;v<g;v++)s=n(u=(o=a[v]).getPoints()),(s=e?!s:s)?(!c&&p[f]&&f++,p[f]={s:new bu,p:u},p[f].s.curves=o.curves,c&&f++,m[f]=[]):m[f].push({h:o,p:u[0]});if(!p[0])return r(a);if(1<p.length){for(var y=!1,x=[],b=0,w=p.length;b<w;b++)d[b]=[];for(var _,M=0,S=p.length;M<S;M++){_=m[M];for(var T=0;T<_.length;T++){for(var E=_[T],A=!0,L=0;L<p.length;L++)i(E.p,p[L].p)&&(M!==L&&x.push({froms:M,tos:L,hole:T}),A?(A=!1,d[L].push(E)):y=!0);A&&d[M].push(E)}}0<x.length&&!y&&(m=d)}for(var R,C=0,P=p.length;C<P;C++){l=p[C].s,h.push(l);for(var I=0,O=(R=m[C]).length;I<O;I++)l.holes.push(R[I].h)}return h}}class Qu{constructor(e){this.type="Font",this.data=e}generateShapes(e){for(var t=[],r=function(e,t,r){for(var i,n=Array.from(e),a=t/r.resolution,s=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*a,o=[],l=0,h=0,c=0;c<n.length;c++)if("\n"===(i=n[c]))l=0,h-=s;else{var u=$u(i,a,l,h,r);l+=u.offsetX,o.push(u.path)}return o}(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:100,this.data),i=0,n=r.length;i<n;i++)Array.prototype.push.apply(t,r[i].toShapes());return t}}function $u(e,t,r,i,n){var a=n.glyphs[e]||n.glyphs["?"];if(a){var s,o,l,h,c,u,d,p,m=new Ku;if(a.o)for(var f,v=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),g=0,y=v.length;g<y;)"m"===(f=v[g++])?(s=v[g++]*t+r,o=v[g++]*t+i,m.moveTo(s,o)):"l"===f?(s=v[g++]*t+r,o=v[g++]*t+i,m.lineTo(s,o)):"q"===f?(l=v[g++]*t+r,h=v[g++]*t+i,c=v[g++]*t+r,u=v[g++]*t+i,m.quadraticCurveTo(c,u,l,h)):"b"===f&&(l=v[g++]*t+r,h=v[g++]*t+i,c=v[g++]*t+r,u=v[g++]*t+i,d=v[g++]*t+r,p=v[g++]*t+i,m.bezierCurveTo(c,u,d,p,l,h));return{offsetX:a.ha*t,path:m}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+n.familyName+".")}Qu.prototype.isFont=!0;class ed extends hu{constructor(e){super(e)}load(e,t,r,i){var n=this,a=new uu(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(n.withCredentials),a.load(e,(function(e){var r;try{r=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),r=JSON.parse(e.substring(65,e.length-2))}var i=n.parse(r);t&&t(i)}),r,i)}parse(e){return new Qu(e)}}var td,rd={getContext:function(){return void 0===td&&(td=new(window.AudioContext||window.webkitAudioContext)),td},setContext:function(e){td=e}};class id extends hu{constructor(e){super(e)}load(e,t,r,i){var n=this,a=new uu(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(r){try{var a=r.slice(0);rd.getContext().decodeAudioData(a,(function(e){t(e)}))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}}),r,i)}}class nd extends Gu{constructor(e,t){super(void 0,2<arguments.length&&void 0!==arguments[2]?arguments[2]:1);var r=(new On).set(e),i=(new On).set(t),n=new ci(r.r,r.g,r.b),a=new ci(i.r,i.g,i.b),s=Math.sqrt(Math.PI),o=s*Math.sqrt(.75);this.sh.coefficients[0].copy(n).add(a).multiplyScalar(s),this.sh.coefficients[1].copy(n).sub(a).multiplyScalar(o)}}nd.prototype.isHemisphereLightProbe=!0;class ad extends Gu{constructor(e){super(void 0,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1);var t=(new On).set(e);this.sh.coefficients[0].set(t.r,t.g,t.b).multiplyScalar(2*Math.sqrt(Math.PI))}}ad.prototype.isAmbientLightProbe=!0;var sd=new Vi,od=new Vi;class ld{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ca,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ca,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}}update(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 r,i,n=e.projectionMatrix.clone(),a=t.eyeSep/2,s=a*t.near/t.focus,o=t.near*Math.tan(Hr*t.fov*.5)/t.zoom;od.elements[12]=-a,sd.elements[12]=a,r=-o*t.aspect+s,i=o*t.aspect+s,n.elements[0]=2*t.near/(i-r),n.elements[8]=(i+r)/(i-r),this.cameraL.projectionMatrix.copy(n),r=-o*t.aspect-s,i=o*t.aspect-s,n.elements[0]=2*t.near/(i-r),n.elements[8]=(i+r)/(i-r),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(od),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(sd)}}class hd{constructor(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=cd(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=cd();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function cd(){return("undefined"==typeof performance?Date:performance).now()}var ud=new ci,dd=new hi,pd=new ci,md=new ci;class fd extends pn{constructor(){super(),this.type="AudioListener",this.context=rd.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new hd}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null===this.filter?this.gain.disconnect(this.context.destination):(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);var t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ud,dd,pd),md.set(0,0,-1).applyQuaternion(dd),t.positionX){var i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ud.x,i),t.positionY.linearRampToValueAtTime(ud.y,i),t.positionZ.linearRampToValueAtTime(ud.z,i),t.forwardX.linearRampToValueAtTime(md.x,i),t.forwardY.linearRampToValueAtTime(md.y,i),t.forwardZ.linearRampToValueAtTime(md.z,i),t.upX.linearRampToValueAtTime(r.x,i),t.upY.linearRampToValueAtTime(r.y,i),t.upZ.linearRampToValueAtTime(r.z,i)}else t.setPosition(ud.x,ud.y,ud.z),t.setOrientation(md.x,md.y,md.z,r.x,r.y,r.z)}}class vd extends pn{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")}pause(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress%=this.duration||this.buffer.duration),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this)}stop(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this)}connect(){if(0<this.filters.length){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}disconnect(){if(0<this.filters.length){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}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this)}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this)}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}var gd=new ci,yd=new hi,xd=new ci,bd=new ci;class wd extends vd{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=r,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(gd,yd,xd),bd.set(0,0,1).applyQuaternion(yd);var t=this.panner;if(t.positionX){var r=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(gd.x,r),t.positionY.linearRampToValueAtTime(gd.y,r),t.positionZ.linearRampToValueAtTime(gd.z,r),t.orientationX.linearRampToValueAtTime(bd.x,r),t.orientationY.linearRampToValueAtTime(bd.y,r),t.orientationZ.linearRampToValueAtTime(bd.z,r)}else t.setPosition(gd.x,gd.y,gd.z),t.setOrientation(bd.x,bd.y,bd.z)}}}class _d{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:2048;this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){for(var e=0,t=this.getFrequencyData(),r=0;r<t.length;r++)e+=t[r];return e/t.length}}class Md{constructor(e,t,r){var i,n,a;this.binding=e,this.valueSize=r,"quaternion"===t?(i=this._slerp,n=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*r),this._workIndex=5):"string"===t||"bool"===t?(i=this._select,n=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(5*r)):(i=this._lerp,n=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*r)),this._mixBufferRegion=i,this._mixBufferRegionAdditive=n,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){var r=this.buffer,i=this.valueSize,n=e*i+i,a=this.cumulativeWeight;if(0===a){for(var s=0;s!==i;++s)r[n+s]=r[s];a=t}else{var o=t/(a+=t);this._mixBufferRegion(r,n,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){var t=this.buffer,r=this.valueSize,i=r*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){var t=this.valueSize,r=this.buffer,i=e*t+t,n=this.cumulativeWeight,a=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,1>n){var o=t*this._origIndex;this._mixBufferRegion(r,i,o,1-n,t)}0<a&&this._mixBufferRegionAdditive(r,i,this._addIndex*t,1,t);for(var l=t,h=t+t;l!==h;++l)if(r[l]!==r[l+t]){s.setValue(r,i);break}}saveOriginalState(){var e=this.binding,t=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(t,i);for(var n=r,a=i;n!==a;++n)t[n]=t[i+n%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,r=e;r<t;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,i,n){if(.5<=i)for(var a=0;a!==n;++a)e[t+a]=e[r+a]}_slerp(e,t,r,i){hi.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,n){var a=this._workIndex*n;hi.multiplyQuaternionsFlat(e,a,e,t,e,r),hi.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,r,i,n){for(var a,s=1-i,o=0;o!==n;++o)e[a=t+o]=e[a]*s+e[r+o]*i}_lerpAdditive(e,t,r,i,n){for(var a=0;a!==n;++a)e[t+a]+=e[r+a]*i}}var Sd="\\[\\]\\.:\\/",Td=/[\[\]\.:\/]/g,Ed="[^"+Sd+"]",Ad="[^"+Sd.replace("\\.","")+"]",Ld=/((?:WC+[\/:])*)/.source.replace("WC",Ed),Rd=/(WCOD+)?/.source.replace("WCOD",Ad),Cd=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ed),Pd=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ed),Id=new RegExp("^"+Ld+Rd+Cd+Pd+"$"),Od=["material","materials","bones"];class Dd{constructor(e,t,r){this.path=t,this.parsedPath=r||Dd.parseTrackName(t),this.node=Dd.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new Dd.Composite(e,t,r):new Dd(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Td,"")}static parseTrackName(e){var t=Id.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var n=r.nodeName.substring(i+1);-1!==Od.indexOf(n)&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=n)}if(null===r.propertyName||0===r.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var r=e.skeleton.getBoneByName(t);if(void 0!==r)return r}if(e.children){var i=function e(r){for(var i,n=0;n<r.length;n++){if((i=r[n]).name===t||i.uuid===t)return i;var a=e(i.children);if(a)return a}return null}(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.node[this.propertyName]}_getValue_array(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)e[t++]=r[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){var e=this.node,t=this.parsedPath,r=t.objectName,i=t.propertyName,n=t.propertyIndex;if(e||(e=Dd.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(r){var a=t.objectIndex;switch(r){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var s=0;s<e.length;s++)if(e[s].name===a){a=s;break}break;default:if(void 0===e[r])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[r]}if(void 0!==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 o=e[i];if(void 0!==o){var l=this.Versioning.None;this.targetObject=e,void 0===e.needsUpdate?void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate):l=this.Versioning.NeedsUpdate;var h=this.BindingType.Direct;if(void 0!==n){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[n]&&(n=e.morphTargetDictionary[n])}h=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=n}else void 0!==o.fromArray&&void 0!==o.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(h=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][l]}else{var c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Dd.Composite=class{constructor(e,t,r){var i=r||Dd.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();var r=this._targetGroup.nCachedObjects_,i=this._bindings[r];void 0!==i&&i.getValue(e,t)}setValue(e,t){for(var r=this._bindings,i=this._targetGroup.nCachedObjects_,n=r.length;i!==n;++i)r[i].setValue(e,t)}bind(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},Dd.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Dd.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Dd.prototype.GetterByBindingType=[Dd.prototype._getValue_direct,Dd.prototype._getValue_array,Dd.prototype._getValue_arrayElement,Dd.prototype._getValue_toArray],Dd.prototype.SetterByBindingTypeAndVersioning=[[Dd.prototype._setValue_direct,Dd.prototype._setValue_direct_setNeedsUpdate,Dd.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Dd.prototype._setValue_array,Dd.prototype._setValue_array_setNeedsUpdate,Dd.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Dd.prototype._setValue_arrayElement,Dd.prototype._setValue_arrayElement_setNeedsUpdate,Dd.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Dd.prototype._setValue_fromArray,Dd.prototype._setValue_fromArray_setNeedsUpdate,Dd.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Nd{constructor(){this.uuid=jr(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,r=arguments.length;t!==r;++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}}}add(){for(var e=this._objects,t=this._indicesByUUID,r=this._paths,i=this._parsedPaths,n=this._bindings,a=n.length,s=void 0,o=e.length,l=this.nCachedObjects_,h=0,c=arguments.length;h!==c;++h){var u=arguments[h],d=u.uuid,p=t[d];if(void 0===p){p=o++,t[d]=p,e.push(u);for(var m=0,f=a;m!==f;++m)n[m].push(new Dd(u,r[m],i[m]))}else if(p<l){s=e[p];var v=--l,g=e[v];t[g.uuid]=p,e[p]=g,t[d]=v,e[v]=u;for(var y=0,x=a;y!==x;++y){var b=n[y],w=b[v],_=b[p];b[p]=w,void 0===_&&(_=new Dd(u,r[y],i[y])),b[v]=_}}else e[p]!==s&&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(){for(var e=this._objects,t=this._indicesByUUID,r=this._bindings,i=r.length,n=this.nCachedObjects_,a=0,s=arguments.length;a!==s;++a){var o=arguments[a],l=o.uuid,h=t[l];if(void 0!==h&&h>=n){var c=n++,u=e[c];t[u.uuid]=h,e[h]=u,t[l]=c,e[c]=o;for(var d=0,p=i;d!==p;++d){var m=r[d],f=m[c],v=m[h];m[h]=f,m[c]=v}}}this.nCachedObjects_=n}uncache(){for(var e=this._objects,t=this._indicesByUUID,r=this._bindings,i=r.length,n=this.nCachedObjects_,a=e.length,s=0,o=arguments.length;s!==o;++s){var l=arguments[s].uuid,h=t[l];if(void 0!==h)if(delete t[l],h<n){var c=--n,u=e[c],d=--a,p=e[d];t[u.uuid]=h,e[h]=u,t[p.uuid]=c,e[c]=p,e.pop();for(var m=0,f=i;m!==f;++m){var v=r[m],g=v[c],y=v[d];v[h]=g,v[c]=y,v.pop()}}else{var x=--a,b=e[x];0<x&&(t[b.uuid]=h),e[h]=b,e.pop();for(var w,_=0,M=i;_!==M;++_)(w=r[_])[h]=w[x],w.pop()}}this.nCachedObjects_=n}subscribe_(e,t){var r=this._bindingsIndicesByPath,i=r[e],n=this._bindings;if(void 0!==i)return n[i];var a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,h=this.nCachedObjects_,c=Array(l);i=n.length,r[e]=i,a.push(e),s.push(t),n.push(c);for(var u,d=h,p=o.length;d!==p;++d)u=o[d],c[d]=new Dd(u,e,t);return c}unsubscribe_(e){var t=this._bindingsIndicesByPath,r=t[e];if(void 0!==r){var i=this._paths,n=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s];t[e[s]]=r,a[r]=o,a.pop(),n[r]=n[s],n.pop(),i[r]=i[s],i.pop()}}}Nd.prototype.isAnimationObjectGroup=!0;class Bd{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:t.blendMode;this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=i;for(var n,a=t.tracks,s=a.length,o=Array(s),l={endingStart:Wt,endingEnd:Wt},h=0;h!==s;++h)n=a[h].createInterpolant(null),o[h]=n,n.settings=l;this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Gt,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}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,r){if(e.fadeOut(t),this.fadeIn(t),r){var i=this._clip.duration,n=e._clip.duration,a=n/i,s=i/n;e.warp(1,a,t),this.warp(s,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}stopFading(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,r){var i=this._mixer,n=i.time,a=this.timeScale,s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);var o=s.parameterPositions,l=s.sampleValues;return o[0]=n,o[1]=n+r,l[0]=e/a,l[1]=t/a,this}stopWarping(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,r,i){if(this.enabled){var n=this._startTime;if(null!==n){var a=(e-n)*r;if(0>a||0===r)return;this._startTime=null,t=r*a}t*=this._updateTimeScale(e);var s=this._updateTime(t),o=this._updateWeight(e);if(0<o){var l=this._interpolants,h=this._propertyBindings;if(this.blendMode===Yt)for(var c=0,u=l.length;c!==u;++c)l[c].evaluate(s),h[c].accumulateAdditive(o);else for(var d=0,p=l.length;d!==p;++d)l[d].evaluate(s),h[d].accumulate(i,o)}}else this._updateWeight(e)}_updateWeight(e){var t=0;if(this.enabled){t=this.weight;var r=this._weightInterpolant;if(null!==r){var i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){var t=0;if(!this.paused){t=this.timeScale;var r=this._timeScaleInterpolant;null!==r&&(t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){var t=this._clip.duration,r=this.loop,i=this.time+e,n=this._loopCount,a=r===Vt;if(0===e)return-1===n?i:a&&1==(1&n)?t-i:i;if(r===Ft){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(0>i)){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:0>e?-1:1})}}else{if(-1===n&&(0<=e?(n=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=t||0>i){var s=Math.floor(i/t);i-=t*s,n+=Math.abs(s);var o=this.repetitions-n;if(0>=o)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=0<e?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<e?1:-1});else{if(1===o){var l=0>e;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=n,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:s})}}else this.time=i;if(a&&1==(1&n))return t-i}return i}_setEndings(e,t,r){var i=this._interpolantSettings;r?(i.endingStart=Zt,i.endingEnd=Zt):(i.endingStart=e?this.zeroSlopeAtStart?Zt:Wt:qt,i.endingEnd=t?this.zeroSlopeAtEnd?Zt:Wt:qt)}_scheduleFading(e,t,r){var i=this._mixer,n=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var s=a.parameterPositions,o=a.sampleValues;return s[0]=n,o[0]=t,s[1]=n+e,o[1]=r,this}}class Ud extends zr{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){var r=e._localRoot||this._root,i=e._clip.tracks,n=i.length,a=e._propertyBindings,s=e._interpolants,o=r.uuid,l=this._bindingsByRootAndName,h=l[o];void 0===h&&(h={},l[o]=h);for(var c=0;c!==n;++c){var u=i[c],d=u.name,p=h[d];if(void 0!==p)a[c]=p;else{if(void 0!==(p=a[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,o,d));continue}var m=t&&t._propertyBindings[c].binding.parsedPath;++(p=new Md(Dd.create(r,d,m),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(p,o,d),a[c]=p}s[c].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,r=e._clip.uuid,i=this._actionsByClip[r];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,r,t)}for(var n,a=e._propertyBindings,s=0,o=a.length;s!==o;++s)0==(n=a[s]).useCount++&&(this._lendBinding(n),n.saveOriginalState());this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){for(var t,r=e._propertyBindings,i=0,n=r.length;i!==n;++i)0==--(t=r[i]).useCount&&(t.restoreOriginalState(),this._takeBackBinding(t));this._takeBackAction(e)}}_initMemoryManager(){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(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,r){var i=this._actions,n=this._actionsByClip,a=n[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=a;else{var s=a.knownActions;e._byClipCacheIndex=s.length,s.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[r]=e}_removeInactiveAction(e){var t=this._actions,r=t[t.length-1],i=e._cacheIndex;r._cacheIndex=i,t[i]=r,t.pop(),e._cacheIndex=null;var n=e._clip.uuid,a=this._actionsByClip,s=a[n],o=s.knownActions,l=o[o.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,o[h]=l,o.pop(),e._byClipCacheIndex=null,delete s.actionByRoot[(e._localRoot||this._root).uuid],0===o.length&&delete a[n],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){for(var t,r=e._propertyBindings,i=0,n=r.length;i!==n;++i)0==--(t=r[i]).referenceCount&&this._removeInactiveBinding(t)}_lendAction(e){var t=this._actions,r=e._cacheIndex,i=this._nActiveActions++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_takeBackAction(e){var t=this._actions,r=e._cacheIndex,i=--this._nActiveActions,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_addInactiveBinding(e,t,r){var i=this._bindingsByRootAndName,n=this._bindings,a=i[t];void 0===a&&(a={},i[t]=a),a[r]=e,e._cacheIndex=n.length,n.push(e)}_removeInactiveBinding(e){var t=this._bindings,r=e.binding,i=r.rootNode.uuid,n=r.path,a=this._bindingsByRootAndName,s=a[i],o=t[t.length-1],l=e._cacheIndex;o._cacheIndex=l,t[l]=o,t.pop(),delete s[n],0===Object.keys(s).length&&delete a[i]}_lendBinding(e){var t=this._bindings,r=e._cacheIndex,i=this._nActiveBindings++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_takeBackBinding(e){var t=this._bindings,r=e._cacheIndex,i=--this._nActiveBindings,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_lendControlInterpolant(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return void 0===r&&((r=new Xc(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){var t=this._controlInterpolants,r=e.__cacheIndex,i=--this._nActiveControlInterpolants,n=t[i];e.__cacheIndex=i,t[i]=e,n.__cacheIndex=r,t[r]=n}clipAction(e,t,r){var i=t||this._root,n=i.uuid,a="string"==typeof e?nu.findByName(i,e):e,s=null===a?e:a.uuid,o=this._actionsByClip[s],l=null;if(void 0===r&&(r=null===a?Xt:a.blendMode),void 0!==o){var h=o.actionByRoot[n];if(void 0!==h&&h.blendMode===r)return h;l=o.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;var c=new Bd(this,a,t,r);return this._bindAction(c,l),this._addInactiveAction(c,s,n),c}existingAction(e,t){var r=t||this._root,i=r.uuid,n="string"==typeof e?nu.findByName(r,e):e,a=n?n.uuid:e,s=this._actionsByClip[a];return void 0===s?null:s.actionByRoot[i]||null}stopAllAction(){for(var e=this._actions,t=this._nActiveActions-1;0<=t;--t)e[t].stop();return this}update(e){e*=this.timeScale;for(var t=this._actions,r=this._nActiveActions,i=this.time+=e,n=Math.sign(e),a=this._accuIndex^=1,s=0;s!==r;++s)t[s]._update(i,e,n,a);for(var o=this._bindings,l=this._nActiveBindings,h=0;h!==l;++h)o[h].apply(a);return this}setTime(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){var t=this._actions,r=e.uuid,i=this._actionsByClip,n=i[r];if(void 0!==n){for(var a,s=n.knownActions,o=0,l=s.length;o!==l;++o){a=s[o],this._deactivateAction(a);var h=a._cacheIndex,c=t[t.length-1];a._cacheIndex=null,a._byClipCacheIndex=null,c._cacheIndex=h,t[h]=c,t.pop(),this._removeInactiveBindingsForAction(a)}delete i[r]}}uncacheRoot(e){var t=e.uuid,r=this._actionsByClip;for(var i in r){var n=r[i].actionByRoot[t];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var s in a){var o=a[s];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){var r=this.existingAction(e,t);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}}Ud.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class zd{constructor(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new zd(void 0===this.value.clone?this.value:this.value.clone())}}class Fd extends hl{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;super(e,t),this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){var t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){var t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}Fd.prototype.isInstancedInterleavedBuffer=!0;class Gd{constructor(e,t,r,i,n){this.buffer=e,this.type=t,this.itemSize=r,this.elementSize=i,this.count=n,this.version=0}set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}Gd.prototype.isGLBufferAttribute=!0;class Vd{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1/0;this.ray=new Gi(e,t),this.near=r,this.far=i,this.camera=null,this.layers=new Qi,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(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: "+t.type)}intersectObject(e){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return kd(e,this,t,!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1]),t.sort(Hd),t}intersectObjects(e){for(var t=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[],i=0,n=e.length;i<n;i++)kd(e[i],this,r,t);return r.sort(Hd),r}}function Hd(e,t){return e.distance-t.distance}function kd(e,t,r,i){if(e.layers.test(t.layers)&&e.raycast(t,r),!0===i)for(var n=e.children,a=0,s=n.length;a<s;a++)kd(n[a],t,r,!0)}class jd{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;return this.radius=e,this.phi=t,this.theta=r,this}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(Wr(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class Wd{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;return this.radius=e,this.theta=t,this.y=r,this}set(e,t,r){return this.radius=e,this.theta=t,this.y=r,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+r*r),this.theta=Math.atan2(e,r),this.y=t,this}clone(){return(new this.constructor).copy(this)}}var Zd=new $r;class qd{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new $r(1/0,1/0),t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r(-1/0,-1/0);this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){var r=Zd.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Zd.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}qd.prototype.isBox2=!0;var Xd=new ci,Yd=new ci;class Jd{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci;this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Xd.subVectors(e,this.start),Yd.subVectors(this.end,this.start);var r=Yd.dot(Yd),i=Yd.dot(Xd)/r;return t&&(i=Wr(i,0,1)),i}closestPointToPoint(e,t,r){var i=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}class Kd extends pn{constructor(e){super(),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}}Kd.prototype.isImmediateRenderObject=!0;var Qd=new ci;class $d extends pn{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var r=new na,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],n=0,a=1;n<32;n++,a++){var s=n/32*Math.PI*2,o=a/32*Math.PI*2;i.push(Math.cos(s),Math.sin(s),1,Math.cos(o),Math.sin(o),1)}r.setAttribute("position",new Zn(i,3));var l=new ql({fog:!1,toneMapped:!1});this.cone=new rh(r,l),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Qd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Qd),void 0===this.color?this.cone.material.color.copy(this.light.color):this.cone.material.color.set(this.color)}}var ep=new ci,tp=new Vi,rp=new Vi;class ip extends rh{constructor(e){for(var t,r=np(e),i=new na,n=[],a=[],s=new On(0,0,1),o=new On(0,1,0),l=0;l<r.length;l++)(t=r[l]).parent&&t.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),a.push(s.r,s.g,s.b),a.push(o.r,o.g,o.b));i.setAttribute("position",new Zn(n,3)),i.setAttribute("color",new Zn(a,3)),super(i,new ql({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=r,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){var t=this.bones,r=this.geometry,i=r.getAttribute("position");rp.copy(this.root.matrixWorld).invert();for(var n,a=0,s=0;a<t.length;a++)(n=t[a]).parent&&n.parent.isBone&&(tp.multiplyMatrices(rp,n.matrixWorld),ep.setFromMatrixPosition(tp),i.setXYZ(s,ep.x,ep.y,ep.z),tp.multiplyMatrices(rp,n.parent.matrixWorld),ep.setFromMatrixPosition(tp),i.setXYZ(s+1,ep.x,ep.y,ep.z),s+=2);r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function np(e){var t=[];e&&e.isBone&&t.push(e);for(var r=0;r<e.children.length;r++)t.push.apply(t,np(e.children[r]));return t}class ap extends _a{constructor(e,t,r){super(new Ec(t,4,2),new Dn({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.light.updateMatrixWorld(),this.color=r,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){void 0===this.color?this.material.color.copy(this.light.color):this.material.color.set(this.color)}}var sp=new ci,op=new On,lp=new On;class hp extends pn{constructor(e,t,r){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r;var i=new _c(t);i.rotateY(.5*Math.PI),this.material=new Dn({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);var n=i.getAttribute("position"),a=new Float32Array(3*n.count);i.setAttribute("color",new Un(a,3)),this.add(new _a(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");op.copy(this.light.color),lp.copy(this.light.groundColor);for(var r,i=0,n=t.count;i<n;i++)r=i<n/2?op:lp,t.setXYZ(i,r.r,r.g,r.b);t.needsUpdate=!0}e.lookAt(sp.setFromMatrixPosition(this.light.matrixWorld).negate())}}class cp extends rh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:10,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:10,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:4473924,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:8947848;r=new On(r),i=new On(i);for(var n=t/2,a=e/t,s=e/2,o=[],l=[],h=0,c=0,u=-s;h<=t;h++,u+=a){o.push(-s,0,u,s,0,u),o.push(u,0,-s,u,0,s);var d=h===n?r:i;d.toArray(l,c),c+=3,d.toArray(l,c),c+=3,d.toArray(l,c),c+=3,d.toArray(l,c),c+=3}var p=new na;p.setAttribute("position",new Zn(o,3)),p.setAttribute("color",new Zn(l,3)),super(p,new ql({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}class up extends rh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:10,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:16,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:8,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:64,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:4473924,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:8947848;n=new On(n),a=new On(a);for(var s=[],o=[],l=0;l<=t;l++){var h=l/t*(2*Math.PI),c=Math.sin(h)*e,u=Math.cos(h)*e;s.push(0,0,0),s.push(c,0,u);var d=1&l?n:a;o.push(d.r,d.g,d.b),o.push(d.r,d.g,d.b)}for(var p=0;p<=r;p++)for(var m=1&p?n:a,f=e-e/r*p,v=0;v<i;v++){var g=v/i*(2*Math.PI),y=Math.sin(g)*f,x=Math.cos(g)*f;s.push(y,0,x),o.push(m.r,m.g,m.b),g=(v+1)/i*(2*Math.PI),y=Math.sin(g)*f,x=Math.cos(g)*f,s.push(y,0,x),o.push(m.r,m.g,m.b)}var b=new na;b.setAttribute("position",new Zn(s,3)),b.setAttribute("color",new Zn(o,3)),super(b,new ql({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}}var dp=new ci,pp=new ci,mp=new ci;class fp extends pn{constructor(e,t,r){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,void 0===t&&(t=1);var i=new na;i.setAttribute("position",new Zn([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var n=new ql({fog:!1,toneMapped:!1});this.lightPlane=new $l(i,n),this.add(this.lightPlane),(i=new na).setAttribute("position",new Zn([0,0,0,0,0,1],3)),this.targetLine=new $l(i,n),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){dp.setFromMatrixPosition(this.light.matrixWorld),pp.setFromMatrixPosition(this.light.target.matrixWorld),mp.subVectors(pp,dp),this.lightPlane.lookAt(pp),void 0===this.color?(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)):(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)),this.targetLine.lookAt(pp),this.targetLine.scale.z=mp.length()}}var vp=new ci,gp=new Ra;class yp extends rh{constructor(e){function t(e,t,i){r(e,i),r(t,i)}function r(e,t){a.push(0,0,0),s.push(t.r,t.g,t.b),void 0===o[e]&&(o[e]=[]),o[e].push(a.length/3-1)}var i=new na,n=new ql({color:16777215,vertexColors:!0,toneMapped:!1}),a=[],s=[],o={},l=new On(16755200),h=new On(16711680),c=new On(43775),u=new On(16777215),d=new On(3355443);t("n1","n2",l),t("n2","n4",l),t("n4","n3",l),t("n3","n1",l),t("f1","f2",l),t("f2","f4",l),t("f4","f3",l),t("f3","f1",l),t("n1","f1",l),t("n2","f2",l),t("n3","f3",l),t("n4","f4",l),t("p","n1",h),t("p","n2",h),t("p","n3",h),t("p","n4",h),t("u1","u2",c),t("u2","u3",c),t("u3","u1",c),t("c","t",u),t("p","c",d),t("cn1","cn2",d),t("cn3","cn4",d),t("cf1","cf2",d),t("cf3","cf4",d),i.setAttribute("position",new Zn(a,3)),i.setAttribute("color",new Zn(s,3)),super(i,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){var e=this.geometry,t=this.pointMap;gp.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),xp("c",t,e,gp,0,0,-1),xp("t",t,e,gp,0,0,1),xp("n1",t,e,gp,-1,-1,-1),xp("n2",t,e,gp,1,-1,-1),xp("n3",t,e,gp,-1,1,-1),xp("n4",t,e,gp,1,1,-1),xp("f1",t,e,gp,-1,-1,1),xp("f2",t,e,gp,1,-1,1),xp("f3",t,e,gp,-1,1,1),xp("f4",t,e,gp,1,1,1),xp("u1",t,e,gp,.7,1.1,-1),xp("u2",t,e,gp,-.7,1.1,-1),xp("u3",t,e,gp,0,2,-1),xp("cf1",t,e,gp,-1,0,1),xp("cf2",t,e,gp,1,0,1),xp("cf3",t,e,gp,0,-1,1),xp("cf4",t,e,gp,0,1,1),xp("cn1",t,e,gp,-1,0,-1),xp("cn2",t,e,gp,1,0,-1),xp("cn3",t,e,gp,0,-1,-1),xp("cn4",t,e,gp,0,1,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function xp(e,t,r,i,n,a,s){vp.set(n,a,s).unproject(i);var o=t[e];if(void 0!==o)for(var l=r.getAttribute("position"),h=0,c=o.length;h<c;h++)l.setXYZ(o[h],vp.x,vp.y,vp.z)}var bp=new pi;class wp extends rh{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:16776960,r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),n=new na;n.setIndex(new Un(r,1)),n.setAttribute("position",new Un(i,3)),super(n,new ql({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&bp.setFromObject(this.object),!bp.isEmpty()){var t=bp.min,r=bp.max,i=this.geometry.attributes.position,n=i.array;n[0]=r.x,n[1]=r.y,n[2]=r.z,n[3]=t.x,n[4]=r.y,n[5]=r.z,n[6]=t.x,n[7]=t.y,n[8]=r.z,n[9]=r.x,n[10]=t.y,n[11]=r.z,n[12]=r.x,n[13]=r.y,n[14]=t.z,n[15]=t.x,n[16]=r.y,n[17]=t.z,n[18]=t.x,n[19]=t.y,n[20]=t.z,n[21]=r.x,n[22]=t.y,n[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}}setFromObject(e){return this.object=e,this.update(),this}copy(e){return rh.prototype.copy.call(this,e),this.object=e.object,this}}class _p extends rh{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:16776960,r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new na;i.setIndex(new Un(r,1)),i.setAttribute("position",new Zn([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new ql({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}}class Mp extends $l{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:16776960,i=new na;i.setAttribute("position",new Zn([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),i.computeBoundingSphere(),super(i,new ql({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;var n=new na;n.setAttribute("position",new Zn([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),n.computeBoundingSphere(),this.add(new _a(n,new Dn({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){var t=-this.plane.constant;1e-8>Math.abs(t)&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=0>t?y:g,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}}var Sp,Tp,Ep=new ci;class Ap extends pn{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci(0,0,1),t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci(0,0,0),r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:16776960,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:.2*r,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:.2*n;super(),this.type="ArrowHelper",void 0===Sp&&((Sp=new na).setAttribute("position",new Zn([0,0,0,0,1,0],3)),(Tp=new vh(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new $l(Sp,new ql({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new _a(Tp,new Dn({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,n,a)}setDirection(e){if(.99999<e.y)this.quaternion.set(0,0,0,1);else if(-.99999>e.y)this.quaternion.set(1,0,0,0);else{Ep.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Ep,t)}}setLength(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:.2*e,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.2*t;this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}class Lp extends rh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=new na;r.setAttribute("position",new Zn(t,3)),r.setAttribute("color",new Zn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(r,new ql({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,r){var i=new On,n=this.geometry.attributes.color.array;return i.set(e),i.toArray(n,0),i.toArray(n,3),i.set(t),i.toArray(n,6),i.toArray(n,9),i.set(r),i.toArray(n,12),i.toArray(n,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}var Rp=new Float32Array(1),Cp=new Int32Array(Rp.buffer);class Pp{static toHalfFloat(e){Rp[0]=e;var t=Cp[0],r=32768&t>>16,i=2047&t>>12,n=255&t>>23;return 103>n?r:142<n?(r|=31744,r|=(255==n?0:1)&&8388607&t):113>n?r|=((i|=2048)>>114-n)+(1&i>>113-n):(r|=n-112<<10|i>>1,r+=1&i)}}var Ip=Math.pow(2,8),Op=[.125,.215,.35,.446,.526,.582],Dp=5+Op.length,Np={[$t]:0,[er]:1,[rr]:2,[nr]:3,[ar]:4,[sr]:5,[tr]:6},Bp=new Dn({side:y,depthWrite:!1,depthTest:!1}),Up=new _a(new Sa,Bp),zp=new Du,{_lodPlanes:Fp,_sizeLods:Gp,_sigmas:Vp}=Jp(),Hp=new On,kp=null,jp=(1+Math.sqrt(5))/2,Wp=1/jp,Zp=[new ci(1,1,1),new ci(-1,1,1),new ci(1,1,-1),new ci(-1,1,-1),new ci(0,jp,Wp),new ci(0,jp,-Wp),new ci(Wp,0,jp),new ci(-Wp,0,jp),new ci(jp,Wp,0),new ci(-jp,Wp,0)];function qp(e){var t=Math.max(e.r,e.g,e.b),r=Math.min(Math.max(Math.ceil(Math.log2(t)),-128),127);return e.multiplyScalar(Math.pow(2,-r)),(r+128)/255}class Xp{constructor(e){var t,r;this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=(20,t=new Float32Array(20),r=new ci(0,1,0),new Nc({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r},inputEncoding:{value:Np[$t]},outputEncoding:{value:Np[$t]}},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:_,depthTest:!1,depthWrite:!1})),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:100;kp=this._renderer.getRenderTarget();var n=this._allocateTargets();return this._sceneToCubeUV(e,r,i,n),0<t&&this._blur(n,0,0,t),this._applyPMREM(n),this._cleanup(n),n}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=em(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=$p(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(var e=0;e<Fp.length;e++)Fp[e].dispose()}_cleanup(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(kp),e.scissorTest=!1,Qp(e,0,0,e.width,e.height)}_fromTexture(e){kp=this._renderer.getRenderTarget();var t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t}_allocateTargets(e){var t={magFilter:ge,minFilter:ge,generateMipmaps:!1,type:Ae,format:je,encoding:Yp(e)?e.encoding:rr,depthBuffer:!1},r=Kp(t);return r.depthBuffer=!e,this._pingPongRenderTarget=Kp(t),r}_compileMaterial(e){var t=new _a(Fp[0],e);this._renderer.compile(t,zp)}_sceneToCubeUV(e,t,r,i){var n=new Ca(90,1,t,r),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,h=o.outputEncoding,c=o.toneMapping;o.getClearColor(Hp),o.toneMapping=te,o.outputEncoding=$t,o.autoClear=!1;var u=!1,d=e.background;if(d){if(d.isColor){Bp.color.copy(d).convertSRGBToLinear(),e.background=null;var p=qp(Bp.color);Bp.opacity=p,u=!0}}else{Bp.color.copy(Hp).convertSRGBToLinear();var m=qp(Bp.color);Bp.opacity=m,u=!0}for(var f,v=0;6>v;v++)0==(f=v%3)?(n.up.set(0,a[v],0),n.lookAt(s[v],0,0)):1==f?(n.up.set(0,0,a[v]),n.lookAt(0,s[v],0)):(n.up.set(0,a[v],0),n.lookAt(0,0,s[v])),Qp(i,f*Ip,2<v?Ip:0,Ip,Ip),o.setRenderTarget(i),u&&o.render(Up,n),o.render(e,n);o.toneMapping=c,o.outputEncoding=h,o.autoClear=l}_textureToCubeUV(e,t){var r=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=em()):null==this._equirectShader&&(this._equirectShader=$p());var i=e.isCubeTexture?this._cubemapShader:this._equirectShader,n=new _a(Fp[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=Np[e.encoding],a.outputEncoding.value=Np[t.texture.encoding],Qp(t,0,0,3*Ip,2*Ip),r.setRenderTarget(t),r.render(n,zp)}_applyPMREM(e){var t=this._renderer,r=t.autoClear;t.autoClear=!1;for(var i=1;i<Dp;i++){var n=Math.sqrt(Vp[i]*Vp[i]-Vp[i-1]*Vp[i-1]),a=Zp[(i-1)%Zp.length];this._blur(e,i-1,i,n,a)}t.autoClear=r}_blur(e,t,r,i,n){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,r,i,"latitudinal",n),this._halfBlur(a,e,r,r,i,"longitudinal",n)}_halfBlur(e,t,r,i,n,a,s){var o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var h=new _a(Fp[i],l),c=l.uniforms,u=Gp[r]-1,d=isFinite(n)?Math.PI/(2*u):2*Math.PI/39,p=n/d,m=isFinite(n)?1+Math.floor(3*p):20;m>20&&console.warn("sigmaRadians, ".concat(n,", is too large and will clip, as it requested ").concat(m," samples when the maximum is set to ").concat(20));for(var f=[],v=0,g=0;g<20;++g){var y=g/p,x=Math.exp(-y*y/2);f.push(x),0==g?v+=x:g<m&&(v+=2*x)}for(var b=0;b<f.length;b++)f[b]/=v;c.envMap.value=e.texture,c.samples.value=m,c.weights.value=f,c.latitudinal.value="latitudinal"===a,s&&(c.poleAxis.value=s),c.dTheta.value=d,c.mipInt.value=8-r,c.inputEncoding.value=Np[e.texture.encoding],c.outputEncoding.value=Np[e.texture.encoding];var w=Gp[i];Qp(t,3*Math.max(0,Ip-2*w),(0===i?0:2*Ip)+2*w*(i>4?i-8+4:0),3*w,2*w),o.setRenderTarget(t),o.render(h,zp)}}function Yp(e){return void 0!==e&&e.type===Ae&&(e.encoding===$t||e.encoding===er||e.encoding===tr)}function Jp(){for(var e,t=[],r=[],i=[],n=8,a=0;a<Dp;a++){e=Math.pow(2,n),r.push(e);var s=1/e;a>4?s=Op[a-8+4-1]:0==a&&(s=0),i.push(s);for(var o=1/(e-1),l=-o/2,h=1+o/2,c=[l,l,h,l,h,h,l,l,h,h,l,h],u=new Float32Array(108),d=new Float32Array(72),p=new Float32Array(36),m=0;m<6;m++){var f=m%3*2/3-1,v=2<m?0:-1,g=[f,v,0,f+2/3,v,0,f+2/3,v+1,0,f,v,0,f+2/3,v+1,0,f,v+1,0];u.set(g,18*m),d.set(c,12*m);var y=[m,m,m,m,m,m];p.set(y,6*m)}var x=new na;x.setAttribute("position",new Un(u,3)),x.setAttribute("uv",new Un(d,2)),x.setAttribute("faceIndex",new Un(p,1)),t.push(x),n>4&&n--}return{_lodPlanes:t,_sizeLods:r,_sigmas:i}}function Kp(e){var t=new si(3*Ip,3*Ip,e);return t.texture.mapping=de,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function Qp(e,t,r,i,n){e.viewport.set(t,r,i,n),e.scissor.set(t,r,i,n)}function $p(){var e=new $r(1,1);return new Nc({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:e},inputEncoding:{value:Np[$t]},outputEncoding:{value:Np[$t]}},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:_,depthTest:!1,depthWrite:!1})}function em(){return new Nc({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Np[$t]},outputEncoding:{value:Np[$t]}},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:_,depthTest:!1,depthWrite:!1})}var tm=0,rm=1,im=0,nm=1,am=2;function sm(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function om(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}function lm(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new hh(e,t)}function hm(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new El(e)}function cm(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new hh(e,t)}function um(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new nh(e)}function dm(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new nh(e)}function pm(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new nh(e)}function mm(e,t,r){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new ci(e,t,r)}function fm(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Un(e,t).setUsage(Lr)}function vm(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new zn(e,t)}function gm(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Fn(e,t)}function ym(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Gn(e,t)}function xm(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Vn(e,t)}function bm(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Hn(e,t)}function wm(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new kn(e,t)}function _m(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new jn(e,t)}function Mm(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Zn(e,t)}function Sm(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new qn(e,t)}function Tm(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Lp(e)}function Em(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new wp(e,t)}function Am(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new rh(new Sh(e.geometry),new ql({color:void 0===t?16777215:t}))}function Lm(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new rh(new Ic(e.geometry),new ql({color:void 0===t?16777215:t}))}function Rm(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new uu(e)}function Cm(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new vu(e)}function Pm(e,t,r){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Da(e,r)}function Im(){console.error("THREE.CanvasRenderer has been removed")}function Om(){console.error("THREE.JSONLoader has been removed.")}Th.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Th.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},xu.prototype.fromPoints=function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)},cp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},ip.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},hu.prototype.extractUrlBase=function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Hu.extractUrlBase(e)},hu.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.")}},qd.prototype.center=function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},qd.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},qd.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},qd.prototype.size=function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)},pi.prototype.center=function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},pi.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},pi.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},pi.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},pi.prototype.size=function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)},Ii.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Va.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},Jd.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},ei.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},ei.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},ei.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},ei.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},ei.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},ei.prototype.getInverse=function(e){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Vi.prototype.extractPosition=function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},Vi.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Vi.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new ci).setFromMatrixColumn(this,3)},Vi.prototype.setRotationFromQuaternion=function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},Vi.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Vi.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Vi.prototype.multiplyVector4=function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Vi.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Vi.prototype.rotateAxis=function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},Vi.prototype.crossVector=function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Vi.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Vi.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Vi.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Vi.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Vi.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Vi.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Vi.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Vi.prototype.makeFrustum=function(e,t,r,i,n,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,r,n,a)},Vi.prototype.getInverse=function(e){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},za.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},hi.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},hi.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Gi.prototype.isIntersectionBox=function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Gi.prototype.isIntersectionPlane=function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},Gi.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},Sn.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Sn.prototype.barycoordFromPoint=function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},Sn.prototype.midpoint=function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},Sn.prototypenormal=function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},Sn.prototype.plane=function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)},Sn.barycoordFromPoint=function(e,t,r,i,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Sn.getBarycoord(e,t,r,i,n)},Sn.normal=function(e,t,r,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Sn.getNormal(e,t,r,i)},bu.prototype.extractAllPoints=function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},bu.prototype.extrude=function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new yc(this,e)},bu.prototype.makeGeometry=function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Tc(this,e)},$r.prototype.fromAttribute=function(e,t,r){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,r)},$r.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},$r.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ci.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},ci.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},ci.prototype.getPositionFromMatrix=function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},ci.prototype.getScaleFromMatrix=function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},ci.prototype.getColumnFromMatrix=function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},ci.prototype.applyProjection=function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},ci.prototype.fromAttribute=function(e,t,r){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,r)},ci.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},ci.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ai.prototype.fromAttribute=function(e,t,r){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,r)},ai.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},pn.prototype.getChildByName=function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},pn.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},pn.prototype.translate=function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},pn.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},pn.prototype.applyMatrix=function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(pn.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.")}}}),_a.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(_a.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Jt},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.")}}}),Bl.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Ca.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(wu.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(Un.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Lr},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Lr)}}}),Un.prototype.setDynamic=function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Lr:Ar),this},Un.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Un.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},na.prototype.addIndex=function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},na.prototype.addAttribute=function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new Un(arguments[1],arguments[2])))},na.prototype.addDrawCall=function(e,t,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},na.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},na.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},na.prototype.removeAttribute=function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},na.prototype.applyMatrix=function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(na.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}}}),hl.prototype.setDynamic=function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Lr:Ar),this},hl.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},yc.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},yc.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},yc.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},ll.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},zd.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(En.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new On}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===b}},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(La.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}}}),nl.prototype.clearTarget=function(e,t,r,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,r,i)},nl.prototype.animate=function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},nl.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},nl.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},nl.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},nl.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},nl.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},nl.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},nl.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},nl.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},nl.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},nl.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},nl.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},nl.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},nl.prototype.enableScissorTest=function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},nl.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},nl.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},nl.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},nl.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},nl.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},nl.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},nl.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},nl.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},nl.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},nl.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(nl.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?er:$t}},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(Xo.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(si.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}}}),vd.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new id).load(e,(function(e){t.setBuffer(e)})),this},_d.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Ia.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},Ia.prototype.clear=function(e,t,r,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,r,i)},ti.crossOrigin=void 0,ti.loadTexture=function(e,t,r,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var n=new gu;n.setCrossOrigin(this.crossOrigin);var a=n.load(e,r,void 0,i);return t&&(a.mapping=t),a},ti.loadTextureCube=function(e,t,r,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var n=new fu;n.setCrossOrigin(this.crossOrigin);var a=n.load(e,r,void 0,i);return t&&(a.mapping=t),a},ti.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},ti.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Dm={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function Nm(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:s}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=s)},6550:function(e,t,r){(function(e){var t=function(){try{return!!Symbol.iterator}catch(e){return!1}}(),r=function(e){var r={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t&&(r[Symbol.iterator]=function(){return r}),r},i=function(e){return encodeURIComponent(e).replace(/%20/g,"+")},n=function(e){return decodeURIComponent((e+"").replace(/\+/g," "))};(function(){try{var t=e.URLSearchParams;return"a=1"===new t("?a=1").toString()&&"function"==typeof t.prototype.set&&"function"==typeof t.prototype.entries}catch(e){return!1}})()||function(){var n=function(e){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var t=typeof e;if("undefined"==t);else if("string"===t)""!=e&&this._fromString(e);else if(e instanceof n){var r=this;e.forEach((function(e,t){r.append(t,e)}))}else{if(null===e||"object"!==t)throw new TypeError("Unsupported input's type for URLSearchParams");if("[object Array]"===Object.prototype.toString.call(e))for(var i,a=0;a<e.length;a++){if(i=e[a],"[object Array]"!==Object.prototype.toString.call(i)&&2===i.length)throw new TypeError("Expected [string, any] as entry at index "+a+" of URLSearchParams's input");this.append(i[0],i[1])}else for(var s in e)e.hasOwnProperty(s)&&this.append(s,e[s])}},a=n.prototype;a.append=function(e,t){e in this._entries?this._entries[e].push(t+""):this._entries[e]=[t+""]},a.delete=function(e){delete this._entries[e]},a.get=function(e){return e in this._entries?this._entries[e][0]:null},a.getAll=function(e){return e in this._entries?this._entries[e].slice(0):[]},a.has=function(e){return e in this._entries},a.set=function(e,t){this._entries[e]=[t+""]},a.forEach=function(e,t){var r;for(var i in this._entries)if(this._entries.hasOwnProperty(i)){r=this._entries[i];for(var n=0;n<r.length;n++)e.call(t,r[n],i,this)}},a.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),r(e)},a.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),r(e)},a.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),r(e)},t&&(a[Symbol.iterator]=a.entries),a.toString=function(){var e=[];return this.forEach((function(t,r){e.push(i(r)+"="+i(t))})),e.join("&")},e.URLSearchParams=n}();var a=e.URLSearchParams.prototype;"function"!=typeof a.sort&&(a.sort=function(){var e=this,t=[];this.forEach((function(r,i){t.push([i,r]),e._entries||e.delete(i)})),t.sort((function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:0})),e._entries&&(e._entries={});for(var r=0;r<t.length;r++)this.append(t[r][0],t[r][1])}),"function"!=typeof a._fromString&&Object.defineProperty(a,"_fromString",{enumerable:!1,configurable:!1,writable:!1,value:function(e){if(this._entries)this._entries={};else{var t=[];this.forEach((function(e,r){t.push(r)}));for(var r=0;r<t.length;r++)this.delete(t[r])}var i,a=(e=e.replace(/^\?/,"")).split("&");for(r=0;r<a.length;r++)i=a[r].split("="),this.append(n(i[0]),1<i.length?n(i[1]):"")}})})(void 0===r.g?"undefined"==typeof window?"undefined"==typeof self?this:self:window:r.g),function(e){if(function(){try{var t=new e.URL("b","http://a");return t.pathname="c d","http://a/c%20d"===t.href&&t.searchParams}catch(e){return!1}}()||function(){var t=e.URL,r=function(t,r){"string"!=typeof t&&(t+=""),r&&"string"!=typeof r&&(r+="");var i,n=document;if(r&&(void 0===e.location||r!==e.location.href)){r=r.toLowerCase(),(i=(n=document.implementation.createHTMLDocument("")).createElement("base")).href=r,n.head.appendChild(i);try{if(0!==i.href.indexOf(r))throw new Error(i.href)}catch(e){throw new Error("URL unable to set base "+r+" due to "+e)}}var a=n.createElement("a");a.href=t,i&&(n.body.appendChild(a),a.href=a.href);var s=n.createElement("input");if(s.type="url",s.value=t,":"===a.protocol||!/:/.test(a.href)||!s.checkValidity()&&!r)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:a});var o,l=new e.URLSearchParams(this.search),h=!0,c=!0,u=this;["append","delete","set"].forEach((function(e){var t=l[e];l[e]=function(){t.apply(l,arguments),h&&(c=!1,u.search=l.toString(),c=!0)}})),Object.defineProperty(this,"searchParams",{value:l,enumerable:!0}),Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==o&&(o=this.search,c&&(h=!1,this.searchParams._fromString(this.search),h=!0))}})},i=r.prototype;["hash","host","hostname","port","protocol"].forEach((function(e){!function(e){Object.defineProperty(i,e,{get:function(){return this._anchorElement[e]},set:function(t){this._anchorElement[e]=t},enumerable:!0})}(e)})),Object.defineProperty(i,"search",{get:function(){return this._anchorElement.search},set:function(e){this._anchorElement.search=e,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(i,{toString:{get:function(){var e=this;return function(){return e.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(e){this._anchorElement.href=e,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(e){this._anchorElement.pathname=e},enumerable:!0},origin:{get:function(){var e={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],t=this._anchorElement.port!=e&&""!==this._anchorElement.port;return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(t?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(){},enumerable:!0},username:{get:function(){return""},set:function(){},enumerable:!0}}),r.createObjectURL=function(){return t.createObjectURL.apply(t,arguments)},r.revokeObjectURL=function(){return t.revokeObjectURL.apply(t,arguments)},e.URL=r}(),void 0!==e.location&&!("origin"in e.location)){var t=function(){return e.location.protocol+"//"+e.location.hostname+(e.location.port?":"+e.location.port:"")};try{Object.defineProperty(e.location,"origin",{get:t,enumerable:!0})}catch(r){setInterval((function(){e.location.origin=t()}),100)}}}(void 0===r.g?"undefined"==typeof window?"undefined"==typeof self?this:self:window:r.g)},3515:(e,t,r)=>{function i(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t.oe=function(e){throw console.error(e),e};var i=t(t.s=ENTRY_MODULE);return i.default||i}var n="[\\.|\\-|\\+|\\w|/|@]+",a="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+n+").*?\\)";function s(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function o(e,t,i){var o={};o[i]=[];var l,h=t.toString(),c=h.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!c)return o;for(var u,d=c[1],p=new RegExp("(\\\\n|\\W)"+s(d)+a,"g");u=p.exec(h);)"dll-reference"!==u[3]&&o[i].push(u[3]);for(p=new RegExp("\\("+s(d)+'\\("(dll-reference\\s('+n+'))"\\)\\)'+a,"g");u=p.exec(h);)e[u[2]]||(o[i].push(u[1]),e[u[2]]=r(u[1]).m),o[u[2]]=o[u[2]]||[],o[u[2]].push(u[4]);for(var m=Object.keys(o),f=0;f<m.length;f++)for(var v=0;v<o[m[f]].length;v++)l=o[m[f]][v],!isNaN(1*l)&&(o[m[f]][v]=1*o[m[f]][v]);return o}function l(e){return Object.keys(e).reduce((function(t,r){return t||0<e[r].length}),!1)}e.exports=function(e,t){t=t||{};var n={main:r.m},a=t.all?{main:Object.keys(n.main)}:function(e,t){for(var r={main:[t]},i={main:[]},n={main:{}};l(r);)for(var a=Object.keys(r),s=0;s<a.length;s++){var h=a[s],c=r[h].pop();if(n[h]=n[h]||{},!n[h][c]&&e[h][c]){n[h][c]=!0,i[h]=i[h]||[],i[h].push(c);for(var u=o(e,e[h][c],h),d=Object.keys(u),p=0;p<d.length;p++)r[d[p]]=r[d[p]]||[],r[d[p]]=r[d[p]].concat(u[d[p]])}}return i}(n,e),s="";Object.keys(a).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;a[e][t];)t++;a[e].push(t),n[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",s=s+"var "+e+" = ("+i.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+a[e].map((function(t){return JSON.stringify(t)+": "+n[e][t].toString()})).join(",")+"});\n"})),s=s+"new (("+i.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+a.main.map((function(e){return JSON.stringify(e)+": "+n.main[e].toString()})).join(",")+"}))(self);";var h=new window.Blob([s],{type:"text/javascript"});if(t.bare)return h;var c=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(h),u=new window.Worker(c);return u.objectURL=c,u}},701:(e,t,r)=>{var i,n,a,s,o,l,h,c,u=r(1515),d=r(2515).resolveURL,p=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];var e=this;this.setFromObject=t=>{var{nearPlane:r,farPlane:i,eyePosition:n,targetPosition:a,upVector:s}=t;e.nearPlane=r,e.farPlane=i,e.eyePosition=n,e.targetPosition=a,e.upVector=s}},m=function(e,t,r,i){var n=e.eyePosition,a=e.targetPosition,s=e.upVector,o=t.eyePosition,l=t.targetPosition,h=t.upVector,c=r,u=i,d=0,p=!1;c.near=Math.min(e.nearPlane,t.nearPlane),c.far=Math.max(e.farPlane,t.farPlane),c.cameraObject.up.set(t.upVector[0],t.upVector[1],t.upVector[2]),this.setDuration=e=>{u=e},this.update=e=>{!1===this.enabled||((e=>{var t=d+e;t>u&&(t=u),d=t})(e),(()=>{var e=d/u,t=[n[0]*(1-e)+o[0]*e,n[1]*(1-e)+o[1]*e,n[2]*(1-e)+o[2]*e],r=[a[0]*(1-e)+l[0]*e,a[1]*(1-e)+l[1]*e,a[2]*(1-e)+l[2]*e];s[0],h[0],s[1],h[1],s[2],h[2],c.cameraObject.position.set(t[0],t[1],t[2]),c.cameraObject.target.set(r[0],r[1],r[2])})(),d==u&&(p=!0))},this.isTransitionCompleted=()=>p},f=function(e,t,r,i){var n=e,a=t,s=r,o=i,l=0,h=!1;this.setDuration=e=>{o=e},this.update=e=>{!1===this.enabled||((e=>{var t=l,r=l+e;r>o&&(r=o);var i=((l=r)-t)/o*a;s.rotateAboutLookAtpoint(n,i)})(e),l==o&&(h=!0))},this.isTransitionCompleted=()=>h},v=function(e,t,r,i,n){var a=e,s=t,o=n,l=r,h=i,c=new u.Raycaster;c.params.Line.threshold=.1,c.params.Points.threshold=1;var d=new u.Vector2,p=!1,m=new Date,f=!1,v=0,g=[],y={zincCamera:void 0,x:-1,y:-1},x=void 0;this.enable=()=>{enable=!0},this.disable=()=>{enable=!1},this.getIntersectsObject=e=>{if(s!==a){var t=a.getThreeJSScene();o.render(t,e.cameraObject)}var r=x||a.getPickableThreeJSObjects();return g.length=0,c.intersectObjects(r,!0,g)},this.setPickableObjects=e=>{void 0===e?x=void 0:(x=[],e.forEach((e=>{e.getGroup()&&e.getGroup().visible&&x.push(e.getGroup())})))},this.getIntersectsObjectWithOrigin=(e,t,r)=>(c.set(t,r),this.getIntersectsObject(e)),this.getIntersectsObjectWithCamera=(e,t,r)=>(e.getNDCFromDocumentCoords(t,r,d),c.setFromCamera(d,e.cameraObject),this.getIntersectsObject(e)),this.pick=(e,t,r)=>{if(o&&a&&e&&l){this.getIntersectsObjectWithCamera(e,t,r);for(var i,n=g.length,s=0;s<n;s++)if((i=g[s].object?g[s].object.userData:void 0)&&i.isMarkerCluster&&i.visible&&i.clusterIsVisible(g[s].object.clusterIndex)&&i.zoomToCluster(g[s].object.clusterIndex))return;l(g,t,r)}};var b=(e,t,r)=>{if(o&&a&&e&&h){if(this.getIntersectsObjectWithCamera(e,t,r),m.setTime(Date.now()),0===g.length){if(f)return;f=!0}else f=!1;h(g,t,r)}};this.move=(e,t,r)=>{o&&a&&e&&h&&(a.displayMarkers?b(e,t,r):(y.zincCamera=e,y.x=t,y.y=r,!p&&(250<=(v=m?Date.now()-m.getTime():250)?b(e,t,r):(p=!0,setTimeout(w(y),v)))))};var w=e=>function(){p=!1,b(e.zincCamera,e.x,e.y)}},g=function(e,t,r,i){var n=new u.Vector3,a=-t,s=i,o=e;this.stopOnCameraInput=r,this.requireUpdate=!0;var l=new u.Vector3,h=new u.Vector3;this.update=e=>{!1===this.enabled||(this.requireUpdate&&((e=>{var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]),r=.25*(4*Math.abs(e[0])+4*Math.abs(e[1])),i=-e[1]/t,a=e[0]/t,o=i*e[0]+a*-e[1];o>r?o=r:o<-r&&(o=-r);var c=Math.acos(o/r)-.5*Math.PI;n.copy(s.cameraObject.position).sub(s.cameraObject.target).normalize(),l.copy(s.cameraObject.up).normalize(),h.crossVectors(l,n).normalize().multiplyScalar(i),l.multiplyScalar(a),l.add(h).multiplyScalar(Math.cos(c)),n.multiplyScalar(Math.sin(c)).add(l)})(o),this.requireUpdate=!1),s.rotateAboutLookAtpoint(n,a*e/1e3))}},y=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new u.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new u.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1};Object.assign(y.prototype,{update:(h=new u.Matrix4,c=new u.Matrix4,function(e){if(i!==e.focus||n!==e.fov||a!==e.aspect*this.aspect||s!==e.near||o!==e.far||l!==e.zoom){i=e.focus,n=e.fov,a=e.aspect*this.aspect,s=e.near,o=e.far,l=e.zoom;var t,r,d=e.projectionMatrix.clone(),p=.032*s/i,m=s*Math.tan(u.Math.DEG2RAD*n*.5)/e.zoom;c.elements[12]=-.032,h.elements[12]=.032,t=-m*a+p,r=m*a+p,d.elements[0]=2*s/(r-t),d.elements[8]=(r+t)/(r-t),this.cameraL.projectionMatrix.copy(d),t=-m*a-p,r=m*a-p,d.elements[0]=2*s/(r-t),d.elements[8]=(r+t)/(r-t),this.cameraR.projectionMatrix.copy(d)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(c),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(h)})});var x=function(e){var t=this;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;var r,i,n,a,s=e=>{t.deviceOrientation=e},o=()=>{"undefined"!=typeof window&&(t.screenOrientation=window.orientation||0)},l=(r=new u.Vector3(0,0,1),i=new u.Euler,n=new u.Quaternion,a=new u.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),(e,t,s,o,l)=>{var h=new u.Vector3(0,0,1);h.subVectors(e.target,e.position),i.set(s,t,-o,"YXZ");var c=new u.Quaternion;c.setFromEuler(i),c.multiply(a),c.multiply(n.setFromAxisAngle(r,-l)),h.applyQuaternion(c),h.addVectors(e.position,h),e.lookAt(h)});this.connect=()=>{o(),"undefined"!=typeof window&&(window.addEventListener("orientationchange",o,!1),window.addEventListener("deviceorientation",s,!1)),t.enabled=!0},this.disconnect=()=>{"undefined"!=typeof window&&(window.removeEventListener("orientationchange",o,!1),window.removeEventListener("deviceorientation",s,!1)),t.enabled=!1},this.update=()=>{if(!1!==t.enabled){var e=t.deviceOrientation.alpha?u.Math.degToRad(t.deviceOrientation.alpha):0,r=t.deviceOrientation.beta?u.Math.degToRad(t.deviceOrientation.beta):0,i=t.deviceOrientation.gamma?u.Math.degToRad(t.deviceOrientation.gamma):0,n=t.screenOrientation?u.Math.degToRad(t.screenOrientation):0;l(t.object,e,r,i,n)}},this.dispose=function(){this.disconnect()},this.connect()},b=function(){var e=void 0,t=void 0,r=void 0,i=new u.Vector3,n=new u.Vector3,a=new u.Vector3,s=new u.Vector3,o=void 0;this.setCurrentCameraSettings=(a,s)=>{e=a.clone(),t=a,r=s,e.near=r.nearPlane,r.farPlane&&(e.far=r.farPlane),r.eyePosition&&e.position.set(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),r.upVector&&e.up.set(r.upVector[0],r.upVector[1],r.upVector[2]),r.targetPosition&&(e.target=new u.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),e.lookAt(e.target)),e.updateProjectionMatrix(),i.copy(e.position).project(e),n.copy(e.target).project(e)},this.getCurrentPosition=()=>(n.copy(t.target).project(e),[n.x,n.y]),this.zoom=e=>{var r=.002*e,i=Math.max(t.zoom-r,1);t.zoom=i,t.updateProjectionMatrix()},this.zoomToBox=(t,r)=>{t.getCenter(a),a.project(e),this.setCenterZoom([a.x,a.y],r)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:t.zoom}),this.setCenterZoom=(r,i)=>{a.set(r[0],r[1],n.z).unproject(e),s.copy(a).sub(t.target),t.target.copy(a),t.lookAt(t.target),t.position.add(s),t.zoom=i,t.updateProjectionMatrix()},this.setEventCallback=e=>{(void 0===e||"function"==typeof e)&&(o=e)},this.triggerCallback=()=>{void 0!==o&&"function"==typeof o&&o()}};t.Viewport=p,t.CameraControls=function(e,t,r,i){var n={NONE:-1,DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,ROTATE_TRANSITION:4,MINIMAP:5,SYNC_CONTROL:6},a={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6,KEYBOARD_ZOOM:7,KEYBOARD_ROTATE:8,KEYBOARD_PAN:9},s={ARROWLEFT:37,ARROWUP:38,ARROWRIGHT:39,ARROWDOWN:40,NUMPADADD:107,NUMPADSUBTRACT:109,EQUAL:187,MINUS:189},o={};o.MAIN=a.ROTATE,o.AUXILIARY=a.ZOOM,o.SECONDARY=a.PAN,this.cameraObject=e,this.domElement=void 0===t?document:t,this.renderer=r,this.scene=i,this.tumble_rate=1.5,this.pointer_x=0,this.pointer_y=0,this.pointer_x_start=0,this.pointer_y_start=0,this.previous_pointer_x=0,this.previous_pointer_y=0,this.near_plane_fly_debt=0,this.touchZoomDistanceStart=0,this.touchZoomDistanceEnd=0,this.directionalLight=0,this.zoomRate=50,this.rotateRate=50,this.panRate=100,this.pixelHeight=1;var l,h=6e3,c=!0,y=0,w=void 0,_=void 0,M=!1,S=500,T=void 0,E="default",A=n.DEFAULT,L=void 0,R=void 0,C=void 0,P=0,I=1;this._state=a.NONE,this.targetTouchId=-1;var O=void 0,D=new u.Vector3,N=new u.Vector3,B=new u.Vector3,U=new u.Vector3,z=new u.Vector3,F=new u.Vector3,G=new u.Vector3,V=new u.Vector3,H=new u.Sphere,k=new u.Vector3,j=!1,W=void 0,Z=0,q={default:new p};q.default.nearPlane=.1,q.default.farPlane=2e3,q.default.eyePosition=[0,0,0],q.default.targetPosition=[0,0,-1],q.default.upVector=[0,1,0],void 0===this.cameraObject.target&&(this.cameraObject.target=new u.Vector3(...q.default.targetPosition)),this.calculateMaxAllowedDistance=e=>{var t=e.getBoundingBox();if(t){t.getBoundingSphere(H),Z=6*H.radius;var r=0;this.cameraObject&&(r=this.cameraObject.position.distanceTo(H.center)),Z=r>Z?1.5*r:Z}else Z=0},this.addViewport=(e,t)=>{e&&t&&(q[e]=t)},this.setDefaultViewport=e=>!(!e||!(e in q)||(E=e,0)),this.getDefaultViewport=()=>E,this.getViewportOfName=e=>q[e],this.setCurrentViewport=e=>!!(e in q)&&(this.setCurrentCameraSettings(q[e]),!0),this.setRotationMode=e=>{switch(e){case"none":I=-1;break;case"horizontal":I=2;break;case"vertical":I=3;break;default:I=1}},this.onResize=()=>{O&&(O=void 0),W&&W.setCurrentCameraSettings(this.cameraObject,q[E])},this.getVisibleHeightAtZDepth=e=>{var t=this.cameraObject.position.distanceTo(this.cameraObject.target);e<t?e-=t:e+=t;var r=this.cameraObject.fov*Math.PI/180;return 2*Math.tan(r/2)*Math.abs(e)},this.calculateHeightPerPixelAtZeroDepth=e=>{var t=this.getVisibleHeightAtZDepth(0);return this.pixelHeight=t/e,this.pixelHeight},this.getNDCFromDocumentCoords=(e,t,r)=>{ae(!1);var i=r||new u.Vector2,n=(e-O.left)/O.width*2-1,a=-(t-O.top)/O.height*2+1;return i.set(n,a)},this.getRelativeCoordsFromNDC=(e,t,r)=>{ae(!1);var i=r||new u.Vector2;return i.x=(e+1)*O.width/2,i.y=(1-t)*O.height/2,i},this.setMouseButtonAction=(e,t)=>{o[e]=a[t]};var X=(e,t)=>{e instanceof HTMLCanvasElement&&(e.tabIndex=t)},Y=()=>{if(0<Z){var e=k.distanceTo(H.center);return Z>e||this.cameraObject.position.distanceTo(H.center)>e}return!0},J=e=>{k.copy(this.cameraObject.position).add(e),Y()&&(this.cameraObject.target.add(e),this.cameraObject.position.add(e),this.updateDirectionalLight())},K=e=>{var t;if(ae(!1),A===n.DEFAULT&&(t=this.scene.getNormalisedMinimapCoordinates(this.renderer,e)),t){A=n.MINIMAP;var r=this.scene.getMinimapDiffFromNormalised(t.x,t.y);J(r)}else 0==e.button?e.ctrlKey?this._state=o.AUXILIARY:e.shiftKey?this._state=o.SECONDARY:this._state=o.MAIN:1==e.button?(e.preventDefault(),this._state=o.AUXILIARY):2==e.button&&(this._state=o.SECONDARY),this.pointer_x=e.clientX-O.left,this.pointer_y=e.clientY-O.top,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},Q=e=>{if(ae(!1),O)if(this.pointer_x=e.clientX-O.left,this.pointer_y=e.clientY-O.top,A===n.MINIMAP){var t=this.scene.getNormalisedMinimapCoordinates(this.renderer,e);if(t){var r=this.scene.getMinimapDiffFromNormalised(t.x,t.y);J(r)}}else this._state===a.NONE&&void 0!==l&&l.move(this,e.clientX,e.clientY,this.renderer)},$=e=>{this._state=a.NONE,A==n.MINIMAP&&(A=n.DEFAULT),void 0!==l&&this.pointer_x_start==e.clientX-O.left&&this.pointer_y_start==e.clientY-O.top&&l.pick(this,e.clientX,e.clientY,this.renderer)},ee=e=>{this._state=a.NONE},te=e=>{ae(!1);var t,r,i=e.touches.length;if(1==i)this._state=a.TOUCH_ROTATE,this.pointer_x=e.touches[0].clientX-(null===(t=O)||void 0===t?void 0:t.left),this.pointer_y=e.touches[0].clientY-(null===(r=O)||void 0===r?void 0:r.top),this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y;else if(2==i){this._state=a.TOUCH_ZOOM;var n=e.touches[0].clientX-e.touches[1].clientX,s=e.touches[0].clientY-e.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(n*n+s*s)}else if(3==i){var o,l;this._state=a.TOUCH_PAN,this.targetTouchId=e.touches[0].identifier,this.pointer_x=e.touches[0].clientX-(null===(o=O)||void 0===o?void 0:o.left),this.pointer_y=e.touches[0].clientY-(null===(l=O)||void 0===l?void 0:l.top),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y}},re=e=>{e.preventDefault(),e.stopPropagation();var t=e.touches.length;if(1==t)this.pointer_x=e.touches[0].clientX-O.left,this.pointer_y=e.touches[0].clientY-O.top;else if(2==t){if(this._state===a.TOUCH_ZOOM){var r=e.touches[0].clientX-e.touches[1].clientX,i=e.touches[0].clientY-e.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(r*r+i*i)}}else if(3==t&&this._state===a.TOUCH_PAN)for(var n=0;3>n;n++)e.touches[n].identifier==this.targetTouchId&&(this.pointer_x=e.touches[0].clientX-O.left,this.pointer_y=e.touches[0].clientY-O.top)},ie=e=>{var t=e.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=a.NONE,1==t&&void 0!==l&&this.pointer_x_start==e.touches[0].clientX-O.left&&this.pointer_y_start==e.touches[0].clientY-O.top&&l.pick(this.cameraObject,e.touches[0].clientX,e.touches[0].clientY,this.renderer)},ne=()=>{ae(!0)},ae=e=>{if(e||void 0===O){var t=new IntersectionObserver((e=>{for(var r of e)O=r.boundingClientRect;t.disconnect()}));t.observe(this.domElement)}},se=e=>{ae(!1),this._state=a.SCROLL;var t=0;0<e.deltaY?t=this.zoomRate:0>e.deltaY&&(t=-1*this.zoomRate),P+=t,e.preventDefault(),e.stopImmediatePropagation()},oe=e=>{ae(!1);var t=0;if(e.keyCode===s.EQUAL||e.keyCode===s.MINUS||e.keyCode===s.NUMPADADD||e.keyCode===s.NUMPADSUBTRACT){this._state=a.KEYBOARD_ZOOM;var r=1;e.shiftKey&&(r*=2),e.keyCode===s.EQUAL||e.keyCode===s.NUMPADADD?t=this.zoomRate*r*-1:(e.keyCode===s.MINUS||e.keyCode===s.NUMPADSUBTRACT)&&(t=this.zoomRate*r),P+=t}else(e.keyCode===s.ARROWLEFT||e.keyCode===s.ARROWUP||e.keyCode===s.ARROWRIGHT||e.keyCode===s.ARROWDOWN)&&(e.shiftKey?(this._state=a.KEYBOARD_ROTATE,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,t=this.rotateRate):(this._state=a.KEYBOARD_PAN,t=this.panRate),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,e.keyCode===s.ARROWLEFT?this.pointer_x-=t:e.keyCode===s.ARROWUP?this.pointer_y-=t:e.keyCode===s.ARROWRIGHT?this.pointer_x+=t:e.keyCode===s.ARROWDOWN&&(this.pointer_y+=t));Object.values(s).includes(e.keyCode)&&e.preventDefault()},le=e=>{this._state=a.NONE},he=()=>{if(void 0!==this.cameraObject){var e=O.height,t=this.cameraObject.position.distanceTo(this.cameraObject.target),r=0;this.cameraObject.far>this.cameraObject.near&&t>=this.cameraObject.near&&t<=this.cameraObject.far&&(r=(t-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),N.set(this.previous_pointer_x,e-this.previous_pointer_y,0),B.set(this.previous_pointer_x,e-this.previous_pointer_y,1),U.set(this.pointer_x,e-this.pointer_y,0),z.set(this.pointer_x,e-this.pointer_y,1),N.unproject(this.cameraObject),B.unproject(this.cameraObject),U.unproject(this.cameraObject),z.unproject(this.cameraObject),U.sub(N).multiplyScalar(1-r),z.sub(B).multiplyScalar(r),U.add(z).multiplyScalar(-.002),J(U)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};this.getVectorsFromRotateAboutLookAtPoints=(e,t)=>{e.normalize(),G.copy(this.cameraObject.position).sub(this.cameraObject.target),V.copy(G),G.normalize(),.8<Math.abs(G.dot(e))&&G.copy(this.cameraObject.up),N.crossVectors(e,G).normalize(),B.crossVectors(e,N);var r=e.dot(V),i=N.dot(V),n=B.dot(V),a=e.dot(this.cameraObject.up),s=N.dot(this.cameraObject.up),o=B.dot(this.cameraObject.up),l=Math.cos(t),h=Math.sin(t);return U.set(l*N.x+h*B.x,l*N.y+h*B.y,l*N.z+h*B.z),z.set(l*B.x-h*N.x,l*B.y-h*N.y,l*B.z-h*N.z),G.copy(this.cameraObject.target),G.x=G.x+e.x*r+U.x*i+z.x*n,G.y=G.y+e.y*r+U.y*i+z.y*n,G.z=G.z+e.z*r+U.z*i+z.z*n,D.set(e.x*a+U.x*s+z.x*o,e.y*a+U.y*s+z.y*o,e.z*a+U.z*s+z.z*o),{position:G,up:D}},this.rotateAboutLookAtpoint=(e,t)=>{var r=this.getVectorsFromRotateAboutLookAtPoints(e,t);this.cameraObject.position.copy(r.position),this.updateDirectionalLight(),this.cameraObject.up.copy(r.up)};var ce=()=>{if(void 0!==this.cameraObject){var e,t,r=null===(e=O)||void 0===e?void 0:e.width,i=null===(t=O)||void 0===t?void 0:t.height;if(0<r&&0<i){var n=.25*(r+i),a=0,s=0;(1===I||2===I)&&(a=this.pointer_x-this.previous_pointer_x),(1===I||3===I)&&(s=this.previous_pointer_y-this.pointer_y);var o=Math.sqrt(a*a+s*s);if(0<o){var l=1*-s/o,h=1*a/o;if(1===I){var c=l*(this.pointer_x-.5*(r-1))+h*(.5*(i-1)-this.pointer_y);c>n?c=n:c<-n&&(c=-n)}var u=Math.acos(0/n)-.5*Math.PI,d=this.tumble_rate*o/n;D.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),N.copy(this.cameraObject.up).normalize(),B.copy(N).cross(D).normalize().multiplyScalar(l),N.multiplyScalar(h),F.addVectors(B,N).multiplyScalar(Math.cos(u)),D.multiplyScalar(Math.sin(u)),F.add(D),this.rotateAboutLookAtpoint(F,-d)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},ue=()=>{var e=0;return this._state===a.ZOOM?e=this.previous_pointer_y-this.pointer_y:this._state===a.SCROLL||this._state===a.KEYBOARD_ZOOM?e=P:(e=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),e};this.changeZoomByScrollRateUnit=e=>{var t=e*this.zoomRate;this.changeZoomByValue(t)},this.changeZoomByValue=e=>{if(void 0!==this.cameraObject){var t=O.height,r=this.cameraObject.position.clone();r.sub(this.cameraObject.target);var i=r.length(),n=1.5*e/t;if(.01<i+n*i&&(r.normalize(),k.copy(this.cameraObject.position),k.x+=r.x*n*i,k.y+=r.y*n*i,k.z+=r.z*n*i,Y())){this.cameraObject.position.copy(k),this.updateDirectionalLight();var a=1e-5;if(a*this.cameraObject.far<this.cameraObject.near+n*i+this.near_plane_fly_debt)0!=this.near_plane_fly_debt&&(this.near_plane_fly_debt+=n*i,0<this.near_plane_fly_debt?(this.cameraObject.near+=this.near_plane_fly_debt,this.cameraObject.far+=this.near_plane_fly_debt,this.near_plane_fly_debt=0):(this.cameraObject.near+=n*i,this.cameraObject.far+=n*i));else{if(0==this.near_plane_fly_debt){var s=this.cameraObject.near-a*this.cameraObject.far;this.cameraObject.near=a*this.cameraObject.far,this.cameraObject.far-=s,this.near_plane_fly_debt-=a*this.cameraObject.far}this.near_plane_fly_debt+=n*i}j=!0}}};var de=()=>{var e=ue();this.changeZoomByValue(e),this._state===a.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),(this._state===a.SCROLL||this._state===a.KEYBOARD_ZOOM)&&(P=0,this._state=a.NONE)};this.setDirectionalLight=e=>{this.directionalLight=e},this.updateDirectionalLight=()=>{0!=this.directionalLight&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){c=!0,this.domElement&&this.domElement.addEventListener&&(X(this.domElement,0),this.domElement.addEventListener("mousedown",K,!1),this.domElement.addEventListener("mousemove",Q,!1),this.domElement.addEventListener("mouseup",$,!1),this.domElement.addEventListener("mouseleave",ee,!1),this.domElement.addEventListener("touchstart",te,!1),this.domElement.addEventListener("touchmove",re,!1),this.domElement.addEventListener("touchend",ie,!1),this.domElement.addEventListener("wheel",se,!1),this.domElement.addEventListener("mouseenter",ne,!1),this.domElement.addEventListener("contextmenu",(e=>{e.preventDefault()}),!1),this.domElement.addEventListener("keydown",oe,!1),this.domElement.addEventListener("keyup",le,!1))},this.disable=function(){c=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener("mousedown",K,!1),this.domElement.removeEventListener("mousemove",Q,!1),this.domElement.removeEventListener("mouseup",$,!1),this.domElement.removeEventListener("mouseleave",ee,!1),this.domElement.removeEventListener("touchstart",te,!1),this.domElement.removeEventListener("touchmove",re,!1),this.domElement.removeEventListener("touchend",ie,!1),this.domElement.removeEventListener("wheel",se,!1),this.domElement.removeEventListener("mouseenter",ne,!1),this.domElement.removeEventListener("contextmenu",(e=>{e.preventDefault()}),!1),this.domElement.removeEventListener("keydown",oe,!1),this.domElement.removeEventListener("keyup",le,!1),X(this.domElement,-1))},this.loadPath=e=>{w=e.CameraPath,_=e.NumberOfPoints},this.loadPathURL=(e,t)=>{var r=new XMLHttpRequest;r.onreadystatechange=()=>{if(4==r.readyState&&200==r.status){var e=JSON.parse(r.responseText);this.loadPath(e),null!=t&&"function"==typeof t&&t()}};var i=d(e);r.open("GET",i,!0),r.send()},this.setPathDuration=e=>{h=e,L&&L.setDuration(h),R&&R.setDuration(h)},this.getPlayRate=()=>S,this.setPlayRate=e=>{S=e},this.getTime=()=>y,this.setTime=e=>{y=e>h?h:0>e?0:e},this.getNumberOfTimeFrame=()=>_,this.getCurrentTimeFrame=()=>{if(2<_){var e=y/h*(_-1),t=Math.floor(e),r=1-(e-t),i=Math.ceil(e);return t==i?t==_-1?[t-1,i,0]:[t,i+1,1]:[t,i,r]}return 1==_?[0,0,0]:void 0},this.setCurrentTimeFrame=e=>{2<_&&(0>(y=h*e/(_-1))&&(y=0),y>h&&(y=h))};var pe=e=>{if(A===n.PATH&&((e=>{var t=y+e;t>h&&(t-=h),y=t})(e),w)){for(var t=this.getCurrentTimeFrame(),r=t[0],i=t[1],a=t[2],s=[w[3*r],w[3*r+1],w[3*r+2]],o=[w[3*i],w[3*i+1],w[3*i+2]],l=[],c=0;c<s.length;c++)l.push(a*s[c]+(1-a)*o[c]);this.cameraObject.position.set(l[0],l[1],l[2]),this.cameraObject.target.set(o[0],o[1],o[2]),T&&this.cameraObject.lookAt(this.cameraObject.target),M&&(this.directionalLight.position.set(l[0],l[1],l[2]),this.directionalLight.target.position.set(o[0],o[1],o[2]))}};this.calculatePathNow=()=>{pe(0)};var me=()=>{this._state===a.ROTATE||this._state===a.TOUCH_ROTATE||this._state===a.KEYBOARD_ROTATE?ce():this._state===a.PAN||this._state===a.TOUCH_PAN||this._state===a.KEYBOARD_PAN?(he(),W.triggerCallback()):(this._state===a.ZOOM||this._state===a.TOUCH_ZOOM||this._state===a.SCROLL||this._state===a.KEYBOARD_ZOOM)&&(W.zoom(ue()),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,(this._state===a.SCROLL||this._state===a.KEYBOARD_ZOOM)&&(this._state=a.NONE),P=0,W.triggerCallback())};this.update=e=>{var t=e*S,r=c,i=!0;return A===n.PATH?pe(t):A===n.SMOOTH_CAMERA_TRANSITION&&L?(L.update(t),L.isTransitionCompleted()&&(A=n.DEFAULT),r=!1):A===n.ROTATE_CAMERA_TRANSITION&&R?(R.update(t),R.isTransitionCompleted()&&(A=n.DEFAULT),r=!1):A===n.AUTO_TUMBLE&&C?C.update(t):A===n.SYNC_CONTROL&&W?(me(),r=!1):i=!1,r&&(this._state!==a.NONE&&(i=!0),this._state===a.ROTATE||this._state===a.TOUCH_ROTATE||this._state===a.KEYBOARD_ROTATE?ce():this._state===a.PAN||this._state===a.TOUCH_PAN||this._state===a.KEYBOARD_PAN?he():(this._state===a.ZOOM||this._state===a.TOUCH_ZOOM||this._state===a.SCROLL||this._state===a.KEYBOARD_ZOOM)&&de(),this._state!==a.NONE&&A===n.AUTO_TUMBLE&&C&&C.stopOnCameraInput,this._state===a.SCROLL&&(this._state=a.NONE)),T?(i=!0,T.update()):this.cameraObject.lookAt(this.cameraObject.target),i=i||j,j=!1,i},this.playPath=()=>{A=n.PATH},this.stopPath=()=>{A=n.DEFAULT},this.isPlayingPath=()=>A===n.PATH,this.enableDirectionalLightUpdateWithPath=e=>{M=e},this.enableDeviceOrientation=()=>{T||(T=new x(this.cameraObject))},this.disableDeviceOrientation=()=>{T&&(T.dispose(),T=void 0)},this.isDeviceOrientationEnabled=()=>!!T,this.resetView=()=>{var e=q[E];this.cameraObject.near=e.nearPlane,this.cameraObject.far=e.farPlane,this.cameraObject.position.set(e.eyePosition[0],e.eyePosition[1],e.eyePosition[2]),this.cameraObject.target.set(e.targetPosition[0],e.targetPosition[1],e.targetPosition[2]),this.cameraObject.up.set(e.upVector[0],e.upVector[1],e.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.setCurrentCameraSettings=e=>{e.nearPlane&&(this.cameraObject.near=e.nearPlane),e.farPlane&&(this.cameraObject.far=e.farPlane),e.eyePosition&&this.cameraObject.position.set(e.eyePosition[0],e.eyePosition[1],e.eyePosition[2]),e.targetPosition&&this.cameraObject.target.set(e.targetPosition[0],e.targetPosition[1],e.targetPosition[2]),e.upVector&&this.cameraObject.up.set(e.upVector[0],e.upVector[1],e.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight(),j=!0},this.getViewportFromCentreAndRadius=(e,t,r,i,n,a)=>{var s=this.cameraObject.position.x-this.cameraObject.target.x,o=this.cameraObject.position.y-this.cameraObject.target.y,l=this.cameraObject.position.z-this.cameraObject.target.z,h=1/Math.sqrt(s*s+o*o+l*l);s*=h,o*=h,l*=h;var c,u=[e,t,r],d=i/Math.tan(n*Math.PI/360),m=[e+s*d,t+o*d,r+l*d],f=d+a;c=a>.95*d?(1-.95)*d:d-a;var v=new p;return v.nearPlane=c,v.farPlane=f,v.eyePosition=m,v.targetPosition=u,v.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],v},this.getViewportFromBoundingBox=(e,t)=>{var r=e.min.distanceTo(e.max)/2*t,i=(e.min.x+e.max.x)/2,n=(e.min.y+e.max.y)/2,a=(e.min.z+e.max.z)/2;return this.getViewportFromCentreAndRadius(i,n,a,r,40,4*r)},this.getCurrentViewport=()=>{var e=new p;return e.nearPlane=this.cameraObject.near,e.farPlane=this.cameraObject.far,e.eyePosition[0]=this.cameraObject.position.x,e.eyePosition[1]=this.cameraObject.position.y,e.eyePosition[2]=this.cameraObject.position.z,e.targetPosition[0]=this.cameraObject.target.x,e.targetPosition[1]=this.cameraObject.target.y,e.targetPosition[2]=this.cameraObject.target.z,e.upVector[0]=this.cameraObject.up.x,e.upVector[1]=this.cameraObject.up.y,e.upVector[2]=this.cameraObject.up.z,e},this.getDefaultEyePosition=()=>eyePosition,this.getDefaultTargetPosition=()=>targetPosition,this.cameraTransition=(e,t,r)=>{null==R&&(L=new m(e,t,this,r))},this.rotateCameraTransition=(e,t,r)=>{null==L&&(R=new f(e,t,this,r))},this.enableCameraTransition=()=>{L&&(A=n.SMOOTH_CAMERA_TRANSITION),R&&(A=n.ROTATE_CAMERA_TRANSITION)},this.pauseCameraTransition=()=>{A=n.DEFAULT},this.stopCameraTransition=()=>{A=n.DEFAULT,L=void 0,R=void 0},this.isTransitioningCamera=()=>A===n.SMOOTH_CAMERA_TRANSITION||A===n.ROTATE_CAMERA_TRANSITION,this.autoTumble=(e,t,r)=>{C=new g(e,t,r,this)},this.enableAutoTumble=()=>{A=n.AUTO_TUMBLE},this.stopAutoTumble=()=>{A=n.DEFAULT,C=void 0},this.updateAutoTumble=()=>{C&&(C.requireUpdate=!0)},this.isAutoTumble=()=>A===n.AUTO_TUMBLE,this.enableRaycaster=(e,t,r)=>{null==l&&(l=new v(e,this.scene,t,r,this.renderer))},this.disableRaycaster=()=>{l.disable(),l=void 0},this.isSyncControl=()=>currentMpde===n.SYNC_CONTROL,this.enableSyncControl=()=>(A=n.SYNC_CONTROL,W||(W=new b),W.setCurrentCameraSettings(this.cameraObject,q[E]),W),this.disableSyncControl=()=>{A=n.DEFAULT,this.cameraObject.zoom=1,this.cameraObject.updateProjectionMatrix()},this.enable()},t.SmoothCameraTransition=m,t.RotateCameraTransition=f,t.RayCaster=v,t.CameraAutoTumble=g,t.StereoEffect=function(e){var t=new y;t.aspect=.5,this.setSize=(t,r)=>{e.setSize(t,r)},this.render=(r,i)=>{r.updateMatrixWorld(),null===i.parent&&i.updateMatrixWorld(),t.update(i);var n=e.getSize();e.setScissorTest(!0),e.clear(),e.setScissor(0,0,n.width/2,n.height),e.setViewport(0,0,n.width/2,n.height),e.render(r,t.cameraL),e.setScissor(n.width/2,0,n.width/2,n.height),e.setViewport(n.width/2,0,n.width/2,n.height),e.render(r,t.cameraR),e.setScissorTest(!1)}},t.NDCCameraControl=b},3152:(e,t,r)=>{var i=r(1515),n=r(6133)(i),a=r(5672).V,s=r(3515),o=r(7846).A,l=i.BufferGeometryLoader,h=function(e){var t;e&&e.isGeometry&&(t=e);var c=void 0,u=void 0,d=!1,p=void 0;this.getHostGeometry=()=>{var e=new n(t.getMorph());return new m(e)},this.getGeometry=()=>t;var m=e=>{var r=t.getMorph().material.clone();r.morphTargets=!1;var i=e.toMesh(r),n=new a;return n.geometry=i.geometry,i.userData=n,n.setMorph(i),n};this.setCSG=e=>{c.setCSG(e)};var f=(e,t,r,i)=>{if(d)i("On progress");else{var n=e.getMorph(),a=n.geometry.clone().applyMatrix(n.matrix).toJSON();p=r,d=!0,u.postMessage({action:t,object:a})}};this.intersect=e=>new o(((t,r)=>{if(u)f(e,"intersect",t,r);else{var i=c.intersect(e),n=new h(m(i));n.setCSG(i),t(n)}})),this.subtract=e=>new o(((t,r)=>{if(u)f(e,"intersect",t,r);else{var i=c.subtract(e),n=new h(m(i));n.setCSG(i),t(n)}})),this.union=e=>new o(((t,r)=>{if(u)f(e,"intersect",t,r);else{var i=c.union(e),n=new h(m(i));n.setCSG(i),t(n)}})),this.terminateWorker=()=>{u&&u.terminate()},(e=>{if(void 0!==s&&(u=s(4494)),u){if(e&&e.isGeometry){var n=e.getMorph(),o=n.geometry.clone().applyMatrix(n.matrix).toJSON();u.addEventListener("message",(function(e){(e=>{switch(e.data.action){case"message":console.log(e.data.message);break;case"result":var r=new h((e=>{var r=t.getMorph().material.clone();r.morphTargets=!1;var n=new a,s=(new l).parse(e),o=new i.Mesh(s.geometry,r);return n.geometry=o.geometry,o.userData=n,n.setMorph(o),n})(e.data.object));p&&p(r),p=void 0,d=!1;break;default:throw"Cannot handle specified action."}})(e)})),u.postMessage({action:"initialise",object:o})}}else c=new(r(8701).$)(e)})(e)};t.w=h},1602:(e,t,r)=>{var i=r(1515),n=r(6133)(i),a=(r(2842).V,function(e){var t;e&&e.isGlyphset&&(t=e);var s=[];this.setGlyphset=e=>{e&&e.isGlyphset&&(t=e),hostCSG=void 0},this.getGlyphset=()=>t;this.intersect=e=>{var o=(e=>{if(t&&e&&e.getMorph())return 0==s.length&&t.forEachGlyph((e=>{var t=e.getMesh(),r=e.getLabel();if(t){var i=new n(t.geometry.clone().applyMatrix(t.matrix)),a=[];a.csg=i,a.label=r,t.material&&(a.material=t.material.clone()),s.push(a)}})),new n(e.getMorph())})(e);if(0<s.length&&o){for(var l=new(r(2842).V),h=0;h<s.length;h++){var c=s[h],u=c.csg.intersect(o).toMesh();u&&u.geometry&&0<u.geometry.vertices.length&&(c.material&&(u.material=c.material,u.material.side=i.DoubleSide,u.material.clippingPlanes=null),l.addMeshAsGlyph(u,h+1).setLabel(c.label))}return new a(l)}}});t.K=a},5576:(e,t,r)=>{r(1515);var i=r(9425).B;t.H=function(){var e=this;this.parseGLTFObjects=(t,i,n,a)=>{var s=i;if(0!==n)if("Object3D"!==t.type){var o;if("Mesh"===t.type?o=new(r(5672).V):"LineSegments"===t.type?o=new(r(8145).q):"Points"===t.type&&(o=new(r(770).t)),o){var l=!1,h=!1;t.geometry&&t.geometry.morphAttributes&&(l=!!t.geometry.morphAttributes.position,h=!!t.geometry.morphAttributes.color),o.setMesh(t.clone(),l,h);var c=o.getMorph();o.groupName=c.name,c.matrixAutoUpdate=!0,i.addZincObject(o),null!=a&&"function"==typeof a&&a(o)}}else if(""!==t.name&&(i&&(s=i.findOrCreateChildFromPath(t.name)),s)){var u=s.getGroup();u.position.copy(t.position),u.rotation.copy(t.rotation),u.quaternion.copy(t.quaternion),u.matrixAutoUpdate=!0}n++,t.children.forEach((t=>{e.parseGLTFObjects(t,s,n,a)}))},this.setCamera=e=>{e.viewAll();var t=e.getZincCameraControls(),r=t.getCurrentViewport();t.addViewport("default",r),t.setDefaultViewport("default")},this.load=(t,r,n,a,s)=>{var o=n.substring(0,n.lastIndexOf("/")+1),l=n.substring(n.lastIndexOf("/")+1,n.length);(new i).setPath(o).load(l,(function(i){console.log(i),e.parseGLTFObjects(i.scene,r,0,a),e.setCamera(t),null!=s&&"function"==typeof s&&s()}))}}},807:(e,t,r)=>{"use strict";r.d(t,{q:()=>v});var i=r(1515),n=r(1781).a,a=i.LoaderUtils,s=i.AnimationClip,o=i.Vector3,l=i.Vector4,h=i.Color,c=i.Vector2,u=r(8154).n,d=r(8154).V,p=i.FileLoader,m=i.DefaultLoadingManager,f=r(1574).i;function v(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0===e?m:e,this.withCredentials=!1,this.paramsString=""}Object.assign(v.prototype,{load:function(e,t,r,i){var n=this,s=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:a.extractUrlBase(e),o=new p(this.manager);e.split("?"),this.paramsString=2===e.length?paramsStrings[1]:"",o.setWithCredentials(this.withCredentials),o.load(e,(function(r){var a;try{a=JSON.parse(r)}catch(t){if(console.error("The loader has encountered an error while parsing the content of a resource."),i)return void i({responseURL:e})}var o=a.metadata;if(void 0!==o){var l=o.type;if(void 0!==l&&"object"===l.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.")}if(n&&n.parse)try{var h=n.parse(a,s);t(h.geometry,h.materials)}catch(t){if(console.error("The loader has encountered aon loading the geometry"),console.error(t),i)return void i({responseURL:e})}}),r,i)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){void 0!==e.data&&(e=e.data),e.scale=void 0===e.scale?1:1/e.scale;var r=new d;if(r.morphColors=[],function(e,t){function r(e,t){return e&1<<t}var i,n,a,s,l,d,p,m,f,v,g,y,x,b,w,_,M,S,T,E,A,L,R,C,P,I,O,D=e.faces,N=e.vertices,B=e.normals,U=e.colors,z=e.scale,F=0;if(void 0!==e.uvs){for(i=0;i<e.uvs.length;i++)e.uvs[i].length&&F++;for(i=0;i<F;i++)t.faceVertexUvs[i]=[]}for(s=0,l=N.length;s<l;)(S=new o).x=N[s++]*z,S.y=N[s++]*z,S.z=N[s++]*z,t.vertices.push(S);if(s=0,l=D.length,e.uvs)for(i=0;i<e.uvs.length;i++){t.uvs[i]=[];for(var G=0;G<e.uvs[i].length;G++)t.uvs[i][G]=e.uvs[i][G]}if(B)for(i=0;i<B.length;i++)t.normals[i]=B[i];if(U)for(i=0;i<U.length;i++)t.colors[i]=U[i];for(;s<l;)if(g=r(v=D[s++],0),y=r(v,1),x=r(v,3),b=r(v,4),w=r(v,5),_=r(v,6),M=r(v,7),g){if((E=new u).a=D[s],E.b=D[s+1],E.c=D[s+3],(A=new u).a=D[s+1],A.b=D[s+2],A.c=D[s+3],s+=4,y&&(f=D[s++],E.materialIndex=f,A.materialIndex=f),a=t.faces.length,x)for(i=0;i<F;i++)for(C=e.uvs[i],t.faceVertexUvs[i][a]=[],t.faceVertexUvs[i][a+1]=[],n=0;4>n;n++)I=C[2*(m=D[s++])],O=C[2*m+1],P=new c(I,O),2!==n&&t.faceVertexUvs[i][a].push(P),0!==n&&t.faceVertexUvs[i][a+1].push(P);if(b&&(p=3*D[s++],E.normal.set(B[p++],B[p++],B[p]),A.normal.copy(E.normal)),w)for(i=0;4>i;i++)p=3*D[s++],R=new o(B[p++],B[p++],B[p]),2!==i&&E.vertexNormals.push(R),0!==i&&A.vertexNormals.push(R);if(_&&(L=U[d=D[s++]],E.color.setHex(L),A.color.setHex(L)),M)for(i=0;4>i;i++)L=U[d=D[s++]],2!==i&&E.vertexColors.push(new h(L)),0!==i&&A.vertexColors.push(new h(L));t.faces.push(E),t.faces.push(A)}else{if((T=new u).a=D[s++],T.b=D[s++],T.c=D[s++],y&&(f=D[s++],T.materialIndex=f),a=t.faces.length,x)for(i=0;i<F;i++)for(C=e.uvs[i],t.faceVertexUvs[i][a]=[],n=0;3>n;n++)I=C[2*(m=D[s++])],O=C[2*m+1],P=new c(I,O),t.faceVertexUvs[i][a].push(P);if(b&&(p=3*D[s++],T.normal.set(B[p++],B[p++],B[p])),w)for(i=0;3>i;i++)p=3*D[s++],R=new o(B[p++],B[p++],B[p]),T.vertexNormals.push(R);if(_&&(d=D[s++],T.color.setHex(U[d])),M)for(i=0;3>i;i++)d=D[s++],T.vertexColors.push(new h(U[d]));t.faces.push(T)}}(e,r),function(e,t){var r=void 0===e.influencesPerVertex?2:e.influencesPerVertex;if(e.skinWeights)for(var i=0,n=e.skinWeights.length;i<n;i+=r){var a=e.skinWeights[i],s=1<r?e.skinWeights[i+1]:0,o=2<r?e.skinWeights[i+2]:0,h=3<r?e.skinWeights[i+3]:0;t.skinWeights.push(new l(a,s,o,h))}if(e.skinIndices)for(i=0,n=e.skinIndices.length;i<n;i+=r){var c=e.skinIndices[i],u=1<r?e.skinIndices[i+1]:0,d=2<r?e.skinIndices[i+2]:0,p=3<r?e.skinIndices[i+3]:0;t.skinIndices.push(new l(c,u,d,p))}t.bones=e.bones,t.bones&&0<t.bones.length&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn("When skinning, number of vertices ("+t.vertices.length+"), skinIndices ("+t.skinIndices.length+"), and skinWeights ("+t.skinWeights.length+") should match.")}(e,r),function(e,t){var r,n,a,s,l,h=e.scale;if(void 0!==e.morphTargets)for(var c=0,u=e.morphTargets.length;c<u;c++){t.morphTargets[c]={},t.morphTargets[c].name=e.morphTargets[c].name,t.morphTargets[c].vertices=[];for(var d,p=t.morphTargets[c].vertices,m=e.morphTargets[c].vertices,f=0,v=m.length;f<v;f+=3)(d=new o).x=m[f]*h,d.y=m[f+1]*h,d.z=m[f+2]*h,p.push(d)}if(void 0!==e.morphNormals)for(c=0,u=e.morphNormals.length;c<u;c++)if(t.morphTargets[c]){t.morphTargets[c].normals=[];var g,y=t.morphTargets[c].normals,x=e.morphNormals[c].normals;for(f=0,v=x.length;f<v;f+=3)(g=new o).x=x[f],g.y=x[f+1],g.z=x[f+2],y.push(g);t.morphNormalsReady=!0}if(void 0!==e.morphColors)for(c=0,u=e.morphColors.length;c<u;c++)for(t.morphColors[c]={},t.morphColors[c].name=e.morphColors[c].name,t.morphColors[c].colors=[],a=t.morphColors[c].colors,r=0,n=(s=e.morphColors[c].colors).length;r<n;r+=3)(l=new i.Color(16755200)).setRGB(s[r],s[r+1],s[r+2]),a.push(l)}(e,r),function(e,t){var r=[],i=[];void 0!==e.animation&&i.push(e.animation),void 0!==e.animations&&(e.animations.length?i=i.concat(e.animations):i.push(e.animations));for(var n,a=0;a<i.length;a++)(n=s.parseAnimation(i[a],t.bones))&&r.push(n);if(t.morphTargets){var o=s.CreateClipsFromMorphTargetSequences(t.morphTargets,10);r=r.concat(o)}0<r.length&&(t.animations=r)}(e,r),r.computeFaceNormals(),r.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:r};var a=n.prototype.initMaterials(e.materials,t,"Anonymous");if(e.materials[0].video){var p=t+e.materials[0].video;this.paramsString&&(p+="?".concat(this.paramsString));var m=new f(p);r._video=m}return a&&0<a.length&&(a[0].side=e.materials[0].singleSided?i.FrontSide:e.materials[0].flipSided?i.BackSide:i.DoubleSide,e.materials[0].specularCoef&&(a[0].shininess=Math.floor(e.materials[0].specularCoef/3))),{geometry:r,materials:a}}})},654:(e,t,r)=>{"use strict";r.d(t,{L:()=>m});var i=r(1515),n=/^[og]\s*(.+)?/,a=/^mtllib /,s=/^usemtl /,o=/^usemap /,l=new i.Vector3,h=new i.Vector3,c=new i.Vector3,u=new i.Vector3,d=new i.Vector3;function p(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var r=this._finalize(!1);r&&(r.inherited||0>=r.groupCount)&&this.materials.splice(r.index,1);var i={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:void 0===r?this.smooth:r.smooth,groupStart:void 0===r?0:r.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){var t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(i),i},currentMaterial:function(){return 0<this.materials.length?this.materials[this.materials.length-1]:void 0},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var r=this.materials.length-1;0<=r;r--)0>=this.materials[r].groupCount&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone){var i=r.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){var r=parseInt(e,10);return 3*(0<=r?r-1:r+t/3)},parseNormalIndex:function(e,t){var r=parseInt(e,10);return 3*(0<=r?r-1:r+t/3)},parseUVIndex:function(e,t){var r=parseInt(e,10);return 2*(0<=r?r-1:r+t/2)},addVertex:function(e,t,r){var i=this.vertices,n=this.object.geometry.vertices;n.push(i[e+0],i[e+1],i[e+2]),n.push(i[t+0],i[t+1],i[t+2]),n.push(i[r+0],i[r+1],i[r+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){var i=this.normals,n=this.object.geometry.normals;n.push(i[e+0],i[e+1],i[e+2]),n.push(i[t+0],i[t+1],i[t+2]),n.push(i[r+0],i[r+1],i[r+2])},addFaceNormal:function(e,t,r){var i=this.vertices,n=this.object.geometry.normals;l.fromArray(i,e),h.fromArray(i,t),c.fromArray(i,r),d.subVectors(c,h),u.subVectors(l,h),d.cross(u),d.normalize(),n.push(d.x,d.y,d.z),n.push(d.x,d.y,d.z),n.push(d.x,d.y,d.z)},addColor:function(e,t,r){var i=this.colors,n=this.object.geometry.colors;void 0!==i[e]&&n.push(i[e+0],i[e+1],i[e+2]),void 0!==i[t]&&n.push(i[t+0],i[t+1],i[t+2]),void 0!==i[r]&&n.push(i[r+0],i[r+1],i[r+2])},addUV:function(e,t,r){var i=this.uvs,n=this.object.geometry.uvs;n.push(i[e+0],i[e+1]),n.push(i[t+0],i[t+1]),n.push(i[r+0],i[r+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,i,n,a,s,o,l){var h=this.vertices.length,c=this.parseVertexIndex(e,h),u=this.parseVertexIndex(t,h),d=this.parseVertexIndex(r,h);if(this.addVertex(c,u,d),this.addColor(c,u,d),void 0!==s&&""!==s){var p=this.normals.length;c=this.parseNormalIndex(s,p),u=this.parseNormalIndex(o,p),d=this.parseNormalIndex(l,p),this.addNormal(c,u,d)}else this.addFaceNormal(c,u,d);if(void 0!==i&&""!==i){var m=this.uvs.length;c=this.parseUVIndex(i,m),u=this.parseUVIndex(n,m),d=this.parseUVIndex(a,m),this.addUV(c,u,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t,r=this.vertices.length,i=0,n=e.length;i<n;i++)t=this.parseVertexIndex(e[i],r),this.addVertexPoint(t),this.addColor(t)},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,i=this.uvs.length,n=0,a=e.length;n<a;n++)this.addVertexLine(this.parseVertexIndex(e[n],r));for(var s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],i))}};return e.startObject("",!1),e}class m extends i.Loader{constructor(e){super(e),this.materials=null}load(e,t,r,n){var a=this,s=new i.FileLoader(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(r){try{t(a.parse(r))}catch(t){n?n(t):console.error(t),a.manager.itemError(e)}}),r,n)}setMaterials(e){return this.materials=e,this}parse(e){var t=new p;-1!==e.indexOf("\r\n")&&(e=e.replace(/\r\n/g,"\n")),-1!==e.indexOf("\\\n")&&(e=e.replace(/\\\n/g,""));for(var r=e.split("\n"),l="",h="",c=[],u="function"==typeof"".trimLeft,d=0,m=r.length;d<m;d++)if(l=r[d],0!==(l=u?l.trimLeft():l.trim()).length&&"#"!==(h=l.charAt(0)))if("v"===h){var f=l.split(/\s+/);switch(f[0]){case"v":t.vertices.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),7<=f.length?t.colors.push(parseFloat(f[4]),parseFloat(f[5]),parseFloat(f[6])):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3]));break;case"vt":t.uvs.push(parseFloat(f[1]),parseFloat(f[2]))}}else if("f"===h){for(var v,g=l.substr(1).trim().split(/\s+/),y=[],x=0,b=g.length;x<b;x++)if(0<(v=g[x]).length){var w=v.split("/");y.push(w)}for(var _=y[0],M=1,S=y.length-1;M<S;M++){var T=y[M],E=y[M+1];t.addFace(_[0],T[0],E[0],_[1],T[1],E[1],_[2],T[2],E[2])}}else if("l"===h){var A=l.substring(1).trim().split(" "),L=[],R=[];if(-1===l.indexOf("/"))L=A;else for(var C,P=0,I=A.length;P<I;P++)""!==(C=A[P].split("/"))[0]&&L.push(C[0]),""!==C[1]&&R.push(C[1]);t.addLineGeometry(L,R)}else if("p"===h){var O=l.substr(1).trim().split(" ");t.addPointGeometry(O)}else if(null!==(c=n.exec(l))){var D=(" "+c[0].substr(1).trim()).substr(1);t.startObject(D)}else if(s.test(l))t.object.startMaterial(l.substring(7).trim(),t.materialLibraries);else if(a.test(l))t.materialLibraries.push(l.substring(7).trim());else if(o.test(l))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===h){if(1<(c=l.split(" ")).length){var N=c[1].trim().toLowerCase();t.object.smooth="0"!==N&&"off"!==N}else t.object.smooth=!0;var B=t.object.currentMaterial();B&&(B.smooth=t.object.smooth)}else{if("\0"===l)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+l+'"')}t.finalize();var U=new i.Group;if(U.materialLibraries=[].concat(t.materialLibraries),1==(1!==t.objects.length||0!==t.objects[0].geometry.vertices.length))for(var z=0,F=t.objects.length;z<F;z++){var G=t.objects[z],V=G.geometry,H=G.materials,k="Line"===V.type,j="Points"===V.type,W=!1;if(0!==V.vertices.length){var Z=new i.BufferGeometry;Z.setAttribute("position",new i.Float32BufferAttribute(V.vertices,3)),0<V.normals.length&&Z.setAttribute("normal",new i.Float32BufferAttribute(V.normals,3)),0<V.colors.length&&(W=!0,Z.setAttribute("color",new i.Float32BufferAttribute(V.colors,3))),!0===V.hasUVIndices&&Z.setAttribute("uv",new i.Float32BufferAttribute(V.uvs,2));for(var q=[],X=0,Y=H.length;X<Y;X++){var J=H[X],K=J.name+"_"+J.smooth+"_"+W,Q=t.materials[K];if(null!==this.materials)if(Q=this.materials.create(J.name),!k||!Q||Q instanceof i.LineBasicMaterial){if(j&&Q&&!(Q instanceof i.PointsMaterial)){var $=new i.PointsMaterial({size:10,sizeAttenuation:!1});i.Material.prototype.copy.call($,Q),$.color.copy(Q.color),$.map=Q.map,Q=$}}else{var ee=new i.LineBasicMaterial;i.Material.prototype.copy.call(ee,Q),ee.color.copy(Q.color),Q=ee}void 0===Q&&((Q=k?new i.LineBasicMaterial:j?new i.PointsMaterial({size:1,sizeAttenuation:!1}):new i.MeshPhongMaterial).name=J.name,Q.flatShading=!J.smooth,Q.vertexColors=W,t.materials[K]=Q),q.push(Q)}var te=void 0;if(1<q.length){for(var re,ie=0,ne=H.length;ie<ne;ie++)re=H[ie],Z.addGroup(re.groupStart,re.groupCount,ie);te=k?new i.LineSegments(Z,q):j?new i.Points(Z,q):new i.Mesh(Z,q)}else te=k?new i.LineSegments(Z,q[0]):j?new i.Points(Z,q[0]):new i.Mesh(Z,q[0]);te.name=G.name,U.add(te)}}else if(0<t.vertices.length){var ae=new i.PointsMaterial({size:1,sizeAttenuation:!1}),se=new i.BufferGeometry;se.setAttribute("position",new i.Float32BufferAttribute(t.vertices,3)),0<t.colors.length&&void 0!==t.colors[0]&&(se.setAttribute("color",new i.Float32BufferAttribute(t.colors,3)),ae.vertexColors=!0);var oe=new i.Points(se,ae);U.add(oe)}return U}}},7270:(e,t,r)=>{"use strict";r.d(t,{t:()=>n});var i=r(1515);class n extends i.Loader{constructor(e){super(e)}load(e,t,r,n){var a=this,s=new i.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(r){try{t(a.parse(r))}catch(t){n?n(t):console.error(t),a.manager.itemError(e)}}),r,n)}parse(e){function t(e,t,r){for(var i=0,n=e.length;i<n;i++)if(e[i]!==t.getUint8(r+i,!1))return!1;return!0}var r,n=function(e){if("string"==typeof e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=255&e.charCodeAt(r);return t.buffer||t}return e}(e);return function(e){var r=new DataView(e);if(84+50*r.getUint32(80,!0)===r.byteLength)return!0;for(var i=[115,111,108,105,100],n=0;5>n;n++)if(t(i,r,n))return!1;return!0}(n)?function(e){for(var t,r,n,a,s,o,l,h,c=new DataView(e),u=c.getUint32(80,!0),d=!1,p=0;p<70;p++)1129270351==c.getUint32(p,!1)&&82==c.getUint8(p+4)&&61==c.getUint8(p+5)&&(d=!0,a=new Float32Array(3*u*3),s=c.getUint8(p+6)/255,o=c.getUint8(p+7)/255,l=c.getUint8(p+8)/255,h=c.getUint8(p+9)/255);for(var m=new i.BufferGeometry,f=new Float32Array(3*u*3),v=new Float32Array(3*u*3),g=0;g<u;g++){var y=84+50*g,x=c.getFloat32(y,!0),b=c.getFloat32(y+4,!0),w=c.getFloat32(y+8,!0);if(d){var _=c.getUint16(y+48,!0);0==(32768&_)?(t=(31&_)/31,r=(31&_>>5)/31,n=(31&_>>10)/31):(t=s,r=o,n=l)}for(var M=1;3>=M;M++){var S=y+12*M,T=3*g*3+3*(M-1);f[T]=c.getFloat32(S,!0),f[T+1]=c.getFloat32(S+4,!0),f[T+2]=c.getFloat32(S+8,!0),v[T]=x,v[T+1]=b,v[T+2]=w,d&&(a[T]=t,a[T+1]=r,a[T+2]=n)}}return m.setAttribute("position",new i.BufferAttribute(f,3)),m.setAttribute("normal",new i.BufferAttribute(v,3)),d&&(m.setAttribute("color",new i.BufferAttribute(a,3)),m.hasColors=!0,m.alpha=h),m}(n):function(e){for(var t,r=new i.BufferGeometry,n=/solid([\s\S]*?)endsolid/g,a=/facet([\s\S]*?)endfacet/g,s=0,o=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,l=new RegExp("vertex"+o+o+o,"g"),h=new RegExp("normal"+o+o+o,"g"),c=[],u=[],d=new i.Vector3,p=0,m=0,f=0;null!==(t=n.exec(e));){m=f;for(var v=t[0];null!==(t=a.exec(v));){for(var g=0,y=0,x=t[0];null!==(t=h.exec(x));)d.x=parseFloat(t[1]),d.y=parseFloat(t[2]),d.z=parseFloat(t[3]),y++;for(;null!==(t=l.exec(x));)c.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])),u.push(d.x,d.y,d.z),g++,f++;1!==y&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+s),3!==g&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+s),s++}var b=m,w=f-m;r.addGroup(b,w,p),p++}return r.setAttribute("position",new i.Float32BufferAttribute(c,3)),r.setAttribute("normal",new i.Float32BufferAttribute(u,3)),r}("string"==typeof(r=e)?r:i.LoaderUtils.decodeText(new Uint8Array(r)))}}},1915:(e,t,r)=>{function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function n(e){for(var t,r=1;r<arguments.length;r++)t=null==arguments[r]?{}:arguments[r],r%2?i(Object(t),!0).forEach((function(r){var i,n,a;i=e,n=r,a=t[r],n=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(n),n in i?Object.defineProperty(i,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[n]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}));return e}var a=r(807).q,s=r(1515).FileLoader,o=function(e,t,r){var i=new s,n=new a;i.crossOrigin=t;var o=e,l=r,h=void 0,c=!1,u=!1,d=void 0,p=[],m=e=>{var t=h[e.index];if(t){var r=n.parse(t);e.onLoad(r.geometry,r.materials)}else f(e,{responseURL:o})},f=e=>{e.onError&&(!d&&(d={responseURL:o}),e.onError(d))};this.downloadCompleted=e=>{try{h=JSON.parse(e[0]),c=!1,u=!0,Array.isArray(h)?p.forEach((e=>m(e))):p.forEach((e=>f(e)))}catch(e){p.forEach((e=>f(e)))}};var v=()=>e=>{d=e,u=!0,c=!1,p.forEach((e=>{f(e)}))},g=()=>e=>{p.forEach((t=>{t.onProgress&&t.onProgress(e)}))};this.load=(e,t,r,n)=>{var a={index:e,onLoad:t,onProgress:r,onError:n};u?h?m(a):f(d):c?p.push(a):(p.push(a),c=!0,i.load(o,l,g,v))}},l=function(e,t){var r=[],i=e,n=t,a=0;this.itemDownloaded=(e,t)=>{if(r[e]=t,++a==i){for(var s=r[0][1],o=(e=>{var t=(e,t)=>{e.merge(t)};if(e&&0<e.length){for(;1<e.length;){var r=e.splice(1,1);t(e[0],r[0])}return e[0]}})(r.map((e=>e[0]))),l=1;l<i;l++)r[e][0].dispose(),r[e][1].forEach((e=>e.dispose()));n(o,s)}}};t._=function(){var e=0;this.crossOrigin="Anonymous";var t=new a,r=[],i={},s=(t,a,s,l,h)=>{var u=h?n({},h):{},d=i[t];if(!d)if(20>e){var p=new c(void 0,this,u);++e,d=new o(t,this.crossOrigin,p),i[t]=d}else r.push({url:t,onLoad:a,onProgress:s,onError:l,options:h});d&&(u.isHandler=d,d.load(h.index,a,s,l))},h=(i,n,a,o,l)=>{if(l&&void 0!==l.index)s(i,n,a,o,l);else if(20>e){++e;var h=new c(n,this,l),u=new c(o,this,l);t.crossOrigin=this.crossOrigin,t.load(i,h,a,u)}else r.push({url:i,onLoad:n,onProgress:a,onError:o,options:l})};this.load=(e,t,r,i,a)=>{Array.isArray(e)?((e,t,r,i,a)=>{var s=e.length,o=new l(s,t),c=0;e.forEach((e=>{var s=a?n({},a):{};s.msHandler=o,s.order=c,c++,h(e,t,r,i,s)}))})(e,t,r,i,a):h(e,t,r,i,a)},this.loadFromWaitingList=()=>{for(;20>e;){var t=r.shift();if(!t)return;this.load(t.url,t.onLoad,t.onProgress,t.onError,t.options)}},this.itemRemainingCheck=()=>{if(0===r.length&&0==e)for(var t in i)i.hasOwnProperty(t)&&delete i[t]};var c=function(t,r,i){return function(){--e;for(var n=arguments.length,a=Array(n),s=0;s<n;s++)a[s]=arguments[s];null!=i&&i.msHandler?i.msHandler.itemDownloaded(i.order,a):null!=i&&i.isHandler?i.isHandler.downloadCompleted(a):t&&t(...a),r.loadFromWaitingList(),r.itemRemainingCheck()}};this.parse=e=>t.parse(e)}},7404:(e,t,r)=>{var i=r(1515);t.U=function(e){var t=e;this.camera=new i.OrthographicCamera(-.5,.5,.5,-.5,.01,10),this.helper=void 0;var r=new i.BufferGeometry,n=new Float32Array([-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1]),a=new i.BufferAttribute(n,3);r.setAttribute("position",a);var s=new i.MeshBasicMaterial({color:3355443,depthTest:!1,depthWrite:!1,opacity:.5,transparent:!0});this.mask=new i.Mesh(r,s);var o=new i.Box3,l=new i.Vector3;this.getDiffFromNormalised=(e,t)=>{o.setFromBufferAttribute(a).getCenter(l);var r=l.clone().project(this.camera);return new i.Vector3(e,t,r.z).unproject(this.camera).sub(l)};var h=(e,r)=>{t.camera.near&&(this.camera.near=t.camera.near),r.farPlane&&(this.camera.far=r.farPlane),r.eyePosition&&this.camera.position.set(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),r.upVector&&this.camera.up.set(r.upVector[0],r.upVector[1],r.upVector[2]),r.targetPosition&&this.camera.lookAt(new i.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2])),this.camera.zoom=1/e,this.camera.updateProjectionMatrix()};this.getBoundary=()=>{var e=(new i.Vector3).copy(t.camera.target).project(t.camera),r=new i.Vector3(-1,-1,e.z).unproject(t.camera),n=new i.Vector3(1,-1,e.z).unproject(t.camera),s=new i.Vector3(1,1,e.z).unproject(t.camera),o=new i.Vector3(-1,1,e.z).unproject(t.camera);a.copyVector3sArray([r,n,s,s,o,r]),a.needsUpdate=!0},this.updateCamera=()=>{this.getBoundary();var e=t.getZincCameraControls(),r=t.getBoundingBox();if(r){var i=r.min.distanceTo(r.max),n=i/2,a=(r.min.x+r.max.x)/2,s=(r.min.y+r.max.y)/2,o=(r.min.z+r.max.z)/2,l=e.getViewportFromCentreAndRadius(a,s,o,n,40,4*n);h(i,l)}}}},9960:(e,t)=>{t.augmentMorphColor=function(){return function(e){e.vertexShader=e.vertexShader.replace("#include <color_pars_vertex>",["varying vec3 vColor;","attribute vec3 morphColor0;","attribute vec3 morphColor1;"].join("\n")),e.vertexShader=e.vertexShader.replace("#include <color_vertex>",["vColor.xyz = color.xyz;","#ifdef USE_MORPHTARGETS","vColor = morphColor0 * morphTargetInfluences[ 0 ];","vColor += morphColor1 * morphTargetInfluences[ 1 ];","#endif"].join("\n"))}}},5672:function(e,t,r){var i=r(1515),n=r(2515).toBufferGeometry,a=function(){r(7393).c.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(e,t,a)=>{if(!this.morph||!this.morph.geometry||null==e){var s=((e,t,a)=>{var s,o=n(e,a),l=!1;if(1>a.opacity&&(l=!0),void 0===o._video){var h=a.localTimeEnabled||a.localMorphColour;t?((s=t).morphTargets=h,s.morphNormals=a.localTimeEnabled):s=o instanceof i.BufferGeometry&&void 0===o.attributes.color?new i.MeshPhongMaterial({color:a.colour,morphTargets:h,morphNormals:a.localTimeEnabled,transparent:l,opacity:a.opacity,side:i.DoubleSide}):new i.MeshPhongMaterial({color:a.colour,morphTargets:h,morphNormals:a.localTimeEnabled,vertexColors:i.VertexColors,transparent:l,opacity:a.opacity,side:i.DoubleSide}),a.localMorphColour&&o.morphAttributes.color&&(s.onBeforeCompile=r(9960).augmentMorphColor())}else{var c=o._video.createCanvasVideoTexture();s=new i.MeshBasicMaterial({morphTargets:a.localTimeEnabled,color:new i.Color(1,1,1),transparent:l,opacity:a.opacity,map:c,side:i.DoubleSide}),o._video}return new i.Mesh(o,s)})(e,t,a);this.setMesh(s,a.localTimeEnabled,a.localMorphColour)}},this.calculateUVs=()=>{this.geometry.computeBoundingBox();var e=this.geometry.boundingBox.max,t=this.geometry.boundingBox.min,r=new i.Vector2(0-t.x,0-t.y),n=new i.Vector2(e.x-t.x,e.y-t.y);this.geometry.faceVertexUvs[0]=[];for(var a=0;a<this.geometry.faces.length;a++){var s=this.geometry.vertices[this.geometry.faces[a].a],o=this.geometry.vertices[this.geometry.faces[a].b],l=this.geometry.vertices[this.geometry.faces[a].c];geometry.faceVertexUvs[0].push([new i.Vector2((s.x+r.x)/n.x,(s.y+r.y)/n.y),new i.Vector2((o.x+r.x)/n.x,(o.y+r.y)/n.y),new i.Vector2((l.x+r.x)/n.x,(l.y+r.y)/n.y)])}geometry.uvsNeedUpdate=!0},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=e=>{this.morph.material.wireframe=e},this.editVertices=function(e,t){if(e&&e.length){var r=this.getMorph(),i=r.geometry.getAttribute("position");if(!r||0>t)return;var n=3*t;e.forEach((e=>{i.array[n++]=e[0],i.array[n++]=e[1],i.array[n++]=e[2]})),i.needsUpdate=!0,r.geometry.computeBoundingBox(),r.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}};a.prototype=Object.create(r(7393).c.prototype),t.V=a},9344:(e,t,r)=>{var i=r(1515),n=function(e,t,n,a){var s;r(7393).c.call(this),t&&((s=t.clone()).vertexColors=i.FaceColors),this.id=n;var o=void 0,l=void 0;this.isGlyph=!0;var h=[0,0,0];this.fromMesh=e=>!(!e||!e.isMesh||(this.morph=e.clone(),this.morph.userData=this,this.group.add(this.morph),0)),e&&s&&this.fromMesh(new i.Mesh(e,s)),this.getGlyphset=function(){return a},this.setLabel=e=>{e&&("string"==typeof e||e instanceof String)&&(l=e,this.morph&&(this.morph.name=e))},this.showLabel=e=>{o&&(h=o.getPosition(),this.group.remove(o.getSprite()),o.dispose(),o=void 0),l&&("string"==typeof l||l instanceof String)&&((o=new(r(4296).J)(l,e)).setPosition(h[0],h[1],h[2]),this.group.add(o.getSprite()))},this.hideLabel=()=>{o&&(h=o.getPosition(),this.group.remove(o.getSprite()),o.dispose(),o=void 0)},this.getLabel=()=>l,this.getMesh=()=>this.morph,this.setTransformation=(e,t,r,i)=>{this.morph&&(this.morph.matrix.elements[0]=t[0],this.morph.matrix.elements[1]=t[1],this.morph.matrix.elements[2]=t[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=r[0],this.morph.matrix.elements[5]=r[1],this.morph.matrix.elements[6]=r[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=i[0],this.morph.matrix.elements[9]=i[1],this.morph.matrix.elements[10]=i[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=e[0],this.morph.matrix.elements[13]=e[1],this.morph.matrix.elements[14]=e[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),h=[...e],o&&o.setPosition(e[0],e[1],e[2])},this.setColour=e=>{o&&o.setColour(e),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry&&(this.geometry.colorsNeedUpdate=!0)},this.dispose=()=>{this.material&&this.material.dispose(),this.morph=void 0}};n.prototype=Object.create(r(7393).c.prototype),t.z=n},2842:(e,t,r)=>{var i=r(1515),n=r(807).q,a=function(){r(7393).c.call(this);var e=[],t=void 0,a=void 0,s=void 0,o=void 0,l=void 0,h=void 0,c=void 0,u=0,d=0,p=[0,0,0],m=[0,0,0],f=[0,0,0],v="NONE";this.ready=!1;var g=!1,y=!1;this.isGlyphset=!0;var x=new i.Matrix4,b=new i.Color,w=new i.Color,_=new i.Box3,M=new i.Box3,S=new i.Box3,T=[],E=[],A=[],L=[],R=[],C=[],P=[],I=[];this.globalScale=1;for(var O=0;8>O;O++)T[O]=new i.Vector3;this.load=(e,r,x,b,w)=>{t=e.axis1,a=e.axis2,s=e.axis3,o=e.positions,l=e.scale,h=e.colors,c=e.label,g=e.metadata.MorphColours,y=e.metadata.MorphVertices,u=e.metadata.number_of_time_steps,v=e.metadata.repeat_mode,d=e.metadata.number_of_vertices,"AXES_2D"==v||"MIRROR"==v?d*=2:"AXES_3D"==v&&(d*=3),p=e.metadata.base_size,m=e.metadata.offset,f=e.metadata.scale_factors;var _=new n;this.geometry=new i.BufferGeometry;var M=new i.InstancedMesh(this.geometry,void 0,d);if(this.setMorph(M),b){var S=_.parse(r);F(x,w)(S.geometry,S.materials),S.geometry.dispose()}else _.crossOrigin="Anonymous",_.load(r,F(x,w))};var D=(e,t,r,i,n,a)=>{if("NONE"==v||"MIRROR"==v){for(var s=[0,0,0],o=[0,0,0],l=[0,0,0],h=[0,0,0],c=[0,0,0],u=[0,0,0],d=[0,0,0],g=[0,0,0],y=[0,0,0],x=0;3>x;x++)b=0>n[x]?-1:1,s[x]=(b*p[x]+n[x]*f[x])*this.globalScale;for(x=0;3>x;x++)o[x]=t[x]*s[0],l[x]=r[x]*s[1],h[x]=i[x]*s[2],c[x]=e[x]+m[0]*o[x]+m[1]*l[x]+m[2]*h[x],"MIRROR"==v&&(u[x]=-o[x],d[x]=-l[x],g[x]=-h[x],y[x]=c[x],0>n[0]&&(c[x]-=o[x],y[x]-=u[x]));0>h[0]*(o[1]*l[2]-o[2]*l[1])+h[1]*(o[2]*l[0]-o[0]*l[2])+h[2]*(o[0]*l[1]-o[1]*l[0])&&(h[0]=-h[0],h[1]=-h[1],h[2]=-h[2]),a[0]=[c,o,l,h],"MIRROR"==v&&(0>g[0]*(u[1]*d[2]-u[2]*d[1])+g[1]*(u[2]*d[0]-u[0]*d[2])+g[2]*(u[0]*d[1]-u[1]*d[0])&&(g[0]=-g[0],g[1]=-g[1],g[2]=-g[2]),a[1]=[y,u,d,g])}else if("AXES_2D"==v||"AXES_3D"==v){var b,w=[0,0,0],_=[0,0,0];for(x=0;3>x;x++)b=0>n[x]?-1:1,w[x]=(b*p[0]+n[x]*f[0])*this.globalScale;for(x=0;3>x;x++)_[x]=e[x]+m[0]*w[0]*t[x]+m[1]*w[1]*r[x]+m[2]*w[2]*i[x];for(var M="AXES_2D"==glyph_repeat_mode?2:3,S=0;S<M;S++){var T=void 0,E=void 0,A=n[S],L=[0,0,0],R=[0,0,0],C=[0,0,0];0==S?(T=t,E=r):1==S?(T=r,E="AXES_2D"==glyph_repeat_mode?t:i):(T=i,E=t);var P=(p[0]+A*f[0])*this.globalScale;L[0]=T[0]*P,L[1]=T[1]*P,L[2]=T[2]*P,C[0]=L[1]*E[2]-E[1]*L[2],C[1]=L[2]*E[0]-E[2]*L[0],C[2]=L[0]*E[1]-L[1]*E[0];var I=Math.sqrt(C[0]*C[0]+C[1]*C[1]+C[2]*C[2]);if(0<I){var O=(p[2]+A*f[2])*this.globalScale/I;"AXES_2D"==v&&0<S&&(O*=-1),C[0]*=O,C[1]*=O,C[2]*=O}if(R[0]=C[1]*L[2]-L[1]*C[2],R[1]=C[2]*L[0]-L[2]*C[0],R[2]=C[0]*L[1]-C[1]*L[0],0<(I=Math.sqrt(R[0]*R[0]+R[1]*R[1]+R[2]*R[2]))){var D=(p[1]+A*f[1])*this.globalScale/I;R[0]*=D,R[1]*=D,R[2]*=D}a[S]=[_,L,R,C]}}return a},N=(t,r,i,n,a)=>{var s=1;"AXES_2D"==v||"MIRROR"==v?s=2:"AXES_3D"==v&&(s=3);var o=t.length/3,l=0;I.length=s;for(var h=0;h<o;h++){var c=3*h,u=[t[c],t[c+1],t[c+2]],d=[r[c],r[c+1],r[c+2]],p=[i[c],i[c+1],i[c+2]],m=[n[c],n[c+1],n[c+2]],f=[a[c],a[c+1],a[c+2]],g=D(u,d,p,m,f,I);if(g.length==s)for(var y=0;y<s;y++){x.elements[0]=g[y][1][0],x.elements[1]=g[y][1][1],x.elements[2]=g[y][1][2],x.elements[3]=0,x.elements[4]=g[y][2][0],x.elements[5]=g[y][2][1],x.elements[6]=g[y][2][2],x.elements[7]=0,x.elements[8]=g[y][3][0],x.elements[9]=g[y][3][1],x.elements[10]=g[y][3][2],x.elements[11]=0,x.elements[12]=g[y][0][0],x.elements[13]=g[y][0][1],x.elements[14]=g[y][0][2],x.elements[15]=1,this.morph.setMatrixAt(l,x);var b=e[l];b&&b.setTransformation(g[y][0],g[y][1],g[y][2],g[y][3]),l++}}this.morph.instanceMatrix.needsUpdate=!0},B=t=>{var r=1;"AXES_2D"==v||"MIRROR"==v?r=2:"AXES_3D"==v&&(r=3);for(var i,n=t.length,a=0,s=0;s<n;s++){i=t[s];for(var o=0;o<r;o++){b.setHex(i),this.morph.setColorAt(a,b);var l=e[a];l&&l.setColour(b),a++}}this.morph.instanceColor.needsUpdate=!0},U=()=>{var e=E,r=A,i=L,n=R,c=C,d=P,p=this.inbuildTime/this.duration*(u-1),m=Math.floor(p),f=1-(p-m),v=Math.ceil(p);if(y){var x=o[m.toString()],_=o[v.toString()],M=t[m.toString()],S=t[v.toString()],T=a[m.toString()],I=a[v.toString()],O=s[m.toString()],D=s[v.toString()],U=l[m.toString()],z=l[v.toString()];E.length=x.length,A.length=x.length,L.length=x.length,R.length=x.length,C.length=x.length;for(var F=0;F<x.length;F++)e[F]=f*x[F]+(1-f)*_[F],r[F]=f*M[F]+(1-f)*S[F],i[F]=f*T[F]+(1-f)*I[F],n[F]=f*O[F]+(1-f)*D[F],c[F]=f*U[F]+(1-f)*z[F]}else e=o[0],r=t[0],i=a[0],n=s[0],c=l[0];if(N(e,r,i,n,c),this.boundingBoxUpdateRequired=!0,null!=h){if(g){var G=h[m.toString()],V=h[v.toString()];d.length=G.length;for(var H=0;H<G.length;H++)b.setHex(G[H]),w.setHex(V[H]),b.setRGB(b.r*f+w.r*(1-f),b.g*f+w.g*(1-f),b.b*f+w.b*(1-f)),d[H]=b.getHex()}else d=h[0];B(d)}};this.showLabel=()=>{for(var t=0;t<e.length;t++)e[t].showLabel(this.morph.material?this.morph.material.color:void 0)},this.hideLabel=()=>{for(var t=0;t<e.length;t++)e[t].hideLabel()};var z=i=>{for(var n=0;n<d;n++){var p=new(r(9344).z)(void 0,void 0,n,this),m=c?c[n]:void 0;(m=m||this.groupName)&&p.setLabel(m),0<u&&p.setFrustumCulled(!1),e[n]=p,this.morph.add(p.getGroup())}i&&this.showLabel(),N(o[0],t[0],a[0],s[0],l[0]),null!=h&&B(h[0]),this.ready=!0,this.boundingBoxUpdateRequired=!0};this.addCustomGlyph=t=>{t.isGlyph&&e.push(t),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(t,i)=>{if(t.isMesh){var n=new(r(9344).z)(void 0,void 0,i,this);return n.fromMesh(t),e.push(n),this.morph.add(n.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,n}},this.forEachGlyph=t=>{for(var r=0;r<e.length;r++)t(e[r])};var F=(e,t)=>(r,i)=>{var n=r.toBufferGeometry();this.geometry.copy(n),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),n.dispose(),i&&i[0]&&(this.morph.material=i[0]),z(t),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),r.dispose(),null!=e&&"function"==typeof e&&e(this)};this.getClosestVertexIndex=function(){var e=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);for(var t,r=o[0],i=r.length/3,n=-1,a=0,s=0;s<i;s++)t=3*s,this._v2.set(r[t],r[t+1],r[t+2]),a=this._v1.distanceTo(this._v2),(-1==n||n>a)&&(n=a,e=s)}return e},this.getClosestVertex=function(){if(-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex()),0<=this.closestVertexIndex&&this.morph){var e=new i.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,x),e.setFromMatrixPosition(x),e}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){_.setFromBufferAttribute(this.morph.geometry.attributes.position);for(var e=0;e<d;e++)this.morph.getMatrixAt(e,x),M.copy(_).applyMatrix4(x),0==e?S.copy(M):S.union(M);if(!S)return;this.cachedBoundingBox.copy(S),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox}},this.setMorphTime=e=>{this.inbuildTime=e>this.duration?this.duration:0>e?0:e,(g||y)&&(U(),y&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!(!(!1===this.ready||0<u)||!g&&!y),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(e){this.globalScale=e,U()},this.dispose=()=>{for(var r=e.length-1;0<=r;r--)e[r].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),t=void 0,a=void 0,s=void 0,o=void 0,l=void 0,h=void 0,this.ready=!1,this.groupName=void 0},this.render=(e,t,r)=>{if(1==t){var i=this.inbuildTime+e;i>this.duration&&(i-=this.duration),this.inbuildTime=i,(g||y)&&U()}this.updateMarker(t,r)}};a.prototype=Object.create(r(7393).c.prototype),t.V=a},4296:(e,t,r)=>{var i=r(8221).A;t.J=function(e,t){var r=e,n=void 0;(n=t?new i(r,.015,t.getStyle()):new i(r,.015)).fontFace="Asap",n.fontWeight=700,n.material.map.generateMipmaps=!1,n.material.sizeAttenuation=!1,n.center.x=-.05,n.center.y=0,this.getPosition=()=>n?[n.position.x,n.position.y,n.position.z]:[0,0,0],this.setPosition=(e,t,r)=>{n&&n.position.set(e,t,r)},this.setColour=e=>{n.color=e.getStyle()},this.setScale=e=>{n&&0<e&&n.scale.set(e,e,1)},this.dispose=()=>{},this.getSprite=()=>n,this.getString=()=>r}},8145:(e,t,r)=>{var i=r(1515),n=r(2515).toBufferGeometry,a=function(){r(7393).c.call(this),this.isLines=!0,this.createLineSegment=(e,t,i)=>{if(e&&t){var a=n(e,i);i.localMorphColour&&a.morphAttributes.color&&(t.onBeforeCompile=r(9960).augmentMorphColor());var s=new(r(1491).D)(a,t);this.setMesh(s,i.localTimeEnabled,i.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addLines=(e,t)=>{if(e&&0<e.length){var r=this.addVertices(e);if(!this.getMorph()){var n=new i.LineBasicMaterial({color:t});r.colorsNeedUpdate=!0,this.createLineSegment(r,n,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}}};a.prototype=Object.create(r(7393).c.prototype),t.q=a},7931:(e,t,r)=>{r(1515),r(2515).toBufferGeometry;var i=r(8233).b,n=r(9236).G,a=r(5807).n,s=function(){r(8145).q.call(this),this.isLines2=!0;var e=Array(300);this.createLineSegment=(e,t,r)=>{if(e&&t){var n=new a;n.setPositions(e),n.colorsNeedUpdate=!0;var s=new i(n,t);s.scale.set(1,1,1),s.computeLineDistances(),this.setMesh(s,r.localTimeEnabled,r.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addVertices=function(t){if(t&&t.length){var r=this.getMorph();r||(this.drawRange=0);var i=3*this.drawRange;if(t.forEach((t=>{e[i++]=t[0],e[i++]=t[1],e[i++]=t[2],this.drawRange++})),!r)for(;300>i;)e[i++]=t[0][0],e[i++]=t[0][1],e[i++]=t[0][2];r&&(r.geometry.setPositions(e),r.computeLineDistances(),this.boundingBoxUpdateRequired=!0)}return e},this.getVerticesByFaceIndex=function(e){var t=2*e*3,r=this.getMorph();if(r&&3*this.drawRange>t){var i=r.geometry.getAttribute("instanceStart");return[[i.data.array[t],i.data.array[++t],i.data.array[++t]],[i.data.array[++t],i.data.array[++t],i.data.array[++t]]]}return[]},this.editVertices=function(t,r){if(t&&t.length){var i=this.getMorph(),n=r+t.length-1;if(!i||0>r||n>=this.drawRange)return;var a=3*r;for(t.forEach((t=>{e[a++]=t[0],e[a++]=t[1],e[a++]=t[2]})),a=3*this.drawRange;300>a;)e[a++]=t[0][0],e[a++]=t[0][1],e[a++]=t[0][2];i.geometry.setPositions(e),i.computeLineDistances(),this.boundingBoxUpdateRequired=!0}return e},this.addLines=(t,r)=>{if(t&&0<t.length){if(this.addVertices(t),!this.getMorph()){var i=new n({color:r,linewidth:1,vertexColors:!1,worldUnits:!1});i.resolution.set(window.innerWidth,window.innerHeight),this.createLineSegment(e,i,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}},this.render=()=>{this.getMorph().material.resolution.set(window.innerWidth,window.innerHeight)}};(s.prototype=Object.create(r(8145).q.prototype)).constructor=s,t.s=s},9801:(e,t,r)=>{var i=r(1515),n=r(2515).updateMorphColorAttribute,a=r(2515).toBufferGeometry;t.U=function(e){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=e,this.addLevel=(e,t)=>{if(e){var r,i=Math.abs(t);for(r=0;r<this.levels.length&&!(i<this.levels[r].distance);r++);this.levels.splice(r,0,{distance:i,morph:e,loaded:!0,loading:!1,url:""}),e.renderOrder=this._renderOrder}},this.levelLoaded=(e,t)=>{if(e){for(var r=Math.abs(t),i=0;i<this.levels.length;i++)if(r===this.levels[i].distance){this._parent.group.add(e),this.levels[i].morph=e,this.levels[i].loaded=!0,this.levels[i].loading=!1;break}this.checkTransparentMesh()}},this.addLevelFromURL=(e,t,r,i,n)=>{this._loader=e;var a,s=this.calculateDistance(t);for(a=0;a<this.levels.length&&!(s<this.levels[a].distance);a++);this.levels.splice(a,0,{distance:s,morph:void 0,loaded:!1,loading:!1,url:r,index:i}),n&&this.loadLevel(a)},this.loadLevel=e=>{var t=this.levels[e];return t.morph||t.loaded||t.loading||(t.loading=!0,this._loader.load(t.url,this.lodLoader(t.distance),void 0,void 0,{index:t.index})),void 0===t.morph},this.calculateDistance=function(e){this._parent.getBoundingBox();var t=this._parent.radius,r=0;return"far"===e?r=4.5*t:"medium"===e?r=2.5*t:"close"==e&&(r=0),r},this.containsLevels=()=>!!(this.levels&&1<this.levels.length),this.checkTransparentMesh=()=>{var e=this.levels[this._currentLevel];this._material&&(this._material.transparent?(!this._secondaryMaterial&&(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=i.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,!e.secondaryMesh&&(e.secondaryMesh=new i.Mesh(e.morph.geometry,this._secondaryMaterial),e.secondaryMesh.renderOrder=e.morph.renderOrder+1,e.secondaryMesh.userData=e.morph.userData,e.secondaryMesh.name=e.morph.name),this._material.side=i.BackSide,this._material.needsUpdate=!0,!e.secondaryMesh.parent&&(e.morph.add(e.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(e.secondaryMesh))):(e.secondaryMesh&&(e.morph.remove(e.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(e.secondaryMesh),this._parent.animationGroup.remove(e.secondaryMesh))),this._material.side=i.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach((e=>{e.morph&&e.morph.geometry&&e.morph.geometry.dispose()})),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{var e=this.levels[this._currentLevel];return e&&e.morph?e.morph:this._parent.morph},this.lodLoader=function(e){return t=>{var n=this._material,s={localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour},o=a(t,s),l=void 0;this._parent.isGeometry?l=new i.Mesh(o,n):this._parent.isLines&&(l=new(r(1491).D)(o,n)),l.userData=this._parent,l.renderOrder=this._renderOrder,t.dispose(),this.levelLoaded(l,e)}},this.updateMorphColorAttribute=e=>{if(this._material&&(this._material.vertexColors==i.VertexColors||1==this._material.vertexColors))if(e){var t=this.getCurrentMorph();n(t.geometry,t)}else this.levels.forEach((e=>{e.morph&&e.morph.geometry&&n(e.morph.geometry,e.morph)}))},this.setColour=e=>{this._material.color=e,this._secondaryMaterial&&(this._secondaryMaterial.color=e),t()},this.setFrustumCulled=e=>{this.levels.forEach((t=>{t.morph&&(t.morph.frustumCulled=e),t.secondaryMesh&&(t.secondaryMesh.frustumCulled=e)}))},this.setMaterial=e=>{e&&(!this._material||this._material.id!==e.id)&&(this._material=e,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=e.clone(),this._secondaryMaterial.side=i.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach((e=>{e.morph&&(e.morph.material=this._material,e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)),e.secondaryMesh&&(e.secondaryMesh.material=this._secondaryMaterial)})))},this.setName=e=>{this.levels.forEach((t=>{t.morph&&(t.morph.name=e),t.secondaryMesh&&(t.secondaryMesh.name=e)}))},this.setRenderOrder=e=>{this._renderOrder=e,this.levels.forEach((t=>{t.morph&&(t.morph.renderOrder=e),t.secondaryMesh&&(t.secondaryMesh.renderOrder=e)}))},this.setVertexColors=e=>{this._material.vertexColors=e,t(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=e)},this.update=(e,t)=>{var r=this.levels;if(1<r.length){var i,n,a=e.cameraObject.position.distanceTo(t),s=-1,o=-1;for(i=0,n=r.length;i<n&&a>=r[i].distance;i++)r[i].morph?(-1<s&&r[s].morph&&(r[s].morph.visible=!1),s=i,r[i].morph.visible=!0,o=-1):o=i;for(-1<o&&this.loadLevel(o);i<n;i++)r[i].morph&&(-1<s?r[i].morph.visible=!1:(r[i].morph.visible=!0,s=i));this._currentLevel!=s&&(this._currentLevel=s,this.checkTransparentMesh())}},this.toggleMarker=(e,t)=>{this.levels.forEach((r=>{r.morph&&(t?r.morph.add(e):r.morph.remove(e))}))};var t=()=>{this.levels.forEach((e=>{e.morph&&e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)}))}}},4834:(e,t,r)=>{var i=r(1515),n=new Image(128,128);n.src=r(2370);var a=new i.Texture;a.image=n,a.needsUpdate=!0;var s=[.02,.03,1],o=new i.SpriteMaterial({map:a,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),l=r(2515).createNewSpriteText,h=function(e){r(7393).c.call(this),this.texture=a;var t=void 0,n=void 0,h=void 0,c=void 0,u=void 0,d=!0;this.morph=new i.Group,this.group=this.morph,this.parent=e,this.isMarker=!0;var p=!1;this.ndc=new i.Vector3;var m=void 0,f=void 0;this.updateVisual=(e,t)=>{var r=1;e!==t&&(r=.6+.4*(1-(this.ndc.z-e)/(t-e))),this.setSpriteSize(r)},this.updateNDC=e=>(this.ndc.copy(this.morph.position),this.ndc.project(e),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(e,t,r)=>{this.morph.position.set(e,t,r)},this.setSpriteSize=e=>{t.scale.set(.015,.02,1),t.scale.multiplyScalar(e)},this.setUserSprite=()=>{c&&(this.morph.add(c),d&&(this.morph.remove(t),f&&this.morph.remove(f),d=!1))},this.setImageForUserSprite=(e,t)=>{c&&(this.morph.remove(c),c=void 0),n&&n.dispose(),h&&h.dispose(),(n=new i.Texture).image=e,n.needsUpdate=!0,h=new i.SpriteMaterial({map:n,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),t||(t=[.05,.05,1]),(c=new i.Sprite(h)).center.set(.5,0),c.scale.set(t[0],t[1],t[2]),c.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{d||(d=!0,this.morph.add(t),c&&this.morph.remove(c),f&&this.morph.add(f))},this.loadUserSprite=(e,t)=>{if(e)if(e!==u){u=e;var r=new Image(128,128);r.crossOrigin="anonymous",r.onload=()=>{this.setImageForUserSprite(r,t)},r.src=e}else this.setUserSprite()},this.dispose=()=>{this.morph&&this.morph.clear(),t&&(t.clear(),t=void 0),f&&(f.material.map.dispose(),f.material.dispose(),f=void 0)},this.isEnabled=()=>p,this.setNumber=e=>{(!e||m!=e)&&f&&(this.morph.remove(f),f.material.map.dispose(),f.material.dispose(),f=void 0),!f&&e&&(f=l(e,.012,"black","Asap",120,700),this.morph.add(f)),m=e},this.getNumber=()=>m||1,this.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{p=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{p=!1,this.morph.visible=!1,this.visible=!1},(()=>{(t=new i.Sprite(o)).center.set(.5,0),this.morph.add(t),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,t.scale.set(s[0],s[1],s[2]),t.userData=this})()};h.prototype=Object.create(r(7393).c.prototype),t.p=h},2970:(e,t,r)=>{function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}var n=r(1515),a=new Image(128,128);a.src=r(7328);var s=new n.Texture;s.image=a,s.needsUpdate=!0;var o=[.02,.03,1],l=new n.SpriteMaterial({map:s,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),h=r(2515).createNewSpriteText,c=function(e){r(7393).c.call(this),this.texture=s;var t=void 0;this.morph=new n.Group,this.group=this.morph,this.isMarkerCluster=!0;var a=!0,c=[];this.markers={};var u=new n.Vector2,d=new n.Vector2,p=Date.now();this.setSpriteSize=e=>{t.scale.set(.015,.02,1),t.scale.multiplyScalar(e)},this.clear=()=>{this.group.clear(),this.markers={}},this.dispose=()=>{this.clear(),this.morph&&this.morph.clear()};var m=e=>{var t=new n.Group,r=new n.Sprite(l);return r.clusterIndex=e,r.center.set(.5,0),r.position.set(0,0,0),r.renderOrder=1e4,r.scale.set(o[0],o[1],o[2]),r.userData=this,t.add(r),this.group.add(t),{group:t,marker:r,label:void 0,number:0,min:[0,0,0],max:[1,1,1]}},f=(e,t)=>{var r=!0,i={members:[],coords:[0,0,0],min:[0,0,0],max:[1,1,1]};for(var n in e)r?(u.set(e[n].ndc.x,e[n].ndc.y),this._b1.setFromPoints([e[n].morph.position]),r=!1,i.members.push(e[n]),i.coords=[e[n].morph.position.x,e[n].morph.position.y,e[n].morph.position.z],t.push(i),delete e[n]):(d.set(e[n].ndc.x,e[n].ndc.y),.1>u.distanceTo(d)&&(i.members.push(e[n]),this._b1.expandByPoint(e[n].morph.position),delete e[n]));i.min=[this._b1.min.x,this._b1.min.y,this._b1.min.z],i.max=[this._b1.max.x,this._b1.max.y,this._b1.max.z],1!=r&&f(e,t)};this.calculate=()=>{if(a&&500<Date.now()-p){var e=[];f(function(e){for(var t,r=1;r<arguments.length;r++)t=null==arguments[r]?{}:arguments[r],r%2?i(Object(t),!0).forEach((function(r){var i,n,a;i=e,n=r,a=t[r],n=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(n),n in i?Object.defineProperty(i,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[n]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}));return e}({},this.markers),e),(e=>{var t=0;for(e.forEach((e=>{var r=e.members.length,i=0;1===r?e.members[0].setVisibility(!0):(e.members.forEach((e=>{i+=e.getNumber(),e.setVisibility(!1)})),!c[t]&&c.push(m(t)),((e,t,r)=>{e.group.visible=!0,e.group.position.set(t.coords[0],t.coords[1],t.coords[2]),(void 0===e.label||r!==e.number)&&(e.label&&(e.group.remove(e.label),e.label.material.map.dispose(),e.label.material.dispose()),e.label=h(r,.012,"black","Asap",120,700),e.number=r,e.group.add(e.label)),e.min=t.min,e.max=t.max})(c[t],e,i),t++)}));t<c.length;t++)c[t].group.visible=!1})(e),p=Date.now(),this.markerUpdateRequired=!1}},this.isEnabled=()=>a,this.enable=()=>{a=!0,this.morph.visible=!0},this.disable=()=>{for(var e in a=!1,this.morph.visible=!1,this.markers){var t;null!==(t=this.markers[e])&&void 0!==t&&t.isMarker&&this.markers[e].isEnabled()&&this.markers[e].setVisibility(!0)}},this.zoomToCluster=t=>!!(void 0!==t&&-1<t&&(this._v1.set(...c[t].min),this._v2.set(...c[t].max),Math.abs(0<this._v1.distanceTo(this._v2))))&&(this._b1.set(this._v1,this._v2),e.translateBoundingBoxToCameraView(this._b1,3,300),this.markerUpdateRequired=!0,!0),this.clusterIsVisible=e=>{var t;return!!(void 0!==e&&-1<e&&c[e])&&(null===(t=c[e].group)||void 0===t?void 0:t.visible)}};c.prototype=Object.create(r(7393).c.prototype),t.p=c},770:(e,t,r)=>{var i=r(1515),n=r(377).O,a=r(2515).toBufferGeometry,s=r(2515).getCircularTexture,o=r(4296).J,l=function(){r(7393).c.call(this),this.isPointset=!0;var e=[];this.createMesh=(e,t,r)=>{if(e&&t){var i=a(e,r),o=s();t.map=o;var l=new n(i,t);this.setMesh(l,r.localTimeEnabled,r.localMorphColour)}};var t=(t,r,n,a)=>{if(n){var s=new i.Color(a),l=new o(n,s);l.setPosition(r[0],r[1],r[2]);var h=l.getSprite();h.material.sizeAttenuation=!1,h.material.alphaTest=.5,h.material.transparent=!0,h.material.depthWrite=!1,h.material.depthTest=!1,this.group.add(h),e[t]=l}};this.addPoints=(e,r,n)=>{if(e&&0<e.length){var a=this.drawRange-1,s=this.addVertices(e);if(!this.getMorph()){var o=new i.PointsMaterial({alphaTest:.5,size:10,color:n,sizeAttenuation:!1});s.colorsNeedUpdate=!0,this.createMesh(s,o,{localTimeEnabled:!1,localMorphColour:!1})}var l=a+e.length,h=0;if(Array.isArray(r)&&r.length===e.length||"string"==typeof r)for(;a+h<l;){var c="string"==typeof r?r:r[h];t(h,e[h],c,n),h++}this.region&&(this.region.pickableUpdateRequired=!0)}},this.setSize=e=>{this.morph&&this.morph.material&&(this.morph.material.size=e,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=e=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=e,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(e){if(0<=e&&this.drawRange>e){var t=this.getMorph().geometry.getAttribute("position");return[t.getX(e),t.getY(e),t.getZ(e)]}},this.editVertices=function(t,r){if(t&&t.length){var i=this.getMorph(),n=r+t.length-1;if(!i||0>r||n>=this.drawRange)return;var a=i.geometry.getAttribute("position"),s=r;t.forEach((t=>{var r=e[s];r&&r.setPosition(t[0],t[1],t[2]),a.setXYZ(s++,t[0],t[1],t[2])})),a.needsUpdate=!0,this.boundingBoxUpdateRequired=!0}},this.render=(e,t,r,i)=>{this.morph&&r&&(this.morph.sizePerPixel=r.pixelHeight),l.prototype.render.call(this,e,t,r,i)}};l.prototype=Object.create(r(7393).c.prototype),t.t=l},9372:(e,t,r)=>{r(1515);var i=r(2515).resolveURL,n=function(e){r(7393).c.call(this),this.isTexturePrimitive=!0,this.texture=e,this.load=(e,t)=>{if(e&&e.images&&e.images.source){var n=new(r(3523).$),a=[];e.images.source.forEach((e=>{a.push(i(e))}));var s=this;n.loadFromImages(a).then((()=>{s.texture=n,s.initialise(e,t)}))}},this.initialise=(e,t)=>{null!=t&&"function"==typeof t&&t(this)}};(n.prototype=Object.create(r(7393).c.prototype)).constructor=n,t.p=n},4291:(e,t,r)=>{function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function n(e){for(var t,r=1;r<arguments.length;r++)t=null==arguments[r]?{}:arguments[r],r%2?i(Object(t),!0).forEach((function(r){var i,n,a;i=e,n=r,a=t[r],n=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(n),n in i?Object.defineProperty(i,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[n]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}));return e}var a=r(1515),s=r(8612),o=function(e){r(9372).p.call(this,e),this.isTextureSlides=!0;var t=[],i={};this.morph=new a.Group,this.group=this.morph,this.morph.userData=this;var o=void 0,l=!0;this.createSlides=e=>{e.forEach((e=>this.createSlide(e)))};var h=(e,t)=>{var r=e.material,i=r.uniforms;switch(e.rotation.x=0,e.rotation.y=0,e.rotation.z=0,e.position.x=0,e.position.y=0,e.position.z=0,t.direction){case"x":var n=-Math.PI/2;e.rotation.y=n,i.direction.value=1,i.slide.value.set(t.value,0,0),e.position.x=t.value;break;case"y":e.rotation.x=Math.PI/2,i.direction.value=2,i.slide.value.set(0,t.value,0),e.position.y=t.value;break;case"z":i.direction.value=3,i.slide.value.set(0,0,t.value),e.position.z=t.value}r.needsUpdate=!0,this.boundingBoxUpdateRequired=!0};this.modifySlideSettings=e=>{e&&e.id&&e.id in i&&i[e.id]&&h(i[e.id],e)},this.createSlide=e=>{if(this.texture&&this.texture.isTextureArray&&this.texture.isReady()&&e&&e.direction&&void 0!==e.value){var r=new a.PlaneGeometry(1,1);r.translate(.5,.5,0);var n=s.getUniforms();n.diffuse.value=this.texture.impl,n.depth.value=this.texture.size.depth,n.flipY.value=l;var o={fs:s.fs,vs:s.vs,uniforms:n,glslVersion:s.glslVersion,side:a.DoubleSide,transparent:!1},c=this.texture.getMaterial(o);c.needsUpdate=!0;var u=new a.Mesh(r,c);u.name=this.groupName,u.userData=this;var d={value:e.value,direction:e.direction,id:u.id};return t.push(d),h(u,d),i[u.id]=u,this.morph.add(u),this.boundingBoxUpdateRequired=!0,d}},this.getTextureSettings=()=>[...t],this.getTextureSettingsWithId=e=>{for(var r=0;r<t.length;r++)if(e===t[r].id)return n({},t[r])},this.getSlides=()=>this.morph?[...this.morph.children]:[],this.removeSlide=e=>{e&&this.removeSlideWithId(e.id)},this.removeSlideWithId=e=>{if(this.morph&&e in i&&i[e]){if(this.morph.getObjectById(e)){var r=i[e];this.morph.remove(r),r.clear(),r.geometry&&r.geometry.dispose(),r.material&&r.material.dispose(),this.boundingBoxUpdateRequired=!0}var n=t.findIndex((t=>t.id===e));-1<n&&t.splice(n,1)}},this.dispose=()=>{this.morph.children.forEach((e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})),r(9372).p.prototype.dispose.call(this),this.boundingBoxUpdateRequired=!0},this.getBoundingBox=()=>{if(this.morph&&this.morph.children&&this.morph.visible&&this.boundingBoxUpdateRequired){this.cachedBoundingBox.makeEmpty();var e=new a.Vector3(0,0,0);this.morph.children.forEach((t=>{((e,t,r)=>{if(t)switch(t.direction.value){case 1:r.copy(t.slide.value),e.expandByPoint(r),r.setY(1),r.setZ(1),e.expandByPoint(r);break;case 2:r.copy(t.slide.value),e.expandByPoint(r),r.setX(1),r.setZ(1),e.expandByPoint(r);break;case 3:r.copy(t.slide.value),e.expandByPoint(r),r.setX(1),r.setY(1),e.expandByPoint(r)}})(this.cachedBoundingBox,t.material.uniforms,e)})),this.morph.updateMatrixWorld(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox},this.applyTransformation=(e,t,r)=>{var i=new a.Matrix4;i.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,0);var n=(new a.Quaternion).setFromRotationMatrix(i);this.morph.position.set(...t),this.morph.quaternion.copy(n),this.morph.scale.set(...r),this.morph.updateMatrix(),this.boundingBoxUpdateRequired=!0},this.setRenderOrder=e=>{this.morph.renderOrder=e},this.initialise=(e,t)=>{if(e){var r=e.locations;r&&0<r.length&&(this.applyTransformation(r[0].orientation,r[0].position,r[0].scale),"flipY"in r[0]&&(l=r[0].flipY)),this.createSlides(e.settings.slides),null!=t&&"function"==typeof t&&t(this)}},this.showEdges=e=>{if(o)o.material.color=e;else{var t=new a.BoxGeometry(1,1,1);t.translate(.5,.5,.5);var r=new a.EdgesGeometry(t);o=new a.LineSegments(r,new a.LineBasicMaterial({color:e})),this.group.add(o)}o.visible=!0},this.hideEdges=()=>{o&&(o.visible=!1)}};(o.prototype=Object.create(r(9372).p.prototype)).constructor=o,t.W=o},7393:(e,t,r)=>{var i=r(1515),n=r(2515).createBufferGeometry,a=r(2515).resolveURL,s=0,o=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new i.Group,this._lod=new(r(9801).U)(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new i.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid="pr"+s++,this._v1=new i.Vector3,this._v2=new i.Vector3,this._b1=new i.Box3,this.center=new i.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1};o.prototype.setDuration=function(e){this.duration=e,this.clipAction&&this.clipAction.setDuration(this.duration)},o.prototype.getDuration=function(){return this.duration},o.prototype.setRegion=function(e){this.region=e},o.prototype.getRegion=function(){return this.region},o.prototype.getMorph=function(){return this._lod.getCurrentMorph()||this.morph},o.prototype.getGroup=function(){return this.group},o.prototype.setMorph=function(e){this.morph=e,this.group.add(this.morph);var t=this._lod.calculateDistance("far");this._lod.addLevel(e,t),this._lod.setMaterial(e.material)},o.prototype.checkTransparentMesh=function(){},o.prototype.setMesh=function(e,t,r){this.animationGroup=new i.AnimationObjectGroup(e),this.mixer=new i.AnimationMixer(this.animationGroup);var n=e.geometry;if(this.geometry=e.geometry,this.clipAction=void 0,n&&n.morphAttributes){var a=n.morphAttributes.position;a||(a=n.morphAttributes.color?n.morphAttributes.color:n.morphAttributes.normal),a&&(this.animationClip=i.AnimationClip.CreateClipsFromMorphTargetSequences(a,10,!0),this.animationClip&&null!=this.animationClip[0]&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=i.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=t,this.morphColour=r,e.userData=this,e.matrixAutoUpdate=!1,this.setMorph(e),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(n.setAttribute("morphTarget0",n.getAttribute("position")),n.setAttribute("morphTarget1",n.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},o.prototype.setAnatomicalId=function(e){this.anatomicalId=e},o.prototype.setName=function(e){this.groupName=e,this._lod.setName(e)},o.prototype.getCurrentTime=function(){if(this.clipAction){var e=this.clipAction.time/this.clipAction._clip.duration;return this.duration*e}return this.inbuildTime},o.prototype.setMorphTime=function(e){var t=!1;if(this.clipAction){var r=e/this.duration*this.clipAction._clip.duration;r!=this.clipAction.time&&(this.clipAction.time=r,t=!0),t&&this.isTimeVarying()&&this.mixer.update(0)}else{var i;(i=e>this.duration?this.duration:0>e?0:e)!=this.inbuildTime&&(this.inbuildTime=i,t=!0)}t&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},o.prototype.isTimeVarying=function(){return!(!this.timeEnabled&&!this.morphColour)},o.prototype.getVisibility=function(){return this.visible},o.prototype.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.region&&(this.region.pickableUpdateRequired=!0))},o.prototype.setAlpha=function(e){var t=this._lod._material,r=!1;1>e&&(r=!0),t.opacity=e,t.transparent=r,this.checkTransparentMesh()},o.prototype.setFrustumCulled=function(e){this._lod.setFrustumCulled(e)},o.prototype.setVertexColors=function(e){this._lod.setVertexColors(e)},o.prototype.getColour=function(){return this._lod._material?this._lod._material.color:void 0},o.prototype.setColour=function(e){this._lod.setColour(e)},o.prototype.setGreyScale=function(e){if(e){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour((new i.Color).setHex(12303291)),!0}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},o.prototype.getColourHex=function(){return!this.morphColour&&this._lod._material&&this._lod._material.color?this._lod._material.color.getHexString():void 0},o.prototype.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e)},o.prototype.setEmissiveRGB=function(e){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...e)},o.prototype.setMaterial=function(e){this._lod.setMaterial(e)},o.prototype.getClosestVertexIndex=function(){var e=-1,t=this.getMorph();if(t&&t.geoemtry){var r=t.geometry.attributes.position;if(this._b1.setFromBufferAttribute(r),this._b1.getCenter(this._v1),r)for(var i=-1,n=0,a=0;a<r.count;a++)this._v2.fromArray(r.array,3*a),n=this._v2.distanceTo(this._v1),-1==i?i=n:i>n&&(i=n,e=a)}return e},o.prototype.getClosestVertex=function(e){var t=new i.Vector3;-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex());var r=this.getMorph();if(r&&r.geometry&&0<=this.closestVertexIndex){var n=r.morphTargetInfluences,a=r.geometry.morphAttributes;if(!(n&&a&&a.position))return t.fromArray(r.geometry.attributes.position.array,3*this.closestVertexIndex),e?t.applyMatrix4(r.matrixWorld):t;for(var s=!1,o=0;o<n.length;o++)0<n[o]&&(s=!0,this._v1.fromArray(a.position[o].array,3*this.closestVertexIndex),t.add(this._v1.multiplyScalar(n[o])));if(s)return e?t.applyMatrix4(r.matrixWorld):t}return this.getBoundingBox(),t.copy(this.center),e?t.applyMatrix4(this.morph.matrixWorld):t},o.prototype.getBoundingBox=function(){if(this.visible){var e=this._lod.getCurrentMorph();if(e&&e.visible)return this.boundingBoxUpdateRequired&&(r(2515).getBoundingBox(e,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),this.boundingBoxUpdateRequired=!1),this.cachedBoundingBox}},o.prototype.dispose=function(){this._lod.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.group=void 0,this.clipAction=void 0,this.groupName=void 0},o.prototype.markerIsRequired=function(e){return!(!this.visible||!("on"===this.markerMode||e&&e.displayMarkers&&"inherited"===this.markerMode))},o.prototype.updateMarker=function(e,t){if(0==e&&this.markerIsRequired(t)){var i=t.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new(r(4834).p)(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){var n=this.getClosestVertex(!1);n&&(this.marker.setPosition(n.x,n.y,n.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(t.markersList&&!(this.marker.uuid in t.markersList)&&(i=!0,t.markersList[this.marker.uuid]=this.marker),this.marker.enable(),this.group.add(this.marker.morph)),this.marker.setNumber(this.markerNumber),this.markerImgURL?this.marker.loadUserSprite(this.markerImgURL):this.marker.setDefaultSprite(),t&&t.camera&&(i||t.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(t.camera.cameraObject),t.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),t.markersList&&this.marker.uuid in t.markersList&&(t.markerCluster.markerUpdateRequired=!0,delete t.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},o.prototype.processMarkerVisual=function(e,t){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(e,t)},o.prototype.initiateMorphColor=function(){1==this.morphColour&&this._lod.updateMorphColorAttribute(!1)},o.prototype.setRenderOrder=function(e){this._lod.setRenderOrder(e)},o.prototype.getClosestVertexDOMElementCoords=function(e){if(e&&e.camera){var t=!0,r=this.getClosestVertex(!0);return r.project(e.camera),r.z=Math.min(Math.max(r.z,0),1),(1<r.x||-1>r.x||1<r.y||-1>r.y)&&(t=!1),e.getZincCameraControls().getRelativeCoordsFromNDC(r.x,r.y,r),{position:r,inView:t}}},o.prototype.setMarkerMode=function(e,t){e!==this.markerMode&&(this.markerMode="on"===e||"off"===e?e:"inherited",this.region&&(this.region.pickableUpdateRequired=!0)),t&&(this.markerNumber=t.number,this.markerImgURL=t.imgURL)},o.prototype.render=function(e,t,r,i){if(this.visible&&!(this.timeEnabled&&t)&&this._lod.update(r,this.center),1==t){if(this.clipAction&&this.isTimeVarying())this.mixer.update(e);else{var n=this.inbuildTime+e;n>this.duration&&(n-=this.duration),this.inbuildTime=n}this.visible&&0!=e&&(this.boundingBoxUpdateRequired=!0,1==this.morphColour&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(t,i)},o.prototype.addLOD=function(e,t,r,i,n){this._lod.addLevelFromURL(e,t,r,i,n)},o.prototype.addVertices=function(e){var t=this.getMorph(),r=void 0;if(t){if(-1<this.drawRange){var i=t.geometry.getAttribute("position");e.forEach((e=>{i.setXYZ(this.drawRange,e[0],e[1],e[2]),++this.drawRange})),i.needsUpdate=!0,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),r=t.geoemtry,this.boundingBoxUpdateRequired=!0}}else r=n(500,e),this.drawRange=e.length;return r},o.prototype.setPosition=function(e,t,r){var i=this.getGroup();i&&(i.position.set(e,t,r),i.updateMatrix(),this.boundingBoxUpdateRequired=!0)},o.prototype.loadAdditionalSources=function(e){e.load(a(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},o.prototype.setScaleAll=function(e){var t=this.getGroup();t&&(t.scale.set(e,e,e),t.updateMatrix(),this.boundingBoxUpdateRequired=!0)},t.c=o},2843:(e,t,r)=>{var{Group:i,Matrix4:n}=r(1515),a=r(770).t,s=(r(8145).q,r(7931).s),o=r(5672).V,l=r(1515),h=0,c=function(e,t){var r=e,u=new i;u.matrixAutoUpdate=!1,u.userData=this;var d=[],p="",m=[],f=t,v=new n,g=3e3;v.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.pickableUpdateRequired=!0,this.isRegion=!0,this.uuid="re"+h++,this.hideAllPrimitives=()=>{d.forEach((e=>e.hideAllPrimitives())),m.forEach((e=>e.setVisibility(!1)))},this.showAllPrimitives=()=>{d.forEach((e=>e.showAllPrimitives())),m.forEach((e=>e.setVisibility(!0)))},this.setVisibility=e=>{e!=u.visible&&(u.visible=e,this.pickableUpdateRequired=!0)},this.getVisibility=()=>u.visible,this.getGroup=()=>u,this.setTransformation=e=>{v.set(...e),u.matrix.copy(v),u.updateMatrixWorld()},this.setName=e=>{e&&""!==e&&(p=e)},this.getName=()=>p,this.getParent=()=>r,this.getFullSeparatedPath=()=>{var e=[];if(""!==p){e.push(p);for(var t,i=r;void 0!==i;)""!==(t=i.getName())&&e.unshift(t),i=i.getParent()}return e},this.getFullPath=()=>{var e=this.getFullSeparatedPath();if(0<e.length){var t=e.shift();return e.forEach((e=>{t=t.concat("/",e)})),t}return""},this.createChild=e=>{var t=new c(this,f);return t.setName(e),d.push(t),u.add(t.getGroup()),t},this.getChildWithName=e=>{if(e)for(var t=e.toLowerCase(),r=0;r<d.length;r++)if(d[r].getName().toLowerCase()===t)return d[r]},this.findChildFromSeparatedPath=e=>{if(e&&0<e.length&&""===e[0]&&e.shift(),e&&0<e.length){var t=this.getChildWithName(e[0]);return t?(e.shift(),t.findChildFromSeparatedPath(e)):void 0}return this},this.findChildFromPath=e=>{var t=e.split("/");return this.findChildFromSeparatedPath(t)},this.createChildFromSeparatedPath=e=>{if(0<e.length&&""===e[0]&&e.shift(),0<e.length){var t=this.getChildWithName(e[0]);return t||(t=this.createChild(e[0])),e.shift(),t.createChildFromSeparatedPath(e)}return this},this.createChildFromPath=e=>{var t=e.split("/");return this.createChildFromSeparatedPath(t)},this.findOrCreateChildFromPath=e=>{var t=this.findChildFromPath(e);return t||(t=this.createChildFromPath(e)),t},this.addZincObject=e=>{e&&(e.setRegion(this),u.add(e.getGroup()),m.push(e),this.pickableUpdateRequired=!0,f&&f.triggerObjectAddedCallback(e))},this.removeZincObject=e=>{for(var t=0;t<m.length;t++)if(e===m[t])return u.remove(e.getGroup()),m.splice(t,1),f&&f.triggerObjectRemovedCallback(e),e.dispose(),void(this.pickableUpdateRequired=!0)},this.checkPickableUpdateRequred=e=>{if(this.pickableUpdateRequired)return!0;if(e)for(var t=0;t<d.length;t++)if(d[t].checkPickableUpdateRequred(e))return!0;return!1},this.getPickableThreeJSObjects=(e,t)=>(u.visible&&(m.forEach((t=>{if(t.getGroup()&&t.getGroup().visible){var r=t.marker;r&&r.isEnabled()&&e.push(r.getMorph()),e.push(t.getGroup())}})),t&&d.forEach((r=>{r.getPickableThreeJSObjects(e,t)})),this.pickableUpdateRequired=!1),e),this.setDuration=e=>{g=e,m.forEach((t=>t.setDuration(e))),d.forEach((t=>t.setDuration(e)))},this.getDuration=()=>g,this.getBoundingBox=e=>{var t,r;return m.forEach((e=>{(r=e.getBoundingBox())&&(null==t?t=r.clone():t.union(r))})),e&&d.forEach((i=>{(r=i.getBoundingBox(e))&&(null==t?t=r.clone():t.union(r))})),t},this.clear=e=>{e&&d.forEach((t=>t.clear(e))),m.forEach((e=>{u.remove(e.getGroup()),e.dispose()})),d=[],m=[]},this.objectIsInRegion=(e,t)=>{for(var r=0;r<m.length;r++)if(e===m[r])return!0;if(t)for(var i=0;i<d.length;i++)if(d[i].objectIsInRegion(e,t))return!0;return!1},this.forEachGeometry=(e,t)=>{m.forEach((t=>{t.isGeometry&&e(t)})),t&&d.forEach((r=>r.forEachGeometry(e,t)))},this.forEachGlyphset=(e,t)=>{m.forEach((t=>{t.isGlyphset&&e(t)})),t&&d.forEach((r=>r.forEachGlyphset(e,t)))},this.forEachPointset=(e,t)=>{m.forEach((t=>{t.isPointset&&e(t)})),t&&d.forEach((r=>r.forEachPointset(e,t)))},this.forEachLine=(e,t)=>{m.forEach((t=>{t.isLines&&e(t)})),t&&d.forEach((r=>r.forEachLine(e,t)))},this.findObjectsWithAnatomicalId=(e,t)=>(m.forEach((t=>{t.anatomicalId===e&&objectsArray.push(t)})),t&&d.forEach((r=>{var i=r.findObjectsWithAnatomicalId(e,t);objectsArray.push(...i)})),objectsArray),this.findObjectsWithGroupName=(e,t)=>{var r=[];return m.forEach((t=>{(t.groupName?t.groupName.toLowerCase():t.groupName)===(e?e.toLowerCase():e)&&r.push(t)})),t&&d.forEach((i=>{var n=i.findObjectsWithGroupName(e,t);r.push(...n)})),r},this.findGeometriesWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter((e=>e.isGeometry)),this.findPointsetsWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter((e=>e.isPointset)),this.findGlyphsetsWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter((e=>e.isGlyphset)),this.findLinesWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter((e=>e.isLines)),this.getAllObjects=e=>{var t=[...m];return e&&d.forEach((r=>{var i=r.getAllObjects(e);t.push(...i)})),t},this.getChildRegions=e=>{var t=[...d];return e&&d.forEach((r=>{var i=r.getChildRegions(e);t.push(...i)})),t},this.getCurrentTime=()=>{if(null!=m[0])return m[0].getCurrentTime();for(var e,t=0;t<d.length;t++)if(-1!==(e=d[t].getCurrentTime()))return e;return-1},this.setMorphTime=(e,t)=>{m.forEach((t=>{t.setMorphTime(e)})),t&&d.forEach((t=>{t.setMorphTime(e)}))},this.isTimeVarying=()=>{for(var e=0;e<m.length;e++)if(m[e].isTimeVarying())return!0;for(var t=0;t<d.length;t++)if(d[t].isTimeVarying())return!0;return!1},this.renderGeometries=(e,t,r,i,n,a)=>{var s;this.getAllObjects(a).forEach((a=>{a.render(e*t,r,i,n)})),n&&!1===r&&null!==(s=n.markerCluster)&&void 0!==s&&s.markerUpdateRequired&&n.markerCluster.calculate()},this.createPoints=(e,t,r,i)=>{var n=!1,s=this.findObjectsWithGroupName(e,!1),o=s.findIndex((e=>e.isPointset)),l=-1<o?s[o]:new a;return l.addPoints(t,r,i),-1===o?(l.setName(e),this.addZincObject(l),n=!0):this.pickableUpdateRequired=!0,{zincObject:l,isNew:n}},this.createLines=(e,t,r)=>{var i=!1,n=this.findObjectsWithGroupName(e,!1),a=n.findIndex((e=>e.isLines)),o=-1<a?n[a]:new s;return o.addLines(t,r),-1===a?(o.setName(e),this.addZincObject(o),i=!0):this.pickableUpdateRequired=!0,{zincObject:o,isNew:i}},this.createGeometryFromThreeJSGeometry=(e,t,r,i,n,a)=>{var s=new o,h=new l.MeshPhongMaterial({color:r,morphTargets:!1,morphNormals:!1,transparent:!0,opacity:i,side:l.DoubleSide});return s.createMesh(t,h,{localTimeEnabled:!1,localMorphColour:!1}),s.getMorph()?(s.setVisibility(!1),s.setName(e),s.setRenderOrder(a),this.addZincObject(s),s):void 0}};t.T=c},3260:(e,t,r)=>{var i=r(1515),n=r(164);t.A=function(e){var t=e,a=void 0,s=void 0,o=new i.Clock(!1);this.playAnimation=!0;var l=1e3,h=[],c=0,u=[],d=0,p=void 0,m=void 0,f=void 0,v=void 0,g=[],y=[],x=new i.Group,b=void 0,w=void 0,_=!1,M=[0,0],S=[0,0];this.getDrawingWidth=()=>t?t.clientWidth:b?void 0===b.clientWidth?Math.round(b.width):Math.round(b.clientWidth):0,this.getDrawingHeight=()=>t?t.clientHeight:b?void 0===b.clientHeight?Math.round(b.height):Math.round(b.clientHeight):0,this.onWindowResize=()=>{s.onWindowResize();var e=this.getDrawingWidth(),r=this.getDrawingHeight();if(null!=a){var n;t?(n=t.getBoundingClientRect(),a.setSize(e,r)):b&&(void 0===b.getBoundingClientRect||(n=b.getBoundingClientRect(),b.width=e,b.height=r),a.setSize(e,r,!1)),n&&(S[0]=n.left,S[1]=n.top);var o=new i.Vector2;a.getSize(o),M[0]=o.x,M[1]=o.y}},this.initialiseVisualisation=e=>{if(void 0===(e=e||{}).antialias){var r=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(r=!0)}catch(e){r=!1}e.antialias=!r}e.canvas&&(t=void 0,b=e.canvas),a=new i.WebGLRenderer(e),void 0!==t&&t.appendChild(a.domElement),a.setClearColor(16777215,1),b&&b.style&&(b.style.height="100%",b.style.width="100%"),a.autoClear=!1;var n=this.createScene("default");this.setCurrentScene(n)},this.getCurrentScene=()=>s,this.setCurrentScene=e=>{if(e){this.removeActiveScene(e);var t=s;s=e,t&&t.setInteractiveControlEnable(!1),s.setInteractiveControlEnable(!0),s.setAdditionalScenesGroup(x),this.onWindowResize()}},this.getSceneByName=e=>g[e],this.createScene=e=>{var i;if(null==g[e])return i=b?new(r(5015).Z)(b,a):new(r(5015).Z)(t,a),g[e]=i,i.sceneName=e,i},this.resetView=()=>{s.resetView()},this.viewAll=()=>{if(s){var e=s.getBoundingBox();if(e){for(var t,r=0;r<y.length;r++)(t=y[r].getBoundingBox())&&e.union(t);s.viewAllWithBoundingBox(e)}}},this.loadModelsURL=(e,t,r,i,n,a)=>{s.loadModelsURL(e,t,r,i,n,a)},this.loadViewURL=e=>{s.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{s.loadFromViewURL(e,t)},this.updateDirectionalLight=()=>{s.updateDirectionalLight()};var T=()=>{_?(p=requestAnimationFrame(T),this.render()):(cancelAnimationFrame(p),p=void 0)};this.stopAnimate=()=>{_&&(o.stop(),_=!1)},this.animate=()=>{_||(o.start(),_=!0,T())},Date.now(),this.addPreRenderCallbackFunction=e=>(++c,h[c]=e,c),this.removePreRenderCallbackFunction=e=>{e in h&&delete h[e]},this.addPostRenderCallbackFunction=e=>(++d,u[d]=e,d),this.removePostRenderCallbackFunction=e=>{e in u&&delete u[e]},this.getPlayRate=()=>l,this.setPlayRate=e=>{l=e},this.getCurrentTime=()=>s.getCurrentTime(),this.setMorphsTime=e=>{s.setMorphsTime(e)},this.getZincGeometryByID=e=>s.getZincGeometryByID(e),this.addToScene=e=>{s.addObject(e)},this.addToOrthoScene=e=>{if(null==f&&(f=new i.Scene),null==m){var t=this.getDrawingWidth(),r=this.getDrawingHeight();(m=new i.OrthographicCamera(-t/2,t/2,r/2,-r/2,1,10)).position.z=10}f.add(e)};var E=e=>t=>{t.needsUpdate=!0;var r=new i.SpriteMaterial({map:t}),n=r.map.image.width,a=r.map.image.height;e.material=r,e.scale.set(n,a,1);var s=this.getDrawingWidth(),o=this.getDrawingHeight();e.position.set((s-n)/2,(-o+a)/2,1),this.addToOrthoScene(e)};this.addLogo=()=>{v=new i.Sprite,i.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png",void 0,E(v))},this.render=()=>{w||(t?0<t.clientWidth&&0<t.clientHeight&&(w=new n(t,this.onWindowResize)):b&&0<b.width&&0<b.height&&(w=new n(b,this.onWindowResize)));var e=o.getDelta();s.renderGeometries(l,e,this.playAnimation);for(var r=0;r<y.length;r++)y[r].renderGeometries(l,e,this.playAnimation);for(var i in null!=m&&null!=f&&(a.clearDepth(),a.render(f,m)),h)h.hasOwnProperty(i)&&h[i].call();for(var c in s.render(a),u)u.hasOwnProperty(c)&&u[c].call()},this.getThreeJSRenderer=()=>a,this.isSceneActive=e=>{if(s===e)return!0;for(var t=0;t<y.length;t++)if(y[t]===e)return!0;return!1},this.addActiveScene=e=>{this.isSceneActive(e)||(y.push(e),x.add(e.getThreeJSScene()))},this.removeActiveScene=e=>{for(var t=0;t<y.length;t++)if(y[t]===e)return y.splice(t,1),void x.remove(e.getThreeJSScene())},this.clearAllActiveScene=()=>{for(var e=0;e<y.length;e++)x.remove(y[e].getThreeJSScene());y.splice(0,y.length)},this.dispose=()=>{for(var e in _&&cancelAnimationFrame(p),g)g.hasOwnProperty(e)&&g[e].clearAll();g=[],y=[],x=new i.Group,this.stopAnimate(),h=[],c=0,m=void 0,f=void 0,v=void 0;var t=this.createScene("default");this.setCurrentScene(t),w=void 0},this.transitionScene=(e,t)=>{if(s){var r=s.getZincCameraControls(),i=e.getBoundingBox();if(i){var n=i.min.distanceTo(i.max)/2,a=(i.min.x+i.max.x)/2,o=(i.min.y+i.max.y)/2,l=(i.min.z+i.max.z)/2,h=r.getViewportFromCentreAndRadius(a,o,l,n,40,4*n),c=r.getCurrentViewport();r.cameraTransition(c,h,t),r.enableCameraTransition()}}},this.isWebGL2=()=>!!a&&a.capabilities.isWebGL2}},5015:(e,t,r)=>{var i=r(1515),n=r(2970).p,a=r(6264).c,s=r(3778).O,o=r(701).Viewport,l=r(2515).createBufferGeometry,h=r(2515).getCircularTexture,c=r(2515).createNewSpriteText,u=0;t.Z=function(e,t){var d=this,p=e,m=void 0,f=new a(this),v=void 0,g={},y=0,x={},b=0,w=new i.Scene,_=new i.Scene,M=new(r(2843).T)(void 0,this);w.add(M.getGroup());var S=new i.Group;w.add(S),this.directionalLight=void 0,this.ambient=void 0,this.camera=void 0;var T=6e3,E=void 0;this.sceneName=void 0;var A=!1,L=void 0;this.autoClearFlag=!0,this.displayMarkers=!1,this.displayMinimap=!1,this.displayMiniAxes=!1,this.minimapScissor={x_offset:16,y_offset:16,width:128,height:128,align:"top-right",updateRequired:!0};var R={x:0,y:0},C={Duration:"6 secs",OriginalDuration:"-",TimeStamps:{}},P=new i.Vector2,I=[];this.forcePickableObjectsUpdate=!1,this.uuid="sc"+u++;var O=new n(this);O.disable(),w.add(O.group);var D={main:[],mini:[]},N=new i.Vector3(0,0,0),B=()=>p?void 0===p.clientWidth?p.width:p.clientWidth:0,U=()=>p?void 0===p.clientHeight?p.height:p.clientHeight:0;this.getDownloadProgress=()=>f.getDownloadProgress(),this.onWindowResize=()=>{var e=U();this.camera.aspect=B()/e,this.camera.updateProjectionMatrix(),this.minimapScissor.updateRequired=!0,E.onResize(),E.calculateHeightPerPixelAtZeroDepth(e)},this.resetView=()=>{this.onWindowResize(),E.resetView()},this.changeZoomByScrollRateUnit=e=>{E.changeZoomByScrollRateUnit(e)},(()=>{this.camera=new i.PerspectiveCamera(40,B()/U(),0,10),this.ambient=new i.AmbientLight(16777215,.2),w.add(this.ambient),this.directionalLight=new i.DirectionalLight(16777215,.8),w.add(this.directionalLight),(E=new(r(701).CameraControls)(this.camera,t.domElement,t,this)).setDirectionalLight(this.directionalLight),E.resetView(),v=new(r(7404).U)(this)})(),this.loadView=e=>{var t=new o;return t.setFromObject(e),E.setCurrentCameraSettings(t),!0},this.setupMultipleViews=(e,t)=>{for(var[r,i]of Object.entries(t)){var n=new o;n.setFromObject(i),E.addViewport(r,n)}E.setDefaultViewport(e)},this.getBoundingBox=()=>M.getBoundingBox(!0),this.viewAllWithBoundingBox=e=>{if(e){var t=E.getViewportFromBoundingBox(e,1);E.setCurrentCameraSettings(t),E.calculateHeightPerPixelAtZeroDepth(U()),O.markerUpdateRequired=!0}},this.viewAll=()=>{var e=this.getBoundingBox();this.viewAllWithBoundingBox(e),O.markerUpdateRequired=!0},this.forEachGeometry=e=>{M.forEachGeometry(e,!0)},this.forEachGlyphset=e=>{M.forEachGlyphset(e,!0)},this.forEachPointset=e=>{M.forEachPointset(e,!0)},this.forEachLine=e=>{M.forEachLine(e,!0)},this.findGeometriesWithGroupName=e=>M.findGeometriesWithGroupName(e,!0),this.findPointsetsWithGroupName=e=>M.findPointsetsWithGroupName(e,!0),this.findGlyphsetsWithGroupName=e=>M.findGlyphsetsWithGroupName(e,!0),this.findLinesWithGroupName=e=>M.findLinesWithGroupName(e,!0),this.findObjectsWithGroupName=e=>M.findObjectsWithGroupName(e,!0),this.findObjectsWithAnatomicalId=e=>M.findObjectsWithAnatomicalId(e,!0),this.getBoundingBoxOfZincObjects=e=>{for(var t,r=void 0,i=0;i<e.length;i++)(t=e[i].getBoundingBox())&&(r?r.union(t):r=t);return r},this.vectorToScreenXY=e=>{e.project(this.camera);var t=B()/2,r=U()/2;return e.x=e.x*t+t,e.y=-e.y*r+r,e},this.getObjectsScreenXY=e=>{if(e&&0<e.length){var t=this.getBoundingBoxOfZincObjects(e),r=new i.Vector3;return t.getCenter(r),this.vectorToScreenXY(r)}},this.getNamedObjectsScreenXY=e=>{var t=this.findObjectsWithGroupName(e);return this.getObjectsScreenXY(t)},this.addZincObject=e=>{e&&(M.addZincObject(e),E&&E.calculateMaxAllowedDistance(this))},this.loadGlyphsetURL=(e,t,r,i)=>{f.loadGlyphsetURL(M,e,t,r,i)},this.loadPointsetURL=(e,t,r,i,n)=>{f.loadPointsetURL(M,e,t,r,i,n)},this.loadLinesURL=(e,t,r,i,n)=>{f.loadLinesURL(M,e,t,r,i,n)},this.loadSTL=(e,t,r)=>{f.loadSTL(M,e,t,r)},this.loadOBJ=(e,t,r)=>{f.loadOBJ(M,e,t,r)},this.loadMetadataURL=(e,t,r,i)=>{f.loadMetadataURL(M,e,t,r,i)},this.loadModelsURL=(e,t,r,i,n,a)=>{f.loadModelsURL(M.urls,t,r,i,n,a)},this.loadViewURL=e=>{f.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{f.loadFromViewURL(e,t)},this.loadGLTF=(e,t,r,i)=>{f.loadGLTF(M,e,t,r,i)},this.updateDirectionalLight=()=>{E.updateDirectionalLight()},this.addObject=e=>{w.add(e)},this.removeObject=e=>{w.remove(e)},this.getCurrentTime=()=>{if(null!=m)return m.getCurrentTime(T);var e=M.getCurrentTime();return-1===e?0:e},this.setMorphsTime=e=>{null!=m&&m.setMorphTime(e,T),M.setMorphTime(e,!0)},this.isTimeVarying=()=>!(!m||!m.video||m.video.error)||M.isTimeVarying(),this.renderGeometries=(e,t,r)=>{var i={};if(i.camera=E,i.displayMarkers=this.displayMarkers,i.markerCluster=O,i.markersList=O.markers,i.ndcToBeUpdated=!1,r&&(i.markerCluster.markerUpdateRequired=!0),m)if(m.isReadyToPlay()){r?m.video.play():m.video.pause();var n=m.video.currentTime/m.getVideoDuration()*T;0==f.toBeDownloaded?(E.setTime(n),i.ndcToBeUpdated=E.update(0),i.ndcToBeUpdated&&E.calculateHeightPerPixelAtZeroDepth(U()),M.setMorphTime(n,!0),M.renderGeometries(0,0,r,E,i,!0)):E.update(0)}else myPlayRate=0;else 0==f.toBeDownloaded?(i.ndcToBeUpdated=E.update(t),i.ndcToBeUpdated&&E.calculateHeightPerPixelAtZeroDepth(U()),M.renderGeometries(e,t,r,E,i,!0)):E.update(0)},this.getThreeJSScene=()=>w,this.setVideoHandler=e=>{m||(m=e)},this.setAdditionalScenesGroup=e=>{w.add(e)};var z=e=>{var t,r,i,n,a,s,o,l;(this.displayMinimap||this.displayMiniAxes)&&(e.setScissorTest(!0),e.getSize(P),this.minimapScissor.updateRequired&&(t=this.minimapScissor.align,r=this.minimapScissor.x_offset,i=this.minimapScissor.y_offset,n=this.minimapScissor.width,a=this.minimapScissor.height,s=P.x,o=P.y,l=t.includes("top")?o-a-i:t.includes("bottom")?i:Math.floor((o-a)/2),R={x:t.includes("left")?r:t.includes("right")?s-r-n:Math.floor((s-n)/2),y:l},this.minimapScissor.updateRequired=!1),e.setScissor(R.x,R.y,this.minimapScissor.width,this.minimapScissor.height),e.setViewport(R.x,R.y,this.minimapScissor.width,this.minimapScissor.height),v.updateCamera(),this.displayMiniAxes?e.render(_,v.camera):(w.add(v.mask),e.render(w,v.camera),w.remove(v.mask)),e.setScissorTest(!1),e.setViewport(0,0,P.x,P.y))};this.render=e=>{this.autoClearFlag&&e.clear(),A&&L?L.render(w,this.camera):(e.render(w,this.camera),z(e))},this.setInteractiveControlEnable=e=>{1==e?E.enable():E.disable()},this.getZincCameraControls=()=>E,this.getThreeJSScene=()=>w,this.setDuration=e=>{M.setDuration(e),T=e,E.setPathDuration(e),f.duration=e},this.getDuration=()=>T,this.setStereoEffectEnable=e=>{1!=e||L||(L=new r(701).StereoEffect(t)),t.setSize(B(),U()),this.camera.updateProjectionMatrix(),A=e},this.objectIsInScene=e=>M.objectIsInRegion(e,!0),this.alignBoundingBoxToCameraView=(e,t)=>{if(e){e.getCenter(N);var r=this.getZincCameraControls().getCurrentViewport(),n=new i.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),a=new i.Vector3(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),s=new i.Vector3,o=new i.Vector3;s.subVectors(n,a).normalize(),o.subVectors(n,N).normalize();var l=new i.Vector3;l.crossVectors(s,o);var h=s.angleTo(o);0<t?(this.getZincCameraControls().rotateCameraTransition(l,h,t),this.getZincCameraControls().enableCameraTransition()):this.getZincCameraControls().rotateAboutLookAtpoint(l,h),O.markerUpdateRequired=!0}},this.translateBoundingBoxToCameraView=(e,t,r)=>{if(e){var i=this.getZincCameraControls().getCurrentViewport(),n=this.getZincCameraControls().getViewportFromBoundingBox(e,t);0<r&&(this.getZincCameraControls().cameraTransition(i,n,r),this.getZincCameraControls().enableCameraTransition()),O.markerUpdateRequired=!0}},this.alignObjectToCameraView=(e,t)=>{if(this.objectIsInScene(e)){var r=e.getBoundingBox();this.alignBoundingBoxToCameraView(r,t)}},this.setCameraTargetToObject=e=>{if(this.objectIsInScene(e)){var t=e.getBoundingBox(),r=this.getZincCameraControls().getCurrentViewport();t.getCenter(N);var n=new i.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),a=new i.Vector3(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),s=new i.Vector3,o=new i.Vector3;s.subVectors(a,n),o.addVectors(N,s),r.eyePosition[0]=o.x,r.eyePosition[1]=o.y,r.eyePosition[2]=o.z,r.targetPosition[0]=N.x,r.targetPosition[1]=N.y,r.targetPosition[2]=N.z,this.getZincCameraControls().setCurrentCameraSettings(r),O.markerUpdateRequired=!0}},this.isStereoEffectEnable=()=>A,this.removeZincObject=e=>{M.removeZincObject(e),E&&E.calculateMaxAllowedDistance(this),O.markerUpdateRequired=!0},this.updatePickableThreeJSObjects=()=>{I.length=0,O.isEnabled&&I.push(O.group),M.getPickableThreeJSObjects(I,!0),this.forcePickableObjectsUpdate=!1},this.getPickableThreeJSObjects=()=>((this.forcePickableObjectsUpdate||M.checkPickableUpdateRequred(!0))&&this.updatePickableThreeJSObjects(),I),this.getNormalisedMinimapCoordinates=(e,t)=>{if(this.displayMinimap){var r=new i.Vector2;e.getSize(r);var n=r.y-t.clientY;if(R.x+this.minimapScissor.width>t.clientX&&t.clientX>R.x&&R.y+this.minimapScissor.height>n&&n>R.y)return{x:(t.clientX-R.x)/this.minimapScissor.width*2-1,y:(n-R.y)/this.minimapScissor.height*2-1}}},this.getMinimapDiffFromNormalised=(e,t)=>v?v.getDiffFromNormalised(e,t):void 0,this.isWebGL2=()=>t.isWebGL2(),this.clearAll=()=>{O.clear(),M.clear(!0),this.clearZincObjectAddedCallbacks(),this.clearZincObjectRemovedCallbacks(),f.toBeDwonloaded=0,E&&E.calculateMaxAllowedDistance(this),O.markerUpdateRequired=!0},this.addMetadataTimeStamp=(e,t)=>{C.TimeStamps[e]=G(t)},this.getMetadataTag=e=>C[e],this.getMetadata=()=>C,this.setMetadataTag=(e,t)=>{C[e]=t},this.removeMetadataTag=e=>{delete C[e]},this.resetMetadata=()=>{C={Duration:"6 secs",OriginalDuration:"-",TimeStamps:{}}},this.resetDuration=()=>{this.setDuration(6e3)};var F=e=>[...e.years?["".concat(e.years,"years")]:[],...e.months?["".concat(e.months,"months")]:[],...e.weeks?["".concat(e.weeks,"weeks")]:[],...e.days?["".concat(e.days,"days")]:[],...e.hours?["".concat(e.hours,"hours")]:[],...e.mins?["".concat(e.mins,"mins")]:[],...e.secs?["".concat(e.secs,"secs")]:[]].join(" "),G=e=>e.years?31536e6*e.years:0+e.months?2592e6*e.months:0+e.weeks?6048e5*e.weeks:0+e.days?864e5*e.days:0+e.hours?36e5*e.hours:0+e.mins?6e4*e.mins:0+e.secs?1e3*e.secs:0;this.setDurationFromObject=e=>{var t=F(e),r=G(e);this.setMetadataTag("Duration",t),this.setDuration(r)},this.setOriginalDurationFromObject=e=>{var t=F(e);this.setMetadataTag("OriginalDuration",t)},this.exportGLTF=e=>new s(this).exportGLTF(e),this.getRootRegion=()=>M,this.createLines=(e,t,r,i)=>{var n=M.findChildFromPath(e);return void 0===n&&(n=M.createChildFromPath(e)),n.createLines(t,r,i)},this.createPoints=(e,t,r,i,n)=>{var a=M.findChildFromPath(e);return void 0===a&&(a=M.createChildFromPath(e)),a.createPoints(t,r,i,n)},this.addZincObjectAddedCallbacks=e=>(++y,g[y]=e,y),this.addZincObjectRemovedCallbacks=e=>(++b,x[b]=e,b),this.removeZincObjectAddedCallbacks=e=>{e in y&&delete g[e]},this.removeZincObjectRemovedCallbacks=e=>{e in b&&delete x[e]},this.clearZincObjectAddedCallbacks=()=>{g={},y=0},this.clearZincObjectRemovedCallbacks=()=>{x={},b=0},this.triggerObjectAddedCallback=e=>{for(var t in g)g.hasOwnProperty(t)&&g[t](e)},this.triggerObjectRemovedCallback=e=>{for(var t in x)x.hasOwnProperty(t)&&x[t](e)},this.addTemporaryPoints=(e,t)=>{var n=l(e.length,e),a=new i.PointsMaterial({alphaTest:.5,size:15,color:t,sizeAttenuation:!1}),s=h();a.map=s;var o=new(r(377).O)(n,a);return S.add(o),o},this.addTemporaryLines=(e,t)=>{var n=l(e.length,e),a=new i.LineBasicMaterial({color:t}),s=new(r(1491).D)(n,a);return S.add(s),s},this.removeTemporaryPrimitive=e=>{S.remove(e),e.geometry.dispose(),e.material.dispose()},this.clearTemporaryPrimitives=()=>{var e=0;return S.children.forEach((t=>{t.geometry.dispose(),t.material.dispose(),e++})),S.clear(),e},this.addBoundingBoxPrimitive=function(e,t,r,n,a){var s=5<arguments.length&&void 0!==arguments[5]?arguments[5]:void 0,o=M.findChildFromPath(e);void 0===o&&(o=M.createChildFromPath(e));var l=s||d.getBoundingBox();N.set(0,0,0);var h=N.subVectors(l.max,l.min),c=new i.BoxGeometry(h.x,h.y,h.z),u=o.createGeometryFromThreeJSGeometry(t,c,r,n,a,1e4);return h.addVectors(l.min,l.max).multiplyScalar(.5),u.setPosition(h.x,h.y,h.z),u},this.addSlicesPrimitive=function(e,t,r,n,a){var s=5<arguments.length&&void 0!==arguments[5]?arguments[5]:void 0;if(t&&3<=t.length&&r&&3<=r.length){var o=M.findChildFromPath(e);void 0===o&&(o=M.createChildFromPath(e));var l=s||d.getBoundingBox();N.set(0,0,0);var h=N.subVectors(l.max,l.min),c=[],u=0;return["x","y","z"].forEach((e=>{var s;switch(e){case"x":(s=new i.PlaneGeometry(h.z,h.y)).rotateY(Math.PI/2);break;case"y":(s=new i.PlaneGeometry(h.x,h.z)).rotateX(Math.PI/2);break;case"z":s=new i.PlaneGeometry(h.x,h.y)}var l=o.createGeometryFromThreeJSGeometry(t[u],s,r[u],n,a,10001);c.push(l),u++})),h.addVectors(l.min,l.max).multiplyScalar(.5),c.forEach((e=>{e.setPosition(h.x,h.y,h.z)})),c}},this.enableMarkerCluster=e=>{e?(O.markerUpdateRequired=!0,O.enable()):(O.markerUpdateRequired=!1,O.disable()),this.forcePickableObjectsUpdate=!0},this.destroyAxisDisplay=()=>{this.displayMiniAxes=!1,D.main&&(this.enableAxisDisplay(!1,!1),D.main.forEach((e=>{e.dispose&&e.dispose()}))),D.mini&&(this.enableAxisDisplay(!1,!0),D.mini.forEach((e=>{e.dispose&&e.dispose()}))),D={main:[],mini:[]}},this.createAxisDisplay=function(){var e=!!(0<arguments.length&&void 0!==arguments[0])&&arguments[0];d.destroyAxisDisplay();var t=[{name:"x",dir:new i.Vector3(1,0,0),colour:"red",hex:16733525},{name:"y",dir:new i.Vector3(0,1,0),colour:"green",hex:5635925},{name:"z",dir:new i.Vector3(0,0,1),colour:"blue",hex:5592575}],r=d.getBoundingBox(),n=r.min.distanceTo(r.max),a=new i.Vector3(0,0,0);e&&a.copy(r.min),t.forEach((e=>{var t=new i.ArrowHelper(e.dir,a,n,e.hex);D.main.push(t);var s=new i.ArrowHelper(e.dir,r.getCenter(N),n/2,e.hex);D.mini.push(s);var o=c(e.name,.036,e.colour,"Asap",120,700),l=e.dir.clone().multiplyScalar(n).add(a);o.position.set(l.x,l.y,l.z),D.main.push(o)}))},this.enableAxisDisplay=function(e){var t,r=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1];r&&null!==(t=D)&&void 0!==t&&null!==(t=t.mini)&&void 0!==t&&t.length?(d.displayMiniAxes=e,D.mini.forEach((t=>{e?_.add(t):_.remove(t)}))):!r&&D.main&&D.main.forEach((t=>{e?w.add(t):w.remove(t)}))}}},3778:(e,t,r)=>{var i=r(370).r;t.O=function(e){var t=e;this.exportGLTF=e=>{var r=t.getRootRegion().getAllObjects(!0),n=[];r.forEach((e=>{e.animationClip&&n.push({clip:e.animationClip[0],mesh:e.getMorph()})}));var a=new i,s={binary:e,animations:n};return new Promise((e=>{a.parse(t.getThreeJSScene(),(function(t){e(t)}),s)}))}}},6264:(e,t,r)=>{var i=r(1515),n=r(2515).resolveURL,a=r(2515).createNewURL,s=r(2515).isRegionGroup,o=r(7270).t,l=r(654).L,h=r(1915)._;t.c=function(e){var t=e;this.toBeDownloaded=0,this.progressMap={};var c=!1,u=!1,d=new h;this.getDownloadProgress=()=>{var e=0,t=0,r=!1;for(var i in this.progressMap){var n=this.progressMap[i];e+=n[1],t+=n[0],0==n[1]&&(r=!0)}return r&&(e=0),[e,t,u]},this.onProgress=e=>t=>{this.progressMap[e]=[t.loaded,t.total]},this.onError=e=>t=>{--this.toBeDownloaded,u=!0,console.error("There is an issue with external resource ".concat(null!=t&&t.responseURL?": "+(null==t?void 0:t.responseURL):"",".")),e&&e({type:"Error",xhr:t})},this.loadViewURL=(e,r)=>{this.toBeDownloaded+=1;var i=new XMLHttpRequest;i.onreadystatechange=()=>{if(4==i.readyState)if(200==i.status){var n=JSON.parse(i.responseText);t.setupMultipleViews("default",{default:n}),t.resetView(),c=!0,--this.toBeDownloaded,null!=r&&"function"==typeof r&&r()}else this.onError(r)({responseURL:e})};var a=n(e);i.open("GET",a,!0),i.send()},this.loadModelsURL=(e,t,i,a,s,o,l)=>{var h=t.length;this.toBeDownloaded+=h;for(var c=0;c<h;c++){var u=t[c],p=r(1913).defaultMaterialColor,m=r(1913).defaultOpacity;null!=i&&null!=i[c]&&(p=!!i[c]),null!=a&&null!=a[c]&&(m=a[c]);var f=0;null!=s&&null!=s[c]&&(f=!!s[c]);var v=0;null!=o&&null!=o[c]&&(v=!!o[c]),d.load(n(u),x(e,p,m,f,v,void 0,void 0,void 0,void 0,l),this.onProgress(u),this.onError(l))}},this.loadFromViewURL=(e,r,i)=>{var a=new XMLHttpRequest;a.onreadystatechange=()=>{if(4==a.readyState&&200==a.status){var n=JSON.parse(a.responseText);t.loadView(n);for(var s,o=[],l=r+"_",h=0;h<n.numberOfResources;h++)s=l+(h+1)+".json",o.push(s);this.loadModelsURL(e,o,n.colour,n.opacity,n.timeEnabled,n.morphColour,i)}};var s=n(r+"_view.json");a.open("GET",s,!0),a.send()};var p=(e,n,a,s,o,l,h,c)=>(u,p)=>{var m=new(r(8145).q),f=void 0;p&&p[0]&&(f=new i.LineBasicMaterial({color:p[0].color.clone()}),1>p[0].opacity&&(f.transparent=!0),f.opacity=p[0].opacity,f.morphTargets=n,f.vertexColors=p[0].vertexColors);var v={localTimeEnabled:n,localMorphColour:a};if(m&&(m.createLineSegment(u,f,v),m.setName(s),m.setAnatomicalId(o),m.setRenderOrder(l),e.addZincObject(m),m.setDuration(t.getDuration()),h&&h.levels))for(var[g,y]of Object.entries(h.levels))m.addLOD(d,g,y.URL,y.Index,h.preload);--this.toBeDownloaded,u.dispose(),null!=c&&"function"==typeof c&&c(m)};this.loadLinesURL=(e,t,r,i,n,a,s)=>{var o=0;this.toBeDownloaded+=1;var l=!(!s||!s.isInline)&&s.isInline,h=s&&s.anatomicalId?s.anatomicalId:void 0,c=s&&s.renderOrder?s.renderOrder:void 0;null!=r&&(o=!!r);var u=0;if(null!=i&&(u=!!i),l){var m=d.parse(t);p(e,o,u,n,h,c,s.lod,a)(m.geometry,m.materials)}else d.load(t,p(e,o,u,n,h,c,s.lod,a),this.onProgress(t),this.onError(a),s.loaderOptions)};var m=(e,i,a,s,o,l)=>{var h=l&&l.isInline?l.isInline:void 0,c=l&&l.anatomicalId?l.anatomicalId:void 0,u=l&&l.displayLabels?l.displayLabels:void 0,d=l&&l.renderOrder?l.renderOrder:void 0,p=new(r(2842).V);p.setDuration(t.getDuration()),p.groupName=s;var m=()=>{--this.toBeDownloaded,null!=o&&"function"==typeof o&&o(p)};++this.toBeDownloaded,h?p.load(i,a,m,h,u):p.load(i,n(a),m,h,u),p.setAnatomicalId(c),p.setRenderOrder(d),e.addZincObject(p)},f=(e,n,a,s,o,l,h)=>(c,u)=>{var d=new(r(770).t),p=new i.PointsMaterial({alphaTest:.5,size:10,sizeAttenuation:!1});u&&u[0]&&(1>u[0].opacity&&(p.transparent=!0),p.opacity=u[0].opacity,p.color=u[0].color,p.morphTargets=n,p.vertexColors=u[0].vertexColors);var m={};m.localTimeEnabled=n,m.localMorphColour=a,d&&(d.createMesh(c,p,m),d.setName(s),d.setAnatomicalId(o),e.addZincObject(d),d.setDuration(t.getDuration()),d.setRenderOrder(l)),c.dispose(),--this.toBeDownloaded,null!=h&&"function"==typeof h&&h(d)};this.loadSTL=(e,t,i,a)=>{this.toBeDownloaded+=1;var s=r(1913).defaultMaterialColor,l=r(1913).defaultOpacity,h=new o;h.crossOrigin="Anonymous",h.load(n(t),x(e,s,l,!1,!1,i,void 0,void 0,void 0,a))},this.loadOBJ=(e,t,i,a)=>{this.toBeDownloaded+=1;var s=r(1913).defaultMaterialColor,o=r(1913).defaultOpacity,h=new l;h.crossOrigin="Anonymous",h.load(n(t),x(e,s,o,!1,!1,i,void 0,void 0,void 0,a))};var v=(e,t,i,n,a,s,h)=>{this.toBeDownloaded+=1;var c=r(1913).defaultMaterialColor,u=r(1913).defaultOpacity,p=0,m=!(!h||!h.isInline)&&h.isInline,f=h&&h.fileFormat?h.fileFormat:void 0,v=h&&h.anatomicalId?h.anatomicalId:void 0,g=h&&h.renderOrder?h.renderOrder:void 0;null!=i&&(p=!!i);var y=0;null!=n&&(y=!!n);var b=d;if(void 0!==f)if("STL"==f)b=new o;else if("OBJ"==f)return(b=new l).crossOrigin="Anonymous",void b.load(t,objloader(e,c,u,p,y,a,v,s),this.onProgress(t),this.onError,h.loaderOptions);if(m){var w=d.parse(t);x(e,c,u,p,y,a,v,g,h,s)(w.geometry,w.materials)}else b.crossOrigin="Anonymous",d.load(t,x(e,c,u,p,y,a,v,g,h,s),this.onProgress(t),this.onError(s),h.loaderOptions)},g=function(e,r,i){var n=0;return a=>{if(++n,a&&null!=r&&"function"==typeof r&&r(a),n==e&&(0==c&&t.viewAll(),null!=i&&"function"==typeof i)){i();var s=t.getZincCameraControls();s&&s.calculateMaxAllowedDistance(t)}}};this.loadPointsetURL=(e,t,r,i,n,a,s)=>{var o=0;this.toBeDownloaded+=1,null!=r&&(o=!!r);var l=0;null!=i&&(l=!!i);var h=!(!s||!s.isInline)&&s.isInline,c=s&&s.anatomicalId?s.anatomicalId:void 0,u=s&&s.renderOrder?s.renderOrder:void 0;if(h){var p=d.parse(t);f(e,o,l,n,c,u,a)(p.geometry,p.materials)}else d.load(t,f(e,o,l,n,c,u,a),this.onProgress(t),this.onError(a),s.loaderOptions)};var y=(e,t,i,n,s,o)=>{var l=o&&o.isInline?o.isInline:void 0,h=o&&o.anatomicalId?o.anatomicalId:void 0,c=o&&o.renderOrder?o.renderOrder:void 0,u=void 0;if(i){if(t&&i.images&&i.images.source)for(var d,p=i.images.source,m=0;m<p.length;m++)d=a(p[m],t),i.images.source[m]=d;"slides"===i.type&&(u=new(r(4291).W)),u&&(u.groupName=n,++this.toBeDownloaded,u.load(i,(()=>{--this.toBeDownloaded,null!=s&&"function"==typeof s&&s(u)}),l),u.setAnatomicalId(h),u.setRenderOrder(c),e.addZincObject(u))}};this.loadTextureURL=(e,t,r,i,a)=>{if(a&&a.isInline&&a.isInline)y(e,void 0,t,r,i,a);else{var s=new XMLHttpRequest;s.onreadystatechange=((e,t,r,i,n)=>()=>{if(4==t.readyState&&200==t.status){var a=JSON.parse(t.responseText);y(e,t.responseURL,a,r,i,n)}})(e,s,r,i,a),s.open("GET",n(t),!0),s.send()}},this.loadGlyphsetURL=(e,t,r,i,a,s)=>{if(s&&s.isInline&&s.isInline)m(e,t,r,i,a,s);else{var o=new XMLHttpRequest;o.onreadystatechange=((e,t,r,i,n,a)=>()=>{if(4==t.readyState&&200==t.status){var s=JSON.parse(t.responseText);m(e,s,r,i,n,a)}})(e,o,r,i,a,s),o.open("GET",n(t),!0),o.send()}};var x=(e,i,n,a,s,o,l,h,c,u)=>(p,m)=>{var f;m&&m[0]&&(f=m[0]);var v=((e,i,n,a,s,o,l,h,c,u,d)=>{var p={colour:n,opacity:a,localTimeEnabled:s,localMorphColour:o},m=new(r(5672).V);return m.createMesh(i,h,p),m.getMorph()?(m.setName(c),m.setRenderOrder(u),m.setAnatomicalId(d),e&&e.addZincObject(m),m.setDuration(t.getDuration()),m.videoHandler&&t.setVideoHandler(m.videoHandler),m):void 0})(e,p,i,n,a,s,0,f,o,h,l);if(c.lod&&c.lod.levels)for(var[g,y]of Object.entries(c.lod.levels))v.addLOD(d,g,y.URL,y.Index,c.lod.preload);--this.toBeDownloaded,p.dispose(),null!=u&&"function"==typeof u&&u(v)},b=e=>{var[,t,r,i,n,a,s,o]=e.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/);return{years:t,months:r,weeks:i,days:n,hours:a,mins:s,secs:o}};this.loadSettings=e=>{if(e){if(e.Duration){var r=b(e.Duration);t.setDurationFromObject(r)}if(e.OriginalDuration){var i=b(e.OriginalDuration);t.setOriginalDurationFromObject(i)}if(e.TimeStamps)for(var n in e.TimeStamps){var a=b(e.TimeStamps[n]);t.addMetadataTimeStamp(n,a)}}};var w=(e,t,r,i,n)=>{if(r){var s=void 0,o=!1;r.URL?(s=r.URL,t&&(s=a(s,t))):r.Inline&&(s=r.Inline.URL,o=!0);var l={};if(r.LOD&&r.LOD.Levels)for(var[h,c]of(l.preload=!!r.LOD.Preload,l.levels={},Object.entries(r.LOD.Levels)))l.levels[h]={},l.levels[h].URL=a(c.URL,t),l.levels[h].Index=c.Index;var u=r.GroupName;(void 0===u||""===u)&&(u="_Unnamed");var d={loaderOptions:{index:r.Index},isInline:o,fileFormat:r.FileFormat,anatomicalId:r.AnatomicalId,compression:r.compression,lod:l,renderOrder:i};switch(r.Type){case"Surfaces":v(e,s,r.MorphVertices,r.MorphColours,u,n,d);break;case"Glyph":var p;o?p=r.Inline.GlyphGeometriesURL:(p=r.GlyphGeometriesURL,p=a(r.GlyphGeometriesURL,t)),r.DisplayLabels&&(d.displayLabels=!0),this.loadGlyphsetURL(e,s,p,u,n,d);break;case"Points":this.loadPointsetURL(e,s,r.MorphVertices,r.MorphColours,u,n,d);break;case"Lines":this.loadLinesURL(e,s,r.MorphVertices,r.MorphColours,u,n,d);break;case"Texture":this.loadTextureURL(e,s,u,n,d)}}},_=(e,r,i)=>{if(r){var n=void 0,s=!1;switch(r.URL?(n=r.URL,e&&(n=a(r.URL,e))):r.Inline&&(n=r.Inline.URL,s=!0),r.Type){case"View":s?(t.setupMultipleViews("default",{default:n}),c=!0,null!=i&&"function"==typeof i&&i()):this.loadViewURL(n,i);break;case"Settings":this.loadSettings(r)}}};this.loadGLTF=(e,i,n,a,s)=>{(new(r(5576).H)).load(t,e,i,n,a,s)};var M=(e,t,r,i)=>{if(r.Primitives&&r.Primitives.forEach((r=>{var n=1;r.Order&&(n=r.Order),w(e,t,r,n,i)})),r.Transformation&&e.setTransformation(r.Transformation),r.Children)for(var[n,a]of Object.entries(r.Children)){var s=e.findOrCreateChildFromPath(n);s&&M(s,t,a,i)}},S=(e,t)=>{if(Array.isArray(e)){for(var r=0,i=0;i<e.length;i++)e[i].Type&&(t&&"View"===e[i].Type||"Surfaces"===e[i].Type||"Glyph"===e[i].Type||"Points"===e[i].Type||"Lines"===e[i].Type||"Texture"===e[i].Type)&&r++;return r}return 0},T=e=>{var t=e.Primitives?S(e.Primitives,!1):0;return e.Children&&Object.values(e.Children).forEach((e=>{t+=T(e)})),t},E=e=>Array.isArray(e)?S(e,!0):"object"==typeof e&&null!==e&&"2.0"===e.Version?T(e.Regions):void 0,A=(e,t,r,i,n)=>{var a=e;r.RegionPath&&""!==r.RegionPath&&(a=e.findOrCreateChildFromPath(r.RegionPath)),w(a,t,r,2*i,n)},L=(e,r,i,n,s)=>{var o=E(r),l=new g(o,n,s);r.Settings&&this.loadSettings(r.Settings),r.Views&&((e,r)=>{var i=r.Default;if(r.Inline)t.setupMultipleViews(i,r.Entries);else{var n=[],s=function(t){e&&(newURL=a(l,e),n.push(new Promise(((e,r)=>{fetch(newURL).then((e=>e.json())).then((r=>e({key:t,data:r}))).catch((e=>r(e)))}))))};for(var[o,l]of Object.entries(r.Entries))s(o);Promise.all(n).then((e=>{var r={};e.forEach((e=>{r[e.key]=e.data})),t.setupMultipleViews(i,r);var n=t.getZincCameraControls();n&&n.setCurrentViewport(i),c=!0}))}})(i,r.Views),r.Regions&&M(e,i,r.Regions,l)};this.loadMetadataURL=(e,r,i,a,o)=>{var l=new XMLHttpRequest,h=n(r);l.onreadystatechange=()=>{if(4==l.readyState&&200==l.status){t.resetMetadata(),t.resetDuration(),c=!1;var r=l.responseURL;void 0===r&&(r=new URL(h).href);var n=JSON.parse(l.responseText);Array.isArray(n)?((e,t,r,i,n,a)=>{for(var o=((e,t)=>Array.isArray(e)?((e,t)=>{var r,i,n=e,a=null==t||null===(r=t.enabled)||void 0===r?void 0:r.include,o=null==t||null===(i=t.enabled)||void 0===i?void 0:i.exclude;return(null!=a&&a.length||null!=o&&o.length)&&(a&&(n=e.filter((e=>{if("View"===e.Type)return!0;for(var t=0;t<a.length;t++)if(s(e.RegionPath,e.GroupName,a[t]))return!0;return!1}))),o&&(n=n.filter((e=>{if("View"===e.Type)return!0;for(var t=0;t<o.length;t++)if(s(e.RegionPath,e.GroupName,o[t]))return!1;return!0})))),n})(e,t):e)(t,a),l=E(o),h=new g(l,i,n),c=0;c<t.length;c++)_(r,o[c],h);for(var u=0;u<t.length;u++)A(e,r,o[u],u,h)})(e,n,r,i,a,o):"object"==typeof n&&null!==n&&"2.0"==n.Version&&L(e,n,r,i,a)}},l.open("GET",h,!0),l.send()}}},8612:(e,t,r)=>{var i=r(1515),n=i.GLSL3;t.fs="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2DArray;\n\nuniform sampler2DArray diffuse;\nuniform bool discardAlpha;\nin vec3 vUw;\n\nout vec4 outColor;\n\nvoid main() {\n\n vec4 color = texture( diffuse, vUw );\n\n // lighten a bit\n if (discardAlpha && color.a == 0.0) discard;\n\n outColor = vec4( color.rgba );\n\n}\n",t.vs="\nout vec3 vUw;\nuniform float depth;\nuniform vec3 slide;\nuniform int direction;\nuniform bool flipY;\n\nvoid main() {\n\n vec3 slidePos = position.xyz;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position.xyz, 1.0 );\n\n if (direction == 1)\n slidePos = vec3(slide.x, position.y, position.x);\n if (direction == 2)\n slidePos = vec3(position.x, slide.y, position.y);\n if (direction == 3)\n slidePos = vec3(position.x, position.y, slide.z);\n\n if (flipY) \n slidePos.y = 1.0 - slidePos.y;\n\n vUw.xyz = vec3(slidePos.x, slidePos.y, slidePos.z * depth);\n\n}\n",t.glslVersion=n,t.getUniforms=function(){return{diffuse:{value:void 0},depth:{value:1},slide:{value:new i.Vector3(0,0,1)},direction:{value:1},flipY:{value:!0},discardAlpha:{value:!0}}}},1860:(e,t,r)=>{function i(e,t,r,i,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(i,n)}function n(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){function s(e){i(l,n,a,s,o,"next",e)}function o(e){i(l,n,a,s,o,"throw",e)}var l=e.apply(t,r);s(void 0)}))}}var a=r(1515),s=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};s.prototype.loadImage=function(e,t){return new Promise(((r,i)=>{e.onload=()=>r(e),e.onerror=i,e.src=t}))},s.prototype.imageToUint8Array=function(){var e=n((function*(e,t,r,i){yield e.loadImage(t,r),i.width=t.width,i.height=t.height;var n=i.getContext("2d");return n.drawImage(t,0,0),{array:new Uint8Array(n.getImageData(0,0,i.width,i.height).data.buffer),width:i.width,height:i.height}}));return function(){return e.apply(this,arguments)}}(),s.prototype.loadFromImages=function(){var e=n((function*(){}));return function(){return e.apply(this,arguments)}}(),s.prototype.isReady=function(){return!(!this.impl||this.isLoading)},s.prototype.getMaterial=function(){if(this.impl)return new a.MeshBasicMaterial({color:new a.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:a.DoubleSide})},t.g=s},3523:(e,t,r)=>{function i(e,t,r,i,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(i,n)}var n=r(1515),a=function(){var e=this;r(1860).g.call(this),this.isTextureArray=!0,this.loadFromImages=function(){var t,r=(t=function*(t){var r=1,i=1,a=0;if(t&&t.length){e.isLoading=!0;var s=new Image;s.crossOrigin="Anonymous";for(var o,l=document.createElement("canvas"),h=0,c=Array(t.length),u=0;u<t.length;u++)(o=yield e.imageToUint8Array(e,s,t[u],l))&&o.array&&(r=o.width,i=o.height,c[a]=o.array,h+=c[a].length,a++);var d=new Uint8Array(h);h=0,c.forEach((e=>{d.set(e,h),h+=e.length})),e.impl=new n.DataTexture2DArray(d,r,i,a),e.size={width:r,height:i,depth:a},e.isLoading=!1,e.impl.needsUpdate=!0}},function(){var e=this,r=arguments;return new Promise((function(n,a){function s(e){i(l,n,a,s,o,"next",e)}function o(e){i(l,n,a,s,o,"throw",e)}var l=t.apply(e,r);s(void 0)}))});return function(){return r.apply(this,arguments)}}(),this.getMaterial=e=>{if(this.impl){var t;if(e){if(e.vs&&e.fs){var r=!0;"transparent"in e&&(r=e.transparent);var i=n.FrontSide;e.side&&(i=e.side),t=new n.ShaderMaterial({transparent:r,uniforms:e.uniforms,vertexShader:e.vs,fragmentShader:e.fs,side:i}),e.glslVersion&&(t.glslVersion=e.glslVersion)}}else t=new n.MeshBasicMaterial({color:new n.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:n.DoubleSide});if(t)return t.needsUpdate=!0,t}}};a.prototype=Object.create(r(1860).g.prototype),t.$=a},6133:e=>{"use strict";e.exports=function(e){var t=function(r){var i,n,a,s,o,l,h,c=[];if(r.isBufferGeometry&&(r=(new e.Geometry).fromBufferGeometry(r)),r instanceof e.Geometry)this.matrix=new e.Matrix4;else{if(!r.isMesh){if(r instanceof t.Node)return this.tree=r,this.matrix=new e.Matrix4,this;throw"ThreeBSP: Given geometry is unsupported"}r.updateMatrix(),this.matrix=r.matrix.clone(),(r=r.geometry).isBufferGeometry&&(r=(new e.Geometry).fromBufferGeometry(r)),r.mergeVertices(),r.computeVertexNormals(!1)}for(i=0,n=r.faces.length;i<n;i++)a=r.faces[i],o=r.faceVertexUvs[0][i],h=new t.Polygon,a instanceof e.Face3?(s=r.vertices[a.a],l=o?new e.Vector2(o[0].x,o[0].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[0],l)).applyMatrix4(this.matrix),h.vertices.push(s),s=r.vertices[a.b],l=o?new e.Vector2(o[1].x,o[1].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[2],l)).applyMatrix4(this.matrix),h.vertices.push(s),s=r.vertices[a.c],l=o?new e.Vector2(o[2].x,o[2].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[2],l)).applyMatrix4(this.matrix),h.vertices.push(s)):(e.Face4,s=r.vertices[a.a],l=o?new e.Vector2(o[0].x,o[0].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[0],l)).applyMatrix4(this.matrix),h.vertices.push(s),s=r.vertices[a.b],l=o?new e.Vector2(o[1].x,o[1].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[1],l)).applyMatrix4(this.matrix),h.vertices.push(s),s=r.vertices[a.c],l=o?new e.Vector2(o[2].x,o[2].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[2],l)).applyMatrix4(this.matrix),h.vertices.push(s),s=r.vertices[a.d],l=o?new e.Vector2(o[3].x,o[3].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[3],l)).applyMatrix4(this.matrix),h.vertices.push(s)),h.calculateProperties(),c.push(h);this.tree=new t.Node(c)};return t.prototype.subtract=function(e){var r=this.tree.clone(),i=e.tree.clone();return r.invert(),r.clipTo(i),i.clipTo(r),i.invert(),i.clipTo(r),i.invert(),r.build(i.allPolygons()),r.invert(),(r=new t(r)).matrix=this.matrix,r},t.prototype.union=function(e){var r=this.tree.clone(),i=e.tree.clone();return r.clipTo(i),i.clipTo(r),i.invert(),i.clipTo(r),i.invert(),r.build(i.allPolygons()),(r=new t(r)).matrix=this.matrix,r},t.prototype.intersect=function(e){var r=this.tree.clone(),i=e.tree.clone();return r.invert(),i.clipTo(r),i.invert(),r.clipTo(i),i.clipTo(r),r.build(i.allPolygons()),r.invert(),(r=new t(r)).matrix=this.matrix,r},t.prototype.toGeometry=function(){var t,r,i,n,a,s,o,l,h,c,u=(new e.Matrix4).getInverse(this.matrix),d=new e.Geometry,p=this.tree.allPolygons(),m=p.length,f={};for(t=0;t<m;t++)for(n=(i=p[t]).vertices.length,r=2;r<n;r++)c=[],l=i.vertices[0],c.push(new e.Vector2(l.uv.x,l.uv.y)),(l=new e.Vector3(l.x,l.y,l.z)).applyMatrix4(u),void 0===f[l.x+","+l.y+","+l.z]?(d.vertices.push(l),a=f[l.x+","+l.y+","+l.z]=d.vertices.length-1):a=f[l.x+","+l.y+","+l.z],l=i.vertices[r-1],c.push(new e.Vector2(l.uv.x,l.uv.y)),(l=new e.Vector3(l.x,l.y,l.z)).applyMatrix4(u),void 0===f[l.x+","+l.y+","+l.z]?(d.vertices.push(l),s=f[l.x+","+l.y+","+l.z]=d.vertices.length-1):s=f[l.x+","+l.y+","+l.z],l=i.vertices[r],c.push(new e.Vector2(l.uv.x,l.uv.y)),(l=new e.Vector3(l.x,l.y,l.z)).applyMatrix4(u),void 0===f[l.x+","+l.y+","+l.z]?(d.vertices.push(l),o=f[l.x+","+l.y+","+l.z]=d.vertices.length-1):o=f[l.x+","+l.y+","+l.z],h=new e.Face3(a,s,o,new e.Vector3(i.normal.x,i.normal.y,i.normal.z)),d.faces.push(h),d.faceVertexUvs[0].push(c);return d},t.prototype.toBufferGeometry=function(){var t=this.toGeometry();return(new e.BufferGeometry).fromGeometry(t)},t.prototype.toMesh=function(t){var r=this.toBufferGeometry(),i=new e.Mesh(r,t);return i.position.setFromMatrixPosition(this.matrix),i.rotation.setFromRotationMatrix(this.matrix),i},t.Polygon=function(e){e instanceof Array||(e=[]),this.vertices=e,0<e.length?this.calculateProperties():this.normal=this.w=void 0},t.Polygon.prototype.calculateProperties=function(){var e=this.vertices[0],t=this.vertices[1],r=this.vertices[2];return this.normal=t.clone().subtract(e).cross(r.clone().subtract(e)).normalize(),this.w=this.normal.clone().dot(e),this},t.Polygon.prototype.clone=function(){var e,r,i=new t.Polygon;for(e=0,r=this.vertices.length;e<r;e++)i.vertices.push(this.vertices[e].clone());return i.calculateProperties(),i},t.Polygon.prototype.flip=function(){var e,t=[];for(this.normal.multiplyScalar(-1),this.w*=-1,e=this.vertices.length-1;0<=e;e--)t.push(this.vertices[e]);return this.vertices=t,this},t.Polygon.prototype.classifyVertex=function(e){var t=this.normal.dot(e)-this.w;return t<-1e-5?2:t>1e-5?1:0},t.Polygon.prototype.classifySide=function(e){var t,r,i,n=0,a=0,s=e.vertices.length;for(t=0;t<s;t++)r=e.vertices[t],1===(i=this.classifyVertex(r))?n++:2===i&&a++;return 0<n&&0===a?1:0===n&&0<a?2:0===n&&0===a?0:3},t.Polygon.prototype.splitPolygon=function(e,r,i,n,a){var s=this.classifySide(e);if(0===s)(0<this.normal.dot(e.normal)?r:i).push(e);else if(1===s)n.push(e);else if(2===s)a.push(e);else{var o,l,h,c,u,d,p,m,f,v=[],g=[];for(l=0,o=e.vertices.length;l<o;l++)h=(l+1)%o,d=e.vertices[l],p=e.vertices[h],c=this.classifyVertex(d),u=this.classifyVertex(p),2!=c&&v.push(d),1!=c&&g.push(d),3==(c|u)&&(m=(this.w-this.normal.dot(d))/this.normal.dot(p.clone().subtract(d)),f=d.interpolate(p,m),v.push(f),g.push(f));3<=v.length&&n.push(new t.Polygon(v).calculateProperties()),3<=g.length&&a.push(new t.Polygon(g).calculateProperties())}},t.Vertex=function(t,r,i,n,a){this.x=t,this.y=r,this.z=i,this.normal=n||new e.Vector3,this.uv=a||new e.Vector2},t.Vertex.prototype.clone=function(){return new t.Vertex(this.x,this.y,this.z,this.normal.clone(),this.uv.clone())},t.Vertex.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},t.Vertex.prototype.subtract=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this},t.Vertex.prototype.multiplyScalar=function(e){return this.x*=e,this.y*=e,this.z*=e,this},t.Vertex.prototype.cross=function(e){var t=this.x,r=this.y,i=this.z;return this.x=r*e.z-i*e.y,this.y=i*e.x-t*e.z,this.z=t*e.y-r*e.x,this},t.Vertex.prototype.normalize=function(){var e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return this.x/=e,this.y/=e,this.z/=e,this},t.Vertex.prototype.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},t.Vertex.prototype.lerp=function(e,t){return this.add(e.clone().subtract(this).multiplyScalar(t)),this.normal.add(e.normal.clone().sub(this.normal).multiplyScalar(t)),this.uv.add(e.uv.clone().sub(this.uv).multiplyScalar(t)),this},t.Vertex.prototype.interpolate=function(e,t){return this.clone().lerp(e,t)},t.Vertex.prototype.applyMatrix4=function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i+n[12],this.y=n[1]*t+n[5]*r+n[9]*i+n[13],this.z=n[2]*t+n[6]*r+n[10]*i+n[14],this},t.Node=function(e){var r,i,n=[],a=[];if(this.polygons=[],this.front=this.back=void 0,e instanceof Array&&0!==e.length){for(this.divider=e[0].clone(),r=0,i=e.length;r<i;r++)this.divider.splitPolygon(e[r],this.polygons,this.polygons,n,a);0<n.length&&(this.front=new t.Node(n)),0<a.length&&(this.back=new t.Node(a))}},t.Node.isConvex=function(e){var t,r;for(t=0;t<e.length;t++)for(r=0;r<e.length;r++)if(t!==r&&2!==e[t].classifySide(e[r]))return!1;return!0},t.Node.prototype.build=function(e){var r,i,n=[],a=[];for(this.divider||(this.divider=e[0].clone()),r=0,i=e.length;r<i;r++)this.divider.splitPolygon(e[r],this.polygons,this.polygons,n,a);0<n.length&&(!this.front&&(this.front=new t.Node),this.front.build(n)),0<a.length&&(!this.back&&(this.back=new t.Node),this.back.build(a))},t.Node.prototype.allPolygons=function(){var e=this.polygons.slice();return this.front&&(e=e.concat(this.front.allPolygons())),this.back&&(e=e.concat(this.back.allPolygons())),e},t.Node.prototype.clone=function(){var e=new t.Node;return e.divider=this.divider.clone(),e.polygons=this.polygons.map((function(e){return e.clone()})),e.front=this.front&&this.front.clone(),e.back=this.back&&this.back.clone(),e},t.Node.prototype.invert=function(){var e,t,r;for(e=0,t=this.polygons.length;e<t;e++)this.polygons[e].flip();return this.divider.flip(),this.front&&this.front.invert(),this.back&&this.back.invert(),r=this.front,this.front=this.back,this.back=r,this},t.Node.prototype.clipPolygons=function(e){var t,r,i,n;if(!this.divider)return e.slice();for(i=[],n=[],t=0,r=e.length;t<r;t++)this.divider.splitPolygon(e[t],i,n,i,n);return this.front&&(i=this.front.clipPolygons(i)),n=this.back?this.back.clipPolygons(n):[],i.concat(n)},t.Node.prototype.clipTo=function(e){this.polygons=e.clipPolygons(this.polygons),this.front&&this.front.clipTo(e),this.back&&this.back.clipTo(e)},t}},370:(e,t,r)=>{"use strict";r.d(t,{r:()=>n});var i=r(1515);class n{constructor(){this.pluginCallbacks=[],this.register((function(e){return new m(e)})),this.register((function(e){return new f(e)})),this.register((function(e){return new v(e)}))}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r){for(var i=new p,n=[],a=0,s=this.pluginCallbacks.length;a<s;a++)n.push(this.pluginCallbacks[a](i));i.setPlugins(n),i.write(e,t,r)}}var a=5121,s=5123,o={};o[i.NearestFilter]=9728,o[i.NearestMipmapNearestFilter]=9984,o[i.NearestMipmapLinearFilter]=9986,o[i.LinearFilter]=9729,o[i.LinearMipmapNearestFilter]=9985,o[i.LinearMipmapLinearFilter]=9987,o[i.ClampToEdgeWrapping]=33071,o[i.RepeatWrapping]=10497,o[i.MirroredRepeatWrapping]=33648;var l={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"};function h(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function c(e){return 4*Math.ceil(e/4)}function u(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=c(e.byteLength);if(r!==e.byteLength){var i=new Uint8Array(r);if(i.set(new Uint8Array(e)),0!==t)for(var n=e.byteLength;n<r;n++)i[n]=t;return i.buffer}return e}var d=null;class p{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}write(e,t,r){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(e);var i=this;Promise.all(this.pending).then((function(){var e=i.buffers,r=i.json,n=i.options,a=i.extensionsUsed,s=new Blob(e,{type:"application/octet-stream"}),o=Object.keys(a);if(0<o.length&&(r.extensionsUsed=o),r.buffers&&0<r.buffers.length&&(r.buffers[0].byteLength=s.size),!0===n.binary){var l=new window.FileReader;l.readAsArrayBuffer(s),l.onloadend=function(){var e=u(l.result),i=new DataView(new ArrayBuffer(8));i.setUint32(0,e.byteLength,!0),i.setUint32(4,5130562,!0);var n=u(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;for(var t,r=new Uint8Array(new ArrayBuffer(e.length)),i=0,n=e.length;i<n;i++)t=e.charCodeAt(i),r[i]=255<t?32:t;return r.buffer}(JSON.stringify(r)),32),a=new DataView(new ArrayBuffer(8));a.setUint32(0,n.byteLength,!0),a.setUint32(4,1313821514,!0);var s=new ArrayBuffer(12),o=new DataView(s);o.setUint32(0,1179937895,!0),o.setUint32(4,2,!0);var h=12+a.byteLength+n.byteLength+i.byteLength+e.byteLength;o.setUint32(8,h,!0);var c=new Blob([s,a,n,i,e],{type:"application/octet-stream"}),d=new window.FileReader;d.readAsArrayBuffer(c),d.onloadend=function(){t(d.result)}}}else if(r.buffers&&0<r.buffers.length){var h=new window.FileReader;h.readAsDataURL(s),h.onloadend=function(){var e=h.result;r.buffers[0].uri=e,t(r)}}else t(r)}))}serializeUserData(e,t){if(!(e.userData&&e.userData.isZincObject||0===Object.keys(e.userData).length)){var r=this.options,i=this.extensionsUsed;try{var n=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&n.gltfExtensions){for(var a in void 0===t.extensions&&(t.extensions={}),n.gltfExtensions)t.extensions[a]=n.gltfExtensions[a],i[a]=!0;delete n.gltfExtensions}0<Object.keys(n).length&&(t.extras=n)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}getUID(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new i.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}createNormalizedNormalAttribute(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),n=new i.Vector3,a=0,s=r.count;a<s;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}applyTextureTransform(e,t){var r=!1,i={};(0!==t.offset.x||0!==t.offset.y)&&(i.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(i.rotation=t.rotation,r=!0),(1!==t.repeat.x||1!==t.repeat.y)&&(i.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=i,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,t,r,i,n){var o=this.json;o.bufferViews||(o.bufferViews=[]);for(var l=t===a?1:t===s?2:4,h=c(i*e.itemSize*l),u=new DataView(new ArrayBuffer(h)),d=0,p=r;p<r+i;p++)for(var m,f=0;f<e.itemSize;f++)m=void 0,4<e.itemSize?m=e.array[p*e.itemSize+f]:0===f?m=e.getX(p):1===f?m=e.getY(p):2===f?m=e.getZ(p):3==f&&(m=e.getW(p)),5126===t?u.setFloat32(d,m,!0):5125===t?u.setUint32(d,m,!0):t===s?u.setUint16(d,m,!0):t===a&&u.setUint8(d,m),d+=l;var v={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:h};return void 0!==n&&(v.target=n),34962===n&&(v.byteStride=e.itemSize*l),this.byteOffset+=h,o.bufferViews.push(v),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(i){var n=new window.FileReader;n.readAsArrayBuffer(e),n.onloadend=function(){var e=u(n.result),a={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,i(r.bufferViews.push(a)-1)}}))}processAccessor(e,t,r,i){var n,o=this.options,l=this.json;if(e.array.constructor===Float32Array)n=5126;else if(e.array.constructor===Uint32Array)n=5125;else if(e.array.constructor===Uint16Array)n=s;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");n=a}if(void 0===r&&(r=0),void 0===i&&(i=e.count),o.truncateDrawRange&&void 0!==t&&null===t.index){var h=r+i,c=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;r=Math.max(r,t.drawRange.start),0>(i=Math.min(h,c)-r)&&(i=0)}if(0===i)return null;var u,d=function(e,t,r){for(var i={min:Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},n=t;n<t+r;n++)for(var a,s=0;s<e.itemSize;s++)a=void 0,4<e.itemSize?a=e.array[n*e.itemSize+s]:0===s?a=e.getX(n):1===s?a=e.getY(n):2===s?a=e.getZ(n):3==s&&(a=e.getW(n)),i.min[s]=Math.min(i.min[s],a),i.max[s]=Math.max(i.max[s],a);return i}(e,r,i);void 0!==t&&(u=e===t.index?34963:34962);var p=this.processBufferView(e,n,r,i,u),m={bufferView:p.id,byteOffset:p.byteOffset,componentType:n,count:i,max:d.max,min:d.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(m.normalized=!0),l.accessors||(l.accessors=[]),l.accessors.push(m)-1}processImage(e,t,r){var n=this,a=n.cache,s=n.json,o=n.options,l=n.pending;a.images.has(e)||a.images.set(e,{});var h=a.images.get(e),c=t===i.RGBAFormat?"image/png":"image/jpeg",u=c+":flipY/"+r.toString();if(void 0!==h[u])return h[u];s.images||(s.images=[]);var p={mimeType:c};if(o.embedImages){var m=d=d||document.createElement("canvas");m.width=Math.min(e.width,o.maxTextureSize),m.height=Math.min(e.height,o.maxTextureSize);var f=m.getContext("2d");if(!0===r&&(f.translate(0,m.height),f.scale(1,-1)),"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)f.drawImage(e,0,0,m.width,m.height);else{t!==i.RGBAFormat&&t!==i.RGBFormat&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(e.width>o.maxTextureSize||e.height>o.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);var v=new Uint8ClampedArray(e.height*e.width*4);if(t===i.RGBAFormat)for(var g=0;g<v.length;g+=4)v[g+0]=e.data[g+0],v[g+1]=e.data[g+1],v[g+2]=e.data[g+2],v[g+3]=e.data[g+3];else for(var y=0,x=0;y<v.length;y+=4,x+=3)v[y+0]=e.data[x+0],v[y+1]=e.data[x+1],v[y+2]=e.data[x+2],v[y+3]=255;f.putImageData(new ImageData(v,e.width,e.height),0,0)}!0===o.binary?l.push(new Promise((function(e){m.toBlob((function(t){n.processBufferViewImage(t).then((function(t){p.bufferView=t,e()}))}),c)}))):p.uri=m.toDataURL(c)}else p.uri=e.src;var b=s.images.push(p)-1;return h[u]=b,b}processSampler(e){var t=this.json;t.samplers||(t.samplers=[]);var r={magFilter:o[e.magFilter],minFilter:o[e.minFilter],wrapS:o[e.wrapS],wrapT:o[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var i={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY)};e.name&&(i.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,i)}));var n=r.textures.push(i)-1;return t.textures.set(e,n),n}processMaterial(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");var a=e.color.toArray().concat([e.opacity]);if(h(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap)if(e.metalnessMap===e.roughnessMap){var s={index:this.processTexture(e.metalnessMap)};this.applyTextureTransform(s,e.metalnessMap),n.pbrMetallicRoughness.metallicRoughnessTexture=s}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(e.map){var o={index:this.processTexture(e.map)};this.applyTextureTransform(o,e.map),n.pbrMetallicRoughness.baseColorTexture=o}if(e.emissive){var l=e.emissive.clone().multiplyScalar(e.emissiveIntensity),c=Math.max(l.r,l.g,l.b);if(1<c&&(l.multiplyScalar(1/c),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<c&&(n.emissiveFactor=l.toArray()),e.emissiveMap){var u={index:this.processTexture(e.emissiveMap)};this.applyTextureTransform(u,e.emissiveMap),n.emissiveTexture=u}}if(e.normalMap){var d={index:this.processTexture(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),this.applyTextureTransform(d,e.normalMap),n.normalTexture=d}if(e.aoMap){var p={index:this.processTexture(e.aoMap),texCoord:1};1!==e.aoMapIntensity&&(p.strength=e.aoMapIntensity),this.applyTextureTransform(p,e.aoMap),n.occlusionTexture=p}e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===i.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)}));var m=r.materials.push(n)-1;return t.materials.set(e,m),m}processMesh(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,s=e.material.length;a<s;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,h=e.geometry;if(l=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,!0!==h.isBufferGeometry)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var c={},u={},d=[],p=[],m={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=h.getAttribute("normal");void 0===f||this.isNormalizedNormalAttribute(f)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),h.setAttribute("normal",this.createNormalizedNormalAttribute(f)));var v=null;for(var g in h.attributes)if("morph"!==g.substr(0,5)){var y=h.attributes[g];if(g=m[g]||g.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(g)||(g="_"+g),t.attributes.has(this.getUID(y))){u[g]=t.attributes.get(this.getUID(y));continue}v=null;var x=y.array;"JOINTS_0"!==g||x instanceof Uint16Array||x instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),v=new i.BufferAttribute(new Uint16Array(x),y.itemSize,y.normalized));var b=this.processAccessor(v||y,h);null!==b&&(u[g]=b,t.attributes.set(this.getUID(y),b))}if(void 0!==f&&h.setAttribute("normal",f),0===Object.keys(u).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var w=[],_=[],M={};if(void 0!==e.morphTargetDictionary)for(var S in e.morphTargetDictionary)M[e.morphTargetDictionary[S]]=S;for(var T=0;T<e.morphTargetInfluences.length;++T){var E={},A=!1;for(var L in h.morphAttributes)if("position"==L||"normal"===L||"color"===L){var R=h.morphAttributes[L][T],C=L.toUpperCase();m[L]&&(C=m[L]);var P=h.attributes[L];if(t.attributes.has(this.getUID(R)))E[C]=t.attributes.get(this.getUID(R));else{var I=P.clone();if(!h.morphTargetsRelative)if(P)for(var O=0,D=R.count;O<D;O++)P.count>O&&I.setXYZ(O,R.getX(O)-P.getX(O),R.getY(O)-P.getY(O),R.getZ(O)-P.getZ(O));else for(var N=0,B=R.count;N<B;N++)I.setXYZ(N,0,0,0);E[C]=this.processAccessor(I,h),t.attributes.set(this.getUID(P),E[C])}}else A||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),A=!0);p.push(E),w.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&_.push(M[T])}c.weights=w,0<_.length&&(c.extras={},c.extras.targetNames=_)}var U=Array.isArray(e.material);if(U&&0===h.groups.length)return null;for(var z,F=U?e.material:[e.material],G=U?h.groups:[{materialIndex:0,start:void 0,count:void 0}],V=0,H=G.length;V<H;V++){if(z={mode:l,attributes:u},this.serializeUserData(h,z),0<p.length&&(z.targets=p),null!==h.index){var k=this.getUID(h.index);(void 0!==G[V].start||void 0!==G[V].count)&&(k+=":"+G[V].start+":"+G[V].count),t.attributes.has(k)?z.indices=t.attributes.get(k):(z.indices=this.processAccessor(h.index,h,G[V].start,G[V].count),t.attributes.set(k,z.indices)),null===z.indices&&delete z.indices}var j=this.processMaterial(F[G[V].materialIndex]);null!==j&&(z.material=j),d.push(z)}c.primitives=d,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,c)}));var W=r.meshes.push(c)-1;return t.meshes.set(o,W),W}processCamera(e){var t=this.json;t.cameras||(t.cameras=[]);var r=e.isOrthographicCamera,n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:0>=e.far?.001:e.far,znear:0>e.near?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:i.MathUtils.degToRad(e.fov),zfar:0>=e.far?.001:e.far,znear:0>e.near?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}processAnimation(e,t){var r=this.json,a=this.nodeMap;r.animations||(r.animations=[]);for(var s=(e=n.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,o=[],h=[],c=0;c<s.length;++c){var u=s[c],d=i.PropertyBinding.parseTrackName(u.name),p=i.PropertyBinding.findNode(t,d.nodeName),m=l[d.propertyName];if("bones"===d.objectName&&(p=!0===p.isSkinnedMesh?p.skeleton.getBoneByName(d.objectIndex):void 0),!p||!m)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name),null;var f=u.values.length/u.times.length;m===l.morphTargetInfluences&&(f/=p.morphTargetInfluences.length);var v=void 0;!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(v="CUBICSPLINE",f/=3):v=u.getInterpolation()===i.InterpolateDiscrete?"STEP":"LINEAR",h.push({input:this.processAccessor(new i.BufferAttribute(u.times,1)),output:this.processAccessor(new i.BufferAttribute(u.values,f)),interpolation:v}),o.push({sampler:h.length-1,target:{node:a.get(p),path:m}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:h,channels:o}),r.animations.length-1}processSkin(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var s=e.skeleton.bones[0];if(void 0===s)return null;for(var o=[],l=new Float32Array(16*a.bones.length),h=new i.Matrix4,c=0;c<a.bones.length;++c)o.push(r.get(a.bones[c])),h.copy(a.boneInverses[c]),h.multiply(e.bindMatrix).toArray(l,16*c);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new i.BufferAttribute(l,16)),joints:o,skeleton:r.get(s)}),n.skin=t.skins.length-1}processNode(e){var t=this.json,r=this.options,i=this.nodeMap;t.nodes||(t.nodes=[]);var n={};if(r.trs){var a=e.quaternion.toArray(),s=e.position.toArray(),o=e.scale.toArray();h(a,[0,0,0,1])||(n.rotation=a),h(s,[0,0,0])||(n.translation=s),h(o,[1,1,1])||(n.scale=o)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===h(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(n.matrix=e.matrix.elements);if(""!==e.name&&(n.name=e.name+""),this.serializeUserData(e,n),e.isMesh||e.isLine||e.isPoints){var l=this.processMesh(e);null!==l&&(n.mesh=l)}else e.isCamera&&(n.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var c,u=[],d=0,p=e.children.length;d<p;d++)if((c=e.children[d]).visible||!1===r.onlyVisible){var m=this.processNode(c);null!==m&&u.push(m)}0<u.length&&(n.children=u)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,n)}));var f=t.nodes.push(n)-1;return i.set(e,f),f}processScene(e){var t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);var i={};""!==e.name&&(i.name=e.name),t.scenes.push(i);for(var n,a=[],s=0,o=e.children.length;s<o;s++)if((n=e.children[s]).visible||!1===r.onlyVisible){var l=this.processNode(n);null!==l&&a.push(l)}0<a.length&&(i.nodes=a),this.serializeUserData(e,i)}processObjects(e){var t=new i.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}processInput(e){var t=this.options;e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)}));for(var r=[],n=0;n<e.length;n++)e[n]instanceof i.Scene?this.processScene(e[n]):r.push(e[n]);0<r.length&&this.processObjects(r);for(var a=0;a<this.skins.length;++a)this.processSkin(this.skins[a]);for(var s=0;s<t.animations.length;++s)this.processAnimation(t.animations[s].clip,t.animations[s].mesh);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}_invokeAll(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}class m{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(e.isLight){if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);var r=this.writer,i=r.json,n=r.extensionsUsed,a={};e.name&&(a.name=e.name),a.color=e.color.toArray(),a.intensity=e.intensity,e.isDirectionalLight?a.type="directional":e.isPointLight?(a.type="point",0<e.distance&&(a.range=e.distance)):e.isSpotLight&&(a.type="spot",0<e.distance&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,a.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."),n[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},n[this.name]=!0);var s=i.extensions[this.name].lights;s.push(a),t.extensions=t.extensions||{},t.extensions[this.name]={light:s.length-1}}}}class f{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(e.isMeshBasicMaterial){var r=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},r[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}}class v{constructor(e){this.writer=e,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(e,t){if(e.isGLTFSpecularGlossinessMaterial){var r=this.writer,i=r.extensionsUsed,n={};t.pbrMetallicRoughness.baseColorFactor&&(n.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);var a=[1,1,1];if(e.specular.toArray(a,0),n.specularFactor=a,n.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(n.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap){var s={index:r.processTexture(e.specularMap)};r.applyTextureTransform(s,e.specularMap),n.specularGlossinessTexture=s}t.extensions=t.extensions||{},t.extensions[this.name]=n,i[this.name]=!0}}}n.Utils={insertKeyframe:function(e,t){var r,i=.001,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),s=new e.ValueBufferType(e.values.length+n),o=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var l=0;l<n;l++)s[l]=0;r=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),s.set(o.evaluate(t),0),s.set(e.values,n),r=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),s.set(e.values,0),s.set(o.evaluate(t),e.values.length),r=a.length-1}else for(var h=0;h<e.times.length;h++){if(Math.abs(e.times[h]-t)<i)return h;if(e.times[h]<t&&e.times[h+1]>t){a.set(e.times.slice(0,h+1),0),a[h+1]=t,a.set(e.times.slice(h+1),h+2),s.set(e.values.slice(0,(h+1)*n),0),s.set(o.evaluate(t),(h+1)*n),s.set(e.values.slice((h+1)*n),(h+2)*n),r=h+1;break}}return e.times=a,e.values=s,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,s=0;s<a.length;++s){var o=a[s],l=i.PropertyBinding.parseTrackName(o.name),h=i.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"===l.propertyName&&void 0!==l.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(i.InterpolateLinear)}var c=h.morphTargetInfluences.length,u=h.morphTargetDictionary[l.propertyIndex];if(void 0===u)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0!==n[h.uuid]){var p=o.createInterpolant(new o.ValueBufferType(1));d=n[h.uuid];for(var m=0;m<d.times.length;m++)d.values[m*c+u]=p.evaluate(d.times[m]);for(var f,v=0;v<o.times.length;v++)f=this.insertKeyframe(d,o.times[v]),d.values[f*c+u]=o.values[v]}else{for(var g=new((d=o.clone()).ValueBufferType)(c*d.times.length),y=0;y<d.times.length;y++)g[y*c+u]=d.values[y];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=g,n[h.uuid]=d,r.push(d)}}else r.push(o)}return e.tracks=r,e}}},8154:(e,t,r)=>{"use strict";r.d(t,{V:()=>l,n:()=>c});var i=r(1515),n=new i.Matrix4,a=new i.Object3D,s=new i.Vector3,o=new i.Vector3;function l(){this.uuid=i.MathUtils.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.normals=[],this.uvs=[],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,this.morphNormalsReady=!1}l.prototype=Object.assign(Object.create(i.EventDispatcher.prototype),{constructor:l,isGeometry:!0,applyMatrix4:function(e){for(var t=(new i.Matrix3).getNormalMatrix(e),r=0,n=this.vertices.length;r<n;r++)this.vertices[r].applyMatrix4(e);for(var a,s=0,o=this.faces.length;s<o;s++){(a=this.faces[s]).normal.applyMatrix3(t).normalize();for(var l=0,h=a.vertexNormals.length;l<h;l++)a.vertexNormals[l].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 n.makeRotationX(e),this.applyMatrix4(n),this},rotateY:function(e){return n.makeRotationY(e),this.applyMatrix4(n),this},rotateZ:function(e){return n.makeRotationZ(e),this.applyMatrix4(n),this},translate:function(e,t,r){return n.makeTranslation(e,t,r),this.applyMatrix4(n),this},scale:function(e,t,r){return n.makeScale(e,t,r),this.applyMatrix4(n),this},lookAt:function(e){return a.lookAt(e),a.updateMatrix(),this.applyMatrix4(a.matrix),this},fromBufferGeometry:function(e){function t(e,t,n,a){var s=void 0===l?[]:[r.colors[e].clone(),r.colors[t].clone(),r.colors[n].clone()],d=void 0===o?[]:[(new i.Vector3).fromBufferAttribute(o,e),(new i.Vector3).fromBufferAttribute(o,t),(new i.Vector3).fromBufferAttribute(o,n)],p=new c(e,t,n,d,s,a);r.faces.push(p),void 0!==h&&r.faceVertexUvs[0].push([(new i.Vector2).fromBufferAttribute(h,e),(new i.Vector2).fromBufferAttribute(h,t),(new i.Vector2).fromBufferAttribute(h,n)]),void 0!==u&&r.faceVertexUvs[1].push([(new i.Vector2).fromBufferAttribute(u,e),(new i.Vector2).fromBufferAttribute(u,t),(new i.Vector2).fromBufferAttribute(u,n)])}var r=this,n=null===e.index?void 0:e.index,a=e.attributes;if(void 0===a.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var s=a.position,o=a.normal,l=a.color,h=a.uv,u=a.uv2;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var d=0;d<s.count;d++)r.vertices.push((new i.Vector3).fromBufferAttribute(s,d)),void 0!==l&&r.colors.push((new i.Color).fromBufferAttribute(l,d));var p=e.groups;if(0<p.length)for(var m=0;m<p.length;m++)for(var f=p[m],v=f.start,g=v,y=v+f.count;g<y;g+=3)void 0===n?t(g,g+1,g+2,f.materialIndex):t(n.getX(g),n.getX(g+1),n.getX(g+2),f.materialIndex);else if(void 0!==n)for(var x=0;x<n.count;x+=3)t(n.getX(x),n.getX(x+1),n.getX(x+2));else for(var b=0;b<s.count;b+=3)t(b,b+1,b+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(s).negate(),this.translate(s.x,s.y,s.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,r=0===t?1:1/t,n=new i.Matrix4;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix4(n),this},computeFaceNormals:function(){for(var e=new i.Vector3,t=new i.Vector3,r=0,n=this.faces.length;r<n;r++){var a=this.faces[r],s=this.vertices[a.a],o=this.vertices[a.b],l=this.vertices[a.c];e.subVectors(l,o),t.subVectors(s,o),e.cross(t),e.normalize(),a.normal.copy(e)}},computeVertexNormals:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=Array(this.vertices.length),r=0,n=this.vertices.length;r<n;r++)t[r]=new i.Vector3;if(e)for(var a=new i.Vector3,s=new i.Vector3,o=0,l=this.faces.length;o<l;o++){var h=this.faces[o],c=this.vertices[h.a],u=this.vertices[h.b],d=this.vertices[h.c];a.subVectors(d,u),s.subVectors(c,u),a.cross(s),t[h.a].add(a),t[h.b].add(a),t[h.c].add(a)}else{this.computeFaceNormals();for(var p,m=0,f=this.faces.length;m<f;m++)t[(p=this.faces[m]).a].add(p.normal),t[p.b].add(p.normal),t[p.c].add(p.normal)}for(var v=0,g=this.vertices.length;v<g;v++)t[v].normalize();for(var y=0,x=this.faces.length;y<x;y++){var b=this.faces[y],w=b.vertexNormals;3===w.length?(w[0].copy(t[b.a]),w[1].copy(t[b.b]),w[2].copy(t[b.c])):(w[0]=t[b.a].clone(),w[1]=t[b.b].clone(),w[2]=t[b.c].clone())}return 0<this.faces.length&&(this.normalsNeedUpdate=!0),t},computeFlatVertexNormals:function(){this.computeFaceNormals();for(var e=0,t=this.faces.length;e<t;e++){var r=this.faces[e],i=r.vertexNormals;3===i.length?(i[0].copy(r.normal),i[1].copy(r.normal),i[2].copy(r.normal)):(i[0]=r.normal.clone(),i[1]=r.normal.clone(),i[2]=r.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(var e,t=0,r=this.faces.length;t<r;t++){(e=this.faces[t]).__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]);for(var n=0,a=e.vertexNormals.length;n<a;n++)e.__originalVertexNormals[n]?e.__originalVertexNormals[n].copy(e.vertexNormals[n]):e.__originalVertexNormals[n]=e.vertexNormals[n].clone()}var s=new l;s.faces=this.faces;for(var o=0,h=this.morphTargets.length;o<h;o++){if(!this.morphNormals[o]){this.morphNormals[o]={},this.morphNormals[o].faceNormals=[],this.morphNormals[o].vertexNormals=[];for(var c=this.morphNormals[o].faceNormals,u=this.morphNormals[o].vertexNormals,d=0,p=this.faces.length;d<p;d++){var m=new i.Vector3,f={a:new i.Vector3,b:new i.Vector3,c:new i.Vector3};c.push(m),u.push(f)}}var v=this.morphNormals[o];s.vertices=this.morphTargets[o].vertices,s.computeFaceNormals();var g=s.computeVertexNormals();if(g&&0<g.length){this.morphTargets[o].normals=Array(this.vertices.length);for(var y=0;y<g.length;y++)this.morphTargets[o].normals[y]=g[y].clone()}for(var x=0,b=this.faces.length;x<b;x++){var w=this.faces[x],_=v.faceNormals[x],M=v.vertexNormals[x];_.copy(w.normal),M.a.copy(w.vertexNormals[0]),M.b.copy(w.vertexNormals[1]),M.c.copy(w.vertexNormals[2])}}for(var S,T=0,E=this.faces.length;T<E;T++)(S=this.faces[T]).normal=S.__originalFaceNormal,S.vertexNormals=S.__originalVertexNormals;this.morphNormalsReady=!0},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new i.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new i.Sphere),this.boundingSphere.setFromPoints(this.vertices)},mergeMorph:function(e,t){var r=this.morphTargets.length,i=this.morphTargets,n=e.morphTargets,a=this.morphColors.length,s=this.morphColors,l=e.morphColors;if(0<r&&r==n.length)for(var h=0,c=i.length;h<c;h++){for(var u=i[h],d=n[h],p=0,m=d.vertices.length;p<m;p++){var f=d.vertices[p].clone();void 0!==t&&f.applyMatrix4(t),u.vertices.push(f)}if(u.normals&&d.normals)for(var v=0;v<d.normals.length;v+=3)o.set(d.normals2[v],d.normals2[v+1],d.normals2[v+2]),void 0!==t&&o.applyMatrix4(t),u.normals.push(o.x,o.y,o.z)}if(0<a&&a==l.length)for(var g=0,y=s.length;g<y;g++)for(var x=s[g],b=l[g],w=0,_=b.colors;w<_;w++)x.colors.push(b.colors[w].clone())},merge:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;if(e&&e.isGeometry){var n,a=this.vertices.length,s=this.vertices,l=e.vertices,h=e.normals,u=this.faces,d=e.faces,p=this.colors,m=e.colors;void 0!==t&&(n=(new i.Matrix3).getNormalMatrix(t));for(var f=0,v=l.length;f<v;f++){var g=l[f].clone();void 0!==t&&g.applyMatrix4(t),s.push(g)}for(var y=0;y<h.length;y+=3)o.set(h[y],h[y+1],h[y+2]),void 0!==t&&o.applyMatrix4(t),this.normals.push(o.x,o.y,o.z);for(var x=0,b=m.length;x<b;x++)"number"==typeof m[x]?p.push(m[x]):p.push(m[x].clone());for(var w=0,_=d.length;w<_;w++){var M=d[w],S=void 0,T=void 0,E=M.vertexNormals,A=M.vertexColors,L=new c(M.a+a,M.b+a,M.c+a);L.normal.copy(M.normal),void 0!==n&&L.normal.applyMatrix3(n).normalize();for(var R=0,C=E.length;R<C;R++)S=E[R].clone(),void 0!==n&&S.applyMatrix3(n).normalize(),L.vertexNormals.push(S);L.color.copy(M.color);for(var P=0,I=A.length;P<I;P++)T=A[P],L.vertexColors.push(T.clone());L.materialIndex=M.materialIndex+r,u.push(L)}for(var O,D=0,N=e.faceVertexUvs.length;D<N;D++){O=e.faceVertexUvs[D],void 0===this.faceVertexUvs[D]&&(this.faceVertexUvs[D]=[]);for(var B=0,U=O.length;B<U;B++){for(var z=O[B],F=[],G=0,V=z.length;G<V;G++)F.push(z[G].clone());this.faceVertexUvs[D].push(F)}}this.mergeMorph(e,t)}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){return e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),void this.merge(e.geometry,e.matrix)):void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:4,t={},r=[],i=[],n=Math.pow(10,e),a=0,s=this.vertices.length;a<s;a++){var o=this.vertices[a],l=Math.round(o.x*n)+"_"+Math.round(o.y*n)+"_"+Math.round(o.z*n);void 0===t[l]?(t[l]=a,r.push(this.vertices[a]),i[a]=r.length-1):i[a]=i[t[l]]}for(var h,c=[],u=0,d=this.faces.length;u<d;u++){(h=this.faces[u]).a=i[h.a],h.b=i[h.b],h.c=i[h.c];for(var p=[h.a,h.b,h.c],m=0;3>m;m++)if(p[m]===p[(m+1)%3]){c.push(u);break}}for(var f,v=c.length-1;0<=v;v--){f=c[v],this.faces.splice(f,1);for(var g=0,y=this.faceVertexUvs.length;g<y;g++)this.faceVertexUvs[g].splice(f,1)}var x=this.vertices.length-r.length;return this.vertices=r,x},setFromPoints:function(e){this.vertices=[];for(var t,r=0,n=e.length;r<n;r++)t=e[r],this.vertices.push(new i.Vector3(t.x,t.y,t.z||0));return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,r=0;r<t;r++)e[r]._id=r;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));var i,n,a=this.faceVertexUvs[0],s=this.faceVertexUvs[1];a&&a.length===t&&(i=[]),s&&s.length===t&&(n=[]);for(var o,l=0;l<t;l++)o=e[l]._id,i&&i.push(a[o]),n&&n.push(s[o]);i&&(this.faceVertexUvs[0]=i),n&&(this.faceVertexUvs[1]=n)},toJSON:function(){function e(e,t,r){return r?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0===d[t]?(d[t]=u.length/3,u.push(e.x,e.y,e.z),d[t]):d[t]}function r(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0===m[t]?(m[t]=p.length,p.push(e.getHex()),m[t]):m[t]}function i(e){var t=e.x.toString()+e.y.toString();return void 0===v[t]?(v[t]=f.length/2,f.push(e.x,e.y),v[t]):v[t]}var n={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),void 0!==this.parameters){var a=this.parameters;for(var s in a)void 0!==a[s]&&(n[s]=a[s]);return n}for(var o,l=[],h=0;h<this.vertices.length;h++)o=this.vertices[h],l.push(o.x,o.y,o.z);for(var c=[],u=[],d={},p=[],m={},f=[],v={},g=0;g<this.faces.length;g++){var y=this.faces[g],x=void 0!==this.faceVertexUvs[0][g],b=0<y.normal.length(),w=0<y.vertexNormals.length,_=1!==y.color.r||1!==y.color.g||1!==y.color.b,M=0<y.vertexColors.length,S=0;if(S=e(S,0,0),S=e(S,1,!0),S=e(S,2,!1),S=e(S,3,x),S=e(S,4,b),S=e(S,5,w),S=e(S,6,_),S=e(S,7,M),c.push(S),c.push(y.a,y.b,y.c),c.push(y.materialIndex),x){var T=this.faceVertexUvs[0][g];c.push(i(T[0]),i(T[1]),i(T[2]))}if(b&&c.push(t(y.normal)),w){var E=y.vertexNormals;c.push(t(E[0]),t(E[1]),t(E[2]))}if(_&&c.push(r(y.color)),M){var A=y.vertexColors;c.push(r(A[0]),r(A[1]),r(A[2]))}}return n.data={},n.data.vertices=l,n.data.normals=u,0<p.length&&(n.data.colors=p),0<f.length&&(n.data.uvs=[f]),n.data.faces=c,n},clone:function(){return(new l).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,r=0,i=t.length;r<i;r++)this.vertices.push(t[r].clone());for(var n=e.colors,a=0,s=n.length;a<s;a++)this.colors.push(n[a].clone());for(var o=e.faces,l=0,h=o.length;l<h;l++)this.faces.push(o[l].clone());for(var c,u=0,d=e.faceVertexUvs.length;u<d;u++){c=e.faceVertexUvs[u],void 0===this.faceVertexUvs[u]&&(this.faceVertexUvs[u]=[]);for(var p=0,m=c.length;p<m;p++){for(var f,v=c[p],g=[],y=0,x=v.length;y<x;y++)f=v[y],g.push(f.clone());this.faceVertexUvs[u].push(g)}}for(var b,w=e.morphTargets,_=0,M=w.length;_<M;_++){if((b={}).name=w[_].name,void 0!==w[_].vertices){b.vertices=[];for(var S=0,T=w[_].vertices.length;S<T;S++)b.vertices.push(w[_].vertices[S].clone())}if(void 0!==w[_].normals){b.normals=[];for(var E=0,A=w[_].normals.length;E<A;E++)b.normals.push(w[_].normals[E].clone())}this.morphTargets.push(b)}for(var L,R=e.morphNormals,C=0,P=R.length;C<P;C++){if(L={},void 0!==R[C].vertexNormals){L.vertexNormals=[];for(var I=0,O=R[C].vertexNormals.length;I<O;I++){var D=R[C].vertexNormals[I],N={};N.a=D.a.clone(),N.b=D.b.clone(),N.c=D.c.clone(),L.vertexNormals.push(N)}}if(void 0!==R[C].faceNormals){L.faceNormals=[];for(var B=0,U=R[C].faceNormals.length;B<U;B++)L.faceNormals.push(R[C].faceNormals[B].clone())}this.morphNormals.push(L)}for(var z=e.skinWeights,F=0,G=z.length;F<G;F++)this.skinWeights.push(z[F].clone());for(var V=e.skinIndices,H=0,k=V.length;H<k;H++)this.skinIndices.push(V[H].clone());for(var j=e.lineDistances,W=0,Z=j.length;W<Z;W++)this.lineDistances.push(j[W]);var q=e.boundingBox;null!==q&&(this.boundingBox=q.clone());var X=e.boundingSphere;return null!==X&&(this.boundingSphere=X.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},computeGroups(){var e,t,r=[],i=void 0,n=this.faces;for(t=0;t<n.length;t++){var a=n[t];a.materialIndex!==i&&(i=a.materialIndex,void 0!==e&&(e.count=3*t-e.start,r.push(e)),e={start:3*t,materialIndex:i})}return void 0!==e&&(e.count=3*t-e.start,r.push(e)),r},toBufferGeometry:function(){var e=(new h).fromGeometry(this),t=new i.BufferGeometry,r=new Float32Array(3*e.vertices.length);if(t.setAttribute("position",new i.BufferAttribute(r,3).copyVector3sArray(e.vertices)),0<e.normals.length){var n=new Float32Array(3*e.normals.length);t.setAttribute("normal",new i.BufferAttribute(n,3).copyVector3sArray(e.normals))}if(0<e.colors.length){var a=new Float32Array(3*e.colors.length);t.setAttribute("color",new i.BufferAttribute(a,3).copyColorsArray(e.colors))}if(0<e.uvs.length){var s=new Float32Array(2*e.uvs.length);t.setAttribute("uv",new i.BufferAttribute(s,2).copyVector2sArray(e.uvs))}if(0<e.uvs2.length){var o=new Float32Array(2*e.uvs2.length);t.setAttribute("uv2",new i.BufferAttribute(o,2).copyVector2sArray(e.uvs2))}for(var l in t.groups=e.groups,e.morphTargets){for(var c=[],u=e.morphTargets[l],d=0,p=u.length;d<p;d++){var m=u[d],f=new i.Float32BufferAttribute(3*m.data.length,3);f.name=m.name,c.push(f.copyVector3sArray(m.data))}t.morphAttributes[l]=c}if(0<e.skinIndices.length){var v=new i.Float32BufferAttribute(4*e.skinIndices.length,4);t.setAttribute("skinIndex",v.copyVector4sArray(e.skinIndices))}if(0<e.skinWeights.length){var g=new i.Float32BufferAttribute(4*e.skinWeights.length,4);t.setAttribute("skinWeight",g.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(t.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(t.boundingBox=e.boundingBox.clone()),t},toIndexedBufferGeometry:function(){var e=new i.BufferGeometry,t=new Float32Array(3*this.vertices.length);if(e.setAttribute("position",new i.BufferAttribute(t,3).copyVector3sArray(this.vertices)),0<this.normals.length){var r=new Float32Array(this.normals.length),n=new i.BufferAttribute(r,3).copyArray(this.normals);e.setAttribute("normal",n)}if(0<this.uvs.length&&0<this.uvs[0].length){var a=new Float32Array(2*this.uvs[0].length);e.setAttribute("uv",new i.BufferAttribute(a,2).copyArray(this.uvs[0]))}if(1<this.uvs.length&&0<this.uvs[1].length){var s=new Float32Array(2*this.uvs[1].length);e.setAttribute("uv2",new i.BufferAttribute(s,2).copyArray(this.uvs[1]))}if(0<this.colors.length){for(var o=[],l=0;l<this.colors.length;l++)o.push(new i.Color(this.colors[l]));var h=new Float32Array(3*o.length);e.setAttribute("color",new i.BufferAttribute(h,3).copyColorsArray(o))}else{for(var c=new Float32Array(3*this.vertices.length),u=0;u<3*this.vertices.length;u++)c[u]=1;e.setAttribute("color",new i.BufferAttribute(c,3))}if(0<this.faces.length){for(var d=[],p=[],m=0;m<this.faces.length;m++){p.push(this.faces[m].a,this.faces[m].b,this.faces[m].c);var f=this.faces[m].vertexColors;if(3===f.length)d.push(f[0],f[1],f[2]);else{var v=this.faces[m].color;d.push(v,v,v)}}e.setIndex(p),e.groups=this.computeGroups()}if(0<this.morphTargets.length){for(var g=[],y=[],x=0,b=this.morphTargets.length;x<b;x++){var w=this.morphTargets[x],_=new i.Float32BufferAttribute(3*w.vertices.length,3);if(_.name=w.name,g.push(_.copyVector3sArray(w.vertices)),w.normals){var M=new i.Float32BufferAttribute(3*w.normals.length,3);M.name=w.name,y.push(M.copyVector3sArray(w.normals))}}e.morphAttributes.position=g,e.morphAttributes.normal=y}if(0<this.skinIndices.length){var S=new i.Float32BufferAttribute(4*this.skinIndices.length,4);e.setAttribute("skinIndex",S.copyVector4sArray(this.skinIndices))}if(0<this.skinWeights.length){var T=new i.Float32BufferAttribute(4*this.skinWeights.length,4);e.setAttribute("skinWeight",T.copyVector4sArray(this.skinWeights))}return null!==this.boundingSphere&&(e.boundingSphere=this.boundingSphere.clone()),null!==this.boundingBox&&(e.boundingBox=this.boundingBox.clone()),e},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)},dispose:function(){this.dispatchEvent({type:"dispose"})}}),l.createBufferGeometryFromObject=function(e){var t=new i.BufferGeometry,r=e.geometry;if(e.isPoints||e.isLine){var n=new i.Float32BufferAttribute(3*r.vertices.length,3),a=new i.Float32BufferAttribute(3*r.colors.length,3);if(t.setAttribute("position",n.copyVector3sArray(r.vertices)),t.setAttribute("color",a.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length){var s=new i.Float32BufferAttribute(r.lineDistances.length,1);t.setAttribute("lineDistance",s.copyArray(r.lineDistances))}null!==r.boundingSphere&&(t.boundingSphere=r.boundingSphere.clone()),null!==r.boundingBox&&(t.boundingBox=r.boundingBox.clone())}else e.isMesh&&(t=r.toBufferGeometry());return t};class h{constructor(){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}computeGroups(e){var t,r,i=[],n=void 0,a=e.faces;for(r=0;r<a.length;r++){var s=a[r];s.materialIndex!==n&&(n=s.materialIndex,void 0!==t&&(t.count=3*r-t.start,i.push(t)),t={start:3*r,materialIndex:n})}void 0!==t&&(t.count=3*r-t.start,i.push(t)),this.groups=i}fromGeometry(e){var t,r=e.faces,n=e.vertices,a=e.faceVertexUvs,s=a[0]&&0<a[0].length,o=a[1]&&0<a[1].length,l=e.morphTargets,h=l.length;if(0<h){t=[];for(var c=0;c<h;c++)t[c]={name:l[c].name,data:[]};this.morphTargets.position=t}var u,d=e.morphNormals,p=d.length;if(0<p){u=[];for(var m=0;m<p;m++)u[m]={name:d[m].name,data:[]};this.morphTargets.normal=u}var f=e.skinIndices,v=e.skinWeights,g=f.length===n.length,y=v.length===n.length;0<n.length&&0===r.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var x,b=0;b<r.length;b++){x=r[b],this.vertices.push(n[x.a],n[x.b],n[x.c]);var w=x.vertexNormals;if(3===w.length)this.normals.push(w[0],w[1],w[2]);else{var _=x.normal;this.normals.push(_,_,_)}var M=x.vertexColors;if(3===M.length)this.colors.push(M[0],M[1],M[2]);else{var S=x.color;this.colors.push(S,S,S)}if(!0===s){var T=a[0][b];void 0===T?(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",b),this.uvs.push(new i.Vector2,new i.Vector2,new i.Vector2)):this.uvs.push(T[0],T[1],T[2])}if(!0===o){var E=a[1][b];void 0===E?(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",b),this.uvs2.push(new i.Vector2,new i.Vector2,new i.Vector2)):this.uvs2.push(E[0],E[1],E[2])}for(var A,L=0;L<h;L++)A=l[L].vertices,t[L].data.push(A[x.a],A[x.b],A[x.c]);for(var R,C=0;C<p;C++)R=d[C].vertexNormals[b],u[C].data.push(R.a,R.b,R.c);g&&this.skinIndices.push(f[x.a],f[x.b],f[x.c]),y&&this.skinWeights.push(v[x.a],v[x.b],v[x.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}}class c{constructor(e,t,r,n,a){var s=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0;this.a=e,this.b=t,this.c=r,this.normal=n&&n.isVector3?n:new i.Vector3,this.vertexNormals=Array.isArray(n)?n:[],this.color=a&&a.isColor?a:new i.Color,this.vertexColors=Array.isArray(a)?a:[],this.materialIndex=s}clone(){return(new this.constructor).copy(this)}copy(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,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var i=0,n=e.vertexColors.length;i<n;i++)this.vertexColors[i]=e.vertexColors[i].clone();return this}}},1781:(e,t,r)=>{"use strict";r.d(t,{a:()=>l});var i,n,a,s,o=r(1515);function l(){}r(1515),l.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,r=0,i=t.length;r<i;r+=2){var n=t[r],a=t[r+1];if(n.test(e))return a}return null}},Object.assign(l.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,r){for(var i=[],n=0;n<e.length;++n)i[n]=this.createMaterial(e[n],t,r);return i},createMaterial:(i={NoBlending:o.NoBlending,NormalBlending:o.NormalBlending,AdditiveBlending:o.AdditiveBlending,SubtractiveBlending:o.SubtractiveBlending,MultiplyBlending:o.MultiplyBlending,CustomBlending:o.CustomBlending},n=new o.Color,a=new o.TextureLoader,s=new o.MaterialLoader,function(e,t,r){function h(e,i,n,s,h){var u,d=t+e,p=l.Handlers.get(d);null===p?(a.setCrossOrigin(r),u=a.load(d)):u=p.load(d),void 0!==i&&(u.repeat.fromArray(i),1!==i[0]&&(u.wrapS=o.RepeatWrapping),1!==i[1]&&(u.wrapT=o.RepeatWrapping)),void 0!==n&&u.offset.fromArray(n),void 0!==s&&("repeat"===s[0]&&(u.wrapS=o.RepeatWrapping),"mirror"===s[0]&&(u.wrapS=o.MirroredRepeatWrapping),"repeat"===s[1]&&(u.wrapT=o.RepeatWrapping),"mirror"===s[1]&&(u.wrapT=o.MirroredRepeatWrapping)),void 0!==h&&(u.anisotropy=h);var m=o.MathUtils.generateUUID();return c[m]=u,m}var c={},u={uuid:o.MathUtils.generateUUID(),type:"MeshLambertMaterial"};for(var d in e){var p=e[d];switch(d){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"DbgName":u.name=p;break;case"blending":u.blending=i[p];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",d,"is no longer supported.");break;case"colorDiffuse":u.color=n.fromArray(p).getHex();break;case"colorSpecular":u.specular=n.fromArray(p).getHex();break;case"colorEmissive":u.emissive=n.fromArray(p).getHex();break;case"specularCoef":u.shininess=p;break;case"shading":"basic"===p.toLowerCase()&&(u.type="MeshBasicMaterial"),"phong"===p.toLowerCase()&&(u.type="MeshPhongMaterial"),"standard"===p.toLowerCase()&&(u.type="MeshStandardMaterial");break;case"mapDiffuse":u.map=h(p,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy);break;case"mapEmissive":u.emissiveMap=h(p,e.mapEmissiveRepeat,e.mapEmissiveOffset,e.mapEmissiveWrap,e.mapEmissiveAnisotropy);break;case"mapLight":u.lightMap=h(p,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy);break;case"mapAO":u.aoMap=h(p,e.mapAORepeat,e.mapAOOffset,e.mapAOWrap,e.mapAOAnisotropy);break;case"mapBump":u.bumpMap=h(p,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy);break;case"mapBumpScale":u.bumpScale=p;break;case"mapNormal":u.normalMap=h(p,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy);break;case"mapNormalFactor":u.normalScale=p;break;case"mapSpecular":u.specularMap=h(p,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy);break;case"mapMetalness":u.metalnessMap=h(p,e.mapMetalnessRepeat,e.mapMetalnessOffset,e.mapMetalnessWrap,e.mapMetalnessAnisotropy);break;case"mapRoughness":u.roughnessMap=h(p,e.mapRoughnessRepeat,e.mapRoughnessOffset,e.mapRoughnessWrap,e.mapRoughnessAnisotropy);break;case"mapAlpha":u.alphaMap=h(p,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy);break;case"flipSided":u.side=o.BackSide;break;case"doubleSided":u.side=o.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),u.opacity=p;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":u[d]=p;break;case"vertexColors":!0===p&&(u.vertexColors=o.VertexColors),"face"===p&&(u.vertexColors=o.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",d,p)}}return"MeshBasicMaterial"===u.type&&delete u.emissive,"MeshPhongMaterial"!==u.type&&delete u.specular,1>u.opacity&&(u.transparent=!0),s.setTextures(c),s.parse(u)})})},377:(e,t,r)=>{"use strict";r.d(t,{O:()=>c});var i=r(1515),n=new i.Matrix4,a=new i.Ray,s=new i.Sphere,o=new i.Vector3,l=new i.Vector3,h=new i.Vector3;class c extends i.Object3D{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new i.BufferGeometry,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new i.PointsMaterial;super(),this.type="Points",this.geometry=e,this.material=t,this.sizePerPixel=1,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){var r=this.geometry,i=this.matrixWorld,l=e.params.Points.threshold,h=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),s.copy(r.boundingSphere),s.applyMatrix4(i),s.radius+=l,!1!==e.ray.intersectsSphere(s)){n.copy(i).invert(),a.copy(e.ray).applyMatrix4(n);var c=l/((this.scale.x+this.scale.y+this.scale.z)/3)*this.material.size*this.sizePerPixel,p=c*c;if(r.isBufferGeometry){var m=r.index,f=r.attributes.position,v=r.morphAttributes.position;if(null!==m)for(var g,y=Math.max(0,h.start),x=Math.min(m.count,h.start+h.count),b=y;b<x;b++)d(this,f,v,g=m.getX(b)),u(o,g,p,i,e,t,this);else for(var w=Math.max(0,h.start),_=Math.min(f.count,h.start+h.count),M=w;M<_;M++)d(this,f,v,M),u(o,M,p,i,e,t,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,r=Object.keys(t);if(0<r.length){var i=t[r[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var n,a=0,s=i.length;a<s;a++)n=i[a].name||a+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=a}}}else{var o=e.morphTargets;void 0!==o&&0<o.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function u(e,t,r,n,s,o,l){var h=a.distanceSqToPoint(e);if(h<r){var c=new i.Vector3;a.closestPointToPoint(e,c),c.applyMatrix4(n);var u=s.ray.origin.distanceTo(c);if(u<s.near||u>s.far)return;o.push({distance:u,distanceToRay:Math.sqrt(h),point:c,index:t,face:null,object:l})}}function d(e,t,r,i){o.fromBufferAttribute(t,i);var n=e.morphTargetInfluences;if(e.material.morphTargets&&r&&n){l.set(0,0,0);for(var a=0,s=r.length;a<s;a++){var c=n[a],u=r[a];0!==c&&(h.fromBufferAttribute(u,i),l.addScaledVector(h.sub(o),c))}o.add(l)}}c.prototype.isPoints=!0},9236:(e,t,r)=>{"use strict";r.d(t,{G:()=>n});var i=r(1515);i.UniformsLib.line={linewidth:{value:1},resolution:{value:new i.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},dashOffset:{value:0},gapSize:{value:1},opacity:{value:1}},i.ShaderLib.line={uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.fog,i.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef ALPHA_TO_COVERAGE\n\n\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\tfloat a = vUv.x;\n\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\tfloat len2 = a * a + b * b;\n\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t}\n\n\t\t\t#else\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}"};class n extends i.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:i.UniformsUtils.clone(i.ShaderLib.line.uniforms),vertexShader:i.ShaderLib.line.vertexShader,fragmentShader:i.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return!!("USE_DASH"in this.defines)},set(e){!!e!=!!("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return!!("ALPHA_TO_COVERAGE"in this.defines)},set:function(e){!!e!=!!("ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}n.prototype.isLineMaterial=!0},1491:(e,t,r)=>{"use strict";r.d(t,{D:()=>g});var i=r(1515),n=new i.Vector3,a=new i.Vector3,s=new i.Matrix4,o=new i.Ray,l=new i.Sphere,h=new i.Vector3,c=new i.Vector3,u=new i.Vector3,d=new i.Vector3;class p extends i.Object3D{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new i.BufferGeometry,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new i.LineBasicMaterial;super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[0],s=1,o=t.count;s<o;s++)n.fromBufferAttribute(t,s-1),a.fromBufferAttribute(t,s),r[s]=r[s-1],r[s]+=n.distanceTo(a);e.setAttribute("lineDistance",new i.Float32BufferAttribute(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){var r=this.geometry,n=this.matrixWorld,a=e.params.Line.threshold,h=r.drawRange,c=r.morphAttributes.position;if(null===r.boundingSphere&&r.computeBoundingSphere(),l.copy(r.boundingSphere),l.applyMatrix4(n),l.radius+=a,!1!==e.ray.intersectsSphere(l)){s.copy(n).invert(),o.copy(e.ray).applyMatrix4(s);var u=a/((this.scale.x+this.scale.y+this.scale.z)/3),d=u*u,p=new i.Vector3,f=new i.Vector3,v=new i.Vector3,g=new i.Vector3,y=this.isLineSegments?2:1;if(r.isBufferGeometry){var x=r.index,b=r.attributes.position;if(null!==x){for(var w=Math.max(0,h.start),_=Math.min(x.count,h.start+h.count),M=w;M<_-1;M+=y)if(m(p,f,this,b,c,x.getX(M),x.getX(M+1)),!(o.distanceSqToSegment(p,f,g,v)>d)){g.applyMatrix4(this.matrixWorld);var S=e.ray.origin.distanceTo(g);S<e.near||S>e.far||t.push({distance:S,point:v.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this})}}else for(var T=Math.max(0,h.start),E=Math.min(b.count,h.start+h.count),A=T;A<E-1;A+=y)if(m(p,f,this,b,c,A,A+1),!(o.distanceSqToSegment(p,f,g,v)>d)){g.applyMatrix4(this.matrixWorld);var L=e.ray.origin.distanceTo(g);L<e.near||L>e.far||t.push({distance:L,point:v.clone().applyMatrix4(this.matrixWorld),index:A,face:null,faceIndex:null,object:this})}}else r.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,r=Object.keys(t);if(0<r.length){var i=t[r[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var n,a=0,s=i.length;a<s;a++)n=i[a].name||a+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=a}}}else{var o=e.morphTargets;void 0!==o&&0<o.length&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function m(e,t,r,i,n,a,s){e.fromBufferAttribute(i,a),t.fromBufferAttribute(i,s);var o=r.morphTargetInfluences;if(r.material.morphTargets&&n&&o){h.set(0,0,0),c.set(0,0,0);for(var l=0,p=n.length;l<p;l++){var m=o[l],f=n[l];0!==m&&(u.fromBufferAttribute(f,a),d.fromBufferAttribute(f,s),h.addScaledVector(u.sub(e),m),c.addScaledVector(d.sub(t),m))}e.add(h),t.add(c)}}p.prototype.isLine=!0;var f=new i.Vector3,v=new i.Vector3;class g extends p{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[],n=0,a=t.count;n<a;n+=2)f.fromBufferAttribute(t,n),v.fromBufferAttribute(t,n+1),r[n]=0==n?0:r[n-1],r[n+1]=r[n]+f.distanceTo(v);e.setAttribute("lineDistance",new i.Float32BufferAttribute(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}g.prototype.isLineSegments=!0},8233:(e,t,r)=>{"use strict";r.d(t,{b:()=>y});var i=r(1515),n=r(5807),a=r(9236),s=new i.Vector3,o=new i.Vector3,l=new i.Vector4,h=new i.Vector4,c=new i.Vector4,u=new i.Vector3,d=new i.Matrix4,p=new i.Line3,m=new i.Vector3,f=new i.Box3,v=new i.Sphere,g=new i.Vector4;class y extends i.Mesh{constructor(){super(0<arguments.length&&void 0!==arguments[0]?arguments[0]:new n.n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:new a.G({color:16777215*Math.random()})),this.type="LineSegments2"}computeLineDistances(){for(var e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,n=new Float32Array(2*t.count),a=0,l=0,h=t.count;a<h;a++,l+=2)s.fromBufferAttribute(t,a),o.fromBufferAttribute(r,a),n[l]=0==l?0:n[l-1],n[l+1]=n[l]+s.distanceTo(o);var c=new i.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new i.InterleavedBufferAttribute(c,1,0)),e.setAttribute("instanceDistanceEnd",new i.InterleavedBufferAttribute(c,1,1)),this}raycast(e,t){null===e.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var r=void 0===e.params.Line2?0:e.params.Line2.threshold||0,n=e.ray,a=e.camera,s=a.projectionMatrix,o=this.matrixWorld,y=this.geometry,x=this.material,b=x.resolution,w=x.linewidth+r,_=y.attributes.instanceStart,M=y.attributes.instanceEnd,S=-a.near,T=2*Math.max(w/b.width,w/b.height);null===y.boundingSphere&&y.computeBoundingSphere(),v.copy(y.boundingSphere).applyMatrix4(o);var E=Math.max(a.near,v.distanceToPoint(n.origin));g.set(0,0,-E,1).applyMatrix4(a.projectionMatrix),g.multiplyScalar(1/g.w),g.applyMatrix4(a.projectionMatrixInverse);var A=.5*Math.abs(T/g.w);if(v.radius+=A,!1!==e.ray.intersectsSphere(v)){null===y.boundingBox&&y.computeBoundingBox(),f.copy(y.boundingBox).applyMatrix4(o);var L=Math.max(a.near,f.distanceToPoint(n.origin));g.set(0,0,-L,1).applyMatrix4(a.projectionMatrix),g.multiplyScalar(1/g.w),g.applyMatrix4(a.projectionMatrixInverse);var R=.5*Math.abs(T/g.w);if(f.max.x+=R,f.max.y+=R,f.max.z+=R,f.min.x-=R,f.min.y-=R,f.min.z-=R,!1!==e.ray.intersectsBox(f)){n.at(1,c),c.w=1,c.applyMatrix4(a.matrixWorldInverse),c.applyMatrix4(s),c.multiplyScalar(1/c.w),c.x*=b.x/2,c.y*=b.y/2,c.z=0,u.copy(c),d.multiplyMatrices(a.matrixWorldInverse,o);for(var C=0,P=_.count;C<P;C++)if(l.fromBufferAttribute(_,C),h.fromBufferAttribute(M,C),l.w=1,h.w=1,l.applyMatrix4(d),h.applyMatrix4(d),!(l.z>S&&h.z>S)){if(l.z>S){var I=l.z-h.z,O=(l.z-S)/I;l.lerp(h,O)}else if(h.z>S){var D=h.z-l.z,N=(h.z-S)/D;h.lerp(l,N)}l.applyMatrix4(s),h.applyMatrix4(s),l.multiplyScalar(1/l.w),h.multiplyScalar(1/h.w),l.x*=b.x/2,l.y*=b.y/2,h.x*=b.x/2,h.y*=b.y/2,p.start.copy(l),p.start.z=0,p.end.copy(h),p.end.z=0;var B=p.closestPointToPointParameter(u,!0);p.at(B,m);var U=i.MathUtils.lerp(l.z,h.z,B),z=-1<=U&&1>=U,F=u.distanceTo(m)<.5*w;if(z&&F){p.start.fromBufferAttribute(_,C),p.end.fromBufferAttribute(M,C),p.start.applyMatrix4(o),p.end.applyMatrix4(o);var G=new i.Vector3,V=new i.Vector3;n.distanceSqToSegment(p.start,p.end,V,G),t.push({point:V,pointOnLine:G,distance:n.origin.distanceTo(V),object:this,face:null,faceIndex:C,uv:null,uv2:null})}}}}}}y.prototype.LineSegments2=!0},5807:(e,t,r)=>{"use strict";r.d(t,{n:()=>s});var i=r(1515),n=new i.Box3,a=new i.Vector3;class s extends i.InstancedBufferGeometry{constructor(){super(),this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new i.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new i.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var r=new i.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new i.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceEnd",new i.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var r=new i.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new i.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceColorEnd",new i.InterleavedBufferAttribute(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new i.WireframeGeometry(e.geometry)),this}fromLineSegments(e){var t=e.geometry;return t.isGeometry?void console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead."):(t.isBufferGeometry&&this.setPositions(t.attributes.position.array),this)}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new i.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),n.setFromBufferAttribute(t),this.boundingBox.union(n))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new i.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var r=this.boundingSphere.center;this.boundingBox.getCenter(r);for(var n=0,s=0,o=e.count;s<o;s++)a.fromBufferAttribute(e,s),n=Math.max(n,r.distanceToSquared(a)),a.fromBufferAttribute(t,s),n=Math.max(n,r.distanceToSquared(a));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}s.prototype.isLineSegmentsGeometry=!0},2515:(e,t,r)=>{var i=r(1515),n=r(8154).V,a=r(8221).A;function s(e){var t=e,i=r(1913).modelPrefix;return i&&("/"!=i[i.length-1]&&function(e){throw new TypeError('"prefix" is read-only')}(),/^(?:[a-z]+:)?\/\//i.test(e)||(t=i+e)),t}function o(e,t,r,i){var n=new XMLHttpRequest;n.open("GET",s(e),!0),n.onreadystatechange=()=>{4==n.readyState&&(200==n.status?r(n.responseText,t):i(e))},n.send(null)}t.getColorsRGB=(e,t)=>{var r=Math.floor(t/3),n=t%3,a=0;0==n?a=e[r].r:1==n?a=e[r].g:2==n&&(a=e[r].b);var s=new i.Color(a);return[s.r,s.g,s.b]},t.updateMorphColorAttribute=function(e,t){if(t&&e&&e.morphAttributes&&e.morphAttributes.color){var r=e.morphAttributes.color,i=t.morphTargetInfluences,n=i.length;e.deleteAttribute("morphColor0"),e.deleteAttribute("morphColor1");for(var a=0,s=[],o=0;1>a||o<n;o++)0<i[o]&&(a++,s.push([o,i[o]]));2==s.length?(e.setAttribute("morphColor0",r[s[0][0]]),e.setAttribute("morphColor1",r[s[1][0]])):1==s.length&&(e.setAttribute("morphColor0",r[s[0][0]]),e.setAttribute("morphColor1",r[s[0][0]]))}},t.toBufferGeometry=(e,t)=>{var r;return e instanceof n?(t.localTimeEnabled&&!e.morphNormalsReady&&(null==e.morphNormals||0==e.morphNormals.length)&&e.computeMorphNormals(),r=e.toIndexedBufferGeometry(),t.localMorphColour&&l(e,r)):e instanceof i.BufferGeometry&&(r=e.clone()),r.colorsNeedUpdate=!0,r.computeBoundingBox(),r.computeBoundingSphere(),e._video&&(r._video=e._video),r},t.copyMorphColorsToBufferGeometry=(e,t)=>{if(e&&e.morphColors&&0<e.morphColors.length){for(var n=[],a=e.morphColors,s=r(2515).getColorsRGB,o=0,l=a.length;o<l;o++){for(var h=a[o],c=[],u=0;u<e.faces.length;u++){var d=e.faces[u],p=s(h.colors,d.a);c.push(p[0],p[1],p[2]),p=s(h.colors,d.b),c.push(p[0],p[1],p[2]),p=s(h.colors,d.c),c.push(p[0],p[1],p[2])}var m=new i.Float32BufferAttribute(3*e.faces.length*3,3);m.name=h.name,n.push(m.copyArray(c))}t.morphAttributes.color=n}};var l=(e,t)=>{if(e&&e.morphColors&&0<e.morphColors.length){for(var n=[],a=e.morphColors,s=r(2515).getColorsRGB,o=0,l=a.length;o<l;o++){for(var h,c=a[o],u=[],d=0;d<3*c.colors.length;d++)h=s(c.colors,d),u.push(h[0],h[1],h[2]);var p=new i.Float32BufferAttribute(u,3);p.name=c.name,n.push(p)}t.morphAttributes.color=n}};t.mergeVertices=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1e-4;t=Math.max(t,Number.EPSILON);for(var r={},n=e.getIndex(),a=e.getAttribute("position"),s=n?n.count:a.count,o=0,l=Object.keys(e.attributes),h={},c={},u=[],d=["getX","getY","getZ","getW"],p=0,m=l.length;p<m;p++)h[b=l[p]]=[],(T=e.morphAttributes[b])&&(c[b]=Array(T.length).fill().map((()=>[])));var f=Math.log10(1/t),v=Math.pow(10,f);for(p=0;p<s;p++){var g=n?n.getX(p):p,y="",x=0;for(m=l.length;x<m;x++)for(var b=l[x],w=(S=e.getAttribute(b)).itemSize,_=0;_<w;_++)y+="".concat(~~(S[d[_]](g)*v),",");if(y in r)u.push(r[y]);else{for(x=0,m=l.length;x<m;x++){b=l[x];var M,S=e.getAttribute(b),T=e.morphAttributes[b],E=(w=S.itemSize,h[b]),A=c[b];for(_=0;_<w;_++)if(M=d[_],E.push(S[M](g)),T)for(var L=0,R=T.length;L<R;L++)A[L].push(T[L][M](g))}r[y]=o,u.push(o),o++}}var C=e.clone();for(p=0,m=l.length;p<m;p++){b=l[p];var P,I=e.getAttribute(b),O=new I.array.constructor(h[b]);if(I.isInterleavedBufferAttribute?S=new i.BufferAttribute(O,I.itemSize,I.itemSize):(S=e.getAttribute(b).clone()).setArray(O),C.setAttribute(b,S),b in c)for(x=0;x<c[b].length;x++)(P=e.morphAttributes[b][x].clone()).setArray(new P.array.constructor(c[b][x])),C.morphAttributes[b][x]=P}var D=Uint8Array;u.length>=Math.pow(2,8)&&(D=Uint16Array),u.length>=Math.pow(2,16)&&(D=Uint32Array);var N=new D(u);return u=null,null===n?u=new i.BufferAttribute(N,1):(u=e.getIndex().clone()).setArray(N),C.setIndex(u),C},t.getBoundingBox=function(e,t,r,i,n){var a=e.morphTargetInfluences,s=void 0;e.geometry&&(s=e.geometry.morphAttributes);var o=!1;if(a&&s&&s.position){i.set(0,0,0),n.set(0,0,0);for(var l=0;l<a.length;l++)0<a[l]&&(o=!0,r.setFromArray(s.position[l].array),i.add(r.min.multiplyScalar(a[l])),n.add(r.max.multiplyScalar(a[l])));o&&t.set(i,n)}o||t.setFromBufferAttribute(e.geometry.attributes.position),e.updateWorldMatrix(!0,!0),t.applyMatrix4(e.matrixWorld)},t.createNewURL=function(e,t){var r=(e,t)=>{try{var r=new URL(e,t).href;if(e&&2>e.split("?").length){var i=t.split("?");2===i.length&&(r=r+"?"+i[1])}return r}catch(t){console.error("There is an issue creating the url link with: ".concat(e,"."))}};if(!Array.isArray(e))return r(e,t);var i=[];return e.forEach((e=>{i.push(r(e,t))})),i},t.createBufferGeometry=function(e,t){if(t&&e>=t.length){var r=new i.BufferGeometry,n=new Float32Array(3*e),a=0;return t.forEach((e=>{n[a++]=e[0],n[a++]=e[1],n[a++]=e[2]})),r.setAttribute("position",new i.BufferAttribute(n,3)),r.setDrawRange(0,t.length),r}},t.getCircularTexture=function(){var e=new Image;e.src=r(2978);var t=new i.Texture;return t.image=e,t.needsUpdate=!0,t},t.resolveURL=s,t.loadExternalFile=o,t.loadExternalFiles=function(e,t,r){function i(e,r){s[r]=e,++a==n&&t(s)}for(var n=e.length,a=0,s=[],l=0;l<n;l++)o(e[l],l,i,r)},t.PhongToToon=function(e){if(e.isMeshPhongMaterial){var t=new i.MeshToonMaterial({color:e.color.clone(),morphTargets:e.morphTargets,morphNormals:e.morphNormals,vertexColors:e.vertexColors,transparent:e.transparent,opacity:e.opacity,side:e.side});return e.map&&(t.map=e.map),t}return e},t.createNewSpriteText=function(e,t,r,i,n,s){var o=new a(e,t,r,i,n,s);return o.fontFace=i,o.fontSize=n,o.fontWeight=s,o.material.map.generateMipmaps=!1,o.material.map.anisotropy=4,o.material.sizeAttenuation=!1,o.material.alphaTest=.5,o.material.transparent=!0,o.material.depthWrite=!1,o.material.depthTest=!1,o.center.set(.5,-1.2),o.renderOrder=1e4,o},t.isRegionGroup=function(e,t,r){if(r){var i=e||"",n=t||"",a=r.lastIndexOf("/");if(-1<a){var s=void 0,o=void 0;if(s=r.substring(0,a),o=r.substring(a+1),!("*"!==s&&"**"!==s&&s.toLowerCase()!==i.toLowerCase()||"*"!==o&&"**"!==o&&o.toLowerCase()!==n.toLowerCase()))return!0}else if(i.toLowerCase()===r.toLowerCase()||n.toLowerCase()===r.toLowerCase())return!0}return!1}},1574:(e,t,r)=>{var i=r(1515);t.i=function(e){var t=this;this.video=void 0,this.videoTexture=void 0,this.setMorphTime=function(e,r){var i=e/r*t.video.duration;t.video.currentTime=i},this.getVideoDuration=function(){return t.video.duration},this.createCanvasVideoTexture=function(){return t.videoTexture=new i.VideoTexture(t.video),t.videoTexture.minFilter=i.LinearFilter,t.videoTexture.magFilter=i.LinearFilter,t.videoTexture.format=i.RGBFormat,t.video.currentTime=0,t.videoTexture},this.getCurrentTime=function(e){return t.video?e*(t.video.currentTime/t.video.duration):0},this.isReadyToPlay=function(){return!!(t.video&&3<=t.video.readyState)},document&&(t.video=document.createElement("video"),t.video.crossOrigin="anonymous",t.video.src=e,t.video.load(),t.video.loop=!0)}},4494:(e,t,r)=>{var i=r(5672).V,n=r(1515),a=n.BufferGeometryLoader;e.exports=function(e){var t=void 0,s=function(e){var t=(new a).parse(e),r=new n.MeshPhongMaterial,s=new n.Mesh(t.geometry,r),o=new i;return o.setMorph(s),o};e.addEventListener("message",(function(i){switch(i.data.action){case"initialise":n=i.data.object,a=s(n),t=new(r(8701).$)(a),e.postMessage({action:"message",message:"Initialised"});break;case"intersect":!function(r){if(t){var i=s(r),n=t.intersect(i).toBufferGeometry().toJSON();e.postMessage({action:"result",object:n})}}(i.data.object);break;case"subtract":!function(r){if(t){var i=s(r),n=t.subtract(i).toBufferGeometry().toJSON();e.postMessage({action:"result",object:n})}}(i.data.object);break;case"union":!function(r){if(t){var i=s(r),n=t.union(i).toBufferGeometry().toJSON();e.postMessage({action:"result",object:n})}}(i.data.object);break;default:throw"Cannot handle specified action."}var n,a}))}},8701:(e,t,r)=>{var i=r(1515),n=r(6133)(i);r(5672).V,r(3152).w,t.$=function(e){var t,r;e&&e.isGeometry&&(t=e),this.setGeometry=e=>{e&&e.isGeometry&&(t=e),r=void 0},this.setCSG=e=>{r=e};var i=e=>{if(t&&t.morph&&e&&e.morph)return void 0===r&&(r=new n(t.morph)),new n(e.morph)};this.intersect=e=>{var t=i(e);return r&&t?r.intersect(t):void 0},this.subtract=e=>{var t=i(e);return r&&t?r.subtract(t):void 0},this.union=e=>{var t=i(e);return r&&t?r.union(t):void 0}}},1913:(e,t,r)=>{r(6550);var i=r(8330).version;e.exports=new function(){this.Revision=i,this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.modelPrefix=void 0,this.Geometry=r(5672).V,this.Glyph=r(9344).z,this.Glyphset=r(2842).V,this.Pointset=r(770).t,this.Label=r(4296).J,this.Lines=r(8145).q,this.TextureArray=r(3523).$,this.TextureSlides=r(4291).W,this.Renderer=r(3260).A,this.Scene=r(5015).Z,this.GeometryCSG=r(3152).w,this.GlyphsetCSG=r(1602).K,this.Viewport=r(701).Viewport,this.CameraControls=r(701).CameraControls,this.SmoothCameraTransition=r(701).SmoothCameraTransition,this.RayCaster=r(701).RayCaster,this.CameraAutoTumble=r(701).CameraAutoTumble,this.StereoEffect=r(701).StereoEffect,this.loadExternalFile=r(2515).loadExternalFile,this.loadExternalFiles=r(2515).loadExternalFiles,this.THREE=r(1515)}},2978:e=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg=="},2370:e=>{e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgdmlld0JveD0iMCAwIDM2NSA1NjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4NCjxkZWZzPg0KPC9kZWZzPg0KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCAwKSIgaWQ9IjgwOGVkMjgzLTI1MjQtNDQwZi04OGFlLTNiZGI0N2JiNTc0OSIgID4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4NCjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItMTgyLjUiIHk9Ii0yODAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIC8+DQo8L2c+DQo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+DQo8ZyBzdHlsZT0iIiAgID4NCjwvZz4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCA5Ny41KSIgID4NCjxnIHN0eWxlPSIiICAgPg0KPC9nPg0KPC9nPg0KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMC45OSAwIDAgMC45OSAxODIuNSAyODApIiAgPg0KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii01NDAiIHk9Ii01NDAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjEwODAiIGhlaWdodD0iMTA4MCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHBhdGggc3R5bGU9InN0cm9rZTogcmdiKDAsMCwwKTsgc3Ryb2tlLXdpZHRoOiAwOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMCw4OSwxMTYpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB0cmFuc2Zvcm09IiB0cmFuc2xhdGUoLTE4Mi45LCAtMjc5Ljg1KSIgZD0iTSAxODIuOSA1NTEuNyBDIDE4Mi45IDU1MS44MDAwMDAwMDAwMDAxIDE4My4xIDU1MiAxODMuMSA1NTIgQyAxODMuMSA1NTIgMzU4LjMgMjgzIDM1OC4zIDE5NC42IEMgMzU4LjMgNjQuNSAyNjkuNSA3LjkwMDAwMDAwMDAwMDAwNiAxODIuOSA3LjY5OTk5OTk5OTk5OTk4OSBDIDk2LjMgNy45IDcuNSA2NC41IDcuNSAxOTQuNiBDIDcuNSAyODMgMTgyLjggNTUyIDE4Mi44IDU1MiBDIDE4Mi44IDU1MiAxODIuOSA1NTEuNyAxODIuOSA1NTEuNyB6IE0gMTIyLjIgMTg3LjIgQyAxMjIuMiAxNTMuNiAxNDkuNCAxMjYuMzk5OTk5OTk5OTk5OTkgMTgzIDEyNi4zOTk5OTk5OTk5OTk5OSBDIDIxNi42IDEyNi4zOTk5OTk5OTk5OTk5OSAyNDMuOCAxNTMuNiAyNDMuOCAxODcuMiBDIDI0My44IDIyMC43OTk5OTk5OTk5OTk5OCAyMTYuNSAyNDggMTgyLjkgMjQ4IEMgMTQ5LjQgMjQ4IDEyMi4yIDIyMC44IDEyMi4yIDE4Ny4yIHoiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPg0KPGNpcmNsZSBzdHlsZT0ic3Ryb2tlOiByZ2IoMCwwLDApOyBzdHJva2Utd2lkdGg6IDA7IHN0cm9rZS1kYXNoYXJyYXk6IG5vbmU7IHN0cm9rZS1saW5lY2FwOiBidXR0OyBzdHJva2UtZGFzaG9mZnNldDogMDsgc3Ryb2tlLWxpbmVqb2luOiBtaXRlcjsgc3Ryb2tlLW1pdGVybGltaXQ6IDQ7IGZpbGw6IHJnYigyNTUsMjU1LDI1NSk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIGN4PSIwIiBjeT0iMCIgcj0iMzUiIC8+DQo8L2c+DQo8L2c+DQo8L2c+DQo8L3N2Zz4="},7328:e=>{e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIHZpZXdCb3g9IjAgMCAzNjUgNTYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4KPGRlZnM+CjwvZGVmcz4KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDApIiBpZD0iODA4ZWQyODMtMjUyNC00NDBmLTg4YWUtM2JkYjQ3YmI1NzQ5IiAgPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii0xODIuNSIgeT0iLTI4MCIgcng9IjAiIHJ5PSIwIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgLz4KPC9nPgo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+CjxnIHN0eWxlPSIiICAgPgo8L2c+CjwvZz4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDk3LjUpIiAgPgo8ZyBzdHlsZT0iIiAgID4KPC9nPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDAuOTkgMCAwIDAuOTkgMTgyLjUgMjgwKSIgID4KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItNTQwIiB5PSItNTQwIiByeD0iMCIgcnk9IjAiIHdpZHRoPSIxMDgwIiBoZWlnaHQ9IjEwODAiIC8+CjwvZz4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxwYXRoIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwxNjUsMCk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHRyYW5zZm9ybT0iIHRyYW5zbGF0ZSgtMTgyLjksIC0yNzkuODUpIiBkPSJNIDE4Mi45IDU1MS43IEMgMTgyLjkgNTUxLjgwMDAwMDAwMDAwMDEgMTgzLjEgNTUyIDE4My4xIDU1MiBDIDE4My4xIDU1MiAzNTguMyAyODMgMzU4LjMgMTk0LjYgQyAzNTguMyA2NC41IDI2OS41IDcuOTAwMDAwMDAwMDAwMDA2IDE4Mi45IDcuNjk5OTk5OTk5OTk5OTg5IEMgOTYuMyA3LjkgNy41IDY0LjUgNy41IDE5NC42IEMgNy41IDI4MyAxODIuOCA1NTIgMTgyLjggNTUyIEMgMTgyLjggNTUyIDE4Mi45IDU1MS43IDE4Mi45IDU1MS43IHogTSAxMjIuMiAxODcuMiBDIDEyMi4yIDE1My42IDE0OS40IDEyNi4zOTk5OTk5OTk5OTk5OSAxODMgMTI2LjM5OTk5OTk5OTk5OTk5IEMgMjE2LjYgMTI2LjM5OTk5OTk5OTk5OTk5IDI0My44IDE1My42IDI0My44IDE4Ny4yIEMgMjQzLjggMjIwLjc5OTk5OTk5OTk5OTk4IDIxNi41IDI0OCAxODIuOSAyNDggQyAxNDkuNCAyNDggMTIyLjIgMjIwLjggMTIyLjIgMTg3LjIgeiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiAvPgo8L2c+CgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPgo8Y2lyY2xlIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgY3g9IjAiIGN5PSIwIiByPSIzNSIgLz4KPC9nPgo8L2c+CjwvZz4KPC9zdmc+"},9425:(e,t,r)=>{"use strict";r.d(t,{B:()=>n});var i=r(1515);class n extends i.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new h(e)})),this.register((function(e){return new u(e)})),this.register((function(e){return new d(e)})),this.register((function(e){return new c(e)})),this.register((function(e){return new o(e)})),this.register((function(e){return new p(e)}))}load(e,t,r,n){var a,s=this;a=""===this.resourcePath?""===this.path?i.LoaderUtils.extractUrlBase(e):this.path:this.resourcePath,this.manager.itemStart(e);var o=function(t){n?n(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)},l=new i.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(r){try{s.parse(r,a,(function(r){t(r),s.manager.itemEnd(e)}),o)}catch(e){o(e)}}),r,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,n){var a,o={},h={};if("string"==typeof e)a=e;else if(i.LoaderUtils.decodeText(new Uint8Array(e,0,4))===m){try{o[s.KHR_BINARY_GLTF]=new f(e)}catch(e){return void(n&&n(e))}a=o[s.KHR_BINARY_GLTF].content}else a=i.LoaderUtils.decodeText(new Uint8Array(e));var c=JSON.parse(a);if(void 0===c.asset||2>c.asset.version[0])n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var u=new N(c,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(var d,p=0;p<this.pluginCallbacks.length;p++)h[(d=this.pluginCallbacks[p](u)).name]=d,o[d.name]=!0;if(c.extensionsUsed)for(var y=0;y<c.extensionsUsed.length;++y){var w=c.extensionsUsed[y],_=c.extensionsRequired||[];w===s.KHR_MATERIALS_UNLIT?o[w]=new l:w===s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS?o[w]=new x:w===s.KHR_DRACO_MESH_COMPRESSION?o[w]=new v(c,this.dracoLoader):w===s.KHR_TEXTURE_TRANSFORM?o[w]=new g:w===s.KHR_MESH_QUANTIZATION?o[w]=new b:0<=_.indexOf(w)&&void 0===h[w]&&console.warn('THREE.GLTFLoader: Unknown extension "'+w+'".')}u.setExtensions(o),u.setPlugins(h),u.parse(r,n)}}}function a(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var s={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",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class o{constructor(e){this.parser=e,this.name=s.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){for(var e,t=this.parser,r=this.parser.json.nodes||[],i=0,n=r.length;i<n;i++)(e=r[i]).extensions&&e.extensions[this.name]&&void 0!==e.extensions[this.name].light&&t._addNodeRef(this.cache,e.extensions[this.name].light)}_loadLight(e){var t=this.parser,r="light:"+e,n=t.cache.get(r);if(n)return n;var a,s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l=new i.Color(16777215);void 0!==o.color&&l.fromArray(o.color);var h=void 0===o.range?0:o.range;switch(o.type){case"directional":(a=new i.DirectionalLight(l)).target.position.set(0,0,-1),a.add(a.target);break;case"point":(a=new i.PointLight(l)).distance=h;break;case"spot":(a=new i.SpotLight(l)).distance=h,o.spot=o.spot||{},o.spot.innerConeAngle=void 0===o.spot.innerConeAngle?0:o.spot.innerConeAngle,o.spot.outerConeAngle=void 0===o.spot.outerConeAngle?Math.PI/4:o.spot.outerConeAngle,a.angle=o.spot.outerConeAngle,a.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return a.position.set(0,0,0),a.decay=2,void 0!==o.intensity&&(a.intensity=o.intensity),a.name=t.createUniqueName(o.name||"light_"+e),n=Promise.resolve(a),t.cache.add(r,n),n}createNodeAttachment(e){var t=this,r=this.parser,i=r.json.nodes[e],n=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}class l{constructor(){this.name=s.KHR_MATERIALS_UNLIT}getMaterialType(){return i.MeshBasicMaterial}extendParams(e,t,r){var n=[];e.color=new i.Color(1,1,1),e.opacity=1;var a=t.pbrMetallicRoughness;if(a){if(Array.isArray(a.baseColorFactor)){var s=a.baseColorFactor;e.color.fromArray(s),e.opacity=s[3]}void 0!==a.baseColorTexture&&n.push(r.assignTexture(e,"map",a.baseColorTexture))}return Promise.all(n)}}class h{constructor(e){this.parser=e,this.name=s.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?i.MeshPhysicalMaterial:null}extendMaterialParams(e,t){var r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var a=[],s=n.extensions[this.name];if(void 0!==s.clearcoatFactor&&(t.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&a.push(r.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&a.push(r.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(a.push(r.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){var o=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new i.Vector2(o,-o)}return Promise.all(a)}}class c{constructor(e){this.parser=e,this.name=s.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?i.MeshPhysicalMaterial:null}extendMaterialParams(e,t){var r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();var n=[],a=i.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(n)}}class u{constructor(e){this.parser=e,this.name=s.KHR_TEXTURE_BASISU}loadTexture(e){var t=this.parser,r=t.json,i=r.textures[e];if(!i.extensions||!i.extensions[this.name])return null;var n=i.extensions[this.name],a=r.images[n.source],s=t.options.ktx2Loader;if(!s){if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,a,s)}}class d{constructor(e){this.parser=e,this.name=s.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){var t=this.name,r=this.parser,i=r.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;var a=n.extensions[t],s=i.images[a.source],o=r.textureLoader;if(s.uri){var l=r.options.manager.getHandler(s.uri);null!==l&&(o=l)}return this.detectSupport().then((function(n){if(n)return r.loadTextureImage(e,s,o);if(i.extensionsRequired&&0<=i.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class p{constructor(e){this.name=s.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){var t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){var i=r.extensions[this.name],n=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&0<=t.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([n,a.ready]).then((function(e){var t=i.byteOffset||0,r=i.byteLength||0,n=i.count,s=i.byteStride,o=new ArrayBuffer(n*s),l=new Uint8Array(e[0],t,r);return a.decodeGltfBuffer(new Uint8Array(o),n,s,l,i.mode,i.filter),o}))}return null}}var m="glTF";class f{constructor(e){this.name=s.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,12);if(this.header={magic:i.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==m)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(2>this.header.version)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var r,n=this.header.length-12,a=new DataView(e,12),o=0;o<n;){r=a.getUint32(o,!0),o+=4;var l=a.getUint32(o,!0);if(o+=4,1313821514===l){var h=new Uint8Array(e,12+o,r);this.content=i.LoaderUtils.decodeText(h)}else if(5130562===l){var c=12+o;this.body=e.slice(c,c+r)}o+=r}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class v{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=s.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){var r=this.json,i=this.dracoLoader,n=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,s={},o={},l={};for(var h in a){var c=E[h]||h.toLowerCase();s[c]=a[h]}for(var u in e.attributes){var d=E[u]||u.toLowerCase();if(void 0!==a[u]){var p=r.accessors[e.attributes[u]],m=_[p.componentType];l[d]=m,o[d]=!0===p.normalized}}return t.getDependency("bufferView",n).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(var r in e.attributes){var i=e.attributes[r],n=o[r];void 0!==n&&(i.normalized=n)}t(e)}),s,l)}))}))}}class g{constructor(){this.name=s.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(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),e.needsUpdate=!0),e}}class y extends i.MeshStandardMaterial{constructor(e){super(),this.isGLTFSpecularGlossinessMaterial=!0;var t=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),r=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),n=["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"),a=["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"),s=["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 i.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=o,this.onBeforeCompile=function(e){for(var i in o)e.uniforms[i]=o[i];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>",r).replace("#include <roughnessmap_fragment>",n).replace("#include <metalnessmap_fragment>",a).replace("#include <lights_physical_fragment>",s)},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)}copy(e){return super.copy(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}}class x{constructor(){this.name=s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.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(){return y}extendParams(e,t,r){var n=t.extensions[this.name];e.color=new i.Color(1,1,1),e.opacity=1;var a=[];if(Array.isArray(n.diffuseFactor)){var s=n.diffuseFactor;e.color.fromArray(s),e.opacity=s[3]}if(void 0!==n.diffuseTexture&&a.push(r.assignTexture(e,"map",n.diffuseTexture)),e.emissive=new i.Color(0,0,0),e.glossiness=void 0===n.glossinessFactor?1:n.glossinessFactor,e.specular=new i.Color(1,1,1),Array.isArray(n.specularFactor)&&e.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var o=n.specularGlossinessTexture;a.push(r.assignTexture(e,"glossinessMap",o)),a.push(r.assignTexture(e,"specularMap",o))}return Promise.all(a)}createMaterial(e){var t=new y(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=i.TangentSpaceNormalMap,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}}class b{constructor(){this.name=s.KHR_MESH_QUANTIZATION}}class w extends i.Interpolant{constructor(e,t,r,i){super(e,t,r,i)}copySampleValue_(e){for(var t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=0;n!==i;n++)t[n]=r[e*i*3+i+n];return t}}w.prototype.beforeStart_=w.prototype.copySampleValue_,w.prototype.afterEnd_=w.prototype.copySampleValue_,w.prototype.interpolate_=function(e,t,r,i){for(var n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=3*s,l=i-t,h=(r-t)/l,c=h*h,u=c*h,d=e*o,p=d-o,m=-2*u+3*c,f=u-c,v=0;v!==s;v++){var g=a[p+v+s],y=a[p+v+2*s]*l,x=a[d+v+s],b=a[d+v]*l;n[v]=(1-m)*g+(f-c+h)*y+m*x+f*b}return n};var _={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},M={9728:i.NearestFilter,9729:i.LinearFilter,9984:i.NearestMipmapNearestFilter,9985:i.LinearMipmapNearestFilter,9986:i.NearestMipmapLinearFilter,9987:i.LinearMipmapLinearFilter},S={33071:i.ClampToEdgeWrapping,33648:i.MirroredRepeatWrapping,10497:i.RepeatWrapping},T={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},E={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},A={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},L={CUBICSPLINE:void 0,LINEAR:i.InterpolateLinear,STEP:i.InterpolateDiscrete};function R(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 C(e,t,r){for(var i in r.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=r.extensions[i])}function P(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 I(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,i=t.weights.length;r<i;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){var n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(var a=0,s=n.length;a<s;a++)e.morphTargetDictionary[n[a]]=a}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function O(e){for(var t="",r=Object.keys(e).sort(),i=0,n=r.length;i<n;i++)t+=r[i]+":"+e[r[i]]+";";return t}function D(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}class N{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new a,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.textureCache={},this.nodeNamesUsed={},this.textureLoader="undefined"!=typeof createImageBitmap&&!1===/Firefox/.test(navigator.userAgent)?new i.ImageBitmapLoader(this.options.manager):new i.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new i.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){var r=this,i=this.json,n=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.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:r,userData:{}};C(n,a,i),P(a,i),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){e(a)}))})).catch(t)}_markDefs(){for(var e,t=this.json.nodes||[],r=this.json.skins||[],i=this.json.meshes||[],n=0,a=r.length;n<a;n++)for(var s=0,o=(e=r[n].joints).length;s<o;s++)t[e[s]].isBone=!0;for(var l,h=0,c=t.length;h<c;h++)void 0!==(l=t[h]).mesh&&(this._addNodeRef(this.meshCache,l.mesh),void 0!==l.skin&&(i[l.mesh].isSkinnedMesh=!0)),void 0!==l.camera&&this._addNodeRef(this.cameraCache,l.camera)}_addNodeRef(e,t){void 0===t||(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(1>=e.refs[t])return r;var i=r.clone();return i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){var t=Object.values(this.plugins);t.push(this);for(var r,i=0;i<t.length;i++)if(r=e(t[i]))return r;return null}_invokeAll(e){var t=Object.values(this.plugins);t.unshift(this);for(var r,i=[],n=0;n<t.length;n++)(r=e(t[n]))&&i.push(r);return i}getDependency(e,t){var r=e+":"+t,i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this.loadNode(t);break;case"mesh":i=this._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(r,i)}return i}getDependencies(e){var t=this.cache.get(e);if(!t){var r=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map((function(t,i){return r.getDependency(e,i)}))),this.cache.add(e,t)}return t}loadBuffer(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[s.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,n){r.load(R(t.uri,i.path),e,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}loadBufferView(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+r)}))}loadAccessor(e){var t=this,r=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse)return Promise.resolve(null);var a=[];return void 0===n.bufferView?a.push(null):a.push(this.getDependency("bufferView",n.bufferView)),void 0!==n.sparse&&(a.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),a.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(a).then((function(e){var a,s,o=e[0],l=T[n.type],h=_[n.componentType],c=h.BYTES_PER_ELEMENT,u=n.byteOffset||0,d=void 0===n.bufferView?void 0:r.bufferViews[n.bufferView].byteStride,p=!0===n.normalized;if(d&&d!==c*l){var m=Math.floor(u/d),f="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+m+":"+n.count,v=t.cache.get(f);v||(a=new h(o,m*d,n.count*d/c),v=new i.InterleavedBuffer(a,d/c),t.cache.add(f,v)),s=new i.InterleavedBufferAttribute(v,l,u%d/c,p)}else a=null===o?new h(n.count*l):new h(o,u,n.count*l),s=new i.BufferAttribute(a,l,p);if(void 0!==n.sparse){var g=T.SCALAR,y=_[n.sparse.indices.componentType],x=n.sparse.indices.byteOffset||0,b=n.sparse.values.byteOffset||0,w=new y(e[1],x,n.sparse.count*g),M=new h(e[2],b,n.sparse.count*l);null!==o&&(s=new i.BufferAttribute(s.array.slice(),s.itemSize,s.normalized));for(var S,E=0,A=w.length;E<A;E++)if(S=w[E],s.setX(S,M[E*l]),2<=l&&s.setY(S,M[E*l+1]),3<=l&&s.setZ(S,M[E*l+2]),4<=l&&s.setW(S,M[E*l+3]),5<=l)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}return s}))}loadTexture(e){var t=this.json,r=this.options,i=t.textures[e],n=t.images[i.source],a=this.textureLoader;if(n.uri){var s=r.manager.getHandler(n.uri);null!==s&&(a=s)}return this.loadTextureImage(e,n,a)}loadTextureImage(e,t,r){var n=this,a=this.json,s=this.options,o=a.textures[e],l=(t.uri||t.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];var h=self.URL||self.webkitURL,c=t.uri||"",u=!1,d=!0,p=0<c.search(/\.jpe?g($|\?)/i)||0===c.search(/^data\:image\/jpeg/);if(("image/jpeg"===t.mimeType||p)&&(d=!1),void 0!==t.bufferView)c=n.getDependency("bufferView",t.bufferView).then((function(e){if("image/png"===t.mimeType){var r=new DataView(e,25,1).getUint8(0,!1);d=6===r||4===r||3===r}u=!0;var i=new Blob([e],{type:t.mimeType});return c=h.createObjectURL(i)}));else if(void 0===t.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");var m=Promise.resolve(c).then((function(e){return new Promise((function(t,n){var a=t;!0===r.isImageBitmapLoader&&(a=function(e){var r=new i.Texture(e);r.needsUpdate=!0,t(r)}),r.load(R(e,s.path),a,void 0,n)}))})).then((function(t){!0===u&&h.revokeObjectURL(c),t.flipY=!1,o.name&&(t.name=o.name),d||(t.format=i.RGBFormat);var r=(a.samplers||{})[o.sampler]||{};return t.magFilter=M[r.magFilter]||i.LinearFilter,t.minFilter=M[r.minFilter]||i.LinearMipmapLinearFilter,t.wrapS=S[r.wrapS]||i.RepeatWrapping,t.wrapT=S[r.wrapT]||i.RepeatWrapping,n.associations.set(t,{type:"textures",index:e}),t})).catch((function(){return console.error("THREE.GLTFLoader: Couldn't load texture",c),null}));return this.textureCache[l]=m,m}assignTexture(e,t,r){var i=this;return this.getDependency("texture",r.index).then((function(n){if(void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),i.extensions[s.KHR_TEXTURE_TRANSFORM]){var a=void 0===r.extensions?void 0:r.extensions[s.KHR_TEXTURE_TRANSFORM];if(a){var o=i.associations.get(n);n=i.extensions[s.KHR_TEXTURE_TRANSFORM].extendTexture(n,a),i.associations.set(n,o)}}e[t]=n}))}assignFinalMaterial(e){var t=e.geometry,r=e.material,n=void 0!==t.attributes.tangent,a=void 0!==t.attributes.color,s=void 0===t.attributes.normal,o=0<Object.keys(t.morphAttributes).length,l=o&&void 0!==t.morphAttributes.normal;if(e.isPoints){var h="PointsMaterial:"+r.uuid,c=this.cache.get(h);c||(c=new i.PointsMaterial,i.Material.prototype.copy.call(c,r),c.color.copy(r.color),c.map=r.map,c.sizeAttenuation=!1,this.cache.add(h,c)),r=c}else if(e.isLine){var u="LineBasicMaterial:"+r.uuid,d=this.cache.get(u);d||(d=new i.LineBasicMaterial,i.Material.prototype.copy.call(d,r),d.color.copy(r.color),this.cache.add(u,d)),r=d}if(n||a||s||o){var p="ClonedMaterial:"+r.uuid+":";r.isGLTFSpecularGlossinessMaterial&&(p+="specular-glossiness:"),n&&(p+="vertex-tangents:"),a&&(p+="vertex-colors:"),s&&(p+="flat-shading:"),o&&(p+="morph-targets:"),l&&(p+="morph-normals:");var m=this.cache.get(p);m||(m=r.clone(),a&&(m.vertexColors=!0),s&&(m.flatShading=!0),o&&(m.morphTargets=!0),l&&(m.morphNormals=!0),n&&(m.vertexTangents=!0,m.normalScale&&(m.normalScale.y*=-1),m.clearcoatNormalScale&&(m.clearcoatNormalScale.y*=-1)),this.cache.add(p,m),this.associations.set(m,this.associations.get(r))),r=m}r.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=r}getMaterialType(){return i.MeshStandardMaterial}loadMaterial(e){var t,r=this,n=this.json,a=this.extensions,o=n.materials[e],l={},h=o.extensions||{},c=[];if(h[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var u=a[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=u.getMaterialType(),c.push(u.extendParams(l,o,r))}else if(h[s.KHR_MATERIALS_UNLIT]){var d=a[s.KHR_MATERIALS_UNLIT];t=d.getMaterialType(),c.push(d.extendParams(l,o,r))}else{var p=o.pbrMetallicRoughness||{};if(l.color=new i.Color(1,1,1),l.opacity=1,Array.isArray(p.baseColorFactor)){var m=p.baseColorFactor;l.color.fromArray(m),l.opacity=m[3]}void 0!==p.baseColorTexture&&c.push(r.assignTexture(l,"map",p.baseColorTexture)),l.metalness=void 0===p.metallicFactor?1:p.metallicFactor,l.roughness=void 0===p.roughnessFactor?1:p.roughnessFactor,void 0!==p.metallicRoughnessTexture&&(c.push(r.assignTexture(l,"metalnessMap",p.metallicRoughnessTexture)),c.push(r.assignTexture(l,"roughnessMap",p.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,l)}))))}!0===o.doubleSided&&(l.side=i.DoubleSide);var f=o.alphaMode||"OPAQUE";return"BLEND"===f?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,"MASK"===f&&(l.alphaTest=void 0===o.alphaCutoff?.5:o.alphaCutoff)),void 0!==o.normalTexture&&t!==i.MeshBasicMaterial&&(c.push(r.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new i.Vector2(1,-1),void 0!==o.normalTexture.scale&&l.normalScale.set(o.normalTexture.scale,-o.normalTexture.scale)),void 0!==o.occlusionTexture&&t!==i.MeshBasicMaterial&&(c.push(r.assignTexture(l,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(l.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==i.MeshBasicMaterial&&(l.emissive=(new i.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==i.MeshBasicMaterial&&c.push(r.assignTexture(l,"emissiveMap",o.emissiveTexture)),Promise.all(c).then((function(){var n;return n=t===y?a[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):new t(l),o.name&&(n.name=o.name),n.map&&(n.map.encoding=i.sRGBEncoding),n.emissiveMap&&(n.emissiveMap.encoding=i.sRGBEncoding),P(n,o),r.associations.set(n,{type:"materials",index:e}),o.extensions&&C(a,n,o),n}))}createUniqueName(e){for(var t=i.PropertyBinding.sanitizeNodeName(e||""),r=t,n=1;this.nodeNamesUsed[r];++n)r=t+"_"+n;return this.nodeNamesUsed[r]=!0,r}loadGeometries(e){function t(e){return n[s.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then((function(t){return U(t,e,r)}))}for(var r=this,n=this.extensions,a=this.primitiveCache,o=[],l=0,h=e.length;l<h;l++){var c,u=e[l],d=(void 0,(f=(m=u).extensions&&m.extensions[s.KHR_DRACO_MESH_COMPRESSION])?"draco:"+f.bufferView+":"+f.indices+":"+O(f.attributes):m.indices+":"+O(m.attributes)+":"+m.mode),p=a[d];if(p)o.push(p.promise);else c=u.extensions&&u.extensions[s.KHR_DRACO_MESH_COMPRESSION]?t(u):U(new i.BufferGeometry,u,r),a[d]={primitive:u,promise:c},o.push(c)}var m,f;return Promise.all(o)}loadMesh(e){for(var t,r=this,n=this.json,a=this.extensions,s=n.meshes[e],o=s.primitives,l=[],h=0,c=o.length;h<c;h++)t=void 0===o[h].material?(void 0===(u=this.cache).DefaultMaterial&&(u.DefaultMaterial=new i.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:i.FrontSide})),u.DefaultMaterial):this.getDependency("material",o[h].material),l.push(t);var u;return l.push(r.loadGeometries(o)),Promise.all(l).then((function(t){for(var n=t.slice(0,t.length-1),l=t[t.length-1],h=[],c=0,u=l.length;c<u;c++){var d=l[c],p=o[c],m=void 0,f=n[c];if(4===p.mode||5===p.mode||6===p.mode||void 0===p.mode)!0!==(m=!0===s.isSkinnedMesh?new i.SkinnedMesh(d,f):new i.Mesh(d,f)).isSkinnedMesh||m.geometry.attributes.skinWeight.normalized||m.normalizeSkinWeights(),5===p.mode?m.geometry=z(m.geometry,i.TriangleStripDrawMode):6===p.mode&&(m.geometry=z(m.geometry,i.TriangleFanDrawMode));else if(1===p.mode)m=new i.LineSegments(d,f);else if(3===p.mode)m=new i.Line(d,f);else if(2===p.mode)m=new i.LineLoop(d,f);else{if(0!==p.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);m=new i.Points(d,f)}0<Object.keys(m.geometry.morphAttributes).length&&I(m,s),m.name=r.createUniqueName(s.name||"mesh_"+e),P(m,s),p.extensions&&C(a,m,p),r.assignFinalMaterial(m),h.push(m)}if(1===h.length)return h[0];for(var v=new i.Group,g=0,y=h.length;g<y;g++)v.add(h[g]);return v}))}loadCamera(e){var t,r=this.json.cameras[e],n=r[r.type];return n?("perspective"===r.type?t=new i.PerspectiveCamera(i.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===r.type&&(t=new i.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),P(t,r),Promise.resolve(t)):void console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){var t=this.json.skins[e],r={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(r):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return r.inverseBindMatrices=e,r}))}loadAnimation(e){for(var t=this.json.animations[e],r=[],n=[],a=[],s=[],o=[],l=0,h=t.channels.length;l<h;l++){var c=t.channels[l],u=t.samplers[c.sampler],d=c.target,p=void 0===d.node?d.id:d.node,m=void 0===t.parameters?u.input:t.parameters[u.input],f=void 0===t.parameters?u.output:t.parameters[u.output];r.push(this.getDependency("node",p)),n.push(this.getDependency("accessor",m)),a.push(this.getDependency("accessor",f)),s.push(u),o.push(d)}return Promise.all([Promise.all(r),Promise.all(n),Promise.all(a),Promise.all(s),Promise.all(o)]).then((function(r){for(var n=r[0],a=r[1],s=r[2],o=r[3],l=r[4],h=[],c=function(){var e,t=n[u],r=a[u],c=s[u],d=o[u],p=l[u];if(void 0===t)return 1;switch(t.updateMatrix(),t.matrixAutoUpdate=!0,A[p.path]){case A.weights:e=i.NumberKeyframeTrack;break;case A.rotation:e=i.QuaternionKeyframeTrack;break;default:e=i.VectorKeyframeTrack}var m=t.name?t.name:t.uuid,f=void 0===d.interpolation?i.InterpolateLinear:L[d.interpolation],v=[];A[p.path]===A.weights?t.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&v.push(e.name?e.name:e.uuid)})):v.push(m);var g=c.array;if(c.normalized){for(var y=D(g.constructor),x=new Float32Array(g.length),b=0,_=g.length;b<_;b++)x[b]=g[b]*y;g=x}for(var M,S=0,T=v.length;S<T;S++)M=new e(v[S]+"."+A[p.path],r.array,g,f),"CUBICSPLINE"===d.interpolation&&(M.createInterpolant=function(e){return new w(this.times,this.values,this.getValueSize()/3,e)},M.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),h.push(M)},u=0,d=n.length;u<d;u++)c();var p=t.name?t.name:"animation_"+e;return new i.AnimationClip(p,void 0,h)}))}createNodeMesh(e){var t=this.json,r=this,i=t.nodes[e];return void 0===i.mesh?null:r.getDependency("mesh",i.mesh).then((function(e){var t=r._getNodeRef(r.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,r=i.weights.length;t<r;t++)e.morphTargetInfluences[t]=i.weights[t]})),t}))}loadNode(e){var t,r,n=this.json,a=this.extensions,s=this,o=n.nodes[e],l=o.name?s.createUniqueName(o.name):"";return(t=[],r=s._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})),r&&t.push(r),void 0!==o.camera&&t.push(s.getDependency("camera",o.camera).then((function(e){return s._getNodeRef(s.cameraCache,o.camera,e)}))),s._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),Promise.all(t)).then((function(t){var r;if((r=!0===o.isBone?new i.Bone:1<t.length?new i.Group:1===t.length?t[0]:new i.Object3D)!==t[0])for(var n=0,h=t.length;n<h;n++)r.add(t[n]);if(o.name&&(r.userData.name=o.name,r.name=l),P(r,o),o.extensions&&C(a,r,o),void 0!==o.matrix){var c=new i.Matrix4;c.fromArray(o.matrix),r.applyMatrix4(c)}else void 0!==o.translation&&r.position.fromArray(o.translation),void 0!==o.rotation&&r.quaternion.fromArray(o.rotation),void 0!==o.scale&&r.scale.fromArray(o.scale);return s.associations.set(r,{type:"nodes",index:e}),r}))}loadScene(e){var t=this.json,r=this.extensions,n=this.json.scenes[e],a=new i.Group;n.name&&(a.name=this.createUniqueName(n.name)),P(a,n),n.extensions&&C(r,a,n);for(var s=n.nodes||[],o=[],l=0,h=s.length;l<h;l++)o.push(B(s[l],a,t,this));return Promise.all(o).then((function(){return a}))}}function B(e,t,r,n){var a=r.nodes[e];return n.getDependency("node",e).then((function(e){return void 0===a.skin?e:n.getDependency("skin",a.skin).then((function(e){for(var r=[],i=0,a=(t=e).joints.length;i<a;i++)r.push(n.getDependency("node",t.joints[i]));return Promise.all(r)})).then((function(r){return e.traverse((function(e){if(e.isMesh){for(var n,a=[],s=[],o=0,l=r.length;o<l;o++)if(n=r[o]){a.push(n);var h=new i.Matrix4;void 0!==t.inverseBindMatrices&&h.fromArray(t.inverseBindMatrices.array,16*o),s.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o]);e.bind(new i.Skeleton(a,s),e.matrixWorld)}})),e}));var t})).then((function(e){t.add(e);var i=[];if(a.children)for(var s,o=a.children,l=0,h=o.length;l<h;l++)s=o[l],i.push(B(s,e,r,n));return Promise.all(i)}))}function U(e,t,r){function n(t,i){return r.getDependency("accessor",t).then((function(t){e.setAttribute(i,t)}))}var a=t.attributes,s=[];for(var o in a){var l=E[o]||o.toLowerCase();l in e.attributes||s.push(n(a[o],l))}if(void 0!==t.indices&&!e.index){var h=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));s.push(h)}return P(e,t),function(e,t,r){var n=t.attributes,a=new i.Box3;if(void 0!==n.POSITION){var s=r.json.accessors[n.POSITION],o=s.min,l=s.max;if(void 0!==o&&void 0!==l){if(a.set(new i.Vector3(o[0],o[1],o[2]),new i.Vector3(l[0],l[1],l[2])),s.normalized){var h=D(_[s.componentType]);a.min.multiplyScalar(h),a.max.multiplyScalar(h)}var c=t.targets;if(void 0!==c){for(var u,d=new i.Vector3,p=new i.Vector3,m=0,f=c.length;m<f;m++)if(void 0!==(u=c[m]).POSITION){var v=r.json.accessors[u.POSITION],g=v.min,y=v.max;if(void 0!==g&&void 0!==y){if(p.setX(Math.max(Math.abs(g[0]),Math.abs(y[0]))),p.setY(Math.max(Math.abs(g[1]),Math.abs(y[1]))),p.setZ(Math.max(Math.abs(g[2]),Math.abs(y[2]))),v.normalized){var x=D(_[v.componentType]);p.multiplyScalar(x)}d.max(p)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}a.expandByVector(d)}e.boundingBox=a;var b=new i.Sphere;a.getCenter(b.center),b.radius=a.min.distanceTo(a.max)/2,e.boundingSphere=b}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,r),Promise.all(s).then((function(){return void 0===t.targets?e:function(e,t,r){for(var i,n=!1,a=!1,s=0,o=t.length;s<o&&(void 0!==(i=t[s]).POSITION&&(n=!0),void 0!==i.NORMAL&&(a=!0),!n||!a);s++);if(!n&&!a)return Promise.resolve(e);for(var l,h=[],c=[],u=0,d=t.length;u<d;u++){if(l=t[u],n){var p=void 0===l.POSITION?e.attributes.position:r.getDependency("accessor",l.POSITION);h.push(p)}if(a){var m=void 0===l.NORMAL?e.attributes.normal:r.getDependency("accessor",l.NORMAL);c.push(m)}}return Promise.all([Promise.all(h),Promise.all(c)]).then((function(t){var r=t[0],i=t[1];return n&&(e.morphAttributes.position=r),a&&(e.morphAttributes.normal=i),e.morphTargetsRelative=!0,e}))}(e,t.targets,r)}))}function z(e,t){var r=e.getIndex();if(null===r){var n=[],a=e.getAttribute("position");if(void 0===a)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var s=0;s<a.count;s++)n.push(s);e.setIndex(n),r=e.getIndex()}var o=r.count-2,l=[];if(t===i.TriangleFanDrawMode)for(var h=1;h<=o;h++)l.push(r.getX(0)),l.push(r.getX(h)),l.push(r.getX(h+1));else for(var c=0;c<o;c++)0==c%2?(l.push(r.getX(c)),l.push(r.getX(c+1)),l.push(r.getX(c+2))):(l.push(r.getX(c+2)),l.push(r.getX(c+1)),l.push(r.getX(c)));l.length/3!=o&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var u=e.clone();return u.setIndex(l),u}},8330:e=>{"use strict";e.exports=JSON.parse('{"name":"zincjs","version":"1.14.1","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu <alan.wu@auckland.ac.nz>","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}')}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var a=t[i]={exports:{}};return e[i].call(a.exports,a,a.exports,r),a.exports}return r.m=e,r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(1913)})()));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Zinc=t():e.Zinc=t()}(this,(()=>(()=>{var e={164:function(e,t,r){"use strict";var i,n;"undefined"==typeof window||window,void 0===(n="function"==typeof(i=function(){function e(e,t){var r=Object.prototype.toString.call(e),i="[object Array]"===r||"[object NodeList]"===r||"[object HTMLCollection]"===r||"[object Object]"===r||"undefined"!=typeof jQuery&&e instanceof jQuery||"undefined"!=typeof Elements&&e instanceof Elements,n=0,a=e.length;if(i)for(;n<a;n++)t(e[n]);else t(e)}function t(e){if(!e.getBoundingClientRect)return{width:e.offsetWidth,height:e.offsetHeight};var t=e.getBoundingClientRect();return{width:Math.round(t.width),height:Math.round(t.height)}}function r(e,t){Object.keys(t).forEach((function(r){e.style[r]=t[r]}))}if("undefined"==typeof window)return null;var i="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),n=i.requestAnimationFrame||i.mozRequestAnimationFrame||i.webkitRequestAnimationFrame||function(e){return i.setTimeout(e,20)},a=i.cancelAnimationFrame||i.mozCancelAnimationFrame||i.webkitCancelAnimationFrame||function(e){i.clearTimeout(e)},s=function(i,o){function l(){var e,t,r=[];this.add=function(e){r.push(e)},this.call=function(i){for(e=0,t=r.length;e<t;e++)r[e].call(this,i)},this.remove=function(i){var n=[];for(e=0,t=r.length;e<t;e++)r[e]!==i&&n.push(r[e]);r=n},this.length=function(){return r.length}}function h(e,i){if(e){if(e.resizedAttached)return void e.resizedAttached.add(i);e.resizedAttached=new l,e.resizedAttached.add(i),e.resizeSensor=document.createElement("div"),e.resizeSensor.dir="ltr",e.resizeSensor.className="resize-sensor";var a={pointerEvents:"none",position:"absolute",left:"0px",top:"0px",right:"0px",bottom:"0px",overflow:"hidden",zIndex:"-1",visibility:"hidden",maxWidth:"100%"},s={position:"absolute",left:"0px",top:"0px",transition:"0s"};r(e.resizeSensor,a);var o=document.createElement("div");o.className="resize-sensor-expand",r(o,a);var h=document.createElement("div");r(h,s),o.appendChild(h);var u=document.createElement("div");u.className="resize-sensor-shrink",r(u,a);var d=document.createElement("div");r(d,s),r(d,{width:"200%",height:"200%"}),u.appendChild(d),e.resizeSensor.appendChild(o),e.resizeSensor.appendChild(u),e.appendChild(e.resizeSensor);var p=window.getComputedStyle(e),m=p?p.getPropertyValue("position"):null;"absolute"!==m&&"relative"!==m&&"fixed"!==m&&"sticky"!==m&&(e.style.position="relative");var f=!1,v=0,g=t(e),y=0,x=0,b=!0;c=0;var w=function t(){if(b){if(0===e.offsetWidth&&0===e.offsetHeight)return void(c||(c=n((function(){c=0,t()}))));b=!1}var r,i;r=e.offsetWidth,i=e.offsetHeight,h.style.width=r+10+"px",h.style.height=i+10+"px",o.scrollLeft=r+10,o.scrollTop=i+10,u.scrollLeft=r+10,u.scrollTop=i+10};e.resizeSensor.resetSensor=w;var _=function(){v=0,f&&(y=g.width,x=g.height,e.resizedAttached&&e.resizedAttached.call(g))},M=function(){g=t(e),(f=g.width!==y||g.height!==x)&&!v&&(v=n(_)),w()},S=function(e,t,r){e.attachEvent?e.attachEvent("on"+t,r):e.addEventListener(t,r)};S(o,"scroll",M),S(u,"scroll",M),c=n((function(){c=0,w()}))}}var c=0;e(i,(function(e){h(e,o)})),this.detach=function(e){c||(a(c),c=0),s.detach(i,e)},this.reset=function(){i.resizeSensor.resetSensor()}};if(s.reset=function(t){e(t,(function(e){e.resizeSensor.resetSensor()}))},s.detach=function(t,r){e(t,(function(e){!e||e.resizedAttached&&"function"==typeof r&&(e.resizedAttached.remove(r),e.resizedAttached.length())||e.resizeSensor&&(e.contains(e.resizeSensor)&&e.removeChild(e.resizeSensor),delete e.resizeSensor,delete e.resizedAttached)}))},"undefined"!=typeof MutationObserver){var o=new MutationObserver((function(e){for(var t in e)if(e.hasOwnProperty(t))for(var r=e[t].addedNodes,i=0;i<r.length;i++)r[i].resizeSensor&&s.reset(r[i])}));document.addEventListener("DOMContentLoaded",(function(e){o.observe(document.body,{childList:!0,subtree:!0})}))}return s})?i.call(t,r,t,e):i)||(e.exports=n)},7846:(e,t,r)=>{"use strict";r.d(t,{A:()=>m});function i(e,t){this.name="AggregateError",this.errors=e,this.message=t||""}i.prototype=Error.prototype;var n=setTimeout;function a(e){return!(!e||void 0===e.length)}function s(){}function o(e){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],p(e,this)}function l(e,t){for(;3===e._state;)e=e._value;return 0===e._state?void e._deferreds.push(t):(e._handled=!0,void o._immediateFn((function(){var r=1===e._state?t.onFulfilled:t.onRejected;if(null!==r){var i;try{i=r(e._value)}catch(e){return void c(t.promise,e)}h(t.promise,i)}else(1===e._state?h:c)(t.promise,e._value)})))}function h(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var r=t.then;if(t instanceof o)return e._state=3,e._value=t,void u(e);if("function"==typeof r)return void p((i=r,n=t,function(){i.apply(n,arguments)}),e)}e._state=1,e._value=t,u(e)}catch(t){c(e,t)}var i,n}function c(e,t){e._state=2,e._value=t,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&o._immediateFn((function(){e._handled||o._unhandledRejectionFn(e._value)}));for(var t=0,r=e._deferreds.length;t<r;t++)l(e,e._deferreds[t]);e._deferreds=null}function d(e,t,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=r}function p(e,t){var r=!1;try{e((function(e){r||(r=!0,h(t,e))}),(function(e){r||(r=!0,c(t,e))}))}catch(e){if(r)return;r=!0,c(t,e)}}o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){var r=new this.constructor(s);return l(this,new d(e,t,r)),r},o.prototype.finally=function(e){var t=this.constructor;return this.then((function(r){return t.resolve(e()).then((function(){return r}))}),(function(r){return t.resolve(e()).then((function(){return t.reject(r)}))}))},o.all=function(e){return new o((function(t,r){function i(e,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var o=a.then;if("function"==typeof o)return void o.call(a,(function(t){i(e,t)}),r)}n[e]=a,0==--s&&t(n)}catch(e){r(e)}}if(!a(e))return r(new TypeError("Promise.all accepts an array"));var n=Array.prototype.slice.call(e);if(0===n.length)return t([]);for(var s=n.length,o=0;o<n.length;o++)i(o,n[o])}))},o.any=function(e){var t=this;return new t((function(r,n){if(!e||void 0===e.length)return n(new TypeError("Promise.any accepts an array"));var a=Array.prototype.slice.call(e);if(0===a.length)return n();for(var s=[],o=0;o<a.length;o++)try{t.resolve(a[o]).then(r).catch((function(e){s.push(e),s.length===a.length&&n(new i(s,"All promises were rejected"))}))}catch(e){n(e)}}))},o.allSettled=function(e){return new this((function(t,r){function i(e,r){if(r&&("object"==typeof r||"function"==typeof r)){var s=r.then;if("function"==typeof s)return void s.call(r,(function(t){i(e,t)}),(function(r){n[e]={status:"rejected",reason:r},0==--a&&t(n)}))}n[e]={status:"fulfilled",value:r},0==--a&&t(n)}if(!e||void 0===e.length)return r(new TypeError(typeof e+" "+e+" is not iterable(cannot read property Symbol(Symbol.iterator))"));var n=Array.prototype.slice.call(e);if(0===n.length)return t([]);for(var a=n.length,s=0;s<n.length;s++)i(s,n[s])}))},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o((function(t){t(e)}))},o.reject=function(e){return new o((function(t,r){r(e)}))},o.race=function(e){return new o((function(t,r){if(!a(e))return r(new TypeError("Promise.race accepts an array"));for(var i=0,n=e.length;i<n;i++)o.resolve(e[i]).then(t,r)}))},o._immediateFn="function"==typeof setImmediate&&function(e){setImmediate(e)}||function(e){n(e,0)},o._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};const m=o},8221:(e,t,r)=>{"use strict";r.d(t,{A:()=>p});var i=r(1515);function n(e,t){for(var r,i=0;i<t.length;i++)(r=t[i]).enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function o(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,i=a(e);if(t){var n=a(this).constructor;r=Reflect.construct(i,arguments,n)}else r=i.apply(this,arguments);return function(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}(this,r)}}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null!=r){var i,n,a=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(i=r.next()).done)&&(a.push(i.value),!t||a.length!==t);s=!0);}catch(e){o=!0,n=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw n}}return a}}(e,t)||c(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}var d="undefined"!=typeof window&&window.THREE?window.THREE:{LinearFilter:i.LinearFilter,Sprite:i.Sprite,SpriteMaterial:i.SpriteMaterial,Texture:i.Texture};const p=function(e){function t(){var e,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"",i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:10,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"rgba(255, 255, 255, 1)";return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=a.call(this,new d.SpriteMaterial({map:new d.Texture})))._text="".concat(r),e._textHeight=i,e._color=n,e._backgroundColor=!1,e._padding=0,e._borderWidth=0,e._borderRadius=0,e._borderColor="white",e._strokeWidth=0,e._strokeColor="white",e._fontFace="Arial",e._fontSize=90,e._fontWeight="normal",e._canvas=document.createElement("canvas"),e._texture=e.material.map,e._texture.minFilter=d.LinearFilter,e._genCanvas(),e}!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(t,e);var r,i,a=o(t);return r=t,(i=[{key:"text",get:function(){return this._text},set:function(e){this._text=e,this._genCanvas()}},{key:"textHeight",get:function(){return this._textHeight},set:function(e){this._textHeight=e,this._genCanvas()}},{key:"color",get:function(){return this._color},set:function(e){this._color=e,this._genCanvas()}},{key:"backgroundColor",get:function(){return this._backgroundColor},set:function(e){this._backgroundColor=e,this._genCanvas()}},{key:"padding",get:function(){return this._padding},set:function(e){this._padding=e,this._genCanvas()}},{key:"borderWidth",get:function(){return this._borderWidth},set:function(e){this._borderWidth=e,this._genCanvas()}},{key:"borderRadius",get:function(){return this._borderRadius},set:function(e){this._borderRadius=e,this._genCanvas()}},{key:"borderColor",get:function(){return this._borderColor},set:function(e){this._borderColor=e,this._genCanvas()}},{key:"fontFace",get:function(){return this._fontFace},set:function(e){this._fontFace=e,this._genCanvas()}},{key:"fontSize",get:function(){return this._fontSize},set:function(e){this._fontSize=e,this._genCanvas()}},{key:"fontWeight",get:function(){return this._fontWeight},set:function(e){this._fontWeight=e,this._genCanvas()}},{key:"strokeWidth",get:function(){return this._strokeWidth},set:function(e){this._strokeWidth=e,this._genCanvas()}},{key:"strokeColor",get:function(){return this._strokeColor},set:function(e){this._strokeColor=e,this._genCanvas()}},{key:"_genCanvas",value:function(){var e=this,t=this._canvas,r=t.getContext("2d"),i=Array.isArray(this.borderWidth)?this.borderWidth:[this.borderWidth,this.borderWidth],n=i.map((function(t){return t*e.fontSize*.1})),a=(Array.isArray(this.borderRadius)?this.borderRadius:[this.borderRadius,this.borderRadius,this.borderRadius,this.borderRadius]).map((function(t){return t*e.fontSize*.1})),s=Array.isArray(this.padding)?this.padding:[this.padding,this.padding],o=s.map((function(t){return t*e.fontSize*.1})),c=this.text.split("\n"),u="".concat(this.fontWeight," ").concat(this.fontSize,"px ").concat(this.fontFace);r.font=u;var d=Math.max.apply(Math,h(c.map((function(e){return r.measureText(e).width})))),p=this.fontSize*c.length;if(t.width=d+2*n[0]+2*o[0],t.height=p+2*n[1]+2*o[1],this.borderWidth){if(r.strokeStyle=this.borderColor,n[0]){var m=n[0]/2;r.lineWidth=n[0],r.beginPath(),r.moveTo(m,a[0]),r.lineTo(m,t.height-a[3]),r.moveTo(t.width-m,a[1]),r.lineTo(t.width-m,t.height-a[2]),r.stroke()}if(n[1]){var f=n[1]/2;r.lineWidth=n[1],r.beginPath(),r.moveTo(Math.max(n[0],a[0]),f),r.lineTo(t.width-Math.max(n[0],a[1]),f),r.moveTo(Math.max(n[0],a[3]),t.height-f),r.lineTo(t.width-Math.max(n[0],a[2]),t.height-f),r.stroke()}if(this.borderRadius){var v=Math.max.apply(Math,h(n)),g=v/2;r.lineWidth=v,r.beginPath(),[!!a[0]&&[a[0],g,g,a[0]],!!a[1]&&[t.width-a[1],t.width-g,g,a[1]],!!a[2]&&[t.width-a[2],t.width-g,t.height-g,t.height-a[2]],!!a[3]&&[a[3],g,t.height-g,t.height-a[3]]].filter((function(e){return e})).forEach((function(e){var t=l(e,4),i=t[0],n=t[1],a=t[2],s=t[3];r.moveTo(i,a),r.quadraticCurveTo(n,a,n,s)})),r.stroke()}}this.backgroundColor&&(r.fillStyle=this.backgroundColor,this.borderRadius?(r.beginPath(),r.moveTo(n[0],a[0]),[[n[0],a[0],t.width-a[1],n[1],n[1],n[1]],[t.width-n[0],t.width-n[0],t.width-n[0],n[1],a[1],t.height-a[2]],[t.width-n[0],t.width-a[2],a[3],t.height-n[1],t.height-n[1],t.height-n[1]],[n[0],n[0],n[0],t.height-n[1],t.height-a[3],a[0]]].forEach((function(e){var t=l(e,6),i=t[0],n=t[1],a=t[2],s=t[3],o=t[4],h=t[5];r.quadraticCurveTo(i,s,n,o),r.lineTo(a,h)})),r.closePath(),r.fill()):r.fillRect(n[0],n[1],t.width-2*n[0],t.height-2*n[1])),r.translate.apply(r,h(n)),r.translate.apply(r,h(o)),r.font=u,r.fillStyle=this.color,r.textBaseline="bottom";var y=0<this.strokeWidth;y&&(r.lineWidth=this.strokeWidth*this.fontSize/10,r.strokeStyle=this.strokeColor),c.forEach((function(t,i){var n=(d-r.measureText(t).width)/2,a=(i+1)*e.fontSize;y&&r.strokeText(t,n,a),r.fillText(t,n,a)})),this._texture.image=t,this._texture.needsUpdate=!0;var x=this.textHeight*c.length+2*i[1]+2*s[1];this.scale.set(x*t.width/t.height,x,0)}},{key:"clone",value:function(){return new this.constructor(this.text,this.textHeight,this.color).copy(this)}},{key:"copy",value:function(e){return d.Sprite.prototype.copy.call(this,e),this.color=e.color,this.backgroundColor=e.backgroundColor,this.padding=e.padding,this.borderWidth=e.borderWidth,this.borderColor=e.borderColor,this.fontFace=e.fontFace,this.fontSize=e.fontSize,this.fontWeight=e.fontWeight,this.strokeWidth=e.strokeWidth,this.strokeColor=e.strokeColor,this}}])&&n(r.prototype,i),t}(d.Sprite)},1515:(e,t,r)=>{"use strict";function i(e,t,r,i,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(i,n)}function n(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){function s(e){i(l,n,a,s,o,"next",e)}function o(e){i(l,n,a,s,o,"throw",e)}var l=e.apply(t,r);s(void 0)}))}}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}r.r(t),r.d(t,{ACESFilmicToneMapping:()=>ae,AddEquation:()=>L,AddOperation:()=>ee,AdditiveAnimationBlendMode:()=>Yt,AdditiveBlending:()=>S,AlphaFormat:()=>Fe,AlwaysDepth:()=>W,AlwaysStencilFunc:()=>Er,AmbientLight:()=>Uu,AmbientLightProbe:()=>ad,AnimationClip:()=>nu,AnimationLoader:()=>du,AnimationMixer:()=>Ud,AnimationObjectGroup:()=>Nd,AnimationUtils:()=>Wc,ArcCurve:()=>Ah,ArrayCamera:()=>Qo,ArrowHelper:()=>Ap,Audio:()=>vd,AudioAnalyser:()=>_d,AudioContext:()=>rd,AudioListener:()=>fd,AudioLoader:()=>id,AxesHelper:()=>Lp,AxisHelper:()=>Tm,BackSide:()=>y,BasicDepthPacking:()=>or,BasicShadowMap:()=>p,BinaryTextureLoader:()=>Cm,Bone:()=>Ul,BooleanKeyframeTrack:()=>Kc,BoundingBoxHelper:()=>Em,Box2:()=>qd,Box3:()=>pi,Box3Helper:()=>_p,BoxBufferGeometry:()=>Sa,BoxGeometry:()=>Sa,BoxHelper:()=>wp,BufferAttribute:()=>Un,BufferGeometry:()=>na,BufferGeometryLoader:()=>Wu,ByteType:()=>Le,Cache:()=>su,Camera:()=>Ra,CameraHelper:()=>yp,CanvasRenderer:()=>Im,CanvasTexture:()=>ph,CatmullRomCurve3:()=>Oh,CineonToneMapping:()=>ne,CircleBufferGeometry:()=>fh,CircleGeometry:()=>fh,ClampToEdgeWrapping:()=>fe,Clock:()=>hd,Color:()=>On,ColorKeyframeTrack:()=>Qc,CompressedTexture:()=>dh,CompressedTextureLoader:()=>pu,ConeBufferGeometry:()=>gh,ConeGeometry:()=>gh,CubeCamera:()=>Ia,CubeReflectionMapping:()=>le,CubeRefractionMapping:()=>he,CubeTexture:()=>Oa,CubeTextureLoader:()=>fu,CubeUVReflectionMapping:()=>de,CubeUVRefractionMapping:()=>pe,CubicBezierCurve:()=>Uh,CubicBezierCurve3:()=>zh,CubicInterpolant:()=>qc,CullFaceBack:()=>c,CullFaceFront:()=>u,CullFaceFrontBack:()=>d,CullFaceNone:()=>h,Curve:()=>Th,CurvePath:()=>yu,CustomBlending:()=>A,CustomToneMapping:()=>se,CylinderBufferGeometry:()=>vh,CylinderGeometry:()=>vh,Cylindrical:()=>Wd,DataTexture:()=>zl,DataTexture2DArray:()=>ls,DataTexture3D:()=>hs,DataTextureLoader:()=>vu,DataUtils:()=>Pp,DecrementStencilOp:()=>fr,DecrementWrapStencilOp:()=>gr,DefaultLoadingManager:()=>lu,DepthFormat:()=>We,DepthStencilFormat:()=>Ze,DepthTexture:()=>mh,DirectionalLight:()=>Bu,DirectionalLightHelper:()=>fp,DiscreteInterpolant:()=>Yc,DodecahedronBufferGeometry:()=>xh,DodecahedronGeometry:()=>xh,DoubleSide:()=>x,DstAlphaFactor:()=>F,DstColorFactor:()=>V,DynamicBufferAttribute:()=>fm,DynamicCopyUsage:()=>Dr,DynamicDrawUsage:()=>Lr,DynamicReadUsage:()=>Pr,EdgesGeometry:()=>Sh,EdgesHelper:()=>Am,EllipseCurve:()=>Eh,EqualDepth:()=>X,EqualStencilFunc:()=>wr,EquirectangularReflectionMapping:()=>ce,EquirectangularRefractionMapping:()=>ue,Euler:()=>Ki,EventDispatcher:()=>zr,ExtrudeBufferGeometry:()=>yc,ExtrudeGeometry:()=>yc,FaceColors:()=>nm,FileLoader:()=>uu,FlatShading:()=>b,Float16BufferAttribute:()=>Wn,Float32Attribute:()=>Mm,Float32BufferAttribute:()=>Zn,Float64Attribute:()=>Sm,Float64BufferAttribute:()=>qn,FloatType:()=>Oe,Fog:()=>ol,FogExp2:()=>sl,Font:()=>Qu,FontLoader:()=>ed,FrontSide:()=>g,Frustum:()=>Va,GLBufferAttribute:()=>Gd,GLSL1:()=>Br,GLSL3:()=>Ur,GammaEncoding:()=>tr,GreaterDepth:()=>J,GreaterEqualDepth:()=>Y,GreaterEqualStencilFunc:()=>Tr,GreaterStencilFunc:()=>Mr,GridHelper:()=>cp,Group:()=>$o,HalfFloatType:()=>De,HemisphereLight:()=>_u,HemisphereLightHelper:()=>hp,HemisphereLightProbe:()=>nd,IcosahedronBufferGeometry:()=>bc,IcosahedronGeometry:()=>bc,ImageBitmapLoader:()=>Ju,ImageLoader:()=>mu,ImageUtils:()=>ti,ImmediateRenderObject:()=>Kd,IncrementStencilOp:()=>mr,IncrementWrapStencilOp:()=>vr,InstancedBufferAttribute:()=>ju,InstancedBufferGeometry:()=>ku,InstancedInterleavedBuffer:()=>Fd,InstancedMesh:()=>Zl,Int16Attribute:()=>xm,Int16BufferAttribute:()=>Vn,Int32Attribute:()=>wm,Int32BufferAttribute:()=>kn,Int8Attribute:()=>vm,Int8BufferAttribute:()=>zn,IntType:()=>Pe,InterleavedBuffer:()=>hl,InterleavedBufferAttribute:()=>ul,Interpolant:()=>Zc,InterpolateDiscrete:()=>Ht,InterpolateLinear:()=>kt,InterpolateSmooth:()=>jt,InvertStencilOp:()=>yr,JSONLoader:()=>Om,KeepStencilOp:()=>dr,KeyframeTrack:()=>Jc,LOD:()=>Cl,LatheBufferGeometry:()=>wc,LatheGeometry:()=>wc,Layers:()=>Qi,LensFlare:()=>Nm,LessDepth:()=>Z,LessEqualDepth:()=>q,LessEqualStencilFunc:()=>_r,LessStencilFunc:()=>br,Light:()=>wu,LightProbe:()=>Gu,Line:()=>$l,Line3:()=>Jd,LineBasicMaterial:()=>ql,LineCurve:()=>Fh,LineCurve3:()=>Gh,LineDashedMaterial:()=>kc,LineLoop:()=>ih,LinePieces:()=>rm,LineSegments:()=>rh,LineStrip:()=>tm,LinearEncoding:()=>$t,LinearFilter:()=>_e,LinearInterpolant:()=>Xc,LinearMipMapLinearFilter:()=>Ee,LinearMipMapNearestFilter:()=>Se,LinearMipmapLinearFilter:()=>Te,LinearMipmapNearestFilter:()=>Me,LinearToneMapping:()=>re,Loader:()=>hu,LoaderUtils:()=>Hu,LoadingManager:()=>ou,LogLuvEncoding:()=>ir,LoopOnce:()=>Ft,LoopPingPong:()=>Vt,LoopRepeat:()=>Gt,LuminanceAlphaFormat:()=>ke,LuminanceFormat:()=>He,MOUSE:()=>o,Material:()=>En,MaterialLoader:()=>Vu,Math:()=>Qr,MathUtils:()=>Qr,Matrix3:()=>ei,Matrix4:()=>Vi,MaxEquation:()=>I,Mesh:()=>_a,MeshBasicMaterial:()=>Dn,MeshDepthMaterial:()=>jo,MeshDistanceMaterial:()=>Wo,MeshFaceMaterial:()=>sm,MeshLambertMaterial:()=>Vc,MeshMatcapMaterial:()=>Hc,MeshNormalMaterial:()=>Gc,MeshPhongMaterial:()=>zc,MeshPhysicalMaterial:()=>Uc,MeshStandardMaterial:()=>Bc,MeshToonMaterial:()=>Fc,MinEquation:()=>P,MirroredRepeatWrapping:()=>ve,MixOperation:()=>$,MultiMaterial:()=>om,MultiplyBlending:()=>E,MultiplyOperation:()=>Q,NearestFilter:()=>ge,NearestMipMapLinearFilter:()=>we,NearestMipMapNearestFilter:()=>xe,NearestMipmapLinearFilter:()=>be,NearestMipmapNearestFilter:()=>ye,NeverDepth:()=>j,NeverStencilFunc:()=>xr,NoBlending:()=>_,NoColors:()=>im,NoToneMapping:()=>te,NormalAnimationBlendMode:()=>Xt,NormalBlending:()=>M,NotEqualDepth:()=>K,NotEqualStencilFunc:()=>Sr,NumberKeyframeTrack:()=>$c,Object3D:()=>pn,ObjectLoader:()=>Zu,ObjectSpaceNormalMap:()=>cr,OctahedronBufferGeometry:()=>_c,OctahedronGeometry:()=>_c,OneFactor:()=>D,OneMinusDstAlphaFactor:()=>G,OneMinusDstColorFactor:()=>H,OneMinusSrcAlphaFactor:()=>z,OneMinusSrcColorFactor:()=>B,OrthographicCamera:()=>Du,PCFShadowMap:()=>m,PCFSoftShadowMap:()=>f,PMREMGenerator:()=>Xp,ParametricBufferGeometry:()=>Mc,ParametricGeometry:()=>Mc,Particle:()=>hm,ParticleBasicMaterial:()=>dm,ParticleSystem:()=>cm,ParticleSystemMaterial:()=>pm,Path:()=>xu,PerspectiveCamera:()=>Ca,Plane:()=>za,PlaneBufferGeometry:()=>ja,PlaneGeometry:()=>ja,PlaneHelper:()=>Mp,PointCloud:()=>lm,PointCloudMaterial:()=>um,PointLight:()=>Ou,PointLightHelper:()=>ap,Points:()=>hh,PointsMaterial:()=>nh,PolarGridHelper:()=>up,PolyhedronBufferGeometry:()=>yh,PolyhedronGeometry:()=>yh,PositionalAudio:()=>wd,PropertyBinding:()=>Dd,PropertyMixer:()=>Md,QuadraticBezierCurve:()=>Vh,QuadraticBezierCurve3:()=>Hh,Quaternion:()=>hi,QuaternionKeyframeTrack:()=>tu,QuaternionLinearInterpolant:()=>eu,REVISION:()=>s,RGBADepthPacking:()=>lr,RGBAFormat:()=>Ve,RGBAIntegerFormat:()=>Qe,RGBA_ASTC_10x10_Format:()=>wt,RGBA_ASTC_10x5_Format:()=>yt,RGBA_ASTC_10x6_Format:()=>xt,RGBA_ASTC_10x8_Format:()=>bt,RGBA_ASTC_12x10_Format:()=>_t,RGBA_ASTC_12x12_Format:()=>Mt,RGBA_ASTC_4x4_Format:()=>ct,RGBA_ASTC_5x4_Format:()=>ut,RGBA_ASTC_5x5_Format:()=>dt,RGBA_ASTC_6x5_Format:()=>pt,RGBA_ASTC_6x6_Format:()=>mt,RGBA_ASTC_8x5_Format:()=>ft,RGBA_ASTC_8x6_Format:()=>vt,RGBA_ASTC_8x8_Format:()=>gt,RGBA_BPTC_Format:()=>St,RGBA_ETC2_EAC_Format:()=>ht,RGBA_PVRTC_2BPPV1_Format:()=>st,RGBA_PVRTC_4BPPV1_Format:()=>at,RGBA_S3TC_DXT1_Format:()=>et,RGBA_S3TC_DXT3_Format:()=>tt,RGBA_S3TC_DXT5_Format:()=>rt,RGBDEncoding:()=>sr,RGBEEncoding:()=>rr,RGBEFormat:()=>je,RGBFormat:()=>Ge,RGBIntegerFormat:()=>Ke,RGBM16Encoding:()=>ar,RGBM7Encoding:()=>nr,RGB_ETC1_Format:()=>ot,RGB_ETC2_Format:()=>lt,RGB_PVRTC_2BPPV1_Format:()=>nt,RGB_PVRTC_4BPPV1_Format:()=>it,RGB_S3TC_DXT1_Format:()=>$e,RGFormat:()=>Ye,RGIntegerFormat:()=>Je,RawShaderMaterial:()=>Nc,Ray:()=>Gi,Raycaster:()=>Vd,RectAreaLight:()=>zu,RedFormat:()=>qe,RedIntegerFormat:()=>Xe,ReinhardToneMapping:()=>ie,RepeatWrapping:()=>me,ReplaceStencilOp:()=>pr,ReverseSubtractEquation:()=>C,RingBufferGeometry:()=>Sc,RingGeometry:()=>Sc,SRGB8_ALPHA8_ASTC_10x10_Format:()=>Bt,SRGB8_ALPHA8_ASTC_10x5_Format:()=>Ot,SRGB8_ALPHA8_ASTC_10x6_Format:()=>Dt,SRGB8_ALPHA8_ASTC_10x8_Format:()=>Nt,SRGB8_ALPHA8_ASTC_12x10_Format:()=>Ut,SRGB8_ALPHA8_ASTC_12x12_Format:()=>zt,SRGB8_ALPHA8_ASTC_4x4_Format:()=>Tt,SRGB8_ALPHA8_ASTC_5x4_Format:()=>Et,SRGB8_ALPHA8_ASTC_5x5_Format:()=>At,SRGB8_ALPHA8_ASTC_6x5_Format:()=>Lt,SRGB8_ALPHA8_ASTC_6x6_Format:()=>Rt,SRGB8_ALPHA8_ASTC_8x5_Format:()=>Ct,SRGB8_ALPHA8_ASTC_8x6_Format:()=>Pt,SRGB8_ALPHA8_ASTC_8x8_Format:()=>It,Scene:()=>ll,SceneUtils:()=>Dm,ShaderChunk:()=>Wa,ShaderLib:()=>qa,ShaderMaterial:()=>La,ShadowMaterial:()=>Dc,Shape:()=>bu,ShapeBufferGeometry:()=>Tc,ShapeGeometry:()=>Tc,ShapePath:()=>Ku,ShapeUtils:()=>fc,ShortType:()=>Re,Skeleton:()=>Vl,SkeletonHelper:()=>ip,SkinnedMesh:()=>Bl,SmoothShading:()=>w,Sphere:()=>Ii,SphereBufferGeometry:()=>Ec,SphereGeometry:()=>Ec,Spherical:()=>jd,SphericalHarmonics3:()=>Fu,SplineCurve:()=>kh,SpotLight:()=>Lu,SpotLightHelper:()=>$d,Sprite:()=>El,SpriteMaterial:()=>dl,SrcAlphaFactor:()=>U,SrcAlphaSaturateFactor:()=>k,SrcColorFactor:()=>N,StaticCopyUsage:()=>Or,StaticDrawUsage:()=>Ar,StaticReadUsage:()=>Cr,StereoCamera:()=>ld,StreamCopyUsage:()=>Nr,StreamDrawUsage:()=>Rr,StreamReadUsage:()=>Ir,StringKeyframeTrack:()=>ru,SubtractEquation:()=>R,SubtractiveBlending:()=>T,TOUCH:()=>l,TangentSpaceNormalMap:()=>hr,TetrahedronBufferGeometry:()=>Ac,TetrahedronGeometry:()=>Ac,TextBufferGeometry:()=>Lc,TextGeometry:()=>Lc,Texture:()=>ii,TextureLoader:()=>gu,TorusBufferGeometry:()=>Rc,TorusGeometry:()=>Rc,TorusKnotBufferGeometry:()=>Cc,TorusKnotGeometry:()=>Cc,Triangle:()=>Sn,TriangleFanDrawMode:()=>Qt,TriangleStripDrawMode:()=>Kt,TrianglesDrawMode:()=>Jt,TubeBufferGeometry:()=>Pc,TubeGeometry:()=>Pc,UVMapping:()=>oe,Uint16Attribute:()=>bm,Uint16BufferAttribute:()=>Hn,Uint32Attribute:()=>_m,Uint32BufferAttribute:()=>jn,Uint8Attribute:()=>gm,Uint8BufferAttribute:()=>Fn,Uint8ClampedAttribute:()=>ym,Uint8ClampedBufferAttribute:()=>Gn,Uniform:()=>zd,UniformsLib:()=>Za,UniformsUtils:()=>Aa,UnsignedByteType:()=>Ae,UnsignedInt248Type:()=>ze,UnsignedIntType:()=>Ie,UnsignedShort4444Type:()=>Ne,UnsignedShort5551Type:()=>Be,UnsignedShort565Type:()=>Ue,UnsignedShortType:()=>Ce,VSMShadowMap:()=>v,Vector2:()=>$r,Vector3:()=>ci,Vector4:()=>ai,VectorKeyframeTrack:()=>iu,Vertex:()=>mm,VertexColors:()=>am,VideoTexture:()=>uh,WebGL1Renderer:()=>al,WebGLCubeRenderTarget:()=>Da,WebGLMultipleRenderTargets:()=>oi,WebGLMultisampleRenderTarget:()=>li,WebGLRenderTarget:()=>si,WebGLRenderTargetCube:()=>Pm,WebGLRenderer:()=>nl,WebGLUtils:()=>Ko,WireframeGeometry:()=>Ic,WireframeHelper:()=>Lm,WrapAroundEnding:()=>qt,XHRLoader:()=>Rm,ZeroCurvatureEnding:()=>Wt,ZeroFactor:()=>O,ZeroSlopeEnding:()=>Zt,ZeroStencilOp:()=>ur,sRGBEncoding:()=>er});var s="130",o={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},l={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},h=0,c=1,u=2,d=3,p=0,m=1,f=2,v=3,g=0,y=1,x=2,b=1,w=2,_=0,M=1,S=2,T=3,E=4,A=5,L=100,R=101,C=102,P=103,I=104,O=200,D=201,N=202,B=203,U=204,z=205,F=206,G=207,V=208,H=209,k=210,j=0,W=1,Z=2,q=3,X=4,Y=5,J=6,K=7,Q=0,$=1,ee=2,te=0,re=1,ie=2,ne=3,ae=4,se=5,oe=300,le=301,he=302,ce=303,ue=304,de=306,pe=307,me=1e3,fe=1001,ve=1002,ge=1003,ye=1004,xe=1004,be=1005,we=1005,_e=1006,Me=1007,Se=1007,Te=1008,Ee=1008,Ae=1009,Le=1010,Re=1011,Ce=1012,Pe=1013,Ie=1014,Oe=1015,De=1016,Ne=1017,Be=1018,Ue=1019,ze=1020,Fe=1021,Ge=1022,Ve=1023,He=1024,ke=1025,je=Ve,We=1026,Ze=1027,qe=1028,Xe=1029,Ye=1030,Je=1031,Ke=1032,Qe=1033,$e=33776,et=33777,tt=33778,rt=33779,it=35840,nt=35841,at=35842,st=35843,ot=36196,lt=37492,ht=37496,ct=37808,ut=37809,dt=37810,pt=37811,mt=37812,ft=37813,vt=37814,gt=37815,yt=37816,xt=37817,bt=37818,wt=37819,_t=37820,Mt=37821,St=36492,Tt=37840,Et=37841,At=37842,Lt=37843,Rt=37844,Ct=37845,Pt=37846,It=37847,Ot=37848,Dt=37849,Nt=37850,Bt=37851,Ut=37852,zt=37853,Ft=2200,Gt=2201,Vt=2202,Ht=2300,kt=2301,jt=2302,Wt=2400,Zt=2401,qt=2402,Xt=2500,Yt=2501,Jt=0,Kt=1,Qt=2,$t=3e3,er=3001,tr=3007,rr=3002,ir=3003,nr=3004,ar=3005,sr=3006,or=3200,lr=3201,hr=0,cr=1,ur=0,dr=7680,pr=7681,mr=7682,fr=7683,vr=34055,gr=34056,yr=5386,xr=512,br=513,wr=514,_r=515,Mr=516,Sr=517,Tr=518,Er=519,Ar=35044,Lr=35048,Rr=35040,Cr=35045,Pr=35049,Ir=35041,Or=35046,Dr=35050,Nr=35042,Br="100",Ur="300 es";class zr{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});var r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;var r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0!==this._listeners){var r=this._listeners[e];if(void 0!==r){var i=r.indexOf(t);-1!==i&&r.splice(i,1)}}}dispatchEvent(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var r=t.slice(0),i=0,n=r.length;i<n;i++)r[i].call(this,e);e.target=null}}}}for(var Fr=[],Gr=0;256>Gr;Gr++)Fr[Gr]=(16>Gr?"0":"")+Gr.toString(16);var Vr=1234567,Hr=Math.PI/180,kr=180/Math.PI;function jr(){var e=0|4294967295*Math.random(),t=0|4294967295*Math.random(),r=0|4294967295*Math.random(),i=0|4294967295*Math.random();return(Fr[255&e]+Fr[255&e>>8]+Fr[255&e>>16]+Fr[255&e>>24]+"-"+Fr[255&t]+Fr[255&t>>8]+"-"+Fr[64|15&t>>16]+Fr[255&t>>24]+"-"+Fr[128|63&r]+Fr[255&r>>8]+"-"+Fr[255&r>>16]+Fr[255&r>>24]+Fr[255&i]+Fr[255&i>>8]+Fr[255&i>>16]+Fr[255&i>>24]).toUpperCase()}function Wr(e,t,r){return Math.max(t,Math.min(r,e))}function Zr(e,t){return(e%t+t)%t}function qr(e,t,r){return(1-r)*e+r*t}function Xr(e){return 0==(e&e-1)&&0!==e}function Yr(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Jr(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}var Kr,Qr=Object.freeze({__proto__:null,DEG2RAD:Hr,RAD2DEG:kr,generateUUID:jr,clamp:Wr,euclideanModulo:Zr,mapLinear:function(e,t,r,i,n){return i+(e-t)*(n-i)/(r-t)},inverseLerp:function(e,t,r){return e===t?0:(r-e)/(t-e)},lerp:qr,damp:function(e,t,r,i){return qr(e,t,1-Math.exp(-r*i))},pingpong:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(Zr(e,2*t)-t)},smoothstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-t))*e*(3-2*e)},smootherstep:function(e,t,r){return e<=t?0:e>=r?1:(e=(e-t)/(r-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&&(Vr=e%2147483647),((Vr=16807*Vr%2147483647)-1)/2147483646},degToRad:function(e){return e*Hr},radToDeg:function(e){return e*kr},isPowerOfTwo:Xr,ceilPowerOfTwo:Yr,floorPowerOfTwo:Jr,setQuaternionFromProperEuler:function(e,t,r,i,n){var a=Math.cos,s=Math.sin,o=a(r/2),l=s(r/2),h=a((t+i)/2),c=s((t+i)/2),u=a((t-i)/2),d=s((t-i)/2),p=a((i-t)/2),m=s((i-t)/2);"XYX"===n?e.set(o*c,l*u,l*d,o*h):"YZY"===n?e.set(l*d,o*c,l*u,o*h):"ZXZ"===n?e.set(l*u,l*d,o*c,o*h):"XZX"===n?e.set(o*c,l*m,l*p,o*h):"YXY"===n?e.set(l*p,o*c,l*m,o*h):"ZYZ"===n?e.set(l*m,l*p,o*c,o*h):console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}});class $r{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e,t){return void 0===t?(this.x+=e.x,this.y+=e.y,this):(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t))}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return void 0===t?(this.x-=e.x,this.y-=e.y,this):(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t))}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){var t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){var t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t,r){return void 0!==r&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){var r=Math.cos(t),i=Math.sin(t),n=this.x-e.x,a=this.y-e.y;return this.x=n*r-a*i+e.x,this.y=n*i+a*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}$r.prototype.isVector2=!0;class ei{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,r,i,n,a,s,o,l){var h=this.elements;return h[0]=e,h[1]=i,h[2]=s,h[3]=t,h[4]=n,h[5]=o,h[6]=r,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){var t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){var r=e.elements,i=t.elements,n=this.elements,a=r[0],s=r[3],o=r[6],l=r[1],h=r[4],c=r[7],u=r[2],d=r[5],p=r[8],m=i[0],f=i[3],v=i[6],g=i[1],y=i[4],x=i[7],b=i[2],w=i[5],_=i[8];return n[0]=a*m+s*g+o*b,n[3]=a*f+s*y+o*w,n[6]=a*v+s*x+o*_,n[1]=l*m+h*g+c*b,n[4]=l*f+h*y+c*w,n[7]=l*v+h*x+c*_,n[2]=u*m+d*g+p*b,n[5]=u*f+d*y+p*w,n[8]=u*v+d*x+p*_,this}multiplyScalar(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){var e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8];return t*a*h-t*s*l-r*n*h+r*s*o+i*n*l-i*a*o}invert(){var e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],c=h*a-s*l,u=s*o-h*n,d=l*n-a*o,p=t*c+r*u+i*d;if(0==p)return this.set(0,0,0,0,0,0,0,0,0);var m=1/p;return e[0]=c*m,e[1]=(i*l-h*r)*m,e[2]=(s*r-i*a)*m,e[3]=u*m,e[4]=(h*t-i*o)*m,e[5]=(i*n-s*t)*m,e[6]=d*m,e[7]=(r*o-l*t)*m,e[8]=(a*t-r*n)*m,this}transpose(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,i,n,a,s){var o=Math.cos(n),l=Math.sin(n);return this.set(r*o,r*l,-r*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){var r=this.elements;return r[0]*=e,r[3]*=e,r[6]*=e,r[1]*=t,r[4]*=t,r[7]*=t,this}rotate(e){var t=Math.cos(e),r=Math.sin(e),i=this.elements,n=i[0],a=i[3],s=i[6],o=i[1],l=i[4],h=i[7];return i[0]=t*n+r*o,i[3]=t*a+r*l,i[6]=t*s+r*h,i[1]=-r*n+t*o,i[4]=-r*a+t*l,i[7]=-r*s+t*h,this}translate(e,t){var r=this.elements;return r[0]+=e*r[2],r[3]+=e*r[5],r[6]+=e*r[8],r[1]+=t*r[2],r[4]+=t*r[5],r[7]+=t*r[8],this}equals(e){for(var t=this.elements,r=e.elements,i=0;9>i;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=0;9>r;r++)this.elements[r]=e[r+t];return this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}ei.prototype.isMatrix3=!0;class ti{static getDataURL(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===Kr&&(Kr=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Kr.width=e.width,Kr.height=e.height;var r=Kr.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=Kr}return 2048<t.width||2048<t.height?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}}var ri=0;class ii extends zr{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:ii.DEFAULT_IMAGE,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:ii.DEFAULT_MAPPING,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:fe,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:fe,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:_e,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:Te,s=6<arguments.length&&void 0!==arguments[6]?arguments[6]:Ve,o=7<arguments.length&&void 0!==arguments[7]?arguments[7]:Ae,l=8<arguments.length&&void 0!==arguments[8]?arguments[8]:1,h=9<arguments.length&&void 0!==arguments[9]?arguments[9]:$t;super(),Object.defineProperty(this,"id",{value:ri++}),this.uuid=jr(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=r,this.wrapT=i,this.magFilter=n,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new $r(0,0),this.repeat=new $r(1,1),this.center=new $r(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ei,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=h,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(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(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var r={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=jr()),!t&&void 0===e.images[i.uuid]){var n;if(Array.isArray(i)){n=[];for(var a=0,s=i.length;a<s;a++)i[a].isDataTexture?n.push(ni(i[a].image)):n.push(ni(i[a]))}else n=ni(i);e.images[i.uuid]={uuid:i.uuid,url:n}}r.image=i.uuid}return t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==oe)return e;if(e.applyMatrix3(this.matrix),0>e.x||1<e.x)switch(this.wrapS){case me:e.x-=Math.floor(e.x);break;case fe:e.x=0>e.x?0:1;break;case ve:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x)}if(0>e.y||1<e.y)switch(this.wrapT){case me:e.y-=Math.floor(e.y);break;case fe:e.y=0>e.y?0:1;break;case ve:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&this.version++}}function ni(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?ti.getDataURL(e):e.data?{data:Array.prototype.slice.call(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}ii.DEFAULT_IMAGE=void 0,ii.DEFAULT_MAPPING=oe,ii.prototype.isTexture=!0;class ai{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0===e.w?1:e.w,this}add(e,t){return void 0===t?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this):(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t))}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e,t){return void 0===t?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this):(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t))}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(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}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){var t=this.x,r=this.y,i=this.z,n=this.w,a=e.elements;return this.x=a[0]*t+a[4]*r+a[8]*i+a[12]*n,this.y=a[1]*t+a[5]*r+a[9]*i+a[13]*n,this.z=a[2]*t+a[6]*r+a[10]*i+a[14]*n,this.w=a[3]*t+a[7]*r+a[11]*i+a[15]*n,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return 1e-4>t?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){var t,r,i,n,a=.01,s=.1,o=e.elements,l=o[0],h=o[4],c=o[8],u=o[1],d=o[5],p=o[9],m=o[2],f=o[6],v=o[10];if(Math.abs(h-u)<a&&Math.abs(c-m)<a&&Math.abs(p-f)<a){if(Math.abs(h+u)<s&&Math.abs(c+m)<s&&Math.abs(p+f)<s&&Math.abs(l+d+v-3)<s)return this.set(1,0,0,0),this;t=Math.PI;var g=(l+1)/2,y=(d+1)/2,x=(v+1)/2,b=(h+u)/4,w=(c+m)/4,_=(p+f)/4;return g>y&&g>x?g<a?(r=0,i=.707106781,n=.707106781):(i=b/(r=Math.sqrt(g)),n=w/r):y>x?y<a?(r=.707106781,i=0,n=.707106781):(r=b/(i=Math.sqrt(y)),n=_/i):x<a?(r=.707106781,i=.707106781,n=0):(r=w/(n=Math.sqrt(x)),i=_/n),this.set(r,i,n,t),this}var M=Math.sqrt((f-p)*(f-p)+(c-m)*(c-m)+(u-h)*(u-h));return.001>Math.abs(M)&&(M=1),this.x=(f-p)/M,this.y=(c-m)/M,this.z=(u-h)/M,this.w=Math.acos((l+d+v-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this.w=0>this.w?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t,r){return void 0!==r&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}}ai.prototype.isVector4=!0;class si extends zr{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};super(),this.width=e,this.height=t,this.depth=1,this.scissor=new ai(0,0,e,t),this.scissorTest=!1,this.viewport=new ai(0,0,e,t),this.texture=new ii(void 0,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.image={width:e,height:t,depth:1},this.texture.generateMipmaps=void 0!==r.generateMipmaps&&r.generateMipmaps,this.texture.minFilter=void 0===r.minFilter?_e:r.minFilter,this.depthBuffer=!(void 0!==r.depthBuffer)||r.depthBuffer,this.stencilBuffer=void 0!==r.stencilBuffer&&r.stencilBuffer,this.depthTexture=void 0===r.depthTexture?null:r.depthTexture}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.image=function(e){for(var t,r=1;r<arguments.length;r++)t=null==arguments[r]?{}:arguments[r],r%2?a(Object(t),!0).forEach((function(r){var i,n,a;i=e,n=r,a=t[r],n=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(n),n in i?Object.defineProperty(i,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[n]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):a(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}));return e}({},this.texture.image),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}si.prototype.isWebGLRenderTarget=!0;class oi extends si{constructor(e,t,r){super(e,t);var i=this.texture;this.texture=[];for(var n=0;n<r;n++)this.texture[n]=i.clone()}setSize(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==r){this.width=e,this.height=t,this.depth=r;for(var i=0,n=this.texture.length;i<n;i++)this.texture[i].image.width=e,this.texture[i].image.height=t,this.texture[i].image.depth=r;this.dispose()}return this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t),this}copy(e){this.dispose(),this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this.texture.length=0;for(var t=0,r=e.texture.length;t<r;t++)this.texture[t]=e.texture[t].clone();return this}}oi.prototype.isWebGLMultipleRenderTargets=!0;class li extends si{constructor(e,t,r){super(e,t,r),this.samples=4}copy(e){return super.copy.call(this,e),this.samples=e.samples,this}}li.prototype.isWebGLMultisampleRenderTarget=!0;class hi{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;this._x=e,this._y=t,this._z=r,this._w=i}static slerp(e,t,r,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),r.slerpQuaternions(e,t,i)}static slerpFlat(e,t,r,i,n,a,s){var o=r[i+0],l=r[i+1],h=r[i+2],c=r[i+3],u=n[a+0],d=n[a+1],p=n[a+2],m=n[a+3];if(0===s)return e[t+0]=o,e[t+1]=l,e[t+2]=h,void(e[t+3]=c);if(1===s)return e[t+0]=u,e[t+1]=d,e[t+2]=p,void(e[t+3]=m);if(c!==m||o!==u||l!==d||h!==p){var f=1-s,v=o*u+l*d+h*p+c*m,g=0<=v?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);f=Math.sin(f*b)/x,s=Math.sin(s*b)/x}var w=s*g;if(o=o*f+u*w,l=l*f+d*w,h=h*f+p*w,c=c*f+m*w,f==1-s){var _=1/Math.sqrt(o*o+l*l+h*h+c*c);o*=_,l*=_,h*=_,c*=_}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=c}static multiplyQuaternionsFlat(e,t,r,i,n,a){var s=r[i],o=r[i+1],l=r[i+2],h=r[i+3],c=n[a],u=n[a+1],d=n[a+2],p=n[a+3];return e[t]=s*p+h*c+o*d-l*u,e[t+1]=o*p+h*u+l*c-s*d,e[t+2]=l*p+h*d+s*u-o*c,e[t+3]=h*p-s*c-o*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var r=e._x,i=e._y,n=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(r/2),h=s(i/2),c=s(n/2),u=o(r/2),d=o(i/2),p=o(n/2);return"XYZ"===a?(this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p):"YXZ"===a?(this._x=u*h*c+l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p):"ZXY"===a?(this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c-u*d*p):"ZYX"===a?(this._x=u*h*c-l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c+u*d*p):"YZX"===a?(this._x=u*h*c+l*d*p,this._y=l*d*c+u*h*p,this._z=l*h*p-u*d*c,this._w=l*h*c-u*d*p):"XZY"===a?(this._x=u*h*c-l*d*p,this._y=l*d*c-u*h*p,this._z=l*h*p+u*d*c,this._w=l*h*c+u*d*p):console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a),!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){var r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){var t=e.elements,r=t[0],i=t[4],n=t[8],a=t[1],s=t[5],o=t[9],l=t[2],h=t[6],c=t[10],u=r+s+c;if(0<u){var d=.5/Math.sqrt(u+1);this._w=.25/d,this._x=(h-o)*d,this._y=(n-l)*d,this._z=(a-i)*d}else if(r>s&&r>c){var p=2*Math.sqrt(1+r-s-c);this._w=(h-o)/p,this._x=.25*p,this._y=(i+a)/p,this._z=(n+l)/p}else if(s>c){var m=2*Math.sqrt(1+s-r-c);this._w=(n-l)/m,this._x=(i+a)/m,this._y=.25*m,this._z=(o+h)/m}else{var f=2*Math.sqrt(1+c-r-s);this._w=(a-i)/f,this._x=(n+l)/f,this._y=(o+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){var r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(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=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Wr(this.dot(e),-1,1)))}rotateTowards(e,t){var r=this.angleTo(e);if(0===r)return this;var i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e,t){return void 0===t?this.multiplyQuaternions(this,e):(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t))}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){var r=e._x,i=e._y,n=e._z,a=e._w,s=t._x,o=t._y,l=t._z,h=t._w;return this._x=r*h+a*s+i*l-n*o,this._y=i*h+a*o+n*s-r*l,this._z=n*h+a*l+r*o-i*s,this._w=a*h-r*s-i*o-n*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);var r=this._x,i=this._y,n=this._z,a=this._w,s=a*e._w+r*e._x+i*e._y+n*e._z;if(0>s?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),1<=s)return this._w=a,this._x=r,this._y=i,this._z=n,this;var o=1-s*s;if(o<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*r+t*this._x,this._y=l*i+t*this._y,this._z=l*n+t*this._z,this.normalize(),this._onChangeCallback(),this}var h=Math.sqrt(o),c=Math.atan2(h,s),u=Math.sin((1-t)*c)/h,d=Math.sin(t*c)/h;return this._w=a*u+this._w*d,this._x=r*u+this._x*d,this._y=i*u+this._y*d,this._z=n*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,r){this.copy(e).slerp(t,r)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}hi.prototype.isQuaternion=!0;class ci{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;this.x=e,this.y=t,this.z=r}set(e,t,r){return void 0===r&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e,t){return void 0===t?(this.x+=e.x,this.y+=e.y,this.z+=e.z,this):(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t))}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e,t){return void 0===t?(this.x-=e.x,this.y-=e.y,this.z-=e.z,this):(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t))}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e,t){return void 0===t?(this.x*=e.x,this.y*=e.y,this.z*=e.z,this):(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t))}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(di.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(di.setFromAxisAngle(e,t))}applyMatrix3(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6]*i,this.y=n[1]*t+n[4]*r+n[7]*i,this.z=n[2]*t+n[5]*r+n[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){var t=this.x,r=this.y,i=this.z,n=e.elements,a=1/(n[3]*t+n[7]*r+n[11]*i+n[15]);return this.x=(n[0]*t+n[4]*r+n[8]*i+n[12])*a,this.y=(n[1]*t+n[5]*r+n[9]*i+n[13])*a,this.z=(n[2]*t+n[6]*r+n[10]*i+n[14])*a,this}applyQuaternion(e){var t=this.x,r=this.y,i=this.z,n=e.x,a=e.y,s=e.z,o=e.w,l=o*t+a*i-s*r,h=o*r+s*t-n*i,c=o*i+n*r-a*t,u=-n*t-a*r-s*i;return this.x=l*o+u*-n+h*-s-c*-a,this.y=h*o+u*-a+c*-n-l*-s,this.z=c*o+u*-s+l*-a-h*-n,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i,this.y=n[1]*t+n[5]*r+n[9]*i,this.z=n[2]*t+n[6]*r+n[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){var r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=0>this.x?Math.ceil(this.x):Math.floor(this.x),this.y=0>this.y?Math.ceil(this.y):Math.floor(this.y),this.z=0>this.z?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e,t){return void 0===t?this.crossVectors(this,e):(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t))}crossVectors(e,t){var r=e.x,i=e.y,n=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-n*s,this.y=n*a-r*o,this.z=r*s-i*a,this}projectOnVector(e){var t=e.lengthSq();if(0===t)return this.set(0,0,0);var r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return ui.copy(this).projectOnVector(e),this.sub(ui)}reflect(e){return this.sub(ui.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;var r=this.dot(e)/t;return Math.acos(Wr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){var t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){var i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){var t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t,r){return void 0!==r&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}}ci.prototype.isVector3=!0;var ui=new ci,di=new hi;class pi{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci(1/0,1/0,1/0),t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci(-1/0,-1/0,-1/0);this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){for(var t=1/0,r=1/0,i=1/0,n=-1/0,a=-1/0,s=-1/0,o=0,l=e.length;o<l;o+=3){var h=e[o],c=e[o+1],u=e[o+2];h<t&&(t=h),c<r&&(r=c),u<i&&(i=u),h>n&&(n=h),c>a&&(a=c),u>s&&(s=u)}return this.min.set(t,r,i),this.max.set(n,a,s),this}setFromBufferAttribute(e){for(var t=1/0,r=1/0,i=1/0,n=-1/0,a=-1/0,s=-1/0,o=0,l=e.count;o<l;o++){var h=e.getX(o),c=e.getY(o),u=e.getZ(o);h<t&&(t=h),c<r&&(r=c),u<i&&(i=u),h>n&&(n=h),c>a&&(a=c),u>s&&(s=u)}return this.min.set(t,r,i),this.max.set(n,a,s),this}setFromPoints(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){var r=fi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e){return this.makeEmpty(),this.expandByObject(e)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;void 0!==t&&(null===t.boundingBox&&t.computeBoundingBox(),vi.copy(t.boundingBox),vi.applyMatrix4(e.matrixWorld),this.union(vi));for(var r=e.children,i=0,n=r.length;i<n;i++)this.expandByObject(r[i]);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,fi),fi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){var t,r;return 0<e.normal.x?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),0<e.normal.y?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),0<e.normal.z?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Mi),Si.subVectors(this.max,Mi),gi.subVectors(e.a,Mi),yi.subVectors(e.b,Mi),xi.subVectors(e.c,Mi),bi.subVectors(yi,gi),wi.subVectors(xi,yi),_i.subVectors(gi,xi);var t=[0,-bi.z,bi.y,0,-wi.z,wi.y,0,-_i.z,_i.y,bi.z,0,-bi.x,wi.z,0,-wi.x,_i.z,0,-_i.x,-bi.y,bi.x,0,-wi.y,wi.x,0,-_i.y,_i.x,0];return!!Ai(t,gi,yi,xi,Si)&&!!Ai(t=[1,0,0,0,1,0,0,0,1],gi,yi,xi,Si)&&(Ti.crossVectors(bi,wi),Ai(t=[Ti.x,Ti.y,Ti.z],gi,yi,xi,Si))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return fi.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=.5*this.getSize(fi).length(),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(mi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),mi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),mi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),mi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),mi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),mi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),mi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),mi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(mi)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}pi.prototype.isBox3=!0;var mi=[new ci,new ci,new ci,new ci,new ci,new ci,new ci,new ci],fi=new ci,vi=new pi,gi=new ci,yi=new ci,xi=new ci,bi=new ci,wi=new ci,_i=new ci,Mi=new ci,Si=new ci,Ti=new ci,Ei=new ci;function Ai(e,t,r,i,n){for(var a=0,s=e.length-3;a<=s;a+=3){Ei.fromArray(e,a);var o=n.x*Math.abs(Ei.x)+n.y*Math.abs(Ei.y)+n.z*Math.abs(Ei.z),l=t.dot(Ei),h=r.dot(Ei),c=i.dot(Ei);if(Math.max(-Math.max(l,h,c),Math.min(l,h,c))>o)return!1}return!0}var Li=new pi,Ri=new ci,Ci=new ci,Pi=new ci;class Ii{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1;this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){var r=this.center;void 0===t?Li.setFromPoints(e).getCenter(r):r.copy(t);for(var i=0,n=0,a=e.length;n<a;n++)i=Math.max(i,r.distanceToSquared(e[n]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return 0>this.radius}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){var r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Pi.subVectors(e,this.center);var t=Pi.lengthSq();if(t>this.radius*this.radius){var r=Math.sqrt(t),i=.5*(r-this.radius);this.center.add(Pi.multiplyScalar(i/r)),this.radius+=i}return this}union(e){return Ci.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Ri.copy(e.center).add(Ci)),this.expandByPoint(Ri.copy(e.center).sub(Ci)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}var Oi=new ci,Di=new ci,Ni=new ci,Bi=new ci,Ui=new ci,zi=new ci,Fi=new ci;class Gi{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci(0,0,-1);this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Oi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);var r=t.dot(this.direction);return 0>r?t.copy(this.origin):t.copy(this.direction).multiplyScalar(r).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){var t=Oi.subVectors(e,this.origin).dot(this.direction);return 0>t?this.origin.distanceToSquared(e):(Oi.copy(this.direction).multiplyScalar(t).add(this.origin),Oi.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){Di.copy(e).add(t).multiplyScalar(.5),Ni.copy(t).sub(e).normalize(),Bi.copy(this.origin).sub(Di);var n,a,s,o,l=.5*e.distanceTo(t),h=-this.direction.dot(Ni),c=Bi.dot(this.direction),u=-Bi.dot(Ni),d=Bi.lengthSq(),p=Math.abs(1-h*h);if(0<p)if(a=h*c-u,o=l*p,0<=(n=h*u-c))if(a>=-o)if(a<=o){var m=1/p;s=(n*=m)*(n+h*(a*=m)+2*c)+a*(h*n+a+2*u)+d}else a=l,s=-(n=Math.max(0,-(h*a+c)))*n+a*(a+2*u)+d;else a=-l,s=-(n=Math.max(0,-(h*a+c)))*n+a*(a+2*u)+d;else a<=-o?s=-(n=Math.max(0,-(-h*l+c)))*n+(a=0<n?-l:Math.min(Math.max(-l,-u),l))*(a+2*u)+d:a<=o?(n=0,s=(a=Math.min(Math.max(-l,-u),l))*(a+2*u)+d):s=-(n=Math.max(0,-(h*l+c)))*n+(a=0<n?l:Math.min(Math.max(-l,-u),l))*(a+2*u)+d;else a=0<h?-l:l,s=-(n=Math.max(0,-(h*a+c)))*n+a*(a+2*u)+d;return r&&r.copy(this.direction).multiplyScalar(n).add(this.origin),i&&i.copy(Ni).multiplyScalar(a).add(Di),s}intersectSphere(e,t){Oi.subVectors(e.center,this.origin);var r=Oi.dot(this.direction),i=Oi.dot(Oi)-r*r,n=e.radius*e.radius;if(i>n)return null;var a=Math.sqrt(n-i),s=r-a,o=r+a;return 0>s&&0>o?null:0>s?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var r=-(this.origin.dot(e.normal)+e.constant)/t;return 0<=r?r:null}intersectPlane(e,t){var r=this.distanceToPlane(e);return null===r?null:this.at(r,t)}intersectsPlane(e){var t=e.distanceToPoint(this.origin);return 0===t||!!(0>e.normal.dot(this.direction)*t)}intersectBox(e,t){var r,i,n,a,s,o,l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,u=this.origin;return 0<=l?(r=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l):(r=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l),0<=h?(n=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(n=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),r>a||n>i?null:((n>r||r!=r)&&(r=n),(a<i||i!=i)&&(i=a),0<=c?(s=(e.min.z-u.z)*c,o=(e.max.z-u.z)*c):(s=(e.max.z-u.z)*c,o=(e.min.z-u.z)*c),r>o||s>i?null:((s>r||r!=r)&&(r=s),(o<i||i!=i)&&(i=o),0>i?null:this.at(0<=r?r:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Oi)}intersectTriangle(e,t,r,i,n){Ui.subVectors(t,e),zi.subVectors(r,e),Fi.crossVectors(Ui,zi);var a,s=this.direction.dot(Fi);if(0<s){if(i)return null;a=1}else{if(!(0>s))return null;a=-1,s=-s}Bi.subVectors(this.origin,e);var o=a*this.direction.dot(zi.crossVectors(Bi,zi));if(0>o)return null;var l=a*this.direction.dot(Ui.cross(Bi));if(0>l)return null;if(o+l>s)return null;var h=-a*Bi.dot(Fi);return 0>h?null:this.at(h/s,n)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Vi{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0<arguments.length&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,r,i,n,a,s,o,l,h,c,u,d,p,m,f){var v=this.elements;return v[0]=e,v[4]=t,v[8]=r,v[12]=i,v[1]=n,v[5]=a,v[9]=s,v[13]=o,v[2]=l,v[6]=h,v[10]=c,v[14]=u,v[3]=d,v[7]=p,v[11]=m,v[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Vi).fromArray(this.elements)}copy(e){var t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){var t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){var t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){var t=this.elements,r=e.elements,i=1/Hi.setFromMatrixColumn(e,0).length(),n=1/Hi.setFromMatrixColumn(e,1).length(),a=1/Hi.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*n,t[5]=r[5]*n,t[6]=r[6]*n,t[7]=0,t[8]=r[8]*a,t[9]=r[9]*a,t[10]=r[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,r=e.x,i=e.y,n=e.z,a=Math.cos(r),s=Math.sin(r),o=Math.cos(i),l=Math.sin(i),h=Math.cos(n),c=Math.sin(n);if("XYZ"===e.order){var u=a*h,d=a*c,p=s*h,m=s*c;t[0]=o*h,t[4]=-o*c,t[8]=l,t[1]=d+p*l,t[5]=u-m*l,t[9]=-s*o,t[2]=m-u*l,t[6]=p+d*l,t[10]=a*o}else if("YXZ"===e.order){var f=o*h,v=o*c,g=l*h,y=l*c;t[0]=f+y*s,t[4]=g*s-v,t[8]=a*l,t[1]=a*c,t[5]=a*h,t[9]=-s,t[2]=v*s-g,t[6]=y+f*s,t[10]=a*o}else if("ZXY"===e.order){var x=o*h,b=o*c,w=l*h,_=l*c;t[0]=x-_*s,t[4]=-a*c,t[8]=w+b*s,t[1]=b+w*s,t[5]=a*h,t[9]=_-x*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){var M=a*h,S=a*c,T=s*h,E=s*c;t[0]=o*h,t[4]=T*l-S,t[8]=M*l+E,t[1]=o*c,t[5]=E*l+M,t[9]=S*l-T,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){var A=a*o,L=a*l,R=s*o,C=s*l;t[0]=o*h,t[4]=C-A*c,t[8]=R*c+L,t[1]=c,t[5]=a*h,t[9]=-s*h,t[2]=-l*h,t[6]=L*c+R,t[10]=A-C*c}else if("XZY"===e.order){var P=a*o,I=a*l,O=s*o,D=s*l;t[0]=o*h,t[4]=-c,t[8]=l*h,t[1]=P*c+D,t[5]=a*h,t[9]=I*c-O,t[2]=O*c-I,t[6]=s*h,t[10]=D*c+P}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ji,e,Wi)}lookAt(e,t,r){var i=this.elements;return Xi.subVectors(e,t),0===Xi.lengthSq()&&(Xi.z=1),Xi.normalize(),Zi.crossVectors(r,Xi),0===Zi.lengthSq()&&(1===Math.abs(r.z)?Xi.x+=1e-4:Xi.z+=1e-4,Xi.normalize(),Zi.crossVectors(r,Xi)),Zi.normalize(),qi.crossVectors(Xi,Zi),i[0]=Zi.x,i[4]=qi.x,i[8]=Xi.x,i[1]=Zi.y,i[5]=qi.y,i[9]=Xi.y,i[2]=Zi.z,i[6]=qi.z,i[10]=Xi.z,this}multiply(e,t){return void 0===t?this.multiplyMatrices(this,e):(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t))}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){var r=e.elements,i=t.elements,n=this.elements,a=r[0],s=r[4],o=r[8],l=r[12],h=r[1],c=r[5],u=r[9],d=r[13],p=r[2],m=r[6],f=r[10],v=r[14],g=r[3],y=r[7],x=r[11],b=r[15],w=i[0],_=i[4],M=i[8],S=i[12],T=i[1],E=i[5],A=i[9],L=i[13],R=i[2],C=i[6],P=i[10],I=i[14],O=i[3],D=i[7],N=i[11],B=i[15];return n[0]=a*w+s*T+o*R+l*O,n[4]=a*_+s*E+o*C+l*D,n[8]=a*M+s*A+o*P+l*N,n[12]=a*S+s*L+o*I+l*B,n[1]=h*w+c*T+u*R+d*O,n[5]=h*_+c*E+u*C+d*D,n[9]=h*M+c*A+u*P+d*N,n[13]=h*S+c*L+u*I+d*B,n[2]=p*w+m*T+f*R+v*O,n[6]=p*_+m*E+f*C+v*D,n[10]=p*M+m*A+f*P+v*N,n[14]=p*S+m*L+f*I+v*B,n[3]=g*w+y*T+x*R+b*O,n[7]=g*_+y*E+x*C+b*D,n[11]=g*M+y*A+x*P+b*N,n[15]=g*S+y*L+x*I+b*B,this}multiplyScalar(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){var e=this.elements,t=e[0],r=e[4],i=e[8],n=e[12],a=e[1],s=e[5],o=e[9],l=e[13],h=e[2],c=e[6],u=e[10],d=e[14];return e[3]*(+n*o*c-i*l*c-n*s*u+r*l*u+i*s*d-r*o*d)+e[7]*(+t*o*d-t*l*u+n*a*u-i*a*d+i*l*h-n*o*h)+e[11]*(+t*l*c-t*s*d-n*a*c+r*a*d+n*s*h-r*l*h)+e[15]*(-i*s*h-t*o*c+t*s*u+i*a*c-r*a*u+r*o*h)}transpose(){var e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,r){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]=r),this}invert(){var e=this.elements,t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=e[11],p=e[12],m=e[13],f=e[14],v=e[15],g=c*f*l-m*u*l+m*o*d-s*f*d-c*o*v+s*u*v,y=p*u*l-h*f*l-p*o*d+a*f*d+h*o*v-a*u*v,x=h*m*l-p*c*l+p*s*d-a*m*d-h*s*v+a*c*v,b=p*c*o-h*m*o-p*s*u+a*m*u+h*s*f-a*c*f,w=t*g+r*y+i*x+n*b;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var _=1/w;return e[0]=g*_,e[1]=(m*u*n-c*f*n-m*i*d+r*f*d+c*i*v-r*u*v)*_,e[2]=(s*f*n-m*o*n+m*i*l-r*f*l-s*i*v+r*o*v)*_,e[3]=(c*o*n-s*u*n-c*i*l+r*u*l+s*i*d-r*o*d)*_,e[4]=y*_,e[5]=(h*f*n-p*u*n+p*i*d-t*f*d-h*i*v+t*u*v)*_,e[6]=(p*o*n-a*f*n-p*i*l+t*f*l+a*i*v-t*o*v)*_,e[7]=(a*u*n-h*o*n+h*i*l-t*u*l-a*i*d+t*o*d)*_,e[8]=x*_,e[9]=(p*c*n-h*m*n-p*r*d+t*m*d+h*r*v-t*c*v)*_,e[10]=(a*m*n-p*s*n+p*r*l-t*m*l-a*r*v+t*s*v)*_,e[11]=(h*s*n-a*c*n-h*r*l+t*c*l+a*r*d-t*s*d)*_,e[12]=b*_,e[13]=(h*m*i-p*c*i+p*r*u-t*m*u-h*r*f+t*c*f)*_,e[14]=(p*s*i-a*m*i-p*r*o+t*m*o+a*r*f-t*s*f)*_,e[15]=(a*c*i-h*s*i+h*r*o-t*c*o-a*r*u+t*s*u)*_,this}scale(e){var t=this.elements,r=e.x,i=e.y,n=e.z;return t[0]*=r,t[4]*=i,t[8]*=n,t[1]*=r,t[5]*=i,t[9]*=n,t[2]*=r,t[6]*=i,t[10]*=n,t[3]*=r,t[7]*=i,t[11]*=n,this}getMaxScaleOnAxis(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=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,r,i))}makeTranslation(e,t,r){return this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){var t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){var t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){var r=Math.cos(t),i=Math.sin(t),n=1-r,a=e.x,s=e.y,o=e.z,l=n*a,h=n*s;return this.set(l*a+r,l*s-i*o,l*o+i*s,0,l*s+i*o,h*s+r,h*o-i*a,0,l*o-i*s,h*o+i*a,n*o*o+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,n,a){return this.set(1,r,n,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){var i=this.elements,n=t._x,a=t._y,s=t._z,o=t._w,l=n+n,h=a+a,c=s+s,u=n*l,d=n*h,p=n*c,m=a*h,f=a*c,v=s*c,g=o*l,y=o*h,x=o*c,b=r.x,w=r.y,_=r.z;return i[0]=(1-(m+v))*b,i[1]=(d+x)*b,i[2]=(p-y)*b,i[3]=0,i[4]=(d-x)*w,i[5]=(1-(u+v))*w,i[6]=(f+g)*w,i[7]=0,i[8]=(p+y)*_,i[9]=(f-g)*_,i[10]=(1-(u+m))*_,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){var i=this.elements,n=Hi.set(i[0],i[1],i[2]).length(),a=Hi.set(i[4],i[5],i[6]).length(),s=Hi.set(i[8],i[9],i[10]).length();0>this.determinant()&&(n=-n),e.x=i[12],e.y=i[13],e.z=i[14],ki.copy(this);var o=1/n,l=1/a,h=1/s;return ki.elements[0]*=o,ki.elements[1]*=o,ki.elements[2]*=o,ki.elements[4]*=l,ki.elements[5]*=l,ki.elements[6]*=l,ki.elements[8]*=h,ki.elements[9]*=h,ki.elements[10]*=h,t.setFromRotationMatrix(ki),r.x=n,r.y=a,r.z=s,this}makePerspective(e,t,r,i,n,a){void 0===a&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var s=this.elements;return s[0]=2*n/(t-e),s[4]=0,s[8]=(t+e)/(t-e),s[12]=0,s[1]=0,s[5]=2*n/(r-i),s[9]=(r+i)/(r-i),s[13]=0,s[2]=0,s[6]=0,s[10]=-(a+n)/(a-n),s[14]=-2*a*n/(a-n),s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,r,i,n,a){var s=this.elements,o=1/(t-e),l=1/(r-i),h=1/(a-n);return s[0]=2*o,s[4]=0,s[8]=0,s[12]=-(t+e)*o,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-(r+i)*l,s[2]=0,s[6]=0,s[10]=-2*h,s[14]=-(a+n)*h,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){for(var t=this.elements,r=e.elements,i=0;16>i;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=0;16>r;r++)this.elements[r]=e[r+t];return this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}Vi.prototype.isMatrix4=!0;var Hi=new ci,ki=new Vi,ji=new ci(0,0,0),Wi=new ci(1,1,1),Zi=new ci,qi=new ci,Xi=new ci,Yi=new Vi,Ji=new hi;class Ki{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:Ki.DefaultOrder;this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this._order,r=!(2<arguments.length&&void 0!==arguments[2])||arguments[2],i=e.elements,n=i[0],a=i[4],s=i[8],o=i[1],l=i[5],h=i[9],c=i[2],u=i[6],d=i[10];return"XYZ"===t?(this._y=Math.asin(Wr(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,n)):(this._x=Math.atan2(u,l),this._z=0)):"YXZ"===t?(this._x=Math.asin(-Wr(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,n),this._z=0)):"ZXY"===t?(this._x=Math.asin(Wr(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,n))):"ZYX"===t?(this._y=Math.asin(-Wr(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,n)):(this._x=0,this._z=Math.atan2(-a,l))):"YZX"===t?(this._z=Math.asin(Wr(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-c,n)):(this._x=0,this._y=Math.atan2(s,d))):"XZY"===t?(this._z=Math.asin(-Wr(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(u,l),this._y=Math.atan2(s,n)):(this._x=Math.atan2(-h,d),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t),this._order=t,!0===r&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return Yi.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Yi,t,r)}setFromVector3(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}reorder(e){return Ji.setFromEuler(this),this.setFromQuaternion(Ji,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}toVector3(e){return e?e.set(this._x,this._y,this._z):new ci(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Ki.prototype.isEuler=!0,Ki.DefaultOrder="XYZ",Ki.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Qi{constructor(){this.mask=1}set(e){this.mask=0|1<<e}enable(e){this.mask|=0|1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=0|1<<e}disable(e){this.mask&=~(0|1<<e)}disableAll(){this.mask=0}test(e){return 0!=(this.mask&e.mask)}}var $i=0,en=new ci,tn=new hi,rn=new Vi,nn=new ci,an=new ci,sn=new ci,on=new hi,ln=new ci(1,0,0),hn=new ci(0,1,0),cn=new ci(0,0,1),un={type:"added"},dn={type:"removed"};class pn extends zr{constructor(){super(),Object.defineProperty(this,"id",{value:$i++}),this.uuid=jr(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=pn.DefaultUp.clone();var e=new ci,t=new Ki,r=new hi,i=new ci(1,1,1);t._onChange((function(){r.setFromEuler(t,!1)})),r._onChange((function(){t.setFromQuaternion(r,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:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Vi},normalMatrix:{value:new ei}}),this.matrix=new Vi,this.matrixWorld=new Vi,this.matrixAutoUpdate=pn.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Qi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return tn.setFromAxisAngle(e,t),this.quaternion.multiply(tn),this}rotateOnWorldAxis(e,t){return tn.setFromAxisAngle(e,t),this.quaternion.premultiply(tn),this}rotateX(e){return this.rotateOnAxis(ln,e)}rotateY(e){return this.rotateOnAxis(hn,e)}rotateZ(e){return this.rotateOnAxis(cn,e)}translateOnAxis(e,t){return en.copy(e).applyQuaternion(this.quaternion),this.position.add(en.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ln,e)}translateY(e){return this.translateOnAxis(hn,e)}translateZ(e){return this.translateOnAxis(cn,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(rn.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?nn.copy(e):nn.set(e,t,r);var i=this.parent;this.updateWorldMatrix(!0,!1),an.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?rn.lookAt(an,nn,this.up):rn.lookAt(nn,an,this.up),this.quaternion.setFromRotationMatrix(rn),i&&(rn.extractRotation(i.matrixWorld),tn.setFromRotationMatrix(rn),this.quaternion.premultiply(tn.invert()))}add(e){if(1<arguments.length){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(un)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(1<arguments.length){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var r=this.children.indexOf(e);return-1!==r&&(e.parent=null,this.children.splice(r,1),e.dispatchEvent(dn)),this}removeFromParent(){var e=this.parent;return null!==e&&e.remove(this),this}clear(){for(var e,t=0;t<this.children.length;t++)(e=this.children[t]).parent=null,e.dispatchEvent(dn);return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),rn.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),rn.multiply(e.parent.matrixWorld)),e.applyMatrix4(rn),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(var r=0,i=this.children.length;r<i;r++){var n=this.children[r].getObjectByProperty(e,t);if(void 0!==n)return n}}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(an,e,sn),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(an,on,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);for(var t=this.children,r=0,i=t.length;r<i;r++)t[r].traverse(e)}traverseVisible(e){if(!1!==this.visible){e(this);for(var t=this.children,r=0,i=t.length;r<i;r++)t[r].traverseVisible(e)}}traverseAncestors(e){var t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(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,r=0,i=t.length;r<i;r++)t[r].updateMatrixWorld(e)}updateWorldMatrix(e,t){var r=this.parent;if(!0===e&&null!==r&&r.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,n=0,a=i.length;n<a;n++)i[n].updateWorldMatrix(!1,!0)}toJSON(e){function t(t,r){return void 0===t[r.uuid]&&(t[r.uuid]=r.toJSON(e)),r.uuid}function r(e){var t=[];for(var r in e){var i=e[r];delete i.metadata,t.push(i)}return t}var i=void 0===e||"string"==typeof e,n={};i&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var a={};if(a.uuid=this.uuid,a.type=this.type,""!==this.name&&(a.name=this.name),!0===this.castShadow&&(a.castShadow=!0),!0===this.receiveShadow&&(a.receiveShadow=!0),!1===this.visible&&(a.visible=!1),!1===this.frustumCulled&&(a.frustumCulled=!1),0!==this.renderOrder&&(a.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(a.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&(a.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=t(e.geometries,this.geometry);var s=this.geometry.parameters;if(void 0!==s&&void 0!==s.shapes){var o=s.shapes;if(Array.isArray(o))for(var l,h=0,c=o.length;h<c;h++)l=o[h],t(e.shapes,l);else t(e.shapes,o)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(t(e.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){for(var u=[],d=0,p=this.material.length;d<p;d++)u.push(t(e.materials,this.material[d]));a.material=u}else a.material=t(e.materials,this.material);if(0<this.children.length){a.children=[];for(var m=0;m<this.children.length;m++)a.children.push(this.children[m].toJSON(e).object)}if(0<this.animations.length){a.animations=[];for(var f,v=0;v<this.animations.length;v++)f=this.animations[v],a.animations.push(t(e.animations,f))}if(i){var g=r(e.geometries),y=r(e.materials),x=r(e.textures),b=r(e.images),w=r(e.shapes),_=r(e.skeletons),M=r(e.animations);0<g.length&&(n.geometries=g),0<y.length&&(n.materials=y),0<x.length&&(n.textures=x),0<b.length&&(n.images=b),0<w.length&&(n.shapes=w),0<_.length&&(n.skeletons=_),0<M.length&&(n.animations=M)}return n.object=a,n}clone(e){return(new this.constructor).copy(this,e)}copy(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var r,i=0;i<e.children.length;i++)r=e.children[i],this.add(r.clone());return this}}pn.DefaultUp=new ci(0,1,0),pn.DefaultMatrixAutoUpdate=!0,pn.prototype.isObject3D=!0;var mn=new ci,fn=new ci,vn=new ci,gn=new ci,yn=new ci,xn=new ci,bn=new ci,wn=new ci,_n=new ci,Mn=new ci;class Sn{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new ci;this.a=e,this.b=t,this.c=r}static getNormal(e,t,r,i){i.subVectors(r,t),mn.subVectors(e,t),i.cross(mn);var n=i.lengthSq();return 0<n?i.multiplyScalar(1/Math.sqrt(n)):i.set(0,0,0)}static getBarycoord(e,t,r,i,n){mn.subVectors(i,t),fn.subVectors(r,t),vn.subVectors(e,t);var a=mn.dot(mn),s=mn.dot(fn),o=mn.dot(vn),l=fn.dot(fn),h=fn.dot(vn),c=a*l-s*s;if(0===c)return n.set(-2,-1,-1);var u=1/c,d=(l*o-s*h)*u,p=(a*h-s*o)*u;return n.set(1-d-p,p,d)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,gn),0<=gn.x&&0<=gn.y&&1>=gn.x+gn.y}static getUV(e,t,r,i,n,a,s,o){return this.getBarycoord(e,t,r,i,gn),o.set(0,0),o.addScaledVector(n,gn.x),o.addScaledVector(a,gn.y),o.addScaledVector(s,gn.z),o}static isFrontFacing(e,t,r,i){return mn.subVectors(r,t),fn.subVectors(e,t),!!(0>mn.cross(fn).dot(i))}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return mn.subVectors(this.c,this.b),fn.subVectors(this.a,this.b),.5*mn.cross(fn).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Sn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Sn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,n){return Sn.getUV(e,this.a,this.b,this.c,t,r,i,n)}containsPoint(e){return Sn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Sn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){var r,i,n=this.a,a=this.b,s=this.c;yn.subVectors(a,n),xn.subVectors(s,n),wn.subVectors(e,n);var o=yn.dot(wn),l=xn.dot(wn);if(0>=o&&0>=l)return t.copy(n);_n.subVectors(e,a);var h=yn.dot(_n),c=xn.dot(_n);if(0<=h&&c<=h)return t.copy(a);var u=o*c-h*l;if(0>=u&&0<=o&&0>=h)return r=o/(o-h),t.copy(n).addScaledVector(yn,r);Mn.subVectors(e,s);var d=yn.dot(Mn),p=xn.dot(Mn);if(0<=p&&d<=p)return t.copy(s);var m=d*l-o*p;if(0>=m&&0<=l&&0>=p)return i=l/(l-p),t.copy(n).addScaledVector(xn,i);var f=h*p-d*c;if(0>=f&&0<=c-h&&0<=d-p)return bn.subVectors(s,a),i=(c-h)/(c-h+(d-p)),t.copy(a).addScaledVector(bn,i);var v=1/(f+m+u);return r=m*v,i=u*v,t.copy(n).addScaledVector(yn,r).addScaledVector(xn,i)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}var Tn=0;class En extends zr{constructor(){super(),Object.defineProperty(this,"id",{value:Tn++}),this.uuid=jr(),this.name="",this.type="Material",this.fog=!0,this.blending=M,this.side=g,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=U,this.blendDst=z,this.blendEquation=L,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=q,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Er,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=dr,this.stencilZFail=dr,this.stencilZPass=dr,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.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}onBuild(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(var t in e){var r=e[t];if(void 0!==r)if("shading"!=t){var i=this[t];void 0!==i?i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r: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=r===b;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}}toJSON(e){function t(e){var t=[];for(var r in e){var i=e[r];delete i.metadata,t.push(i)}return t}var r=void 0===e||"string"==typeof e;r&&(e={textures:{},images:{}});var i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(i.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==M&&(i.blending=this.blending),this.side!==g&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),1>this.opacity&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),0<this.alphaTest&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(i.wireframe=this.wireframe),1<this.wireframeLinewidth&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(i.morphTargets=!0),!0===this.morphNormals&&(i.morphNormals=!0),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),r){var n=t(e.textures),a=t(e.images);0<n.length&&(i.textures=n),0<a.length&&(i.images=a)}return i}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,r=null;if(null!==t){var i=t.length;r=Array(i);for(var n=0;n!==i;++n)r[n]=t[n].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}En.prototype.isMaterial=!0;var An={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},Ln={h:0,s:0,l:0},Rn={h:0,s:0,l:0};function Cn(e,t,r){return 0>r&&(r+=1),1<r&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+6*(t-e)*(2/3-r):e}function Pn(e){return.04045>e?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function In(e){return.0031308>e?12.92*e:1.055*Math.pow(e,.41666)-.055}class On{constructor(e,t,r){return void 0===t&&void 0===r?this.set(e):this.setRGB(e,t,r)}set(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(255&e>>16)/255,this.g=(255&e>>8)/255,this.b=(255&e)/255,this}setRGB(e,t,r){return this.r=e,this.g=t,this.b=r,this}setHSL(e,t,r){if(e=Zr(e,1),t=Wr(t,0,1),r=Wr(r,0,1),0===t)this.r=this.g=this.b=r;else{var i=.5>=r?r*(1+t):r+t-r*t,n=2*r-i;this.r=Cn(n,i,e+1/3),this.g=Cn(n,i,e),this.b=Cn(n,i,e-1/3)}return this}setStyle(e){function t(t){void 0===t||1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var r;if(r=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){var i,n=r[1],a=r[2];switch(n){case"rgb":case"rgba":if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\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[4]),this;if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\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[4]),this;break;case"hsl":case"hsla":if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){var s=parseFloat(i[1])/360,o=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[4]),this.setHSL(s,o,l)}}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){var h=r[1],c=h.length;if(3===c)return this.r=parseInt(h.charAt(0)+h.charAt(0),16)/255,this.g=parseInt(h.charAt(1)+h.charAt(1),16)/255,this.b=parseInt(h.charAt(2)+h.charAt(2),16)/255,this;if(6===c)return this.r=parseInt(h.charAt(0)+h.charAt(1),16)/255,this.g=parseInt(h.charAt(2)+h.charAt(3),16)/255,this.b=parseInt(h.charAt(4)+h.charAt(5),16)/255,this}return e&&0<e.length?this.setColorName(e):this}setColorName(e){var t=An[e.toLowerCase()];return void 0===t?console.warn("THREE.Color: Unknown color "+e):this.setHex(t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyGammaToLinear(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:2;return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}copyLinearToGamma(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:2,r=0<t?1/t:1;return this.r=Math.pow(e.r,r),this.g=Math.pow(e.g,r),this.b=Math.pow(e.b,r),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.r=Pn(e.r),this.g=Pn(e.g),this.b=Pn(e.b),this}copyLinearToSRGB(e){return this.r=In(e.r),this.g=In(e.g),this.b=In(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){var t,r,i=this.r,n=this.g,a=this.b,s=Math.max(i,n,a),o=Math.min(i,n,a),l=(o+s)/2;if(o===s)t=0,r=0;else{var h=s-o;r=.5>=l?h/(s+o):h/(2-s-o),s===i?t=(n-a)/h+(n<a?6:0):s===n?t=(a-i)/h+2:s===a&&(t=(i-n)/h+4),t/=6}return e.h=t,e.s=r,e.l=l,e}getStyle(){return"rgb("+(0|255*this.r)+","+(0|255*this.g)+","+(0|255*this.b)+")"}offsetHSL(e,t,r){return this.getHSL(Ln),Ln.h+=e,Ln.s+=t,Ln.l+=r,this.setHSL(Ln.h,Ln.s,Ln.l),this}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(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}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(Ln),e.getHSL(Rn);var r=qr(Ln.h,Rn.h,t),i=qr(Ln.s,Rn.s,t),n=qr(Ln.l,Rn.l,t);return this.setHSL(r,i,n),this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(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}toJSON(){return this.getHex()}}On.NAMES=An,On.prototype.isColor=!0,On.prototype.r=1,On.prototype.g=1,On.prototype.b=1;class Dn extends En{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new On(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Q,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this}}Dn.prototype.isMeshBasicMaterial=!0;var Nn=new ci,Bn=new $r;class Un{constructor(e,t,r){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?0:e.length/t,this.normalized=!0===r,this.usage=Ar,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(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(e,t,r){e*=this.itemSize,r*=t.itemSize;for(var i=0,n=this.itemSize;i<n;i++)this.array[e+i]=t.array[r+i];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){for(var t,r=this.array,i=0,n=0,a=e.length;n<a;n++)void 0===(t=e[n])&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",n),t=new On),r[i++]=t.r,r[i++]=t.g,r[i++]=t.b;return this}copyVector2sArray(e){for(var t,r=this.array,i=0,n=0,a=e.length;n<a;n++)void 0===(t=e[n])&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",n),t=new $r),r[i++]=t.x,r[i++]=t.y;return this}copyVector3sArray(e){for(var t,r=this.array,i=0,n=0,a=e.length;n<a;n++)void 0===(t=e[n])&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",n),t=new ci),r[i++]=t.x,r[i++]=t.y,r[i++]=t.z;return this}copyVector4sArray(e){for(var t,r=this.array,i=0,n=0,a=e.length;n<a;n++)void 0===(t=e[n])&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",n),t=new ai),r[i++]=t.x,r[i++]=t.y,r[i++]=t.z,r[i++]=t.w;return this}applyMatrix3(e){if(2===this.itemSize)for(var t=0,r=this.count;t<r;t++)Bn.fromBufferAttribute(this,t),Bn.applyMatrix3(e),this.setXY(t,Bn.x,Bn.y);else if(3===this.itemSize)for(var i=0,n=this.count;i<n;i++)Nn.fromBufferAttribute(this,i),Nn.applyMatrix3(e),this.setXYZ(i,Nn.x,Nn.y,Nn.z);return this}applyMatrix4(e){for(var t=0,r=this.count;t<r;t++)Nn.x=this.getX(t),Nn.y=this.getY(t),Nn.z=this.getZ(t),Nn.applyMatrix4(e),this.setXYZ(t,Nn.x,Nn.y,Nn.z);return this}applyNormalMatrix(e){for(var t=0,r=this.count;t<r;t++)Nn.x=this.getX(t),Nn.y=this.getY(t),Nn.z=this.getZ(t),Nn.applyNormalMatrix(e),this.setXYZ(t,Nn.x,Nn.y,Nn.z);return this}transformDirection(e){for(var t=0,r=this.count;t<r;t++)Nn.x=this.getX(t),Nn.y=this.getY(t),Nn.z=this.getZ(t),Nn.transformDirection(e),this.setXYZ(t,Nn.x,Nn.y,Nn.z);return this}set(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,t,r,i,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=n,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){var e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Ar&&(e.usage=this.usage),(0!==this.updateRange.offset||-1!==this.updateRange.count)&&(e.updateRange=this.updateRange),e}}Un.prototype.isBufferAttribute=!0;class zn extends Un{constructor(e,t,r){super(new Int8Array(e),t,r)}}class Fn extends Un{constructor(e,t,r){super(new Uint8Array(e),t,r)}}class Gn extends Un{constructor(e,t,r){super(new Uint8ClampedArray(e),t,r)}}class Vn extends Un{constructor(e,t,r){super(new Int16Array(e),t,r)}}class Hn extends Un{constructor(e,t,r){super(new Uint16Array(e),t,r)}}class kn extends Un{constructor(e,t,r){super(new Int32Array(e),t,r)}}class jn extends Un{constructor(e,t,r){super(new Uint32Array(e),t,r)}}class Wn extends Un{constructor(e,t,r){super(new Uint16Array(e),t,r)}}Wn.prototype.isFloat16BufferAttribute=!0;class Zn extends Un{constructor(e,t,r){super(new Float32Array(e),t,r)}}class qn extends Un{constructor(e,t,r){super(new Float64Array(e),t,r)}}function Xn(e){if(0===e.length)return-1/0;for(var t=e[0],r=1,i=e.length;r<i;++r)e[r]>t&&(t=e[r]);return t}var Yn={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Jn(e,t){return new Yn[e](t)}var Kn=0,Qn=new Vi,$n=new pn,ea=new ci,ta=new pi,ra=new pi,ia=new ci;class na extends zr{constructor(){super(),Object.defineProperty(this,"id",{value:Kn++}),this.uuid=jr(),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={}}getIndex(){return this.index}setIndex(e){return this.index=Array.isArray(e)?new(65535<Xn(e)?jn:Hn)(e,1):e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){var t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);var r=this.attributes.normal;if(void 0!==r){var i=(new ei).getNormalMatrix(e);r.applyNormalMatrix(i),r.needsUpdate=!0}var n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(e),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return Qn.makeRotationFromQuaternion(e),this.applyMatrix4(Qn),this}rotateX(e){return Qn.makeRotationX(e),this.applyMatrix4(Qn),this}rotateY(e){return Qn.makeRotationY(e),this.applyMatrix4(Qn),this}rotateZ(e){return Qn.makeRotationZ(e),this.applyMatrix4(Qn),this}translate(e,t,r){return Qn.makeTranslation(e,t,r),this.applyMatrix4(Qn),this}scale(e,t,r){return Qn.makeScale(e,t,r),this.applyMatrix4(Qn),this}lookAt(e){return $n.lookAt(e),$n.updateMatrix(),this.applyMatrix4($n.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ea).negate(),this.translate(ea.x,ea.y,ea.z),this}setFromPoints(e){for(var t,r=[],i=0,n=e.length;i<n;i++)t=e[i],r.push(t.x,t.y,t.z||0);return this.setAttribute("position",new Zn(r,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new pi);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 ci(-1/0,-1/0,-1/0),new ci(1/0,1/0,1/0));if(void 0===e)this.boundingBox.makeEmpty();else if(this.boundingBox.setFromBufferAttribute(e),t)for(var r,i=0,n=t.length;i<n;i++)r=t[i],ta.setFromBufferAttribute(r),this.morphTargetsRelative?(ia.addVectors(this.boundingBox.min,ta.min),this.boundingBox.expandByPoint(ia),ia.addVectors(this.boundingBox.max,ta.max),this.boundingBox.expandByPoint(ia)):(this.boundingBox.expandByPoint(ta.min),this.boundingBox.expandByPoint(ta.max));(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(){null===this.boundingSphere&&(this.boundingSphere=new Ii);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 ci,1/0);if(e){var r=this.boundingSphere.center;if(ta.setFromBufferAttribute(e),t)for(var i,n=0,a=t.length;n<a;n++)i=t[n],ra.setFromBufferAttribute(i),this.morphTargetsRelative?(ia.addVectors(ta.min,ra.min),ta.expandByPoint(ia),ia.addVectors(ta.max,ra.max),ta.expandByPoint(ia)):(ta.expandByPoint(ra.min),ta.expandByPoint(ra.max));ta.getCenter(r);for(var s=0,o=0,l=e.count;o<l;o++)ia.fromBufferAttribute(e,o),s=Math.max(s,r.distanceToSquared(ia));if(t)for(var h=0,c=t.length;h<c;h++)for(var u=t[h],d=this.morphTargetsRelative,p=0,m=u.count;p<m;p++)ia.fromBufferAttribute(u,p),d&&(ea.fromBufferAttribute(e,p),ia.add(ea)),s=Math.max(s,r.distanceToSquared(ia));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeFaceNormals(){}computeTangents(){function e(e,t,r){p.fromArray(a,3*e),m.fromArray(a,3*t),f.fromArray(a,3*r),v.fromArray(o,2*e),g.fromArray(o,2*t),y.fromArray(o,2*r),m.sub(p),f.sub(p),g.sub(v),y.sub(v);var i=1/(g.x*y.y-y.x*g.y);isFinite(i)&&(x.copy(m).multiplyScalar(y.y).addScaledVector(f,-g.y).multiplyScalar(i),b.copy(f).multiplyScalar(g.x).addScaledVector(m,-y.x).multiplyScalar(i),c[e].add(x),c[t].add(x),c[r].add(x),u[e].add(b),u[t].add(b),u[r].add(b))}function t(e){C.fromArray(s,3*e),P.copy(C);var t=c[e];L.copy(t),L.sub(C.multiplyScalar(C.dot(t))).normalize(),R.crossVectors(P,t);var r=0>R.dot(u[e])?-1:1;h[4*e]=L.x,h[4*e+1]=L.y,h[4*e+2]=L.z,h[4*e+3]=r}var r=this.index,i=this.attributes;if(null!==r&&void 0!==i.position&&void 0!==i.normal&&void 0!==i.uv){var n=r.array,a=i.position.array,s=i.normal.array,o=i.uv.array,l=a.length/3;void 0===i.tangent&&this.setAttribute("tangent",new Un(new Float32Array(4*l),4));for(var h=i.tangent.array,c=[],u=[],d=0;d<l;d++)c[d]=new ci,u[d]=new ci;var p=new ci,m=new ci,f=new ci,v=new $r,g=new $r,y=new $r,x=new ci,b=new ci,w=this.groups;0===w.length&&(w=[{start:0,count:n.length}]);for(var _=0,M=w.length;_<M;++_)for(var S=w[_],T=S.start,E=T,A=T+S.count;E<A;E+=3)e(n[E+0],n[E+1],n[E+2]);for(var L=new ci,R=new ci,C=new ci,P=new ci,I=0,O=w.length;I<O;++I)for(var D=w[I],N=D.start,B=N,U=N+D.count;B<U;B+=3)t(n[B+0]),t(n[B+1]),t(n[B+2])}else console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)")}computeVertexNormals(){var e=this.index,t=this.getAttribute("position");if(void 0!==t){var r=this.getAttribute("normal");if(void 0===r)r=new Un(new Float32Array(3*t.count),3),this.setAttribute("normal",r);else for(var i=0,n=r.count;i<n;i++)r.setXYZ(i,0,0,0);var a=new ci,s=new ci,o=new ci,l=new ci,h=new ci,c=new ci,u=new ci,d=new ci;if(e)for(var p=0,m=e.count;p<m;p+=3){var f=e.getX(p+0),v=e.getX(p+1),g=e.getX(p+2);a.fromBufferAttribute(t,f),s.fromBufferAttribute(t,v),o.fromBufferAttribute(t,g),u.subVectors(o,s),d.subVectors(a,s),u.cross(d),l.fromBufferAttribute(r,f),h.fromBufferAttribute(r,v),c.fromBufferAttribute(r,g),l.add(u),h.add(u),c.add(u),r.setXYZ(f,l.x,l.y,l.z),r.setXYZ(v,h.x,h.y,h.z),r.setXYZ(g,c.x,c.y,c.z)}else for(var y=0,x=t.count;y<x;y+=3)a.fromBufferAttribute(t,y+0),s.fromBufferAttribute(t,y+1),o.fromBufferAttribute(t,y+2),u.subVectors(o,s),d.subVectors(a,s),u.cross(d),r.setXYZ(y+0,u.x,u.y,u.z),r.setXYZ(y+1,u.x,u.y,u.z),r.setXYZ(y+2,u.x,u.y,u.z);this.normalizeNormals(),r.needsUpdate=!0}}merge(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 r=this.attributes;for(var i in r)if(void 0!==e.attributes[i])for(var n=r[i].array,a=e.attributes[i],s=a.array,o=a.itemSize*t,l=Math.min(s.length,n.length-o),h=0,c=o;h<l;h++,c++)n[c]=s[h];return this}console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e)}normalizeNormals(){for(var e=this.attributes.normal,t=0,r=e.count;t<r;t++)ia.fromBufferAttribute(e,t),ia.normalize(),e.setXYZ(t,ia.x,ia.y,ia.z)}toNonIndexed(){function e(e,t){for(var r=e.array,i=e.itemSize,n=e.normalized,a=new r.constructor(t.length*i),s=0,o=0,l=0,h=t.length;l<h;l++){s=e.isInterleavedBufferAttribute?t[l]*e.data.stride+e.offset:t[l]*i;for(var c=0;c<i;c++)a[o++]=r[s++]}return new Un(a,i,n)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;var t=new na,r=this.index.array,i=this.attributes;for(var n in i){var a=e(i[n],r);t.setAttribute(n,a)}var s=this.morphAttributes;for(var o in s){for(var l=[],h=s[o],c=0,u=h.length;c<u;c++){var d=e(h[c],r);l.push(d)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;for(var p,m=this.groups,f=0,v=m.length;f<v;f++)p=m[f],t.addGroup(p.start,p.count,p.materialIndex);return t}toJSON(){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),0<Object.keys(this.userData).length&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var r in t)void 0!==t[r]&&(e[r]=t[r]);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 n=this.attributes;for(var a in n){var s=n[a];e.data.attributes[a]=s.toJSON(e.data)}var o={},l=!1;for(var h in this.morphAttributes){for(var c,u=this.morphAttributes[h],d=[],p=0,m=u.length;p<m;p++)c=u[p],d.push(c.toJSON(e.data));0<d.length&&(o[h]=d,l=!0)}l&&(e.data.morphAttributes=o,e.data.morphTargetsRelative=this.morphTargetsRelative);var f=this.groups;0<f.length&&(e.data.groups=JSON.parse(JSON.stringify(f)));var v=this.boundingSphere;return null!==v&&(e.data.boundingSphere={center:v.center.toArray(),radius:v.radius}),e}clone(){return(new na).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;var t={};this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone(t));var i=e.attributes;for(var n in i){var a=i[n];this.setAttribute(n,a.clone(t))}var s=e.morphAttributes;for(var o in s){for(var l=[],h=s[o],c=0,u=h.length;c<u;c++)l.push(h[c].clone(t));this.morphAttributes[o]=l}this.morphTargetsRelative=e.morphTargetsRelative;for(var d,p=e.groups,m=0,f=p.length;m<f;m++)d=p[m],this.addGroup(d.start,d.count,d.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(){this.dispatchEvent({type:"dispose"})}}na.prototype.isBufferGeometry=!0;var aa=new Vi,sa=new Gi,oa=new Ii,la=new ci,ha=new ci,ca=new ci,ua=new ci,da=new ci,pa=new ci,ma=new ci,fa=new ci,va=new ci,ga=new $r,ya=new $r,xa=new $r,ba=new ci,wa=new ci;class _a extends pn{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new na,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new Dn;super(),this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(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(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,r=Object.keys(t);if(0<r.length){var i=t[r[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var n,a=0,s=i.length;a<s;a++)n=i[a].name||a+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=a}}}else{var o=e.morphTargets;void 0!==o&&0<o.length&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){var r,i=this.geometry,n=this.material,a=this.matrixWorld;if(void 0!==n&&(null===i.boundingSphere&&i.computeBoundingSphere(),oa.copy(i.boundingSphere),oa.applyMatrix4(a),!1!==e.ray.intersectsSphere(oa))&&(aa.copy(a).invert(),sa.copy(e.ray).applyMatrix4(aa),null===i.boundingBox||!1!==sa.intersectsBox(i.boundingBox)))if(i.isBufferGeometry){var s=i.index,o=i.attributes.position,l=i.morphAttributes.position,h=i.morphTargetsRelative,c=i.attributes.uv,u=i.attributes.uv2,d=i.groups,p=i.drawRange;if(null!==s)if(Array.isArray(n))for(var m=0,f=d.length;m<f;m++)for(var v=d[m],g=n[v.materialIndex],y=Math.max(v.start,p.start),x=Math.min(v.start+v.count,p.start+p.count);y<x;y+=3){var b=s.getX(y),w=s.getX(y+1),_=s.getX(y+2);(r=Ma(this,g,e,sa,o,l,h,c,u,b,w,_))&&(r.faceIndex=Math.floor(y/3),r.face.materialIndex=v.materialIndex,t.push(r))}else for(var M=Math.max(0,p.start),S=Math.min(s.count,p.start+p.count),T=M;T<S;T+=3){var E=s.getX(T),A=s.getX(T+1),L=s.getX(T+2);(r=Ma(this,n,e,sa,o,l,h,c,u,E,A,L))&&(r.faceIndex=Math.floor(T/3),t.push(r))}else if(void 0!==o)if(Array.isArray(n))for(var R=0,C=d.length;R<C;R++)for(var P=d[R],I=n[P.materialIndex],O=Math.max(P.start,p.start),D=Math.min(P.start+P.count,p.start+p.count);O<D;O+=3)(r=Ma(this,I,e,sa,o,l,h,c,u,O,O+1,O+2))&&(r.faceIndex=Math.floor(O/3),r.face.materialIndex=P.materialIndex,t.push(r));else for(var N=Math.max(0,p.start),B=Math.min(o.count,p.start+p.count),U=N;U<B;U+=3)(r=Ma(this,n,e,sa,o,l,h,c,u,U,U+1,U+2))&&(r.faceIndex=Math.floor(U/3),t.push(r))}else i.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function Ma(e,t,r,i,n,a,s,o,l,h,c,u){la.fromBufferAttribute(n,h),ha.fromBufferAttribute(n,c),ca.fromBufferAttribute(n,u);var d=e.morphTargetInfluences;if(t.morphTargets&&a&&d){ma.set(0,0,0),fa.set(0,0,0),va.set(0,0,0);for(var p=0,m=a.length;p<m;p++){var f=d[p],v=a[p];0!==f&&(ua.fromBufferAttribute(v,h),da.fromBufferAttribute(v,c),pa.fromBufferAttribute(v,u),s?(ma.addScaledVector(ua,f),fa.addScaledVector(da,f),va.addScaledVector(pa,f)):(ma.addScaledVector(ua.sub(la),f),fa.addScaledVector(da.sub(ha),f),va.addScaledVector(pa.sub(ca),f)))}la.add(ma),ha.add(fa),ca.add(va)}e.isSkinnedMesh&&(e.boneTransform(h,la),e.boneTransform(c,ha),e.boneTransform(u,ca));var g=function(e,t,r,i,n,a,s,o){if(null===(t.side===y?i.intersectTriangle(s,a,n,!0,o):i.intersectTriangle(n,a,s,t.side!==x,o)))return null;wa.copy(o),wa.applyMatrix4(e.matrixWorld);var l=r.ray.origin.distanceTo(wa);return l<r.near||l>r.far?null:{distance:l,point:wa.clone(),object:e}}(e,t,r,i,la,ha,ca,ba);if(g){o&&(ga.fromBufferAttribute(o,h),ya.fromBufferAttribute(o,c),xa.fromBufferAttribute(o,u),g.uv=Sn.getUV(ba,la,ha,ca,ga,ya,xa,new $r)),l&&(ga.fromBufferAttribute(l,h),ya.fromBufferAttribute(l,c),xa.fromBufferAttribute(l,u),g.uv2=Sn.getUV(ba,la,ha,ca,ga,ya,xa,new $r));var b={a:h,b:c,c:u,normal:new ci,materialIndex:0};Sn.getNormal(la,ha,ca,b.normal),g.face=b}return g}_a.prototype.isMesh=!0;class Sa extends na{constructor(){function e(e,t,r,i,n,a,s,m,f,v,g){for(var y,x=f+1,b=0,w=0,_=new ci,M=0;M<v+1;M++){y=M*(s/v)-s/2;for(var S,T=0;T<x;T++)S=T*(a/f)-a/2,_[e]=S*i,_[t]=y*n,_[r]=m/2,h.push(_.x,_.y,_.z),_[e]=0,_[t]=0,_[r]=0<m?1:-1,c.push(_.x,_.y,_.z),u.push(T/f),u.push(1-M/v),b+=1}for(var E=0;E<v;E++)for(var A=0;A<f;A++){var L=d+A+x*E,R=d+A+x*(E+1),C=d+(A+1)+x*(E+1),P=d+(A+1)+x*E;l.push(L,R,P),l.push(R,C,P),w+=6}o.addGroup(p,w,g),p+=w,d+=b}var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,s=5<arguments.length&&void 0!==arguments[5]?arguments[5]:1;super(),this.type="BoxGeometry",this.parameters={width:t,height:r,depth:i,widthSegments:n,heightSegments:a,depthSegments:s};var o=this;n=Math.floor(n),a=Math.floor(a),s=Math.floor(s);var l=[],h=[],c=[],u=[],d=0,p=0;e("z","y","x",-1,-1,i,r,t,s,a,0),e("z","y","x",1,-1,i,r,-t,s,a,1),e("x","z","y",1,1,t,i,r,n,s,2),e("x","z","y",1,-1,t,i,-r,n,s,3),e("x","y","z",1,-1,t,r,i,n,a,4),e("x","y","z",-1,-1,t,r,-i,n,a,5),this.setIndex(l),this.setAttribute("position",new Zn(h,3)),this.setAttribute("normal",new Zn(c,3)),this.setAttribute("uv",new Zn(u,2))}static fromJSON(e){return new Sa(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Ta(e){var t={};for(var r in e)for(var i in t[r]={},e[r]){var n=e[r][i];t[r][i]=n&&(n.isColor||n.isMatrix3||n.isMatrix4||n.isVector2||n.isVector3||n.isVector4||n.isTexture||n.isQuaternion)?n.clone():Array.isArray(n)?n.slice():n}return t}function Ea(e){for(var t,r={},i=0;i<e.length;i++)for(var n in t=Ta(e[i]))r[n]=t[n];return r}var Aa={clone:Ta,merge:Ea};class La extends En{constructor(e){super(),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.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))}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ta(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){var t=super.toJSON(e);for(var r in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){var i=this.uniforms[r].value;t.uniforms[r]=i&&i.isTexture?{type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?{type:"c",value:i.getHex()}:i&&i.isVector2?{type:"v2",value:i.toArray()}:i&&i.isVector3?{type:"v3",value:i.toArray()}:i&&i.isVector4?{type:"v4",value:i.toArray()}:i&&i.isMatrix3?{type:"m3",value:i.toArray()}:i&&i.isMatrix4?{type:"m4",value:i.toArray()}:{value:i}}0<Object.keys(this.defines).length&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var n={};for(var a in this.extensions)!0===this.extensions[a]&&(n[a]=!0);return 0<Object.keys(n).length&&(t.extensions=n),t}}La.prototype.isShaderMaterial=!0;class Ra extends pn{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Vi,this.projectionMatrix=new Vi,this.projectionMatrixInverse=new Vi}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}Ra.prototype.isCamera=!0;class Ca extends Ra{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:50,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:2e3;super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(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(e){var t=.5*this.getFilmHeight()/e;this.fov=2*kr*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){var e=Math.tan(.5*Hr*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*kr*Math.atan(Math.tan(.5*Hr*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,r,i,n,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=r,this.view.offsetY=i,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){var e=this.near,t=e*Math.tan(.5*Hr*this.fov)/this.zoom,r=2*t,i=this.aspect*r,n=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var s=a.fullWidth,o=a.fullHeight;n+=a.offsetX*i/s,t-=a.offsetY*r/o,i*=a.width/s,r*=a.height/o}var l=this.filmOffset;0!==l&&(n+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(n,n+i,t,t-r,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){var t=super.toJSON(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}}Ca.prototype.isPerspectiveCamera=!0;var Pa=90;class Ia extends pn{constructor(e,t,r){if(super(),this.type="CubeCamera",!0===r.isWebGLCubeRenderTarget){this.renderTarget=r;var i=new Ca(Pa,1,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new ci(1,0,0)),this.add(i);var n=new Ca(Pa,1,e,t);n.layers=this.layers,n.up.set(0,-1,0),n.lookAt(new ci(-1,0,0)),this.add(n);var a=new Ca(Pa,1,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new ci(0,1,0)),this.add(a);var s=new Ca(Pa,1,e,t);s.layers=this.layers,s.up.set(0,0,-1),s.lookAt(new ci(0,-1,0)),this.add(s);var o=new Ca(Pa,1,e,t);o.layers=this.layers,o.up.set(0,-1,0),o.lookAt(new ci(0,0,1)),this.add(o);var l=new Ca(Pa,1,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new ci(0,0,-1)),this.add(l)}else console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.")}update(e,t){null===this.parent&&this.updateMatrixWorld();var r=this.renderTarget,[i,n,a,s,o,l]=this.children,h=e.xr.enabled,c=e.getRenderTarget();e.xr.enabled=!1;var u=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,i),e.setRenderTarget(r,1),e.render(t,n),e.setRenderTarget(r,2),e.render(t,a),e.setRenderTarget(r,3),e.render(t,s),e.setRenderTarget(r,4),e.render(t,o),r.texture.generateMipmaps=u,e.setRenderTarget(r,5),e.render(t,l),e.setRenderTarget(c),e.xr.enabled=h}}class Oa extends ii{constructor(e,t,r,i,n,a,s,o,l,h){super(e=void 0===e?[]:e,t=void 0===t?le:t,r,i,n,a,s=void 0===s?Ge:s,o,l,h),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}Oa.prototype.isCubeTexture=!0;class Da extends si{constructor(e,t,r){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=r),super(e,e,t),t=t||{},this.texture=new Oa(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0===t.minFilter?_e:t.minFilter,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=Ve,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;var r=new Sa(5,5,5),i=new La({name:"CubemapFromEquirect",uniforms:Ta({tEquirect:{value:null}}),vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",side:y,blending:_});i.uniforms.tEquirect.value=t;var n=new _a(r,i),a=t.minFilter;return t.minFilter===Te&&(t.minFilter=_e),new Ia(1,10,this).update(e,n),t.minFilter=a,n.geometry.dispose(),n.material.dispose(),this}clear(e,t,r,i){for(var n=e.getRenderTarget(),a=0;6>a;a++)e.setRenderTarget(this,a),e.clear(t,r,i);e.setRenderTarget(n)}}Da.prototype.isWebGLCubeRenderTarget=!0;var Na=new ci,Ba=new ci,Ua=new ei;class za{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci(1,0,0),t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){var i=Na.subVectors(r,t).cross(Ba.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){var r=e.delta(Na),i=this.normal.dot(r);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;var n=-(e.start.dot(this.normal)+this.constant)/i;return 0>n||1<n?null:t.copy(r).multiplyScalar(n).add(e.start)}intersectsLine(e){var t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return 0>t&&0<r||0>r&&0<t}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){var r=t||Ua.getNormalMatrix(e),i=this.coplanarPoint(Na).applyMatrix4(e),n=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(n),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}za.prototype.isPlane=!0;var Fa=new Ii,Ga=new ci;class Va{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new za,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new za,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new za,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new za,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:new za,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:new za;this.planes=[e,t,r,i,n,a]}set(e,t,r,i,n,a){var s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(r),s[3].copy(i),s[4].copy(n),s[5].copy(a),this}copy(e){for(var t=this.planes,r=0;6>r;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e){var t=this.planes,r=e.elements,i=r[0],n=r[1],a=r[2],s=r[3],o=r[4],l=r[5],h=r[6],c=r[7],u=r[8],d=r[9],p=r[10],m=r[11],f=r[12],v=r[13],g=r[14],y=r[15];return t[0].setComponents(s-i,c-o,m-u,y-f).normalize(),t[1].setComponents(s+i,c+o,m+u,y+f).normalize(),t[2].setComponents(s+n,c+l,m+d,y+v).normalize(),t[3].setComponents(s-n,c-l,m-d,y-v).normalize(),t[4].setComponents(s-a,c-h,m-p,y-g).normalize(),t[5].setComponents(s+a,c+h,m+p,y+g).normalize(),this}intersectsObject(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Fa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Fa)}intersectsSprite(e){return Fa.center.set(0,0,0),Fa.radius=.7071067811865476,Fa.applyMatrix4(e.matrixWorld),this.intersectsSphere(Fa)}intersectsSphere(e){for(var t=this.planes,r=e.center,i=-e.radius,n=0;6>n;n++)if(t[n].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){for(var t,r=this.planes,i=0;6>i;i++)if(t=r[i],Ga.x=0<t.normal.x?e.max.x:e.min.x,Ga.y=0<t.normal.y?e.max.y:e.min.y,Ga.z=0<t.normal.z?e.max.z:e.min.z,0>t.distanceToPoint(Ga))return!1;return!0}containsPoint(e){for(var t=this.planes,r=0;6>r;r++)if(0>t[r].distanceToPoint(e))return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Ha(){function e(r,a){i(r,a),n=t.requestAnimationFrame(e)}var t=null,r=!1,i=null,n=null;return{start:function(){!0===r||null===i||(n=t.requestAnimationFrame(e),r=!0)},stop:function(){t.cancelAnimationFrame(n),r=!1},setAnimationLoop:function(e){i=e},setContext:function(e){t=e}}}function ka(e,t){var r=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 r=i.get(t);r&&(e.deleteBuffer(r.buffer),i.delete(t))},update:function(t,n){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 s=i.get(t);void 0===s?i.set(t,function(t,i){var n=t.array,a=t.usage,s=e.createBuffer();e.bindBuffer(i,s),e.bufferData(i,n,a),t.onUploadCallback();var o=5126;return n instanceof Float32Array?o=5126:n instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):n instanceof Uint16Array?t.isFloat16BufferAttribute?r?o=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):o=5123:n instanceof Int16Array?o=5122:n instanceof Uint32Array?o=5125:n instanceof Int32Array?o=5124:n instanceof Int8Array?o=5120:(n instanceof Uint8Array||n instanceof Uint8ClampedArray)&&(o=5121),{buffer:s,type:o,bytesPerElement:n.BYTES_PER_ELEMENT,version:t.version}}(t,n)):s.version<t.version&&(function(t,i,n){var a=i.array,s=i.updateRange;e.bindBuffer(n,t),-1===s.count?e.bufferSubData(n,0,a):(r?e.bufferSubData(n,s.offset*a.BYTES_PER_ELEMENT,a,s.offset,s.count):e.bufferSubData(n,s.offset*a.BYTES_PER_ELEMENT,a.subarray(s.offset,s.offset+s.count)),s.count=-1)}(s.buffer,t,n),s.version=t.version)}}}}class ja extends na{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:i};for(var n,a=Math.floor(r),s=Math.floor(i),o=a+1,l=[],h=[],c=[],u=[],d=0;d<s+1;d++){n=d*(t/s)-t/2;for(var p,m=0;m<o;m++)p=m*(e/a)-e/2,h.push(p,-n,0),c.push(0,0,1),u.push(m/a),u.push(1-d/s)}for(var f=0;f<s;f++)for(var v=0;v<a;v++){var g=v+o*f,y=v+o*(f+1),x=v+1+o*(f+1),b=v+1+o*f;l.push(g,y,b),l.push(y,x,b)}this.setIndex(l),this.setAttribute("position",new Zn(h,3)),this.setAttribute("normal",new Zn(c,3)),this.setAttribute("uv",new Zn(u,2))}static fromJSON(e){return new ja(e.width,e.height,e.widthSegments,e.heightSegments)}}var Wa={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 dotVH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotVH - 6.98316 ) * dotVH );\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, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat 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:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSNMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition.xyz / vWorldPosition.w;\n\tvec3 v = normalize( cameraPosition - pos );\n\tfloat ior = ( 1.0 + 0.4 * reflectivity ) / ( 1.0 - 0.4 * reflectivity );\n\tvec3 transmission = transmissionFactor * getIBLVolumeRefraction(\n\t\tnormal, v, roughnessFactor, material.diffuseColor, totalSpecular,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec4 vWorldPosition;\n\tvec3 getVolumeTransmissionRay(vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix) {\n\t\tvec3 refractionVector = refract(-v, normalize(n), 1.0 / ior);\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length(vec3(modelMatrix[0].xyz));\n\t\tmodelScale.y = length(vec3(modelMatrix[1].xyz));\n\t\tmodelScale.z = length(vec3(modelMatrix[2].xyz));\n\t\treturn normalize(refractionVector) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness(float roughness, float ior) {\n\t\treturn roughness * clamp(ior * 2.0 - 2.0, 0.0, 1.0);\n\t}\n\tvec3 getTransmissionSample(vec2 fragCoord, float roughness, float ior) {\n\t\tfloat framebufferLod = log2(transmissionSamplerSize.x) * applyIorToRoughness(roughness, ior);\n\t\treturn texture2DLodEXT(transmissionSamplerMap, fragCoord.xy, framebufferLod).rgb;\n\t}\n\tvec3 applyVolumeAttenuation(vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance) {\n\t\tif (attenuationDistance == 0.0) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log(attenuationColor) / attenuationDistance;\n\t\t\tvec3 transmittance = exp(-attenuationCoefficient * transmissionDistance);\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec3 getIBLVolumeRefraction(vec3 n, vec3 v, float perceptualRoughness, vec3 baseColor, vec3 specularColor,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay(n, v, thickness, ior, modelMatrix);\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4(refractedRayExit, 1.0);\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec3 transmittedLight = getTransmissionSample(refractionCoords, perceptualRoughness, ior);\n\t\tvec3 attenuatedColor = applyVolumeAttenuation(transmittedLight, length(transmissionRay), attenuationColor, attenuationDistance);\n\t\treturn (1.0 - specularColor) * attenuatedColor * baseColor;\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_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#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform vec3 attenuationColor;\n\tuniform float attenuationDistance;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <transmission_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define 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#ifdef USE_TRANSMISSION\n\tvarying vec4 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <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#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition;\n#endif\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}"},Za={common:{diffuse:{value:new On(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new ei},uv2Transform:{value:new ei},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 $r(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new On(16777215)}},lights:{ambientLightColor:{value:[]},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 On(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ei}},sprite:{diffuse:{value:new On(16777215)},opacity:{value:1},center:{value:new $r(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ei}}},qa={basic:{uniforms:Ea([Za.common,Za.specularmap,Za.envmap,Za.aomap,Za.lightmap,Za.fog]),vertexShader:Wa.meshbasic_vert,fragmentShader:Wa.meshbasic_frag},lambert:{uniforms:Ea([Za.common,Za.specularmap,Za.envmap,Za.aomap,Za.lightmap,Za.emissivemap,Za.fog,Za.lights,{emissive:{value:new On(0)}}]),vertexShader:Wa.meshlambert_vert,fragmentShader:Wa.meshlambert_frag},phong:{uniforms:Ea([Za.common,Za.specularmap,Za.envmap,Za.aomap,Za.lightmap,Za.emissivemap,Za.bumpmap,Za.normalmap,Za.displacementmap,Za.fog,Za.lights,{emissive:{value:new On(0)},specular:{value:new On(1118481)},shininess:{value:30}}]),vertexShader:Wa.meshphong_vert,fragmentShader:Wa.meshphong_frag},standard:{uniforms:Ea([Za.common,Za.envmap,Za.aomap,Za.lightmap,Za.emissivemap,Za.bumpmap,Za.normalmap,Za.displacementmap,Za.roughnessmap,Za.metalnessmap,Za.fog,Za.lights,{emissive:{value:new On(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Wa.meshphysical_vert,fragmentShader:Wa.meshphysical_frag},toon:{uniforms:Ea([Za.common,Za.aomap,Za.lightmap,Za.emissivemap,Za.bumpmap,Za.normalmap,Za.displacementmap,Za.gradientmap,Za.fog,Za.lights,{emissive:{value:new On(0)}}]),vertexShader:Wa.meshtoon_vert,fragmentShader:Wa.meshtoon_frag},matcap:{uniforms:Ea([Za.common,Za.bumpmap,Za.normalmap,Za.displacementmap,Za.fog,{matcap:{value:null}}]),vertexShader:Wa.meshmatcap_vert,fragmentShader:Wa.meshmatcap_frag},points:{uniforms:Ea([Za.points,Za.fog]),vertexShader:Wa.points_vert,fragmentShader:Wa.points_frag},dashed:{uniforms:Ea([Za.common,Za.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Wa.linedashed_vert,fragmentShader:Wa.linedashed_frag},depth:{uniforms:Ea([Za.common,Za.displacementmap]),vertexShader:Wa.depth_vert,fragmentShader:Wa.depth_frag},normal:{uniforms:Ea([Za.common,Za.bumpmap,Za.normalmap,Za.displacementmap,{opacity:{value:1}}]),vertexShader:Wa.normal_vert,fragmentShader:Wa.normal_frag},sprite:{uniforms:Ea([Za.sprite,Za.fog]),vertexShader:Wa.sprite_vert,fragmentShader:Wa.sprite_frag},background:{uniforms:{uvTransform:{value:new ei},t2D:{value:null}},vertexShader:Wa.background_vert,fragmentShader:Wa.background_frag},cube:{uniforms:Ea([Za.envmap,{opacity:{value:1}}]),vertexShader:Wa.cube_vert,fragmentShader:Wa.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Wa.equirect_vert,fragmentShader:Wa.equirect_frag},distanceRGBA:{uniforms:Ea([Za.common,Za.displacementmap,{referencePosition:{value:new ci},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Wa.distanceRGBA_vert,fragmentShader:Wa.distanceRGBA_frag},shadow:{uniforms:Ea([Za.lights,Za.fog,{color:{value:new On(0)},opacity:{value:1}}]),vertexShader:Wa.shadow_vert,fragmentShader:Wa.shadow_frag}};function Xa(e,t,r,i,n){function a(e,t){r.buffers.color.setClear(e.r,e.g,e.b,t,n)}var s,o,l=new On(0),h=0,c=null,u=0,d=null;return{getClearColor:function(){return l},setClearColor:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;l.set(e),a(l,h=t)},getClearAlpha:function(){return h},setClearAlpha:function(e){a(l,h=e)},render:function(r,n){var p=!1,m=!0===n.isScene?n.background:null;m&&m.isTexture&&(m=t.get(m));var f=e.xr,v=f.getSession&&f.getSession();v&&"additive"===v.environmentBlendMode&&(m=null),null===m?a(l,h):m&&m.isColor&&(a(m,1),p=!0),(e.autoClear||p)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.mapping===de)?(void 0===o&&((o=new _a(new Sa(1,1,1),new La({name:"BackgroundCubeMaterial",uniforms:Ta(qa.cube.uniforms),vertexShader:qa.cube.vertexShader,fragmentShader:qa.cube.fragmentShader,side:y,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),o.geometry.deleteAttribute("uv"),o.onBeforeRender=function(e,t,r){this.matrixWorld.copyPosition(r.matrixWorld)},Object.defineProperty(o.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(o)),o.material.uniforms.envMap.value=m,o.material.uniforms.flipEnvMap.value=m.isCubeTexture&&m._needsFlipEnvMap?-1:1,(c!==m||u!==m.version||d!==e.toneMapping)&&(o.material.needsUpdate=!0,c=m,u=m.version,d=e.toneMapping),r.unshift(o,o.geometry,o.material,0,0,null)):m&&m.isTexture&&(void 0===s&&((s=new _a(new ja(2,2),new La({name:"BackgroundMaterial",uniforms:Ta(qa.background.uniforms),vertexShader:qa.background.vertexShader,fragmentShader:qa.background.fragmentShader,side:g,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(s)),s.material.uniforms.t2D.value=m,!0===m.matrixAutoUpdate&&m.updateMatrix(),s.material.uniforms.uvTransform.value.copy(m.matrix),(c!==m||u!==m.version||d!==e.toneMapping)&&(s.material.needsUpdate=!0,c=m,u=m.version,d=e.toneMapping),r.unshift(s,s.geometry,s.material,0,0,null))}}}function Ya(e,t,r,i){function n(t){return i.isWebGL2?e.bindVertexArray(t):f.bindVertexArrayOES(t)}function a(t){return i.isWebGL2?e.deleteVertexArray(t):f.deleteVertexArrayOES(t)}function s(e){for(var t=[],r=[],i=[],n=0;n<m;n++)t[n]=0,r[n]=0,i[n]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:i,object:e,attributes:{},index:null}}function o(){for(var e=x.newAttributes,t=0,r=e.length;t<r;t++)e[t]=0}function l(e){h(e,0)}function h(r,n){var a=x.newAttributes,s=x.enabledAttributes,o=x.attributeDivisors;a[r]=1,0===s[r]&&(e.enableVertexAttribArray(r),s[r]=1),o[r]!==n&&((i.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](r,n),o[r]=n)}function c(){for(var t=x.newAttributes,r=x.enabledAttributes,i=0,n=r.length;i<n;i++)r[i]!==t[i]&&(e.disableVertexAttribArray(i),r[i]=0)}function u(t,r,n,a,s,o){!0!==i.isWebGL2||5124!==n&&5125!==n?e.vertexAttribPointer(t,r,n,a,s,o):e.vertexAttribIPointer(t,r,n,s,o)}function d(){p(),x===y||n((x=y).object)}function p(){y.geometry=null,y.program=null,y.wireframe=!1}var m=e.getParameter(34921),f=i.isWebGL2?null:t.get("OES_vertex_array_object"),v=i.isWebGL2||null!==f,g={},y=s(null),x=y;return{setup:function(a,d,p,m,y){var b=!1;if(v){var w=function(t,r,n){var a=!0===n.wireframe,o=g[t.id];void 0===o&&(o={},g[t.id]=o);var l=o[r.id];void 0===l&&(l={},o[r.id]=l);var h=l[a];return void 0===h&&(h=s(i.isWebGL2?e.createVertexArray():f.createVertexArrayOES()),l[a]=h),h}(m,p,d);x!==w&&n((x=w).object),b=function(e,t){var r=x.attributes,i=e.attributes,n=0;for(var a in i){var s=r[a],o=i[a];if(void 0===s)return!0;if(s.attribute!==o)return!0;if(s.data!==o.data)return!0;n++}return x.attributesNum!==n||x.index!==t}(m,y),b&&function(e,t){var r={},i=e.attributes,n=0;for(var a in i){var s=i[a],o={};o.attribute=s,s.data&&(o.data=s.data),r[a]=o,n++}x.attributes=r,x.attributesNum=n,x.index=t}(m,y)}else{var _=!0===d.wireframe;(x.geometry!==m.id||x.program!==p.id||x.wireframe!==_)&&(x.geometry=m.id,x.program=p.id,x.wireframe=_,b=!0)}!0===a.isInstancedMesh&&(b=!0),null!==y&&r.update(y,34963),b&&(function(n,a,s,d){if(!1!==i.isWebGL2||!n.isInstancedMesh&&!d.isInstancedBufferGeometry||null!==t.get("ANGLE_instanced_arrays")){o();var p=d.attributes,m=s.getAttributes(),f=a.defaultAttributeValues;for(var v in m){var g=m[v];if(0<=g){var y=p[v];if(void 0!==y){var x=y.normalized,b=y.itemSize,w=r.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?(h(g,T.meshPerAttribute),void 0===d._maxInstanceCount&&(d._maxInstanceCount=T.meshPerAttribute*T.count)):l(g),e.bindBuffer(34962,_),u(g,b,M,x,E*S,A*S)}else y.isInstancedBufferAttribute?(h(g,y.meshPerAttribute),void 0===d._maxInstanceCount&&(d._maxInstanceCount=y.meshPerAttribute*y.count)):l(g),e.bindBuffer(34962,_),u(g,b,M,x,0,0)}else if("instanceMatrix"===v){var L=r.get(n.instanceMatrix);if(void 0===L)continue;var R=L.buffer,C=L.type;h(g+0,1),h(g+1,1),h(g+2,1),h(g+3,1),e.bindBuffer(34962,R),e.vertexAttribPointer(g+0,4,C,!1,64,0),e.vertexAttribPointer(g+1,4,C,!1,64,16),e.vertexAttribPointer(g+2,4,C,!1,64,32),e.vertexAttribPointer(g+3,4,C,!1,64,48)}else if("instanceColor"===v){var P=r.get(n.instanceColor);if(void 0===P)continue;var I=P.buffer,O=P.type;h(g,1),e.bindBuffer(34962,I),e.vertexAttribPointer(g,3,O,!1,12,0)}else if(void 0!==f){var D=f[v];if(void 0!==D)switch(D.length){case 2:e.vertexAttrib2fv(g,D);break;case 3:e.vertexAttrib3fv(g,D);break;case 4:e.vertexAttrib4fv(g,D);break;default:e.vertexAttrib1fv(g,D)}}}}c()}}(a,d,p,m),null!==y&&e.bindBuffer(34963,r.get(y).buffer))},reset:d,resetDefaultState:p,dispose:function(){for(var e in d(),g){var t=g[e];for(var r in t){var i=t[r];for(var n in i)a(i[n].object),delete i[n];delete t[r]}delete g[e]}},releaseStatesOfGeometry:function(e){if(void 0!==g[e.id]){var t=g[e.id];for(var r in t){var i=t[r];for(var n in i)a(i[n].object),delete i[n];delete t[r]}delete g[e.id]}},releaseStatesOfProgram:function(e){for(var t in g){var r=g[t];if(void 0!==r[e.id]){var i=r[e.id];for(var n in i)a(i[n].object),delete i[n];delete r[e.id]}}},initAttributes:o,enableAttribute:l,disableUnusedAttributes:c}}function Ja(e,t,r,i){var n,a=i.isWebGL2;this.setMode=function(e){n=e},this.render=function(t,i){e.drawArrays(n,t,i),r.update(i,n,1)},this.renderInstances=function(i,s,o){if(0!==o){var l,h;if(a)l=e,h="drawArraysInstanced";else if(h="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[h](n,i,s,o),r.update(s,n,o)}}}function Ka(e,t,r){function i(t){if("highp"===t){if(0<e.getShaderPrecisionFormat(35633,36338).precision&&0<e.getShaderPrecisionFormat(35632,36338).precision)return"highp";t="mediump"}return"mediump"===t&&0<e.getShaderPrecisionFormat(35633,36337).precision&&0<e.getShaderPrecisionFormat(35632,36337).precision?"mediump":"lowp"}var n,a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,s=void 0===r.precision?"highp":r.precision,o=i(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);var l=a||t.has("WEBGL_draw_buffers"),h=!0===r.logarithmicDepthBuffer,c=e.getParameter(34930),u=e.getParameter(35660),d=e.getParameter(3379),p=e.getParameter(34076),m=e.getParameter(34921),f=e.getParameter(36347),v=e.getParameter(36348),g=e.getParameter(36349),y=0<u,x=a||t.has("OES_texture_float");return{isWebGL2:a,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===t.has("EXT_texture_filter_anisotropic")){var r=t.get("EXT_texture_filter_anisotropic");n=e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:i,precision:s,logarithmicDepthBuffer:h,maxTextures:c,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:v,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:a?e.getParameter(36183):0}}function Qa(e){function t(){c.value!==n&&(c.value=n,c.needsUpdate=0<a),i.numPlanes=a,i.numIntersection=0}function r(e,t,r,n){var a=null===e?0:e.length,s=null;if(0!==a){if(s=c.value,!0!==n||null===s){var o=r+4*a,u=t.matrixWorldInverse;h.getNormalMatrix(u),(null===s||s.length<o)&&(s=new Float32Array(o));for(var d=0,p=r;d!==a;++d,p+=4)l.copy(e[d]).applyMatrix4(u,h),l.normal.toArray(s,p),s[p+3]=l.constant}c.value=s,c.needsUpdate=!0}return i.numPlanes=a,i.numIntersection=0,s}var i=this,n=null,a=0,s=!1,o=!1,l=new za,h=new ei,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t,i){var o=0!==e.length||t||0!==a||s;return s=t,n=r(e,i,0),a=e.length,o},this.beginShadows=function(){o=!0,r(null)},this.endShadows=function(){o=!1,t()},this.setState=function(i,l,h){var u=i.clippingPlanes,d=i.clipIntersection,p=i.clipShadows,m=e.get(i);if(!s||null===u||0===u.length||o&&!p)o?r(null):t();else{var f=o?0:a,v=4*f,g=m.clippingState||null;c.value=g,g=r(u,l,v,h);for(var y=0;y!=v;++y)g[y]=n[y];m.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=f}}}function $a(e){function t(e,t){return t===ce?e.mapping=le:t===ue&&(e.mapping=he),e}function r(e){var t=e.target;t.removeEventListener("dispose",r);var n=i.get(t);void 0!==n&&(i.delete(t),n.dispose())}var i=new WeakMap;return{get:function(n){if(n&&n.isTexture){var a=n.mapping;if(a===ce||a===ue){if(i.has(n))return t(i.get(n).texture,n.mapping);var s=n.image;if(s&&0<s.height){var o=e.getRenderTarget(),l=new Da(s.height/2);return l.fromEquirectangularTexture(e,n),i.set(n,l),e.setRenderTarget(o),n.addEventListener("dispose",r),t(l.texture,n.mapping)}return null}}return n},dispose:function(){i=new WeakMap}}}function es(e){function t(t){return void 0!==r[t]?r[t]:(i="WEBGL_depth_texture"===t?e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture"):"EXT_texture_filter_anisotropic"===t?e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"):"WEBGL_compressed_texture_s3tc"===t?e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"):"WEBGL_compressed_texture_pvrtc"===t?e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"):e.getExtension(t),r[t]=i,i);var i}var r={};return{has:function(e){return null!==t(e)},init:function(e){e.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float")},get:function(e){var r=t(e);return null===r&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),r}}}function ts(e,t,r,i){function n(e){var a=e.target;for(var l in null!==a.index&&t.remove(a.index),a.attributes)t.remove(a.attributes[l]);a.removeEventListener("dispose",n),delete s[a.id];var h=o.get(a);h&&(t.remove(h),o.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,r.memory.geometries--}function a(e){var r=[],i=e.index,n=e.attributes.position,a=0;if(null!==i){var s=i.array;a=i.version;for(var l=0,h=s.length;l<h;l+=3){var c=s[l+0],u=s[l+1],d=s[l+2];r.push(c,u,u,d,d,c)}}else{var p=n.array;a=n.version;for(var m=0,f=p.length/3-1;m<f;m+=3){var v=m+0,g=m+1,y=m+2;r.push(v,g,g,y,y,v)}}var x=new(65535<Xn(r)?jn:Hn)(r,1);x.version=a;var b=o.get(e);b&&t.remove(b),o.set(e,x)}var s={},o=new WeakMap;return{get:function(e,t){return!0===s[t.id]||(t.addEventListener("dispose",n),s[t.id]=!0,r.memory.geometries++),t},update:function(e){var r=e.attributes;for(var i in r)t.update(r[i],34962);var n=e.morphAttributes;for(var a in n)for(var s=n[a],o=0,l=s.length;o<l;o++)t.update(s[o],34962)},getWireframeAttribute:function(e){var t=o.get(e);if(t){var r=e.index;null!==r&&t.version<r.version&&a(e)}else a(e);return o.get(e)}}}function rs(e,t,r,i){var n,a,s,o=i.isWebGL2;this.setMode=function(e){n=e},this.setIndex=function(e){a=e.type,s=e.bytesPerElement},this.render=function(t,i){e.drawElements(n,i,a,t*s),r.update(i,n,1)},this.renderInstances=function(i,l,h){if(0!==h){var c,u;if(o)c=e,u="drawElementsInstanced";else if(u="drawElementsInstancedANGLE",null===(c=t.get("ANGLE_instanced_arrays")))return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[u](n,l,a,i*s,h),r.update(l,n,h)}}}function is(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,r,i){switch(t.calls++,r){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:",r)}}}}function ns(e,t){return e[0]-t[0]}function as(e,t){return Math.abs(t[1])-Math.abs(e[1])}function ss(e){for(var t={},r=new Float32Array(8),i=[],n=0;8>n;n++)i[n]=[n,0];return{update:function(n,a,s,o){var l=n.morphTargetInfluences,h=void 0===l?0:l.length,c=t[a.id];if(void 0===c||c.length!==h){c=[];for(var u=0;u<h;u++)c[u]=[u,0];t[a.id]=c}for(var d,p=0;p<h;p++)(d=c[p])[0]=p,d[1]=l[p];c.sort(as);for(var m=0;8>m;m++)m<h&&c[m][1]?(i[m][0]=c[m][0],i[m][1]=c[m][1]):(i[m][0]=Number.MAX_SAFE_INTEGER,i[m][1]=0);i.sort(ns);for(var f=s.morphTargets&&a.morphAttributes.position,v=s.morphNormals&&a.morphAttributes.normal,g=0,y=0;8>y;y++){var x=i[y],b=x[0],w=x[1];b!==Number.MAX_SAFE_INTEGER&&w?(f&&a.getAttribute("morphTarget"+y)!==f[b]&&a.setAttribute("morphTarget"+y,f[b]),v&&a.getAttribute("morphNormal"+y)!==v[b]&&a.setAttribute("morphNormal"+y,v[b]),r[y]=w,g+=w):(f&&!0===a.hasAttribute("morphTarget"+y)&&a.deleteAttribute("morphTarget"+y),v&&!0===a.hasAttribute("morphNormal"+y)&&a.deleteAttribute("morphNormal"+y),r[y]=0)}var _=a.morphTargetsRelative?1:1-g;o.getUniforms().setValue(e,"morphTargetBaseInfluence",_),o.getUniforms().setValue(e,"morphTargetInfluences",r)}}}function os(e,t,r,i){function n(e){var t=e.target;t.removeEventListener("dispose",n),r.remove(t.instanceMatrix),null!==t.instanceColor&&r.remove(t.instanceColor)}var a=new WeakMap;return{update:function(e){var s=i.render.frame,o=e.geometry,l=t.get(e,o);return a.get(l)!==s&&(t.update(l),a.set(l,s)),e.isInstancedMesh&&(!1===e.hasEventListener("dispose",n)&&e.addEventListener("dispose",n),r.update(e.instanceMatrix,34962),null!==e.instanceColor&&r.update(e.instanceColor,34962)),l},dispose:function(){a=new WeakMap}}}qa.physical={uniforms:Ea([qa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new $r(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new On(0)},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new $r},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new On(0)}}]),vertexShader:Wa.meshphysical_vert,fragmentShader:Wa.meshphysical_frag};class ls extends ii{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;super(null),this.image={data:e,width:t,height:r,depth:i},this.magFilter=ge,this.minFilter=ge,this.wrapR=fe,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}ls.prototype.isDataTexture2DArray=!0;class hs extends ii{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;super(null),this.image={data:e,width:t,height:r,depth:i},this.magFilter=ge,this.minFilter=ge,this.wrapR=fe,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}hs.prototype.isDataTexture3D=!0;var cs=new ii,us=new ls,ds=new hs,ps=new Oa,ms=[],fs=[],vs=new Float32Array(16),gs=new Float32Array(9),ys=new Float32Array(4);function xs(e,t,r){var i=e[0];if(0>=i||0<i)return e;var n=t*r,a=ms[n];if(void 0===a&&(a=new Float32Array(n),ms[n]=a),0!==t){i.toArray(a,0);for(var s=1,o=0;s!==t;++s)o+=r,e[s].toArray(a,o)}return a}function bs(e,t){if(e.length!==t.length)return!1;for(var r=0,i=e.length;r<i;r++)if(e[r]!==t[r])return!1;return!0}function ws(e,t){for(var r=0,i=t.length;r<i;r++)e[r]=t[r]}function _s(e,t){var r=fs[t];void 0===r&&(r=new Int32Array(t),fs[t]=r);for(var i=0;i!==t;++i)r[i]=e.allocateTextureUnit();return r}function Ms(e,t){var r=this.cache;r[0]===t||(e.uniform1f(this.addr,t),r[0]=t)}function Ss(e,t){var r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(bs(r,t))return;e.uniform2fv(this.addr,t),ws(r,t)}}function Ts(e,t){var r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else if(void 0!==t.r)(r[0]!==t.r||r[1]!==t.g||r[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),r[0]=t.r,r[1]=t.g,r[2]=t.b);else{if(bs(r,t))return;e.uniform3fv(this.addr,t),ws(r,t)}}function Es(e,t){var r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(bs(r,t))return;e.uniform4fv(this.addr,t),ws(r,t)}}function As(e,t){var r=this.cache,i=t.elements;if(void 0===i){if(bs(r,t))return;e.uniformMatrix2fv(this.addr,!1,t),ws(r,t)}else{if(bs(r,i))return;ys.set(i),e.uniformMatrix2fv(this.addr,!1,ys),ws(r,i)}}function Ls(e,t){var r=this.cache,i=t.elements;if(void 0===i){if(bs(r,t))return;e.uniformMatrix3fv(this.addr,!1,t),ws(r,t)}else{if(bs(r,i))return;gs.set(i),e.uniformMatrix3fv(this.addr,!1,gs),ws(r,i)}}function Rs(e,t){var r=this.cache,i=t.elements;if(void 0===i){if(bs(r,t))return;e.uniformMatrix4fv(this.addr,!1,t),ws(r,t)}else{if(bs(r,i))return;vs.set(i),e.uniformMatrix4fv(this.addr,!1,vs),ws(r,i)}}function Cs(e,t){var r=this.cache;r[0]===t||(e.uniform1i(this.addr,t),r[0]=t)}function Ps(e,t){var r=this.cache;bs(r,t)||(e.uniform2iv(this.addr,t),ws(r,t))}function Is(e,t){var r=this.cache;bs(r,t)||(e.uniform3iv(this.addr,t),ws(r,t))}function Os(e,t){var r=this.cache;bs(r,t)||(e.uniform4iv(this.addr,t),ws(r,t))}function Ds(e,t){var r=this.cache;r[0]===t||(e.uniform1ui(this.addr,t),r[0]=t)}function Ns(e,t){var r=this.cache;bs(r,t)||(e.uniform2uiv(this.addr,t),ws(r,t))}function Bs(e,t){var r=this.cache;bs(r,t)||(e.uniform3uiv(this.addr,t),ws(r,t))}function Us(e,t){var r=this.cache;bs(r,t)||(e.uniform4uiv(this.addr,t),ws(r,t))}function zs(e,t,r){var i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.safeSetTexture2D(t||cs,n)}function Fs(e,t,r){var i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.setTexture3D(t||ds,n)}function Gs(e,t,r){var i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.safeSetTextureCube(t||ps,n)}function Vs(e,t,r){var i=this.cache,n=r.allocateTextureUnit();i[0]!==n&&(e.uniform1i(this.addr,n),i[0]=n),r.setTexture2DArray(t||us,n)}function Hs(e,t){e.uniform1fv(this.addr,t)}function ks(e,t){var r=xs(t,this.size,2);e.uniform2fv(this.addr,r)}function js(e,t){var r=xs(t,this.size,3);e.uniform3fv(this.addr,r)}function Ws(e,t){var r=xs(t,this.size,4);e.uniform4fv(this.addr,r)}function Zs(e,t){var r=xs(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,r)}function qs(e,t){var r=xs(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,r)}function Xs(e,t){var r=xs(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,r)}function Ys(e,t){e.uniform1iv(this.addr,t)}function Js(e,t){e.uniform2iv(this.addr,t)}function Ks(e,t){e.uniform3iv(this.addr,t)}function Qs(e,t){e.uniform4iv(this.addr,t)}function $s(e,t){e.uniform1uiv(this.addr,t)}function eo(e,t){e.uniform2uiv(this.addr,t)}function to(e,t){e.uniform3uiv(this.addr,t)}function ro(e,t){e.uniform4uiv(this.addr,t)}function io(e,t,r){var i=t.length,n=_s(r,i);e.uniform1iv(this.addr,n);for(var a=0;a!==i;++a)r.safeSetTexture2D(t[a]||cs,n[a])}function no(e,t,r){var i=t.length,n=_s(r,i);e.uniform1iv(this.addr,n);for(var a=0;a!==i;++a)r.safeSetTextureCube(t[a]||ps,n[a])}function ao(e,t,r){var i;this.id=e,this.addr=r,this.cache=[],this.setValue=5126===(i=t.type)?Ms:35664===i?Ss:35665===i?Ts:35666===i?Es:35674===i?As:35675===i?Ls:35676===i?Rs:5124===i||35670===i?Cs:35667===i||35671===i?Ps:35668===i||35672===i?Is:35669===i||35673===i?Os:5125===i?Ds:36294===i?Ns:36295===i?Bs:36296===i?Us:35678===i||36198===i||36298===i||36306===i||35682===i?zs:35679===i||36299===i||36307===i?Fs:35680===i||36300===i||36308===i||36293===i?Gs:36289===i||36303===i||36311===i||36292===i?Vs:void 0}function so(e,t,r){var i;this.id=e,this.addr=r,this.cache=[],this.size=t.size,this.setValue=5126===(i=t.type)?Hs:35664===i?ks:35665===i?js:35666===i?Ws:35674===i?Zs:35675===i?qs:35676===i?Xs:5124===i||35670===i?Ys:35667===i||35671===i?Js:35668===i||35672===i?Ks:35669===i||35673===i?Qs:5125===i?$s:36294===i?eo:36295===i?to:36296===i?ro:35678===i||36198===i||36298===i||36306===i||35682===i?io:35680===i||36300===i||36308===i||36293===i?no:void 0}function oo(e){this.id=e,this.seq=[],this.map={}}so.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),ws(t,e)},oo.prototype.setValue=function(e,t,r){for(var i,n=this.seq,a=0,s=n.length;a!==s;++a)(i=n[a]).setValue(e,t[i.id],r)};var lo=/(\w+)(\])?(\[|\.)?/g;function ho(e,t){e.seq.push(t),e.map[t.id]=t}function co(e,t,r){var i=e.name,n=i.length;for(lo.lastIndex=0;;){var a=lo.exec(i),s=lo.lastIndex,o=a[1],l="]"===a[2],h=a[3];if(l&&(o|=0),void 0===h||"["===h&&s+2===n){ho(r,void 0===h?new ao(o,e,t):new so(o,e,t));break}var c=r.map[o];void 0===c&&ho(r,c=new oo(o)),r=c}}function uo(e,t){this.seq=[],this.map={};for(var r=e.getProgramParameter(t,35718),i=0;i<r;++i){var n=e.getActiveUniform(t,i);co(n,e.getUniformLocation(t,n.name),this)}}function po(e,t,r){var i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),i}uo.prototype.setValue=function(e,t,r,i){var n=this.map[t];void 0!==n&&n.setValue(e,r,i)},uo.prototype.setOptional=function(e,t,r){var i=t[r];void 0!==i&&this.setValue(e,r,i)},uo.upload=function(e,t,r,i){for(var n=0,a=t.length;n!==a;++n){var s=t[n],o=r[s.id];!1!==o.needsUpdate&&s.setValue(e,o.value,i)}},uo.seqWithValue=function(e,t){for(var r,i=[],n=0,a=e.length;n!==a;++n)(r=e[n]).id in t&&i.push(r);return i};var mo=0;function fo(e){return e===$t?["Linear","( value )"]:e===er?["sRGB","( value )"]:e===rr?["RGBE","( value )"]:e===nr?["RGBM","( value, 7.0 )"]:e===ar?["RGBM","( value, 16.0 )"]:e===sr?["RGBD","( value, 256.0 )"]:e===tr?["Gamma","( value, float( GAMMA_FACTOR ) )"]:e===ir?["LogLuv","( value )"]:(console.warn("THREE.WebGLProgram: Unsupported encoding:",e),["Linear","( value )"])}function vo(e,t,r){var i=e.getShaderParameter(t,35713),n=e.getShaderInfoLog(t).trim();return i&&""===n?"":"THREE.WebGLShader: gl.getShaderInfoLog() "+r+"\n"+n+function(e){for(var t=e.split("\n"),r=0;r<t.length;r++)t[r]=r+1+": "+t[r];return t.join("\n")}(e.getShaderSource(t))}function go(e,t){var r=fo(t);return"vec4 "+e+"( vec4 value ) { return "+r[0]+"ToLinear"+r[1]+"; }"}function yo(e,t){var r=fo(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+r[0]+r[1]+"; }"}function xo(e){return""!==e}function bo(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 wo(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var _o=/^[ \t]*#include +<([\w\d./]+)>/gm;function Mo(e){return e.replace(_o,So)}function So(e,t){var r=Wa[t];if(void 0===r)throw new Error("Can not resolve #include <"+t+">");return Mo(r)}var To=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Eo=/#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 Ao(e){return e.replace(Eo,Ro).replace(To,Lo)}function Lo(e,t,r,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Ro(0,t,r,i)}function Ro(e,t,r,i){for(var n="",a=parseInt(t);a<parseInt(r);a++)n+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return n}function Co(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 Po(e,t,r,i){var n,a,s,o,l=e.getContext(),h=r.defines,c=r.vertexShader,u=r.fragmentShader,d=function(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===m?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===f?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===v&&(t="SHADOWMAP_TYPE_VSM"),t}(r),p=function(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case le:case he:t="ENVMAP_TYPE_CUBE";break;case de:case pe:t="ENVMAP_TYPE_CUBE_UV"}return t}(r),g=function(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case he:case pe:t="ENVMAP_MODE_REFRACTION"}return t}(r),y=function(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case Q:t="ENVMAP_BLENDING_MULTIPLY";break;case $:t="ENVMAP_BLENDING_MIX";break;case ee:t="ENVMAP_BLENDING_ADD"}return t}(r),x=0<e.gammaFactor?e.gammaFactor:1,b=r.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||0<e.transmission)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(xo).join("\n")}(r),w=function(e){var t=[];for(var r in e){var i=e[r];!1!==i&&t.push("#define "+r+" "+i)}return t.join("\n")}(h),_=l.createProgram(),M=r.glslVersion?"#version "+r.glslVersion+"\n":"";r.isRawShaderMaterial?(0<(n=[w].filter(xo).join("\n")).length&&(n+="\n"),0<(a=[b,w].filter(xo).join("\n")).length&&(a+="\n")):(n=[Co(r),"#define SHADER_NAME "+r.shaderName,w,r.instancing?"#define USE_INSTANCING":"",r.instancingColor?"#define USE_INSTANCING_COLOR":"",r.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+x,"#define MAX_BONES "+r.maxBones,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+g:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMap&&r.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",r.normalMap&&r.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.displacementMap&&r.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.vertexTangents?"#define USE_TANGENT":"",r.vertexColors?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUvs?"#define USE_UV":"",r.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.useVertexTexture?"#define BONE_TEXTURE":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+d:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#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(xo).join("\n"),a=[b,Co(r),"#define SHADER_NAME "+r.shaderName,w,r.alphaTest?"#define ALPHATEST "+r.alphaTest+(r.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+x,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.matcap?"#define USE_MATCAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+p:"",r.envMap?"#define "+g:"",r.envMap?"#define "+y:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMap&&r.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",r.normalMap&&r.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.sheen?"#define USE_SHEEN":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.vertexTangents?"#define USE_TANGENT":"",r.vertexColors||r.instancingColor?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUvs?"#define USE_UV":"",r.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+d:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(r.extensionShaderTextureLOD||r.envMap)&&r.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",r.toneMapping===te?"":"#define TONE_MAPPING",r.toneMapping===te?"":Wa.tonemapping_pars_fragment,r.toneMapping===te?"":("toneMapping",s=r.toneMapping,s===re?o="Linear":s===ie?o="Reinhard":s===ne?o="OptimizedCineon":s===ae?o="ACESFilmic":s===se?o="Custom":(console.warn("THREE.WebGLProgram: Unsupported toneMapping:",s),o="Linear"),"vec3 toneMapping( vec3 color ) { return "+o+"ToneMapping( color ); }"),r.dithering?"#define DITHERING":"",Wa.encodings_pars_fragment,r.map?go("mapTexelToLinear",r.mapEncoding):"",r.matcap?go("matcapTexelToLinear",r.matcapEncoding):"",r.envMap?go("envMapTexelToLinear",r.envMapEncoding):"",r.emissiveMap?go("emissiveMapTexelToLinear",r.emissiveMapEncoding):"",r.lightMap?go("lightMapTexelToLinear",r.lightMapEncoding):"",yo("linearToOutputTexel",r.outputEncoding),r.depthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(xo).join("\n")),c=wo(c=bo(c=Mo(c),r),r),u=wo(u=bo(u=Mo(u),r),r),c=Ao(c),u=Ao(u),r.isWebGL2&&!0!==r.isRawShaderMaterial&&(M="#version 300 es\n",n=["#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+n,a=["#define varying in",r.glslVersion===Ur?"":"out highp vec4 pc_fragColor;",r.glslVersion===Ur?"":"#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 S,T,E=M+a+u,A=po(l,35633,M+n+c),L=po(l,35632,E);if(l.attachShader(_,A),l.attachShader(_,L),void 0===r.index0AttributeName?!0===r.morphTargets&&l.bindAttribLocation(_,0,"position"):l.bindAttribLocation(_,0,r.index0AttributeName),l.linkProgram(_),e.debug.checkShaderErrors){var R=l.getProgramInfoLog(_).trim(),C=l.getShaderInfoLog(A).trim(),P=l.getShaderInfoLog(L).trim(),I=!0,O=!0;if(!1===l.getProgramParameter(_,35714)){I=!1;var D=vo(l,A,"vertex"),N=vo(l,L,"fragment");console.error("THREE.WebGLProgram: shader error: ",l.getError(),"35715",l.getProgramParameter(_,35715),"gl.getProgramInfoLog",R,D,N)}else""===R?(""===C||""===P)&&(O=!1):console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",R);O&&(this.diagnostics={runnable:I,programLog:R,vertexShader:{log:C,prefix:n},fragmentShader:{log:P,prefix:a}})}return l.deleteShader(A),l.deleteShader(L),this.getUniforms=function(){return void 0===S&&(S=new uo(l,_)),S},this.getAttributes=function(){return void 0===T&&(T=function(e,t){for(var r={},i=e.getProgramParameter(t,35721),n=0;n<i;n++){var a=e.getActiveAttrib(t,n).name;r[a]=e.getAttribLocation(t,a)}return r}(l,_)),T},this.destroy=function(){i.releaseStatesOfProgram(this),l.deleteProgram(_),this.program=void 0},this.name=r.shaderName,this.id=mo++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=A,this.fragmentShader=L,this}function Io(e,t,r,i,n,a){function s(e){var t;return e&&e.isTexture?t=e.encoding:e&&e.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),t=e.texture.encoding):t=$t,t}var o=[],l=i.isWebGL2,h=i.logarithmicDepthBuffer,c=i.floatVertexTextures,u=i.maxVertexUniforms,d=i.vertexTextures,p=i.precision,m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},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","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmission","transmissionMap","thicknessMap"];return{getParameters:function(n,o,f,v,g){var b,w,_=v.fog,M=n.isMeshStandardMaterial?v.environment:null,S=t.get(n.envMap||M),T=m[n.type],E=g.isSkinnedMesh?function(e){var t=e.skeleton.bones;if(c)return 1024;var r=u,i=Math.floor((r-20)/4),n=Math.min(i,t.length);return n<t.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+t.length+" bones. This GPU supports "+n+"."),0):n}(g):0;if(null!==n.precision&&(p=i.getMaxPrecision(n.precision))!==n.precision&&console.warn("THREE.WebGLProgram.getParameters:",n.precision,"not supported, using",p,"instead."),T){var A=qa[T];b=A.vertexShader,w=A.fragmentShader}else b=n.vertexShader,w=n.fragmentShader;var L=e.getRenderTarget();return{isWebGL2:l,shaderID:T,shaderName:n.type,vertexShader:b,fragmentShader:w,defines:n.defines,isRawShaderMaterial:!0===n.isRawShaderMaterial,glslVersion:n.glslVersion,precision:p,instancing:!0===g.isInstancedMesh,instancingColor:!0===g.isInstancedMesh&&null!==g.instanceColor,supportsVertexTextures:d,outputEncoding:null===L?e.outputEncoding:s(L.texture),map:!!n.map,mapEncoding:s(n.map),matcap:!!n.matcap,matcapEncoding:s(n.matcap),envMap:!!S,envMapMode:S&&S.mapping,envMapEncoding:s(S),envMapCubeUV:!!S&&(S.mapping===de||S.mapping===pe),lightMap:!!n.lightMap,lightMapEncoding:s(n.lightMap),aoMap:!!n.aoMap,emissiveMap:!!n.emissiveMap,emissiveMapEncoding:s(n.emissiveMap),bumpMap:!!n.bumpMap,normalMap:!!n.normalMap,objectSpaceNormalMap:n.normalMapType===cr,tangentSpaceNormalMap:n.normalMapType===hr,clearcoatMap:!!n.clearcoatMap,clearcoatRoughnessMap:!!n.clearcoatRoughnessMap,clearcoatNormalMap:!!n.clearcoatNormalMap,displacementMap:!!n.displacementMap,roughnessMap:!!n.roughnessMap,metalnessMap:!!n.metalnessMap,specularMap:!!n.specularMap,alphaMap:!!n.alphaMap,gradientMap:!!n.gradientMap,sheen:!!n.sheen,transmission:!!n.transmission,transmissionMap:!!n.transmissionMap,thicknessMap:!!n.thicknessMap,combine:n.combine,vertexTangents:n.normalMap&&n.vertexTangents,vertexColors:n.vertexColors,vertexAlphas:!0===n.vertexColors&&g.geometry&&g.geometry.attributes.color&&4===g.geometry.attributes.color.itemSize,vertexUvs:!!(n.map||n.bumpMap||n.normalMap||n.specularMap||n.alphaMap||n.emissiveMap||n.roughnessMap||n.metalnessMap||n.clearcoatMap||n.clearcoatRoughnessMap||n.clearcoatNormalMap||n.displacementMap||n.transmissionMap||n.thicknessMap),uvsVertexOnly:!(n.map||n.bumpMap||n.normalMap||n.specularMap||n.alphaMap||n.emissiveMap||n.roughnessMap||n.metalnessMap||n.clearcoatNormalMap||n.transmission||n.transmissionMap||n.thicknessMap||!n.displacementMap),fog:!!_,useFog:n.fog,fogExp2:_&&_.isFogExp2,flatShading:!!n.flatShading,sizeAttenuation:n.sizeAttenuation,logarithmicDepthBuffer:h,skinning:!0===g.isSkinnedMesh&&0<E,maxBones:E,useVertexTexture:c,morphTargets:n.morphTargets,morphNormals:n.morphNormals,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:n.dithering,shadowMapEnabled:e.shadowMap.enabled&&0<f.length,shadowMapType:e.shadowMap.type,toneMapping:n.toneMapped?e.toneMapping:te,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:n.premultipliedAlpha,alphaTest:n.alphaTest,doubleSided:n.side===x,flipSided:n.side===y,depthPacking:void 0!==n.depthPacking&&n.depthPacking,index0AttributeName:n.index0AttributeName,extensionDerivatives:n.extensions&&n.extensions.derivatives,extensionFragDepth:n.extensions&&n.extensions.fragDepth,extensionDrawBuffers:n.extensions&&n.extensions.drawBuffers,extensionShaderTextureLOD:n.extensions&&n.extensions.shaderTextureLOD,rendererExtensionFragDepth:l||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:l||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:l||r.has("EXT_shader_texture_lod"),customProgramCacheKey:n.customProgramCacheKey()}},getProgramCacheKey:function(t){var r=[];if(t.shaderID?r.push(t.shaderID):(r.push(t.fragmentShader),r.push(t.vertexShader)),void 0!==t.defines)for(var i in t.defines)r.push(i),r.push(t.defines[i]);if(!1===t.isRawShaderMaterial){for(var n=0;n<f.length;n++)r.push(t[f[n]]);r.push(e.outputEncoding),r.push(e.gammaFactor)}return r.push(t.customProgramCacheKey),r.join()},getUniforms:function(e){var t,r=m[e.type];if(r){var i=qa[r];t=Aa.clone(i.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,r){for(var i,a,s=0,l=o.length;s<l;s++)if((a=o[s]).cacheKey===r){++(i=a).usedTimes;break}return void 0===i&&(i=new Po(e,r,t,n),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 Oo(){var e=new WeakMap;return{get:function(t){var r=e.get(t);return void 0===r&&(r={},e.set(t,r)),r},remove:function(t){e.delete(t)},update:function(t,r,i){e.get(t)[r]=i},dispose:function(){e=new WeakMap}}}function Do(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.program===t.program?e.material.id===t.material.id?e.z===t.z?e.id-t.id:e.z-t.z:e.material.id-t.material.id:e.program.id-t.program.id:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function No(e,t){return e.groupOrder===t.groupOrder?e.renderOrder===t.renderOrder?e.z===t.z?e.id-t.id:t.z-e.z:e.renderOrder-t.renderOrder:e.groupOrder-t.groupOrder}function Bo(e){function t(t,n,a,s,l,h){var c=r[i],u=e.get(a);return void 0===c?(c={id:t.id,object:t,geometry:n,material:a,program:u.program||o,groupOrder:s,renderOrder:t.renderOrder,z:l,group:h},r[i]=c):(c.id=t.id,c.object=t,c.geometry=n,c.material=a,c.program=u.program||o,c.groupOrder=s,c.renderOrder=t.renderOrder,c.z=l,c.group=h),i++,c}var r=[],i=0,n=[],a=[],s=[],o={id:-1};return{opaque:n,transmissive:a,transparent:s,init:function(){i=0,n.length=0,a.length=0,s.length=0},push:function(e,r,i,o,l,h){var c=t(e,r,i,o,l,h);0<i.transmission?a.push(c):!0===i.transparent?s.push(c):n.push(c)},unshift:function(e,r,i,o,l,h){var c=t(e,r,i,o,l,h);0<i.transmission?a.unshift(c):!0===i.transparent?s.unshift(c):n.unshift(c)},finish:function(){for(var e,t=i,n=r.length;t<n&&null!==(e=r[t]).id;t++)e.id=null,e.object=null,e.geometry=null,e.material=null,e.program=null,e.group=null},sort:function(e,t){1<n.length&&n.sort(e||Do),1<a.length&&a.sort(t||No),1<s.length&&s.sort(t||No)}}}function Uo(e){var t=new WeakMap;return{get:function(r,i){var n;return!1===t.has(r)?(n=new Bo(e),t.set(r,[n])):i>=t.get(r).length?(n=new Bo(e),t.get(r).push(n)):n=t.get(r)[i],n},dispose:function(){t=new WeakMap}}}function zo(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var r;switch(t.type){case"DirectionalLight":r={direction:new ci,color:new On};break;case"SpotLight":r={position:new ci,direction:new ci,color:new On,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":r={position:new ci,color:new On,distance:0,decay:0};break;case"HemisphereLight":r={direction:new ci,skyColor:new On,groundColor:new On};break;case"RectAreaLight":r={color:new On,position:new ci,halfWidth:new ci,halfHeight:new ci}}return e[t.id]=r,r}}}var Fo=0;function Go(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Vo(e,t){for(var r=new zo,i=function(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var r;switch(t.type){case"DirectionalLight":case"SpotLight":r={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $r};break;case"PointLight":r={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $r,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=r,r}}}(),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:[]},a=0;9>a;a++)n.probe.push(new ci);var s=new ci,o=new Vi,l=new Vi;return{setup:function(a){for(var s=0,o=0,l=0,h=0;9>h;h++)n.probe[h].set(0,0,0);var c=0,u=0,d=0,p=0,m=0,f=0,v=0,g=0;a.sort(Go);for(var y=0,x=a.length;y<x;y++){var b=a[y],w=b.color,_=b.intensity,M=b.distance,S=b.shadow&&b.shadow.map?b.shadow.map.texture:null;if(b.isAmbientLight)s+=w.r*_,o+=w.g*_,l+=w.b*_;else if(b.isLightProbe)for(var T=0;9>T;T++)n.probe[T].addScaledVector(b.sh.coefficients[T],_);else if(b.isDirectionalLight){var E=r.get(b);if(E.color.copy(b.color).multiplyScalar(b.intensity),b.castShadow){var A=b.shadow,L=i.get(b);L.shadowBias=A.bias,L.shadowNormalBias=A.normalBias,L.shadowRadius=A.radius,L.shadowMapSize=A.mapSize,n.directionalShadow[c]=L,n.directionalShadowMap[c]=S,n.directionalShadowMatrix[c]=b.shadow.matrix,f++}n.directional[c]=E,c++}else if(b.isSpotLight){var R=r.get(b);if(R.position.setFromMatrixPosition(b.matrixWorld),R.color.copy(w).multiplyScalar(_),R.distance=M,R.coneCos=Math.cos(b.angle),R.penumbraCos=Math.cos(b.angle*(1-b.penumbra)),R.decay=b.decay,b.castShadow){var C=b.shadow,P=i.get(b);P.shadowBias=C.bias,P.shadowNormalBias=C.normalBias,P.shadowRadius=C.radius,P.shadowMapSize=C.mapSize,n.spotShadow[d]=P,n.spotShadowMap[d]=S,n.spotShadowMatrix[d]=b.shadow.matrix,g++}n.spot[d]=R,d++}else if(b.isRectAreaLight){var I=r.get(b);I.color.copy(w).multiplyScalar(_),I.halfWidth.set(.5*b.width,0,0),I.halfHeight.set(0,.5*b.height,0),n.rectArea[p]=I,p++}else if(b.isPointLight){var O=r.get(b);if(O.color.copy(b.color).multiplyScalar(b.intensity),O.distance=b.distance,O.decay=b.decay,b.castShadow){var D=b.shadow,N=i.get(b);N.shadowBias=D.bias,N.shadowNormalBias=D.normalBias,N.shadowRadius=D.radius,N.shadowMapSize=D.mapSize,N.shadowCameraNear=D.camera.near,N.shadowCameraFar=D.camera.far,n.pointShadow[u]=N,n.pointShadowMap[u]=S,n.pointShadowMatrix[u]=b.shadow.matrix,v++}n.point[u]=O,u++}else if(b.isHemisphereLight){var B=r.get(b);B.skyColor.copy(b.color).multiplyScalar(_),B.groundColor.copy(b.groundColor).multiplyScalar(_),n.hemi[m]=B,m++}}0<p&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(n.rectAreaLTC1=Za.LTC_FLOAT_1,n.rectAreaLTC2=Za.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(n.rectAreaLTC1=Za.LTC_HALF_1,n.rectAreaLTC2=Za.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),n.ambient[0]=s,n.ambient[1]=o,n.ambient[2]=l;var U=n.hash;(U.directionalLength!==c||U.pointLength!==u||U.spotLength!==d||U.rectAreaLength!==p||U.hemiLength!==m||U.numDirectionalShadows!==f||U.numPointShadows!==v||U.numSpotShadows!==g)&&(n.directional.length=c,n.spot.length=d,n.rectArea.length=p,n.point.length=u,n.hemi.length=m,n.directionalShadow.length=f,n.directionalShadowMap.length=f,n.pointShadow.length=v,n.pointShadowMap.length=v,n.spotShadow.length=g,n.spotShadowMap.length=g,n.directionalShadowMatrix.length=f,n.pointShadowMatrix.length=v,n.spotShadowMatrix.length=g,U.directionalLength=c,U.pointLength=u,U.spotLength=d,U.rectAreaLength=p,U.hemiLength=m,U.numDirectionalShadows=f,U.numPointShadows=v,U.numSpotShadows=g,n.version=Fo++)},setupView:function(e,t){for(var r,i=0,a=0,h=0,c=0,u=0,d=t.matrixWorldInverse,p=0,m=e.length;p<m;p++)if((r=e[p]).isDirectionalLight){var f=n.directional[i];f.direction.setFromMatrixPosition(r.matrixWorld),s.setFromMatrixPosition(r.target.matrixWorld),f.direction.sub(s),f.direction.transformDirection(d),i++}else if(r.isSpotLight){var v=n.spot[h];v.position.setFromMatrixPosition(r.matrixWorld),v.position.applyMatrix4(d),v.direction.setFromMatrixPosition(r.matrixWorld),s.setFromMatrixPosition(r.target.matrixWorld),v.direction.sub(s),v.direction.transformDirection(d),h++}else if(r.isRectAreaLight){var g=n.rectArea[c];g.position.setFromMatrixPosition(r.matrixWorld),g.position.applyMatrix4(d),l.identity(),o.copy(r.matrixWorld),o.premultiply(d),l.extractRotation(o),g.halfWidth.set(.5*r.width,0,0),g.halfHeight.set(0,.5*r.height,0),g.halfWidth.applyMatrix4(l),g.halfHeight.applyMatrix4(l),c++}else if(r.isPointLight){var y=n.point[a];y.position.setFromMatrixPosition(r.matrixWorld),y.position.applyMatrix4(d),a++}else if(r.isHemisphereLight){var x=n.hemi[u];x.direction.setFromMatrixPosition(r.matrixWorld),x.direction.transformDirection(d),x.direction.normalize(),u++}},state:n}}function Ho(e,t){var r=new Vo(e,t),i=[],n=[];return{init:function(){i.length=0,n.length=0},state:{lightsArray:i,shadowsArray:n,lights:r},setupLights:function(){r.setup(i)},setupLightsView:function(e){r.setupView(i,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){n.push(e)}}}function ko(e,t){var r=new WeakMap;return{get:function(i){var n,a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return!1===r.has(i)?(n=new Ho(e,t),r.set(i,[n])):a>=r.get(i).length?(n=new Ho(e,t),r.get(i).push(n)):n=r.get(i)[a],n},dispose:function(){r=new WeakMap}}}class jo extends En{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=or,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)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,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}}jo.prototype.isMeshDepthMaterial=!0;class Wo extends En{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new ci,this.nearDistance=1,this.farDistance=1e3,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,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}}Wo.prototype.isMeshDistanceMaterial=!0;var Zo="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 HORIZONTAL_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}",qo="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function Xo(e,t,r){function i(r,i){var n=t.update(E);M.uniforms.shadow_pass.value=r.map.texture,M.uniforms.resolution.value=r.mapSize,M.uniforms.radius.value=r.radius,e.setRenderTarget(r.mapPass),e.clear(),e.renderBufferDirect(i,null,n,M,E,null),S.uniforms.shadow_pass.value=r.mapPass.texture,S.uniforms.resolution.value=r.mapSize,S.uniforms.radius.value=r.radius,e.setRenderTarget(r.map),e.clear(),e.renderBufferDirect(i,null,n,S,E,null)}function n(e){var t=e<<0,r=d[t];return void 0===r&&(r=new jo({depthPacking:lr,morphTargets:e}),d[t]=r),r}function a(e){var t=e<<0,r=p[t];return void 0===r&&(r=new Wo({morphTargets:e}),p[t]=r),r}function s(t,r,i,s,o,l,h){var c=null,u=n,d=t.customDepthMaterial;if(!0===s.isPointLight&&(u=a,d=t.customDistanceMaterial),void 0===d){var p=!1;!0===i.morphTargets&&(p=r.morphAttributes&&r.morphAttributes.position&&0<r.morphAttributes.position.length),c=u(p)}else c=d;if(e.localClippingEnabled&&!0===i.clipShadows&&0!==i.clippingPlanes.length){var m=c.uuid,g=i.uuid,y=f[m];void 0===y&&(y={},f[m]=y);var x=y[g];void 0===x&&(x=c.clone(),y[g]=x),c=x}return c.visible=i.visible,c.wireframe=i.wireframe,c.side=h===v?null===i.shadowSide?i.side:i.shadowSide:null===i.shadowSide?w[i.side]:i.shadowSide,c.clipShadows=i.clipShadows,c.clippingPlanes=i.clippingPlanes,c.clipIntersection=i.clipIntersection,c.wireframeLinewidth=i.wireframeLinewidth,c.linewidth=i.linewidth,!0===s.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(s.matrixWorld),c.nearDistance=o,c.farDistance=l),c}function o(r,i,n,a,h){if(!1!==r.visible){if(r.layers.test(i.layers)&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&h===v)&&(!r.frustumCulled||l.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,r.matrixWorld);var c=t.update(r),u=r.material;if(Array.isArray(u))for(var d=c.groups,p=0,m=d.length;p<m;p++){var f=d[p],g=u[f.materialIndex];if(g&&g.visible){var y=s(r,c,g,a,n.near,n.far,h);e.renderBufferDirect(n,null,c,y,r,f)}}else if(u.visible){var x=s(r,c,u,a,n.near,n.far,h);e.renderBufferDirect(n,null,c,x,r,null)}}for(var b=r.children,w=0,_=b.length;w<_;w++)o(b[w],i,n,a,h)}}var l=new Va,h=new $r,c=new $r,u=new ai,d=[],p=[],f={},b=r.maxTextureSize,w={0:y,1:g,2:x},M=new La({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new $r},radius:{value:4}},vertexShader:qo,fragmentShader:Zo}),S=M.clone();S.defines.HORIZONTAL_PASS=1;var T=new na;T.setAttribute("position",new Un(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var E=new _a(T,M),A=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=m,this.render=function(t,r,n){if(!1!==A.enabled&&(!1!==A.autoUpdate||!1!==A.needsUpdate)&&0!==t.length){var a=e.getRenderTarget(),s=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.state;p.setBlending(_),p.buffers.color.setClear(1,1,1,1),p.buffers.depth.setTest(!0),p.setScissorTest(!1);for(var m=0,f=t.length;m<f;m++){var g=t[m],y=g.shadow;if(void 0!==y){if(!1!==y.autoUpdate||!1!==y.needsUpdate){h.copy(y.mapSize);var x=y.getFrameExtents();if(h.multiply(x),c.copy(y.mapSize),(h.x>b||h.y>b)&&(h.x>b&&(c.x=Math.floor(b/x.x),h.x=c.x*x.x,y.mapSize.x=c.x),h.y>b&&(c.y=Math.floor(b/x.y),h.y=c.y*x.y,y.mapSize.y=c.y)),null===y.map&&!y.isPointLightShadow&&this.type===v){var w={minFilter:_e,magFilter:_e,format:Ve};y.map=new si(h.x,h.y,w),y.map.texture.name=g.name+".shadowMap",y.mapPass=new si(h.x,h.y,w),y.camera.updateProjectionMatrix()}if(null===y.map){var M={minFilter:ge,magFilter:ge,format:Ve};y.map=new si(h.x,h.y,M),y.map.texture.name=g.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var S,T=y.getViewportCount(),E=0;E<T;E++)S=y.getViewport(E),u.set(c.x*S.x,c.y*S.y,c.x*S.z,c.y*S.w),p.viewport(u),y.updateMatrices(g,E),l=y.getFrustum(),o(r,n,y.camera,g,this.type);y.isPointLightShadow||this.type!==v||i(y,n),y.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}A.needsUpdate=!1,e.setRenderTarget(a,s,d)}}}function Yo(e,t,r){function i(t,r,i){var n=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var s=0;s<i;s++)e.texImage2D(r+s,0,6408,1,1,0,6408,5121,n);return a}function n(t){!0!==b[t]&&(e.enable(t),b[t]=!0)}function a(t){!1!==b[t]&&(e.disable(t),b[t]=!1)}function s(t,r,i,s,o,l,h,c){return t===_?void(!0===ee&&(a(3042),ee=!1)):(!1===ee&&(n(3042),ee=!0),t===A?(o=o||r,l=l||i,h=h||s,(r!==re||o!==ae)&&(e.blendEquationSeparate(Te[r],Te[o]),re=r,ae=o),(i!==ie||s!==ne||l!==se||h!==oe)&&(e.blendFuncSeparate(Ae[i],Ae[s],Ae[l],Ae[h]),ie=i,ne=s,se=l,oe=h),te=t,void(le=null)):void((t!==te||c!==le)&&((re!==L||ae!==L)&&(e.blendEquation(32774),re=L,ae=L),c?t===M?e.blendFuncSeparate(1,771,1,771):t===S?e.blendFunc(1,1):t===T?e.blendFuncSeparate(0,0,769,771):t===E?e.blendFuncSeparate(0,768,0,770):console.error("THREE.WebGLState: Invalid blending: ",t):t===M?e.blendFuncSeparate(770,771,1,771):t===S?e.blendFunc(770,1):t===T?e.blendFunc(0,769):t===E?e.blendFunc(0,768):console.error("THREE.WebGLState: Invalid blending: ",t),ie=null,ne=null,se=null,oe=null,te=t,le=c)))}function o(t){he!==t&&(t?e.frontFace(2304):e.frontFace(2305),he=t)}function l(t){t===h?a(2884):(n(2884),t!==ce&&(t===c?e.cullFace(1029):t===u?e.cullFace(1028):e.cullFace(1032))),ce=t}function d(t,r,i){t?(n(32823),(de!==r||pe!==i)&&(e.polygonOffset(r,i),de=r,pe=i)):a(32823)}function p(t){void 0===t&&(t=33984+me-1),ye!==t&&(e.activeTexture(t),ye=t)}var m=r.isWebGL2,f=new function(){var t=!1,r=new ai,i=null,n=new ai(0,0,0,0);return{setMask:function(r){i===r||t||(e.colorMask(r,r,r,r),i=r)},setLocked:function(e){t=e},setClear:function(t,i,a,s,o){!0===o&&(t*=s,i*=s,a*=s),r.set(t,i,a,s),!1===n.equals(r)&&(e.clearColor(t,i,a,s),n.copy(r))},reset:function(){t=!1,i=null,n.set(-1,0,0,0)}}},v=new function(){var t=!1,r=null,i=null,s=null;return{setTest:function(e){e?n(2929):a(2929)},setMask:function(i){r===i||t||(e.depthMask(i),r=i)},setFunc:function(t){i!==t&&(t?t===j?e.depthFunc(512):t===W?e.depthFunc(519):t===Z?e.depthFunc(513):t===q?e.depthFunc(515):t===X?e.depthFunc(514):t===Y?e.depthFunc(518):t===J?e.depthFunc(516):t===K?e.depthFunc(517):e.depthFunc(515):e.depthFunc(515),i=t)},setLocked:function(e){t=e},setClear:function(t){s!==t&&(e.clearDepth(t),s=t)},reset:function(){t=!1,r=null,i=null,s=null}}},g=new function(){var t=!1,r=null,i=null,s=null,o=null,l=null,h=null,c=null,u=null;return{setTest:function(e){t||(e?n(2960):a(2960))},setMask:function(i){r===i||t||(e.stencilMask(i),r=i)},setFunc:function(t,r,n){(i!==t||s!==r||o!==n)&&(e.stencilFunc(t,r,n),i=t,s=r,o=n)},setOp:function(t,r,i){(l!==t||h!==r||c!==i)&&(e.stencilOp(t,r,i),l=t,h=r,c=i)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,r=null,i=null,s=null,o=null,l=null,h=null,c=null,u=null}}},b={},w=null,Q={},$=null,ee=!1,te=null,re=null,ie=null,ne=null,ae=null,se=null,oe=null,le=!1,he=null,ce=null,ue=null,de=null,pe=null,me=e.getParameter(35661),fe=!1,ve=0,ge=e.getParameter(7938);-1===ge.indexOf("WebGL")?-1!==ge.indexOf("OpenGL ES")&&(ve=parseFloat(/^OpenGL ES (\d)/.exec(ge)[1]),fe=2<=ve):(ve=parseFloat(/^WebGL (\d)/.exec(ge)[1]),fe=1<=ve);var ye=null,xe={},be=e.getParameter(3088),we=e.getParameter(2978),_e=(new ai).fromArray(be),Me=(new ai).fromArray(we),Se={};Se[3553]=i(3553,3553,1),Se[34067]=i(34067,34069,6),f.setClear(0,0,0,1),v.setClear(1),g.setClear(0),n(2929),v.setFunc(q),o(!1),l(c),n(2884),s(_);var Te={[L]:32774,[R]:32778,[C]:32779};if(m)Te[P]=32775,Te[I]=32776;else{var Ee=t.get("EXT_blend_minmax");null!==Ee&&(Te[P]=Ee.MIN_EXT,Te[I]=Ee.MAX_EXT)}var Ae={[O]:0,[D]:1,[N]:768,[U]:770,[k]:776,[V]:774,[F]:772,[B]:769,[z]:771,[H]:775,[G]:773};return{buffers:{color:f,depth:v,stencil:g},enable:n,disable:a,bindFramebuffer:function(t,r){return null===r&&null!==w&&(r=w),Q[t]!==r&&(e.bindFramebuffer(t,r),Q[t]=r,m&&(36009===t&&(Q[36160]=r),36160===t&&(Q[36009]=r)),!0)},bindXRFramebuffer:function(t){t!==w&&(e.bindFramebuffer(36160,t),w=t)},useProgram:function(t){return $!==t&&(e.useProgram(t),$=t,!0)},setBlending:s,setMaterial:function(e,t){e.side===x?a(2884):n(2884);var r=e.side===y;t&&(r=!r),o(r),e.blending===M&&!1===e.transparent?s(_):s(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.premultipliedAlpha),v.setFunc(e.depthFunc),v.setTest(e.depthTest),v.setMask(e.depthWrite),f.setMask(e.colorWrite);var i=e.stencilWrite;g.setTest(i),i&&(g.setMask(e.stencilWriteMask),g.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),g.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),d(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?n(32926):a(32926)},setFlipSided:o,setCullFace:l,setLineWidth:function(t){t!==ue&&(fe&&e.lineWidth(t),ue=t)},setPolygonOffset:d,setScissorTest:function(e){e?n(3089):a(3089)},activeTexture:p,bindTexture:function(t,r){null===ye&&p();var i=xe[ye];void 0===i&&(i={type:void 0,texture:void 0},xe[ye]=i),(i.type!==t||i.texture!==r)&&(e.bindTexture(t,r||Se[t]),i.type=t,i.texture=r)},unbindTexture:function(){var t=xe[ye];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===_e.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),_e.copy(t))},viewport:function(t){!1===Me.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),Me.copy(t))},reset:function(){e.disable(3042),e.disable(2884),e.disable(2929),e.disable(32823),e.disable(3089),e.disable(2960),e.disable(32926),e.blendEquation(32774),e.blendFunc(1,0),e.blendFuncSeparate(1,0,1,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(513),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(519,0,4294967295),e.stencilOp(7680,7680,7680),e.clearStencil(0),e.cullFace(1029),e.frontFace(2305),e.polygonOffset(0,0),e.activeTexture(33984),e.bindFramebuffer(36160,null),!0===m&&(e.bindFramebuffer(36009,null),e.bindFramebuffer(36008,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),b={},ye=null,xe={},w=null,Q={},$=null,ee=!1,te=null,re=null,ie=null,ne=null,ae=null,se=null,oe=null,le=!1,he=null,ce=null,ue=null,de=null,pe=null,_e.set(0,0,e.canvas.width,e.canvas.height),Me.set(0,0,e.canvas.width,e.canvas.height),f.reset(),v.reset(),g.reset()}}}function Jo(e,t,r,i,n,a,s){function o(e,t){return P?new OffscreenCanvas(e,t):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function l(e,t,r,i){var n=1;if((e.width>i||e.height>i)&&(n=i/Math.max(e.width,e.height)),1>n||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Jr:Math.floor,s=a(n*e.width),l=a(n*e.height);void 0===S&&(S=o(s,l));var h=r?o(s,l):S;return h.width=s,h.height=l,h.getContext("2d").drawImage(e,0,0,s,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+l+")."),h}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function h(e){return Xr(e.width)&&Xr(e.height)}function c(e,t){return e.generateMipmaps&&t&&e.minFilter!==ge&&e.minFilter!==_e}function u(t,r,n,a){var s=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1;e.generateMipmap(t),i.get(r).__maxMipLevel=Math.log2(Math.max(n,a,s))}function d(r,i,n){if(!1===T)return i;if(null!==r){if(void 0!==e[r])return e[r];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+r+"'")}var a=i;return 6403===i&&(5126===n&&(a=33326),5131===n&&(a=33325),5121===n&&(a=33321)),6407===i&&(5126===n&&(a=34837),5131===n&&(a=34843),5121===n&&(a=32849)),6408===i&&(5126===n&&(a=34836),5131===n&&(a=34842),5121===n&&(a=32856)),(33325===a||33326===a||34842===a||34836===a)&&t.get("EXT_color_buffer_float"),a}function p(e){return e===ge||e===ye||e===be?9728:9729}function m(t){var r=t.target;r.removeEventListener("dispose",m),function(t){var r=i.get(t);void 0===r.__webglInit||(e.deleteTexture(r.__webglTexture),i.remove(t))}(r),r.isVideoTexture&&C.delete(r),s.memory.textures--}function f(t){var r=t.target;r.removeEventListener("dispose",f),function(t){var r=t.texture,n=i.get(t),a=i.get(r);if(t){if(void 0!==a.__webglTexture&&(e.deleteTexture(a.__webglTexture),s.memory.textures--),t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(var o=0;6>o;o++)e.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[o]);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);if(t.isWebGLMultipleRenderTargets)for(var l,h=0,c=r.length;h<c;h++)(l=i.get(r[h])).__webglTexture&&(e.deleteTexture(l.__webglTexture),s.memory.textures--),i.remove(r[h]);i.remove(r),i.remove(t)}}(r)}function v(e,t){var n=i.get(e);if(e.isVideoTexture&&function(e){var t=s.render.frame;C.get(e)!==t&&(C.set(e,t),e.update())}(e),0<e.version&&n.__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 b(n,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}r.activeTexture(33984+t),r.bindTexture(3553,n.__webglTexture)}function g(t,n){var s=i.get(t);return 0<t.version&&s.__version!==t.version?void function(t,i,n){if(6===i.image.length){x(t,i),r.activeTexture(33984+n),r.bindTexture(34067,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);for(var s=i&&(i.isCompressedTexture||i.image[0].isCompressedTexture),o=i.image[0]&&i.image[0].isDataTexture,p=[],m=0;6>m;m++)p[m]=s||o?o?i.image[m].image:i.image[m]:l(i.image[m],!1,!0,A);var f,v=p[0],g=h(v)||T,b=a.convert(i.format),w=a.convert(i.type),_=d(i.internalFormat,b,w);if(y(34067,i,g),s){for(var M=0;6>M;M++){f=p[M].mipmaps;for(var S,E=0;E<f.length;E++)S=f[E],i.format!==Ve&&i.format!==Ge?null===b?console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):r.compressedTexImage2D(34069+M,E,_,S.width,S.height,0,S.data):r.texImage2D(34069+M,E,_,S.width,S.height,0,b,w,S.data)}t.__maxMipLevel=f.length-1}else{f=i.mipmaps;for(var L=0;6>L;L++)if(o){r.texImage2D(34069+L,0,_,p[L].width,p[L].height,0,b,w,p[L].data);for(var R=0;R<f.length;R++){var C=f[R].image[L].image;r.texImage2D(34069+L,R+1,_,C.width,C.height,0,b,w,C.data)}}else{r.texImage2D(34069+L,0,_,b,w,p[L]);for(var P,I=0;I<f.length;I++)P=f[I],r.texImage2D(34069+L,I+1,_,b,w,P.image[L])}t.__maxMipLevel=f.length}c(i,g)&&u(34067,i,v.width,v.height),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}}(s,t,n):(r.activeTexture(33984+n),void r.bindTexture(34067,s.__webglTexture))}function y(r,a,s){if(s?(e.texParameteri(r,10242,O[a.wrapS]),e.texParameteri(r,10243,O[a.wrapT]),(32879===r||35866===r)&&e.texParameteri(r,32882,O[a.wrapR]),e.texParameteri(r,10240,D[a.magFilter]),e.texParameteri(r,10241,D[a.minFilter])):(e.texParameteri(r,10242,33071),e.texParameteri(r,10243,33071),(32879===r||35866===r)&&e.texParameteri(r,32882,33071),(a.wrapS!==fe||a.wrapT!==fe)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(r,10240,p(a.magFilter)),e.texParameteri(r,10241,p(a.minFilter)),a.minFilter!==ge&&a.minFilter!==_e&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===t.has("EXT_texture_filter_anisotropic")){var o=t.get("EXT_texture_filter_anisotropic");if(a.type===Oe&&!1===t.has("OES_texture_float_linear"))return;if(!1===T&&a.type===De&&!1===t.has("OES_texture_half_float_linear"))return;(1<a.anisotropy||i.get(a).__currentAnisotropy)&&(e.texParameterf(r,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,n.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function x(t,r){void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",m),t.__webglTexture=e.createTexture(),s.memory.textures++)}function b(t,i,n){var s=3553;i.isDataTexture2DArray&&(s=35866),i.isDataTexture3D&&(s=32879),x(t,i),r.activeTexture(33984+n),r.bindTexture(s,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment),e.pixelStorei(37443,0);var o=function(e){return!T&&(e.wrapS!==fe||e.wrapT!==fe||e.minFilter!==ge&&e.minFilter!==_e)}(i)&&!1===h(i.image),p=l(i.image,o,!1,L),m=h(p)||T,f=a.convert(i.format),v=a.convert(i.type),g=d(i.internalFormat,f,v);y(s,i,m);var b,w=i.mipmaps;if(i.isDepthTexture)g=6402,T?g=i.type===Oe?36012:i.type===Ie?33190:i.type===ze?35056:33189:i.type===Oe&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),i.format===We&&6402===g&&i.type!==Ce&&i.type!==Ie&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Ce,v=a.convert(i.type)),i.format===Ze&&6402===g&&(g=34041,i.type!==ze&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=ze,v=a.convert(i.type))),r.texImage2D(3553,0,g,p.width,p.height,0,f,v,null);else if(i.isDataTexture)if(0<w.length&&m){for(var _=0,M=w.length;_<M;_++)b=w[_],r.texImage2D(3553,_,g,b.width,b.height,0,f,v,b.data);i.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else r.texImage2D(3553,0,g,p.width,p.height,0,f,v,p.data),t.__maxMipLevel=0;else if(i.isCompressedTexture){for(var S=0,E=w.length;S<E;S++)b=w[S],i.format!==Ve&&i.format!==Ge?null===f?console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):r.compressedTexImage2D(3553,S,g,b.width,b.height,0,b.data):r.texImage2D(3553,S,g,b.width,b.height,0,f,v,b.data);t.__maxMipLevel=w.length-1}else if(i.isDataTexture2DArray)r.texImage3D(35866,0,g,p.width,p.height,p.depth,0,f,v,p.data),t.__maxMipLevel=0;else if(i.isDataTexture3D)r.texImage3D(32879,0,g,p.width,p.height,p.depth,0,f,v,p.data),t.__maxMipLevel=0;else if(0<w.length&&m){for(var A=0,R=w.length;A<R;A++)b=w[A],r.texImage2D(3553,A,g,f,v,b);i.generateMipmaps=!1,t.__maxMipLevel=w.length-1}else r.texImage2D(3553,0,g,f,v,p),t.__maxMipLevel=0;c(i,m)&&u(s,i,p.width,p.height),t.__version=i.version,i.onUpdate&&i.onUpdate(i)}function w(t,n,s,o,l){var h=a.convert(s.format),c=a.convert(s.type),u=d(s.internalFormat,h,c);32879===l||35866===l?r.texImage3D(l,0,u,n.width,n.height,n.depth,0,h,c,null):r.texImage2D(l,0,u,n.width,n.height,0,h,c,null),r.bindFramebuffer(36160,t),e.framebufferTexture2D(36160,o,l,i.get(s).__webglTexture,0),r.bindFramebuffer(36160,null)}function _(t,r,i){if(e.bindRenderbuffer(36161,t),r.depthBuffer&&!r.stencilBuffer){var n=33189;if(i){var s=r.depthTexture;s&&s.isDepthTexture&&(s.type===Oe?n=36012:s.type===Ie&&(n=33190));var o=M(r);e.renderbufferStorageMultisample(36161,o,n,r.width,r.height)}else e.renderbufferStorage(36161,n,r.width,r.height);e.framebufferRenderbuffer(36160,36096,36161,t)}else if(r.depthBuffer&&r.stencilBuffer){if(i){var l=M(r);e.renderbufferStorageMultisample(36161,l,35056,r.width,r.height)}else e.renderbufferStorage(36161,34041,r.width,r.height);e.framebufferRenderbuffer(36160,33306,36161,t)}else{var h=!0===r.isWebGLMultipleRenderTargets?r.texture[0]:r.texture,c=a.convert(h.format),u=a.convert(h.type),p=d(h.internalFormat,c,u);if(i){var m=M(r);e.renderbufferStorageMultisample(36161,m,p,r.width,r.height)}else e.renderbufferStorage(36161,p,r.width,r.height)}e.bindRenderbuffer(36161,null)}function M(e){return T&&e.isWebGLMultisampleRenderTarget?Math.min(R,e.samples):0}var S,T=n.isWebGL2,E=n.maxTextures,A=n.maxCubemapSize,L=n.maxTextureSize,R=n.maxSamples,C=new WeakMap,P=!1;try{P="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}var I=0,O={[me]:10497,[fe]:33071,[ve]:33648},D={[ge]:9728,[ye]:9984,[be]:9986,[_e]:9729,[Me]:9985,[Te]:9987},N=!1,B=!1;this.allocateTextureUnit=function(){var e=I;return e>=E&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+E),I+=1,e},this.resetTextureUnits=function(){I=0},this.setTexture2D=v,this.setTexture2DArray=function(e,t){var n=i.get(e);return 0<e.version&&n.__version!==e.version?void b(n,e,t):(r.activeTexture(33984+t),void r.bindTexture(35866,n.__webglTexture))},this.setTexture3D=function(e,t){var n=i.get(e);return 0<e.version&&n.__version!==e.version?void b(n,e,t):(r.activeTexture(33984+t),void r.bindTexture(32879,n.__webglTexture))},this.setTextureCube=g,this.setupRenderTarget=function(t){var o=t.texture,l=i.get(t),p=i.get(o);t.addEventListener("dispose",f),!0!==t.isWebGLMultipleRenderTargets&&(p.__webglTexture=e.createTexture(),p.__version=o.version,s.memory.textures++);var m=!0===t.isWebGLCubeRenderTarget,g=!0===t.isWebGLMultipleRenderTargets,x=!0===t.isWebGLMultisampleRenderTarget,b=o.isDataTexture3D||o.isDataTexture2DArray,S=h(t)||T;if(T&&o.format===Ge&&(o.type===Oe||o.type===De)&&(o.format=Ve,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),m){l.__webglFramebuffer=[];for(var E=0;6>E;E++)l.__webglFramebuffer[E]=e.createFramebuffer()}else if(l.__webglFramebuffer=e.createFramebuffer(),g)if(n.drawBuffers)for(var A,L=t.texture,R=0,C=L.length;R<C;R++)void 0===(A=i.get(L[R])).__webglTexture&&(A.__webglTexture=e.createTexture(),s.memory.textures++);else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(x)if(T){l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,l.__webglColorRenderbuffer);var P=a.convert(o.format),I=a.convert(o.type),O=d(o.internalFormat,P,I),D=M(t);e.renderbufferStorageMultisample(36161,D,O,t.width,t.height),r.bindFramebuffer(36160,l.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,l.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),t.depthBuffer&&(l.__webglDepthRenderbuffer=e.createRenderbuffer(),_(l.__webglDepthRenderbuffer,t,!0)),r.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(m){r.bindTexture(34067,p.__webglTexture),y(34067,o,S);for(var N=0;6>N;N++)w(l.__webglFramebuffer[N],t,o,36064,34069+N);c(o,S)&&u(34067,o,t.width,t.height),r.bindTexture(34067,null)}else if(g){for(var B=t.texture,U=0,z=B.length;U<z;U++){var F=B[U],G=i.get(F);r.bindTexture(3553,G.__webglTexture),y(3553,F,S),w(l.__webglFramebuffer,t,F,36064+U,3553),c(F,S)&&u(3553,F,t.width,t.height)}r.bindTexture(3553,null)}else{var V=3553;b&&(T?V=o.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),r.bindTexture(V,p.__webglTexture),y(V,o,S),w(l.__webglFramebuffer,t,o,36064,V),c(o,S)&&u(V,o,t.width,t.height,t.depth),r.bindTexture(V,null)}t.depthBuffer&&function(t){var n=i.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture){if(a)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(r.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),v(n.depthTexture,0);var a=i.get(n.depthTexture).__webglTexture;if(n.depthTexture.format===We)e.framebufferTexture2D(36160,36096,3553,a,0);else{if(n.depthTexture.format!==Ze)throw new Error("Unknown depthTexture format");e.framebufferTexture2D(36160,33306,3553,a,0)}}(n.__webglFramebuffer,t)}else if(a){n.__webglDepthbuffer=[];for(var s=0;6>s;s++)r.bindFramebuffer(36160,n.__webglFramebuffer[s]),n.__webglDepthbuffer[s]=e.createRenderbuffer(),_(n.__webglDepthbuffer[s],t,!1)}else r.bindFramebuffer(36160,n.__webglFramebuffer),n.__webglDepthbuffer=e.createRenderbuffer(),_(n.__webglDepthbuffer,t,!1);r.bindFramebuffer(36160,null)}(t)},this.updateRenderTargetMipmap=function(e){for(var t,n=h(e)||T,a=!0===e.isWebGLMultipleRenderTargets?e.texture:[e.texture],s=0,o=a.length;s<o;s++)if(c(t=a[s],n)){var l=e.isWebGLCubeRenderTarget?34067:3553,d=i.get(t).__webglTexture;r.bindTexture(l,d),u(l,t,e.width,e.height),r.bindTexture(l,null)}},this.updateMultisampleRenderTarget=function(t){if(t.isWebGLMultisampleRenderTarget)if(T){var n=t.width,a=t.height,s=16384;t.depthBuffer&&(s|=256),t.stencilBuffer&&(s|=1024);var o=i.get(t);r.bindFramebuffer(36008,o.__webglMultisampledFramebuffer),r.bindFramebuffer(36009,o.__webglFramebuffer),e.blitFramebuffer(0,0,n,a,0,0,n,a,s,9728),r.bindFramebuffer(36008,null),r.bindFramebuffer(36009,o.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(e,t){e&&e.isWebGLRenderTarget&&(!1===N&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),N=!0),e=e.texture),v(e,t)},this.safeSetTextureCube=function(e,t){e&&e.isWebGLCubeRenderTarget&&(!1===B&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),B=!0),e=e.texture),g(e,t)}}function Ko(e,t,r){var i=r.isWebGL2;return{convert:function(e){var r;if(e===Ae)return 5121;if(e===Ne)return 32819;if(e===Be)return 32820;if(e===Ue)return 33635;if(e===Le)return 5120;if(e===Re)return 5122;if(e===Ce)return 5123;if(e===Pe)return 5124;if(e===Ie)return 5125;if(e===Oe)return 5126;if(e===De)return i?5131:null===(r=t.get("OES_texture_half_float"))?null:r.HALF_FLOAT_OES;if(e===Fe)return 6406;if(e===Ge)return 6407;if(e===Ve)return 6408;if(e===He)return 6409;if(e===ke)return 6410;if(e===We)return 6402;if(e===Ze)return 34041;if(e===qe)return 6403;if(e===Xe)return 36244;if(e===Ye)return 33319;if(e===Je)return 33320;if(e===Ke)return 36248;if(e===Qe)return 36249;if(e===$e||e===et||e===tt||e===rt){if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(e===$e)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(e===et)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(e===tt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(e===rt)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(e===it||e===nt||e===at||e===st){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(e===it)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(e===nt)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(e===at)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(e===st)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(e===ot)return null===(r=t.get("WEBGL_compressed_texture_etc1"))?null:r.COMPRESSED_RGB_ETC1_WEBGL;if((e===lt||e===ht)&&null!==(r=t.get("WEBGL_compressed_texture_etc"))){if(e===lt)return r.COMPRESSED_RGB8_ETC2;if(e===ht)return r.COMPRESSED_RGBA8_ETC2_EAC}return e===ct||e===ut||e===dt||e===pt||e===mt||e===ft||e===vt||e===gt||e===yt||e===xt||e===bt||e===wt||e===_t||e===Mt||e===Tt||e===Et||e===At||e===Lt||e===Rt||e===Ct||e===Pt||e===It||e===Ot||e===Dt||e===Nt||e===Bt||e===Ut||e===zt?null===(r=t.get("WEBGL_compressed_texture_astc"))?null:e:e===St?null===(r=t.get("EXT_texture_compression_bptc"))?null:e:e===ze?i?34042:null===(r=t.get("WEBGL_depth_texture"))?null:r.UNSIGNED_INT_24_8_WEBGL:void 0}}}class Qo extends Ca{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];super(),this.cameras=e}}Qo.prototype.isArrayCamera=!0;class $o extends pn{constructor(){super(),this.type="Group"}}$o.prototype.isGroup=!0;var el={type:"move"};class tl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new $o,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new $o,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ci,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ci),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new $o,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ci,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ci),this._grip}dispatchEvent(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(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(e,t,r){var i=null,n=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState)if(null!==s&&null!==(i=t.getPose(e.targetRaySpace,r))&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(el)),l&&e.hand){for(var h of(a=!0,e.hand.values())){var c=t.getJointPose(h,r);if(void 0===l.joints[h.jointName]){var u=new $o;u.matrixAutoUpdate=!1,u.visible=!1,l.joints[h.jointName]=u,l.add(u)}var d=l.joints[h.jointName];null!==c&&(d.matrix.fromArray(c.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.jointRadius=c.radius),d.visible=null!==c}var p=l.joints["index-finger-tip"],m=l.joints["thumb-tip"],f=p.position.distanceTo(m.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&&e.gripSpace&&null!==(n=t.getPose(e.gripSpace,r))&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1);return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==n),null!==l&&(l.visible=null!==a),this}}class rl extends zr{constructor(e,t){function r(e){var t=y.get(e.inputSource);t&&t.dispatchEvent({type:e.type,data:e.inputSource})}function i(){y.forEach((function(e,t){e.disconnect(t)})),y.clear(),M=null,S=null,l.bindXRFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),L.stop(),o.isPresenting=!1,o.dispatchEvent({type:"sessionend"})}function a(e){for(var t=h.inputSources,r=0;r<g.length;r++)y.set(t[r],g[r]);for(var i=0;i<e.removed.length;i++){var n=e.removed[i],a=y.get(n);a&&(a.dispatchEvent({type:"disconnected",data:n}),y.delete(n))}for(var s=0;s<e.added.length;s++){var o=e.added[s],l=y.get(o);l&&l.dispatchEvent({type:"connected",data:o})}}function s(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}super();var o=this,l=e.state,h=null,c=1,u=null,d="local-floor",p=null,m=null,f=null,v=null,g=[],y=new Map,x=new Ca;x.layers.enable(1),x.viewport=new ai;var b=new Ca;b.layers.enable(2),b.viewport=new ai;var w=[x,b],_=new Qo;_.layers.enable(1),_.layers.enable(2);var M=null,S=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){var t=g[e];return void 0===t&&(t=new tl,g[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){var t=g[e];return void 0===t&&(t=new tl,g[e]=t),t.getGripSpace()},this.getHand=function(e){var t=g[e];return void 0===t&&(t=new tl,g[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){c=e,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){d=e,!0===o.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u},this.getSession=function(){return h},this.setSession=function(){var e=n((function*(e){if(null!==(h=e)){h.addEventListener("select",r),h.addEventListener("selectstart",r),h.addEventListener("selectend",r),h.addEventListener("squeeze",r),h.addEventListener("squeezestart",r),h.addEventListener("squeezeend",r),h.addEventListener("end",i),h.addEventListener("inputsourceschange",a);var n=t.getContextAttributes();if(!0!==n.xrCompatible&&(yield t.makeXRCompatible()),void 0===h.renderState.layers){var s={antialias:n.antialias,alpha:n.alpha,depth:n.depth,stencil:n.stencil,framebufferScaleFactor:c},l=new XRWebGLLayer(h,t,s);h.updateRenderState({baseLayer:l})}else{var p=0;n.depth&&(p=n.stencil?34041:6402);var g={colorFormat:n.alpha?6408:6407,depthFormat:p,scaleFactor:c};m=new XRWebGLBinding(h,t),v=m.createProjectionLayer(g),f=t.createFramebuffer(),h.updateRenderState({layers:[v]})}u=yield h.requestReferenceSpace(d),L.setContext(h),L.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}}));return function(t){return e.apply(this,arguments)}}();var T=new ci,E=new ci;this.updateCamera=function(e){if(null!==h){_.near=b.near=x.near=e.near,_.far=b.far=x.far=e.far,(M!==_.near||S!==_.far)&&(h.updateRenderState({depthNear:_.near,depthFar:_.far}),M=_.near,S=_.far);var t=e.parent,r=_.cameras;s(_,t);for(var i=0;i<r.length;i++)s(r[i],t);_.matrixWorld.decompose(_.position,_.quaternion,_.scale),e.position.copy(_.position),e.quaternion.copy(_.quaternion),e.scale.copy(_.scale),e.matrix.copy(_.matrix),e.matrixWorld.copy(_.matrixWorld);for(var n=e.children,a=0,o=n.length;a<o;a++)n[a].updateMatrixWorld(!0);2===r.length?function(e,t,r){T.setFromMatrixPosition(t.matrixWorld),E.setFromMatrixPosition(r.matrixWorld);var i=T.distanceTo(E),n=t.projectionMatrix.elements,a=r.projectionMatrix.elements,s=n[14]/(n[10]-1),o=n[14]/(n[10]+1),l=(n[9]+1)/n[5],h=(n[9]-1)/n[5],c=(n[8]-1)/n[0],u=(a[8]+1)/a[0],d=s*c,p=s*u,m=i/(-c+u),f=m*-c;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();var v=s+m,g=o+m,y=d-f,x=p+(i-f),b=l*o/g*v,w=h*o/g*v;e.projectionMatrix.makePerspective(y,x,b,w,v,g)}(_,x,b):_.projectionMatrix.copy(x.projectionMatrix)}},this.getCamera=function(){return _};var A=null,L=new Ha;L.setAnimationLoop((function(e,r){if(null!==(p=r.getViewerPose(u))){var i=p.views,n=h.renderState.baseLayer;void 0===h.renderState.layers&&l.bindXRFramebuffer(n.framebuffer);var a=!1;i.length!==_.cameras.length&&(_.cameras.length=0,a=!0);for(var s=0;s<i.length;s++){var o=i[s],c=null;if(void 0===h.renderState.layers)c=n.getViewport(o);else{var d=m.getViewSubImage(v,o);l.bindXRFramebuffer(f),t.framebufferTexture2D(36160,36064,3553,d.colorTexture,0),void 0!==d.depthStencilTexture&&t.framebufferTexture2D(36160,36096,3553,d.depthStencilTexture,0),c=d.viewport}var y=w[s];y.matrix.fromArray(o.transform.matrix),y.projectionMatrix.fromArray(o.projectionMatrix),y.viewport.set(c.x,c.y,c.width,c.height),0==s&&_.matrix.copy(y.matrix),!0===a&&_.cameras.push(y)}}for(var x=h.inputSources,b=0;b<g.length;b++){var M=g[b],S=x[b];M.update(S,r,u)}A&&A(e,r)})),this.setAnimationLoop=function(e){A=e},this.dispose=function(){}}}function il(e){function t(t,r){t.opacity.value=r.opacity,r.color&&t.diffuse.value.copy(r.color),r.emissive&&t.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(t.map.value=r.map),r.alphaMap&&(t.alphaMap.value=r.alphaMap),r.specularMap&&(t.specularMap.value=r.specularMap);var i,n,a=e.get(r).envMap;if(a){t.envMap.value=a,t.flipEnvMap.value=a.isCubeTexture&&a._needsFlipEnvMap?-1:1,t.reflectivity.value=r.reflectivity,t.refractionRatio.value=r.refractionRatio;var s=e.get(a).__maxMipLevel;void 0!==s&&(t.maxMipLevel.value=s)}r.lightMap&&(t.lightMap.value=r.lightMap,t.lightMapIntensity.value=r.lightMapIntensity),r.aoMap&&(t.aoMap.value=r.aoMap,t.aoMapIntensity.value=r.aoMapIntensity),r.map?i=r.map:r.specularMap?i=r.specularMap:r.displacementMap?i=r.displacementMap:r.normalMap?i=r.normalMap:r.bumpMap?i=r.bumpMap:r.roughnessMap?i=r.roughnessMap:r.metalnessMap?i=r.metalnessMap:r.alphaMap?i=r.alphaMap:r.emissiveMap?i=r.emissiveMap:r.clearcoatMap?i=r.clearcoatMap:r.clearcoatNormalMap?i=r.clearcoatNormalMap:r.clearcoatRoughnessMap&&(i=r.clearcoatRoughnessMap),void 0!==i&&(i.isWebGLRenderTarget&&(i=i.texture),!0===i.matrixAutoUpdate&&i.updateMatrix(),t.uvTransform.value.copy(i.matrix)),r.aoMap?n=r.aoMap:r.lightMap&&(n=r.lightMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uv2Transform.value.copy(n.matrix))}function r(t,r){t.roughness.value=r.roughness,t.metalness.value=r.metalness,r.roughnessMap&&(t.roughnessMap.value=r.roughnessMap),r.metalnessMap&&(t.metalnessMap.value=r.metalnessMap),r.emissiveMap&&(t.emissiveMap.value=r.emissiveMap),r.bumpMap&&(t.bumpMap.value=r.bumpMap,t.bumpScale.value=r.bumpScale,r.side===y&&(t.bumpScale.value*=-1)),r.normalMap&&(t.normalMap.value=r.normalMap,t.normalScale.value.copy(r.normalScale),r.side===y&&t.normalScale.value.negate()),r.displacementMap&&(t.displacementMap.value=r.displacementMap,t.displacementScale.value=r.displacementScale,t.displacementBias.value=r.displacementBias),e.get(r).envMap&&(t.envMapIntensity.value=r.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,n,a,s){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,t.side===y&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===y&&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,t.side===y&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===y&&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,i){r(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,t.side===y&&e.clearcoatNormalScale.value.negate()),e.transmission.value=t.transmission,t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap),0<t.transmission&&(e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)}(e,i,s):r(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,t.side===y&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===y&&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,t.side===y&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===y&&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,r,i){var n;e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=.5*i,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,n,a):i.isSpriteMaterial?function(e,t){var r;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?r=t.map:t.alphaMap&&(r=t.alphaMap),void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),e.uvTransform.value.copy(r.matrix))}(e,i):i.isShadowMaterial?(e.color.value.copy(i.color),e.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function nl(){function e(){return null===se?me:1}function t(e,t){for(var r=0;r<e.length;r++){var i=e[r],n=v.getContext(i,t);if(null!==n)return n}return null}function r(){O=new es(Ie),D=new Ka(Ie,O,f),O.init(D),$=new Ko(Ie,O,D),N=new Yo(Ie,O,D),_e[0]=1029,B=new is(Ie),U=new Oo,z=new Jo(Ie,O,N,U,D,$,B),F=new $a(re),G=new ka(Ie,D),ee=new Ya(Ie,O,G,D),V=new ts(Ie,G,B,ee),H=new os(Ie,V,G,B),J=new ss(Ie),q=new Qa(U),k=new Io(re,F,O,D,ee,q),j=new il(U),W=new Uo(U),Z=new ko(O,D),Y=new Xa(re,F,N,H,T),X=new Xo(re,H,D),K=new Ja(Ie,O,B,D),Q=new rs(Ie,O,B,D),B.programs=k.programs,re.capabilities=D,re.extensions=O,re.properties=U,re.renderLists=W,re.shadowMap=X,re.state=N,re.info=B}function i(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),ie=!0}function n(){console.log("THREE.WebGLRenderer: Context Restored."),ie=!1;var e=B.autoReset,t=X.enabled,i=X.autoUpdate,n=X.needsUpdate,a=X.type;r(),B.autoReset=e,X.enabled=t,X.autoUpdate=i,X.needsUpdate=n,X.type=a}function a(e){var t=e.target;t.removeEventListener("dispose",a),function(e){(function(e){var t=U.get(e).programs;void 0!==t&&t.forEach((function(e){k.releaseProgram(e)}))})(e),U.remove(e)}(t)}function s(){Fe.stop()}function o(){Fe.start()}function l(e,t,r,i){if(!1!==e.visible){if(e.layers.test(t.layers))if(e.isGroup)r=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)C.pushLight(e),e.castShadow&&C.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||Me.intersectsSprite(e)){i&&Ce.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Re);var n=H.update(e),a=e.material;a.visible&&R.push(e,n,a,r,Ce.z,null)}}else if(e.isImmediateRenderObject)i&&Ce.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Re),R.push(e,null,e.material,r,Ce.z,null);else if((e.isMesh||e.isLine||e.isPoints)&&(e.isSkinnedMesh&&e.skeleton.frame!==B.render.frame&&(e.skeleton.update(),e.skeleton.frame=B.render.frame),!e.frustumCulled||Me.intersectsObject(e))){i&&Ce.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Re);var s=H.update(e),o=e.material;if(Array.isArray(o))for(var h=s.groups,c=0,u=h.length;c<u;c++){var d=h[c],p=o[d.materialIndex];p&&p.visible&&R.push(e,s,p,r,Ce.z,d)}else o.visible&&R.push(e,s,o,r,Ce.z,null)}for(var m=e.children,f=0,v=m.length;f<v;f++)l(m[f],t,r,i)}}function h(e,t,r){for(var i=!0===t.isScene?t.overrideMaterial:null,n=0,a=e.length;n<a;n++){var s=e[n],o=s.object,l=s.geometry,h=null===i?s.material:i,u=s.group;if(r.isArrayCamera)for(var d,p=r.cameras,m=0,f=p.length;m<f;m++)d=p[m],o.layers.test(d.layers)&&(N.viewport(he.copy(d.viewport)),C.setupLightsView(d),c(o,t,d,l,h,u));else c(o,t,r,l,h,u)}}function c(e,t,r,i,n,a){if(e.onBeforeRender(re,t,r,i,n,a),e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),e.isImmediateRenderObject){var s=p(r,t,n,e);N.setMaterial(n),ee.reset(),function(e,t){e.render((function(e){re.renderBufferImmediate(e,t)}))}(e,s)}else!0===n.transparent&&n.side===x?(n.side=y,n.needsUpdate=!0,re.renderBufferDirect(r,t,i,n,e,a),n.side=g,n.needsUpdate=!0,re.renderBufferDirect(r,t,i,n,e,a),n.side=x):re.renderBufferDirect(r,t,i,n,e,a);e.onAfterRender(re,t,r,i,n,a)}function u(e,t,r){!0!==t.isScene&&(t=Pe);var i=U.get(e),n=C.state.lights,s=C.state.shadowsArray,o=n.state.version,l=k.getParameters(e,n.state,s,t,r),h=k.getProgramCacheKey(l),c=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=F.get(e.envMap||i.environment),void 0===c&&(e.addEventListener("dispose",a),c=new Map,i.programs=c);var u=c.get(h);if(void 0===u)l.uniforms=k.getUniforms(e),e.onBuild(l,re),e.onBeforeCompile(l,re),u=k.acquireProgram(l,h),c.set(h,u),i.uniforms=l.uniforms;else if(i.currentProgram===u&&i.lightsStateVersion===o)return d(e,l),u;var p=i.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(p.clippingPlanes=q.uniform),d(e,l),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&&(p.ambientLightColor.value=n.state.ambient,p.lightProbe.value=n.state.probe,p.directionalLights.value=n.state.directional,p.directionalLightShadows.value=n.state.directionalShadow,p.spotLights.value=n.state.spot,p.spotLightShadows.value=n.state.spotShadow,p.rectAreaLights.value=n.state.rectArea,p.ltc_1.value=n.state.rectAreaLTC1,p.ltc_2.value=n.state.rectAreaLTC2,p.pointLights.value=n.state.point,p.pointLightShadows.value=n.state.pointShadow,p.hemisphereLights.value=n.state.hemi,p.directionalShadowMap.value=n.state.directionalShadowMap,p.directionalShadowMatrix.value=n.state.directionalShadowMatrix,p.spotShadowMap.value=n.state.spotShadowMap,p.spotShadowMatrix.value=n.state.spotShadowMatrix,p.pointShadowMap.value=n.state.pointShadowMap,p.pointShadowMatrix.value=n.state.pointShadowMatrix);var m=u.getUniforms(),f=uo.seqWithValue(m.seq,p);return i.currentProgram=u,i.uniformsList=f,u}function d(e,t){var r=U.get(e);r.outputEncoding=t.outputEncoding,r.instancing=t.instancing,r.skinning=t.skinning,r.numClippingPlanes=t.numClippingPlanes,r.numIntersection=t.numClipIntersection,r.vertexAlphas=t.vertexAlphas}function p(e,t,r,i){!0!==t.isScene&&(t=Pe),z.resetTextureUnits();var n=t.fog,a=r.isMeshStandardMaterial?t.environment:null,s=null===se?re.outputEncoding:se.texture.encoding,o=F.get(r.envMap||a),l=!0===r.vertexColors&&i.geometry&&i.geometry.attributes.color&&4===i.geometry.attributes.color.itemSize,h=U.get(r),c=C.state.lights;if(!0===Se&&(!0===Ee||e!==le)){var d=e===le&&r.id===oe;q.setState(r,e,d)}var p=!1;r.version===h.__version?h.needsLights&&h.lightsStateVersion!==c.state.version?p=!0:h.outputEncoding===s?i.isInstancedMesh&&!1===h.instancing?p=!0:i.isInstancedMesh||!0!==h.instancing?i.isSkinnedMesh&&!1===h.skinning||!i.isSkinnedMesh&&!0===h.skinning||h.envMap!==o||r.fog&&h.fog!==n?p=!0:void 0===h.numClippingPlanes||h.numClippingPlanes===q.numPlanes&&h.numIntersection===q.numIntersection?h.vertexAlphas!==l&&(p=!0):p=!0:p=!0:p=!0:(p=!0,h.__version=r.version);var m=h.currentProgram;1==p&&(m=u(r,t,i));var f,v,g=!1,y=!1,x=!1,b=m.getUniforms(),w=h.uniforms;if(N.useProgram(m.program)&&(g=!0,y=!0,x=!0),r.id!==oe&&(oe=r.id,y=!0),g||le!==e){if(b.setValue(Ie,"projectionMatrix",e.projectionMatrix),D.logarithmicDepthBuffer&&b.setValue(Ie,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),le!==e&&(le=e,y=!0,x=!0),r.isShaderMaterial||r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshStandardMaterial||r.envMap){var _=b.map.cameraPosition;void 0!==_&&_.setValue(Ie,Ce.setFromMatrixPosition(e.matrixWorld))}(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&b.setValue(Ie,"isOrthographic",!0===e.isOrthographicCamera),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial||r.isShadowMaterial||i.isSkinnedMesh)&&b.setValue(Ie,"viewMatrix",e.matrixWorldInverse)}if(i.isSkinnedMesh){b.setOptional(Ie,i,"bindMatrix"),b.setOptional(Ie,i,"bindMatrixInverse");var M=i.skeleton;M&&(D.floatVertexTextures?(null===M.boneTexture&&M.computeBoneTexture(),b.setValue(Ie,"boneTexture",M.boneTexture,z),b.setValue(Ie,"boneTextureSize",M.boneTextureSize)):b.setOptional(Ie,M,"boneMatrices"))}return(y||h.receiveShadow!==i.receiveShadow)&&(h.receiveShadow=i.receiveShadow,b.setValue(Ie,"receiveShadow",i.receiveShadow)),y&&(b.setValue(Ie,"toneMappingExposure",re.toneMappingExposure),h.needsLights&&(v=x,(f=w).ambientLightColor.needsUpdate=v,f.lightProbe.needsUpdate=v,f.directionalLights.needsUpdate=v,f.directionalLightShadows.needsUpdate=v,f.pointLights.needsUpdate=v,f.pointLightShadows.needsUpdate=v,f.spotLights.needsUpdate=v,f.spotLightShadows.needsUpdate=v,f.rectAreaLights.needsUpdate=v,f.hemisphereLights.needsUpdate=v),n&&r.fog&&j.refreshFogUniforms(w,n),j.refreshMaterialUniforms(w,r,me,pe,Le),uo.upload(Ie,h.uniformsList,w,z)),r.isShaderMaterial&&!0===r.uniformsNeedUpdate&&(uo.upload(Ie,h.uniformsList,w,z),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&b.setValue(Ie,"center",i.center),b.setValue(Ie,"modelViewMatrix",i.modelViewMatrix),b.setValue(Ie,"normalMatrix",i.normalMatrix),b.setValue(Ie,"modelMatrix",i.matrixWorld),m}var m,f=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},v=void 0===f.canvas?((m=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")).style.display="block",m):f.canvas,b=void 0===f.context?null:f.context,w=void 0!==f.alpha&&f.alpha,_=!(void 0!==f.depth)||f.depth,M=!(void 0!==f.stencil)||f.stencil,S=void 0!==f.antialias&&f.antialias,T=!(void 0!==f.premultipliedAlpha)||f.premultipliedAlpha,E=void 0!==f.preserveDrawingBuffer&&f.preserveDrawingBuffer,A=void 0===f.powerPreference?"default":f.powerPreference,L=void 0!==f.failIfMajorPerformanceCaveat&&f.failIfMajorPerformanceCaveat,R=null,C=null,P=[],I=[];this.domElement=v,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=$t,this.physicallyCorrectLights=!1,this.toneMapping=te,this.toneMappingExposure=1;var O,D,N,B,U,z,F,G,V,H,k,j,W,Z,q,X,Y,J,K,Q,$,ee,re=this,ie=!1,ne=0,ae=0,se=null,oe=-1,le=null,he=new ai,ce=new ai,ue=null,de=v.width,pe=v.height,me=1,ve=null,ye=null,xe=new ai(0,0,de,pe),be=new ai(0,0,de,pe),we=!1,_e=[],Me=new Va,Se=!1,Ee=!1,Le=null,Re=new Vi,Ce=new ci,Pe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},Ie=b;try{var Ne={alpha:w,depth:_,stencil:M,antialias:S,premultipliedAlpha:T,preserveDrawingBuffer:E,powerPreference:A,failIfMajorPerformanceCaveat:L};if(v.addEventListener("webglcontextlost",i,!1),v.addEventListener("webglcontextrestored",n,!1),null===Ie){var Be=["webgl2","webgl","experimental-webgl"];if(!0===re.isWebGL1Renderer&&Be.shift(),null===(Ie=t(Be,Ne)))throw t(Be)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===Ie.getShaderPrecisionFormat&&(Ie.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}r();var Ue=new rl(re,Ie);this.xr=Ue,this.getContext=function(){return Ie},this.getContextAttributes=function(){return Ie.getContextAttributes()},this.forceContextLoss=function(){var e=O.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){var e=O.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return me},this.setPixelRatio=function(e){void 0===e||(me=e,this.setSize(de,pe,!1))},this.getSize=function(e){return e.set(de,pe)},this.setSize=function(e,t,r){return Ue.isPresenting?void console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(de=e,pe=t,v.width=Math.floor(e*me),v.height=Math.floor(t*me),!1!==r&&(v.style.width=e+"px",v.style.height=t+"px"),void this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(de*me,pe*me).floor()},this.setDrawingBufferSize=function(e,t,r){de=e,pe=t,me=r,v.width=Math.floor(e*r),v.height=Math.floor(t*r),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(he)},this.getViewport=function(e){return e.copy(xe)},this.setViewport=function(e,t,r,i){e.isVector4?xe.set(e.x,e.y,e.z,e.w):xe.set(e,t,r,i),N.viewport(he.copy(xe).multiplyScalar(me).floor())},this.getScissor=function(e){return e.copy(be)},this.setScissor=function(e,t,r,i){e.isVector4?be.set(e.x,e.y,e.z,e.w):be.set(e,t,r,i),N.scissor(ce.copy(be).multiplyScalar(me).floor())},this.getScissorTest=function(){return we},this.setScissorTest=function(e){N.setScissorTest(we=e)},this.setOpaqueSort=function(e){ve=e},this.setTransparentSort=function(e){ye=e},this.getClearColor=function(e){return e.copy(Y.getClearColor())},this.setClearColor=function(){Y.setClearColor.apply(Y,arguments)},this.getClearAlpha=function(){return Y.getClearAlpha()},this.setClearAlpha=function(){Y.setClearAlpha.apply(Y,arguments)},this.clear=function(e,t,r){var i=0;(void 0===e||e)&&(i|=16384),(void 0===t||t)&&(i|=256),(void 0===r||r)&&(i|=1024),Ie.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(){v.removeEventListener("webglcontextlost",i,!1),v.removeEventListener("webglcontextrestored",n,!1),W.dispose(),Z.dispose(),U.dispose(),F.dispose(),H.dispose(),ee.dispose(),Ue.dispose(),Ue.removeEventListener("sessionstart",s),Ue.removeEventListener("sessionend",o),Le&&(Le.dispose(),Le=null),Fe.stop()},this.renderBufferImmediate=function(e,t){ee.initAttributes();var r=U.get(e);e.hasPositions&&!r.position&&(r.position=Ie.createBuffer()),e.hasNormals&&!r.normal&&(r.normal=Ie.createBuffer()),e.hasUvs&&!r.uv&&(r.uv=Ie.createBuffer()),e.hasColors&&!r.color&&(r.color=Ie.createBuffer());var i=t.getAttributes();e.hasPositions&&(Ie.bindBuffer(34962,r.position),Ie.bufferData(34962,e.positionArray,35048),ee.enableAttribute(i.position),Ie.vertexAttribPointer(i.position,3,5126,!1,0,0)),e.hasNormals&&(Ie.bindBuffer(34962,r.normal),Ie.bufferData(34962,e.normalArray,35048),ee.enableAttribute(i.normal),Ie.vertexAttribPointer(i.normal,3,5126,!1,0,0)),e.hasUvs&&(Ie.bindBuffer(34962,r.uv),Ie.bufferData(34962,e.uvArray,35048),ee.enableAttribute(i.uv),Ie.vertexAttribPointer(i.uv,2,5126,!1,0,0)),e.hasColors&&(Ie.bindBuffer(34962,r.color),Ie.bufferData(34962,e.colorArray,35048),ee.enableAttribute(i.color),Ie.vertexAttribPointer(i.color,3,5126,!1,0,0)),ee.disableUnusedAttributes(),Ie.drawArrays(4,0,e.count),e.count=0},this.renderBufferDirect=function(t,r,i,n,a,s){null===r&&(r=Pe);var o=a.isMesh&&0>a.matrixWorld.determinant(),l=p(t,r,n,a);N.setMaterial(n,o);var h=i.index,c=i.attributes.position;if(null===h){if(void 0===c||0===c.count)return}else if(0===h.count)return;var u=1;!0===n.wireframe&&(h=V.getWireframeAttribute(i),u=2),(n.morphTargets||n.morphNormals)&&J.update(a,i,n,l),ee.setup(a,n,l,i,h);var d,m=K;null!==h&&(d=G.get(h),(m=Q).setIndex(d));var f=null===h?c.count:h.count,v=i.drawRange.start*u,g=i.drawRange.count*u,y=null===s?0:s.start*u,x=null===s?1/0:s.count*u,b=Math.max(v,y),w=Math.min(f,v+g,y+x)-1,_=Math.max(0,w-b+1);if(0!==_){if(a.isMesh)!0===n.wireframe?(N.setLineWidth(n.wireframeLinewidth*e()),m.setMode(1)):m.setMode(4);else if(a.isLine){var M=n.linewidth;void 0===M&&(M=1),N.setLineWidth(M*e()),a.isLineSegments?m.setMode(1):a.isLineLoop?m.setMode(2):m.setMode(3)}else a.isPoints?m.setMode(0):a.isSprite&&m.setMode(4);if(a.isInstancedMesh)m.renderInstances(b,_,a.count);else if(i.isInstancedBufferGeometry){var S=Math.min(i.instanceCount,i._maxInstanceCount);m.renderInstances(b,_,S)}else m.render(b,_)}},this.compile=function(e,t){(C=Z.get(e)).init(),e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(C.pushLight(e),e.castShadow&&C.pushShadow(e))})),C.setupLights(),e.traverse((function(t){var r=t.material;if(r)if(Array.isArray(r))for(var i=0;i<r.length;i++)u(r[i],e,t);else u(r,e,t)}))};var ze=null,Fe=new Ha;Fe.setAnimationLoop((function(e){ze&&ze(e)})),"undefined"!=typeof window&&Fe.setContext(window),this.setAnimationLoop=function(e){ze=e,Ue.setAnimationLoop(e),null===e?Fe.stop():Fe.start()},Ue.addEventListener("sessionstart",s),Ue.addEventListener("sessionend",o),this.render=function(e,t){if(void 0===t||!0===t.isCamera){if(!0!==ie){!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),!0===Ue.enabled&&!0===Ue.isPresenting&&(!0===Ue.cameraAutoUpdate&&Ue.updateCamera(t),t=Ue.getCamera()),!0===e.isScene&&e.onBeforeRender(re,e,t,se),(C=Z.get(e,I.length)).init(),I.push(C),Re.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),Me.setFromProjectionMatrix(Re),Ee=this.localClippingEnabled,Se=q.init(this.clippingPlanes,Ee,t),(R=W.get(e,P.length)).init(),P.push(R),l(e,t,0,re.sortObjects),R.finish(),!0===re.sortObjects&&R.sort(ve,ye),!0===Se&&q.beginShadows();var r=C.state.shadowsArray;X.render(r,e,t),C.setupLights(),C.setupLightsView(t),!0===Se&&q.endShadows(),!0===this.info.autoReset&&this.info.reset(),Y.render(R,e);var i=R.opaque,n=R.transmissive,a=R.transparent;0<i.length&&h(i,e,t),0<n.length&&function(e,t,r,i){if(null===Le){var n=!0===S&&!0===D.isWebGL2;Le=new(n?li:si)(1024,1024,{generateMipmaps:!0,type:null===$.convert(De)?Ae:De,minFilter:Te,magFilter:ge,wrapS:fe,wrapT:fe})}var a=re.getRenderTarget();re.setRenderTarget(Le),re.clear();var s=re.toneMapping;re.toneMapping=te,h(e,r,i),re.toneMapping=s,z.updateMultisampleRenderTarget(Le),z.updateRenderTargetMipmap(Le),re.setRenderTarget(a),h(t,r,i)}(i,n,e,t),0<a.length&&h(a,e,t),null!==se&&(z.updateMultisampleRenderTarget(se),z.updateRenderTargetMipmap(se)),!0===e.isScene&&e.onAfterRender(re,e,t),N.buffers.depth.setTest(!0),N.buffers.depth.setMask(!0),N.buffers.color.setMask(!0),N.setPolygonOffset(!1),ee.resetDefaultState(),oe=-1,le=null,I.pop(),C=0<I.length?I[I.length-1]:null,P.pop(),R=0<P.length?P[P.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return ne},this.getActiveMipmapLevel=function(){return ae},this.getRenderTarget=function(){return se},this.setRenderTarget=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;se=e,ne=t,ae=r,e&&void 0===U.get(e).__webglFramebuffer&&z.setupRenderTarget(e);var i=null,n=!1,a=!1;if(e){var s=e.texture;(s.isDataTexture3D||s.isDataTexture2DArray)&&(a=!0);var o=U.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=o[t],n=!0):i=e.isWebGLMultisampleRenderTarget?U.get(e).__webglMultisampledFramebuffer:o,he.copy(e.viewport),ce.copy(e.scissor),ue=e.scissorTest}else he.copy(xe).multiplyScalar(me).floor(),ce.copy(be).multiplyScalar(me).floor(),ue=we;if(N.bindFramebuffer(36160,i)&&D.drawBuffers){var l=!1;if(e)if(e.isWebGLMultipleRenderTargets){var h=e.texture;if(_e.length!==h.length||36064!==_e[0]){for(var c=0,u=h.length;c<u;c++)_e[c]=36064+c;_e.length=h.length,l=!0}}else(1!==_e.length||36064!==_e[0])&&(_e[0]=36064,_e.length=1,l=!0);else(1!==_e.length||1029!==_e[0])&&(_e[0]=1029,_e.length=1,l=!0);l&&(D.isWebGL2?Ie.drawBuffers(_e):O.get("WEBGL_draw_buffers").drawBuffersWEBGL(_e))}if(N.viewport(he),N.scissor(ce),N.setScissorTest(ue),n){var d=U.get(e.texture);Ie.framebufferTexture2D(36160,36064,34069+t,d.__webglTexture,r)}else if(a){var p=U.get(e.texture),m=t||0;Ie.framebufferTextureLayer(36160,36064,p.__webglTexture,r||0,m)}},this.readRenderTargetPixels=function(e,t,r,i,n,a,s){if(e&&e.isWebGLRenderTarget){var o=U.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){N.bindFramebuffer(36160,o);try{var l=e.texture,h=l.format,c=l.type;if(h!==Ve&&$.convert(h)!==Ie.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");var u=c===De&&(O.has("EXT_color_buffer_half_float")||D.isWebGL2&&O.has("EXT_color_buffer_float"));if(!(c===Ae||$.convert(c)===Ie.getParameter(35738)||c===Oe&&(D.isWebGL2||O.has("OES_texture_float")||O.has("WEBGL_color_buffer_float"))||u))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===Ie.checkFramebufferStatus(36160)?0<=t&&t<=e.width-i&&0<=r&&r<=e.height-n&&Ie.readPixels(t,r,i,n,$.convert(h),$.convert(c),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{var d=null===se?null:U.get(se).__webglFramebuffer;N.bindFramebuffer(36160,d)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=Math.pow(2,-r),n=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),s=$.convert(t.format);D.isWebGL2&&(6407===s&&(s=32849),6408===s&&(s=32856)),z.setTexture2D(t,0),Ie.copyTexImage2D(3553,r,s,e.x,e.y,n,a,0),N.unbindTexture()},this.copyTextureToTexture=function(e,t,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,n=t.image.width,a=t.image.height,s=$.convert(r.format),o=$.convert(r.type);z.setTexture2D(r,0),Ie.pixelStorei(37440,r.flipY),Ie.pixelStorei(37441,r.premultiplyAlpha),Ie.pixelStorei(3317,r.unpackAlignment),t.isDataTexture?Ie.texSubImage2D(3553,i,e.x,e.y,n,a,s,o,t.image.data):t.isCompressedTexture?Ie.compressedTexSubImage2D(3553,i,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,s,t.mipmaps[0].data):Ie.texSubImage2D(3553,i,e.x,e.y,s,o,t.image),0===i&&r.generateMipmaps&&Ie.generateMipmap(3553),N.unbindTexture()},this.copyTextureToTexture3D=function(e,t,r,i){var n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0;if(re.isWebGL1Renderer)console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");else{var a,s=e.max.x-e.min.x+1,o=e.max.y-e.min.y+1,l=e.max.z-e.min.z+1,h=$.convert(i.format),c=$.convert(i.type);if(i.isDataTexture3D)z.setTexture3D(i,0),a=32879;else{if(!i.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");z.setTexture2DArray(i,0),a=35866}Ie.pixelStorei(37440,i.flipY),Ie.pixelStorei(37441,i.premultiplyAlpha),Ie.pixelStorei(3317,i.unpackAlignment);var u=Ie.getParameter(3314),d=Ie.getParameter(32878),p=Ie.getParameter(3316),m=Ie.getParameter(3315),f=Ie.getParameter(32877),v=r.isCompressedTexture?r.mipmaps[0]:r.image;Ie.pixelStorei(3314,v.width),Ie.pixelStorei(32878,v.height),Ie.pixelStorei(3316,e.min.x),Ie.pixelStorei(3315,e.min.y),Ie.pixelStorei(32877,e.min.z),r.isDataTexture||r.isDataTexture3D?Ie.texSubImage3D(a,n,t.x,t.y,t.z,s,o,l,h,c,v.data):r.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Ie.compressedTexSubImage3D(a,n,t.x,t.y,t.z,s,o,l,h,v.data)):Ie.texSubImage3D(a,n,t.x,t.y,t.z,s,o,l,h,c,v),Ie.pixelStorei(3314,u),Ie.pixelStorei(32878,d),Ie.pixelStorei(3316,p),Ie.pixelStorei(3315,m),Ie.pixelStorei(32877,f),0===n&&i.generateMipmaps&&Ie.generateMipmap(a),N.unbindTexture()}},this.initTexture=function(e){z.setTexture2D(e,0),N.unbindTexture()},this.resetState=function(){ne=0,ae=0,se=null,N.reset(),ee.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class al extends nl{}al.prototype.isWebGL1Renderer=!0;class sl{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:25e-5;this.name="",this.color=new On(e),this.density=t}clone(){return new sl(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}sl.prototype.isFogExp2=!0;class ol{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1e3;this.name="",this.color=new On(e),this.near=t,this.far=r}clone(){return new ol(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}ol.prototype.isFog=!0;class ll extends pn{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){var t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),t}}ll.prototype.isScene=!0;class hl{constructor(e,t){this.array=e,this.stride=t,this.count=void 0===e?0:e.length/t,this.usage=Ar,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=jr()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(var i=0,n=this.stride;i<n;i++)this.array[e+i]=t.array[r+i];return this}set(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=jr()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);var t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=jr()),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}}}hl.prototype.isInterleavedBuffer=!0;var cl=new ci;class ul{constructor(e,t,r){var i=!!(3<arguments.length&&void 0!==arguments[3])&&arguments[3];this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=!0===i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(var t=0,r=this.data.count;t<r;t++)cl.x=this.getX(t),cl.y=this.getY(t),cl.z=this.getZ(t),cl.applyMatrix4(e),this.setXYZ(t,cl.x,cl.y,cl.z);return this}applyNormalMatrix(e){for(var t=0,r=this.count;t<r;t++)cl.x=this.getX(t),cl.y=this.getY(t),cl.z=this.getZ(t),cl.applyNormalMatrix(e),this.setXYZ(t,cl.x,cl.y,cl.z);return this}transformDirection(e){for(var t=0,r=this.count;t<r;t++)cl.x=this.getX(t),cl.y=this.getY(t),cl.z=this.getZ(t),cl.transformDirection(e),this.setXYZ(t,cl.x,cl.y,cl.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this}setXYZW(e,t,r,i,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=i,this.data.array[e+3]=n,this}clone(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var t,r=[],i=0;i<this.count;i++){t=i*this.data.stride+this.offset;for(var n=0;n<this.itemSize;n++)r.push(this.data.array[t+n])}return new Un(new this.array.constructor(r),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 ul(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var t,r=[],i=0;i<this.count;i++){t=i*this.data.stride+this.offset;for(var n=0;n<this.itemSize;n++)r.push(this.data.array[t+n])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:r,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}}}ul.prototype.isInterleavedBufferAttribute=!0;class dl extends En{constructor(e){super(),this.type="SpriteMaterial",this.color=new On(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this}}dl.prototype.isSpriteMaterial=!0;var pl,ml=new ci,fl=new ci,vl=new ci,gl=new $r,yl=new $r,xl=new Vi,bl=new ci,wl=new ci,_l=new ci,Ml=new $r,Sl=new $r,Tl=new $r;class El extends pn{constructor(e){if(super(),this.type="Sprite",void 0===pl){pl=new na;var t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new hl(t,5);pl.setIndex([0,1,2,0,2,3]),pl.setAttribute("position",new ul(r,3,0,!1)),pl.setAttribute("uv",new ul(r,2,3,!1))}this.geometry=pl,this.material=void 0===e?new dl:e,this.center=new $r(.5,.5)}raycast(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),fl.setFromMatrixScale(this.matrixWorld),xl.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),vl.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&fl.multiplyScalar(-vl.z);var r,i,n=this.material.rotation;0!==n&&(i=Math.cos(n),r=Math.sin(n));var a=this.center;Al(bl.set(-.5,-.5,0),vl,a,fl,r,i),Al(wl.set(.5,-.5,0),vl,a,fl,r,i),Al(_l.set(.5,.5,0),vl,a,fl,r,i),Ml.set(0,0),Sl.set(1,0),Tl.set(1,1);var s=e.ray.intersectTriangle(bl,wl,_l,!1,ml);if(null!==s||(Al(wl.set(-.5,.5,0),vl,a,fl,r,i),Sl.set(0,1),null!==(s=e.ray.intersectTriangle(bl,_l,wl,!1,ml)))){var o=e.ray.origin.distanceTo(ml);o<e.near||o>e.far||t.push({distance:o,point:ml.clone(),uv:Sn.getUV(ml,bl,wl,_l,Ml,Sl,Tl,new $r),face:null,object:this})}}copy(e){return super.copy(e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Al(e,t,r,i,n,a){gl.subVectors(e,r).addScalar(.5).multiply(i),void 0===n?yl.copy(gl):(yl.x=a*gl.x-n*gl.y,yl.y=n*gl.x+a*gl.y),e.copy(t),e.x+=yl.x,e.y+=yl.y,e.applyMatrix4(xl)}El.prototype.isSprite=!0;var Ll=new ci,Rl=new ci;class Cl extends pn{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);for(var t,r=e.levels,i=0,n=r.length;i<n;i++)t=r[i],this.addLevel(t.object.clone(),t.distance);return this.autoUpdate=e.autoUpdate,this}addLevel(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;t=Math.abs(t);var r,i=this.levels;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){var t=this.levels;if(0<t.length){var r,i;for(r=1,i=t.length;r<i&&!(e<t[r].distance);r++);return t[r-1].object}return null}raycast(e,t){if(0<this.levels.length){Ll.setFromMatrixPosition(this.matrixWorld);var r=e.ray.origin.distanceTo(Ll);this.getObjectForDistance(r).raycast(e,t)}}update(e){var t=this.levels;if(1<t.length){Ll.setFromMatrixPosition(e.matrixWorld),Rl.setFromMatrixPosition(this.matrixWorld);var r,i,n=Ll.distanceTo(Rl)/e.zoom;for(t[0].object.visible=!0,r=1,i=t.length;r<i&&n>=t[r].distance;r++)t[r-1].object.visible=!1,t[r].object.visible=!0;for(this._currentLevel=r-1;r<i;r++)t[r].object.visible=!1}}toJSON(e){var t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];for(var r,i=this.levels,n=0,a=i.length;n<a;n++)r=i[n],t.object.levels.push({object:r.object.uuid,distance:r.distance});return t}}var Pl=new ci,Il=new ai,Ol=new ai,Dl=new ci,Nl=new Vi;class Bl extends _a{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Vi,this.bindMatrixInverse=new Vi}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){for(var e=new ai,t=this.geometry.attributes.skinWeight,r=0,i=t.count;r<i;r++){e.x=t.getX(r),e.y=t.getY(r),e.z=t.getZ(r),e.w=t.getW(r);var n=1/e.manhattanLength();n==1/0?e.set(1,0,0,0):e.multiplyScalar(n),t.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){var r=this.skeleton,i=this.geometry;Il.fromBufferAttribute(i.attributes.skinIndex,e),Ol.fromBufferAttribute(i.attributes.skinWeight,e),Pl.fromBufferAttribute(i.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(var n,a=0;4>a;a++)if(0!==(n=Ol.getComponent(a))){var s=Il.getComponent(a);Nl.multiplyMatrices(r.bones[s].matrixWorld,r.boneInverses[s]),t.addScaledVector(Dl.copy(Pl).applyMatrix4(Nl),n)}return t.applyMatrix4(this.bindMatrixInverse)}}Bl.prototype.isSkinnedMesh=!0;class Ul extends pn{constructor(){super(),this.type="Bone"}}Ul.prototype.isBone=!0;class zl extends ii{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=8<arguments.length&&void 0!==arguments[8]?arguments[8]:ge,n=9<arguments.length&&void 0!==arguments[9]?arguments[9]:ge;super(null,5<arguments.length?arguments[5]:void 0,6<arguments.length?arguments[6]:void 0,7<arguments.length?arguments[7]:void 0,i,n,3<arguments.length?arguments[3]:void 0,4<arguments.length?arguments[4]:void 0,10<arguments.length?arguments[10]:void 0,11<arguments.length?arguments[11]:void 0),this.image={data:e,width:t,height:r},this.magFilter=i,this.minFilter=n,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}zl.prototype.isDataTexture=!0;var Fl=new Vi,Gl=new Vi;class Vl{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];this.uuid=jr(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){var e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(var r=0,i=this.bones.length;r<i;r++)this.boneInverses.push(new Vi)}}calculateInverses(){this.boneInverses.length=0;for(var e,t=0,r=this.bones.length;t<r;t++)e=new Vi,this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}pose(){for(var e,t=0,r=this.bones.length;t<r;t++)(e=this.bones[t])&&e.matrixWorld.copy(this.boneInverses[t]).invert();for(var i,n=0,a=this.bones.length;n<a;n++)(i=this.bones[n])&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}update(){for(var e,t=this.bones,r=this.boneInverses,i=this.boneMatrices,n=this.boneTexture,a=0,s=t.length;a<s;a++)e=t[a]?t[a].matrixWorld:Gl,Fl.multiplyMatrices(e,r[a]),Fl.toArray(i,16*a);null!==n&&(n.needsUpdate=!0)}clone(){return new Vl(this.bones,this.boneInverses)}computeBoneTexture(){var e=Math.sqrt(4*this.bones.length);e=Yr(e),e=Math.max(e,4);var t=new Float32Array(e*e*4);t.set(this.boneMatrices);var r=new zl(t,e,e,Ve,Oe);return this.boneMatrices=t,this.boneTexture=r,this.boneTextureSize=e,this}getBoneByName(e){for(var t,r=0,i=this.bones.length;r<i;r++)if((t=this.bones[r]).name===e)return t}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(var r=0,i=e.bones.length;r<i;r++){var n=e.bones[r],a=t[n];void 0===a&&(console.warn("THREE.Skeleton: No bone found with UUID:",n),a=new Ul),this.bones.push(a),this.boneInverses.push((new Vi).fromArray(e.boneInverses[r]))}return this.init(),this}toJSON(){for(var e,t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[],uuid:this.uuid},r=this.bones,i=this.boneInverses,n=0,a=r.length;n<a;n++){e=r[n],t.bones.push(e.uuid);var s=i[n];t.boneInverses.push(s.toArray())}return t}}var Hl=new Vi,kl=new Vi,jl=[],Wl=new _a;class Zl extends _a{constructor(e,t,r){super(e,t),this.instanceMatrix=new Un(new Float32Array(16*r),16),this.instanceColor=null,this.count=r,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}raycast(e,t){var r=this.matrixWorld,i=this.count;if(Wl.geometry=this.geometry,Wl.material=this.material,void 0!==Wl.material)for(var n=0;n<i;n++){this.getMatrixAt(n,Hl),kl.multiplyMatrices(r,Hl),Wl.matrixWorld=kl,Wl.raycast(e,jl);for(var a,s=0,o=jl.length;s<o;s++)(a=jl[s]).instanceId=n,a.object=this,t.push(a);jl.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new Un(new Float32Array(3*this.count),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}Zl.prototype.isInstancedMesh=!0;class ql extends En{constructor(e){super(),this.type="LineBasicMaterial",this.color=new On(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this}}ql.prototype.isLineBasicMaterial=!0;var Xl=new ci,Yl=new ci,Jl=new Vi,Kl=new Gi,Ql=new Ii;class $l extends pn{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new na,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ql;super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[0],i=1,n=t.count;i<n;i++)Xl.fromBufferAttribute(t,i-1),Yl.fromBufferAttribute(t,i),r[i]=r[i-1],r[i]+=Xl.distanceTo(Yl);e.setAttribute("lineDistance",new Zn(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){var r=this.geometry,i=this.matrixWorld,n=e.params.Line.threshold,a=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),Ql.copy(r.boundingSphere),Ql.applyMatrix4(i),Ql.radius+=n,!1!==e.ray.intersectsSphere(Ql)){Jl.copy(i).invert(),Kl.copy(e.ray).applyMatrix4(Jl);var s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=new ci,h=new ci,c=new ci,u=new ci,d=this.isLineSegments?2:1;if(r.isBufferGeometry){var p=r.index,m=r.attributes.position;if(null!==p)for(var f=Math.max(0,a.start),v=Math.min(p.count,a.start+a.count)-1;f<v;f+=d){var g=p.getX(f),y=p.getX(f+1);if(l.fromBufferAttribute(m,g),h.fromBufferAttribute(m,y),!(Kl.distanceSqToSegment(l,h,u,c)>o)){u.applyMatrix4(this.matrixWorld);var x=e.ray.origin.distanceTo(u);x<e.near||x>e.far||t.push({distance:x,point:c.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this})}}else for(var b=Math.max(0,a.start),w=Math.min(m.count,a.start+a.count)-1;b<w;b+=d)if(l.fromBufferAttribute(m,b),h.fromBufferAttribute(m,b+1),!(Kl.distanceSqToSegment(l,h,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:b,face:null,faceIndex:null,object:this})}}else r.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,r=Object.keys(t);if(0<r.length){var i=t[r[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var n,a=0,s=i.length;a<s;a++)n=i[a].name||a+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=a}}}else{var o=e.morphTargets;void 0!==o&&0<o.length&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}$l.prototype.isLine=!0;var eh=new ci,th=new ci;class rh extends $l{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[],i=0,n=t.count;i<n;i+=2)eh.fromBufferAttribute(t,i),th.fromBufferAttribute(t,i+1),r[i]=0==i?0:r[i-1],r[i+1]=r[i]+eh.distanceTo(th);e.setAttribute("lineDistance",new Zn(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}rh.prototype.isLineSegments=!0;class ih extends $l{constructor(e,t){super(e,t),this.type="LineLoop"}}ih.prototype.isLineLoop=!0;class nh extends En{constructor(e){super(),this.type="PointsMaterial",this.color=new On(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}copy(e){return super.copy(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}}nh.prototype.isPointsMaterial=!0;var ah=new Vi,sh=new Gi,oh=new Ii,lh=new ci;class hh extends pn{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new na,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new nh;super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){var r=this.geometry,i=this.matrixWorld,n=e.params.Points.threshold,a=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),oh.copy(r.boundingSphere),oh.applyMatrix4(i),oh.radius+=n,!1!==e.ray.intersectsSphere(oh)){ah.copy(i).invert(),sh.copy(e.ray).applyMatrix4(ah);var s=n/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s;if(r.isBufferGeometry){var l=r.index,h=r.attributes.position;if(null!==l)for(var c,u=Math.max(0,a.start),d=Math.min(l.count,a.start+a.count);u<d;u++)c=l.getX(u),lh.fromBufferAttribute(h,c),ch(lh,c,o,i,e,t,this);else for(var p=Math.max(0,a.start),m=Math.min(h.count,a.start+a.count);p<m;p++)lh.fromBufferAttribute(h,p),ch(lh,p,o,i,e,t,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,r=Object.keys(t);if(0<r.length){var i=t[r[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var n,a=0,s=i.length;a<s;a++)n=i[a].name||a+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=a}}}else{var o=e.morphTargets;void 0!==o&&0<o.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function ch(e,t,r,i,n,a,s){var o=sh.distanceSqToPoint(e);if(o<r){var l=new ci;sh.closestPointToPoint(e,l),l.applyMatrix4(i);var h=n.ray.origin.distanceTo(l);if(h<n.near||h>n.far)return;a.push({distance:h,distanceToRay:Math.sqrt(o),point:l,index:t,face:null,object:s})}}hh.prototype.isPoints=!0;class uh extends ii{constructor(e,t,r,i,n,a,s,o,l){super(e,t,r,i,n,a,s,o,l),this.format=void 0===s?Ge:s,this.minFilter=void 0===a?_e:a,this.magFilter=void 0===n?_e:n,this.generateMipmaps=!1;var h=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback((function t(){h.needsUpdate=!0,e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){var e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}uh.prototype.isVideoTexture=!0;class dh extends ii{constructor(e,t,r,i,n,a,s,o,l,h,c,u){super(null,a,s,o,l,h,i,n,c,u),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}dh.prototype.isCompressedTexture=!0;class ph extends ii{constructor(e,t,r,i,n,a,s,o,l){super(e,t,r,i,n,a,s,o,l),this.needsUpdate=!0}}ph.prototype.isCanvasTexture=!0;class mh extends ii{constructor(e,t,r,i,n,a,s,o,l,h){if((h=void 0===h?We:h)!==We&&h!==Ze)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&h===We&&(r=Ce),void 0===r&&h===Ze&&(r=ze),super(null,i,n,a,s,o,h,r,l),this.image={width:e,height:t},this.magFilter=void 0===s?ge:s,this.minFilter=void 0===o?ge:o,this.flipY=!1,this.generateMipmaps=!1}}mh.prototype.isDepthTexture=!0;class fh extends na{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:8,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:2*Math.PI;super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:r,thetaLength:i},t=Math.max(3,t);var n=[],a=[],s=[],o=[],l=new ci,h=new $r;a.push(0,0,0),s.push(0,0,1),o.push(.5,.5);for(var c,u=0,d=3;u<=t;u++,d+=3)c=r+u/t*i,l.x=e*Math.cos(c),l.y=e*Math.sin(c),a.push(l.x,l.y,l.z),s.push(0,0,1),h.x=(a[d]/e+1)/2,h.y=(a[d+1]/e+1)/2,o.push(h.x,h.y);for(var p=1;p<=t;p++)n.push(p,p+1,0);this.setIndex(n),this.setAttribute("position",new Zn(a,3)),this.setAttribute("normal",new Zn(s,3)),this.setAttribute("uv",new Zn(o,2))}static fromJSON(e){return new fh(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class vh extends na{constructor(){function e(e){for(var i=m,a=new $r,s=new ci,f=0,y=!0===e?t:r,x=!0===e?1:-1,b=1;b<=n;b++)u.push(0,v*x,0),d.push(0,x,0),p.push(.5,.5),m++;for(var w=m,_=0;_<=n;_++){var M=_/n*l+o,S=Math.cos(M),T=Math.sin(M);s.x=y*T,s.y=v*x,s.z=y*S,u.push(s.x,s.y,s.z),d.push(0,x,0),a.x=.5*S+.5,a.y=.5*T*x+.5,p.push(a.x,a.y),m++}for(var E=0;E<n;E++){var A=i+E,L=w+E;!0===e?c.push(L,L+1,A):c.push(L+1,L,A),f+=3}h.addGroup(g,f,!0===e?1:2),g+=f}var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:8,a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:1,s=!!(5<arguments.length&&void 0!==arguments[5])&&arguments[5],o=6<arguments.length&&void 0!==arguments[6]?arguments[6]:0,l=7<arguments.length&&void 0!==arguments[7]?arguments[7]:2*Math.PI;super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:r,height:i,radialSegments:n,heightSegments:a,openEnded:s,thetaStart:o,thetaLength:l};var h=this;n=Math.floor(n),a=Math.floor(a);var c=[],u=[],d=[],p=[],m=0,f=[],v=i/2,g=0;(function(){for(var e=new ci,s=new ci,y=0,x=(r-t)/i,b=0;b<=a;b++){for(var w=[],_=b/a,M=_*(r-t)+t,S=0;S<=n;S++){var T=S/n,E=T*l+o,A=Math.sin(E),L=Math.cos(E);s.x=M*A,s.y=-_*i+v,s.z=M*L,u.push(s.x,s.y,s.z),e.set(A,x,L).normalize(),d.push(e.x,e.y,e.z),p.push(T,1-_),w.push(m++)}f.push(w)}for(var R=0;R<n;R++)for(var C=0;C<a;C++){var P=f[C][R],I=f[C+1][R],O=f[C+1][R+1],D=f[C][R+1];c.push(P,I,D),c.push(I,O,D),y+=6}h.addGroup(g,y,0),g+=y})(),!1===s&&(0<t&&e(!0),0<r&&e(!1)),this.setIndex(c),this.setAttribute("position",new Zn(u,3)),this.setAttribute("normal",new Zn(d,3)),this.setAttribute("uv",new Zn(p,2))}static fromJSON(e){return new vh(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class gh extends vh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:8,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,n=!!(4<arguments.length&&void 0!==arguments[4])&&arguments[4],a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0,s=6<arguments.length&&void 0!==arguments[6]?arguments[6]:2*Math.PI;super(0,e,t,r,i,n,a,s),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:i,openEnded:n,thetaStart:a,thetaLength:s}}static fromJSON(e){return new gh(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class yh extends na{constructor(e,t){function r(e,t,r,n){for(var a=n+1,s=[],o=0;o<=a;o++){s[o]=[];for(var l=e.clone().lerp(r,o/a),h=t.clone().lerp(r,o/a),c=a-o,u=0;u<=c;u++)s[o][u]=0==u&&o===a?l:l.clone().lerp(h,u/c)}for(var d=0;d<a;d++)for(var p,m=0;m<2*(a-d)-1;m++)p=Math.floor(m/2),0==m%2?(i(s[d][p+1]),i(s[d+1][p]),i(s[d][p])):(i(s[d][p+1]),i(s[d+1][p+1]),i(s[d+1][p]))}function i(e){h.push(e.x,e.y,e.z)}function n(t,r){var i=3*t;r.x=e[i+0],r.y=e[i+1],r.z=e[i+2]}function a(e,t,r,i){0>i&&1===e.x&&(c[t]=e.x-1),0===r.x&&0===r.z&&(c[t]=i/2/Math.PI+.5)}function s(e){return Math.atan2(e.z,-e.x)}var o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,l=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0;super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:o,detail:l};var h=[],c=[];(function(e){for(var i=new ci,a=new ci,s=new ci,o=0;o<t.length;o+=3)n(t[o+0],i),n(t[o+1],a),n(t[o+2],s),r(i,a,s,e)})(l),function(e){for(var t=new ci,r=0;r<h.length;r+=3)t.x=h[r+0],t.y=h[r+1],t.z=h[r+2],t.normalize().multiplyScalar(e),h[r+0]=t.x,h[r+1]=t.y,h[r+2]=t.z}(o),function(){for(var e=new ci,t=0;t<h.length;t+=3){e.x=h[t+0],e.y=h[t+1],e.z=h[t+2];var r=s(e)/2/Math.PI+.5,i=(n=e,Math.atan2(-n.y,Math.sqrt(n.x*n.x+n.z*n.z))/Math.PI+.5);c.push(r,1-i)}var n;(function(){for(var e=new ci,t=new ci,r=new ci,i=new ci,n=new $r,o=new $r,l=new $r,u=0,d=0;u<h.length;u+=9,d+=6){e.set(h[u+0],h[u+1],h[u+2]),t.set(h[u+3],h[u+4],h[u+5]),r.set(h[u+6],h[u+7],h[u+8]),n.set(c[d+0],c[d+1]),o.set(c[d+2],c[d+3]),l.set(c[d+4],c[d+5]),i.copy(e).add(t).add(r).divideScalar(3);var p=s(i);a(n,d+0,e,p),a(o,d+2,t,p),a(l,d+4,r,p)}})(),function(){for(var e=0;e<c.length;e+=6){var t=c[e+0],r=c[e+2],i=c[e+4],n=Math.max(t,r,i),a=Math.min(t,r,i);.9<n&&.1>a&&(.2>t&&(c[e+0]+=1),.2>r&&(c[e+2]+=1),.2>i&&(c[e+4]+=1))}}()}(),this.setAttribute("position",new Zn(h,3)),this.setAttribute("normal",new Zn(h.slice(),3)),this.setAttribute("uv",new Zn(c,2)),0===l?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(e){return new yh(e.vertices,e.indices,e.radius,e.details)}}class xh extends yh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=(1+Math.sqrt(5))/2,i=1/r;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-r,0,-i,r,0,i,-r,0,i,r,-i,-r,0,-i,r,0,i,-r,0,i,r,0,-r,0,-i,r,0,-i,-r,0,i,r,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new xh(e.radius,e.detail)}}var bh=new ci,wh=new ci,_h=new ci,Mh=new Sn;class Sh extends na{constructor(e,t){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=void 0===t?1:t,!0!==e.isGeometry){for(var r=Math.pow(10,4),i=Math.cos(Hr*t),n=e.getIndex(),a=e.getAttribute("position"),s=n?n.count:a.count,o=[0,0,0],l=["a","b","c"],h=[,,,],c={},u=[],d=0;d<s;d+=3){n?(o[0]=n.getX(d),o[1]=n.getX(d+1),o[2]=n.getX(d+2)):(o[0]=d,o[1]=d+1,o[2]=d+2);var{a:p,b:m,c:f}=Mh;if(p.fromBufferAttribute(a,o[0]),m.fromBufferAttribute(a,o[1]),f.fromBufferAttribute(a,o[2]),Mh.getNormal(_h),h[0]="".concat(Math.round(p.x*r),",").concat(Math.round(p.y*r),",").concat(Math.round(p.z*r)),h[1]="".concat(Math.round(m.x*r),",").concat(Math.round(m.y*r),",").concat(Math.round(m.z*r)),h[2]="".concat(Math.round(f.x*r),",").concat(Math.round(f.y*r),",").concat(Math.round(f.z*r)),h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(var v=0;3>v;v++){var g=(v+1)%3,y=h[v],x=h[g],b=Mh[l[v]],w=Mh[l[g]],_="".concat(y,"_").concat(x),M="".concat(x,"_").concat(y);M in c&&c[M]?(_h.dot(c[M].normal)<=i&&(u.push(b.x,b.y,b.z),u.push(w.x,w.y,w.z)),c[M]=null):!(_ in c)&&(c[_]={index0:o[v],index1:o[g],normal:_h.clone()})}}for(var S in c)if(c[S]){var{index0:T,index1:E}=c[S];bh.fromBufferAttribute(a,T),wh.fromBufferAttribute(a,E),u.push(bh.x,bh.y,bh.z),u.push(wh.x,wh.y,wh.z)}this.setAttribute("position",new Zn(u,3))}else console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}class Th{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){var r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:5,t=[],r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:5,t=[],r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){var e=this.getLengths();return e[e.length-1]}getLengths(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,r=[],i=this.getPoint(0),n=0;r.push(0);for(var a=1;a<=e;a++)n+=(t=this.getPoint(a/e)).distanceTo(i),r.push(n),i=t;return this.cacheArcLengths=r,r}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){var r,i=this.getLengths(),n=0,a=i.length;r=t||e*i[a-1];for(var s,o=0,l=a-1;o<=l;)if(0>(s=i[n=Math.floor(o+(l-o)/2)]-r))o=n+1;else{if(!(0<s)){l=n;break}l=n-1}if(i[n=l]===r)return n/(a-1);var h=i[n];return(n+(r-h)/(i[n+1]-h))/(a-1)}getTangent(e,t){var r=1e-4,i=e-r,n=e+r;0>i&&(i=0),1<n&&(n=1);var a=this.getPoint(i),s=this.getPoint(n),o=t||(a.isVector2?new $r:new ci);return o.copy(s).sub(a).normalize(),o}getTangentAt(e,t){var r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){for(var r,i=new ci,n=[],a=[],s=[],o=new ci,l=new Vi,h=0;h<=e;h++)r=h/e,n[h]=this.getTangentAt(r,new ci),n[h].normalize();a[0]=new ci,s[0]=new ci;var c=Number.MAX_VALUE,u=Math.abs(n[0].x),d=Math.abs(n[0].y),p=Math.abs(n[0].z);u<=c&&(c=u,i.set(1,0,0)),d<=c&&(c=d,i.set(0,1,0)),p<=c&&i.set(0,0,1),o.crossVectors(n[0],i).normalize(),a[0].crossVectors(n[0],o),s[0].crossVectors(n[0],a[0]);for(var m=1;m<=e;m++){if(a[m]=a[m-1].clone(),s[m]=s[m-1].clone(),o.crossVectors(n[m-1],n[m]),o.length()>Number.EPSILON){o.normalize();var f=Math.acos(Wr(n[m-1].dot(n[m]),-1,1));a[m].applyMatrix4(l.makeRotationAxis(o,f))}s[m].crossVectors(n[m],a[m])}if(!0===t){var v=Math.acos(Wr(a[0].dot(a[e]),-1,1));v/=e,0<n[0].dot(o.crossVectors(a[0],a[e]))&&(v=-v);for(var g=1;g<=e;g++)a[g].applyMatrix4(l.makeRotationAxis(n[g],v*g)),s[g].crossVectors(n[g],a[g])}return{tangents:n,normals:a,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){return{metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"},arcLengthDivisions:this.arcLengthDivisions,type:this.type}}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Eh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:2*Math.PI,s=!!(6<arguments.length&&void 0!==arguments[6])&&arguments[6],o=7<arguments.length&&void 0!==arguments[7]?arguments[7]:0;super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=n,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t){for(var r=t||new $r,i=2*Math.PI,n=this.aEndAngle-this.aStartAngle,a=Math.abs(n)<Number.EPSILON;0>n;)n+=i;for(;n>i;)n-=i;n<Number.EPSILON&&(n=a?0:i),!0!==this.aClockwise||a||(n===i?n=-i:n-=i);var s=this.aStartAngle+e*n,o=this.aX+this.xRadius*Math.cos(s),l=this.aY+this.yRadius*Math.sin(s);if(0!==this.aRotation){var h=Math.cos(this.aRotation),c=Math.sin(this.aRotation),u=o-this.aX,d=l-this.aY;o=u*h-d*c+this.aX,l=u*c+d*h+this.aY}return r.set(o,l)}copy(e){return super.copy(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}toJSON(){var e=super.toJSON();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}fromJSON(e){return super.fromJSON(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}}Eh.prototype.isEllipseCurve=!0;class Ah extends Eh{constructor(e,t,r,i,n,a){super(e,t,r,r,i,n,a),this.type="ArcCurve"}}function Lh(){function e(e,a,s,o){t=e,r=s,i=-3*e+3*a-2*s-o,n=2*e-2*a+s+o}var t=0,r=0,i=0,n=0;return{initCatmullRom:function(t,r,i,n,a){e(r,i,a*(i-t),a*(n-r))},initNonuniformCatmullRom:function(t,r,i,n,a,s,o){var l=(r-t)/a-(i-t)/(a+s)+(i-r)/s,h=(i-r)/s-(n-r)/(s+o)+(n-i)/o;e(r,i,l*=s,h*=s)},calc:function(e){var a=e*e;return t+r*e+i*a+n*(a*e)}}}Ah.prototype.isArcCurve=!0;var Rh=new ci,Ch=new Lh,Ph=new Lh,Ih=new Lh;class Oh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"centripetal",i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:.5;super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=i}getPoint(e){var t,r,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci,n=this.points,a=n.length,s=(a-(this.closed?0:1))*e,o=Math.floor(s),l=s-o;this.closed?o+=0<o?0:(Math.floor(Math.abs(o)/a)+1)*a:0===l&&o===a-1&&(o=a-2,l=1),this.closed||0<o?t=n[(o-1)%a]:(Rh.subVectors(n[0],n[1]).add(n[0]),t=Rh);var h=n[o%a],c=n[(o+1)%a];if(this.closed||o+2<a?r=n[(o+2)%a]:(Rh.subVectors(n[a-1],n[a-2]).add(n[a-1]),r=Rh),"centripetal"===this.curveType||"chordal"===this.curveType){var u="chordal"===this.curveType?.5:.25,d=Math.pow(t.distanceToSquared(h),u),p=Math.pow(h.distanceToSquared(c),u),m=Math.pow(c.distanceToSquared(r),u);1e-4>p&&(p=1),1e-4>d&&(d=p),1e-4>m&&(m=p),Ch.initNonuniformCatmullRom(t.x,h.x,c.x,r.x,d,p,m),Ph.initNonuniformCatmullRom(t.y,h.y,c.y,r.y,d,p,m),Ih.initNonuniformCatmullRom(t.z,h.z,c.z,r.z,d,p,m)}else"catmullrom"===this.curveType&&(Ch.initCatmullRom(t.x,h.x,c.x,r.x,this.tension),Ph.initCatmullRom(t.y,h.y,c.y,r.y,this.tension),Ih.initCatmullRom(t.z,h.z,c.z,r.z,this.tension));return i.set(Ch.calc(l),Ph.calc(l),Ih.calc(l)),i}copy(e){super.copy(e),this.points=[];for(var t,r=0,i=e.points.length;r<i;r++)t=e.points[r],this.points.push(t.clone());return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){var e=super.toJSON();e.points=[];for(var t,r=0,i=this.points.length;r<i;r++)t=this.points[r],e.points.push(t.toArray());return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(var t,r=0,i=e.points.length;r<i;r++)t=e.points[r],this.points.push((new ci).fromArray(t));return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function Dh(e,t,r,i,n){var a=.5*(i-t),s=.5*(n-r),o=e*e;return(2*r-2*i+a+s)*(e*o)+(-3*r+3*i-2*a-s)*o+a*e+r}function Nh(e,t,r,i){return function(e,t){var r=1-e;return r*r*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,r)+function(e,t){return e*e*t}(e,i)}function Bh(e,t,r,i,n){return function(e,t){var r=1-e;return r*r*r*t}(e,t)+function(e,t){var r=1-e;return 3*r*r*e*t}(e,r)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,n)}Oh.prototype.isCatmullRomCurve3=!0;class Uh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new $r,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new $r,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new $r;super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=i}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r,r=this.v0,i=this.v1,n=this.v2,a=this.v3;return t.set(Bh(e,r.x,i.x,n.x,a.x),Bh(e,r.y,i.y,n.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){var e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}Uh.prototype.isCubicBezierCurve=!0;class zh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new ci,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:new ci;super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=i}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci,r=this.v0,i=this.v1,n=this.v2,a=this.v3;return t.set(Bh(e,r.x,i.x,n.x,a.x),Bh(e,r.y,i.y,n.y,a.y),Bh(e,r.z,i.z,n.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){var e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}zh.prototype.isCubicBezierCurve3=!0;class Fh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new $r,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r;super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){var r=t||new $r;return r.copy(this.v2).sub(this.v1).normalize(),r}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){var e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}Fh.prototype.isLineCurve=!0;class Gh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci;super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){var e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Vh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new $r,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new $r;super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r,r=this.v0,i=this.v1,n=this.v2;return t.set(Nh(e,r.x,i.x,n.x),Nh(e,r.y,i.y,n.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){var e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}Vh.prototype.isQuadraticBezierCurve=!0;class Hh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new ci;super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci,r=this.v0,i=this.v1,n=this.v2;return t.set(Nh(e,r.x,i.x,n.x),Nh(e,r.y,i.y,n.y),Nh(e,r.z,i.z,n.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){var e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}Hh.prototype.isQuadraticBezierCurve3=!0;class kh extends Th{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];super(),this.type="SplineCurve",this.points=e}getPoint(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r,r=this.points,i=(r.length-1)*e,n=Math.floor(i),a=i-n,s=r[0===n?n:n-1],o=r[n],l=r[n>r.length-2?r.length-1:n+1],h=r[n>r.length-3?r.length-1:n+2];return t.set(Dh(a,s.x,o.x,l.x,h.x),Dh(a,s.y,o.y,l.y,h.y)),t}copy(e){super.copy(e),this.points=[];for(var t,r=0,i=e.points.length;r<i;r++)t=e.points[r],this.points.push(t.clone());return this}toJSON(){var e=super.toJSON();e.points=[];for(var t,r=0,i=this.points.length;r<i;r++)t=this.points[r],e.points.push(t.toArray());return e}fromJSON(e){super.fromJSON(e),this.points=[];for(var t,r=0,i=e.points.length;r<i;r++)t=e.points[r],this.points.push((new $r).fromArray(t));return this}}kh.prototype.isSplineCurve=!0;var jh=Object.freeze({__proto__:null,ArcCurve:Ah,CatmullRomCurve3:Oh,CubicBezierCurve:Uh,CubicBezierCurve3:zh,EllipseCurve:Eh,LineCurve:Fh,LineCurve3:Gh,QuadraticBezierCurve:Vh,QuadraticBezierCurve3:Hh,SplineCurve:kh});function Wh(e,t,r,i,n){var a,s;if(n===0<function(e,t,r,i){for(var n=0,a=t,s=r-i;a<r;a+=i)n+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return n}(e,t,r,i))for(a=t;a<r;a+=i)s=dc(a,e[a],e[a+1],s);else for(a=r-i;a>=t;a-=i)s=dc(a,e[a],e[a+1],s);return s&&sc(s,s.next)&&(pc(s),s=s.next),s}function Zh(e,t){if(!e)return e;t||(t=e);var r,i=e;do{if(r=!1,i.steiner||!sc(i,i.next)&&0!==ac(i.prev,i,i.next))i=i.next;else{if(pc(i),(i=t=i.prev)===i.next)break;r=!0}}while(r||i!==t);return t}function qh(e,t,r,i,n,a,s){if(e){!s&&a&&function(e,t,r,i){var n=e;do{null===n.z&&(n.z=tc(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,r,i,n,a,s,o,l,h=1;do{for(r=e,e=null,a=null,s=0;r;){for(s++,i=r,o=0,t=0;t<h&&(o++,i=i.nextZ);t++);for(l=h;0<o||0<l&&i;)0!==o&&(0===l||!i||r.z<=i.z)?(n=r,r=r.nextZ,o--):(n=i,i=i.nextZ,l--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;r=i}a.nextZ=null,h*=2}while(1<s)}(n)}(e,i,n,a);for(var o,l,h=e;e.prev!==e.next;)if(o=e.prev,l=e.next,a?Yh(e,i,n,a):Xh(e))t.push(o.i/r),t.push(e.i/r),t.push(l.i/r),pc(e),e=l.next,h=l.next;else if((e=l)===h){s?1===s?qh(e=Jh(Zh(e),t,r),t,r,i,n,a,2):2==s&&Kh(e,t,r,i,n,a):qh(Zh(e),t,r,i,n,a,1);break}}}function Xh(e){var t=e.prev,r=e,i=e.next;if(0<=ac(t,r,i))return!1;for(var n=e.next.next;n!==e.prev;){if(ic(t.x,t.y,r.x,r.y,i.x,i.y,n.x,n.y)&&0<=ac(n.prev,n,n.next))return!1;n=n.next}return!0}function Yh(e,t,r,i){var n=e.prev,a=e,s=e.next;if(0<=ac(n,a,s))return!1;for(var o=n.x<a.x?n.x<s.x?n.x:s.x:a.x<s.x?a.x:s.x,l=n.y<a.y?n.y<s.y?n.y:s.y:a.y<s.y?a.y:s.y,h=n.x>a.x?n.x>s.x?n.x:s.x:a.x>s.x?a.x:s.x,c=n.y>a.y?n.y>s.y?n.y:s.y:a.y>s.y?a.y:s.y,u=tc(o,l,t,r,i),d=tc(h,c,t,r,i),p=e.prevZ,m=e.nextZ;p&&p.z>=u&&m&&m.z<=d;){if(p!==e.prev&&p!==e.next&&ic(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&0<=ac(p.prev,p,p.next))return!1;if(p=p.prevZ,m!==e.prev&&m!==e.next&&ic(n.x,n.y,a.x,a.y,s.x,s.y,m.x,m.y)&&0<=ac(m.prev,m,m.next))return!1;m=m.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&ic(n.x,n.y,a.x,a.y,s.x,s.y,p.x,p.y)&&0<=ac(p.prev,p,p.next))return!1;p=p.prevZ}for(;m&&m.z<=d;){if(m!==e.prev&&m!==e.next&&ic(n.x,n.y,a.x,a.y,s.x,s.y,m.x,m.y)&&0<=ac(m.prev,m,m.next))return!1;m=m.nextZ}return!0}function Jh(e,t,r){var i=e;do{var n=i.prev,a=i.next.next;!sc(n,a)&&oc(n,i,i.next,a)&&cc(n,a)&&cc(a,n)&&(t.push(n.i/r),t.push(i.i/r),t.push(a.i/r),pc(i),pc(i.next),i=e=a),i=i.next}while(i!==e);return Zh(i)}function Kh(e,t,r,i,n,a){var s=e;do{for(var o=s.next.next;o!==s.prev;){if(s.i!==o.i&&nc(s,o)){var l=uc(s,o);return s=Zh(s,s.next),l=Zh(l,l.next),qh(s,t,r,i,n,a),void qh(l,t,r,i,n,a)}o=o.next}s=s.next}while(s!==e)}function Qh(e,t){return e.x-t.x}function $h(e,t){if(t=function(e,t){var r,i=t,n=e.x,a=e.y,s=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var o=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=n&&o>s){if(s=o,o===n){if(a===i.y)return i;if(a===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!r)return null;if(n===s)return r;var l,h=r,c=r.x,u=r.y,d=1/0;i=r;do{n>=i.x&&i.x>=c&&n!==i.x&&ic(a<u?n:s,a,c,u,a<u?s:n,a,i.x,i.y)&&(l=Math.abs(a-i.y)/(n-i.x),cc(i,e)&&(l<d||l===d&&(i.x>r.x||i.x===r.x&&ec(r,i)))&&(r=i,d=l)),i=i.next}while(i!==h);return r}(e,t),t){var r=uc(t,e);Zh(t,t.next),Zh(r,r.next)}}function ec(e,t){return 0>ac(e.prev,e,t.prev)&&0>ac(t.next,e,e.next)}function tc(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function rc(e){var t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function ic(e,t,r,i,n,a,s,o){return 0<=(n-s)*(t-o)-(e-s)*(a-o)&&0<=(e-s)*(i-o)-(r-s)*(t-o)&&0<=(r-s)*(a-o)-(n-s)*(i-o)}function nc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&oc(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(cc(e,t)&&cc(t,e)&&function(e,t){var r=e,i=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&n<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==e);return i}(e,t)&&(ac(e.prev,e,t.prev)||ac(e,t.prev,t))||sc(e,t)&&0<ac(e.prev,e,e.next)&&0<ac(t.prev,t,t.next))}function ac(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function sc(e,t){return e.x===t.x&&e.y===t.y}function oc(e,t,r,i){var n=hc(ac(e,t,r)),a=hc(ac(e,t,i)),s=hc(ac(r,i,e)),o=hc(ac(r,i,t));return!!(n!==a&&s!==o||0===n&&lc(e,r,t)||0===a&&lc(e,i,t)||0===s&&lc(r,e,i)||0===o&&lc(r,t,i))}function lc(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function hc(e){return 0<e?1:0>e?-1:0}function cc(e,t){return 0>ac(e.prev,e,e.next)?0<=ac(e,t,e.next)&&0<=ac(e,e.prev,t):0>ac(e,t,e.prev)||0>ac(e,e.next,t)}function uc(e,t){var r=new mc(e.i,e.x,e.y),i=new mc(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function dc(e,t,r,i){var n=new mc(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function pc(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 mc(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class fc{static area(e){for(var t=e.length,r=0,i=t-1,n=0;n<t;i=n++)r+=e[i].x*e[n].y-e[n].x*e[i].y;return.5*r}static isClockWise(e){return 0>fc.area(e)}static triangulateShape(e,t){var r=[],i=[],n=[];vc(e),gc(r,e);var a=e.length;t.forEach(vc);for(var s=0;s<t.length;s++)i.push(a),a+=t[s].length,gc(r,t[s]);for(var o=function(e,t){var r,i,n,a,s,o,l,h=2<arguments.length&&void 0!==arguments[2]?arguments[2]:2,c=t&&t.length,u=c?t[0]*h:e.length,d=Wh(e,0,u,h,!0),p=[];if(!d||d.next===d.prev)return p;if(c&&(d=function(e,t,r,i){var n,a,s,o=[];for(n=0,a=t.length;n<a;n++)(s=Wh(e,t[n]*i,n<a-1?t[n+1]*i:e.length,i,!1))===s.next&&(s.steiner=!0),o.push(rc(s));for(o.sort(Qh),n=0;n<o.length;n++)$h(o[n],r),r=Zh(r,r.next);return r}(e,t,d,h)),e.length>80*h){r=n=e[0],i=a=e[1];for(var m=h;m<u;m+=h)(s=e[m])<r&&(r=s),(o=e[m+1])<i&&(i=o),s>n&&(n=s),o>a&&(a=o);l=0===(l=Math.max(n-r,a-i))?0:1/l}return qh(d,p,h,r,i,l),p}(r,i),l=0;l<o.length;l+=3)n.push(o.slice(l,l+3));return n}}function vc(e){var t=e.length;2<t&&e[t-1].equals(e[0])&&e.pop()}function gc(e,t){for(var r=0;r<t.length;r++)e.push(t[r].x),e.push(t[r].y)}class yc extends na{constructor(e,t){function r(e){function r(e,t,r){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().multiplyScalar(r).add(e)}function s(e,t,r){var i,n,a,s=e.x-t.x,o=e.y-t.y,l=r.x-e.x,h=r.y-e.y,c=s*s+o*o,u=s*h-o*l;if(Math.abs(u)>Number.EPSILON){var d=Math.sqrt(c),p=Math.sqrt(l*l+h*h),m=t.x-o/d,f=t.y+s/d,v=((r.x-h/p-m)*h-(r.y+l/p-f)*l)/(s*h-o*l),g=(i=m+s*v-e.x)*i+(n=f+o*v-e.y)*n;if(2>=g)return new $r(i,n);a=Math.sqrt(g/2)}else{var y=!1;s>Number.EPSILON?l>Number.EPSILON&&(y=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(o)===Math.sign(h)&&(y=!0),y?(i=-o,n=s,a=Math.sqrt(c)):(i=s,n=o,a=Math.sqrt(c/2))}return new $r(i/a,n/a)}function o(e,t){for(var r=e.length;0<=--r;){var i=r,n=r-1;0>n&&(n=e.length-1);for(var a=0,s=f+2*w;a<s;a++){var o=V*a,l=V*(a+1);c(t+i+o,t+n+o,t+n+l,t+i+l)}}}function l(e,t,r){p.push(e),p.push(t),p.push(r)}function h(e,t,r){u(e),u(t),u(r);var a=n.length/3,s=M.generateTopUV(i,n,a-3,a-2,a-1);d(s[0]),d(s[1]),d(s[2])}function c(e,t,r,a){u(e),u(t),u(a),u(t),u(r),u(a);var s=n.length/3,o=M.generateSideWallUV(i,n,s-6,s-3,s-2,s-1);d(o[0]),d(o[1]),d(o[3]),d(o[1]),d(o[2]),d(o[3])}function u(e){n.push(p[3*e+0]),n.push(p[3*e+1]),n.push(p[3*e+2])}function d(e){a.push(e.x),a.push(e.y)}var p=[],m=void 0===t.curveSegments?12:t.curveSegments,f=void 0===t.steps?1:t.steps,v=void 0===t.depth?100:t.depth,g=!(void 0!==t.bevelEnabled)||t.bevelEnabled,y=void 0===t.bevelThickness?6:t.bevelThickness,x=void 0===t.bevelSize?y-2:t.bevelSize,b=void 0===t.bevelOffset?0:t.bevelOffset,w=void 0===t.bevelSegments?3:t.bevelSegments,_=t.extrudePath,M=void 0===t.UVGenerator?xc:t.UVGenerator;void 0!==t.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),v=t.amount);var S,T,E,A,L,R=!1;_&&(S=_.getSpacedPoints(f),R=!0,g=!1,T=_.computeFrenetFrames(f,!1),E=new ci,A=new ci,L=new ci),g||(w=0,y=0,x=0,b=0);var C=e.extractPoints(m),P=C.shape,I=C.holes;if(!fc.isClockWise(P)){P=P.reverse();for(var O,D=0,N=I.length;D<N;D++)O=I[D],fc.isClockWise(O)&&(I[D]=O.reverse())}for(var B,U=fc.triangulateShape(P,I),z=P,F=0,G=I.length;F<G;F++)B=I[F],P=P.concat(B);for(var V=P.length,H=U.length,k=[],j=0,W=z.length,Z=W-1,q=j+1;j<W;j++,Z++,q++)Z===W&&(Z=0),q===W&&(q=0),k[j]=s(z[j],z[Z],z[q]);for(var X,Y,J=[],K=k.concat(),Q=0,$=I.length;Q<$;Q++){X=[];for(var ee=0,te=(Y=I[Q]).length,re=te-1,ie=ee+1;ee<te;ee++,re++,ie++)re===te&&(re=0),ie===te&&(ie=0),X[ee]=s(Y[ee],Y[re],Y[ie]);J.push(X),K=K.concat(X)}for(var ne=0;ne<w;ne++){for(var ae,se=ne/w,oe=y*Math.cos(se*Math.PI/2),le=x*Math.sin(se*Math.PI/2)+b,he=0,ce=z.length;he<ce;he++)l((ae=r(z[he],k[he],le)).x,ae.y,-oe);for(var ue,de=0,pe=I.length;de<pe;de++){ue=I[de],X=J[de];for(var me,fe=0,ve=ue.length;fe<ve;fe++)l((me=r(ue[fe],X[fe],le)).x,me.y,-oe)}}for(var ge,ye=x+b,xe=0;xe<V;xe++)ge=g?r(P[xe],K[xe],ye):P[xe],R?(A.copy(T.normals[0]).multiplyScalar(ge.x),E.copy(T.binormals[0]).multiplyScalar(ge.y),L.copy(S[0]).add(A).add(E),l(L.x,L.y,L.z)):l(ge.x,ge.y,0);for(var be=1;be<=f;be++)for(var we,_e=0;_e<V;_e++)we=g?r(P[_e],K[_e],ye):P[_e],R?(A.copy(T.normals[be]).multiplyScalar(we.x),E.copy(T.binormals[be]).multiplyScalar(we.y),L.copy(S[be]).add(A).add(E),l(L.x,L.y,L.z)):l(we.x,we.y,v/f*be);for(var Me=w-1;0<=Me;Me--){for(var Se,Te=Me/w,Ee=y*Math.cos(Te*Math.PI/2),Ae=x*Math.sin(Te*Math.PI/2)+b,Le=0,Re=z.length;Le<Re;Le++)l((Se=r(z[Le],k[Le],Ae)).x,Se.y,v+Ee);for(var Ce,Pe=0,Ie=I.length;Pe<Ie;Pe++){Ce=I[Pe],X=J[Pe];for(var Oe,De=0,Ne=Ce.length;De<Ne;De++)Oe=r(Ce[De],X[De],Ae),R?l(Oe.x,Oe.y+S[f-1].y,S[f-1].x+Ee):l(Oe.x,Oe.y,v+Ee)}}(function(){var e=n.length/3;if(g){for(var t,r=0,a=V*r,s=0;s<H;s++)h((t=U[s])[2]+a,t[1]+a,t[0]+a);a=V*(r=f+2*w);for(var o,l=0;l<H;l++)h((o=U[l])[0]+a,o[1]+a,o[2]+a)}else{for(var c,u=0;u<H;u++)h((c=U[u])[2],c[1],c[0]);for(var d,p=0;p<H;p++)h((d=U[p])[0]+V*f,d[1]+V*f,d[2]+V*f)}i.addGroup(e,n.length/3-e,0)})(),function(){var e=n.length/3,t=0;o(z,t),t+=z.length;for(var r,a=0,s=I.length;a<s;a++)o(r=I[a],t),t+=r.length;i.addGroup(e,n.length/3-e,1)}()}super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var i=this,n=[],a=[],s=0,o=e.length;s<o;s++)r(e[s]);this.setAttribute("position",new Zn(n,3)),this.setAttribute("uv",new Zn(a,2)),this.computeVertexNormals()}toJSON(){var e=super.toJSON();return function(e,t,r){if(r.shapes=[],Array.isArray(e))for(var i,n=0,a=e.length;n<a;n++)i=e[n],r.shapes.push(i.uuid);else r.shapes.push(e.uuid);return void 0!==t.extrudePath&&(r.options.extrudePath=t.extrudePath.toJSON()),r}(this.parameters.shapes,this.parameters.options,e)}static fromJSON(e,t){for(var r,i=[],n=0,a=e.shapes.length;n<a;n++)r=t[e.shapes[n]],i.push(r);var s=e.options.extrudePath;return void 0!==s&&(e.options.extrudePath=(new jh[s.type]).fromJSON(s)),new yc(i,e.options)}}var xc={generateTopUV:function(e,t,r,i,n){var a=t[3*r],s=t[3*r+1],o=t[3*i],l=t[3*i+1],h=t[3*n],c=t[3*n+1];return[new $r(a,s),new $r(o,l),new $r(h,c)]},generateSideWallUV:function(e,t,r,i,n,a){var s=t[3*r],o=t[3*r+1],l=t[3*r+2],h=t[3*i],c=t[3*i+1],u=t[3*i+2],d=t[3*n],p=t[3*n+1],m=t[3*n+2],f=t[3*a],v=t[3*a+1],g=t[3*a+2];return Math.abs(o-c)<Math.abs(s-h)?[new $r(s,1-l),new $r(h,1-u),new $r(d,1-m),new $r(f,1-g)]:[new $r(o,1-l),new $r(c,1-u),new $r(p,1-m),new $r(v,1-g)]}};class bc extends yh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=(1+Math.sqrt(5))/2;super([-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new bc(e.radius,e.detail)}}class wc extends na{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:12,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:2*Math.PI;super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},t=Math.floor(t),i=Wr(i,0,2*Math.PI);for(var n=[],a=[],s=[],o=1/t,l=new ci,h=new $r,c=0;c<=t;c++)for(var u=r+c*o*i,d=Math.sin(u),p=Math.cos(u),m=0;m<=e.length-1;m++)l.x=e[m].x*d,l.y=e[m].y,l.z=e[m].x*p,a.push(l.x,l.y,l.z),h.x=c/t,h.y=m/(e.length-1),s.push(h.x,h.y);for(var f=0;f<t;f++)for(var v=0;v<e.length-1;v++){var g=v+f*e.length,y=g,x=g+e.length,b=g+e.length+1,w=g+1;n.push(y,x,w),n.push(x,b,w)}if(this.setIndex(n),this.setAttribute("position",new Zn(a,3)),this.setAttribute("uv",new Zn(s,2)),this.computeVertexNormals(),i===2*Math.PI)for(var _=this.attributes.normal.array,M=new ci,S=new ci,T=new ci,E=t*e.length*3,A=0,L=0;A<e.length;A++,L+=3)M.x=_[L+0],M.y=_[L+1],M.z=_[L+2],S.x=_[E+L+0],S.y=_[E+L+1],S.z=_[E+L+2],T.addVectors(M,S).normalize(),_[L+0]=_[E+L+0]=T.x,_[L+1]=_[E+L+1]=T.y,_[L+2]=_[E+L+2]=T.z}static fromJSON(e){return new wc(e.points,e.segments,e.phiStart,e.phiLength)}}class _c extends yh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new _c(e.radius,e.detail)}}class Mc extends na{constructor(e,t,r){super(),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:r};var i=[],n=[],a=[],s=[],o=1e-5,l=new ci,h=new ci,c=new ci,u=new ci,d=new ci;3>e.length&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");for(var p,m=t+1,f=0;f<=r;f++){p=f/r;for(var v,g=0;g<=t;g++)e(v=g/t,p,h),n.push(h.x,h.y,h.z),0<=v-o?(e(v-o,p,c),u.subVectors(h,c)):(e(v+o,p,c),u.subVectors(c,h)),0<=p-o?(e(v,p-o,c),d.subVectors(h,c)):(e(v,p+o,c),d.subVectors(c,h)),l.crossVectors(u,d).normalize(),a.push(l.x,l.y,l.z),s.push(v,p)}for(var y=0;y<r;y++)for(var x=0;x<t;x++){var b=y*m+x,w=y*m+x+1,_=(y+1)*m+x+1,M=(y+1)*m+x;i.push(b,w,M),i.push(w,_,M)}this.setIndex(i),this.setAttribute("position",new Zn(n,3)),this.setAttribute("normal",new Zn(a,3)),this.setAttribute("uv",new Zn(s,2))}}class Sc extends na{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:.5,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:8,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:2*Math.PI;super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:r,phiSegments:i,thetaStart:n,thetaLength:a},r=Math.max(3,r);for(var s=[],o=[],l=[],h=[],c=e,u=(t-e)/(i=Math.max(1,i)),d=new ci,p=new $r,m=0;m<=i;m++){for(var f,v=0;v<=r;v++)f=n+v/r*a,d.x=c*Math.cos(f),d.y=c*Math.sin(f),o.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,h.push(p.x,p.y);c+=u}for(var g,y=0;y<i;y++){g=y*(r+1);for(var x=0;x<r;x++){var b=x+g,w=b,_=b+r+1,M=b+r+2,S=b+1;s.push(w,_,S),s.push(_,M,S)}}this.setIndex(s),this.setAttribute("position",new Zn(o,3)),this.setAttribute("normal",new Zn(l,3)),this.setAttribute("uv",new Zn(h,2))}static fromJSON(e){return new Sc(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Tc extends na{constructor(e){function t(e){var t=n.length/3,o=e.extractPoints(r),h=o.shape,c=o.holes;!1===fc.isClockWise(h)&&(h=h.reverse());for(var u,d=0,p=c.length;d<p;d++)u=c[d],!0===fc.isClockWise(u)&&(c[d]=u.reverse());for(var m,f=fc.triangulateShape(h,c),v=0,g=c.length;v<g;v++)m=c[v],h=h.concat(m);for(var y,x=0,b=h.length;x<b;x++)y=h[x],n.push(y.x,y.y,0),a.push(0,0,1),s.push(y.x,y.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;i.push(S,T,E),l+=3}}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:12;super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:r};var i=[],n=[],a=[],s=[],o=0,l=0;if(!1===Array.isArray(e))t(e);else for(var h=0;h<e.length;h++)t(e[h]),this.addGroup(o,l,h),o+=l,l=0;this.setIndex(i),this.setAttribute("position",new Zn(n,3)),this.setAttribute("normal",new Zn(a,3)),this.setAttribute("uv",new Zn(s,2))}toJSON(){var e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(var r,i=0,n=e.length;i<n;i++)r=e[i],t.shapes.push(r.uuid);else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){for(var r,i=[],n=0,a=e.shapes.length;n<a;n++)r=t[e.shapes[n]],i.push(r);return new Tc(i,e.curveSegments)}}class Ec extends na{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:8,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:6,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:0,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:2*Math.PI,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0,s=6<arguments.length&&void 0!==arguments[6]?arguments[6]:Math.PI;super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:i,phiLength:n,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));for(var o=Math.min(a+s,Math.PI),l=0,h=[],c=new ci,u=new ci,d=[],p=[],m=[],f=[],v=0;v<=r;v++){var g=[],y=v/r,x=0;0==v&&0==a?x=.5/t:v==r&&o==Math.PI&&(x=-.5/t);for(var b,w=0;w<=t;w++)b=w/t,c.x=-e*Math.cos(i+b*n)*Math.sin(a+y*s),c.y=e*Math.cos(a+y*s),c.z=e*Math.sin(i+b*n)*Math.sin(a+y*s),p.push(c.x,c.y,c.z),u.copy(c).normalize(),m.push(u.x,u.y,u.z),f.push(b+x,1-y),g.push(l++);h.push(g)}for(var _=0;_<r;_++)for(var M=0;M<t;M++){var S=h[_][M+1],T=h[_][M],E=h[_+1][M],A=h[_+1][M+1];(0!==_||0<a)&&d.push(S,T,A),(_!==r-1||o<Math.PI)&&d.push(T,E,A)}this.setIndex(d),this.setAttribute("position",new Zn(p,3)),this.setAttribute("normal",new Zn(m,3)),this.setAttribute("uv",new Zn(f,2))}static fromJSON(e){return new Ec(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Ac extends yh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ac(e.radius,e.detail)}}class Lc extends yc{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=t.font;if(!r||!r.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new na;var i=r.generateShapes(e,t.size);t.depth=void 0===t.height?50:t.height,void 0===t.bevelThickness&&(t.bevelThickness=10),void 0===t.bevelSize&&(t.bevelSize=8),void 0===t.bevelEnabled&&(t.bevelEnabled=!1),super(i,t),this.type="TextGeometry"}}class Rc extends na{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:.4,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:8,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:6,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:2*Math.PI;super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:r,tubularSegments:i,arc:n},r=Math.floor(r),i=Math.floor(i);for(var a=[],s=[],o=[],l=[],h=new ci,c=new ci,u=new ci,d=0;d<=r;d++)for(var p=0;p<=i;p++){var m=p/i*n,f=d/r*Math.PI*2;c.x=(e+t*Math.cos(f))*Math.cos(m),c.y=(e+t*Math.cos(f))*Math.sin(m),c.z=t*Math.sin(f),s.push(c.x,c.y,c.z),h.x=e*Math.cos(m),h.y=e*Math.sin(m),u.subVectors(c,h).normalize(),o.push(u.x,u.y,u.z),l.push(p/i),l.push(d/r)}for(var v=1;v<=r;v++)for(var g=1;g<=i;g++){var y=(i+1)*v+g-1,x=(i+1)*(v-1)+g-1,b=(i+1)*(v-1)+g,w=(i+1)*v+g;a.push(y,x,w),a.push(x,b,w)}this.setIndex(a),this.setAttribute("position",new Zn(s,3)),this.setAttribute("normal",new Zn(o,3)),this.setAttribute("uv",new Zn(l,2))}static fromJSON(e){return new Rc(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class Cc extends na{constructor(){function e(e,t,r,i,n){var a=Math.cos(e),s=Math.sin(e),o=r/t*e,l=Math.cos(o);n.x=i*(2+l)*.5*a,n.y=i*(2+l)*s*.5,n.z=i*Math.sin(o)*.5}var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:.4,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:64,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:8,a=4<arguments.length&&void 0!==arguments[4]?arguments[4]:2,s=5<arguments.length&&void 0!==arguments[5]?arguments[5]:3;super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:r,tubularSegments:i,radialSegments:n,p:a,q:s},i=Math.floor(i),n=Math.floor(n);for(var o,l=[],h=[],c=[],u=[],d=new ci,p=new ci,m=new ci,f=new ci,v=new ci,g=new ci,y=new ci,x=0;x<=i;++x){e(o=x/i*a*Math.PI*2,a,s,t,m),e(o+.01,a,s,t,f),g.subVectors(f,m),y.addVectors(f,m),v.crossVectors(g,y),y.crossVectors(v,g),v.normalize(),y.normalize();for(var b=0;b<=n;++b){var w=b/n*Math.PI*2,_=-r*Math.cos(w),M=r*Math.sin(w);d.x=m.x+(_*y.x+M*v.x),d.y=m.y+(_*y.y+M*v.y),d.z=m.z+(_*y.z+M*v.z),h.push(d.x,d.y,d.z),p.subVectors(d,m).normalize(),c.push(p.x,p.y,p.z),u.push(x/i),u.push(b/n)}}for(var S=1;S<=i;S++)for(var T=1;T<=n;T++){var E=(n+1)*(S-1)+(T-1),A=(n+1)*S+(T-1),L=(n+1)*S+T,R=(n+1)*(S-1)+T;l.push(E,A,R),l.push(A,L,R)}this.setIndex(l),this.setAttribute("position",new Zn(h,3)),this.setAttribute("normal",new Zn(c,3)),this.setAttribute("uv",new Zn(u,2))}static fromJSON(e){return new Cc(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Pc extends na{constructor(e){function t(t){c=e.getPointAt(t/r,c);for(var a=s.normals[t],h=s.binormals[t],p=0;p<=n;p++){var m=p/n*Math.PI*2,f=Math.sin(m),v=-Math.cos(m);l.x=v*a.x+f*h.x,l.y=v*a.y+f*h.y,l.z=v*a.z+f*h.z,l.normalize(),d.push(l.x,l.y,l.z),o.x=c.x+i*l.x,o.y=c.y+i*l.y,o.z=c.z+i*l.z,u.push(o.x,o.y,o.z)}}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:64,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:8,a=!!(4<arguments.length&&void 0!==arguments[4])&&arguments[4];super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:r,radius:i,radialSegments:n,closed:a};var s=e.computeFrenetFrames(r,a);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;var o=new ci,l=new ci,h=new $r,c=new ci,u=[],d=[],p=[],m=[];(function(){for(var e=0;e<r;e++)t(e);t(!1===a?r:0),function(){for(var e=0;e<=r;e++)for(var t=0;t<=n;t++)h.x=e/r,h.y=t/n,p.push(h.x,h.y)}(),function(){for(var e=1;e<=r;e++)for(var t=1;t<=n;t++){var i=(n+1)*(e-1)+(t-1),a=(n+1)*e+(t-1),s=(n+1)*e+t,o=(n+1)*(e-1)+t;m.push(i,a,o),m.push(a,s,o)}}()})(),this.setIndex(m),this.setAttribute("position",new Zn(u,3)),this.setAttribute("normal",new Zn(d,3)),this.setAttribute("uv",new Zn(p,2))}toJSON(){var e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Pc((new jh[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Ic extends na{constructor(e){if(super(),this.type="WireframeGeometry",!0!==e.isGeometry){var t=[],r=[0,0],i={},n=new ci;if(null!==e.index){var a=e.attributes.position,s=e.index,o=e.groups;0===o.length&&(o=[{start:0,count:s.count,materialIndex:0}]);for(var l=0,h=o.length;l<h;++l)for(var c=o[l],u=c.start,d=u,p=u+c.count;d<p;d+=3)for(var m=0;3>m;m++){var f=s.getX(d+m),v=s.getX(d+(m+1)%3);r[0]=Math.min(f,v),r[1]=Math.max(f,v);var g=r[0]+","+r[1];void 0===i[g]&&(i[g]={index1:r[0],index2:r[1]})}for(var y in i){var x=i[y];n.fromBufferAttribute(a,x.index1),t.push(n.x,n.y,n.z),n.fromBufferAttribute(a,x.index2),t.push(n.x,n.y,n.z)}}else for(var b=e.attributes.position,w=0,_=b.count/3;w<_;w++)for(var M,S=0;3>S;S++){M=3*w+S,n.fromBufferAttribute(b,M),t.push(n.x,n.y,n.z);var T=3*w+(S+1)%3;n.fromBufferAttribute(b,T),t.push(n.x,n.y,n.z)}this.setAttribute("position",new Zn(t,3))}else console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}var Oc=Object.freeze({__proto__:null,BoxGeometry:Sa,BoxBufferGeometry:Sa,CircleGeometry:fh,CircleBufferGeometry:fh,ConeGeometry:gh,ConeBufferGeometry:gh,CylinderGeometry:vh,CylinderBufferGeometry:vh,DodecahedronGeometry:xh,DodecahedronBufferGeometry:xh,EdgesGeometry:Sh,ExtrudeGeometry:yc,ExtrudeBufferGeometry:yc,IcosahedronGeometry:bc,IcosahedronBufferGeometry:bc,LatheGeometry:wc,LatheBufferGeometry:wc,OctahedronGeometry:_c,OctahedronBufferGeometry:_c,ParametricGeometry:Mc,ParametricBufferGeometry:Mc,PlaneGeometry:ja,PlaneBufferGeometry:ja,PolyhedronGeometry:yh,PolyhedronBufferGeometry:yh,RingGeometry:Sc,RingBufferGeometry:Sc,ShapeGeometry:Tc,ShapeBufferGeometry:Tc,SphereGeometry:Ec,SphereBufferGeometry:Ec,TetrahedronGeometry:Ac,TetrahedronBufferGeometry:Ac,TextGeometry:Lc,TextBufferGeometry:Lc,TorusGeometry:Rc,TorusBufferGeometry:Rc,TorusKnotGeometry:Cc,TorusKnotBufferGeometry:Cc,TubeGeometry:Pc,TubeBufferGeometry:Pc,WireframeGeometry:Ic});class Dc extends En{constructor(e){super(),this.type="ShadowMaterial",this.color=new On(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}Dc.prototype.isShadowMaterial=!0;class Nc extends La{constructor(e){super(e),this.type="RawShaderMaterial"}}Nc.prototype.isRawShaderMaterial=!0;class Bc extends En{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new On(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 On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(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.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this.vertexTangents=e.vertexTangents,this}}Bc.prototype.isMeshStandardMaterial=!0;class Uc extends Bc{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new $r(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=Wr(2.5*(e-1)/(e+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new On(1,1,1),this.setValues(e)}copy(e){return super.copy(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,this.sheen=e.sheen?(this.sheen||new On).copy(e.sheen):null,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this}}Uc.prototype.isMeshPhysicalMaterial=!0;class zc extends En{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new On(16777215),this.specular=new On(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Q,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}zc.prototype.isMeshPhongMaterial=!0;class Fc extends En{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new On(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(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.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this}}Fc.prototype.isMeshToonMaterial=!0;class Gc extends En{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}Gc.prototype.isMeshNormalMaterial=!0;class Vc extends En{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new On(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new On(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Q,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this}}Vc.prototype.isMeshLambertMaterial=!0;class Hc extends En{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new On(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=hr,this.normalScale=new $r(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(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.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}Hc.prototype.isMeshMatcapMaterial=!0;class kc extends ql{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}kc.prototype.isLineDashedMaterial=!0;var jc=Object.freeze({__proto__:null,ShadowMaterial:Dc,SpriteMaterial:dl,RawShaderMaterial:Nc,ShaderMaterial:La,PointsMaterial:nh,MeshPhysicalMaterial:Uc,MeshStandardMaterial:Bc,MeshPhongMaterial:zc,MeshToonMaterial:Fc,MeshNormalMaterial:Gc,MeshLambertMaterial:Vc,MeshDepthMaterial:jo,MeshDistanceMaterial:Wo,MeshBasicMaterial:Dn,MeshMatcapMaterial:Hc,LineDashedMaterial:kc,LineBasicMaterial:ql,Material:En}),Wc={arraySlice:function(e,t,r){return Wc.isTypedArray(e)?new e.constructor(e.subarray(t,void 0===r?e.length:r)):e.slice(t,r)},convertArray:function(e,t,r){return e&&(r||e.constructor!==t)?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,r=Array(t),i=0;i!==t;++i)r[i]=i;return r.sort((function(t,r){return e[t]-e[r]})),r},sortedArray:function(e,t,r){for(var i,n=e.length,a=new e.constructor(n),s=0,o=0;o!==n;++s){i=r[s]*t;for(var l=0;l!==t;++l)a[o++]=e[i+l]}return a},flattenJSON:function(e,t,r,i){for(var n=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[n++];if(void 0!==a){var s=a[i];if(void 0!==s)if(Array.isArray(s))do{void 0!==(s=a[i])&&(t.push(a.time),r.push.apply(r,s)),a=e[n++]}while(void 0!==a);else if(void 0!==s.toArray)do{void 0!==(s=a[i])&&(t.push(a.time),s.toArray(r,r.length)),a=e[n++]}while(void 0!==a);else do{void 0!==(s=a[i])&&(t.push(a.time),r.push(s)),a=e[n++]}while(void 0!==a)}},subclip:function(e,t,r,i){var n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:30,a=e.clone();a.name=t;for(var s=[],o=0;o<a.tracks.length;++o){for(var l,h=a.tracks[o],c=h.getValueSize(),u=[],d=[],p=0;p<h.times.length;++p)if(!((l=h.times[p]*n)<r||l>=i)){u.push(h.times[p]);for(var m=0;m<c;++m)d.push(h.values[p*c+m])}0!==u.length&&(h.times=Wc.convertArray(u,h.times.constructor),h.values=Wc.convertArray(d,h.values.constructor),s.push(h))}a.tracks=s;for(var f=1/0,v=0;v<a.tracks.length;++v)f>a.tracks[v].times[0]&&(f=a.tracks[v].times[0]);for(var g=0;g<a.tracks.length;++g)a.tracks[g].shift(-1*f);return a.resetDuration(),a},makeClipAdditive:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:e,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:30;0>=i&&(i=30);for(var n=r.tracks.length,a=t/i,s=function(){var t=r.tracks[o],i=t.ValueTypeName;if("bool"===i||"string"===i)return 0;var n=e.tracks.find((function(e){return e.name===t.name&&e.ValueTypeName===i}));if(void 0===n)return 0;var s=0,l=t.getValueSize();t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=l/3);var h=0,c=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=c/3);var u,d=t.times.length-1;if(a<=t.times[0]){var p=s,m=l-s;u=Wc.arraySlice(t.values,p,m)}else if(a>=t.times[d]){var f=d*l+s,v=f+l-s;u=Wc.arraySlice(t.values,f,v)}else{var g=t.createInterpolant(),y=s,x=l-s;g.evaluate(a),u=Wc.arraySlice(g.resultBuffer,y,x)}"quaternion"===i&&(new hi).fromArray(u).normalize().conjugate().toArray(u);for(var b,w=n.times.length,_=0;_<w;++_)if(b=_*c+h,"quaternion"===i)hi.multiplyQuaternionsFlat(n.values,b,u,0,n.values,b);else for(var M=c-2*h,S=0;S<M;++S)n.values[b+S]-=u[S]},o=0;o<n;++o)s();return e.blendMode=Yt,e}};class Zc{constructor(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0===i?new t.constructor(r):i,this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){var t=this.parameterPositions,r=this._cachedIndex,i=t[r],n=t[r-1];e:{t:{var a;r:{i:if(!(e<i)){for(var s=r+2;;){if(void 0===i){if(e<n)break i;return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,e,n)}if(r===s)break;if(n=i,e<(i=t[++r]))break t}a=t.length;break r}if(e>=n)break e;var o=t[1];e<o&&(r=2,n=o);for(var l=r-2;;){if(void 0===n)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(r===l)break;if(i=n,e>=(n=t[--r-1]))break t}a=r,r=0}for(;r<a;){var h=r+a>>>1;e<t[h]?a=h:r=h+1}if(i=t[r],void 0===(n=t[r-1]))return this._cachedIndex=0,this.beforeStart_(0,e,i);if(void 0===i)return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,n,e)}this._cachedIndex=r,this.intervalChanged_(r,n,i)}return this.interpolate_(r,n,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){for(var t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=e*i,a=0;a!==i;++a)t[a]=r[n+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Zc.prototype.beforeStart_=Zc.prototype.copySampleValue_,Zc.prototype.afterEnd_=Zc.prototype.copySampleValue_;class qc extends Zc{constructor(e,t,r,i){super(e,t,r,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Wt,endingEnd:Wt}}intervalChanged_(e,t,r){var i=this.parameterPositions,n=e-2,a=e+1,s=i[n],o=i[a];if(void 0===s)switch(this.getSettings_().endingStart){case Zt:n=e,s=2*t-r;break;case qt:s=t+i[n=i.length-2]-i[n+1];break;default:n=e,s=r}if(void 0===o)switch(this.getSettings_().endingEnd){case Zt:a=e,o=2*r-t;break;case qt:a=1,o=r+i[1]-i[0];break;default:a=e-1,o=t}var l=.5*(r-t),h=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-r),this._offsetPrev=n*h,this._offsetNext=a*h}interpolate_(e,t,r,i){for(var n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(r-t)/(i-t),m=p*p,f=m*p,v=-u*f+2*u*m-u*p,g=(1+u)*f+(-1.5-2*u)*m+(-.5+u)*p+1,y=(-1-d)*f+(1.5+d)*m+.5*p,x=d*f-d*m,b=0;b!==s;++b)n[b]=v*a[h+b]+g*a[l+b]+y*a[o+b]+x*a[c+b];return n}}class Xc extends Zc{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){for(var n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=(r-t)/(i-t),c=1-h,u=0;u!==s;++u)n[u]=a[l+u]*c+a[o+u]*h;return n}}class Yc extends Zc{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class Jc{constructor(e,t,r,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=Wc.convertArray(t,this.TimeBufferType),this.values=Wc.convertArray(r,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){var t,r=e.constructor;if(r.toJSON!==this.toJSON)t=r.toJSON(e);else{t={name:e.name,times:Wc.convertArray(e.times,Array),values:Wc.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new Yc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Xc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new qc(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){var t;if(e===Ht?t=this.InterpolantFactoryMethodDiscrete:e===kt?t=this.InterpolantFactoryMethodLinear:e===jt&&(t=this.InterpolantFactoryMethodSmooth),void 0===t){var r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(r);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ht;case this.InterpolantFactoryMethodLinear:return kt;case this.InterpolantFactoryMethodSmooth:return jt}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e)for(var t=this.times,r=0,i=t.length;r!==i;++r)t[r]+=e;return this}scale(e){if(1!==e)for(var t=this.times,r=0,i=t.length;r!==i;++r)t[r]*=e;return this}trim(e,t){for(var r=this.times,i=r.length,n=0,a=i-1;n!==i&&r[n]<e;)++n;for(;-1!==a&&r[a]>t;)--a;if(++a,0!==n||a!==i){n>=a&&(n=(a=Math.max(a,1))-1);var s=this.getValueSize();this.times=Wc.arraySlice(r,n,a),this.values=Wc.arraySlice(this.values,n*s,a*s)}return this}validate(){var e=!0,t=this.getValueSize();0!=t-Math.floor(t)&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var r=this.times,i=this.values,n=r.length;0===n&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a,s=null,o=0;o!==n;o++){if("number"==typeof(a=r[o])&&isNaN(a)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,a),e=!1;break}if(null!==s&&s>a){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,a,s),e=!1;break}s=a}if(void 0!==i&&Wc.isTypedArray(i))for(var l,h=0,c=i.length;h!==c;++h)if(l=i[h],isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,h,l),e=!1;break}return e}optimize(){for(var e=Wc.arraySlice(this.times),t=Wc.arraySlice(this.values),r=this.getValueSize(),i=this.getInterpolation()===jt,n=e.length-1,a=1,s=1;s<n;++s){var o=!1,l=e[s];if(l!==e[s+1]&&(1!==s||l!==e[0]))if(i)o=!0;else for(var h,c=s*r,u=c-r,d=c+r,p=0;p!==r;++p)if((h=t[c+p])!==t[u+p]||h!==t[d+p]){o=!0;break}if(o){if(s!==a){e[a]=e[s];for(var m=s*r,f=a*r,v=0;v!==r;++v)t[f+v]=t[m+v]}++a}}if(0<n){e[a]=e[n];for(var g=n*r,y=a*r,x=0;x!==r;++x)t[y+x]=t[g+x];++a}return a===e.length?(this.times=e,this.values=t):(this.times=Wc.arraySlice(e,0,a),this.values=Wc.arraySlice(t,0,a*r)),this}clone(){var e=Wc.arraySlice(this.times,0),t=Wc.arraySlice(this.values,0),r=new(0,this.constructor)(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Jc.prototype.TimeBufferType=Float32Array,Jc.prototype.ValueBufferType=Float32Array,Jc.prototype.DefaultInterpolation=kt;class Kc extends Jc{}Kc.prototype.ValueTypeName="bool",Kc.prototype.ValueBufferType=Array,Kc.prototype.DefaultInterpolation=Ht,Kc.prototype.InterpolantFactoryMethodLinear=void 0,Kc.prototype.InterpolantFactoryMethodSmooth=void 0;class Qc extends Jc{}Qc.prototype.ValueTypeName="color";class $c extends Jc{}$c.prototype.ValueTypeName="number";class eu extends Zc{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){for(var n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(r-t)/(i-t),l=e*s,h=l+s;l!==h;l+=4)hi.slerpFlat(n,0,a,l-s,a,l,o);return n}}class tu extends Jc{InterpolantFactoryMethodLinear(e){return new eu(this.times,this.values,this.getValueSize(),e)}}tu.prototype.ValueTypeName="quaternion",tu.prototype.DefaultInterpolation=kt,tu.prototype.InterpolantFactoryMethodSmooth=void 0;class ru extends Jc{}ru.prototype.ValueTypeName="string",ru.prototype.ValueBufferType=Array,ru.prototype.DefaultInterpolation=Ht,ru.prototype.InterpolantFactoryMethodLinear=void 0,ru.prototype.InterpolantFactoryMethodSmooth=void 0;class iu extends Jc{}iu.prototype.ValueTypeName="vector";class nu{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:-1,r=2<arguments.length?arguments[2]:void 0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:Xt;this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=jr(),0>this.duration&&this.resetDuration()}static parse(e){for(var t=[],r=e.tracks,i=1/(e.fps||1),n=0,a=r.length;n!==a;++n)t.push(au(r[n]).scale(i));var s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){for(var t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},n=0,a=r.length;n!==a;++n)t.push(Jc.toJSON(r[n]));return i}static CreateFromMorphTargetSequence(e,t,r,i){for(var n=t.length,a=[],s=0;s<n;s++){var o=[],l=[];o.push((s+n-1)%n,s,(s+1)%n),l.push(0,1,0);var h=Wc.getKeyframeOrder(o);o=Wc.sortedArray(o,1,h),l=Wc.sortedArray(l,1,h),i||0!==o[0]||(o.push(n),l.push(l[0])),a.push(new $c(".morphTargetInfluences["+t[s].name+"]",o,l).scale(1/r))}return new this(e,-1,a)}static findByName(e,t){var r=e;if(!Array.isArray(e)){var i=e;r=i.geometry&&i.geometry.animations||i.animations}for(var n=0;n<r.length;n++)if(r[n].name===t)return r[n];return null}static CreateClipsFromMorphTargetSequences(e,t,r){for(var i={},n=/^([\w-]*?)([\d]+)$/,a=0,s=e.length;a<s;a++){var o=e[a],l=o.name.match(n);if(l&&1<l.length){var h=l[1],c=i[h];c||(i[h]=c=[]),c.push(o)}}var u=[];for(var d in i)u.push(this.CreateFromMorphTargetSequence(d,i[d],t,r));return u}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var r,i=function(e,t,r,i,n){if(0!==r.length){var a=[],s=[];Wc.flattenJSON(r,a,s,i),0!==a.length&&n.push(new e(t,a,s))}},n=[],a=e.name||"default",s=e.fps||30,o=e.blendMode,l=e.length||-1,h=e.hierarchy||[],c=0;c<h.length;c++)if((r=h[c].keys)&&0!==r.length)if(r[0].morphTargets){var u={},d=void 0;for(d=0;d<r.length;d++)if(r[d].morphTargets)for(var p=0;p<r[d].morphTargets.length;p++)u[r[d].morphTargets[p]]=-1;for(var m in u){for(var f,v=[],g=[],y=0;y!==r[d].morphTargets.length;++y)f=r[d],v.push(f.time),g.push(f.morphTarget===m?1:0);n.push(new $c(".morphTargetInfluence["+m+"]",v,g))}l=u.length*(s||1)}else{var x=".bones["+t[c].name+"]";i(iu,x+".position",r,"pos",n),i(tu,x+".quaternion",r,"rot",n),i(iu,x+".scale",r,"scl",n)}return 0===n.length?null:new this(a,l,n,o)}resetDuration(){for(var e,t=0,r=0,i=this.tracks.length;r!==i;++r)e=this.tracks[r],t=Math.max(t,e.times[e.times.length-1]);return this.duration=t,this}trim(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function au(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 $c;case"vector":case"vector2":case"vector3":case"vector4":return iu;case"color":return Qc;case"quaternion":return tu;case"bool":case"boolean":return Kc;case"string":return ru}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){var r=[],i=[];Wc.flattenJSON(e.keys,r,i,"value"),e.times=r,e.values=i}return void 0===t.parse?new t(e.name,e.times,e.values,e.interpolation):t.parse(e)}var su={enabled:!1,files:{},add:function(e,t){!1===this.enabled||(this.files[e]=t)},get:function(e){return!1===this.enabled?void 0:this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class ou{constructor(e,t,r){var i=this,n=!1,a=0,s=0,o=void 0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){s++,!1===n&&void 0!==i.onStart&&i.onStart(e,a,s),n=!0},this.itemEnd=function(e){a++,void 0!==i.onProgress&&i.onProgress(e,a,s),a===s&&(n=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return o?o(e):e},this.setURLModifier=function(e){return o=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,r=l.length;t<r;t+=2){var i=l[t],n=l[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return n}return null}}}var lu=new ou;class hu{constructor(e){this.manager=void 0===e?lu:e,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){var r=this;return new Promise((function(i,n){r.load(e,i,t,n)}))}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}var cu={};class uu extends hu{constructor(e){super(e)}load(e,t,r,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var n=this,a=su.get(e);if(void 0!==a)return n.manager.itemStart(e),setTimeout((function(){t&&t(a),n.manager.itemEnd(e)}),0),a;if(void 0===cu[e]){var s,o=e.match(/^data:(.*?)(;base64)?,(.*)$/);if(o){var l=o[1],h=!!o[2],c=o[3];c=decodeURIComponent(c),h&&(c=atob(c));try{var u,d=(this.responseType||"").toLowerCase();switch(d){case"arraybuffer":case"blob":for(var p=new Uint8Array(c.length),m=0;m<c.length;m++)p[m]=c.charCodeAt(m);u="blob"===d?new Blob([p.buffer],{type:l}):p.buffer;break;case"document":var f=new DOMParser;u=f.parseFromString(c,l);break;case"json":u=JSON.parse(c);break;default:u=c}setTimeout((function(){t&&t(u),n.manager.itemEnd(e)}),0)}catch(t){setTimeout((function(){i&&i(t),n.manager.itemError(e),n.manager.itemEnd(e)}),0)}}else{for(var v in cu[e]=[],cu[e].push({onLoad:t,onProgress:r,onError:i}),(s=new XMLHttpRequest).open("GET",e,!0),s.addEventListener("load",(function(t){var r=this.response,i=cu[e];if(delete cu[e],200===this.status||0===this.status){0===this.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),su.add(e,r);for(var a,s=0,o=i.length;s<o;s++)(a=i[s]).onLoad&&a.onLoad(r);n.manager.itemEnd(e)}else{for(var l,h=0,c=i.length;h<c;h++)(l=i[h]).onError&&l.onError(t);n.manager.itemError(e),n.manager.itemEnd(e)}}),!1),s.addEventListener("progress",(function(t){for(var r,i=cu[e],n=0,a=i.length;n<a;n++)(r=i[n]).onProgress&&r.onProgress(t)}),!1),s.addEventListener("error",(function(t){var r=cu[e];delete cu[e];for(var i,a=0,s=r.length;a<s;a++)(i=r[a]).onError&&i.onError(t);n.manager.itemError(e),n.manager.itemEnd(e)}),!1),s.addEventListener("abort",(function(t){var r=cu[e];delete cu[e];for(var i,a=0,s=r.length;a<s;a++)(i=r[a]).onError&&i.onError(t);n.manager.itemError(e),n.manager.itemEnd(e)}),!1),void 0!==this.responseType&&(s.responseType=this.responseType),void 0!==this.withCredentials&&(s.withCredentials=this.withCredentials),s.overrideMimeType&&s.overrideMimeType(void 0===this.mimeType?"text/plain":this.mimeType),this.requestHeader)s.setRequestHeader(v,this.requestHeader[v]);s.send(null)}return n.manager.itemStart(e),s}cu[e].push({onLoad:t,onProgress:r,onError:i})}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class du extends hu{constructor(e){super(e)}load(e,t,r,i){var n=this,a=new uu(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(r){try{t(n.parse(JSON.parse(r)))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}}),r,i)}parse(e){for(var t,r=[],i=0;i<e.length;i++)t=nu.parse(e[i]),r.push(t);return r}}class pu extends hu{constructor(e){super(e)}load(e,t,r,i){function n(n){l.load(e[n],(function(e){var r=a.parse(e,!0);s[n]={width:r.width,height:r.height,format:r.format,mipmaps:r.mipmaps},6===(h+=1)&&(1===r.mipmapCount&&(o.minFilter=_e),o.image=s,o.format=r.format,o.needsUpdate=!0,t&&t(o))}),r,i)}var a=this,s=[],o=new dh,l=new uu(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(a.withCredentials);var h=0;if(Array.isArray(e))for(var c=0,u=e.length;c<u;++c)n(c);else l.load(e,(function(e){var r=a.parse(e,!0);if(r.isCubemap){for(var i=r.mipmaps.length/r.mipmapCount,n=0;n<i;n++){s[n]={mipmaps:[]};for(var l=0;l<r.mipmapCount;l++)s[n].mipmaps.push(r.mipmaps[n*r.mipmapCount+l]),s[n].format=r.format,s[n].width=r.width,s[n].height=r.height}o.image=s}else o.image.width=r.width,o.image.height=r.height,o.mipmaps=r.mipmaps;1===r.mipmapCount&&(o.minFilter=_e),o.format=r.format,o.needsUpdate=!0,t&&t(o)}),r,i);return o}}class mu extends hu{constructor(e){super(e)}load(e,t,r,i){function n(){l.removeEventListener("load",n,!1),l.removeEventListener("error",a,!1),su.add(e,this),t&&t(this),s.manager.itemEnd(e)}function a(t){l.removeEventListener("load",n,!1),l.removeEventListener("error",a,!1),i&&i(t),s.manager.itemError(e),s.manager.itemEnd(e)}void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var s=this,o=su.get(e);if(void 0!==o)return s.manager.itemStart(e),setTimeout((function(){t&&t(o),s.manager.itemEnd(e)}),0),o;var l=document.createElementNS("http://www.w3.org/1999/xhtml","img");return l.addEventListener("load",n,!1),l.addEventListener("error",a,!1),"data:"!==e.substr(0,5)&&void 0!==this.crossOrigin&&(l.crossOrigin=this.crossOrigin),s.manager.itemStart(e),l.src=e,l}}class fu extends hu{constructor(e){super(e)}load(e,t,r,i){function n(r){s.load(e[r],(function(e){a.images[r]=e,6==++o&&(a.needsUpdate=!0,t&&t(a))}),void 0,i)}var a=new Oa,s=new mu(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);for(var o=0,l=0;l<e.length;++l)n(l);return a}}class vu extends hu{constructor(e){super(e)}load(e,t,r,i){var n=this,a=new zl,s=new uu(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(n.withCredentials),s.load(e,(function(e){var r=n.parse(e);r&&(void 0===r.image?void 0!==r.data&&(a.image.width=r.width,a.image.height=r.height,a.image.data=r.data):a.image=r.image,a.wrapS=void 0===r.wrapS?fe:r.wrapS,a.wrapT=void 0===r.wrapT?fe:r.wrapT,a.magFilter=void 0===r.magFilter?_e:r.magFilter,a.minFilter=void 0===r.minFilter?_e:r.minFilter,a.anisotropy=void 0===r.anisotropy?1:r.anisotropy,void 0!==r.encoding&&(a.encoding=r.encoding),void 0!==r.flipY&&(a.flipY=r.flipY),void 0!==r.format&&(a.format=r.format),void 0!==r.type&&(a.type=r.type),void 0!==r.mipmaps&&(a.mipmaps=r.mipmaps,a.minFilter=Te),1===r.mipmapCount&&(a.minFilter=_e),void 0!==r.generateMipmaps&&(a.generateMipmaps=r.generateMipmaps),a.needsUpdate=!0,t&&t(a,r))}),r,i),a}}class gu extends hu{constructor(e){super(e)}load(e,t,r,i){var n=new ii,a=new mu(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,(function(r){n.image=r;var i=0<e.search(/\.jpe?g($|\?)/i)||0===e.search(/^data\:image\/jpeg/);n.format=i?Ge:Ve,n.needsUpdate=!0,void 0!==t&&t(n)}),r,i),n}}class yu extends Th{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Fh(t,e))}getPoint(e){for(var t=e*this.getLength(),r=this.getCurveLengths(),i=0;i<r.length;){if(r[i]>=t){var n=r[i]-t,a=this.curves[i],s=a.getLength(),o=0===s?0:1-n/s;return a.getPointAt(o)}i++}return null}getLength(){var e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,r=0,i=this.curves.length;r<i;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:40,t=[],r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(){for(var e,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:12,r=[],i=0,n=this.curves;i<n.length;i++)for(var a,s=n[i],o=s&&s.isEllipseCurve?2*t:s&&(s.isLineCurve||s.isLineCurve3)?1:s&&s.isSplineCurve?t*s.points.length:t,l=s.getPoints(o),h=0;h<l.length;h++)a=l[h],e&&e.equals(a)||(r.push(a),e=a);return this.autoClose&&1<r.length&&!r[r.length-1].equals(r[0])&&r.push(r[0]),r}copy(e){super.copy(e),this.curves=[];for(var t,r=0,i=e.curves.length;r<i;r++)t=e.curves[r],this.curves.push(t.clone());return this.autoClose=e.autoClose,this}toJSON(){var e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(var t,r=0,i=this.curves.length;r<i;r++)t=this.curves[r],e.curves.push(t.toJSON());return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(var t,r=0,i=e.curves.length;r<i;r++)t=e.curves[r],this.curves.push((new jh[t.type]).fromJSON(t));return this}}class xu extends yu{constructor(e){super(),this.type="Path",this.currentPoint=new $r,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(var t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){var r=new Fh(this.currentPoint.clone(),new $r(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,i){var n=new Vh(this.currentPoint.clone(),new $r(e,t),new $r(r,i));return this.curves.push(n),this.currentPoint.set(r,i),this}bezierCurveTo(e,t,r,i,n,a){var s=new Uh(this.currentPoint.clone(),new $r(e,t),new $r(r,i),new $r(n,a));return this.curves.push(s),this.currentPoint.set(n,a),this}splineThru(e){var t=[this.currentPoint.clone()].concat(e),r=new kh(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,i,n,a){var s=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(e+s,t+o,r,i,n,a),this}absarc(e,t,r,i,n,a){return this.absellipse(e,t,r,r,i,n,a),this}ellipse(e,t,r,i,n,a,s,o){var l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,r,i,n,a,s,o),this}absellipse(e,t,r,i,n,a,s,o){var l=new Eh(e,t,r,i,n,a,s,o);if(0<this.curves.length){var h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);var c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){var e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class bu extends xu{constructor(e){super(e),this.uuid=jr(),this.type="Shape",this.holes=[]}getPointsHoles(e){for(var t=[],r=0,i=this.holes.length;r<i;r++)t[r]=this.holes[r].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(var t,r=0,i=e.holes.length;r<i;r++)t=e.holes[r],this.holes.push(t.clone());return this}toJSON(){var e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(var t,r=0,i=this.holes.length;r<i;r++)t=this.holes[r],e.holes.push(t.toJSON());return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(var t,r=0,i=e.holes.length;r<i;r++)t=e.holes[r],this.holes.push((new xu).fromJSON(t));return this}}class wu extends pn{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1;super(),this.type="Light",this.color=new On(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){var t=super.toJSON(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}}wu.prototype.isLight=!0;class _u extends wu{constructor(e,t,r){super(e,r),this.type="HemisphereLight",this.position.copy(pn.DefaultUp),this.updateMatrix(),this.groundColor=new On(t)}copy(e){return wu.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}_u.prototype.isHemisphereLight=!0;var Mu=new Vi,Su=new ci,Tu=new ci;class Eu{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new $r(512,512),this.map=null,this.mapPass=null,this.matrix=new Vi,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Va,this._frameExtents=new $r(1,1),this._viewportCount=1,this._viewports=[new ai(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){var t=this.camera,r=this.matrix;Su.setFromMatrixPosition(e.matrixWorld),t.position.copy(Su),Tu.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Tu),t.updateMatrixWorld(),Mu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Mu),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(t.projectionMatrix),r.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){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}}class Au extends Eu{constructor(){super(new Ca(50,1,.5,500)),this.focus=1}updateMatrices(e){var t=this.camera,r=2*kr*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,n=e.distance||t.far;(r!==t.fov||i!==t.aspect||n!==t.far)&&(t.fov=r,t.aspect=i,t.far=n,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}Au.prototype.isSpotLightShadow=!0;class Lu extends wu{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:Math.PI/3,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:1;super(e,t),this.type="SpotLight",this.position.copy(pn.DefaultUp),this.updateMatrix(),this.target=new pn,this.distance=r,this.angle=i,this.penumbra=n,this.decay=a,this.shadow=new Au}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(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}}Lu.prototype.isSpotLight=!0;var Ru=new Vi,Cu=new ci,Pu=new ci;class Iu extends Eu{constructor(){super(new Ca(90,1,.5,500)),this._frameExtents=new $r(4,2),this._viewportCount=6,this._viewports=[new ai(2,1,1,1),new ai(0,1,1,1),new ai(3,1,1,1),new ai(1,1,1,1),new ai(3,0,1,1),new ai(1,0,1,1)],this._cubeDirections=[new ci(1,0,0),new ci(-1,0,0),new ci(0,0,1),new ci(0,0,-1),new ci(0,1,0),new ci(0,-1,0)],this._cubeUps=[new ci(0,1,0),new ci(0,1,0),new ci(0,1,0),new ci(0,1,0),new ci(0,0,1),new ci(0,0,-1)]}updateMatrices(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=this.camera,i=this.matrix,n=e.distance||r.far;n!==r.far&&(r.far=n,r.updateProjectionMatrix()),Cu.setFromMatrixPosition(e.matrixWorld),r.position.copy(Cu),Pu.copy(r.position),Pu.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(Pu),r.updateMatrixWorld(),i.makeTranslation(-Cu.x,-Cu.y,-Cu.z),Ru.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ru)}}Iu.prototype.isPointLightShadow=!0;class Ou extends wu{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;super(e,t),this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new Iu}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}Ou.prototype.isPointLight=!0;class Du extends Ra{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:-1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:-1,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:.1,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:2e3;super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=n,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(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(e,t,r,i,n,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=r,this.view.offsetY=i,this.view.width=n,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2,n=r-e,a=r+e,s=i+t,o=i-t;if(null!==this.view&&this.view.enabled){var l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a=(n+=l*this.view.offsetX)+l*this.view.width,o=(s-=h*this.view.offsetY)-h*this.view.height}this.projectionMatrix.makeOrthographic(n,a,s,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){var t=super.toJSON(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}}Du.prototype.isOrthographicCamera=!0;class Nu extends Eu{constructor(){super(new Du(-5,5,5,-5,.5,500))}}Nu.prototype.isDirectionalLightShadow=!0;class Bu extends wu{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(pn.DefaultUp),this.updateMatrix(),this.target=new pn,this.shadow=new Nu}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}Bu.prototype.isDirectionalLight=!0;class Uu extends wu{constructor(e,t){super(e,t),this.type="AmbientLight"}}Uu.prototype.isAmbientLight=!0;class zu extends wu{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:10,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:10;super(e,t),this.type="RectAreaLight",this.width=r,this.height=i}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){var t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}zu.prototype.isRectAreaLight=!0;class Fu{constructor(){this.coefficients=[];for(var e=0;9>e;e++)this.coefficients.push(new ci)}set(e){for(var t=0;9>t;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(var e=0;9>e;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){var r=e.x,i=e.y,n=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*n),t.addScaledVector(a[3],.488603*r),t.addScaledVector(a[4],r*i*1.092548),t.addScaledVector(a[5],i*n*1.092548),t.addScaledVector(a[6],.315392*(3*n*n-1)),t.addScaledVector(a[7],r*n*1.092548),t.addScaledVector(a[8],.546274*(r*r-i*i)),t}getIrradianceAt(e,t){var r=e.x,i=e.y,n=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*n),t.addScaledVector(a[3],1.023328*r),t.addScaledVector(a[4],.858086*r*i),t.addScaledVector(a[5],.858086*i*n),t.addScaledVector(a[6],.743125*n*n-.247708),t.addScaledVector(a[7],.858086*r*n),t.addScaledVector(a[8],.429043*(r*r-i*i)),t}add(e){for(var t=0;9>t;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(var r=0;9>r;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(var t=0;9>t;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(var r=0;9>r;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this}equals(e){for(var t=0;9>t;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=this.coefficients,i=0;9>i;i++)r[i].fromArray(e,t+3*i);return this}toArray(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=this.coefficients,i=0;9>i;i++)r[i].toArray(e,t+3*i);return e}static getBasisAt(e,t){var r=e.x,i=e.y,n=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*n,t[3]=.488603*r,t[4]=1.092548*r*i,t[5]=1.092548*i*n,t[6]=.315392*(3*n*n-1),t[7]=1.092548*r*n,t[8]=.546274*(r*r-i*i)}}Fu.prototype.isSphericalHarmonics3=!0;class Gu extends wu{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new Fu;super(void 0,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1),this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){var t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}Gu.prototype.isLightProbe=!0;class Vu extends hu{constructor(e){super(e),this.textures={}}load(e,t,r,i){var n=this,a=new uu(n.manager);a.setPath(n.path),a.setRequestHeader(n.requestHeader),a.setWithCredentials(n.withCredentials),a.load(e,(function(r){try{t(n.parse(JSON.parse(r)))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}}),r,i)}parse(e){function t(e){return void 0===r[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),r[e]}var r=this.textures,i=new jc[e.type];if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.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 On).setHex(e.sheen)),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.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.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),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.shadowSide&&(i.shadowSide=e.shadowSide),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.morphTargets&&(i.morphTargets=e.morphTargets),void 0!==e.morphNormals&&(i.morphNormals=e.morphNormals),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),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=!!(0<e.vertexColors):i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(var n in e.uniforms){var a=e.uniforms[n];switch(i.uniforms[n]={},a.type){case"t":i.uniforms[n].value=t(a.value);break;case"c":i.uniforms[n].value=(new On).setHex(a.value);break;case"v2":i.uniforms[n].value=(new $r).fromArray(a.value);break;case"v3":i.uniforms[n].value=(new ci).fromArray(a.value);break;case"v4":i.uniforms[n].value=(new ai).fromArray(a.value);break;case"m3":i.uniforms[n].value=(new ei).fromArray(a.value);break;case"m4":i.uniforms[n].value=(new Vi).fromArray(a.value);break;default:i.uniforms[n].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 s in e.extensions)i.extensions[s]=e.extensions[s];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=t(e.map)),void 0!==e.matcap&&(i.matcap=t(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=t(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=t(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=t(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){var o=e.normalScale;!1===Array.isArray(o)&&(o=[o,o]),i.normalScale=(new $r).fromArray(o)}return void 0!==e.displacementMap&&(i.displacementMap=t(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=t(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=t(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=t(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=t(e.specularMap)),void 0!==e.envMap&&(i.envMap=t(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=t(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=t(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=t(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=t(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=t(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=t(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new $r).fromArray(e.clearcoatNormalScale)),void 0!==e.transmissionMap&&(i.transmissionMap=t(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=t(e.thicknessMap)),i}setTextures(e){return this.textures=e,this}}class Hu{static decodeText(e){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);for(var t="",r=0,i=e.length;r<i;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){var t=e.lastIndexOf("/");return-1===t?"./":e.substr(0,t+1)}}class ku extends na{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){var e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}ku.prototype.isInstancedBufferGeometry=!0;class ju extends Un{constructor(e,t,r){var i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1;"number"==typeof r&&(i=r,r=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,r),this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){var e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}ju.prototype.isInstancedBufferAttribute=!0;class Wu extends hu{constructor(e){super(e)}load(e,t,r,i){var n=this,a=new uu(n.manager);a.setPath(n.path),a.setRequestHeader(n.requestHeader),a.setWithCredentials(n.withCredentials),a.load(e,(function(r){try{t(n.parse(JSON.parse(r)))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}}),r,i)}parse(e){function t(e,t){if(void 0!==r[t])return r[t];var n=e.interleavedBuffers[t],a=function(e,t){if(void 0!==i[t])return i[t];var r=e.arrayBuffers[t],n=new Uint32Array(r).buffer;return i[t]=n,n}(e,n.buffer),s=Jn(n.type,a),o=new hl(s,n.stride);return o.uuid=n.uuid,r[t]=o,o}var r={},i={},n=e.isInstancedBufferGeometry?new ku:new na,a=e.data.index;if(void 0!==a){var s=Jn(a.type,a.array);n.setIndex(new Un(s,1))}var o=e.data.attributes;for(var l in o){var h=o[l],c=void 0;if(h.isInterleavedBufferAttribute){var u=t(e.data,h.data);c=new ul(u,h.itemSize,h.offset,h.normalized)}else{var d=Jn(h.type,h.array);c=new(h.isInstancedBufferAttribute?ju:Un)(d,h.itemSize,h.normalized)}void 0!==h.name&&(c.name=h.name),void 0!==h.usage&&c.setUsage(h.usage),void 0!==h.updateRange&&(c.updateRange.offset=h.updateRange.offset,c.updateRange.count=h.updateRange.count),n.setAttribute(l,c)}var p=e.data.morphAttributes;if(p)for(var m in p){for(var f=p[m],v=[],g=0,y=f.length;g<y;g++){var x=f[g],b=void 0;if(x.isInterleavedBufferAttribute){var w=t(e.data,x.data);b=new ul(w,x.itemSize,x.offset,x.normalized)}else{var _=Jn(x.type,x.array);b=new Un(_,x.itemSize,x.normalized)}void 0!==x.name&&(b.name=x.name),v.push(b)}n.morphAttributes[m]=v}e.data.morphTargetsRelative&&(n.morphTargetsRelative=!0);var M=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==M)for(var S,T=0,E=M.length;T!==E;++T)S=M[T],n.addGroup(S.start,S.count,S.materialIndex);var A=e.data.boundingSphere;if(void 0!==A){var L=new ci;void 0!==A.center&&L.fromArray(A.center),n.boundingSphere=new Ii(L,A.radius)}return e.name&&(n.name=e.name),e.userData&&(n.userData=e.userData),n}}class Zu extends hu{constructor(e){super(e)}load(e,t,r,i){var n=this,a=""===this.path?Hu.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var s=new uu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(r){var a=null;try{a=JSON.parse(r)}catch(t){return void 0!==i&&i(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}var s=a.metadata;return void 0===s||void 0===s.type||"geometry"===s.type.toLowerCase()?void console.error("THREE.ObjectLoader: Can't load "+e):void n.parse(a,t)}),r,i)}loadAsync(e,t){var r=this;return n((function*(){var i=r,n=""===r.path?Hu.extractUrlBase(e):r.path;r.resourcePath=r.resourcePath||n;var a=new uu(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials);var s=yield a.loadAsync(e,t),o=JSON.parse(s),l=o.metadata;if(void 0===l||void 0===l.type||"geometry"===l.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+e);return yield i.parseAsync(o)}))()}parse(e,t){var r=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),n=this.parseGeometries(e.geometries,i),a=this.parseImages(e.images,(function(){void 0!==t&&t(l)})),s=this.parseTextures(e.textures,a),o=this.parseMaterials(e.materials,s),l=this.parseObject(e.object,n,o,s,r),h=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,h),void 0!==t){var c=!1;for(var u in a)if(a[u]instanceof HTMLImageElement){c=!0;break}0==c&&t(l)}return l}parseAsync(e){var t=this;return n((function*(){var r=t.parseAnimations(e.animations),i=t.parseShapes(e.shapes),n=t.parseGeometries(e.geometries,i),a=yield t.parseImagesAsync(e.images),s=t.parseTextures(e.textures,a),o=t.parseMaterials(e.materials,s),l=t.parseObject(e.object,n,o,s,r),h=t.parseSkeletons(e.skeletons,l);return t.bindSkeletons(l,h),l}))()}parseShapes(e){var t={};if(void 0!==e)for(var r,i=0,n=e.length;i<n;i++)t[(r=(new bu).fromJSON(e[i])).uuid]=r;return t}parseSkeletons(e,t){var r={},i={};if(t.traverse((function(e){e.isBone&&(i[e.uuid]=e)})),void 0!==e)for(var n,a=0,s=e.length;a<s;a++)r[(n=(new Vl).fromJSON(e[a],i)).uuid]=n;return r}parseGeometries(e,t){var r={};if(void 0!==e)for(var i=new Wu,n=0,a=e.length;n<a;n++){var s=void 0,o=e[n];switch(o.type){case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(o);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:o.type in Oc?s=Oc[o.type].fromJSON(o,t):console.warn('THREE.ObjectLoader: Unsupported geometry type "'.concat(o.type,'"'))}s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),!0===s.isBufferGeometry&&void 0!==o.userData&&(s.userData=o.userData),r[o.uuid]=s}return r}parseMaterials(e,t){var r={},i={};if(void 0!==e){var n=new Vu;n.setTextures(t);for(var a,s=0,o=e.length;s<o;s++)if("MultiMaterial"===(a=e[s]).type){for(var l,h=[],c=0;c<a.materials.length;c++)void 0===r[(l=a.materials[c]).uuid]&&(r[l.uuid]=n.parse(l)),h.push(r[l.uuid]);i[a.uuid]=h}else void 0===r[a.uuid]&&(r[a.uuid]=n.parse(a)),i[a.uuid]=r[a.uuid]}return i}parseAnimations(e){var t={};if(void 0!==e)for(var r=0;r<e.length;r++){var i=e[r],n=nu.parse(i);t[n.uuid]=n}return t}parseImages(e,t){function r(e){if("string"==typeof e){var t=e;return function(e){return n.manager.itemStart(e),i.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemError(e),n.manager.itemEnd(e)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:n.resourcePath+t)}return e.data?{data:Jn(e.type,e.data),width:e.width,height:e.height}:null}var i,n=this,a={};if(void 0!==e&&0<e.length){var s=new ou(t);(i=new mu(s)).setCrossOrigin(this.crossOrigin);for(var o=0,l=e.length;o<l;o++){var h=e[o],c=h.url;if(Array.isArray(c)){a[h.uuid]=[];for(var u=0,d=c.length;u<d;u++){var p=r(c[u]);null!==p&&(p instanceof HTMLImageElement?a[h.uuid].push(p):a[h.uuid].push(new zl(p.data,p.width,p.height)))}}else{var m=r(h.url);null!==m&&(a[h.uuid]=m)}}}return a}parseImagesAsync(e){var t=this;return n((function*(){function r(e){return i.apply(this,arguments)}function i(){return i=n((function*(e){if("string"==typeof e){var t=e,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:s.resourcePath+t;return yield a.loadAsync(r)}return e.data?{data:Jn(e.type,e.data),width:e.width,height:e.height}:null})),i.apply(this,arguments)}var a,s=t,o={};if(void 0!==e&&0<e.length){(a=new mu(t.manager)).setCrossOrigin(t.crossOrigin);for(var l=0,h=e.length;l<h;l++){var c=e[l],u=c.url;if(Array.isArray(u)){o[c.uuid]=[];for(var d=0,p=u.length;d<p;d++){var m=u[d],f=yield r(m);null!==f&&(f instanceof HTMLImageElement?o[c.uuid].push(f):o[c.uuid].push(new zl(f.data,f.width,f.height)))}}else{var v=yield r(c.url);null!==v&&(o[c.uuid]=v)}}}return o}))()}parseTextures(e,t){function r(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}var i={};if(void 0!==e)for(var n,a=0,s=e.length;a<s;a++){void 0===(n=e[a]).image&&console.warn('THREE.ObjectLoader: No "image" specified for',n.uuid),void 0===t[n.image]&&console.warn("THREE.ObjectLoader: Undefined image",n.image);var o=void 0,l=t[n.image];Array.isArray(l)?(o=new Oa(l),6===l.length&&(o.needsUpdate=!0)):(o=l&&l.data?new zl(l.data,l.width,l.height):new ii(l),l&&(o.needsUpdate=!0)),o.uuid=n.uuid,void 0!==n.name&&(o.name=n.name),void 0!==n.mapping&&(o.mapping=r(n.mapping,qu)),void 0!==n.offset&&o.offset.fromArray(n.offset),void 0!==n.repeat&&o.repeat.fromArray(n.repeat),void 0!==n.center&&o.center.fromArray(n.center),void 0!==n.rotation&&(o.rotation=n.rotation),void 0!==n.wrap&&(o.wrapS=r(n.wrap[0],Xu),o.wrapT=r(n.wrap[1],Xu)),void 0!==n.format&&(o.format=n.format),void 0!==n.type&&(o.type=n.type),void 0!==n.encoding&&(o.encoding=n.encoding),void 0!==n.minFilter&&(o.minFilter=r(n.minFilter,Yu)),void 0!==n.magFilter&&(o.magFilter=r(n.magFilter,Yu)),void 0!==n.anisotropy&&(o.anisotropy=n.anisotropy),void 0!==n.flipY&&(o.flipY=n.flipY),void 0!==n.premultiplyAlpha&&(o.premultiplyAlpha=n.premultiplyAlpha),void 0!==n.unpackAlignment&&(o.unpackAlignment=n.unpackAlignment),i[n.uuid]=o}return i}parseObject(e,t,r,i,n){function a(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function s(e){if(void 0!==e){if(Array.isArray(e)){for(var t,i=[],n=0,a=e.length;n<a;n++)t=e[n],void 0===r[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i.push(r[t]);return i}return void 0===r[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),r[e]}}function o(e){return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),i[e]}var l,h,c;switch(e.type){case"Scene":l=new ll,void 0!==e.background&&(Number.isInteger(e.background)?l.background=new On(e.background):l.background=o(e.background)),void 0!==e.environment&&(l.environment=o(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?l.fog=new ol(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(l.fog=new sl(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":l=new Ca(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(l.focus=e.focus),void 0!==e.zoom&&(l.zoom=e.zoom),void 0!==e.filmGauge&&(l.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(l.filmOffset=e.filmOffset),void 0!==e.view&&(l.view=Object.assign({},e.view));break;case"OrthographicCamera":l=new Du(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(l.zoom=e.zoom),void 0!==e.view&&(l.view=Object.assign({},e.view));break;case"AmbientLight":l=new Uu(e.color,e.intensity);break;case"DirectionalLight":l=new Bu(e.color,e.intensity);break;case"PointLight":l=new Ou(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":l=new zu(e.color,e.intensity,e.width,e.height);break;case"SpotLight":l=new Lu(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":l=new _u(e.color,e.groundColor,e.intensity);break;case"LightProbe":l=(new Gu).fromJSON(e);break;case"SkinnedMesh":h=a(e.geometry),c=s(e.material),l=new Bl(h,c),void 0!==e.bindMode&&(l.bindMode=e.bindMode),void 0!==e.bindMatrix&&l.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(l.skeleton=e.skeleton);break;case"Mesh":h=a(e.geometry),c=s(e.material),l=new _a(h,c);break;case"InstancedMesh":h=a(e.geometry),c=s(e.material);var u=e.count,d=e.instanceMatrix,p=e.instanceColor;(l=new Zl(h,c,u)).instanceMatrix=new Un(new Float32Array(d.array),16),void 0!==p&&(l.instanceColor=new Un(new Float32Array(p.array),p.itemSize));break;case"LOD":l=new Cl;break;case"Line":l=new $l(a(e.geometry),s(e.material));break;case"LineLoop":l=new ih(a(e.geometry),s(e.material));break;case"LineSegments":l=new rh(a(e.geometry),s(e.material));break;case"PointCloud":case"Points":l=new hh(a(e.geometry),s(e.material));break;case"Sprite":l=new El(s(e.material));break;case"Group":l=new $o;break;case"Bone":l=new Ul;break;default:l=new pn}if(l.uuid=e.uuid,void 0!==e.name&&(l.name=e.name),void 0===e.matrix?(void 0!==e.position&&l.position.fromArray(e.position),void 0!==e.rotation&&l.rotation.fromArray(e.rotation),void 0!==e.quaternion&&l.quaternion.fromArray(e.quaternion),void 0!==e.scale&&l.scale.fromArray(e.scale)):(l.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&l.matrix.decompose(l.position,l.quaternion,l.scale)),void 0!==e.castShadow&&(l.castShadow=e.castShadow),void 0!==e.receiveShadow&&(l.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(l.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(l.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(l.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&l.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(l.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(l.visible=e.visible),void 0!==e.frustumCulled&&(l.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(l.renderOrder=e.renderOrder),void 0!==e.userData&&(l.userData=e.userData),void 0!==e.layers&&(l.layers.mask=e.layers),void 0!==e.children)for(var m=e.children,f=0;f<m.length;f++)l.add(this.parseObject(m[f],t,r,i,n));if(void 0!==e.animations)for(var v,g=e.animations,y=0;y<g.length;y++)v=g[y],l.animations.push(n[v]);if("LOD"===e.type){void 0!==e.autoUpdate&&(l.autoUpdate=e.autoUpdate);for(var x=e.levels,b=0;b<x.length;b++){var w=x[b],_=l.getObjectByProperty("uuid",w.object);void 0!==_&&l.addLevel(_,w.distance)}}return l}bindSkeletons(e,t){0===Object.keys(t).length||e.traverse((function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){var r=t[e.skeleton];void 0===r?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(r,e.bindMatrix)}}))}setTexturePath(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}}var qu={UVMapping:oe,CubeReflectionMapping:le,CubeRefractionMapping:he,EquirectangularReflectionMapping:ce,EquirectangularRefractionMapping:ue,CubeUVReflectionMapping:de,CubeUVRefractionMapping:pe},Xu={RepeatWrapping:me,ClampToEdgeWrapping:fe,MirroredRepeatWrapping:ve},Yu={NearestFilter:ge,NearestMipmapNearestFilter:ye,NearestMipmapLinearFilter:be,LinearFilter:_e,LinearMipmapNearestFilter:Me,LinearMipmapLinearFilter:Te};class Ju extends hu{constructor(e){super(e),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);var n=this,a=su.get(e);if(void 0!==a)return n.manager.itemStart(e),setTimeout((function(){t&&t(a),n.manager.itemEnd(e)}),0),a;var s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,fetch(e,s).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(n.options,{colorSpaceConversion:"none"}))})).then((function(r){su.add(e,r),t&&t(r),n.manager.itemEnd(e)})).catch((function(t){i&&i(t),n.manager.itemError(e),n.manager.itemEnd(e)})),n.manager.itemStart(e)}}Ju.prototype.isImageBitmapLoader=!0;class Ku{constructor(){this.type="ShapePath",this.color=new On,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new xu,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,i){return this.currentPath.quadraticCurveTo(e,t,r,i),this}bezierCurveTo(e,t,r,i,n,a){return this.currentPath.bezierCurveTo(e,t,r,i,n,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function r(e){for(var t=[],r=0,i=e.length;r<i;r++){var n=e[r],a=new bu;a.curves=n.curves,t.push(a)}return t}function i(e,t){for(var r=t.length,i=!1,n=r-1,a=0;a<r;n=a++){var s=t[n],o=t[a],l=o.x-s.x,h=o.y-s.y;if(Math.abs(h)>Number.EPSILON){if(0>h&&(s=t[a],l=-l,o=t[n],h=-h),e.y<s.y||e.y>o.y)continue;if(e.y!==s.y){var c=h*(e.x-s.x)-l*(e.y-s.y);if(0==c)return!0;if(0>c)continue;i=!i}else if(e.x===s.x)return!0}else{if(e.y!==s.y)continue;if(o.x<=e.x&&e.x<=s.x||s.x<=e.x&&e.x<=o.x)return!0}}return i}var n=fc.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return r(a);var s,o,l,h=[];if(1===a.length)return o=a[0],(l=new bu).curves=o.curves,h.push(l),h;var c=!n(a[0].getPoints());c=e?!c:c;var u,d=[],p=[],m=[],f=0;p[f]=void 0,m[f]=[];for(var v=0,g=a.length;v<g;v++)s=n(u=(o=a[v]).getPoints()),(s=e?!s:s)?(!c&&p[f]&&f++,p[f]={s:new bu,p:u},p[f].s.curves=o.curves,c&&f++,m[f]=[]):m[f].push({h:o,p:u[0]});if(!p[0])return r(a);if(1<p.length){for(var y=!1,x=[],b=0,w=p.length;b<w;b++)d[b]=[];for(var _,M=0,S=p.length;M<S;M++){_=m[M];for(var T=0;T<_.length;T++){for(var E=_[T],A=!0,L=0;L<p.length;L++)i(E.p,p[L].p)&&(M!==L&&x.push({froms:M,tos:L,hole:T}),A?(A=!1,d[L].push(E)):y=!0);A&&d[M].push(E)}}0<x.length&&!y&&(m=d)}for(var R,C=0,P=p.length;C<P;C++){l=p[C].s,h.push(l);for(var I=0,O=(R=m[C]).length;I<O;I++)l.holes.push(R[I].h)}return h}}class Qu{constructor(e){this.type="Font",this.data=e}generateShapes(e){for(var t=[],r=function(e,t,r){for(var i,n=Array.from(e),a=t/r.resolution,s=(r.boundingBox.yMax-r.boundingBox.yMin+r.underlineThickness)*a,o=[],l=0,h=0,c=0;c<n.length;c++)if("\n"===(i=n[c]))l=0,h-=s;else{var u=$u(i,a,l,h,r);l+=u.offsetX,o.push(u.path)}return o}(e,1<arguments.length&&void 0!==arguments[1]?arguments[1]:100,this.data),i=0,n=r.length;i<n;i++)Array.prototype.push.apply(t,r[i].toShapes());return t}}function $u(e,t,r,i,n){var a=n.glyphs[e]||n.glyphs["?"];if(a){var s,o,l,h,c,u,d,p,m=new Ku;if(a.o)for(var f,v=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),g=0,y=v.length;g<y;)"m"===(f=v[g++])?(s=v[g++]*t+r,o=v[g++]*t+i,m.moveTo(s,o)):"l"===f?(s=v[g++]*t+r,o=v[g++]*t+i,m.lineTo(s,o)):"q"===f?(l=v[g++]*t+r,h=v[g++]*t+i,c=v[g++]*t+r,u=v[g++]*t+i,m.quadraticCurveTo(c,u,l,h)):"b"===f&&(l=v[g++]*t+r,h=v[g++]*t+i,c=v[g++]*t+r,u=v[g++]*t+i,d=v[g++]*t+r,p=v[g++]*t+i,m.bezierCurveTo(c,u,d,p,l,h));return{offsetX:a.ha*t,path:m}}console.error('THREE.Font: character "'+e+'" does not exists in font family '+n.familyName+".")}Qu.prototype.isFont=!0;class ed extends hu{constructor(e){super(e)}load(e,t,r,i){var n=this,a=new uu(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(n.withCredentials),a.load(e,(function(e){var r;try{r=JSON.parse(e)}catch(t){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),r=JSON.parse(e.substring(65,e.length-2))}var i=n.parse(r);t&&t(i)}),r,i)}parse(e){return new Qu(e)}}var td,rd={getContext:function(){return void 0===td&&(td=new(window.AudioContext||window.webkitAudioContext)),td},setContext:function(e){td=e}};class id extends hu{constructor(e){super(e)}load(e,t,r,i){var n=this,a=new uu(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(r){try{var a=r.slice(0);rd.getContext().decodeAudioData(a,(function(e){t(e)}))}catch(t){i?i(t):console.error(t),n.manager.itemError(e)}}),r,i)}}class nd extends Gu{constructor(e,t){super(void 0,2<arguments.length&&void 0!==arguments[2]?arguments[2]:1);var r=(new On).set(e),i=(new On).set(t),n=new ci(r.r,r.g,r.b),a=new ci(i.r,i.g,i.b),s=Math.sqrt(Math.PI),o=s*Math.sqrt(.75);this.sh.coefficients[0].copy(n).add(a).multiplyScalar(s),this.sh.coefficients[1].copy(n).sub(a).multiplyScalar(o)}}nd.prototype.isHemisphereLightProbe=!0;class ad extends Gu{constructor(e){super(void 0,1<arguments.length&&void 0!==arguments[1]?arguments[1]:1);var t=(new On).set(e);this.sh.coefficients[0].set(t.r,t.g,t.b).multiplyScalar(2*Math.sqrt(Math.PI))}}ad.prototype.isAmbientLightProbe=!0;var sd=new Vi,od=new Vi;class ld{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ca,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ca,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}}update(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 r,i,n=e.projectionMatrix.clone(),a=t.eyeSep/2,s=a*t.near/t.focus,o=t.near*Math.tan(Hr*t.fov*.5)/t.zoom;od.elements[12]=-a,sd.elements[12]=a,r=-o*t.aspect+s,i=o*t.aspect+s,n.elements[0]=2*t.near/(i-r),n.elements[8]=(i+r)/(i-r),this.cameraL.projectionMatrix.copy(n),r=-o*t.aspect-s,i=o*t.aspect-s,n.elements[0]=2*t.near/(i-r),n.elements[8]=(i+r)/(i-r),this.cameraR.projectionMatrix.copy(n)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(od),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(sd)}}class hd{constructor(){var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=cd(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=cd();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function cd(){return("undefined"==typeof performance?Date:performance).now()}var ud=new ci,dd=new hi,pd=new ci,md=new ci;class fd extends pn{constructor(){super(),this.type="AudioListener",this.context=rd.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new hd}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null===this.filter?this.gain.disconnect(this.context.destination):(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);var t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ud,dd,pd),md.set(0,0,-1).applyQuaternion(dd),t.positionX){var i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ud.x,i),t.positionY.linearRampToValueAtTime(ud.y,i),t.positionZ.linearRampToValueAtTime(ud.z,i),t.forwardX.linearRampToValueAtTime(md.x,i),t.forwardY.linearRampToValueAtTime(md.y,i),t.forwardZ.linearRampToValueAtTime(md.z,i),t.upX.linearRampToValueAtTime(r.x,i),t.upY.linearRampToValueAtTime(r.y,i),t.upZ.linearRampToValueAtTime(r.z,i)}else t.setPosition(ud.x,ud.y,ud.z),t.setOrientation(md.x,md.y,md.z,r.x,r.y,r.z)}}class vd extends pn{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;if(!0!==this.isPlaying){if(!1!==this.hasPlaybackControl){this._startedAt=this.context.currentTime+e;var t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}console.warn("THREE.Audio: this Audio has no playback control.")}else console.warn("THREE.Audio: Audio is already playing.")}pause(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress%=this.duration||this.buffer.duration),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this)}stop(){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this)}connect(){if(0<this.filters.length){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}disconnect(){if(0<this.filters.length){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}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this)}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){return!1===this.hasPlaybackControl?void console.warn("THREE.Audio: this Audio has no playback control."):(this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this)}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}var gd=new ci,yd=new hi,xd=new ci,bd=new ci;class wd extends vd{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,r){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=r,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0!==this.hasPlaybackControl||!1!==this.isPlaying){this.matrixWorld.decompose(gd,yd,xd),bd.set(0,0,1).applyQuaternion(yd);var t=this.panner;if(t.positionX){var r=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(gd.x,r),t.positionY.linearRampToValueAtTime(gd.y,r),t.positionZ.linearRampToValueAtTime(gd.z,r),t.orientationX.linearRampToValueAtTime(bd.x,r),t.orientationY.linearRampToValueAtTime(bd.y,r),t.orientationZ.linearRampToValueAtTime(bd.z,r)}else t.setPosition(gd.x,gd.y,gd.z),t.setOrientation(bd.x,bd.y,bd.z)}}}class _d{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:2048;this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){for(var e=0,t=this.getFrequencyData(),r=0;r<t.length;r++)e+=t[r];return e/t.length}}class Md{constructor(e,t,r){var i,n,a;this.binding=e,this.valueSize=r,"quaternion"===t?(i=this._slerp,n=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*r),this._workIndex=5):"string"===t||"bool"===t?(i=this._select,n=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(5*r)):(i=this._lerp,n=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*r)),this._mixBufferRegion=i,this._mixBufferRegionAdditive=n,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){var r=this.buffer,i=this.valueSize,n=e*i+i,a=this.cumulativeWeight;if(0===a){for(var s=0;s!==i;++s)r[n+s]=r[s];a=t}else{var o=t/(a+=t);this._mixBufferRegion(r,n,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){var t=this.buffer,r=this.valueSize,i=r*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){var t=this.valueSize,r=this.buffer,i=e*t+t,n=this.cumulativeWeight,a=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,1>n){var o=t*this._origIndex;this._mixBufferRegion(r,i,o,1-n,t)}0<a&&this._mixBufferRegionAdditive(r,i,this._addIndex*t,1,t);for(var l=t,h=t+t;l!==h;++l)if(r[l]!==r[l+t]){s.setValue(r,i);break}}saveOriginalState(){var e=this.binding,t=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(t,i);for(var n=r,a=i;n!==a;++n)t[n]=t[i+n%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){var e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,r=e;r<t;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,i,n){if(.5<=i)for(var a=0;a!==n;++a)e[t+a]=e[r+a]}_slerp(e,t,r,i){hi.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,n){var a=this._workIndex*n;hi.multiplyQuaternionsFlat(e,a,e,t,e,r),hi.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,r,i,n){for(var a,s=1-i,o=0;o!==n;++o)e[a=t+o]=e[a]*s+e[r+o]*i}_lerpAdditive(e,t,r,i,n){for(var a=0;a!==n;++a)e[t+a]+=e[r+a]*i}}var Sd="\\[\\]\\.:\\/",Td=/[\[\]\.:\/]/g,Ed="[^"+Sd+"]",Ad="[^"+Sd.replace("\\.","")+"]",Ld=/((?:WC+[\/:])*)/.source.replace("WC",Ed),Rd=/(WCOD+)?/.source.replace("WCOD",Ad),Cd=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ed),Pd=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ed),Id=new RegExp("^"+Ld+Rd+Cd+Pd+"$"),Od=["material","materials","bones"];class Dd{constructor(e,t,r){this.path=t,this.parsedPath=r||Dd.parseTrackName(t),this.node=Dd.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new Dd.Composite(e,t,r):new Dd(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Td,"")}static parseTrackName(e){var t=Id.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){var n=r.nodeName.substring(i+1);-1!==Od.indexOf(n)&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=n)}if(null===r.propertyName||0===r.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(!t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){var r=e.skeleton.getBoneByName(t);if(void 0!==r)return r}if(e.children){var i=function e(r){for(var i,n=0;n<r.length;n++){if((i=r[n]).name===t||i.uuid===t)return i;var a=e(i.children);if(a)return a}return null}(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.node[this.propertyName]}_getValue_array(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)e[t++]=r[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){for(var r=this.resolvedProperty,i=0,n=r.length;i!==n;++i)r[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){var e=this.node,t=this.parsedPath,r=t.objectName,i=t.propertyName,n=t.propertyIndex;if(e||(e=Dd.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,e){if(r){var a=t.objectIndex;switch(r){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(var s=0;s<e.length;s++)if(e[s].name===a){a=s;break}break;default:if(void 0===e[r])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[r]}if(void 0!==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 o=e[i];if(void 0!==o){var l=this.Versioning.None;this.targetObject=e,void 0===e.needsUpdate?void 0!==e.matrixWorldNeedsUpdate&&(l=this.Versioning.MatrixWorldNeedsUpdate):l=this.Versioning.NeedsUpdate;var h=this.BindingType.Direct;if(void 0!==n){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[n]&&(n=e.morphTargetDictionary[n])}h=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=n}else void 0!==o.fromArray&&void 0!==o.toArray?(h=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(h=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=i;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][l]}else{var c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+i+" but it wasn't found.",e)}}else console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.")}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Dd.Composite=class{constructor(e,t,r){var i=r||Dd.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();var r=this._targetGroup.nCachedObjects_,i=this._bindings[r];void 0!==i&&i.getValue(e,t)}setValue(e,t){for(var r=this._bindings,i=this._targetGroup.nCachedObjects_,n=r.length;i!==n;++i)r[i].setValue(e,t)}bind(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},Dd.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Dd.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Dd.prototype.GetterByBindingType=[Dd.prototype._getValue_direct,Dd.prototype._getValue_array,Dd.prototype._getValue_arrayElement,Dd.prototype._getValue_toArray],Dd.prototype.SetterByBindingTypeAndVersioning=[[Dd.prototype._setValue_direct,Dd.prototype._setValue_direct_setNeedsUpdate,Dd.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Dd.prototype._setValue_array,Dd.prototype._setValue_array_setNeedsUpdate,Dd.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Dd.prototype._setValue_arrayElement,Dd.prototype._setValue_arrayElement_setNeedsUpdate,Dd.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Dd.prototype._setValue_fromArray,Dd.prototype._setValue_fromArray_setNeedsUpdate,Dd.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Nd{constructor(){this.uuid=jr(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,r=arguments.length;t!==r;++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}}}add(){for(var e=this._objects,t=this._indicesByUUID,r=this._paths,i=this._parsedPaths,n=this._bindings,a=n.length,s=void 0,o=e.length,l=this.nCachedObjects_,h=0,c=arguments.length;h!==c;++h){var u=arguments[h],d=u.uuid,p=t[d];if(void 0===p){p=o++,t[d]=p,e.push(u);for(var m=0,f=a;m!==f;++m)n[m].push(new Dd(u,r[m],i[m]))}else if(p<l){s=e[p];var v=--l,g=e[v];t[g.uuid]=p,e[p]=g,t[d]=v,e[v]=u;for(var y=0,x=a;y!==x;++y){var b=n[y],w=b[v],_=b[p];b[p]=w,void 0===_&&(_=new Dd(u,r[y],i[y])),b[v]=_}}else e[p]!==s&&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(){for(var e=this._objects,t=this._indicesByUUID,r=this._bindings,i=r.length,n=this.nCachedObjects_,a=0,s=arguments.length;a!==s;++a){var o=arguments[a],l=o.uuid,h=t[l];if(void 0!==h&&h>=n){var c=n++,u=e[c];t[u.uuid]=h,e[h]=u,t[l]=c,e[c]=o;for(var d=0,p=i;d!==p;++d){var m=r[d],f=m[c],v=m[h];m[h]=f,m[c]=v}}}this.nCachedObjects_=n}uncache(){for(var e=this._objects,t=this._indicesByUUID,r=this._bindings,i=r.length,n=this.nCachedObjects_,a=e.length,s=0,o=arguments.length;s!==o;++s){var l=arguments[s].uuid,h=t[l];if(void 0!==h)if(delete t[l],h<n){var c=--n,u=e[c],d=--a,p=e[d];t[u.uuid]=h,e[h]=u,t[p.uuid]=c,e[c]=p,e.pop();for(var m=0,f=i;m!==f;++m){var v=r[m],g=v[c],y=v[d];v[h]=g,v[c]=y,v.pop()}}else{var x=--a,b=e[x];0<x&&(t[b.uuid]=h),e[h]=b,e.pop();for(var w,_=0,M=i;_!==M;++_)(w=r[_])[h]=w[x],w.pop()}}this.nCachedObjects_=n}subscribe_(e,t){var r=this._bindingsIndicesByPath,i=r[e],n=this._bindings;if(void 0!==i)return n[i];var a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,h=this.nCachedObjects_,c=Array(l);i=n.length,r[e]=i,a.push(e),s.push(t),n.push(c);for(var u,d=h,p=o.length;d!==p;++d)u=o[d],c[d]=new Dd(u,e,t);return c}unsubscribe_(e){var t=this._bindingsIndicesByPath,r=t[e];if(void 0!==r){var i=this._paths,n=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s];t[e[s]]=r,a[r]=o,a.pop(),n[r]=n[s],n.pop(),i[r]=i[s],i.pop()}}}Nd.prototype.isAnimationObjectGroup=!0;class Bd{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:t.blendMode;this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=i;for(var n,a=t.tracks,s=a.length,o=Array(s),l={endingStart:Wt,endingEnd:Wt},h=0;h!==s;++h)n=a[h].createInterpolant(null),o[h]=n,n.settings=l;this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Gt,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}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,r){if(e.fadeOut(t),this.fadeIn(t),r){var i=this._clip.duration,n=e._clip.duration,a=n/i,s=i/n;e.warp(1,a,t),this.warp(s,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}stopFading(){var e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,r){var i=this._mixer,n=i.time,a=this.timeScale,s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);var o=s.parameterPositions,l=s.sampleValues;return o[0]=n,o[1]=n+r,l[0]=e/a,l[1]=t/a,this}stopWarping(){var e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,r,i){if(this.enabled){var n=this._startTime;if(null!==n){var a=(e-n)*r;if(0>a||0===r)return;this._startTime=null,t=r*a}t*=this._updateTimeScale(e);var s=this._updateTime(t),o=this._updateWeight(e);if(0<o){var l=this._interpolants,h=this._propertyBindings;if(this.blendMode===Yt)for(var c=0,u=l.length;c!==u;++c)l[c].evaluate(s),h[c].accumulateAdditive(o);else for(var d=0,p=l.length;d!==p;++d)l[d].evaluate(s),h[d].accumulate(i,o)}}else this._updateWeight(e)}_updateWeight(e){var t=0;if(this.enabled){t=this.weight;var r=this._weightInterpolant;if(null!==r){var i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){var t=0;if(!this.paused){t=this.timeScale;var r=this._timeScaleInterpolant;null!==r&&(t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){var t=this._clip.duration,r=this.loop,i=this.time+e,n=this._loopCount,a=r===Vt;if(0===e)return-1===n?i:a&&1==(1&n)?t-i:i;if(r===Ft){-1===n&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(0>i)){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:0>e?-1:1})}}else{if(-1===n&&(0<=e?(n=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=t||0>i){var s=Math.floor(i/t);i-=t*s,n+=Math.abs(s);var o=this.repetitions-n;if(0>=o)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=0<e?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:0<e?1:-1});else{if(1===o){var l=0>e;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=n,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:s})}}else this.time=i;if(a&&1==(1&n))return t-i}return i}_setEndings(e,t,r){var i=this._interpolantSettings;r?(i.endingStart=Zt,i.endingEnd=Zt):(i.endingStart=e?this.zeroSlopeAtStart?Zt:Wt:qt,i.endingEnd=t?this.zeroSlopeAtEnd?Zt:Wt:qt)}_scheduleFading(e,t,r){var i=this._mixer,n=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var s=a.parameterPositions,o=a.sampleValues;return s[0]=n,o[0]=t,s[1]=n+e,o[1]=r,this}}class Ud extends zr{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){var r=e._localRoot||this._root,i=e._clip.tracks,n=i.length,a=e._propertyBindings,s=e._interpolants,o=r.uuid,l=this._bindingsByRootAndName,h=l[o];void 0===h&&(h={},l[o]=h);for(var c=0;c!==n;++c){var u=i[c],d=u.name,p=h[d];if(void 0!==p)a[c]=p;else{if(void 0!==(p=a[c])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,o,d));continue}var m=t&&t._propertyBindings[c].binding.parsedPath;++(p=new Md(Dd.create(r,d,m),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(p,o,d),a[c]=p}s[c].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var t=(e._localRoot||this._root).uuid,r=e._clip.uuid,i=this._actionsByClip[r];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,r,t)}for(var n,a=e._propertyBindings,s=0,o=a.length;s!==o;++s)0==(n=a[s]).useCount++&&(this._lendBinding(n),n.saveOriginalState());this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){for(var t,r=e._propertyBindings,i=0,n=r.length;i!==n;++i)0==--(t=r[i]).useCount&&(t.restoreOriginalState(),this._takeBackBinding(t));this._takeBackAction(e)}}_initMemoryManager(){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(e){var t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,r){var i=this._actions,n=this._actionsByClip,a=n[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,n[t]=a;else{var s=a.knownActions;e._byClipCacheIndex=s.length,s.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[r]=e}_removeInactiveAction(e){var t=this._actions,r=t[t.length-1],i=e._cacheIndex;r._cacheIndex=i,t[i]=r,t.pop(),e._cacheIndex=null;var n=e._clip.uuid,a=this._actionsByClip,s=a[n],o=s.knownActions,l=o[o.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,o[h]=l,o.pop(),e._byClipCacheIndex=null,delete s.actionByRoot[(e._localRoot||this._root).uuid],0===o.length&&delete a[n],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){for(var t,r=e._propertyBindings,i=0,n=r.length;i!==n;++i)0==--(t=r[i]).referenceCount&&this._removeInactiveBinding(t)}_lendAction(e){var t=this._actions,r=e._cacheIndex,i=this._nActiveActions++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_takeBackAction(e){var t=this._actions,r=e._cacheIndex,i=--this._nActiveActions,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_addInactiveBinding(e,t,r){var i=this._bindingsByRootAndName,n=this._bindings,a=i[t];void 0===a&&(a={},i[t]=a),a[r]=e,e._cacheIndex=n.length,n.push(e)}_removeInactiveBinding(e){var t=this._bindings,r=e.binding,i=r.rootNode.uuid,n=r.path,a=this._bindingsByRootAndName,s=a[i],o=t[t.length-1],l=e._cacheIndex;o._cacheIndex=l,t[l]=o,t.pop(),delete s[n],0===Object.keys(s).length&&delete a[i]}_lendBinding(e){var t=this._bindings,r=e._cacheIndex,i=this._nActiveBindings++,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_takeBackBinding(e){var t=this._bindings,r=e._cacheIndex,i=--this._nActiveBindings,n=t[i];e._cacheIndex=i,t[i]=e,n._cacheIndex=r,t[r]=n}_lendControlInterpolant(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return void 0===r&&((r=new Xc(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){var t=this._controlInterpolants,r=e.__cacheIndex,i=--this._nActiveControlInterpolants,n=t[i];e.__cacheIndex=i,t[i]=e,n.__cacheIndex=r,t[r]=n}clipAction(e,t,r){var i=t||this._root,n=i.uuid,a="string"==typeof e?nu.findByName(i,e):e,s=null===a?e:a.uuid,o=this._actionsByClip[s],l=null;if(void 0===r&&(r=null===a?Xt:a.blendMode),void 0!==o){var h=o.actionByRoot[n];if(void 0!==h&&h.blendMode===r)return h;l=o.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;var c=new Bd(this,a,t,r);return this._bindAction(c,l),this._addInactiveAction(c,s,n),c}existingAction(e,t){var r=t||this._root,i=r.uuid,n="string"==typeof e?nu.findByName(r,e):e,a=n?n.uuid:e,s=this._actionsByClip[a];return void 0===s?null:s.actionByRoot[i]||null}stopAllAction(){for(var e=this._actions,t=this._nActiveActions-1;0<=t;--t)e[t].stop();return this}update(e){e*=this.timeScale;for(var t=this._actions,r=this._nActiveActions,i=this.time+=e,n=Math.sign(e),a=this._accuIndex^=1,s=0;s!==r;++s)t[s]._update(i,e,n,a);for(var o=this._bindings,l=this._nActiveBindings,h=0;h!==l;++h)o[h].apply(a);return this}setTime(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){var t=this._actions,r=e.uuid,i=this._actionsByClip,n=i[r];if(void 0!==n){for(var a,s=n.knownActions,o=0,l=s.length;o!==l;++o){a=s[o],this._deactivateAction(a);var h=a._cacheIndex,c=t[t.length-1];a._cacheIndex=null,a._byClipCacheIndex=null,c._cacheIndex=h,t[h]=c,t.pop(),this._removeInactiveBindingsForAction(a)}delete i[r]}}uncacheRoot(e){var t=e.uuid,r=this._actionsByClip;for(var i in r){var n=r[i].actionByRoot[t];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}var a=this._bindingsByRootAndName[t];if(void 0!==a)for(var s in a){var o=a[s];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){var r=this.existingAction(e,t);null!==r&&(this._deactivateAction(r),this._removeInactiveAction(r))}}Ud.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class zd{constructor(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new zd(void 0===this.value.clone?this.value:this.value.clone())}}class Fd extends hl{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1;super(e,t),this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){var t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){var t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}Fd.prototype.isInstancedInterleavedBuffer=!0;class Gd{constructor(e,t,r,i,n){this.buffer=e,this.type=t,this.itemSize=r,this.elementSize=i,this.count=n,this.version=0}set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}Gd.prototype.isGLBufferAttribute=!0;class Vd{constructor(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:1/0;this.ray=new Gi(e,t),this.near=r,this.far=i,this.camera=null,this.layers=new Qi,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(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: "+t.type)}intersectObject(e){var t=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[];return kd(e,this,t,!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1]),t.sort(Hd),t}intersectObjects(e){for(var t=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1],r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:[],i=0,n=e.length;i<n;i++)kd(e[i],this,r,t);return r.sort(Hd),r}}function Hd(e,t){return e.distance-t.distance}function kd(e,t,r,i){if(e.layers.test(t.layers)&&e.raycast(t,r),!0===i)for(var n=e.children,a=0,s=n.length;a<s;a++)kd(n[a],t,r,!0)}class jd{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;return this.radius=e,this.phi=t,this.theta=r,this}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(Wr(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class Wd{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;return this.radius=e,this.theta=t,this.y=r,this}set(e,t,r){return this.radius=e,this.theta=t,this.y=r,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+r*r),this.theta=Math.atan2(e,r),this.y=t,this}clone(){return(new this.constructor).copy(this)}}var Zd=new $r;class qd{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new $r(1/0,1/0),t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new $r(-1/0,-1/0);this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(var t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){var r=Zd.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Zd.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}qd.prototype.isBox2=!0;var Xd=new ci,Yd=new ci;class Jd{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci;this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Xd.subVectors(e,this.start),Yd.subVectors(this.end,this.start);var r=Yd.dot(Yd),i=Yd.dot(Xd)/r;return t&&(i=Wr(i,0,1)),i}closestPointToPoint(e,t,r){var i=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}class Kd extends pn{constructor(e){super(),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}}Kd.prototype.isImmediateRenderObject=!0;var Qd=new ci;class $d extends pn{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var r=new na,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],n=0,a=1;n<32;n++,a++){var s=n/32*Math.PI*2,o=a/32*Math.PI*2;i.push(Math.cos(s),Math.sin(s),1,Math.cos(o),Math.sin(o),1)}r.setAttribute("position",new Zn(i,3));var l=new ql({fog:!1,toneMapped:!1});this.cone=new rh(r,l),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Qd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Qd),void 0===this.color?this.cone.material.color.copy(this.light.color):this.cone.material.color.set(this.color)}}var ep=new ci,tp=new Vi,rp=new Vi;class ip extends rh{constructor(e){for(var t,r=np(e),i=new na,n=[],a=[],s=new On(0,0,1),o=new On(0,1,0),l=0;l<r.length;l++)(t=r[l]).parent&&t.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),a.push(s.r,s.g,s.b),a.push(o.r,o.g,o.b));i.setAttribute("position",new Zn(n,3)),i.setAttribute("color",new Zn(a,3)),super(i,new ql({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=r,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){var t=this.bones,r=this.geometry,i=r.getAttribute("position");rp.copy(this.root.matrixWorld).invert();for(var n,a=0,s=0;a<t.length;a++)(n=t[a]).parent&&n.parent.isBone&&(tp.multiplyMatrices(rp,n.matrixWorld),ep.setFromMatrixPosition(tp),i.setXYZ(s,ep.x,ep.y,ep.z),tp.multiplyMatrices(rp,n.parent.matrixWorld),ep.setFromMatrixPosition(tp),i.setXYZ(s+1,ep.x,ep.y,ep.z),s+=2);r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function np(e){var t=[];e&&e.isBone&&t.push(e);for(var r=0;r<e.children.length;r++)t.push.apply(t,np(e.children[r]));return t}class ap extends _a{constructor(e,t,r){super(new Ec(t,4,2),new Dn({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.light.updateMatrixWorld(),this.color=r,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){void 0===this.color?this.material.color.copy(this.light.color):this.material.color.set(this.color)}}var sp=new ci,op=new On,lp=new On;class hp extends pn{constructor(e,t,r){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r;var i=new _c(t);i.rotateY(.5*Math.PI),this.material=new Dn({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);var n=i.getAttribute("position"),a=new Float32Array(3*n.count);i.setAttribute("color",new Un(a,3)),this.add(new _a(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){var e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");op.copy(this.light.color),lp.copy(this.light.groundColor);for(var r,i=0,n=t.count;i<n;i++)r=i<n/2?op:lp,t.setXYZ(i,r.r,r.g,r.b);t.needsUpdate=!0}e.lookAt(sp.setFromMatrixPosition(this.light.matrixWorld).negate())}}class cp extends rh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:10,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:10,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:4473924,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:8947848;r=new On(r),i=new On(i);for(var n=t/2,a=e/t,s=e/2,o=[],l=[],h=0,c=0,u=-s;h<=t;h++,u+=a){o.push(-s,0,u,s,0,u),o.push(u,0,-s,u,0,s);var d=h===n?r:i;d.toArray(l,c),c+=3,d.toArray(l,c),c+=3,d.toArray(l,c),c+=3,d.toArray(l,c),c+=3}var p=new na;p.setAttribute("position",new Zn(o,3)),p.setAttribute("color",new Zn(l,3)),super(p,new ql({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}class up extends rh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:10,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:16,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:8,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:64,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:4473924,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:8947848;n=new On(n),a=new On(a);for(var s=[],o=[],l=0;l<=t;l++){var h=l/t*(2*Math.PI),c=Math.sin(h)*e,u=Math.cos(h)*e;s.push(0,0,0),s.push(c,0,u);var d=1&l?n:a;o.push(d.r,d.g,d.b),o.push(d.r,d.g,d.b)}for(var p=0;p<=r;p++)for(var m=1&p?n:a,f=e-e/r*p,v=0;v<i;v++){var g=v/i*(2*Math.PI),y=Math.sin(g)*f,x=Math.cos(g)*f;s.push(y,0,x),o.push(m.r,m.g,m.b),g=(v+1)/i*(2*Math.PI),y=Math.sin(g)*f,x=Math.cos(g)*f,s.push(y,0,x),o.push(m.r,m.g,m.b)}var b=new na;b.setAttribute("position",new Zn(s,3)),b.setAttribute("color",new Zn(o,3)),super(b,new ql({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}}var dp=new ci,pp=new ci,mp=new ci;class fp extends pn{constructor(e,t,r){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,void 0===t&&(t=1);var i=new na;i.setAttribute("position",new Zn([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var n=new ql({fog:!1,toneMapped:!1});this.lightPlane=new $l(i,n),this.add(this.lightPlane),(i=new na).setAttribute("position",new Zn([0,0,0,0,0,1],3)),this.targetLine=new $l(i,n),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){dp.setFromMatrixPosition(this.light.matrixWorld),pp.setFromMatrixPosition(this.light.target.matrixWorld),mp.subVectors(pp,dp),this.lightPlane.lookAt(pp),void 0===this.color?(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)):(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)),this.targetLine.lookAt(pp),this.targetLine.scale.z=mp.length()}}var vp=new ci,gp=new Ra;class yp extends rh{constructor(e){function t(e,t,i){r(e,i),r(t,i)}function r(e,t){a.push(0,0,0),s.push(t.r,t.g,t.b),void 0===o[e]&&(o[e]=[]),o[e].push(a.length/3-1)}var i=new na,n=new ql({color:16777215,vertexColors:!0,toneMapped:!1}),a=[],s=[],o={},l=new On(16755200),h=new On(16711680),c=new On(43775),u=new On(16777215),d=new On(3355443);t("n1","n2",l),t("n2","n4",l),t("n4","n3",l),t("n3","n1",l),t("f1","f2",l),t("f2","f4",l),t("f4","f3",l),t("f3","f1",l),t("n1","f1",l),t("n2","f2",l),t("n3","f3",l),t("n4","f4",l),t("p","n1",h),t("p","n2",h),t("p","n3",h),t("p","n4",h),t("u1","u2",c),t("u2","u3",c),t("u3","u1",c),t("c","t",u),t("p","c",d),t("cn1","cn2",d),t("cn3","cn4",d),t("cf1","cf2",d),t("cf3","cf4",d),i.setAttribute("position",new Zn(a,3)),i.setAttribute("color",new Zn(s,3)),super(i,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){var e=this.geometry,t=this.pointMap;gp.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),xp("c",t,e,gp,0,0,-1),xp("t",t,e,gp,0,0,1),xp("n1",t,e,gp,-1,-1,-1),xp("n2",t,e,gp,1,-1,-1),xp("n3",t,e,gp,-1,1,-1),xp("n4",t,e,gp,1,1,-1),xp("f1",t,e,gp,-1,-1,1),xp("f2",t,e,gp,1,-1,1),xp("f3",t,e,gp,-1,1,1),xp("f4",t,e,gp,1,1,1),xp("u1",t,e,gp,.7,1.1,-1),xp("u2",t,e,gp,-.7,1.1,-1),xp("u3",t,e,gp,0,2,-1),xp("cf1",t,e,gp,-1,0,1),xp("cf2",t,e,gp,1,0,1),xp("cf3",t,e,gp,0,-1,1),xp("cf4",t,e,gp,0,1,1),xp("cn1",t,e,gp,-1,0,-1),xp("cn2",t,e,gp,1,0,-1),xp("cn3",t,e,gp,0,-1,-1),xp("cn4",t,e,gp,0,1,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function xp(e,t,r,i,n,a,s){vp.set(n,a,s).unproject(i);var o=t[e];if(void 0!==o)for(var l=r.getAttribute("position"),h=0,c=o.length;h<c;h++)l.setXYZ(o[h],vp.x,vp.y,vp.z)}var bp=new pi;class wp extends rh{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:16776960,r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),n=new na;n.setIndex(new Un(r,1)),n.setAttribute("position",new Un(i,3)),super(n,new ql({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&bp.setFromObject(this.object),!bp.isEmpty()){var t=bp.min,r=bp.max,i=this.geometry.attributes.position,n=i.array;n[0]=r.x,n[1]=r.y,n[2]=r.z,n[3]=t.x,n[4]=r.y,n[5]=r.z,n[6]=t.x,n[7]=t.y,n[8]=r.z,n[9]=r.x,n[10]=t.y,n[11]=r.z,n[12]=r.x,n[13]=r.y,n[14]=t.z,n[15]=t.x,n[16]=r.y,n[17]=t.z,n[18]=t.x,n[19]=t.y,n[20]=t.z,n[21]=r.x,n[22]=t.y,n[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}}setFromObject(e){return this.object=e,this.update(),this}copy(e){return rh.prototype.copy.call(this,e),this.object=e.object,this}}class _p extends rh{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:16776960,r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new na;i.setIndex(new Un(r,1)),i.setAttribute("position",new Zn([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new ql({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}}class Mp extends $l{constructor(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:16776960,i=new na;i.setAttribute("position",new Zn([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),i.computeBoundingSphere(),super(i,new ql({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;var n=new na;n.setAttribute("position",new Zn([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),n.computeBoundingSphere(),this.add(new _a(n,new Dn({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){var t=-this.plane.constant;1e-8>Math.abs(t)&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=0>t?y:g,this.lookAt(this.plane.normal),super.updateMatrixWorld(e)}}var Sp,Tp,Ep=new ci;class Ap extends pn{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new ci(0,0,1),t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new ci(0,0,0),r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:16776960,n=4<arguments.length&&void 0!==arguments[4]?arguments[4]:.2*r,a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:.2*n;super(),this.type="ArrowHelper",void 0===Sp&&((Sp=new na).setAttribute("position",new Zn([0,0,0,0,1,0],3)),(Tp=new vh(0,.5,1,5,1)).translate(0,-.5,0)),this.position.copy(t),this.line=new $l(Sp,new ql({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new _a(Tp,new Dn({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(r,n,a)}setDirection(e){if(.99999<e.y)this.quaternion.set(0,0,0,1);else if(-.99999>e.y)this.quaternion.set(1,0,0,0);else{Ep.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Ep,t)}}setLength(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:.2*e,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.2*t;this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}}class Lp extends rh{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1,t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=new na;r.setAttribute("position",new Zn(t,3)),r.setAttribute("color",new Zn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(r,new ql({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,r){var i=new On,n=this.geometry.attributes.color.array;return i.set(e),i.toArray(n,0),i.toArray(n,3),i.set(t),i.toArray(n,6),i.toArray(n,9),i.set(r),i.toArray(n,12),i.toArray(n,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}var Rp=new Float32Array(1),Cp=new Int32Array(Rp.buffer);class Pp{static toHalfFloat(e){Rp[0]=e;var t=Cp[0],r=32768&t>>16,i=2047&t>>12,n=255&t>>23;return 103>n?r:142<n?(r|=31744,r|=(255==n?0:1)&&8388607&t):113>n?r|=((i|=2048)>>114-n)+(1&i>>113-n):(r|=n-112<<10|i>>1,r+=1&i)}}var Ip=Math.pow(2,8),Op=[.125,.215,.35,.446,.526,.582],Dp=5+Op.length,Np={[$t]:0,[er]:1,[rr]:2,[nr]:3,[ar]:4,[sr]:5,[tr]:6},Bp=new Dn({side:y,depthWrite:!1,depthTest:!1}),Up=new _a(new Sa,Bp),zp=new Du,{_lodPlanes:Fp,_sizeLods:Gp,_sigmas:Vp}=Jp(),Hp=new On,kp=null,jp=(1+Math.sqrt(5))/2,Wp=1/jp,Zp=[new ci(1,1,1),new ci(-1,1,1),new ci(1,1,-1),new ci(-1,1,-1),new ci(0,jp,Wp),new ci(0,jp,-Wp),new ci(Wp,0,jp),new ci(-Wp,0,jp),new ci(jp,Wp,0),new ci(-jp,Wp,0)];function qp(e){var t=Math.max(e.r,e.g,e.b),r=Math.min(Math.max(Math.ceil(Math.log2(t)),-128),127);return e.multiplyScalar(Math.pow(2,-r)),(r+128)/255}class Xp{constructor(e){var t,r;this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=(20,t=new Float32Array(20),r=new ci(0,1,0),new Nc({name:"SphericalGaussianBlur",defines:{n:20},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r},inputEncoding:{value:Np[$t]},outputEncoding:{value:Np[$t]}},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:_,depthTest:!1,depthWrite:!1})),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:.1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:100;kp=this._renderer.getRenderTarget();var n=this._allocateTargets();return this._sceneToCubeUV(e,r,i,n),0<t&&this._blur(n,0,0,t),this._applyPMREM(n),this._cleanup(n),n}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){null===this._cubemapShader&&(this._cubemapShader=em(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){null===this._equirectShader&&(this._equirectShader=$p(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),null!==this._cubemapShader&&this._cubemapShader.dispose(),null!==this._equirectShader&&this._equirectShader.dispose();for(var e=0;e<Fp.length;e++)Fp[e].dispose()}_cleanup(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(kp),e.scissorTest=!1,Qp(e,0,0,e.width,e.height)}_fromTexture(e){kp=this._renderer.getRenderTarget();var t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t}_allocateTargets(e){var t={magFilter:ge,minFilter:ge,generateMipmaps:!1,type:Ae,format:je,encoding:Yp(e)?e.encoding:rr,depthBuffer:!1},r=Kp(t);return r.depthBuffer=!e,this._pingPongRenderTarget=Kp(t),r}_compileMaterial(e){var t=new _a(Fp[0],e);this._renderer.compile(t,zp)}_sceneToCubeUV(e,t,r,i){var n=new Ca(90,1,t,r),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,h=o.outputEncoding,c=o.toneMapping;o.getClearColor(Hp),o.toneMapping=te,o.outputEncoding=$t,o.autoClear=!1;var u=!1,d=e.background;if(d){if(d.isColor){Bp.color.copy(d).convertSRGBToLinear(),e.background=null;var p=qp(Bp.color);Bp.opacity=p,u=!0}}else{Bp.color.copy(Hp).convertSRGBToLinear();var m=qp(Bp.color);Bp.opacity=m,u=!0}for(var f,v=0;6>v;v++)0==(f=v%3)?(n.up.set(0,a[v],0),n.lookAt(s[v],0,0)):1==f?(n.up.set(0,0,a[v]),n.lookAt(0,s[v],0)):(n.up.set(0,a[v],0),n.lookAt(0,0,s[v])),Qp(i,f*Ip,2<v?Ip:0,Ip,Ip),o.setRenderTarget(i),u&&o.render(Up,n),o.render(e,n);o.toneMapping=c,o.outputEncoding=h,o.autoClear=l}_textureToCubeUV(e,t){var r=this._renderer;e.isCubeTexture?null==this._cubemapShader&&(this._cubemapShader=em()):null==this._equirectShader&&(this._equirectShader=$p());var i=e.isCubeTexture?this._cubemapShader:this._equirectShader,n=new _a(Fp[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=Np[e.encoding],a.outputEncoding.value=Np[t.texture.encoding],Qp(t,0,0,3*Ip,2*Ip),r.setRenderTarget(t),r.render(n,zp)}_applyPMREM(e){var t=this._renderer,r=t.autoClear;t.autoClear=!1;for(var i=1;i<Dp;i++){var n=Math.sqrt(Vp[i]*Vp[i]-Vp[i-1]*Vp[i-1]),a=Zp[(i-1)%Zp.length];this._blur(e,i-1,i,n,a)}t.autoClear=r}_blur(e,t,r,i,n){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,r,i,"latitudinal",n),this._halfBlur(a,e,r,r,i,"longitudinal",n)}_halfBlur(e,t,r,i,n,a,s){var o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var h=new _a(Fp[i],l),c=l.uniforms,u=Gp[r]-1,d=isFinite(n)?Math.PI/(2*u):2*Math.PI/39,p=n/d,m=isFinite(n)?1+Math.floor(3*p):20;m>20&&console.warn("sigmaRadians, ".concat(n,", is too large and will clip, as it requested ").concat(m," samples when the maximum is set to ").concat(20));for(var f=[],v=0,g=0;g<20;++g){var y=g/p,x=Math.exp(-y*y/2);f.push(x),0==g?v+=x:g<m&&(v+=2*x)}for(var b=0;b<f.length;b++)f[b]/=v;c.envMap.value=e.texture,c.samples.value=m,c.weights.value=f,c.latitudinal.value="latitudinal"===a,s&&(c.poleAxis.value=s),c.dTheta.value=d,c.mipInt.value=8-r,c.inputEncoding.value=Np[e.texture.encoding],c.outputEncoding.value=Np[e.texture.encoding];var w=Gp[i];Qp(t,3*Math.max(0,Ip-2*w),(0===i?0:2*Ip)+2*w*(i>4?i-8+4:0),3*w,2*w),o.setRenderTarget(t),o.render(h,zp)}}function Yp(e){return void 0!==e&&e.type===Ae&&(e.encoding===$t||e.encoding===er||e.encoding===tr)}function Jp(){for(var e,t=[],r=[],i=[],n=8,a=0;a<Dp;a++){e=Math.pow(2,n),r.push(e);var s=1/e;a>4?s=Op[a-8+4-1]:0==a&&(s=0),i.push(s);for(var o=1/(e-1),l=-o/2,h=1+o/2,c=[l,l,h,l,h,h,l,l,h,h,l,h],u=new Float32Array(108),d=new Float32Array(72),p=new Float32Array(36),m=0;m<6;m++){var f=m%3*2/3-1,v=2<m?0:-1,g=[f,v,0,f+2/3,v,0,f+2/3,v+1,0,f,v,0,f+2/3,v+1,0,f,v+1,0];u.set(g,18*m),d.set(c,12*m);var y=[m,m,m,m,m,m];p.set(y,6*m)}var x=new na;x.setAttribute("position",new Un(u,3)),x.setAttribute("uv",new Un(d,2)),x.setAttribute("faceIndex",new Un(p,1)),t.push(x),n>4&&n--}return{_lodPlanes:t,_sizeLods:r,_sigmas:i}}function Kp(e){var t=new si(3*Ip,3*Ip,e);return t.texture.mapping=de,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function Qp(e,t,r,i,n){e.viewport.set(t,r,i,n),e.scissor.set(t,r,i,n)}function $p(){var e=new $r(1,1);return new Nc({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:e},inputEncoding:{value:Np[$t]},outputEncoding:{value:Np[$t]}},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:_,depthTest:!1,depthWrite:!1})}function em(){return new Nc({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Np[$t]},outputEncoding:{value:Np[$t]}},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:_,depthTest:!1,depthWrite:!1})}var tm=0,rm=1,im=0,nm=1,am=2;function sm(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function om(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[];return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}function lm(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new hh(e,t)}function hm(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new El(e)}function cm(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new hh(e,t)}function um(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new nh(e)}function dm(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new nh(e)}function pm(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new nh(e)}function mm(e,t,r){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new ci(e,t,r)}function fm(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Un(e,t).setUsage(Lr)}function vm(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new zn(e,t)}function gm(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Fn(e,t)}function ym(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Gn(e,t)}function xm(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Vn(e,t)}function bm(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new Hn(e,t)}function wm(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new kn(e,t)}function _m(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new jn(e,t)}function Mm(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new Zn(e,t)}function Sm(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new qn(e,t)}function Tm(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new Lp(e)}function Em(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new wp(e,t)}function Am(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new rh(new Sh(e.geometry),new ql({color:void 0===t?16777215:t}))}function Lm(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new rh(new Ic(e.geometry),new ql({color:void 0===t?16777215:t}))}function Rm(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new uu(e)}function Cm(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new vu(e)}function Pm(e,t,r){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new Da(e,r)}function Im(){console.error("THREE.CanvasRenderer has been removed")}function Om(){console.error("THREE.JSONLoader has been removed.")}Th.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Th.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},xu.prototype.fromPoints=function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)},cp.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},ip.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},hu.prototype.extractUrlBase=function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Hu.extractUrlBase(e)},hu.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.")}},qd.prototype.center=function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},qd.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},qd.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},qd.prototype.size=function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)},pi.prototype.center=function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},pi.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},pi.prototype.isIntersectionBox=function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},pi.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},pi.prototype.size=function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)},Ii.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Va.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)},Jd.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)},ei.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},ei.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},ei.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},ei.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},ei.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},ei.prototype.getInverse=function(e){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},Vi.prototype.extractPosition=function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},Vi.prototype.flattenToArrayOffset=function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},Vi.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new ci).setFromMatrixColumn(this,3)},Vi.prototype.setRotationFromQuaternion=function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},Vi.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Vi.prototype.multiplyVector3=function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Vi.prototype.multiplyVector4=function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Vi.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Vi.prototype.rotateAxis=function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},Vi.prototype.crossVector=function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Vi.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Vi.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Vi.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Vi.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Vi.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Vi.prototype.applyToBufferAttribute=function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},Vi.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Vi.prototype.makeFrustum=function(e,t,r,i,n,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,r,n,a)},Vi.prototype.getInverse=function(e){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(e).invert()},za.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)},hi.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)},hi.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},Gi.prototype.isIntersectionBox=function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},Gi.prototype.isIntersectionPlane=function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},Gi.prototype.isIntersectionSphere=function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},Sn.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},Sn.prototype.barycoordFromPoint=function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},Sn.prototype.midpoint=function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},Sn.prototypenormal=function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},Sn.prototype.plane=function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)},Sn.barycoordFromPoint=function(e,t,r,i,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Sn.getBarycoord(e,t,r,i,n)},Sn.normal=function(e,t,r,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Sn.getNormal(e,t,r,i)},bu.prototype.extractAllPoints=function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},bu.prototype.extrude=function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new yc(this,e)},bu.prototype.makeGeometry=function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Tc(this,e)},$r.prototype.fromAttribute=function(e,t,r){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,r)},$r.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},$r.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ci.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},ci.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},ci.prototype.getPositionFromMatrix=function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},ci.prototype.getScaleFromMatrix=function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},ci.prototype.getColumnFromMatrix=function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},ci.prototype.applyProjection=function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},ci.prototype.fromAttribute=function(e,t,r){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,r)},ci.prototype.distanceToManhattan=function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},ci.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ai.prototype.fromAttribute=function(e,t,r){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,r)},ai.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},pn.prototype.getChildByName=function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},pn.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},pn.prototype.translate=function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},pn.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},pn.prototype.applyMatrix=function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(pn.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.")}}}),_a.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(_a.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Jt},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.")}}}),Bl.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Ca.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(wu.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(Un.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Lr},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Lr)}}}),Un.prototype.setDynamic=function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Lr:Ar),this},Un.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Un.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},na.prototype.addIndex=function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},na.prototype.addAttribute=function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?"index"===e?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new Un(arguments[1],arguments[2])))},na.prototype.addDrawCall=function(e,t,r){void 0!==r&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},na.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},na.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},na.prototype.removeAttribute=function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},na.prototype.applyMatrix=function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)},Object.defineProperties(na.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}}}),hl.prototype.setDynamic=function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===e?Lr:Ar),this},hl.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},yc.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},yc.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},yc.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},ll.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},zd.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(En.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new On}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===b}},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(La.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}}}),nl.prototype.clearTarget=function(e,t,r,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,r,i)},nl.prototype.animate=function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},nl.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},nl.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},nl.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},nl.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},nl.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},nl.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},nl.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},nl.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},nl.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},nl.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},nl.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},nl.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},nl.prototype.enableScissorTest=function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},nl.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},nl.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},nl.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},nl.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},nl.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},nl.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},nl.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},nl.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},nl.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},nl.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(nl.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?er:$t}},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(Xo.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(si.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}}}),vd.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this;return(new id).load(e,(function(e){t.setBuffer(e)})),this},_d.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Ia.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)},Ia.prototype.clear=function(e,t,r,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(e,t,r,i)},ti.crossOrigin=void 0,ti.loadTexture=function(e,t,r,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var n=new gu;n.setCrossOrigin(this.crossOrigin);var a=n.load(e,r,void 0,i);return t&&(a.mapping=t),a},ti.loadTextureCube=function(e,t,r,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var n=new fu;n.setCrossOrigin(this.crossOrigin);var a=n.load(e,r,void 0,i);return t&&(a.mapping=t),a},ti.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},ti.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Dm={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function Nm(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:s}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=s)},6550:function(e,t,r){(function(e){var t=function(){try{return!!Symbol.iterator}catch(e){return!1}}(),r=function(e){var r={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t&&(r[Symbol.iterator]=function(){return r}),r},i=function(e){return encodeURIComponent(e).replace(/%20/g,"+")},n=function(e){return decodeURIComponent((e+"").replace(/\+/g," "))};(function(){try{var t=e.URLSearchParams;return"a=1"===new t("?a=1").toString()&&"function"==typeof t.prototype.set&&"function"==typeof t.prototype.entries}catch(e){return!1}})()||function(){var n=function(e){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var t=typeof e;if("undefined"==t);else if("string"===t)""!=e&&this._fromString(e);else if(e instanceof n){var r=this;e.forEach((function(e,t){r.append(t,e)}))}else{if(null===e||"object"!==t)throw new TypeError("Unsupported input's type for URLSearchParams");if("[object Array]"===Object.prototype.toString.call(e))for(var i,a=0;a<e.length;a++){if(i=e[a],"[object Array]"!==Object.prototype.toString.call(i)&&2===i.length)throw new TypeError("Expected [string, any] as entry at index "+a+" of URLSearchParams's input");this.append(i[0],i[1])}else for(var s in e)e.hasOwnProperty(s)&&this.append(s,e[s])}},a=n.prototype;a.append=function(e,t){e in this._entries?this._entries[e].push(t+""):this._entries[e]=[t+""]},a.delete=function(e){delete this._entries[e]},a.get=function(e){return e in this._entries?this._entries[e][0]:null},a.getAll=function(e){return e in this._entries?this._entries[e].slice(0):[]},a.has=function(e){return e in this._entries},a.set=function(e,t){this._entries[e]=[t+""]},a.forEach=function(e,t){var r;for(var i in this._entries)if(this._entries.hasOwnProperty(i)){r=this._entries[i];for(var n=0;n<r.length;n++)e.call(t,r[n],i,this)}},a.keys=function(){var e=[];return this.forEach((function(t,r){e.push(r)})),r(e)},a.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),r(e)},a.entries=function(){var e=[];return this.forEach((function(t,r){e.push([r,t])})),r(e)},t&&(a[Symbol.iterator]=a.entries),a.toString=function(){var e=[];return this.forEach((function(t,r){e.push(i(r)+"="+i(t))})),e.join("&")},e.URLSearchParams=n}();var a=e.URLSearchParams.prototype;"function"!=typeof a.sort&&(a.sort=function(){var e=this,t=[];this.forEach((function(r,i){t.push([i,r]),e._entries||e.delete(i)})),t.sort((function(e,t){return e[0]<t[0]?-1:e[0]>t[0]?1:0})),e._entries&&(e._entries={});for(var r=0;r<t.length;r++)this.append(t[r][0],t[r][1])}),"function"!=typeof a._fromString&&Object.defineProperty(a,"_fromString",{enumerable:!1,configurable:!1,writable:!1,value:function(e){if(this._entries)this._entries={};else{var t=[];this.forEach((function(e,r){t.push(r)}));for(var r=0;r<t.length;r++)this.delete(t[r])}var i,a=(e=e.replace(/^\?/,"")).split("&");for(r=0;r<a.length;r++)i=a[r].split("="),this.append(n(i[0]),1<i.length?n(i[1]):"")}})})(void 0===r.g?"undefined"==typeof window?"undefined"==typeof self?this:self:window:r.g),function(e){if(function(){try{var t=new e.URL("b","http://a");return t.pathname="c d","http://a/c%20d"===t.href&&t.searchParams}catch(e){return!1}}()||function(){var t=e.URL,r=function(t,r){"string"!=typeof t&&(t+=""),r&&"string"!=typeof r&&(r+="");var i,n=document;if(r&&(void 0===e.location||r!==e.location.href)){r=r.toLowerCase(),(i=(n=document.implementation.createHTMLDocument("")).createElement("base")).href=r,n.head.appendChild(i);try{if(0!==i.href.indexOf(r))throw new Error(i.href)}catch(e){throw new Error("URL unable to set base "+r+" due to "+e)}}var a=n.createElement("a");a.href=t,i&&(n.body.appendChild(a),a.href=a.href);var s=n.createElement("input");if(s.type="url",s.value=t,":"===a.protocol||!/:/.test(a.href)||!s.checkValidity()&&!r)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:a});var o,l=new e.URLSearchParams(this.search),h=!0,c=!0,u=this;["append","delete","set"].forEach((function(e){var t=l[e];l[e]=function(){t.apply(l,arguments),h&&(c=!1,u.search=l.toString(),c=!0)}})),Object.defineProperty(this,"searchParams",{value:l,enumerable:!0}),Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==o&&(o=this.search,c&&(h=!1,this.searchParams._fromString(this.search),h=!0))}})},i=r.prototype;["hash","host","hostname","port","protocol"].forEach((function(e){!function(e){Object.defineProperty(i,e,{get:function(){return this._anchorElement[e]},set:function(t){this._anchorElement[e]=t},enumerable:!0})}(e)})),Object.defineProperty(i,"search",{get:function(){return this._anchorElement.search},set:function(e){this._anchorElement.search=e,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(i,{toString:{get:function(){var e=this;return function(){return e.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(e){this._anchorElement.href=e,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(e){this._anchorElement.pathname=e},enumerable:!0},origin:{get:function(){var e={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],t=this._anchorElement.port!=e&&""!==this._anchorElement.port;return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(t?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(){},enumerable:!0},username:{get:function(){return""},set:function(){},enumerable:!0}}),r.createObjectURL=function(){return t.createObjectURL.apply(t,arguments)},r.revokeObjectURL=function(){return t.revokeObjectURL.apply(t,arguments)},e.URL=r}(),void 0!==e.location&&!("origin"in e.location)){var t=function(){return e.location.protocol+"//"+e.location.hostname+(e.location.port?":"+e.location.port:"")};try{Object.defineProperty(e.location,"origin",{get:t,enumerable:!0})}catch(r){setInterval((function(){e.location.origin=t()}),100)}}}(void 0===r.g?"undefined"==typeof window?"undefined"==typeof self?this:self:window:r.g)},3515:(e,t,r)=>{function i(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t.oe=function(e){throw console.error(e),e};var i=t(t.s=ENTRY_MODULE);return i.default||i}var n="[\\.|\\-|\\+|\\w|/|@]+",a="\\(\\s*(/\\*.*?\\*/)?\\s*.*?("+n+").*?\\)";function s(e){return(e+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function o(e,t,i){var o={};o[i]=[];var l,h=t.toString(),c=h.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!c)return o;for(var u,d=c[1],p=new RegExp("(\\\\n|\\W)"+s(d)+a,"g");u=p.exec(h);)"dll-reference"!==u[3]&&o[i].push(u[3]);for(p=new RegExp("\\("+s(d)+'\\("(dll-reference\\s('+n+'))"\\)\\)'+a,"g");u=p.exec(h);)e[u[2]]||(o[i].push(u[1]),e[u[2]]=r(u[1]).m),o[u[2]]=o[u[2]]||[],o[u[2]].push(u[4]);for(var m=Object.keys(o),f=0;f<m.length;f++)for(var v=0;v<o[m[f]].length;v++)l=o[m[f]][v],!isNaN(1*l)&&(o[m[f]][v]=1*o[m[f]][v]);return o}function l(e){return Object.keys(e).reduce((function(t,r){return t||0<e[r].length}),!1)}e.exports=function(e,t){t=t||{};var n={main:r.m},a=t.all?{main:Object.keys(n.main)}:function(e,t){for(var r={main:[t]},i={main:[]},n={main:{}};l(r);)for(var a=Object.keys(r),s=0;s<a.length;s++){var h=a[s],c=r[h].pop();if(n[h]=n[h]||{},!n[h][c]&&e[h][c]){n[h][c]=!0,i[h]=i[h]||[],i[h].push(c);for(var u=o(e,e[h][c],h),d=Object.keys(u),p=0;p<d.length;p++)r[d[p]]=r[d[p]]||[],r[d[p]]=r[d[p]].concat(u[d[p]])}}return i}(n,e),s="";Object.keys(a).filter((function(e){return"main"!==e})).forEach((function(e){for(var t=0;a[e][t];)t++;a[e].push(t),n[e][t]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",s=s+"var "+e+" = ("+i.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+a[e].map((function(t){return JSON.stringify(t)+": "+n[e][t].toString()})).join(",")+"});\n"})),s=s+"new (("+i.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+a.main.map((function(e){return JSON.stringify(e)+": "+n.main[e].toString()})).join(",")+"}))(self);";var h=new window.Blob([s],{type:"text/javascript"});if(t.bare)return h;var c=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(h),u=new window.Worker(c);return u.objectURL=c,u}},701:(e,t,r)=>{var i,n,a,s,o,l,h,c,u=r(1515),d=r(2515).resolveURL,p=function(){this.nearPlane=.168248,this.farPlane=6.82906,this.eyePosition=[.5,-2.86496,.5],this.targetPosition=[.5,.5,.5],this.upVector=[0,0,1];var e=this;this.setFromObject=t=>{var{nearPlane:r,farPlane:i,eyePosition:n,targetPosition:a,upVector:s}=t;e.nearPlane=r,e.farPlane=i,e.eyePosition=n,e.targetPosition=a,e.upVector=s}},m=function(e,t,r,i){var n=e.eyePosition,a=e.targetPosition,s=e.upVector,o=t.eyePosition,l=t.targetPosition,h=t.upVector,c=r,u=i,d=0,p=!1;c.near=Math.min(e.nearPlane,t.nearPlane),c.far=Math.max(e.farPlane,t.farPlane),c.cameraObject.up.set(t.upVector[0],t.upVector[1],t.upVector[2]),this.setDuration=e=>{u=e},this.update=e=>{!1===this.enabled||((e=>{var t=d+e;t>u&&(t=u),d=t})(e),(()=>{var e=d/u,t=[n[0]*(1-e)+o[0]*e,n[1]*(1-e)+o[1]*e,n[2]*(1-e)+o[2]*e],r=[a[0]*(1-e)+l[0]*e,a[1]*(1-e)+l[1]*e,a[2]*(1-e)+l[2]*e];s[0],h[0],s[1],h[1],s[2],h[2],c.cameraObject.position.set(t[0],t[1],t[2]),c.cameraObject.target.set(r[0],r[1],r[2])})(),d==u&&(p=!0))},this.isTransitionCompleted=()=>p},f=function(e,t,r,i){var n=e,a=t,s=r,o=i,l=0,h=!1;this.setDuration=e=>{o=e},this.update=e=>{!1===this.enabled||((e=>{var t=l,r=l+e;r>o&&(r=o);var i=((l=r)-t)/o*a;s.rotateAboutLookAtpoint(n,i)})(e),l==o&&(h=!0))},this.isTransitionCompleted=()=>h},v=function(e,t,r,i,n){var a=e,s=t,o=n,l=r,h=i,c=new u.Raycaster;c.params.Line.threshold=.1,c.params.Points.threshold=1;var d=new u.Vector2,p=!1,m=new Date,f=!1,v=0,g=[],y={zincCamera:void 0,x:-1,y:-1},x=void 0;this.enable=()=>{enable=!0},this.disable=()=>{enable=!1},this.getIntersectsObject=e=>{if(s!==a){var t=a.getThreeJSScene();o.render(t,e.cameraObject)}var r=x||a.getPickableThreeJSObjects();return g.length=0,c.intersectObjects(r,!0,g)},this.setPickableObjects=e=>{void 0===e?x=void 0:(x=[],e.forEach((e=>{e.getGroup()&&e.getGroup().visible&&x.push(e.getGroup())})))},this.getIntersectsObjectWithOrigin=(e,t,r)=>(c.set(t,r),this.getIntersectsObject(e)),this.getIntersectsObjectWithCamera=(e,t,r)=>(e.getNDCFromDocumentCoords(t,r,d),c.setFromCamera(d,e.cameraObject),this.getIntersectsObject(e)),this.pick=(e,t,r)=>{if(o&&a&&e&&l){this.getIntersectsObjectWithCamera(e,t,r);for(var i,n=g.length,s=0;s<n;s++)if((i=g[s].object?g[s].object.userData:void 0)&&i.isMarkerCluster&&i.visible&&i.clusterIsVisible(g[s].object.clusterIndex)&&i.zoomToCluster(g[s].object.clusterIndex))return;l(g,t,r)}};var b=(e,t,r)=>{if(o&&a&&e&&h){if(this.getIntersectsObjectWithCamera(e,t,r),m.setTime(Date.now()),0===g.length){if(f)return;f=!0}else f=!1;h(g,t,r)}};this.move=(e,t,r)=>{o&&a&&e&&h&&(a.displayMarkers?b(e,t,r):(y.zincCamera=e,y.x=t,y.y=r,!p&&(250<=(v=m?Date.now()-m.getTime():250)?b(e,t,r):(p=!0,setTimeout(w(y),v)))))};var w=e=>function(){p=!1,b(e.zincCamera,e.x,e.y)}},g=function(e,t,r,i){var n=new u.Vector3,a=-t,s=i,o=e;this.stopOnCameraInput=r,this.requireUpdate=!0;var l=new u.Vector3,h=new u.Vector3;this.update=e=>{!1===this.enabled||(this.requireUpdate&&((e=>{var t=Math.sqrt(e[0]*e[0]+e[1]*e[1]),r=.25*(4*Math.abs(e[0])+4*Math.abs(e[1])),i=-e[1]/t,a=e[0]/t,o=i*e[0]+a*-e[1];o>r?o=r:o<-r&&(o=-r);var c=Math.acos(o/r)-.5*Math.PI;n.copy(s.cameraObject.position).sub(s.cameraObject.target).normalize(),l.copy(s.cameraObject.up).normalize(),h.crossVectors(l,n).normalize().multiplyScalar(i),l.multiplyScalar(a),l.add(h).multiplyScalar(Math.cos(c)),n.multiplyScalar(Math.sin(c)).add(l)})(o),this.requireUpdate=!1),s.rotateAboutLookAtpoint(n,a*e/1e3))}},y=function(){this.type="StereoCamera",this.aspect=1,this.cameraL=new u.PerspectiveCamera,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new u.PerspectiveCamera,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1};Object.assign(y.prototype,{update:(h=new u.Matrix4,c=new u.Matrix4,function(e){if(i!==e.focus||n!==e.fov||a!==e.aspect*this.aspect||s!==e.near||o!==e.far||l!==e.zoom){i=e.focus,n=e.fov,a=e.aspect*this.aspect,s=e.near,o=e.far,l=e.zoom;var t,r,d=e.projectionMatrix.clone(),p=.032*s/i,m=s*Math.tan(u.Math.DEG2RAD*n*.5)/e.zoom;c.elements[12]=-.032,h.elements[12]=.032,t=-m*a+p,r=m*a+p,d.elements[0]=2*s/(r-t),d.elements[8]=(r+t)/(r-t),this.cameraL.projectionMatrix.copy(d),t=-m*a-p,r=m*a-p,d.elements[0]=2*s/(r-t),d.elements[8]=(r+t)/(r-t),this.cameraR.projectionMatrix.copy(d)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(c),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(h)})});var x=function(e){var t=this;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0;var r,i,n,a,s=e=>{t.deviceOrientation=e},o=()=>{"undefined"!=typeof window&&(t.screenOrientation=window.orientation||0)},l=(r=new u.Vector3(0,0,1),i=new u.Euler,n=new u.Quaternion,a=new u.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),(e,t,s,o,l)=>{var h=new u.Vector3(0,0,1);h.subVectors(e.target,e.position),i.set(s,t,-o,"YXZ");var c=new u.Quaternion;c.setFromEuler(i),c.multiply(a),c.multiply(n.setFromAxisAngle(r,-l)),h.applyQuaternion(c),h.addVectors(e.position,h),e.lookAt(h)});this.connect=()=>{o(),"undefined"!=typeof window&&(window.addEventListener("orientationchange",o,!1),window.addEventListener("deviceorientation",s,!1)),t.enabled=!0},this.disconnect=()=>{"undefined"!=typeof window&&(window.removeEventListener("orientationchange",o,!1),window.removeEventListener("deviceorientation",s,!1)),t.enabled=!1},this.update=()=>{if(!1!==t.enabled){var e=t.deviceOrientation.alpha?u.Math.degToRad(t.deviceOrientation.alpha):0,r=t.deviceOrientation.beta?u.Math.degToRad(t.deviceOrientation.beta):0,i=t.deviceOrientation.gamma?u.Math.degToRad(t.deviceOrientation.gamma):0,n=t.screenOrientation?u.Math.degToRad(t.screenOrientation):0;l(t.object,e,r,i,n)}},this.dispose=function(){this.disconnect()},this.connect()},b=function(){var e=void 0,t=void 0,r=void 0,i=new u.Vector3,n=new u.Vector3,a=new u.Vector3,s=new u.Vector3,o=void 0;this.setCurrentCameraSettings=(a,s)=>{e=a.clone(),t=a,r=s,e.near=r.nearPlane,r.farPlane&&(e.far=r.farPlane),r.eyePosition&&e.position.set(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),r.upVector&&e.up.set(r.upVector[0],r.upVector[1],r.upVector[2]),r.targetPosition&&(e.target=new u.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),e.lookAt(e.target)),e.updateProjectionMatrix(),i.copy(e.position).project(e),n.copy(e.target).project(e)},this.getCurrentPosition=()=>(n.copy(t.target).project(e),[n.x,n.y]),this.zoom=e=>{var r=.002*e,i=Math.max(t.zoom-r,1);t.zoom=i,t.updateProjectionMatrix()},this.zoomToBox=(t,r)=>{t.getCenter(a),a.project(e),this.setCenterZoom([a.x,a.y],r)},this.getPanZoom=()=>({target:this.getCurrentPosition(),zoom:t.zoom}),this.setCenterZoom=(r,i)=>{a.set(r[0],r[1],n.z).unproject(e),s.copy(a).sub(t.target),t.target.copy(a),t.lookAt(t.target),t.position.add(s),t.zoom=i,t.updateProjectionMatrix()},this.setEventCallback=e=>{(void 0===e||"function"==typeof e)&&(o=e)},this.triggerCallback=()=>{void 0!==o&&"function"==typeof o&&o()}};t.Viewport=p,t.CameraControls=function(e,t,r,i){var n={NONE:-1,DEFAULT:0,PATH:1,SMOOTH_CAMERA_TRANSITION:2,AUTO_TUMBLE:3,ROTATE_TRANSITION:4,MINIMAP:5,SYNC_CONTROL:6},a={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM:4,TOUCH_PAN:5,SCROLL:6,KEYBOARD_ZOOM:7,KEYBOARD_ROTATE:8,KEYBOARD_PAN:9},s={ARROWLEFT:37,ARROWUP:38,ARROWRIGHT:39,ARROWDOWN:40,NUMPADADD:107,NUMPADSUBTRACT:109,EQUAL:187,MINUS:189},o={};o.MAIN=a.ROTATE,o.AUXILIARY=a.ZOOM,o.SECONDARY=a.PAN,this.cameraObject=e,this.domElement=void 0===t?document:t,this.renderer=r,this.scene=i,this.tumble_rate=1.5,this.pointer_x=0,this.pointer_y=0,this.pointer_x_start=0,this.pointer_y_start=0,this.previous_pointer_x=0,this.previous_pointer_y=0,this.near_plane_fly_debt=0,this.touchZoomDistanceStart=0,this.touchZoomDistanceEnd=0,this.directionalLight=0,this.zoomRate=50,this.rotateRate=50,this.panRate=100,this.pixelHeight=1;var l,h=6e3,c=!0,y=0,w=void 0,_=void 0,M=!1,S=500,T=void 0,E="default",A=n.DEFAULT,L=void 0,R=void 0,C=void 0,P=0,I=1;this._state=a.NONE,this.targetTouchId=-1;var O=void 0,D=new u.Vector3,N=new u.Vector3,B=new u.Vector3,U=new u.Vector3,z=new u.Vector3,F=new u.Vector3,G=new u.Vector3,V=new u.Vector3,H=new u.Sphere,k=new u.Vector3,j=!1,W=void 0,Z=0,q={default:new p};q.default.nearPlane=.1,q.default.farPlane=2e3,q.default.eyePosition=[0,0,0],q.default.targetPosition=[0,0,-1],q.default.upVector=[0,1,0],void 0===this.cameraObject.target&&(this.cameraObject.target=new u.Vector3(...q.default.targetPosition)),this.calculateMaxAllowedDistance=e=>{var t=e.getBoundingBox();if(t){t.getBoundingSphere(H),Z=6*H.radius;var r=0;this.cameraObject&&(r=this.cameraObject.position.distanceTo(H.center)),Z=r>Z?1.5*r:Z}else Z=0},this.addViewport=(e,t)=>{e&&t&&(q[e]=t)},this.setDefaultViewport=e=>!(!e||!(e in q)||(E=e,0)),this.getDefaultViewport=()=>E,this.getViewportOfName=e=>q[e],this.setCurrentViewport=e=>!!(e in q)&&(this.setCurrentCameraSettings(q[e]),!0),this.setRotationMode=e=>{switch(e){case"none":I=-1;break;case"horizontal":I=2;break;case"vertical":I=3;break;default:I=1}},this.onResize=()=>{O&&(O=void 0),W&&W.setCurrentCameraSettings(this.cameraObject,q[E])},this.getVisibleHeightAtZDepth=e=>{var t=this.cameraObject.position.distanceTo(this.cameraObject.target);e<t?e-=t:e+=t;var r=this.cameraObject.fov*Math.PI/180;return 2*Math.tan(r/2)*Math.abs(e)},this.calculateHeightPerPixelAtZeroDepth=e=>{var t=this.getVisibleHeightAtZDepth(0);return this.pixelHeight=t/e,this.pixelHeight},this.getNDCFromDocumentCoords=(e,t,r)=>{ae(!1);var i=r||new u.Vector2,n=(e-O.left)/O.width*2-1,a=-(t-O.top)/O.height*2+1;return i.set(n,a)},this.getRelativeCoordsFromNDC=(e,t,r)=>{ae(!1);var i=r||new u.Vector2;return i.x=(e+1)*O.width/2,i.y=(1-t)*O.height/2,i},this.setMouseButtonAction=(e,t)=>{o[e]=a[t]};var X=(e,t)=>{e instanceof HTMLCanvasElement&&(e.tabIndex=t)},Y=()=>{if(0<Z){var e=k.distanceTo(H.center);return Z>e||this.cameraObject.position.distanceTo(H.center)>e}return!0},J=e=>{k.copy(this.cameraObject.position).add(e),Y()&&(this.cameraObject.target.add(e),this.cameraObject.position.add(e),this.updateDirectionalLight())},K=e=>{var t;if(ae(!1),A===n.DEFAULT&&(t=this.scene.getNormalisedMinimapCoordinates(this.renderer,e)),t){A=n.MINIMAP;var r=this.scene.getMinimapDiffFromNormalised(t.x,t.y);J(r)}else 0==e.button?e.ctrlKey?this._state=o.AUXILIARY:e.shiftKey?this._state=o.SECONDARY:this._state=o.MAIN:1==e.button?(e.preventDefault(),this._state=o.AUXILIARY):2==e.button&&(this._state=o.SECONDARY),this.pointer_x=e.clientX-O.left,this.pointer_y=e.clientY-O.top,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},Q=e=>{if(ae(!1),O)if(this.pointer_x=e.clientX-O.left,this.pointer_y=e.clientY-O.top,A===n.MINIMAP){var t=this.scene.getNormalisedMinimapCoordinates(this.renderer,e);if(t){var r=this.scene.getMinimapDiffFromNormalised(t.x,t.y);J(r)}}else this._state===a.NONE&&void 0!==l&&l.move(this,e.clientX,e.clientY,this.renderer)},$=e=>{this._state=a.NONE,A==n.MINIMAP&&(A=n.DEFAULT),void 0!==l&&this.pointer_x_start==e.clientX-O.left&&this.pointer_y_start==e.clientY-O.top&&l.pick(this,e.clientX,e.clientY,this.renderer)},ee=e=>{this._state=a.NONE},te=e=>{ae(!1);var t,r,i=e.touches.length;if(1==i)this._state=a.TOUCH_ROTATE,this.pointer_x=e.touches[0].clientX-(null===(t=O)||void 0===t?void 0:t.left),this.pointer_y=e.touches[0].clientY-(null===(r=O)||void 0===r?void 0:r.top),this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y;else if(2==i){this._state=a.TOUCH_ZOOM;var n=e.touches[0].clientX-e.touches[1].clientX,s=e.touches[0].clientY-e.touches[1].clientY;this.touchZoomDistanceEnd=this.touchZoomDistanceStart=Math.sqrt(n*n+s*s)}else if(3==i){var o,l;this._state=a.TOUCH_PAN,this.targetTouchId=e.touches[0].identifier,this.pointer_x=e.touches[0].clientX-(null===(o=O)||void 0===o?void 0:o.left),this.pointer_y=e.touches[0].clientY-(null===(l=O)||void 0===l?void 0:l.top),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y}},re=e=>{e.preventDefault(),e.stopPropagation();var t=e.touches.length;if(1==t)this.pointer_x=e.touches[0].clientX-O.left,this.pointer_y=e.touches[0].clientY-O.top;else if(2==t){if(this._state===a.TOUCH_ZOOM){var r=e.touches[0].clientX-e.touches[1].clientX,i=e.touches[0].clientY-e.touches[1].clientY;this.touchZoomDistanceEnd=Math.sqrt(r*r+i*i)}}else if(3==t&&this._state===a.TOUCH_PAN)for(var n=0;3>n;n++)e.touches[n].identifier==this.targetTouchId&&(this.pointer_x=e.touches[0].clientX-O.left,this.pointer_y=e.touches[0].clientY-O.top)},ie=e=>{var t=e.touches.length;this.touchZoomDistanceStart=this.touchZoomDistanceEnd=0,this.targetTouchId=-1,this._state=a.NONE,1==t&&void 0!==l&&this.pointer_x_start==e.touches[0].clientX-O.left&&this.pointer_y_start==e.touches[0].clientY-O.top&&l.pick(this.cameraObject,e.touches[0].clientX,e.touches[0].clientY,this.renderer)},ne=()=>{ae(!0)},ae=e=>{if(e||void 0===O){var t=new IntersectionObserver((e=>{for(var r of e)O=r.boundingClientRect;t.disconnect()}));t.observe(this.domElement)}},se=e=>{ae(!1),this._state=a.SCROLL;var t=0;0<e.deltaY?t=this.zoomRate:0>e.deltaY&&(t=-1*this.zoomRate),P+=t,e.preventDefault(),e.stopImmediatePropagation()},oe=e=>{ae(!1);var t=0;if(e.keyCode===s.EQUAL||e.keyCode===s.MINUS||e.keyCode===s.NUMPADADD||e.keyCode===s.NUMPADSUBTRACT){this._state=a.KEYBOARD_ZOOM;var r=1;e.shiftKey&&(r*=2),e.keyCode===s.EQUAL||e.keyCode===s.NUMPADADD?t=this.zoomRate*r*-1:(e.keyCode===s.MINUS||e.keyCode===s.NUMPADSUBTRACT)&&(t=this.zoomRate*r),P+=t}else(e.keyCode===s.ARROWLEFT||e.keyCode===s.ARROWUP||e.keyCode===s.ARROWRIGHT||e.keyCode===s.ARROWDOWN)&&(e.shiftKey?(this._state=a.KEYBOARD_ROTATE,this.pointer_x_start=this.pointer_x,this.pointer_y_start=this.pointer_y,t=this.rotateRate):(this._state=a.KEYBOARD_PAN,t=this.panRate),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,e.keyCode===s.ARROWLEFT?this.pointer_x-=t:e.keyCode===s.ARROWUP?this.pointer_y-=t:e.keyCode===s.ARROWRIGHT?this.pointer_x+=t:e.keyCode===s.ARROWDOWN&&(this.pointer_y+=t));Object.values(s).includes(e.keyCode)&&e.preventDefault()},le=e=>{this._state=a.NONE},he=()=>{if(void 0!==this.cameraObject){var e=O.height,t=this.cameraObject.position.distanceTo(this.cameraObject.target),r=0;this.cameraObject.far>this.cameraObject.near&&t>=this.cameraObject.near&&t<=this.cameraObject.far&&(r=(t-this.cameraObject.near)/(this.cameraObject.far-this.cameraObject.near)),N.set(this.previous_pointer_x,e-this.previous_pointer_y,0),B.set(this.previous_pointer_x,e-this.previous_pointer_y,1),U.set(this.pointer_x,e-this.pointer_y,0),z.set(this.pointer_x,e-this.pointer_y,1),N.unproject(this.cameraObject),B.unproject(this.cameraObject),U.unproject(this.cameraObject),z.unproject(this.cameraObject),U.sub(N).multiplyScalar(1-r),z.sub(B).multiplyScalar(r),U.add(z).multiplyScalar(-.002),J(U)}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y};this.getVectorsFromRotateAboutLookAtPoints=(e,t)=>{e.normalize(),G.copy(this.cameraObject.position).sub(this.cameraObject.target),V.copy(G),G.normalize(),.8<Math.abs(G.dot(e))&&G.copy(this.cameraObject.up),N.crossVectors(e,G).normalize(),B.crossVectors(e,N);var r=e.dot(V),i=N.dot(V),n=B.dot(V),a=e.dot(this.cameraObject.up),s=N.dot(this.cameraObject.up),o=B.dot(this.cameraObject.up),l=Math.cos(t),h=Math.sin(t);return U.set(l*N.x+h*B.x,l*N.y+h*B.y,l*N.z+h*B.z),z.set(l*B.x-h*N.x,l*B.y-h*N.y,l*B.z-h*N.z),G.copy(this.cameraObject.target),G.x=G.x+e.x*r+U.x*i+z.x*n,G.y=G.y+e.y*r+U.y*i+z.y*n,G.z=G.z+e.z*r+U.z*i+z.z*n,D.set(e.x*a+U.x*s+z.x*o,e.y*a+U.y*s+z.y*o,e.z*a+U.z*s+z.z*o),{position:G,up:D}},this.rotateAboutLookAtpoint=(e,t)=>{var r=this.getVectorsFromRotateAboutLookAtPoints(e,t);this.cameraObject.position.copy(r.position),this.updateDirectionalLight(),this.cameraObject.up.copy(r.up)};var ce=()=>{if(void 0!==this.cameraObject){var e,t,r=null===(e=O)||void 0===e?void 0:e.width,i=null===(t=O)||void 0===t?void 0:t.height;if(0<r&&0<i){var n=.25*(r+i),a=0,s=0;(1===I||2===I)&&(a=this.pointer_x-this.previous_pointer_x),(1===I||3===I)&&(s=this.previous_pointer_y-this.pointer_y);var o=Math.sqrt(a*a+s*s);if(0<o){var l=1*-s/o,h=1*a/o;if(1===I){var c=l*(this.pointer_x-.5*(r-1))+h*(.5*(i-1)-this.pointer_y);c>n?c=n:c<-n&&(c=-n)}var u=Math.acos(0/n)-.5*Math.PI,d=this.tumble_rate*o/n;D.copy(this.cameraObject.position).sub(this.cameraObject.target).normalize(),N.copy(this.cameraObject.up).normalize(),B.copy(N).cross(D).normalize().multiplyScalar(l),N.multiplyScalar(h),F.addVectors(B,N).multiplyScalar(Math.cos(u)),D.multiplyScalar(Math.sin(u)),F.add(D),this.rotateAboutLookAtpoint(F,-d)}}}this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y},ue=()=>{var e=0;return this._state===a.ZOOM?e=this.previous_pointer_y-this.pointer_y:this._state===a.SCROLL||this._state===a.KEYBOARD_ZOOM?e=P:(e=-1*(this.touchZoomDistanceEnd-this.touchZoomDistanceStart),this.touchZoomDistanceStart=this.touchZoomDistanceEnd),e};this.changeZoomByScrollRateUnit=e=>{var t=e*this.zoomRate;this.changeZoomByValue(t)},this.changeZoomByValue=e=>{if(void 0!==this.cameraObject){var t=O.height,r=this.cameraObject.position.clone();r.sub(this.cameraObject.target);var i=r.length(),n=1.5*e/t;if(.01<i+n*i&&(r.normalize(),k.copy(this.cameraObject.position),k.x+=r.x*n*i,k.y+=r.y*n*i,k.z+=r.z*n*i,Y())){this.cameraObject.position.copy(k),this.updateDirectionalLight();var a=1e-5;if(a*this.cameraObject.far<this.cameraObject.near+n*i+this.near_plane_fly_debt)0!=this.near_plane_fly_debt&&(this.near_plane_fly_debt+=n*i,0<this.near_plane_fly_debt?(this.cameraObject.near+=this.near_plane_fly_debt,this.cameraObject.far+=this.near_plane_fly_debt,this.near_plane_fly_debt=0):(this.cameraObject.near+=n*i,this.cameraObject.far+=n*i));else{if(0==this.near_plane_fly_debt){var s=this.cameraObject.near-a*this.cameraObject.far;this.cameraObject.near=a*this.cameraObject.far,this.cameraObject.far-=s,this.near_plane_fly_debt-=a*this.cameraObject.far}this.near_plane_fly_debt+=n*i}j=!0}}};var de=()=>{var e=ue();this.changeZoomByValue(e),this._state===a.ZOOM&&(this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y),(this._state===a.SCROLL||this._state===a.KEYBOARD_ZOOM)&&(P=0,this._state=a.NONE)};this.setDirectionalLight=e=>{this.directionalLight=e},this.updateDirectionalLight=()=>{0!=this.directionalLight&&this.directionalLight.position.set(this.cameraObject.position.x,this.cameraObject.position.y,this.cameraObject.position.z)},this.enable=function(){c=!0,this.domElement&&this.domElement.addEventListener&&(X(this.domElement,0),this.domElement.addEventListener("mousedown",K,!1),this.domElement.addEventListener("mousemove",Q,!1),this.domElement.addEventListener("mouseup",$,!1),this.domElement.addEventListener("mouseleave",ee,!1),this.domElement.addEventListener("touchstart",te,!1),this.domElement.addEventListener("touchmove",re,!1),this.domElement.addEventListener("touchend",ie,!1),this.domElement.addEventListener("wheel",se,!1),this.domElement.addEventListener("mouseenter",ne,!1),this.domElement.addEventListener("contextmenu",(e=>{e.preventDefault()}),!1),this.domElement.addEventListener("keydown",oe,!1),this.domElement.addEventListener("keyup",le,!1))},this.disable=function(){c=!1,this.domElement&&this.domElement.removeEventListener&&(this.domElement.removeEventListener("mousedown",K,!1),this.domElement.removeEventListener("mousemove",Q,!1),this.domElement.removeEventListener("mouseup",$,!1),this.domElement.removeEventListener("mouseleave",ee,!1),this.domElement.removeEventListener("touchstart",te,!1),this.domElement.removeEventListener("touchmove",re,!1),this.domElement.removeEventListener("touchend",ie,!1),this.domElement.removeEventListener("wheel",se,!1),this.domElement.removeEventListener("mouseenter",ne,!1),this.domElement.removeEventListener("contextmenu",(e=>{e.preventDefault()}),!1),this.domElement.removeEventListener("keydown",oe,!1),this.domElement.removeEventListener("keyup",le,!1),X(this.domElement,-1))},this.loadPath=e=>{w=e.CameraPath,_=e.NumberOfPoints},this.loadPathURL=(e,t)=>{var r=new XMLHttpRequest;r.onreadystatechange=()=>{if(4==r.readyState&&200==r.status){var e=JSON.parse(r.responseText);this.loadPath(e),null!=t&&"function"==typeof t&&t()}};var i=d(e);r.open("GET",i,!0),r.send()},this.setPathDuration=e=>{h=e,L&&L.setDuration(h),R&&R.setDuration(h)},this.getPlayRate=()=>S,this.setPlayRate=e=>{S=e},this.getTime=()=>y,this.setTime=e=>{y=e>h?h:0>e?0:e},this.getNumberOfTimeFrame=()=>_,this.getCurrentTimeFrame=()=>{if(2<_){var e=y/h*(_-1),t=Math.floor(e),r=1-(e-t),i=Math.ceil(e);return t==i?t==_-1?[t-1,i,0]:[t,i+1,1]:[t,i,r]}return 1==_?[0,0,0]:void 0},this.setCurrentTimeFrame=e=>{2<_&&(0>(y=h*e/(_-1))&&(y=0),y>h&&(y=h))};var pe=e=>{if(A===n.PATH&&((e=>{var t=y+e;t>h&&(t-=h),y=t})(e),w)){for(var t=this.getCurrentTimeFrame(),r=t[0],i=t[1],a=t[2],s=[w[3*r],w[3*r+1],w[3*r+2]],o=[w[3*i],w[3*i+1],w[3*i+2]],l=[],c=0;c<s.length;c++)l.push(a*s[c]+(1-a)*o[c]);this.cameraObject.position.set(l[0],l[1],l[2]),this.cameraObject.target.set(o[0],o[1],o[2]),T&&this.cameraObject.lookAt(this.cameraObject.target),M&&(this.directionalLight.position.set(l[0],l[1],l[2]),this.directionalLight.target.position.set(o[0],o[1],o[2]))}};this.calculatePathNow=()=>{pe(0)};var me=()=>{this._state===a.ROTATE||this._state===a.TOUCH_ROTATE||this._state===a.KEYBOARD_ROTATE?ce():this._state===a.PAN||this._state===a.TOUCH_PAN||this._state===a.KEYBOARD_PAN?(he(),W.triggerCallback()):(this._state===a.ZOOM||this._state===a.TOUCH_ZOOM||this._state===a.SCROLL||this._state===a.KEYBOARD_ZOOM)&&(W.zoom(ue()),this.previous_pointer_x=this.pointer_x,this.previous_pointer_y=this.pointer_y,(this._state===a.SCROLL||this._state===a.KEYBOARD_ZOOM)&&(this._state=a.NONE),P=0,W.triggerCallback())};this.update=e=>{var t=e*S,r=c,i=!0;return A===n.PATH?pe(t):A===n.SMOOTH_CAMERA_TRANSITION&&L?(L.update(t),L.isTransitionCompleted()&&(A=n.DEFAULT),r=!1):A===n.ROTATE_CAMERA_TRANSITION&&R?(R.update(t),R.isTransitionCompleted()&&(A=n.DEFAULT),r=!1):A===n.AUTO_TUMBLE&&C?C.update(t):A===n.SYNC_CONTROL&&W?(me(),r=!1):i=!1,r&&(this._state!==a.NONE&&(i=!0),this._state===a.ROTATE||this._state===a.TOUCH_ROTATE||this._state===a.KEYBOARD_ROTATE?ce():this._state===a.PAN||this._state===a.TOUCH_PAN||this._state===a.KEYBOARD_PAN?he():(this._state===a.ZOOM||this._state===a.TOUCH_ZOOM||this._state===a.SCROLL||this._state===a.KEYBOARD_ZOOM)&&de(),this._state!==a.NONE&&A===n.AUTO_TUMBLE&&C&&C.stopOnCameraInput,this._state===a.SCROLL&&(this._state=a.NONE)),T?(i=!0,T.update()):this.cameraObject.lookAt(this.cameraObject.target),i=i||j,j=!1,i},this.playPath=()=>{A=n.PATH},this.stopPath=()=>{A=n.DEFAULT},this.isPlayingPath=()=>A===n.PATH,this.enableDirectionalLightUpdateWithPath=e=>{M=e},this.enableDeviceOrientation=()=>{T||(T=new x(this.cameraObject))},this.disableDeviceOrientation=()=>{T&&(T.dispose(),T=void 0)},this.isDeviceOrientationEnabled=()=>!!T,this.resetView=()=>{var e=q[E];this.cameraObject.near=e.nearPlane,this.cameraObject.far=e.farPlane,this.cameraObject.position.set(e.eyePosition[0],e.eyePosition[1],e.eyePosition[2]),this.cameraObject.target.set(e.targetPosition[0],e.targetPosition[1],e.targetPosition[2]),this.cameraObject.up.set(e.upVector[0],e.upVector[1],e.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight()},this.setCurrentCameraSettings=e=>{e.nearPlane&&(this.cameraObject.near=e.nearPlane),e.farPlane&&(this.cameraObject.far=e.farPlane),e.eyePosition&&this.cameraObject.position.set(e.eyePosition[0],e.eyePosition[1],e.eyePosition[2]),e.targetPosition&&this.cameraObject.target.set(e.targetPosition[0],e.targetPosition[1],e.targetPosition[2]),e.upVector&&this.cameraObject.up.set(e.upVector[0],e.upVector[1],e.upVector[2]),this.cameraObject.updateProjectionMatrix(),this.updateDirectionalLight(),j=!0},this.getViewportFromCentreAndRadius=(e,t,r,i,n,a)=>{var s=this.cameraObject.position.x-this.cameraObject.target.x,o=this.cameraObject.position.y-this.cameraObject.target.y,l=this.cameraObject.position.z-this.cameraObject.target.z,h=1/Math.sqrt(s*s+o*o+l*l);s*=h,o*=h,l*=h;var c,u=[e,t,r],d=i/Math.tan(n*Math.PI/360),m=[e+s*d,t+o*d,r+l*d],f=d+a;c=a>.95*d?(1-.95)*d:d-a;var v=new p;return v.nearPlane=c,v.farPlane=f,v.eyePosition=m,v.targetPosition=u,v.upVector=[this.cameraObject.up.x,this.cameraObject.up.y,this.cameraObject.up.z],v},this.getViewportFromBoundingBox=(e,t)=>{var r=e.min.distanceTo(e.max)/2*t,i=(e.min.x+e.max.x)/2,n=(e.min.y+e.max.y)/2,a=(e.min.z+e.max.z)/2;return this.getViewportFromCentreAndRadius(i,n,a,r,40,4*r)},this.getCurrentViewport=()=>{var e=new p;return e.nearPlane=this.cameraObject.near,e.farPlane=this.cameraObject.far,e.eyePosition[0]=this.cameraObject.position.x,e.eyePosition[1]=this.cameraObject.position.y,e.eyePosition[2]=this.cameraObject.position.z,e.targetPosition[0]=this.cameraObject.target.x,e.targetPosition[1]=this.cameraObject.target.y,e.targetPosition[2]=this.cameraObject.target.z,e.upVector[0]=this.cameraObject.up.x,e.upVector[1]=this.cameraObject.up.y,e.upVector[2]=this.cameraObject.up.z,e},this.getDefaultEyePosition=()=>eyePosition,this.getDefaultTargetPosition=()=>targetPosition,this.cameraTransition=(e,t,r)=>{null==R&&(L=new m(e,t,this,r))},this.rotateCameraTransition=(e,t,r)=>{null==L&&(R=new f(e,t,this,r))},this.enableCameraTransition=()=>{L&&(A=n.SMOOTH_CAMERA_TRANSITION),R&&(A=n.ROTATE_CAMERA_TRANSITION)},this.pauseCameraTransition=()=>{A=n.DEFAULT},this.stopCameraTransition=()=>{A=n.DEFAULT,L=void 0,R=void 0},this.isTransitioningCamera=()=>A===n.SMOOTH_CAMERA_TRANSITION||A===n.ROTATE_CAMERA_TRANSITION,this.autoTumble=(e,t,r)=>{C=new g(e,t,r,this)},this.enableAutoTumble=()=>{A=n.AUTO_TUMBLE},this.stopAutoTumble=()=>{A=n.DEFAULT,C=void 0},this.updateAutoTumble=()=>{C&&(C.requireUpdate=!0)},this.isAutoTumble=()=>A===n.AUTO_TUMBLE,this.enableRaycaster=(e,t,r)=>{null==l&&(l=new v(e,this.scene,t,r,this.renderer))},this.disableRaycaster=()=>{l.disable(),l=void 0},this.isSyncControl=()=>currentMpde===n.SYNC_CONTROL,this.enableSyncControl=()=>(A=n.SYNC_CONTROL,W||(W=new b),W.setCurrentCameraSettings(this.cameraObject,q[E]),W),this.disableSyncControl=()=>{A=n.DEFAULT,this.cameraObject.zoom=1,this.cameraObject.updateProjectionMatrix()},this.enable()},t.SmoothCameraTransition=m,t.RotateCameraTransition=f,t.RayCaster=v,t.CameraAutoTumble=g,t.StereoEffect=function(e){var t=new y;t.aspect=.5,this.setSize=(t,r)=>{e.setSize(t,r)},this.render=(r,i)=>{r.updateMatrixWorld(),null===i.parent&&i.updateMatrixWorld(),t.update(i);var n=e.getSize();e.setScissorTest(!0),e.clear(),e.setScissor(0,0,n.width/2,n.height),e.setViewport(0,0,n.width/2,n.height),e.render(r,t.cameraL),e.setScissor(n.width/2,0,n.width/2,n.height),e.setViewport(n.width/2,0,n.width/2,n.height),e.render(r,t.cameraR),e.setScissorTest(!1)}},t.NDCCameraControl=b},3152:(e,t,r)=>{var i=r(1515),n=r(6133)(i),a=r(5672).V,s=r(3515),o=r(7846).A,l=i.BufferGeometryLoader,h=function(e){var t;e&&e.isGeometry&&(t=e);var c=void 0,u=void 0,d=!1,p=void 0;this.getHostGeometry=()=>{var e=new n(t.getMorph());return new m(e)},this.getGeometry=()=>t;var m=e=>{var r=t.getMorph().material.clone();r.morphTargets=!1;var i=e.toMesh(r),n=new a;return n.geometry=i.geometry,i.userData=n,n.setMorph(i),n};this.setCSG=e=>{c.setCSG(e)};var f=(e,t,r,i)=>{if(d)i("On progress");else{var n=e.getMorph(),a=n.geometry.clone().applyMatrix(n.matrix).toJSON();p=r,d=!0,u.postMessage({action:t,object:a})}};this.intersect=e=>new o(((t,r)=>{if(u)f(e,"intersect",t,r);else{var i=c.intersect(e),n=new h(m(i));n.setCSG(i),t(n)}})),this.subtract=e=>new o(((t,r)=>{if(u)f(e,"intersect",t,r);else{var i=c.subtract(e),n=new h(m(i));n.setCSG(i),t(n)}})),this.union=e=>new o(((t,r)=>{if(u)f(e,"intersect",t,r);else{var i=c.union(e),n=new h(m(i));n.setCSG(i),t(n)}})),this.terminateWorker=()=>{u&&u.terminate()},(e=>{if(void 0!==s&&(u=s(4494)),u){if(e&&e.isGeometry){var n=e.getMorph(),o=n.geometry.clone().applyMatrix(n.matrix).toJSON();u.addEventListener("message",(function(e){(e=>{switch(e.data.action){case"message":console.log(e.data.message);break;case"result":var r=new h((e=>{var r=t.getMorph().material.clone();r.morphTargets=!1;var n=new a,s=(new l).parse(e),o=new i.Mesh(s.geometry,r);return n.geometry=o.geometry,o.userData=n,n.setMorph(o),n})(e.data.object));p&&p(r),p=void 0,d=!1;break;default:throw"Cannot handle specified action."}})(e)})),u.postMessage({action:"initialise",object:o})}}else c=new(r(8701).$)(e)})(e)};t.w=h},1602:(e,t,r)=>{var i=r(1515),n=r(6133)(i),a=(r(2842).V,function(e){var t;e&&e.isGlyphset&&(t=e);var s=[];this.setGlyphset=e=>{e&&e.isGlyphset&&(t=e),hostCSG=void 0},this.getGlyphset=()=>t;this.intersect=e=>{var o=(e=>{if(t&&e&&e.getMorph())return 0==s.length&&t.forEachGlyph((e=>{var t=e.getMesh(),r=e.getLabel();if(t){var i=new n(t.geometry.clone().applyMatrix(t.matrix)),a=[];a.csg=i,a.label=r,t.material&&(a.material=t.material.clone()),s.push(a)}})),new n(e.getMorph())})(e);if(0<s.length&&o){for(var l=new(r(2842).V),h=0;h<s.length;h++){var c=s[h],u=c.csg.intersect(o).toMesh();u&&u.geometry&&0<u.geometry.vertices.length&&(c.material&&(u.material=c.material,u.material.side=i.DoubleSide,u.material.clippingPlanes=null),l.addMeshAsGlyph(u,h+1).setLabel(c.label))}return new a(l)}}});t.K=a},5576:(e,t,r)=>{r(1515);var i=r(9425).B;t.H=function(){var e=this;this.parseGLTFObjects=(t,i,n,a)=>{var s=i;if(0!==n)if("Object3D"!==t.type){var o;if("Mesh"===t.type?o=new(r(5672).V):"LineSegments"===t.type?o=new(r(8145).q):"Points"===t.type&&(o=new(r(770).t)),o){var l=!1,h=!1;t.geometry&&t.geometry.morphAttributes&&(l=!!t.geometry.morphAttributes.position,h=!!t.geometry.morphAttributes.color),o.setMesh(t.clone(),l,h);var c=o.getMorph();o.groupName=c.name,c.matrixAutoUpdate=!0,i.addZincObject(o),null!=a&&"function"==typeof a&&a(o)}}else if(""!==t.name&&(i&&(s=i.findOrCreateChildFromPath(t.name)),s)){var u=s.getGroup();u.position.copy(t.position),u.rotation.copy(t.rotation),u.quaternion.copy(t.quaternion),u.matrixAutoUpdate=!0}n++,t.children.forEach((t=>{e.parseGLTFObjects(t,s,n,a)}))},this.setCamera=e=>{e.viewAll();var t=e.getZincCameraControls(),r=t.getCurrentViewport();t.addViewport("default",r),t.setDefaultViewport("default")},this.load=(t,r,n,a,s)=>{var o=n.substring(0,n.lastIndexOf("/")+1),l=n.substring(n.lastIndexOf("/")+1,n.length);(new i).setPath(o).load(l,(function(i){console.log(i),e.parseGLTFObjects(i.scene,r,0,a),e.setCamera(t),null!=s&&"function"==typeof s&&s()}))}}},807:(e,t,r)=>{"use strict";r.d(t,{q:()=>v});var i=r(1515),n=r(1781).a,a=i.LoaderUtils,s=i.AnimationClip,o=i.Vector3,l=i.Vector4,h=i.Color,c=i.Vector2,u=r(8154).n,d=r(8154).V,p=i.FileLoader,m=i.DefaultLoadingManager,f=r(1574).i;function v(e){"boolean"==typeof e&&(console.warn("THREE.JSONLoader: showStatus parameter has been removed from constructor."),e=void 0),this.manager=void 0===e?m:e,this.withCredentials=!1,this.paramsString=""}Object.assign(v.prototype,{load:function(e,t,r,i){var n=this,s=this.texturePath&&"string"==typeof this.texturePath?this.texturePath:a.extractUrlBase(e),o=new p(this.manager);e.split("?"),this.paramsString=2===e.length?paramsStrings[1]:"",o.setWithCredentials(this.withCredentials),o.load(e,(function(r){var a;try{a=JSON.parse(r)}catch(t){if(console.error("The loader has encountered an error while parsing the content of a resource."),i)return void i({responseURL:e})}var o=a.metadata;if(void 0!==o){var l=o.type;if(void 0!==l&&"object"===l.toLowerCase())return void console.error("THREE.JSONLoader: "+e+" should be loaded with THREE.ObjectLoader instead.")}if(n&&n.parse)try{var h=n.parse(a,s);t(h.geometry,h.materials)}catch(t){if(console.error("The loader has encountered aon loading the geometry"),console.error(t),i)return void i({responseURL:e})}}),r,i)},setTexturePath:function(e){this.texturePath=e},parse:function(e,t){void 0!==e.data&&(e=e.data),e.scale=void 0===e.scale?1:1/e.scale;var r=new d;if(r.morphColors=[],function(e,t){function r(e,t){return e&1<<t}var i,n,a,s,l,d,p,m,f,v,g,y,x,b,w,_,M,S,T,E,A,L,R,C,P,I,O,D=e.faces,N=e.vertices,B=e.normals,U=e.colors,z=e.scale,F=0;if(void 0!==e.uvs){for(i=0;i<e.uvs.length;i++)e.uvs[i].length&&F++;for(i=0;i<F;i++)t.faceVertexUvs[i]=[]}for(s=0,l=N.length;s<l;)(S=new o).x=N[s++]*z,S.y=N[s++]*z,S.z=N[s++]*z,t.vertices.push(S);if(s=0,l=D.length,e.uvs)for(i=0;i<e.uvs.length;i++){t.uvs[i]=[];for(var G=0;G<e.uvs[i].length;G++)t.uvs[i][G]=e.uvs[i][G]}if(B)for(i=0;i<B.length;i++)t.normals[i]=B[i];if(U)for(i=0;i<U.length;i++)t.colors[i]=U[i];for(;s<l;)if(g=r(v=D[s++],0),y=r(v,1),x=r(v,3),b=r(v,4),w=r(v,5),_=r(v,6),M=r(v,7),g){if((E=new u).a=D[s],E.b=D[s+1],E.c=D[s+3],(A=new u).a=D[s+1],A.b=D[s+2],A.c=D[s+3],s+=4,y&&(f=D[s++],E.materialIndex=f,A.materialIndex=f),a=t.faces.length,x)for(i=0;i<F;i++)for(C=e.uvs[i],t.faceVertexUvs[i][a]=[],t.faceVertexUvs[i][a+1]=[],n=0;4>n;n++)I=C[2*(m=D[s++])],O=C[2*m+1],P=new c(I,O),2!==n&&t.faceVertexUvs[i][a].push(P),0!==n&&t.faceVertexUvs[i][a+1].push(P);if(b&&(p=3*D[s++],E.normal.set(B[p++],B[p++],B[p]),A.normal.copy(E.normal)),w)for(i=0;4>i;i++)p=3*D[s++],R=new o(B[p++],B[p++],B[p]),2!==i&&E.vertexNormals.push(R),0!==i&&A.vertexNormals.push(R);if(_&&(L=U[d=D[s++]],E.color.setHex(L),A.color.setHex(L)),M)for(i=0;4>i;i++)L=U[d=D[s++]],2!==i&&E.vertexColors.push(new h(L)),0!==i&&A.vertexColors.push(new h(L));t.faces.push(E),t.faces.push(A)}else{if((T=new u).a=D[s++],T.b=D[s++],T.c=D[s++],y&&(f=D[s++],T.materialIndex=f),a=t.faces.length,x)for(i=0;i<F;i++)for(C=e.uvs[i],t.faceVertexUvs[i][a]=[],n=0;3>n;n++)I=C[2*(m=D[s++])],O=C[2*m+1],P=new c(I,O),t.faceVertexUvs[i][a].push(P);if(b&&(p=3*D[s++],T.normal.set(B[p++],B[p++],B[p])),w)for(i=0;3>i;i++)p=3*D[s++],R=new o(B[p++],B[p++],B[p]),T.vertexNormals.push(R);if(_&&(d=D[s++],T.color.setHex(U[d])),M)for(i=0;3>i;i++)d=D[s++],T.vertexColors.push(new h(U[d]));t.faces.push(T)}}(e,r),function(e,t){var r=void 0===e.influencesPerVertex?2:e.influencesPerVertex;if(e.skinWeights)for(var i=0,n=e.skinWeights.length;i<n;i+=r){var a=e.skinWeights[i],s=1<r?e.skinWeights[i+1]:0,o=2<r?e.skinWeights[i+2]:0,h=3<r?e.skinWeights[i+3]:0;t.skinWeights.push(new l(a,s,o,h))}if(e.skinIndices)for(i=0,n=e.skinIndices.length;i<n;i+=r){var c=e.skinIndices[i],u=1<r?e.skinIndices[i+1]:0,d=2<r?e.skinIndices[i+2]:0,p=3<r?e.skinIndices[i+3]:0;t.skinIndices.push(new l(c,u,d,p))}t.bones=e.bones,t.bones&&0<t.bones.length&&(t.skinWeights.length!==t.skinIndices.length||t.skinIndices.length!==t.vertices.length)&&console.warn("When skinning, number of vertices ("+t.vertices.length+"), skinIndices ("+t.skinIndices.length+"), and skinWeights ("+t.skinWeights.length+") should match.")}(e,r),function(e,t){var r,n,a,s,l,h=e.scale;if(void 0!==e.morphTargets)for(var c=0,u=e.morphTargets.length;c<u;c++){t.morphTargets[c]={},t.morphTargets[c].name=e.morphTargets[c].name,t.morphTargets[c].vertices=[];for(var d,p=t.morphTargets[c].vertices,m=e.morphTargets[c].vertices,f=0,v=m.length;f<v;f+=3)(d=new o).x=m[f]*h,d.y=m[f+1]*h,d.z=m[f+2]*h,p.push(d)}if(void 0!==e.morphNormals)for(c=0,u=e.morphNormals.length;c<u;c++)if(t.morphTargets[c]){t.morphTargets[c].normals=[];var g,y=t.morphTargets[c].normals,x=e.morphNormals[c].normals;for(f=0,v=x.length;f<v;f+=3)(g=new o).x=x[f],g.y=x[f+1],g.z=x[f+2],y.push(g);t.morphNormalsReady=!0}if(void 0!==e.morphColors)for(c=0,u=e.morphColors.length;c<u;c++)for(t.morphColors[c]={},t.morphColors[c].name=e.morphColors[c].name,t.morphColors[c].colors=[],a=t.morphColors[c].colors,r=0,n=(s=e.morphColors[c].colors).length;r<n;r+=3)(l=new i.Color(16755200)).setRGB(s[r],s[r+1],s[r+2]),a.push(l)}(e,r),function(e,t){var r=[],i=[];void 0!==e.animation&&i.push(e.animation),void 0!==e.animations&&(e.animations.length?i=i.concat(e.animations):i.push(e.animations));for(var n,a=0;a<i.length;a++)(n=s.parseAnimation(i[a],t.bones))&&r.push(n);if(t.morphTargets){var o=s.CreateClipsFromMorphTargetSequences(t.morphTargets,10);r=r.concat(o)}0<r.length&&(t.animations=r)}(e,r),r.computeFaceNormals(),r.computeBoundingSphere(),void 0===e.materials||0===e.materials.length)return{geometry:r};var a=n.prototype.initMaterials(e.materials,t,"Anonymous");if(e.materials[0].video){var p=t+e.materials[0].video;this.paramsString&&(p+="?".concat(this.paramsString));var m=new f(p);r._video=m}return a&&0<a.length&&(a[0].side=e.materials[0].singleSided?i.FrontSide:e.materials[0].flipSided?i.BackSide:i.DoubleSide,e.materials[0].specularCoef&&(a[0].shininess=Math.floor(e.materials[0].specularCoef/3))),{geometry:r,materials:a}}})},654:(e,t,r)=>{"use strict";r.d(t,{L:()=>m});var i=r(1515),n=/^[og]\s*(.+)?/,a=/^mtllib /,s=/^usemtl /,o=/^usemap /,l=new i.Vector3,h=new i.Vector3,c=new i.Vector3,u=new i.Vector3,d=new i.Vector3;function p(){var e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);var r=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){var r=this._finalize(!1);r&&(r.inherited||0>=r.groupCount)&&this.materials.splice(r.index,1);var i={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&0<t.length?t[t.length-1]:"",smooth:void 0===r?this.smooth:r.smooth,groupStart:void 0===r?0:r.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){var t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(i),i},currentMaterial:function(){return 0<this.materials.length?this.materials[this.materials.length-1]:void 0},_finalize:function(e){var t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&1<this.materials.length)for(var r=this.materials.length-1;0<=r;r--)0>=this.materials[r].groupCount&&this.materials.splice(r,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},r&&r.name&&"function"==typeof r.clone){var i=r.clone(0);i.inherited=!0,this.object.materials.push(i)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){var r=parseInt(e,10);return 3*(0<=r?r-1:r+t/3)},parseNormalIndex:function(e,t){var r=parseInt(e,10);return 3*(0<=r?r-1:r+t/3)},parseUVIndex:function(e,t){var r=parseInt(e,10);return 2*(0<=r?r-1:r+t/2)},addVertex:function(e,t,r){var i=this.vertices,n=this.object.geometry.vertices;n.push(i[e+0],i[e+1],i[e+2]),n.push(i[t+0],i[t+1],i[t+2]),n.push(i[r+0],i[r+1],i[r+2])},addVertexPoint:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){var t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,r){var i=this.normals,n=this.object.geometry.normals;n.push(i[e+0],i[e+1],i[e+2]),n.push(i[t+0],i[t+1],i[t+2]),n.push(i[r+0],i[r+1],i[r+2])},addFaceNormal:function(e,t,r){var i=this.vertices,n=this.object.geometry.normals;l.fromArray(i,e),h.fromArray(i,t),c.fromArray(i,r),d.subVectors(c,h),u.subVectors(l,h),d.cross(u),d.normalize(),n.push(d.x,d.y,d.z),n.push(d.x,d.y,d.z),n.push(d.x,d.y,d.z)},addColor:function(e,t,r){var i=this.colors,n=this.object.geometry.colors;void 0!==i[e]&&n.push(i[e+0],i[e+1],i[e+2]),void 0!==i[t]&&n.push(i[t+0],i[t+1],i[t+2]),void 0!==i[r]&&n.push(i[r+0],i[r+1],i[r+2])},addUV:function(e,t,r){var i=this.uvs,n=this.object.geometry.uvs;n.push(i[e+0],i[e+1]),n.push(i[t+0],i[t+1]),n.push(i[r+0],i[r+1])},addDefaultUV:function(){var e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){var t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,r,i,n,a,s,o,l){var h=this.vertices.length,c=this.parseVertexIndex(e,h),u=this.parseVertexIndex(t,h),d=this.parseVertexIndex(r,h);if(this.addVertex(c,u,d),this.addColor(c,u,d),void 0!==s&&""!==s){var p=this.normals.length;c=this.parseNormalIndex(s,p),u=this.parseNormalIndex(o,p),d=this.parseNormalIndex(l,p),this.addNormal(c,u,d)}else this.addFaceNormal(c,u,d);if(void 0!==i&&""!==i){var m=this.uvs.length;c=this.parseUVIndex(i,m),u=this.parseUVIndex(n,m),d=this.parseUVIndex(a,m),this.addUV(c,u,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";for(var t,r=this.vertices.length,i=0,n=e.length;i<n;i++)t=this.parseVertexIndex(e[i],r),this.addVertexPoint(t),this.addColor(t)},addLineGeometry:function(e,t){this.object.geometry.type="Line";for(var r=this.vertices.length,i=this.uvs.length,n=0,a=e.length;n<a;n++)this.addVertexLine(this.parseVertexIndex(e[n],r));for(var s=0,o=t.length;s<o;s++)this.addUVLine(this.parseUVIndex(t[s],i))}};return e.startObject("",!1),e}class m extends i.Loader{constructor(e){super(e),this.materials=null}load(e,t,r,n){var a=this,s=new i.FileLoader(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(r){try{t(a.parse(r))}catch(t){n?n(t):console.error(t),a.manager.itemError(e)}}),r,n)}setMaterials(e){return this.materials=e,this}parse(e){var t=new p;-1!==e.indexOf("\r\n")&&(e=e.replace(/\r\n/g,"\n")),-1!==e.indexOf("\\\n")&&(e=e.replace(/\\\n/g,""));for(var r=e.split("\n"),l="",h="",c=[],u="function"==typeof"".trimLeft,d=0,m=r.length;d<m;d++)if(l=r[d],0!==(l=u?l.trimLeft():l.trim()).length&&"#"!==(h=l.charAt(0)))if("v"===h){var f=l.split(/\s+/);switch(f[0]){case"v":t.vertices.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),7<=f.length?t.colors.push(parseFloat(f[4]),parseFloat(f[5]),parseFloat(f[6])):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3]));break;case"vt":t.uvs.push(parseFloat(f[1]),parseFloat(f[2]))}}else if("f"===h){for(var v,g=l.substr(1).trim().split(/\s+/),y=[],x=0,b=g.length;x<b;x++)if(0<(v=g[x]).length){var w=v.split("/");y.push(w)}for(var _=y[0],M=1,S=y.length-1;M<S;M++){var T=y[M],E=y[M+1];t.addFace(_[0],T[0],E[0],_[1],T[1],E[1],_[2],T[2],E[2])}}else if("l"===h){var A=l.substring(1).trim().split(" "),L=[],R=[];if(-1===l.indexOf("/"))L=A;else for(var C,P=0,I=A.length;P<I;P++)""!==(C=A[P].split("/"))[0]&&L.push(C[0]),""!==C[1]&&R.push(C[1]);t.addLineGeometry(L,R)}else if("p"===h){var O=l.substr(1).trim().split(" ");t.addPointGeometry(O)}else if(null!==(c=n.exec(l))){var D=(" "+c[0].substr(1).trim()).substr(1);t.startObject(D)}else if(s.test(l))t.object.startMaterial(l.substring(7).trim(),t.materialLibraries);else if(a.test(l))t.materialLibraries.push(l.substring(7).trim());else if(o.test(l))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===h){if(1<(c=l.split(" ")).length){var N=c[1].trim().toLowerCase();t.object.smooth="0"!==N&&"off"!==N}else t.object.smooth=!0;var B=t.object.currentMaterial();B&&(B.smooth=t.object.smooth)}else{if("\0"===l)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+l+'"')}t.finalize();var U=new i.Group;if(U.materialLibraries=[].concat(t.materialLibraries),1==(1!==t.objects.length||0!==t.objects[0].geometry.vertices.length))for(var z=0,F=t.objects.length;z<F;z++){var G=t.objects[z],V=G.geometry,H=G.materials,k="Line"===V.type,j="Points"===V.type,W=!1;if(0!==V.vertices.length){var Z=new i.BufferGeometry;Z.setAttribute("position",new i.Float32BufferAttribute(V.vertices,3)),0<V.normals.length&&Z.setAttribute("normal",new i.Float32BufferAttribute(V.normals,3)),0<V.colors.length&&(W=!0,Z.setAttribute("color",new i.Float32BufferAttribute(V.colors,3))),!0===V.hasUVIndices&&Z.setAttribute("uv",new i.Float32BufferAttribute(V.uvs,2));for(var q=[],X=0,Y=H.length;X<Y;X++){var J=H[X],K=J.name+"_"+J.smooth+"_"+W,Q=t.materials[K];if(null!==this.materials)if(Q=this.materials.create(J.name),!k||!Q||Q instanceof i.LineBasicMaterial){if(j&&Q&&!(Q instanceof i.PointsMaterial)){var $=new i.PointsMaterial({size:10,sizeAttenuation:!1});i.Material.prototype.copy.call($,Q),$.color.copy(Q.color),$.map=Q.map,Q=$}}else{var ee=new i.LineBasicMaterial;i.Material.prototype.copy.call(ee,Q),ee.color.copy(Q.color),Q=ee}void 0===Q&&((Q=k?new i.LineBasicMaterial:j?new i.PointsMaterial({size:1,sizeAttenuation:!1}):new i.MeshPhongMaterial).name=J.name,Q.flatShading=!J.smooth,Q.vertexColors=W,t.materials[K]=Q),q.push(Q)}var te=void 0;if(1<q.length){for(var re,ie=0,ne=H.length;ie<ne;ie++)re=H[ie],Z.addGroup(re.groupStart,re.groupCount,ie);te=k?new i.LineSegments(Z,q):j?new i.Points(Z,q):new i.Mesh(Z,q)}else te=k?new i.LineSegments(Z,q[0]):j?new i.Points(Z,q[0]):new i.Mesh(Z,q[0]);te.name=G.name,U.add(te)}}else if(0<t.vertices.length){var ae=new i.PointsMaterial({size:1,sizeAttenuation:!1}),se=new i.BufferGeometry;se.setAttribute("position",new i.Float32BufferAttribute(t.vertices,3)),0<t.colors.length&&void 0!==t.colors[0]&&(se.setAttribute("color",new i.Float32BufferAttribute(t.colors,3)),ae.vertexColors=!0);var oe=new i.Points(se,ae);U.add(oe)}return U}}},7270:(e,t,r)=>{"use strict";r.d(t,{t:()=>n});var i=r(1515);class n extends i.Loader{constructor(e){super(e)}load(e,t,r,n){var a=this,s=new i.FileLoader(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(r){try{t(a.parse(r))}catch(t){n?n(t):console.error(t),a.manager.itemError(e)}}),r,n)}parse(e){function t(e,t,r){for(var i=0,n=e.length;i<n;i++)if(e[i]!==t.getUint8(r+i,!1))return!1;return!0}var r,n=function(e){if("string"==typeof e){for(var t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=255&e.charCodeAt(r);return t.buffer||t}return e}(e);return function(e){var r=new DataView(e);if(84+50*r.getUint32(80,!0)===r.byteLength)return!0;for(var i=[115,111,108,105,100],n=0;5>n;n++)if(t(i,r,n))return!1;return!0}(n)?function(e){for(var t,r,n,a,s,o,l,h,c=new DataView(e),u=c.getUint32(80,!0),d=!1,p=0;p<70;p++)1129270351==c.getUint32(p,!1)&&82==c.getUint8(p+4)&&61==c.getUint8(p+5)&&(d=!0,a=new Float32Array(3*u*3),s=c.getUint8(p+6)/255,o=c.getUint8(p+7)/255,l=c.getUint8(p+8)/255,h=c.getUint8(p+9)/255);for(var m=new i.BufferGeometry,f=new Float32Array(3*u*3),v=new Float32Array(3*u*3),g=0;g<u;g++){var y=84+50*g,x=c.getFloat32(y,!0),b=c.getFloat32(y+4,!0),w=c.getFloat32(y+8,!0);if(d){var _=c.getUint16(y+48,!0);0==(32768&_)?(t=(31&_)/31,r=(31&_>>5)/31,n=(31&_>>10)/31):(t=s,r=o,n=l)}for(var M=1;3>=M;M++){var S=y+12*M,T=3*g*3+3*(M-1);f[T]=c.getFloat32(S,!0),f[T+1]=c.getFloat32(S+4,!0),f[T+2]=c.getFloat32(S+8,!0),v[T]=x,v[T+1]=b,v[T+2]=w,d&&(a[T]=t,a[T+1]=r,a[T+2]=n)}}return m.setAttribute("position",new i.BufferAttribute(f,3)),m.setAttribute("normal",new i.BufferAttribute(v,3)),d&&(m.setAttribute("color",new i.BufferAttribute(a,3)),m.hasColors=!0,m.alpha=h),m}(n):function(e){for(var t,r=new i.BufferGeometry,n=/solid([\s\S]*?)endsolid/g,a=/facet([\s\S]*?)endfacet/g,s=0,o=/[\s]+([+-]?(?:\d*)(?:\.\d*)?(?:[eE][+-]?\d+)?)/.source,l=new RegExp("vertex"+o+o+o,"g"),h=new RegExp("normal"+o+o+o,"g"),c=[],u=[],d=new i.Vector3,p=0,m=0,f=0;null!==(t=n.exec(e));){m=f;for(var v=t[0];null!==(t=a.exec(v));){for(var g=0,y=0,x=t[0];null!==(t=h.exec(x));)d.x=parseFloat(t[1]),d.y=parseFloat(t[2]),d.z=parseFloat(t[3]),y++;for(;null!==(t=l.exec(x));)c.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])),u.push(d.x,d.y,d.z),g++,f++;1!==y&&console.error("THREE.STLLoader: Something isn't right with the normal of face number "+s),3!==g&&console.error("THREE.STLLoader: Something isn't right with the vertices of face number "+s),s++}var b=m,w=f-m;r.addGroup(b,w,p),p++}return r.setAttribute("position",new i.Float32BufferAttribute(c,3)),r.setAttribute("normal",new i.Float32BufferAttribute(u,3)),r}("string"==typeof(r=e)?r:i.LoaderUtils.decodeText(new Uint8Array(r)))}}},1915:(e,t,r)=>{function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function n(e){for(var t,r=1;r<arguments.length;r++)t=null==arguments[r]?{}:arguments[r],r%2?i(Object(t),!0).forEach((function(r){var i,n,a;i=e,n=r,a=t[r],n=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(n),n in i?Object.defineProperty(i,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[n]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}));return e}var a=r(807).q,s=r(1515).FileLoader,o=function(e,t,r){var i=new s,n=new a;i.crossOrigin=t;var o=e,l=r,h=void 0,c=!1,u=!1,d=void 0,p=[],m=e=>{var t=h[e.index];if(t){var r=n.parse(t);e.onLoad(r.geometry,r.materials)}else f(e,{responseURL:o})},f=e=>{e.onError&&(!d&&(d={responseURL:o}),e.onError(d))};this.downloadCompleted=e=>{try{h=JSON.parse(e[0]),c=!1,u=!0,Array.isArray(h)?p.forEach((e=>m(e))):p.forEach((e=>f(e)))}catch(e){p.forEach((e=>f(e)))}};var v=()=>e=>{d=e,u=!0,c=!1,p.forEach((e=>{f(e)}))},g=()=>e=>{p.forEach((t=>{t.onProgress&&t.onProgress(e)}))};this.load=(e,t,r,n)=>{var a={index:e,onLoad:t,onProgress:r,onError:n};u?h?m(a):f(d):c?p.push(a):(p.push(a),c=!0,i.load(o,l,g,v))}},l=function(e,t){var r=[],i=e,n=t,a=0;this.itemDownloaded=(e,t)=>{if(r[e]=t,++a==i){for(var s=r[0][1],o=(e=>{var t=(e,t)=>{e.merge(t)};if(e&&0<e.length){for(;1<e.length;){var r=e.splice(1,1);t(e[0],r[0])}return e[0]}})(r.map((e=>e[0]))),l=1;l<i;l++)r[e][0].dispose(),r[e][1].forEach((e=>e.dispose()));n(o,s)}}};t._=function(){var e=0;this.crossOrigin="Anonymous";var t=new a,r=[],i={},s=(t,a,s,l,h)=>{var u=h?n({},h):{},d=i[t];if(!d)if(20>e){var p=new c(void 0,this,u);++e,d=new o(t,this.crossOrigin,p),i[t]=d}else r.push({url:t,onLoad:a,onProgress:s,onError:l,options:h});d&&(u.isHandler=d,d.load(h.index,a,s,l))},h=(i,n,a,o,l)=>{if(l&&void 0!==l.index)s(i,n,a,o,l);else if(20>e){++e;var h=new c(n,this,l),u=new c(o,this,l);t.crossOrigin=this.crossOrigin,t.load(i,h,a,u)}else r.push({url:i,onLoad:n,onProgress:a,onError:o,options:l})};this.load=(e,t,r,i,a)=>{Array.isArray(e)?((e,t,r,i,a)=>{var s=e.length,o=new l(s,t),c=0;e.forEach((e=>{var s=a?n({},a):{};s.msHandler=o,s.order=c,c++,h(e,t,r,i,s)}))})(e,t,r,i,a):h(e,t,r,i,a)},this.loadFromWaitingList=()=>{for(;20>e;){var t=r.shift();if(!t)return;this.load(t.url,t.onLoad,t.onProgress,t.onError,t.options)}},this.itemRemainingCheck=()=>{if(0===r.length&&0==e)for(var t in i)i.hasOwnProperty(t)&&delete i[t]};var c=function(t,r,i){return function(){--e;for(var n=arguments.length,a=Array(n),s=0;s<n;s++)a[s]=arguments[s];null!=i&&i.msHandler?i.msHandler.itemDownloaded(i.order,a):null!=i&&i.isHandler?i.isHandler.downloadCompleted(a):t&&t(...a),r.loadFromWaitingList(),r.itemRemainingCheck()}};this.parse=e=>t.parse(e)}},7404:(e,t,r)=>{var i=r(1515);t.U=function(e){var t=e;this.camera=new i.OrthographicCamera(-.5,.5,.5,-.5,.01,10),this.helper=void 0;var r=new i.BufferGeometry,n=new Float32Array([-1,-1,1,1,-1,1,1,1,1,1,1,1,-1,1,1,-1,-1,1]),a=new i.BufferAttribute(n,3);r.setAttribute("position",a);var s=new i.MeshBasicMaterial({color:3355443,depthTest:!1,depthWrite:!1,opacity:.5,transparent:!0});this.mask=new i.Mesh(r,s);var o=new i.Box3,l=new i.Vector3;this.getDiffFromNormalised=(e,t)=>{o.setFromBufferAttribute(a).getCenter(l);var r=l.clone().project(this.camera);return new i.Vector3(e,t,r.z).unproject(this.camera).sub(l)};var h=(e,r)=>{t.camera.near&&(this.camera.near=t.camera.near),r.farPlane&&(this.camera.far=r.farPlane),r.eyePosition&&this.camera.position.set(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),r.upVector&&this.camera.up.set(r.upVector[0],r.upVector[1],r.upVector[2]),r.targetPosition&&this.camera.lookAt(new i.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2])),this.camera.zoom=1/e,this.camera.updateProjectionMatrix()};this.getBoundary=()=>{var e=(new i.Vector3).copy(t.camera.target).project(t.camera),r=new i.Vector3(-1,-1,e.z).unproject(t.camera),n=new i.Vector3(1,-1,e.z).unproject(t.camera),s=new i.Vector3(1,1,e.z).unproject(t.camera),o=new i.Vector3(-1,1,e.z).unproject(t.camera);a.copyVector3sArray([r,n,s,s,o,r]),a.needsUpdate=!0},this.updateCamera=()=>{this.getBoundary();var e=t.getZincCameraControls(),r=t.getBoundingBox();if(r){var i=r.min.distanceTo(r.max),n=i/2,a=(r.min.x+r.max.x)/2,s=(r.min.y+r.max.y)/2,o=(r.min.z+r.max.z)/2,l=e.getViewportFromCentreAndRadius(a,s,o,n,40,4*n);h(i,l)}}}},9960:(e,t)=>{t.augmentMorphColor=function(){return function(e){e.vertexShader=e.vertexShader.replace("#include <color_pars_vertex>",["varying vec3 vColor;","attribute vec3 morphColor0;","attribute vec3 morphColor1;"].join("\n")),e.vertexShader=e.vertexShader.replace("#include <color_vertex>",["vColor.xyz = color.xyz;","#ifdef USE_MORPHTARGETS","vColor = morphColor0 * morphTargetInfluences[ 0 ];","vColor += morphColor1 * morphTargetInfluences[ 1 ];","#endif"].join("\n"))}}},5672:function(e,t,r){var i=r(1515),n=r(2515).toBufferGeometry,a=function(){r(7393).c.call(this),this.videoHandler=void 0,this.isGeometry=!0,this.createMesh=(e,t,a)=>{if(!this.morph||!this.morph.geometry||null==e){var s=((e,t,a)=>{var s,o=n(e,a),l=!1;if(1>a.opacity&&(l=!0),void 0===o._video){var h=a.localTimeEnabled||a.localMorphColour;t?((s=t).morphTargets=h,s.morphNormals=a.localTimeEnabled):s=o instanceof i.BufferGeometry&&void 0===o.attributes.color?new i.MeshPhongMaterial({color:a.colour,morphTargets:h,morphNormals:a.localTimeEnabled,transparent:l,opacity:a.opacity,side:i.DoubleSide}):new i.MeshPhongMaterial({color:a.colour,morphTargets:h,morphNormals:a.localTimeEnabled,vertexColors:i.VertexColors,transparent:l,opacity:a.opacity,side:i.DoubleSide}),a.localMorphColour&&o.morphAttributes.color&&(s.onBeforeCompile=r(9960).augmentMorphColor())}else{var c=o._video.createCanvasVideoTexture();s=new i.MeshBasicMaterial({morphTargets:a.localTimeEnabled,color:new i.Color(1,1,1),transparent:l,opacity:a.opacity,map:c,side:i.DoubleSide}),o._video}return new i.Mesh(o,s)})(e,t,a);this.setMesh(s,a.localTimeEnabled,a.localMorphColour)}},this.calculateUVs=()=>{this.geometry.computeBoundingBox();var e=this.geometry.boundingBox.max,t=this.geometry.boundingBox.min,r=new i.Vector2(0-t.x,0-t.y),n=new i.Vector2(e.x-t.x,e.y-t.y);this.geometry.faceVertexUvs[0]=[];for(var a=0;a<this.geometry.faces.length;a++){var s=this.geometry.vertices[this.geometry.faces[a].a],o=this.geometry.vertices[this.geometry.faces[a].b],l=this.geometry.vertices[this.geometry.faces[a].c];geometry.faceVertexUvs[0].push([new i.Vector2((s.x+r.x)/n.x,(s.y+r.y)/n.y),new i.Vector2((o.x+r.x)/n.x,(o.y+r.y)/n.y),new i.Vector2((l.x+r.x)/n.x,(l.y+r.y)/n.y)])}geometry.uvsNeedUpdate=!0},this.checkTransparentMesh=function(){this._lod.checkTransparentMesh()},this.setWireframe=e=>{this.morph.material.wireframe=e},this.editVertices=function(e,t){if(e&&e.length){var r=this.getMorph(),i=r.geometry.getAttribute("position");if(!r||0>t)return;var n=3*t;e.forEach((e=>{i.array[n++]=e[0],i.array[n++]=e[1],i.array[n++]=e[2]})),i.needsUpdate=!0,r.geometry.computeBoundingBox(),r.geometry.computeBoundingSphere(),this.boundingBoxUpdateRequired=!0}}};a.prototype=Object.create(r(7393).c.prototype),t.V=a},9344:(e,t,r)=>{var i=r(1515),n=function(e,t,n,a){var s;r(7393).c.call(this),t&&((s=t.clone()).vertexColors=i.FaceColors),this.id=n;var o=void 0,l=void 0;this.isGlyph=!0;var h=[0,0,0];this.fromMesh=e=>!(!e||!e.isMesh||(this.morph=e.clone(),this.morph.userData=this,this.group.add(this.morph),0)),e&&s&&this.fromMesh(new i.Mesh(e,s)),this.getGlyphset=function(){return a},this.setLabel=e=>{e&&("string"==typeof e||e instanceof String)&&(l=e,this.morph&&(this.morph.name=e))},this.showLabel=e=>{o&&(h=o.getPosition(),this.group.remove(o.getSprite()),o.dispose(),o=void 0),l&&("string"==typeof l||l instanceof String)&&((o=new(r(4296).J)(l,e)).setPosition(h[0],h[1],h[2]),this.group.add(o.getSprite()))},this.hideLabel=()=>{o&&(h=o.getPosition(),this.group.remove(o.getSprite()),o.dispose(),o=void 0)},this.getLabel=()=>l,this.getMesh=()=>this.morph,this.setTransformation=(e,t,r,i)=>{this.morph&&(this.morph.matrix.elements[0]=t[0],this.morph.matrix.elements[1]=t[1],this.morph.matrix.elements[2]=t[2],this.morph.matrix.elements[3]=0,this.morph.matrix.elements[4]=r[0],this.morph.matrix.elements[5]=r[1],this.morph.matrix.elements[6]=r[2],this.morph.matrix.elements[7]=0,this.morph.matrix.elements[8]=i[0],this.morph.matrix.elements[9]=i[1],this.morph.matrix.elements[10]=i[2],this.morph.matrix.elements[11]=0,this.morph.matrix.elements[12]=e[0],this.morph.matrix.elements[13]=e[1],this.morph.matrix.elements[14]=e[2],this.morph.matrix.elements[15]=1,this.morph.matrixAutoUpdate=!1),h=[...e],o&&o.setPosition(e[0],e[1],e[2])},this.setColour=e=>{o&&o.setColour(e),this.secondaryMesh&&this.secondaryMesh.material&&(this.secondaryMesh.material.color=colour),this.geometry&&(this.geometry.colorsNeedUpdate=!0)},this.dispose=()=>{this.material&&this.material.dispose(),this.morph=void 0}};n.prototype=Object.create(r(7393).c.prototype),t.z=n},2842:(e,t,r)=>{var i=r(1515),n=r(807).q,a=function(){r(7393).c.call(this);var e=[],t=void 0,a=void 0,s=void 0,o=void 0,l=void 0,h=void 0,c=void 0,u=0,d=0,p=[0,0,0],m=[0,0,0],f=[0,0,0],v="NONE";this.ready=!1;var g=!1,y=!1;this.isGlyphset=!0;var x=new i.Matrix4,b=new i.Color,w=new i.Color,_=new i.Box3,M=new i.Box3,S=new i.Box3,T=[],E=[],A=[],L=[],R=[],C=[],P=[],I=[];this.globalScale=1;for(var O=0;8>O;O++)T[O]=new i.Vector3;this.load=(e,r,x,b,w)=>{t=e.axis1,a=e.axis2,s=e.axis3,o=e.positions,l=e.scale,h=e.colors,c=e.label,g=e.metadata.MorphColours,y=e.metadata.MorphVertices,u=e.metadata.number_of_time_steps,v=e.metadata.repeat_mode,d=e.metadata.number_of_vertices,"AXES_2D"==v||"MIRROR"==v?d*=2:"AXES_3D"==v&&(d*=3),p=e.metadata.base_size,m=e.metadata.offset,f=e.metadata.scale_factors;var _=new n;this.geometry=new i.BufferGeometry;var M=new i.InstancedMesh(this.geometry,void 0,d);if(this.setMorph(M),b){var S=_.parse(r);F(x,w)(S.geometry,S.materials),S.geometry.dispose()}else _.crossOrigin="Anonymous",_.load(r,F(x,w))};var D=(e,t,r,i,n,a)=>{if("NONE"==v||"MIRROR"==v){for(var s=[0,0,0],o=[0,0,0],l=[0,0,0],h=[0,0,0],c=[0,0,0],u=[0,0,0],d=[0,0,0],g=[0,0,0],y=[0,0,0],x=0;3>x;x++)b=0>n[x]?-1:1,s[x]=(b*p[x]+n[x]*f[x])*this.globalScale;for(x=0;3>x;x++)o[x]=t[x]*s[0],l[x]=r[x]*s[1],h[x]=i[x]*s[2],c[x]=e[x]+m[0]*o[x]+m[1]*l[x]+m[2]*h[x],"MIRROR"==v&&(u[x]=-o[x],d[x]=-l[x],g[x]=-h[x],y[x]=c[x],0>n[0]&&(c[x]-=o[x],y[x]-=u[x]));0>h[0]*(o[1]*l[2]-o[2]*l[1])+h[1]*(o[2]*l[0]-o[0]*l[2])+h[2]*(o[0]*l[1]-o[1]*l[0])&&(h[0]=-h[0],h[1]=-h[1],h[2]=-h[2]),a[0]=[c,o,l,h],"MIRROR"==v&&(0>g[0]*(u[1]*d[2]-u[2]*d[1])+g[1]*(u[2]*d[0]-u[0]*d[2])+g[2]*(u[0]*d[1]-u[1]*d[0])&&(g[0]=-g[0],g[1]=-g[1],g[2]=-g[2]),a[1]=[y,u,d,g])}else if("AXES_2D"==v||"AXES_3D"==v){var b,w=[0,0,0],_=[0,0,0];for(x=0;3>x;x++)b=0>n[x]?-1:1,w[x]=(b*p[0]+n[x]*f[0])*this.globalScale;for(x=0;3>x;x++)_[x]=e[x]+m[0]*w[0]*t[x]+m[1]*w[1]*r[x]+m[2]*w[2]*i[x];for(var M="AXES_2D"==glyph_repeat_mode?2:3,S=0;S<M;S++){var T=void 0,E=void 0,A=n[S],L=[0,0,0],R=[0,0,0],C=[0,0,0];0==S?(T=t,E=r):1==S?(T=r,E="AXES_2D"==glyph_repeat_mode?t:i):(T=i,E=t);var P=(p[0]+A*f[0])*this.globalScale;L[0]=T[0]*P,L[1]=T[1]*P,L[2]=T[2]*P,C[0]=L[1]*E[2]-E[1]*L[2],C[1]=L[2]*E[0]-E[2]*L[0],C[2]=L[0]*E[1]-L[1]*E[0];var I=Math.sqrt(C[0]*C[0]+C[1]*C[1]+C[2]*C[2]);if(0<I){var O=(p[2]+A*f[2])*this.globalScale/I;"AXES_2D"==v&&0<S&&(O*=-1),C[0]*=O,C[1]*=O,C[2]*=O}if(R[0]=C[1]*L[2]-L[1]*C[2],R[1]=C[2]*L[0]-L[2]*C[0],R[2]=C[0]*L[1]-C[1]*L[0],0<(I=Math.sqrt(R[0]*R[0]+R[1]*R[1]+R[2]*R[2]))){var D=(p[1]+A*f[1])*this.globalScale/I;R[0]*=D,R[1]*=D,R[2]*=D}a[S]=[_,L,R,C]}}return a},N=(t,r,i,n,a)=>{var s=1;"AXES_2D"==v||"MIRROR"==v?s=2:"AXES_3D"==v&&(s=3);var o=t.length/3,l=0;I.length=s;for(var h=0;h<o;h++){var c=3*h,u=[t[c],t[c+1],t[c+2]],d=[r[c],r[c+1],r[c+2]],p=[i[c],i[c+1],i[c+2]],m=[n[c],n[c+1],n[c+2]],f=[a[c],a[c+1],a[c+2]],g=D(u,d,p,m,f,I);if(g.length==s)for(var y=0;y<s;y++){x.elements[0]=g[y][1][0],x.elements[1]=g[y][1][1],x.elements[2]=g[y][1][2],x.elements[3]=0,x.elements[4]=g[y][2][0],x.elements[5]=g[y][2][1],x.elements[6]=g[y][2][2],x.elements[7]=0,x.elements[8]=g[y][3][0],x.elements[9]=g[y][3][1],x.elements[10]=g[y][3][2],x.elements[11]=0,x.elements[12]=g[y][0][0],x.elements[13]=g[y][0][1],x.elements[14]=g[y][0][2],x.elements[15]=1,this.morph.setMatrixAt(l,x);var b=e[l];b&&b.setTransformation(g[y][0],g[y][1],g[y][2],g[y][3]),l++}}this.morph.instanceMatrix.needsUpdate=!0},B=t=>{var r=1;"AXES_2D"==v||"MIRROR"==v?r=2:"AXES_3D"==v&&(r=3);for(var i,n=t.length,a=0,s=0;s<n;s++){i=t[s];for(var o=0;o<r;o++){b.setHex(i),this.morph.setColorAt(a,b);var l=e[a];l&&l.setColour(b),a++}}this.morph.instanceColor.needsUpdate=!0},U=()=>{var e=E,r=A,i=L,n=R,c=C,d=P,p=this.inbuildTime/this.duration*(u-1),m=Math.floor(p),f=1-(p-m),v=Math.ceil(p);if(y){var x=o[m.toString()],_=o[v.toString()],M=t[m.toString()],S=t[v.toString()],T=a[m.toString()],I=a[v.toString()],O=s[m.toString()],D=s[v.toString()],U=l[m.toString()],z=l[v.toString()];E.length=x.length,A.length=x.length,L.length=x.length,R.length=x.length,C.length=x.length;for(var F=0;F<x.length;F++)e[F]=f*x[F]+(1-f)*_[F],r[F]=f*M[F]+(1-f)*S[F],i[F]=f*T[F]+(1-f)*I[F],n[F]=f*O[F]+(1-f)*D[F],c[F]=f*U[F]+(1-f)*z[F]}else e=o[0],r=t[0],i=a[0],n=s[0],c=l[0];if(N(e,r,i,n,c),this.boundingBoxUpdateRequired=!0,null!=h){if(g){var G=h[m.toString()],V=h[v.toString()];d.length=G.length;for(var H=0;H<G.length;H++)b.setHex(G[H]),w.setHex(V[H]),b.setRGB(b.r*f+w.r*(1-f),b.g*f+w.g*(1-f),b.b*f+w.b*(1-f)),d[H]=b.getHex()}else d=h[0];B(d)}};this.showLabel=()=>{for(var t=0;t<e.length;t++)e[t].showLabel(this.morph.material?this.morph.material.color:void 0)},this.hideLabel=()=>{for(var t=0;t<e.length;t++)e[t].hideLabel()};var z=i=>{for(var n=0;n<d;n++){var p=new(r(9344).z)(void 0,void 0,n,this),m=c?c[n]:void 0;(m=m||this.groupName)&&p.setLabel(m),0<u&&p.setFrustumCulled(!1),e[n]=p,this.morph.add(p.getGroup())}i&&this.showLabel(),N(o[0],t[0],a[0],s[0],l[0]),null!=h&&B(h[0]),this.ready=!0,this.boundingBoxUpdateRequired=!0};this.addCustomGlyph=t=>{t.isGlyph&&e.push(t),this.ready=!0,this.boundingBoxUpdateRequired=!0},this.addMeshAsGlyph=(t,i)=>{if(t.isMesh){var n=new(r(9344).z)(void 0,void 0,i,this);return n.fromMesh(t),e.push(n),this.morph.add(n.getGroup()),this.ready=!0,this.boundingBoxUpdateRequired=!0,n}},this.forEachGlyph=t=>{for(var r=0;r<e.length;r++)t(e[r])};var F=(e,t)=>(r,i)=>{var n=r.toBufferGeometry();this.geometry.copy(n),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox(),n.dispose(),i&&i[0]&&(this.morph.material=i[0]),z(t),this.morph.name=this.groupName,this.morph.userData=this,this.setMorph(this.morph),r.dispose(),null!=e&&"function"==typeof e&&e(this)};this.getClosestVertexIndex=function(){var e=-1;if(this.morph&&this.ready){this.getBoundingBox().getCenter(this._v1);for(var t,r=o[0],i=r.length/3,n=-1,a=0,s=0;s<i;s++)t=3*s,this._v2.set(r[t],r[t+1],r[t+2]),a=this._v1.distanceTo(this._v2),(-1==n||n>a)&&(n=a,e=s)}return e},this.getClosestVertex=function(){if(-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex()),0<=this.closestVertexIndex&&this.morph){var e=new i.Vector3;return this.morph.getMatrixAt(this.closestVertexIndex,x),e.setFromMatrixPosition(x),e}},this.getBoundingBox=()=>{if(this.morph&&this.ready&&this.morph.visible){if(this.boundingBoxUpdateRequired){_.setFromBufferAttribute(this.morph.geometry.attributes.position);for(var e=0;e<d;e++)this.morph.getMatrixAt(e,x),M.copy(_).applyMatrix4(x),0==e?S.copy(M):S.union(M);if(!S)return;this.cachedBoundingBox.copy(S),this.morph.updateWorldMatrix(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox}},this.setMorphTime=e=>{this.inbuildTime=e>this.duration?this.duration:0>e?0:e,(g||y)&&(U(),y&&(this.markerUpdateRequired=!0))},this.isTimeVarying=()=>!(!(!1===this.ready||0<u)||!g&&!y),this.getCurrentTime=()=>this.inbuildTime,this.setScaleAll=function(e){this.globalScale=e,U()},this.dispose=()=>{for(var r=e.length-1;0<=r;r--)e[r].dispose();this.geometry&&this.geometry.dispose(),this.morph&&this.morph.material.dispose(),t=void 0,a=void 0,s=void 0,o=void 0,l=void 0,h=void 0,this.ready=!1,this.groupName=void 0},this.render=(e,t,r)=>{if(1==t){var i=this.inbuildTime+e;i>this.duration&&(i-=this.duration),this.inbuildTime=i,(g||y)&&U()}this.updateMarker(t,r)}};a.prototype=Object.create(r(7393).c.prototype),t.V=a},4296:(e,t,r)=>{var i=r(8221).A;t.J=function(e,t){var r=e,n=void 0;(n=t?new i(r,.015,t.getStyle()):new i(r,.015)).fontFace="Asap",n.fontWeight=700,n.material.map.generateMipmaps=!1,n.material.sizeAttenuation=!1,n.center.x=-.05,n.center.y=0,this.getPosition=()=>n?[n.position.x,n.position.y,n.position.z]:[0,0,0],this.setPosition=(e,t,r)=>{n&&n.position.set(e,t,r)},this.setColour=e=>{n.color=e.getStyle()},this.setScale=e=>{n&&0<e&&n.scale.set(e,e,1)},this.dispose=()=>{},this.getSprite=()=>n,this.getString=()=>r}},8145:(e,t,r)=>{var i=r(1515),n=r(2515).toBufferGeometry,a=function(){r(7393).c.call(this),this.isLines=!0,this.createLineSegment=(e,t,i)=>{if(e&&t){var a=n(e,i);i.localMorphColour&&a.morphAttributes.color&&(t.onBeforeCompile=r(9960).augmentMorphColor());var s=new(r(1491).D)(a,t);this.setMesh(s,i.localTimeEnabled,i.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addLines=(e,t)=>{if(e&&0<e.length){var r=this.addVertices(e);if(!this.getMorph()){var n=new i.LineBasicMaterial({color:t});r.colorsNeedUpdate=!0,this.createLineSegment(r,n,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}}};a.prototype=Object.create(r(7393).c.prototype),t.q=a},7931:(e,t,r)=>{r(1515),r(2515).toBufferGeometry;var i=r(8233).b,n=r(9236).G,a=r(5807).n,s=function(){r(8145).q.call(this),this.isLines2=!0;var e=Array(300);this.createLineSegment=(e,t,r)=>{if(e&&t){var n=new a;n.setPositions(e),n.colorsNeedUpdate=!0;var s=new i(n,t);s.scale.set(1,1,1),s.computeLineDistances(),this.setMesh(s,r.localTimeEnabled,r.localMorphColour)}},this.setWidth=e=>{this.morph&&this.morph.material&&(this.morph.material.linewidth=e,this.morph.material.needsUpdate=!0)},this.addVertices=function(t){if(t&&t.length){var r=this.getMorph();r||(this.drawRange=0);var i=3*this.drawRange;if(t.forEach((t=>{e[i++]=t[0],e[i++]=t[1],e[i++]=t[2],this.drawRange++})),!r)for(;300>i;)e[i++]=t[0][0],e[i++]=t[0][1],e[i++]=t[0][2];r&&(r.geometry.setPositions(e),r.computeLineDistances(),this.boundingBoxUpdateRequired=!0)}return e},this.getVerticesByFaceIndex=function(e){var t=2*e*3,r=this.getMorph();if(r&&3*this.drawRange>t){var i=r.geometry.getAttribute("instanceStart");return[[i.data.array[t],i.data.array[++t],i.data.array[++t]],[i.data.array[++t],i.data.array[++t],i.data.array[++t]]]}return[]},this.editVertices=function(t,r){if(t&&t.length){var i=this.getMorph(),n=r+t.length-1;if(!i||0>r||n>=this.drawRange)return;var a=3*r;for(t.forEach((t=>{e[a++]=t[0],e[a++]=t[1],e[a++]=t[2]})),a=3*this.drawRange;300>a;)e[a++]=t[0][0],e[a++]=t[0][1],e[a++]=t[0][2];i.geometry.setPositions(e),i.computeLineDistances(),this.boundingBoxUpdateRequired=!0}return e},this.addLines=(t,r)=>{if(t&&0<t.length){if(this.addVertices(t),!this.getMorph()){var i=new n({color:r,linewidth:1,vertexColors:!1,worldUnits:!1});i.resolution.set(window.innerWidth,window.innerHeight),this.createLineSegment(e,i,{localTimeEnabled:!1,localMorphColour:!1})}this.region&&(this.region.pickableUpdateRequired=!0)}},this.render=()=>{this.getMorph().material.resolution.set(window.innerWidth,window.innerHeight)}};(s.prototype=Object.create(r(8145).q.prototype)).constructor=s,t.s=s},9801:(e,t,r)=>{var i=r(1515),n=r(2515).updateMorphColorAttribute,a=r(2515).toBufferGeometry;t.U=function(e){this.levels=[],this._currentLevel=0,this._renderOrder=1,this._material=void 0,this._secondaryMaterial=void 0,this._loader=void 0,this._parent=e,this.addLevel=(e,t)=>{if(e){var r,i=Math.abs(t);for(r=0;r<this.levels.length&&!(i<this.levels[r].distance);r++);this.levels.splice(r,0,{distance:i,morph:e,loaded:!0,loading:!1,url:""}),e.renderOrder=this._renderOrder}},this.levelLoaded=(e,t)=>{if(e){for(var r=Math.abs(t),i=0;i<this.levels.length;i++)if(r===this.levels[i].distance){this._parent.group.add(e),this.levels[i].morph=e,this.levels[i].loaded=!0,this.levels[i].loading=!1;break}this.checkTransparentMesh()}},this.addLevelFromURL=(e,t,r,i,n)=>{this._loader=e;var a,s=this.calculateDistance(t);for(a=0;a<this.levels.length&&!(s<this.levels[a].distance);a++);this.levels.splice(a,0,{distance:s,morph:void 0,loaded:!1,loading:!1,url:r,index:i}),n&&this.loadLevel(a)},this.loadLevel=e=>{var t=this.levels[e];return t.morph||t.loaded||t.loading||(t.loading=!0,this._loader.load(t.url,this.lodLoader(t.distance),void 0,void 0,{index:t.index})),void 0===t.morph},this.calculateDistance=function(e){this._parent.getBoundingBox();var t=this._parent.radius,r=0;return"far"===e?r=4.5*t:"medium"===e?r=2.5*t:"close"==e&&(r=0),r},this.containsLevels=()=>!!(this.levels&&1<this.levels.length),this.checkTransparentMesh=()=>{var e=this.levels[this._currentLevel];this._material&&(this._material.transparent?(!this._secondaryMaterial&&(this._secondaryMaterial=this._material.clone(),this._secondaryMaterial.side=i.FrontSide),this._secondaryMaterial.opacity=this._material.opacity,this._secondaryMaterial.emissive&&this._secondaryMaterial.emissive.copy(this._material.emissive),this._secondaryMaterial.needsUpdate=!0,!e.secondaryMesh&&(e.secondaryMesh=new i.Mesh(e.morph.geometry,this._secondaryMaterial),e.secondaryMesh.renderOrder=e.morph.renderOrder+1,e.secondaryMesh.userData=e.morph.userData,e.secondaryMesh.name=e.morph.name),this._material.side=i.BackSide,this._material.needsUpdate=!0,!e.secondaryMesh.parent&&(e.morph.add(e.secondaryMesh),this._parent.animationGroup&&this._parent.animationGroup.add(e.secondaryMesh))):(e.secondaryMesh&&(e.morph.remove(e.secondaryMesh),this._parent.animationGroup&&(this._parent.animationGroup.uncache(e.secondaryMesh),this._parent.animationGroup.remove(e.secondaryMesh))),this._material.side=i.DoubleSide,this._material.needsUpdate=!0))},this.dispose=()=>{this.levels.forEach((e=>{e.morph&&e.morph.geometry&&e.morph.geometry.dispose()})),this._material&&this._material.dispose(),this._secondaryMaterial&&this._secondaryMaterial.dispose()},this.getCurrentLevel=()=>this._currentLevel,this.getCurrentMorph=()=>{var e=this.levels[this._currentLevel];return e&&e.morph?e.morph:this._parent.morph},this.lodLoader=function(e){return t=>{var n=this._material,s={localTimeEnabled:this._parent.timeEnabled,localMorphColour:this._parent.morphColour},o=a(t,s),l=void 0;this._parent.isGeometry?l=new i.Mesh(o,n):this._parent.isLines&&(l=new(r(1491).D)(o,n)),l.userData=this._parent,l.renderOrder=this._renderOrder,t.dispose(),this.levelLoaded(l,e)}},this.updateMorphColorAttribute=e=>{if(this._material&&(this._material.vertexColors==i.VertexColors||1==this._material.vertexColors))if(e){var t=this.getCurrentMorph();n(t.geometry,t)}else this.levels.forEach((e=>{e.morph&&e.morph.geometry&&n(e.morph.geometry,e.morph)}))},this.setColour=e=>{this._material.color=e,this._secondaryMaterial&&(this._secondaryMaterial.color=e),t()},this.setFrustumCulled=e=>{this.levels.forEach((t=>{t.morph&&(t.morph.frustumCulled=e),t.secondaryMesh&&(t.secondaryMesh.frustumCulled=e)}))},this.setMaterial=e=>{e&&(!this._material||this._material.id!==e.id)&&(this._material=e,this._secondaryMaterial&&this._secondaryMaterial.dispose(),this._secondaryMaterial=e.clone(),this._secondaryMaterial.side=i.FrontSide,this._secondaryMaterial.transparent=!0,this.levels.forEach((e=>{e.morph&&(e.morph.material=this._material,e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)),e.secondaryMesh&&(e.secondaryMesh.material=this._secondaryMaterial)})))},this.setName=e=>{this.levels.forEach((t=>{t.morph&&(t.morph.name=e),t.secondaryMesh&&(t.secondaryMesh.name=e)}))},this.setRenderOrder=e=>{this._renderOrder=e,this.levels.forEach((t=>{t.morph&&(t.morph.renderOrder=e),t.secondaryMesh&&(t.secondaryMesh.renderOrder=e)}))},this.setVertexColors=e=>{this._material.vertexColors=e,t(),this._secondaryMaterial&&(this._secondaryMaterial.vertexColors=e)},this.update=(e,t)=>{var r=this.levels;if(1<r.length){var i,n,a=e.cameraObject.position.distanceTo(t),s=-1,o=-1;for(i=0,n=r.length;i<n&&a>=r[i].distance;i++)r[i].morph?(-1<s&&r[s].morph&&(r[s].morph.visible=!1),s=i,r[i].morph.visible=!0,o=-1):o=i;for(-1<o&&this.loadLevel(o);i<n;i++)r[i].morph&&(-1<s?r[i].morph.visible=!1:(r[i].morph.visible=!0,s=i));this._currentLevel!=s&&(this._currentLevel=s,this.checkTransparentMesh())}},this.toggleMarker=(e,t)=>{this.levels.forEach((r=>{r.morph&&(t?r.morph.add(e):r.morph.remove(e))}))};var t=()=>{this.levels.forEach((e=>{e.morph&&e.morph.geometry&&(e.morph.geometry.colorsNeedUpdate=!0)}))}}},4834:(e,t,r)=>{var i=r(1515),n=new Image(128,128);n.src=r(2370);var a=new i.Texture;a.image=n,a.needsUpdate=!0;var s=[.02,.03,1],o=new i.SpriteMaterial({map:a,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),l=r(2515).createNewSpriteText,h=function(e){r(7393).c.call(this),this.texture=a;var t=void 0,n=void 0,h=void 0,c=void 0,u=void 0,d=!0;this.morph=new i.Group,this.group=this.morph,this.parent=e,this.isMarker=!0;var p=!1;this.ndc=new i.Vector3;var m=void 0,f=void 0;this.updateVisual=(e,t)=>{var r=1;e!==t&&(r=.6+.4*(1-(this.ndc.z-e)/(t-e))),this.setSpriteSize(r)},this.updateNDC=e=>(this.ndc.copy(this.morph.position),this.ndc.project(e),this.ndc.z=Math.min(Math.max(this.ndc.z,0),1),this.ndc),this.setPosition=(e,t,r)=>{this.morph.position.set(e,t,r)},this.setSpriteSize=e=>{t.scale.set(.015,.02,1),t.scale.multiplyScalar(e)},this.setUserSprite=()=>{c&&(this.morph.add(c),d&&(this.morph.remove(t),f&&this.morph.remove(f),d=!1))},this.setImageForUserSprite=(e,t)=>{c&&(this.morph.remove(c),c=void 0),n&&n.dispose(),h&&h.dispose(),(n=new i.Texture).image=e,n.needsUpdate=!0,h=new i.SpriteMaterial({map:n,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),t||(t=[.05,.05,1]),(c=new i.Sprite(h)).center.set(.5,0),c.scale.set(t[0],t[1],t[2]),c.userData=this,this.setUserSprite()},this.setDefaultSprite=()=>{d||(d=!0,this.morph.add(t),c&&this.morph.remove(c),f&&this.morph.add(f))},this.loadUserSprite=(e,t)=>{if(e)if(e!==u){u=e;var r=new Image(128,128);r.crossOrigin="anonymous",r.onload=()=>{this.setImageForUserSprite(r,t)},r.src=e}else this.setUserSprite()},this.dispose=()=>{this.morph&&this.morph.clear(),t&&(t.clear(),t=void 0),f&&(f.material.map.dispose(),f.material.dispose(),f=void 0)},this.isEnabled=()=>p,this.setNumber=e=>{(!e||m!=e)&&f&&(this.morph.remove(f),f.material.map.dispose(),f.material.dispose(),f=void 0),!f&&e&&(f=l(e,.012,"black","Asap",120,700),this.morph.add(f)),m=e},this.getNumber=()=>m||1,this.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.parent.region&&(this.parent.region.pickableUpdateRequired=!0))},this.enable=()=>{p=!0,this.morph.visible=!0,this.visible=!0},this.disable=()=>{p=!1,this.morph.visible=!1,this.visible=!1},(()=>{(t=new i.Sprite(o)).center.set(.5,0),this.morph.add(t),this.morph.position.set(0,0,0),this.morph.renderOrder=1e4,t.scale.set(s[0],s[1],s[2]),t.userData=this})()};h.prototype=Object.create(r(7393).c.prototype),t.p=h},2970:(e,t,r)=>{function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}var n=r(1515),a=new Image(128,128);a.src=r(7328);var s=new n.Texture;s.image=a,s.needsUpdate=!0;var o=[.02,.03,1],l=new n.SpriteMaterial({map:s,alphaTest:.5,transparent:!0,depthTest:!1,depthWrite:!1,sizeAttenuation:!1}),h=r(2515).createNewSpriteText,c=function(e){r(7393).c.call(this),this.texture=s;var t=void 0;this.morph=new n.Group,this.group=this.morph,this.isMarkerCluster=!0;var a=!0,c=[];this.markers={};var u=new n.Vector2,d=new n.Vector2,p=Date.now();this.setSpriteSize=e=>{t.scale.set(.015,.02,1),t.scale.multiplyScalar(e)},this.clear=()=>{this.group.clear(),this.markers={}},this.dispose=()=>{this.clear(),this.morph&&this.morph.clear()};var m=e=>{var t=new n.Group,r=new n.Sprite(l);return r.clusterIndex=e,r.center.set(.5,0),r.position.set(0,0,0),r.renderOrder=1e4,r.scale.set(o[0],o[1],o[2]),r.userData=this,t.add(r),this.group.add(t),{group:t,marker:r,label:void 0,number:0,min:[0,0,0],max:[1,1,1]}},f=(e,t)=>{var r=!0,i={members:[],coords:[0,0,0],min:[0,0,0],max:[1,1,1]};for(var n in e)r?(u.set(e[n].ndc.x,e[n].ndc.y),this._b1.setFromPoints([e[n].morph.position]),r=!1,i.members.push(e[n]),i.coords=[e[n].morph.position.x,e[n].morph.position.y,e[n].morph.position.z],t.push(i),delete e[n]):(d.set(e[n].ndc.x,e[n].ndc.y),.1>u.distanceTo(d)&&(i.members.push(e[n]),this._b1.expandByPoint(e[n].morph.position),delete e[n]));i.min=[this._b1.min.x,this._b1.min.y,this._b1.min.z],i.max=[this._b1.max.x,this._b1.max.y,this._b1.max.z],1!=r&&f(e,t)};this.calculate=()=>{if(a&&500<Date.now()-p){var e=[];f(function(e){for(var t,r=1;r<arguments.length;r++)t=null==arguments[r]?{}:arguments[r],r%2?i(Object(t),!0).forEach((function(r){var i,n,a;i=e,n=r,a=t[r],n=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(n),n in i?Object.defineProperty(i,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[n]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}));return e}({},this.markers),e),(e=>{var t=0;for(e.forEach((e=>{var r=e.members.length,i=0;1===r?e.members[0].setVisibility(!0):(e.members.forEach((e=>{i+=e.getNumber(),e.setVisibility(!1)})),!c[t]&&c.push(m(t)),((e,t,r)=>{e.group.visible=!0,e.group.position.set(t.coords[0],t.coords[1],t.coords[2]),(void 0===e.label||r!==e.number)&&(e.label&&(e.group.remove(e.label),e.label.material.map.dispose(),e.label.material.dispose()),e.label=h(r,.012,"black","Asap",120,700),e.number=r,e.group.add(e.label)),e.min=t.min,e.max=t.max})(c[t],e,i),t++)}));t<c.length;t++)c[t].group.visible=!1})(e),p=Date.now(),this.markerUpdateRequired=!1}},this.isEnabled=()=>a,this.enable=()=>{a=!0,this.morph.visible=!0},this.disable=()=>{for(var e in a=!1,this.morph.visible=!1,this.markers){var t;null!==(t=this.markers[e])&&void 0!==t&&t.isMarker&&this.markers[e].isEnabled()&&this.markers[e].setVisibility(!0)}},this.zoomToCluster=t=>!!(void 0!==t&&-1<t&&(this._v1.set(...c[t].min),this._v2.set(...c[t].max),Math.abs(0<this._v1.distanceTo(this._v2))))&&(this._b1.set(this._v1,this._v2),e.translateBoundingBoxToCameraView(this._b1,3,300),this.markerUpdateRequired=!0,!0),this.clusterIsVisible=e=>{var t;return!!(void 0!==e&&-1<e&&c[e])&&(null===(t=c[e].group)||void 0===t?void 0:t.visible)}};c.prototype=Object.create(r(7393).c.prototype),t.p=c},770:(e,t,r)=>{var i=r(1515),n=r(377).O,a=r(2515).toBufferGeometry,s=r(2515).getCircularTexture,o=r(4296).J,l=function(){r(7393).c.call(this),this.isPointset=!0;var e=[];this.createMesh=(e,t,r)=>{if(e&&t){var i=a(e,r),o=s();t.map=o;var l=new n(i,t);this.setMesh(l,r.localTimeEnabled,r.localMorphColour)}};var t=(t,r,n,a)=>{if(n){var s=new i.Color(a),l=new o(n,s);l.setPosition(r[0],r[1],r[2]);var h=l.getSprite();h.material.sizeAttenuation=!1,h.material.alphaTest=.5,h.material.transparent=!0,h.material.depthWrite=!1,h.material.depthTest=!1,this.group.add(h),e[t]=l}};this.addPoints=(e,r,n)=>{if(e&&0<e.length){var a=this.drawRange-1,s=this.addVertices(e);if(!this.getMorph()){var o=new i.PointsMaterial({alphaTest:.5,size:10,color:n,sizeAttenuation:!1});s.colorsNeedUpdate=!0,this.createMesh(s,o,{localTimeEnabled:!1,localMorphColour:!1})}var l=a+e.length,h=0;if(Array.isArray(r)&&r.length===e.length||"string"==typeof r)for(;a+h<l;){var c="string"==typeof r?r:r[h];t(h,e[h],c,n),h++}this.region&&(this.region.pickableUpdateRequired=!0)}},this.setSize=e=>{this.morph&&this.morph.material&&(this.morph.material.size=e,this.morph.material.needsUpdate=!0)},this.setSizeAttenuation=e=>{this.morph&&this.morph.material&&(this.morph.material.sizeAttenuation=e,this.morph.material.needsUpdate=!0)},this.getVerticesByIndex=function(e){if(0<=e&&this.drawRange>e){var t=this.getMorph().geometry.getAttribute("position");return[t.getX(e),t.getY(e),t.getZ(e)]}},this.editVertices=function(t,r){if(t&&t.length){var i=this.getMorph(),n=r+t.length-1;if(!i||0>r||n>=this.drawRange)return;var a=i.geometry.getAttribute("position"),s=r;t.forEach((t=>{var r=e[s];r&&r.setPosition(t[0],t[1],t[2]),a.setXYZ(s++,t[0],t[1],t[2])})),a.needsUpdate=!0,this.boundingBoxUpdateRequired=!0}},this.render=(e,t,r,i)=>{this.morph&&r&&(this.morph.sizePerPixel=r.pixelHeight),l.prototype.render.call(this,e,t,r,i)}};l.prototype=Object.create(r(7393).c.prototype),t.t=l},9372:(e,t,r)=>{r(1515);var i=r(2515).resolveURL,n=function(e){r(7393).c.call(this),this.isTexturePrimitive=!0,this.texture=e,this.load=(e,t)=>{if(e&&e.images&&e.images.source){var n=new(r(3523).$),a=[];e.images.source.forEach((e=>{a.push(i(e))}));var s=this;n.loadFromImages(a).then((()=>{s.texture=n,s.initialise(e,t)}))}},this.initialise=(e,t)=>{null!=t&&"function"==typeof t&&t(this)}};(n.prototype=Object.create(r(7393).c.prototype)).constructor=n,t.p=n},4291:(e,t,r)=>{function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function n(e){for(var t,r=1;r<arguments.length;r++)t=null==arguments[r]?{}:arguments[r],r%2?i(Object(t),!0).forEach((function(r){var i,n,a;i=e,n=r,a=t[r],n=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(n),n in i?Object.defineProperty(i,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):i[n]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}));return e}var a=r(1515),s=r(8612),o=function(e){r(9372).p.call(this,e),this.isTextureSlides=!0;var t=[],i={};this.morph=new a.Group,this.group=this.morph,this.morph.userData=this;var o=void 0,l=!0;this.createSlides=e=>{e.forEach((e=>this.createSlide(e)))};var h=(e,t)=>{var r=e.material,i=r.uniforms;switch(e.rotation.x=0,e.rotation.y=0,e.rotation.z=0,e.position.x=0,e.position.y=0,e.position.z=0,t.direction){case"x":var n=-Math.PI/2;e.rotation.y=n,i.direction.value=1,i.slide.value.set(t.value,0,0),e.position.x=t.value;break;case"y":e.rotation.x=Math.PI/2,i.direction.value=2,i.slide.value.set(0,t.value,0),e.position.y=t.value;break;case"z":i.direction.value=3,i.slide.value.set(0,0,t.value),e.position.z=t.value}r.needsUpdate=!0,this.boundingBoxUpdateRequired=!0};this.modifySlideSettings=e=>{e&&e.id&&e.id in i&&i[e.id]&&h(i[e.id],e)},this.createSlide=e=>{if(this.texture&&this.texture.isTextureArray&&this.texture.isReady()&&e&&e.direction&&void 0!==e.value){var r=new a.PlaneGeometry(1,1);r.translate(.5,.5,0);var n=s.getUniforms();n.diffuse.value=this.texture.impl,n.depth.value=this.texture.size.depth,n.flipY.value=l;var o={fs:s.fs,vs:s.vs,uniforms:n,glslVersion:s.glslVersion,side:a.DoubleSide,transparent:!1},c=this.texture.getMaterial(o);c.needsUpdate=!0;var u=new a.Mesh(r,c);u.name=this.groupName,u.userData=this;var d={value:e.value,direction:e.direction,id:u.id};return t.push(d),h(u,d),i[u.id]=u,this.morph.add(u),this.boundingBoxUpdateRequired=!0,d}},this.getTextureSettings=()=>[...t],this.getTextureSettingsWithId=e=>{for(var r=0;r<t.length;r++)if(e===t[r].id)return n({},t[r])},this.getSlides=()=>this.morph?[...this.morph.children]:[],this.removeSlide=e=>{e&&this.removeSlideWithId(e.id)},this.removeSlideWithId=e=>{if(this.morph&&e in i&&i[e]){if(this.morph.getObjectById(e)){var r=i[e];this.morph.remove(r),r.clear(),r.geometry&&r.geometry.dispose(),r.material&&r.material.dispose(),this.boundingBoxUpdateRequired=!0}var n=t.findIndex((t=>t.id===e));-1<n&&t.splice(n,1)}},this.dispose=()=>{this.morph.children.forEach((e=>{e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})),r(9372).p.prototype.dispose.call(this),this.boundingBoxUpdateRequired=!0},this.getBoundingBox=()=>{if(this.morph&&this.morph.children&&this.morph.visible&&this.boundingBoxUpdateRequired){this.cachedBoundingBox.makeEmpty();var e=new a.Vector3(0,0,0);this.morph.children.forEach((t=>{((e,t,r)=>{if(t)switch(t.direction.value){case 1:r.copy(t.slide.value),e.expandByPoint(r),r.setY(1),r.setZ(1),e.expandByPoint(r);break;case 2:r.copy(t.slide.value),e.expandByPoint(r),r.setX(1),r.setZ(1),e.expandByPoint(r);break;case 3:r.copy(t.slide.value),e.expandByPoint(r),r.setX(1),r.setY(1),e.expandByPoint(r)}})(this.cachedBoundingBox,t.material.uniforms,e)})),this.morph.updateMatrixWorld(!0,!0),this.cachedBoundingBox.applyMatrix4(this.morph.matrixWorld),this.boundingBoxUpdateRequired=!1}return this.cachedBoundingBox},this.applyTransformation=(e,t,r)=>{var i=new a.Matrix4;i.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,0);var n=(new a.Quaternion).setFromRotationMatrix(i);this.morph.position.set(...t),this.morph.quaternion.copy(n),this.morph.scale.set(...r),this.morph.updateMatrix(),this.boundingBoxUpdateRequired=!0},this.setRenderOrder=e=>{this.morph.renderOrder=e},this.initialise=(e,t)=>{if(e){var r=e.locations;r&&0<r.length&&(this.applyTransformation(r[0].orientation,r[0].position,r[0].scale),"flipY"in r[0]&&(l=r[0].flipY)),this.createSlides(e.settings.slides),null!=t&&"function"==typeof t&&t(this)}},this.showEdges=e=>{if(o)o.material.color=e;else{var t=new a.BoxGeometry(1,1,1);t.translate(.5,.5,.5);var r=new a.EdgesGeometry(t);o=new a.LineSegments(r,new a.LineBasicMaterial({color:e})),this.group.add(o)}o.visible=!0},this.hideEdges=()=>{o&&(o.visible=!1)}};(o.prototype=Object.create(r(9372).p.prototype)).constructor=o,t.W=o},7393:(e,t,r)=>{var i=r(1515),n=r(2515).createBufferGeometry,a=r(2515).resolveURL,s=0,o=function(){this.isZincObject=!0,this.geometry=void 0,this.morph=void 0,this.group=new i.Group,this._lod=new(r(9801).U)(this),this.groupName=void 0,this.timeEnabled=!1,this.morphColour=!1,this.inbuildTime=0,this.mixer=void 0,this.animationGroup=void 0,this.duration=6e3,this.clipAction=void 0,this.userData={},this.videoHandler=void 0,this.marker=void 0,this.markerNumber=void 0,this.markerUpdateRequired=!0,this.closestVertexIndex=-1,this.boundingBoxUpdateRequired=!0,this.cachedBoundingBox=new i.Box3,this.anatomicalId=void 0,this.region=void 0,this.animationClip=void 0,this.markerMode="inherited",this.uuid="pr"+s++,this._v1=new i.Vector3,this._v2=new i.Vector3,this._b1=new i.Box3,this.center=new i.Vector3,this.radius=0,this.visible=!0,this.drawRange=-1,this.origColour=void 0,this.origVertexColors=!1};o.prototype.setDuration=function(e){this.duration=e,this.clipAction&&this.clipAction.setDuration(this.duration)},o.prototype.getDuration=function(){return this.duration},o.prototype.setRegion=function(e){this.region=e},o.prototype.getRegion=function(){return this.region},o.prototype.getMorph=function(){return this._lod.getCurrentMorph()||this.morph},o.prototype.getGroup=function(){return this.group},o.prototype.setMorph=function(e){this.morph=e,this.group.add(this.morph);var t=this._lod.calculateDistance("far");this._lod.addLevel(e,t),this._lod.setMaterial(e.material)},o.prototype.checkTransparentMesh=function(){},o.prototype.setMesh=function(e,t,r){this.animationGroup=new i.AnimationObjectGroup(e),this.mixer=new i.AnimationMixer(this.animationGroup);var n=e.geometry;if(this.geometry=e.geometry,this.clipAction=void 0,n&&n.morphAttributes){var a=n.morphAttributes.position;a||(a=n.morphAttributes.color?n.morphAttributes.color:n.morphAttributes.normal),a&&(this.animationClip=i.AnimationClip.CreateClipsFromMorphTargetSequences(a,10,!0),this.animationClip&&null!=this.animationClip[0]&&(this.clipAction=this.mixer.clipAction(this.animationClip[0]).setDuration(this.duration),this.clipAction.loop=i.loopOnce,this.clipAction.clampWhenFinished=!0,this.clipAction.play()))}this.timeEnabled=t,this.morphColour=r,e.userData=this,e.matrixAutoUpdate=!1,this.setMorph(e),this.checkTransparentMesh(),this.timeEnabled?this.setFrustumCulled(!1):this.morphColour&&(n.setAttribute("morphTarget0",n.getAttribute("position")),n.setAttribute("morphTarget1",n.getAttribute("position"))),this.boundingBoxUpdateRequired=!0},o.prototype.setAnatomicalId=function(e){this.anatomicalId=e},o.prototype.setName=function(e){this.groupName=e,this._lod.setName(e)},o.prototype.getCurrentTime=function(){if(this.clipAction){var e=this.clipAction.time/this.clipAction._clip.duration;return this.duration*e}return this.inbuildTime},o.prototype.setMorphTime=function(e){var t=!1;if(this.clipAction){var r=e/this.duration*this.clipAction._clip.duration;r!=this.clipAction.time&&(this.clipAction.time=r,t=!0),t&&this.isTimeVarying()&&this.mixer.update(0)}else{var i;(i=e>this.duration?this.duration:0>e?0:e)!=this.inbuildTime&&(this.inbuildTime=i,t=!0)}t&&(this.boundingBoxUpdateRequired=!0,this._lod.updateMorphColorAttribute(!0),this.timeEnabled&&(this.markerUpdateRequired=!0))},o.prototype.isTimeVarying=function(){return!(!this.timeEnabled&&!this.morphColour)},o.prototype.getVisibility=function(){return this.visible},o.prototype.setVisibility=function(e){e!==this.visible&&(this.visible=e,this.group.visible=e,this.region&&(this.region.pickableUpdateRequired=!0))},o.prototype.setAlpha=function(e){var t=this._lod._material,r=!1;1>e&&(r=!0),t.opacity=e,t.transparent=r,this.checkTransparentMesh()},o.prototype.setFrustumCulled=function(e){this._lod.setFrustumCulled(e)},o.prototype.setVertexColors=function(e){this._lod.setVertexColors(e)},o.prototype.getColour=function(){return this._lod._material?this._lod._material.color:void 0},o.prototype.setColour=function(e){this._lod.setColour(e)},o.prototype.setGreyScale=function(e){if(e){if(!this.origColour&&this._lod._material)return this.origColour=this._lod._material.color,this.origVertexColors=this._lod._material.vertexColors,this._lod.setVertexColors(!1),this._lod.setColour((new i.Color).setHex(12303291)),!0}else if(this.origColour)return this._lod.setColour(this.origColour),this._lod.setVertexColors(this.origVertexColors),this.origColour=void 0,!0;return!1},o.prototype.getColourHex=function(){return!this.morphColour&&this._lod._material&&this._lod._material.color?this._lod._material.color.getHexString():void 0},o.prototype.setColourHex=function(e){this._lod._material.color.setHex(e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.color.setHex(e)},o.prototype.setEmissiveRGB=function(e){this._lod._material&&this._lod._material.emissive&&this._lod._material.emissive.setRGB(...e),this._lod._secondaryMaterial&&this._lod._secondaryMaterial.emissive.setRGB(...e)},o.prototype.setMaterial=function(e){this._lod.setMaterial(e)},o.prototype.getClosestVertexIndex=function(){var e=-1,t=this.getMorph();if(t&&t.geoemtry){var r=t.geometry.attributes.position;if(this._b1.setFromBufferAttribute(r),this._b1.getCenter(this._v1),r)for(var i=-1,n=0,a=0;a<r.count;a++)this._v2.fromArray(r.array,3*a),n=this._v2.distanceTo(this._v1),-1==i?i=n:i>n&&(i=n,e=a)}return e},o.prototype.getClosestVertex=function(e){var t=new i.Vector3;-1==this.closestVertexIndex&&(this.closestVertexIndex=this.getClosestVertexIndex());var r=this.getMorph();if(r&&r.geometry&&0<=this.closestVertexIndex){var n=r.morphTargetInfluences,a=r.geometry.morphAttributes;if(!(n&&a&&a.position))return t.fromArray(r.geometry.attributes.position.array,3*this.closestVertexIndex),e?t.applyMatrix4(r.matrixWorld):t;for(var s=!1,o=0;o<n.length;o++)0<n[o]&&(s=!0,this._v1.fromArray(a.position[o].array,3*this.closestVertexIndex),t.add(this._v1.multiplyScalar(n[o])));if(s)return e?t.applyMatrix4(r.matrixWorld):t}return this.getBoundingBox(),t.copy(this.center),e?t.applyMatrix4(this.morph.matrixWorld):t},o.prototype.getBoundingBox=function(){if(this.visible){var e=this._lod.getCurrentMorph();if(e&&e.visible)return this.boundingBoxUpdateRequired&&(r(2515).getBoundingBox(e,this.cachedBoundingBox,this._b1,this._v1,this._v2),this.cachedBoundingBox.getCenter(this.center),this.radius=this.center.distanceTo(this.cachedBoundingBox.max),this.boundingBoxUpdateRequired=!1),this.cachedBoundingBox}},o.prototype.dispose=function(){this._lod.dispose(),this.animationGroup=void 0,this.mixer=void 0,this.morph=void 0,this.group=void 0,this.clipAction=void 0,this.groupName=void 0},o.prototype.markerIsRequired=function(e){return!(!this.visible||!("on"===this.markerMode||e&&e.displayMarkers&&"inherited"===this.markerMode))},o.prototype.updateMarker=function(e,t){if(0==e&&this.markerIsRequired(t)){var i=t.ndcToBeUpdated;if(this.groupName){if(this.marker||(this.marker=new(r(4834).p)(this),this.markerUpdateRequired=!0),this.markerUpdateRequired){var n=this.getClosestVertex(!1);n&&(this.marker.setPosition(n.x,n.y,n.z),this.markerUpdateRequired=!1)}this.marker.isEnabled()||(t.markersList&&!(this.marker.uuid in t.markersList)&&(i=!0,t.markersList[this.marker.uuid]=this.marker),this.marker.enable(),this.group.add(this.marker.morph)),this.marker.setNumber(this.markerNumber),this.markerImgURL?this.marker.loadUserSprite(this.markerImgURL):this.marker.setDefaultSprite(),t&&t.camera&&(i||t.markerCluster.markerUpdateRequired)&&(this.marker.updateNDC(t.camera.cameraObject),t.markerCluster.markerUpdateRequired=!0)}}else this.marker&&this.marker.isEnabled()&&(this.marker.disable(),this.group.remove(this.marker.morph),t.markersList&&this.marker.uuid in t.markersList&&(t.markerCluster.markerUpdateRequired=!0,delete t.markersList[this.marker.uuid])),this.markerUpdateRequired=!0},o.prototype.processMarkerVisual=function(e,t){this.marker&&this.marker.isEnabled()&&this.marker.updateVisual(e,t)},o.prototype.initiateMorphColor=function(){1==this.morphColour&&this._lod.updateMorphColorAttribute(!1)},o.prototype.setRenderOrder=function(e){this._lod.setRenderOrder(e)},o.prototype.getClosestVertexDOMElementCoords=function(e){if(e&&e.camera){var t=!0,r=this.getClosestVertex(!0);return r.project(e.camera),r.z=Math.min(Math.max(r.z,0),1),(1<r.x||-1>r.x||1<r.y||-1>r.y)&&(t=!1),e.getZincCameraControls().getRelativeCoordsFromNDC(r.x,r.y,r),{position:r,inView:t}}},o.prototype.setMarkerMode=function(e,t){e!==this.markerMode&&(this.markerMode="on"===e||"off"===e?e:"inherited",this.region&&(this.region.pickableUpdateRequired=!0)),t&&(this.markerNumber=t.number,this.markerImgURL=t.imgURL)},o.prototype.render=function(e,t,r,i){if(this.visible&&!(this.timeEnabled&&t)&&this._lod.update(r,this.center),1==t){if(this.clipAction&&this.isTimeVarying())this.mixer.update(e);else{var n=this.inbuildTime+e;n>this.duration&&(n-=this.duration),this.inbuildTime=n}this.visible&&0!=e&&(this.boundingBoxUpdateRequired=!0,1==this.morphColour&&this._lod.updateMorphColorAttribute(!0))}this.updateMarker(t,i)},o.prototype.addLOD=function(e,t,r,i,n){this._lod.addLevelFromURL(e,t,r,i,n)},o.prototype.addVertices=function(e){var t=this.getMorph(),r=void 0;if(t){if(-1<this.drawRange){var i=t.geometry.getAttribute("position");e.forEach((e=>{i.setXYZ(this.drawRange,e[0],e[1],e[2]),++this.drawRange})),i.needsUpdate=!0,t.geometry.setDrawRange(0,this.drawRange),t.geometry.computeBoundingBox(),t.geometry.computeBoundingSphere(),r=t.geoemtry,this.boundingBoxUpdateRequired=!0}}else r=n(500,e),this.drawRange=e.length;return r},o.prototype.setPosition=function(e,t,r){var i=this.getGroup();i&&(i.position.set(e,t,r),i.updateMatrix(),this.boundingBoxUpdateRequired=!0)},o.prototype.loadAdditionalSources=function(e){e.load(a(filename),meshloader(region,colour,opacity,localTimeEnabled,localMorphColour,void 0,void 0,void 0,void 0,finishCallback),this.onProgress(filename),this.onError(finishCallback))},o.prototype.setScaleAll=function(e){var t=this.getGroup();t&&(t.scale.set(e,e,e),t.updateMatrix(),this.boundingBoxUpdateRequired=!0)},t.c=o},2843:(e,t,r)=>{var{Group:i,Matrix4:n}=r(1515),a=r(770).t,s=(r(8145).q,r(7931).s),o=r(5672).V,l=r(1515),h=0,c=function(e,t){var r=e,u=new i;u.matrixAutoUpdate=!1,u.userData=this;var d=[],p="",m=[],f=t,v=new n,g=3e3;v.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this.pickableUpdateRequired=!0,this.isRegion=!0,this.uuid="re"+h++,this.hideAllPrimitives=()=>{d.forEach((e=>e.hideAllPrimitives())),m.forEach((e=>e.setVisibility(!1)))},this.showAllPrimitives=()=>{d.forEach((e=>e.showAllPrimitives())),m.forEach((e=>e.setVisibility(!0)))},this.setVisibility=e=>{e!=u.visible&&(u.visible=e,this.pickableUpdateRequired=!0)},this.getVisibility=()=>u.visible,this.getGroup=()=>u,this.setTransformation=e=>{v.set(...e),u.matrix.copy(v),u.updateMatrixWorld()},this.setName=e=>{e&&""!==e&&(p=e)},this.getName=()=>p,this.getParent=()=>r,this.getFullSeparatedPath=()=>{var e=[];if(""!==p){e.push(p);for(var t,i=r;void 0!==i;)""!==(t=i.getName())&&e.unshift(t),i=i.getParent()}return e},this.getFullPath=()=>{var e=this.getFullSeparatedPath();if(0<e.length){var t=e.shift();return e.forEach((e=>{t=t.concat("/",e)})),t}return""},this.createChild=e=>{var t=new c(this,f);return t.setName(e),d.push(t),u.add(t.getGroup()),t},this.getChildWithName=e=>{if(e)for(var t=e.toLowerCase(),r=0;r<d.length;r++)if(d[r].getName().toLowerCase()===t)return d[r]},this.findChildFromSeparatedPath=e=>{if(e&&0<e.length&&""===e[0]&&e.shift(),e&&0<e.length){var t=this.getChildWithName(e[0]);return t?(e.shift(),t.findChildFromSeparatedPath(e)):void 0}return this},this.findChildFromPath=e=>{var t=e.split("/");return this.findChildFromSeparatedPath(t)},this.createChildFromSeparatedPath=e=>{if(0<e.length&&""===e[0]&&e.shift(),0<e.length){var t=this.getChildWithName(e[0]);return t||(t=this.createChild(e[0])),e.shift(),t.createChildFromSeparatedPath(e)}return this},this.createChildFromPath=e=>{var t=e.split("/");return this.createChildFromSeparatedPath(t)},this.findOrCreateChildFromPath=e=>{var t=this.findChildFromPath(e);return t||(t=this.createChildFromPath(e)),t},this.addZincObject=e=>{e&&(e.setRegion(this),u.add(e.getGroup()),m.push(e),this.pickableUpdateRequired=!0,f&&f.triggerObjectAddedCallback(e))},this.removeZincObject=e=>{for(var t=0;t<m.length;t++)if(e===m[t])return u.remove(e.getGroup()),m.splice(t,1),f&&f.triggerObjectRemovedCallback(e),e.dispose(),void(this.pickableUpdateRequired=!0)},this.checkPickableUpdateRequred=e=>{if(this.pickableUpdateRequired)return!0;if(e)for(var t=0;t<d.length;t++)if(d[t].checkPickableUpdateRequred(e))return!0;return!1},this.getPickableThreeJSObjects=(e,t)=>(u.visible&&(m.forEach((t=>{if(t.getGroup()&&t.getGroup().visible){var r=t.marker;r&&r.isEnabled()&&e.push(r.getMorph()),e.push(t.getGroup())}})),t&&d.forEach((r=>{r.getPickableThreeJSObjects(e,t)})),this.pickableUpdateRequired=!1),e),this.setDuration=e=>{g=e,m.forEach((t=>t.setDuration(e))),d.forEach((t=>t.setDuration(e)))},this.getDuration=()=>g,this.getBoundingBox=e=>{var t,r;return m.forEach((e=>{(r=e.getBoundingBox())&&(null==t?t=r.clone():t.union(r))})),e&&d.forEach((i=>{(r=i.getBoundingBox(e))&&(null==t?t=r.clone():t.union(r))})),t},this.clear=e=>{e&&d.forEach((t=>t.clear(e))),m.forEach((e=>{u.remove(e.getGroup()),e.dispose()})),d=[],m=[]},this.objectIsInRegion=(e,t)=>{for(var r=0;r<m.length;r++)if(e===m[r])return!0;if(t)for(var i=0;i<d.length;i++)if(d[i].objectIsInRegion(e,t))return!0;return!1},this.forEachGeometry=(e,t)=>{m.forEach((t=>{t.isGeometry&&e(t)})),t&&d.forEach((r=>r.forEachGeometry(e,t)))},this.forEachGlyphset=(e,t)=>{m.forEach((t=>{t.isGlyphset&&e(t)})),t&&d.forEach((r=>r.forEachGlyphset(e,t)))},this.forEachPointset=(e,t)=>{m.forEach((t=>{t.isPointset&&e(t)})),t&&d.forEach((r=>r.forEachPointset(e,t)))},this.forEachLine=(e,t)=>{m.forEach((t=>{t.isLines&&e(t)})),t&&d.forEach((r=>r.forEachLine(e,t)))},this.findObjectsWithAnatomicalId=(e,t)=>{var r=[];return m.forEach((t=>{t.anatomicalId===e&&r.push(t)})),t&&d.forEach((i=>{var n=i.findObjectsWithAnatomicalId(e,t);r.push(...n)})),r},this.findObjectsWithGroupName=(e,t)=>{var r=[];return m.forEach((t=>{(t.groupName?t.groupName.toLowerCase():t.groupName)===(e?e.toLowerCase():e)&&r.push(t)})),t&&d.forEach((i=>{var n=i.findObjectsWithGroupName(e,t);r.push(...n)})),r},this.findGeometriesWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter((e=>e.isGeometry)),this.findPointsetsWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter((e=>e.isPointset)),this.findGlyphsetsWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter((e=>e.isGlyphset)),this.findLinesWithGroupName=(e,t)=>this.findObjectsWithGroupName(e,t).filter((e=>e.isLines)),this.getAllObjects=e=>{var t=[...m];return e&&d.forEach((r=>{var i=r.getAllObjects(e);t.push(...i)})),t},this.getChildRegions=e=>{var t=[...d];return e&&d.forEach((r=>{var i=r.getChildRegions(e);t.push(...i)})),t},this.getCurrentTime=()=>{if(null!=m[0])return m[0].getCurrentTime();for(var e,t=0;t<d.length;t++)if(-1!==(e=d[t].getCurrentTime()))return e;return-1},this.setMorphTime=(e,t)=>{m.forEach((t=>{t.setMorphTime(e)})),t&&d.forEach((t=>{t.setMorphTime(e)}))},this.isTimeVarying=()=>{for(var e=0;e<m.length;e++)if(m[e].isTimeVarying())return!0;for(var t=0;t<d.length;t++)if(d[t].isTimeVarying())return!0;return!1},this.renderGeometries=(e,t,r,i,n,a)=>{var s;this.getAllObjects(a).forEach((a=>{a.render(e*t,r,i,n)})),n&&!1===r&&null!==(s=n.markerCluster)&&void 0!==s&&s.markerUpdateRequired&&n.markerCluster.calculate()},this.createPoints=(e,t,r,i)=>{var n=!1,s=this.findObjectsWithGroupName(e,!1),o=s.findIndex((e=>e.isPointset)),l=-1<o?s[o]:new a;return l.addPoints(t,r,i),-1===o?(l.setName(e),this.addZincObject(l),n=!0):this.pickableUpdateRequired=!0,{zincObject:l,isNew:n}},this.createLines=(e,t,r)=>{var i=!1,n=this.findObjectsWithGroupName(e,!1),a=n.findIndex((e=>e.isLines)),o=-1<a?n[a]:new s;return o.addLines(t,r),-1===a?(o.setName(e),this.addZincObject(o),i=!0):this.pickableUpdateRequired=!0,{zincObject:o,isNew:i}},this.createGeometryFromThreeJSGeometry=(e,t,r,i,n,a)=>{var s=new o,h=new l.MeshPhongMaterial({color:r,morphTargets:!1,morphNormals:!1,transparent:!0,opacity:i,side:l.DoubleSide});return s.createMesh(t,h,{localTimeEnabled:!1,localMorphColour:!1}),s.getMorph()?(s.setVisibility(!1),s.setName(e),s.setRenderOrder(a),this.addZincObject(s),s):void 0}};t.T=c},3260:(e,t,r)=>{var i=r(1515),n=r(164);t.A=function(e){var t=e,a=void 0,s=void 0,o=new i.Clock(!1);this.playAnimation=!0;var l=1e3,h=[],c=0,u=[],d=0,p=void 0,m=void 0,f=void 0,v=void 0,g=[],y=[],x=new i.Group,b=void 0,w=void 0,_=!1,M=[0,0],S=[0,0];this.getDrawingWidth=()=>t?t.clientWidth:b?void 0===b.clientWidth?Math.round(b.width):Math.round(b.clientWidth):0,this.getDrawingHeight=()=>t?t.clientHeight:b?void 0===b.clientHeight?Math.round(b.height):Math.round(b.clientHeight):0,this.onWindowResize=()=>{s.onWindowResize();var e=this.getDrawingWidth(),r=this.getDrawingHeight();if(null!=a){var n;t?(n=t.getBoundingClientRect(),a.setSize(e,r)):b&&(void 0===b.getBoundingClientRect||(n=b.getBoundingClientRect(),b.width=e,b.height=r),a.setSize(e,r,!1)),n&&(S[0]=n.left,S[1]=n.top);var o=new i.Vector2;a.getSize(o),M[0]=o.x,M[1]=o.y}},this.initialiseVisualisation=e=>{if(void 0===(e=e||{}).antialias){var r=!1;try{/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(r=!0)}catch(e){r=!1}e.antialias=!r}e.canvas&&(t=void 0,b=e.canvas),a=new i.WebGLRenderer(e),void 0!==t&&t.appendChild(a.domElement),a.setClearColor(16777215,1),b&&b.style&&(b.style.height="100%",b.style.width="100%"),a.autoClear=!1;var n=this.createScene("default");this.setCurrentScene(n)},this.getCurrentScene=()=>s,this.setCurrentScene=e=>{if(e){this.removeActiveScene(e);var t=s;s=e,t&&t.setInteractiveControlEnable(!1),s.setInteractiveControlEnable(!0),s.setAdditionalScenesGroup(x),this.onWindowResize()}},this.getSceneByName=e=>g[e],this.createScene=e=>{var i;if(null==g[e])return i=b?new(r(5015).Z)(b,a):new(r(5015).Z)(t,a),g[e]=i,i.sceneName=e,i},this.resetView=()=>{s.resetView()},this.viewAll=()=>{if(s){var e=s.getBoundingBox();if(e){for(var t,r=0;r<y.length;r++)(t=y[r].getBoundingBox())&&e.union(t);s.viewAllWithBoundingBox(e)}}},this.loadModelsURL=(e,t,r,i,n,a)=>{s.loadModelsURL(e,t,r,i,n,a)},this.loadViewURL=e=>{s.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{s.loadFromViewURL(e,t)},this.updateDirectionalLight=()=>{s.updateDirectionalLight()};var T=()=>{_?(p=requestAnimationFrame(T),this.render()):(cancelAnimationFrame(p),p=void 0)};this.stopAnimate=()=>{_&&(o.stop(),_=!1)},this.animate=()=>{_||(o.start(),_=!0,T())},Date.now(),this.addPreRenderCallbackFunction=e=>(++c,h[c]=e,c),this.removePreRenderCallbackFunction=e=>{e in h&&delete h[e]},this.addPostRenderCallbackFunction=e=>(++d,u[d]=e,d),this.removePostRenderCallbackFunction=e=>{e in u&&delete u[e]},this.getPlayRate=()=>l,this.setPlayRate=e=>{l=e},this.getCurrentTime=()=>s.getCurrentTime(),this.setMorphsTime=e=>{s.setMorphsTime(e)},this.getZincGeometryByID=e=>s.getZincGeometryByID(e),this.addToScene=e=>{s.addObject(e)},this.addToOrthoScene=e=>{if(null==f&&(f=new i.Scene),null==m){var t=this.getDrawingWidth(),r=this.getDrawingHeight();(m=new i.OrthographicCamera(-t/2,t/2,r/2,-r/2,1,10)).position.z=10}f.add(e)};var E=e=>t=>{t.needsUpdate=!0;var r=new i.SpriteMaterial({map:t}),n=r.map.image.width,a=r.map.image.height;e.material=r,e.scale.set(n,a,1);var s=this.getDrawingWidth(),o=this.getDrawingHeight();e.position.set((s-n)/2,(-o+a)/2,1),this.addToOrthoScene(e)};this.addLogo=()=>{v=new i.Sprite,i.ImageUtils.loadTexture("images/abi_big_logo_transparent_small.png",void 0,E(v))},this.render=()=>{w||(t?0<t.clientWidth&&0<t.clientHeight&&(w=new n(t,this.onWindowResize)):b&&0<b.width&&0<b.height&&(w=new n(b,this.onWindowResize)));var e=o.getDelta();s.renderGeometries(l,e,this.playAnimation);for(var r=0;r<y.length;r++)y[r].renderGeometries(l,e,this.playAnimation);for(var i in null!=m&&null!=f&&(a.clearDepth(),a.render(f,m)),h)h.hasOwnProperty(i)&&h[i].call();for(var c in s.render(a),u)u.hasOwnProperty(c)&&u[c].call()},this.getThreeJSRenderer=()=>a,this.isSceneActive=e=>{if(s===e)return!0;for(var t=0;t<y.length;t++)if(y[t]===e)return!0;return!1},this.addActiveScene=e=>{this.isSceneActive(e)||(y.push(e),x.add(e.getThreeJSScene()))},this.removeActiveScene=e=>{for(var t=0;t<y.length;t++)if(y[t]===e)return y.splice(t,1),void x.remove(e.getThreeJSScene())},this.clearAllActiveScene=()=>{for(var e=0;e<y.length;e++)x.remove(y[e].getThreeJSScene());y.splice(0,y.length)},this.dispose=()=>{for(var e in _&&cancelAnimationFrame(p),g)g.hasOwnProperty(e)&&g[e].clearAll();g=[],y=[],x=new i.Group,this.stopAnimate(),h=[],c=0,m=void 0,f=void 0,v=void 0;var t=this.createScene("default");this.setCurrentScene(t),w=void 0},this.transitionScene=(e,t)=>{if(s){var r=s.getZincCameraControls(),i=e.getBoundingBox();if(i){var n=i.min.distanceTo(i.max)/2,a=(i.min.x+i.max.x)/2,o=(i.min.y+i.max.y)/2,l=(i.min.z+i.max.z)/2,h=r.getViewportFromCentreAndRadius(a,o,l,n,40,4*n),c=r.getCurrentViewport();r.cameraTransition(c,h,t),r.enableCameraTransition()}}},this.isWebGL2=()=>!!a&&a.capabilities.isWebGL2}},5015:(e,t,r)=>{var i=r(1515),n=r(2970).p,a=r(6264).c,s=r(3778).O,o=r(701).Viewport,l=r(2515).createBufferGeometry,h=r(2515).getCircularTexture,c=r(2515).createNewSpriteText,u=0;t.Z=function(e,t){var d=this,p=e,m=void 0,f=new a(this),v=void 0,g={},y=0,x={},b=0,w=new i.Scene,_=new i.Scene,M=new(r(2843).T)(void 0,this);w.add(M.getGroup());var S=new i.Group;w.add(S),this.directionalLight=void 0,this.ambient=void 0,this.camera=void 0;var T=6e3,E=void 0;this.sceneName=void 0;var A=!1,L=void 0;this.autoClearFlag=!0,this.displayMarkers=!1,this.displayMinimap=!1,this.displayMiniAxes=!1,this.minimapScissor={x_offset:16,y_offset:16,width:128,height:128,align:"top-right",updateRequired:!0};var R={x:0,y:0},C={Duration:"6 secs",OriginalDuration:"-",TimeStamps:{}},P=new i.Vector2,I=[];this.forcePickableObjectsUpdate=!1,this.uuid="sc"+u++;var O=new n(this);O.disable(),w.add(O.group);var D={main:[],mini:[]},N=new i.Vector3(0,0,0),B=()=>p?void 0===p.clientWidth?p.width:p.clientWidth:0,U=()=>p?void 0===p.clientHeight?p.height:p.clientHeight:0;this.getDownloadProgress=()=>f.getDownloadProgress(),this.onWindowResize=()=>{var e=U();this.camera.aspect=B()/e,this.camera.updateProjectionMatrix(),this.minimapScissor.updateRequired=!0,E.onResize(),E.calculateHeightPerPixelAtZeroDepth(e)},this.resetView=()=>{this.onWindowResize(),E.resetView()},this.changeZoomByScrollRateUnit=e=>{E.changeZoomByScrollRateUnit(e)},(()=>{this.camera=new i.PerspectiveCamera(40,B()/U(),0,10),this.ambient=new i.AmbientLight(16777215,.2),w.add(this.ambient),this.directionalLight=new i.DirectionalLight(16777215,.8),w.add(this.directionalLight),(E=new(r(701).CameraControls)(this.camera,t.domElement,t,this)).setDirectionalLight(this.directionalLight),E.resetView(),v=new(r(7404).U)(this)})(),this.loadView=e=>{var t=new o;return t.setFromObject(e),E.setCurrentCameraSettings(t),!0},this.setupMultipleViews=(e,t)=>{for(var[r,i]of Object.entries(t)){var n=new o;n.setFromObject(i),E.addViewport(r,n)}E.setDefaultViewport(e)},this.getBoundingBox=()=>M.getBoundingBox(!0),this.viewAllWithBoundingBox=e=>{if(e){var t=E.getViewportFromBoundingBox(e,1);E.setCurrentCameraSettings(t),E.calculateHeightPerPixelAtZeroDepth(U()),O.markerUpdateRequired=!0}},this.viewAll=()=>{var e=this.getBoundingBox();this.viewAllWithBoundingBox(e),O.markerUpdateRequired=!0},this.forEachGeometry=e=>{M.forEachGeometry(e,!0)},this.forEachGlyphset=e=>{M.forEachGlyphset(e,!0)},this.forEachPointset=e=>{M.forEachPointset(e,!0)},this.forEachLine=e=>{M.forEachLine(e,!0)},this.findGeometriesWithGroupName=e=>M.findGeometriesWithGroupName(e,!0),this.findPointsetsWithGroupName=e=>M.findPointsetsWithGroupName(e,!0),this.findGlyphsetsWithGroupName=e=>M.findGlyphsetsWithGroupName(e,!0),this.findLinesWithGroupName=e=>M.findLinesWithGroupName(e,!0),this.findObjectsWithGroupName=e=>M.findObjectsWithGroupName(e,!0),this.findObjectsWithAnatomicalId=e=>M.findObjectsWithAnatomicalId(e,!0),this.getBoundingBoxOfZincObjects=e=>{for(var t,r=void 0,i=0;i<e.length;i++)(t=e[i].getBoundingBox())&&(r?r.union(t):r=t);return r},this.vectorToScreenXY=e=>{e.project(this.camera);var t=B()/2,r=U()/2;return e.x=e.x*t+t,e.y=-e.y*r+r,e},this.getObjectsScreenXY=e=>{if(e&&0<e.length){var t=this.getBoundingBoxOfZincObjects(e),r=new i.Vector3;return t.getCenter(r),this.vectorToScreenXY(r)}},this.getNamedObjectsScreenXY=e=>{var t=this.findObjectsWithGroupName(e);return this.getObjectsScreenXY(t)},this.addZincObject=e=>{e&&(M.addZincObject(e),E&&E.calculateMaxAllowedDistance(this))},this.loadGlyphsetURL=(e,t,r,i)=>{f.loadGlyphsetURL(M,e,t,r,i)},this.loadPointsetURL=(e,t,r,i,n)=>{f.loadPointsetURL(M,e,t,r,i,n)},this.loadLinesURL=(e,t,r,i,n)=>{f.loadLinesURL(M,e,t,r,i,n)},this.loadSTL=(e,t,r)=>{f.loadSTL(M,e,t,r)},this.loadOBJ=(e,t,r)=>{f.loadOBJ(M,e,t,r)},this.loadMetadataURL=(e,t,r,i)=>{f.loadMetadataURL(M,e,t,r,i)},this.loadModelsURL=(e,t,r,i,n,a)=>{f.loadModelsURL(M.urls,t,r,i,n,a)},this.loadViewURL=e=>{f.loadViewURL(e)},this.loadFromViewURL=(e,t)=>{f.loadFromViewURL(e,t)},this.loadGLTF=(e,t,r,i)=>{f.loadGLTF(M,e,t,r,i)},this.updateDirectionalLight=()=>{E.updateDirectionalLight()},this.addObject=e=>{w.add(e)},this.removeObject=e=>{w.remove(e)},this.getCurrentTime=()=>{if(null!=m)return m.getCurrentTime(T);var e=M.getCurrentTime();return-1===e?0:e},this.setMorphsTime=e=>{null!=m&&m.setMorphTime(e,T),M.setMorphTime(e,!0)},this.isTimeVarying=()=>!(!m||!m.video||m.video.error)||M.isTimeVarying(),this.renderGeometries=(e,t,r)=>{var i={};if(i.camera=E,i.displayMarkers=this.displayMarkers,i.markerCluster=O,i.markersList=O.markers,i.ndcToBeUpdated=!1,r&&(i.markerCluster.markerUpdateRequired=!0),m)if(m.isReadyToPlay()){r?m.video.play():m.video.pause();var n=m.video.currentTime/m.getVideoDuration()*T;0==f.toBeDownloaded?(E.setTime(n),i.ndcToBeUpdated=E.update(0),i.ndcToBeUpdated&&E.calculateHeightPerPixelAtZeroDepth(U()),M.setMorphTime(n,!0),M.renderGeometries(0,0,r,E,i,!0)):E.update(0)}else myPlayRate=0;else 0==f.toBeDownloaded?(i.ndcToBeUpdated=E.update(t),i.ndcToBeUpdated&&E.calculateHeightPerPixelAtZeroDepth(U()),M.renderGeometries(e,t,r,E,i,!0)):E.update(0)},this.getThreeJSScene=()=>w,this.setVideoHandler=e=>{m||(m=e)},this.setAdditionalScenesGroup=e=>{w.add(e)};var z=e=>{var t,r,i,n,a,s,o,l;(this.displayMinimap||this.displayMiniAxes)&&(e.setScissorTest(!0),e.getSize(P),this.minimapScissor.updateRequired&&(t=this.minimapScissor.align,r=this.minimapScissor.x_offset,i=this.minimapScissor.y_offset,n=this.minimapScissor.width,a=this.minimapScissor.height,s=P.x,o=P.y,l=t.includes("top")?o-a-i:t.includes("bottom")?i:Math.floor((o-a)/2),R={x:t.includes("left")?r:t.includes("right")?s-r-n:Math.floor((s-n)/2),y:l},this.minimapScissor.updateRequired=!1),e.setScissor(R.x,R.y,this.minimapScissor.width,this.minimapScissor.height),e.setViewport(R.x,R.y,this.minimapScissor.width,this.minimapScissor.height),v.updateCamera(),this.displayMiniAxes?e.render(_,v.camera):(w.add(v.mask),e.render(w,v.camera),w.remove(v.mask)),e.setScissorTest(!1),e.setViewport(0,0,P.x,P.y))};this.render=e=>{this.autoClearFlag&&e.clear(),A&&L?L.render(w,this.camera):(e.render(w,this.camera),z(e))},this.setInteractiveControlEnable=e=>{1==e?E.enable():E.disable()},this.getZincCameraControls=()=>E,this.getThreeJSScene=()=>w,this.setDuration=e=>{M.setDuration(e),T=e,E.setPathDuration(e),f.duration=e},this.getDuration=()=>T,this.setStereoEffectEnable=e=>{1!=e||L||(L=new r(701).StereoEffect(t)),t.setSize(B(),U()),this.camera.updateProjectionMatrix(),A=e},this.objectIsInScene=e=>M.objectIsInRegion(e,!0),this.alignBoundingBoxToCameraView=(e,t)=>{if(e){e.getCenter(N);var r=this.getZincCameraControls().getCurrentViewport(),n=new i.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),a=new i.Vector3(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),s=new i.Vector3,o=new i.Vector3;s.subVectors(n,a).normalize(),o.subVectors(n,N).normalize();var l=new i.Vector3;l.crossVectors(s,o);var h=s.angleTo(o);0<t?(this.getZincCameraControls().rotateCameraTransition(l,h,t),this.getZincCameraControls().enableCameraTransition()):this.getZincCameraControls().rotateAboutLookAtpoint(l,h),O.markerUpdateRequired=!0}},this.translateBoundingBoxToCameraView=(e,t,r)=>{if(e){var i=this.getZincCameraControls().getCurrentViewport(),n=this.getZincCameraControls().getViewportFromBoundingBox(e,t);0<r&&(this.getZincCameraControls().cameraTransition(i,n,r),this.getZincCameraControls().enableCameraTransition()),O.markerUpdateRequired=!0}},this.alignObjectToCameraView=(e,t)=>{if(this.objectIsInScene(e)){var r=e.getBoundingBox();this.alignBoundingBoxToCameraView(r,t)}},this.setCameraTargetToObject=e=>{if(this.objectIsInScene(e)){var t=e.getBoundingBox(),r=this.getZincCameraControls().getCurrentViewport();t.getCenter(N);var n=new i.Vector3(r.targetPosition[0],r.targetPosition[1],r.targetPosition[2]),a=new i.Vector3(r.eyePosition[0],r.eyePosition[1],r.eyePosition[2]),s=new i.Vector3,o=new i.Vector3;s.subVectors(a,n),o.addVectors(N,s),r.eyePosition[0]=o.x,r.eyePosition[1]=o.y,r.eyePosition[2]=o.z,r.targetPosition[0]=N.x,r.targetPosition[1]=N.y,r.targetPosition[2]=N.z,this.getZincCameraControls().setCurrentCameraSettings(r),O.markerUpdateRequired=!0}},this.isStereoEffectEnable=()=>A,this.removeZincObject=e=>{M.removeZincObject(e),E&&E.calculateMaxAllowedDistance(this),O.markerUpdateRequired=!0},this.updatePickableThreeJSObjects=()=>{I.length=0,O.isEnabled&&I.push(O.group),M.getPickableThreeJSObjects(I,!0),this.forcePickableObjectsUpdate=!1},this.getPickableThreeJSObjects=()=>((this.forcePickableObjectsUpdate||M.checkPickableUpdateRequred(!0))&&this.updatePickableThreeJSObjects(),I),this.getNormalisedMinimapCoordinates=(e,t)=>{if(this.displayMinimap){var r=new i.Vector2;e.getSize(r);var n=r.y-t.clientY;if(R.x+this.minimapScissor.width>t.clientX&&t.clientX>R.x&&R.y+this.minimapScissor.height>n&&n>R.y)return{x:(t.clientX-R.x)/this.minimapScissor.width*2-1,y:(n-R.y)/this.minimapScissor.height*2-1}}},this.getMinimapDiffFromNormalised=(e,t)=>v?v.getDiffFromNormalised(e,t):void 0,this.isWebGL2=()=>t.isWebGL2(),this.clearAll=()=>{O.clear(),M.clear(!0),this.clearZincObjectAddedCallbacks(),this.clearZincObjectRemovedCallbacks(),f.toBeDwonloaded=0,E&&E.calculateMaxAllowedDistance(this),O.markerUpdateRequired=!0},this.addMetadataTimeStamp=(e,t)=>{C.TimeStamps[e]=G(t)},this.getMetadataTag=e=>C[e],this.getMetadata=()=>C,this.setMetadataTag=(e,t)=>{C[e]=t},this.removeMetadataTag=e=>{delete C[e]},this.resetMetadata=()=>{C={Duration:"6 secs",OriginalDuration:"-",TimeStamps:{}}},this.resetDuration=()=>{this.setDuration(6e3)};var F=e=>[...e.years?["".concat(e.years,"years")]:[],...e.months?["".concat(e.months,"months")]:[],...e.weeks?["".concat(e.weeks,"weeks")]:[],...e.days?["".concat(e.days,"days")]:[],...e.hours?["".concat(e.hours,"hours")]:[],...e.mins?["".concat(e.mins,"mins")]:[],...e.secs?["".concat(e.secs,"secs")]:[]].join(" "),G=e=>e.years?31536e6*e.years:0+e.months?2592e6*e.months:0+e.weeks?6048e5*e.weeks:0+e.days?864e5*e.days:0+e.hours?36e5*e.hours:0+e.mins?6e4*e.mins:0+e.secs?1e3*e.secs:0;this.setDurationFromObject=e=>{var t=F(e),r=G(e);this.setMetadataTag("Duration",t),this.setDuration(r)},this.setOriginalDurationFromObject=e=>{var t=F(e);this.setMetadataTag("OriginalDuration",t)},this.exportGLTF=e=>new s(this).exportGLTF(e),this.getRootRegion=()=>M,this.createLines=(e,t,r,i)=>{var n=M.findChildFromPath(e);return void 0===n&&(n=M.createChildFromPath(e)),n.createLines(t,r,i)},this.createPoints=(e,t,r,i,n)=>{var a=M.findChildFromPath(e);return void 0===a&&(a=M.createChildFromPath(e)),a.createPoints(t,r,i,n)},this.addZincObjectAddedCallbacks=e=>(++y,g[y]=e,y),this.addZincObjectRemovedCallbacks=e=>(++b,x[b]=e,b),this.removeZincObjectAddedCallbacks=e=>{e in y&&delete g[e]},this.removeZincObjectRemovedCallbacks=e=>{e in b&&delete x[e]},this.clearZincObjectAddedCallbacks=()=>{g={},y=0},this.clearZincObjectRemovedCallbacks=()=>{x={},b=0},this.triggerObjectAddedCallback=e=>{for(var t in g)g.hasOwnProperty(t)&&g[t](e)},this.triggerObjectRemovedCallback=e=>{for(var t in x)x.hasOwnProperty(t)&&x[t](e)},this.addTemporaryPoints=(e,t)=>{var n=l(e.length,e),a=new i.PointsMaterial({alphaTest:.5,size:15,color:t,sizeAttenuation:!1}),s=h();a.map=s;var o=new(r(377).O)(n,a);return S.add(o),o},this.addTemporaryLines=(e,t)=>{var n=l(e.length,e),a=new i.LineBasicMaterial({color:t}),s=new(r(1491).D)(n,a);return S.add(s),s},this.removeTemporaryPrimitive=e=>{S.remove(e),e.geometry.dispose(),e.material.dispose()},this.clearTemporaryPrimitives=()=>{var e=0;return S.children.forEach((t=>{t.geometry.dispose(),t.material.dispose(),e++})),S.clear(),e},this.addBoundingBoxPrimitive=function(e,t,r,n,a){var s=5<arguments.length&&void 0!==arguments[5]?arguments[5]:void 0,o=M.findChildFromPath(e);void 0===o&&(o=M.createChildFromPath(e));var l=s||d.getBoundingBox();N.set(0,0,0);var h=N.subVectors(l.max,l.min),c=new i.BoxGeometry(h.x,h.y,h.z),u=o.createGeometryFromThreeJSGeometry(t,c,r,n,a,1e4);return h.addVectors(l.min,l.max).multiplyScalar(.5),u.setPosition(h.x,h.y,h.z),u},this.addSlicesPrimitive=function(e,t,r,n,a){var s=5<arguments.length&&void 0!==arguments[5]?arguments[5]:void 0;if(t&&3<=t.length&&r&&3<=r.length){var o=M.findChildFromPath(e);void 0===o&&(o=M.createChildFromPath(e));var l=s||d.getBoundingBox();N.set(0,0,0);var h=N.subVectors(l.max,l.min),c=[],u=0;return["x","y","z"].forEach((e=>{var s;switch(e){case"x":(s=new i.PlaneGeometry(h.z,h.y)).rotateY(Math.PI/2);break;case"y":(s=new i.PlaneGeometry(h.x,h.z)).rotateX(Math.PI/2);break;case"z":s=new i.PlaneGeometry(h.x,h.y)}var l=o.createGeometryFromThreeJSGeometry(t[u],s,r[u],n,a,10001);c.push(l),u++})),h.addVectors(l.min,l.max).multiplyScalar(.5),c.forEach((e=>{e.setPosition(h.x,h.y,h.z)})),c}},this.enableMarkerCluster=e=>{e?(O.markerUpdateRequired=!0,O.enable()):(O.markerUpdateRequired=!1,O.disable()),this.forcePickableObjectsUpdate=!0},this.destroyAxisDisplay=()=>{this.displayMiniAxes=!1,D.main&&(this.enableAxisDisplay(!1,!1),D.main.forEach((e=>{e.dispose&&e.dispose()}))),D.mini&&(this.enableAxisDisplay(!1,!0),D.mini.forEach((e=>{e.dispose&&e.dispose()}))),D={main:[],mini:[]}},this.createAxisDisplay=function(){var e=!!(0<arguments.length&&void 0!==arguments[0])&&arguments[0];d.destroyAxisDisplay();var t=[{name:"x",dir:new i.Vector3(1,0,0),colour:"red",hex:16733525},{name:"y",dir:new i.Vector3(0,1,0),colour:"green",hex:5635925},{name:"z",dir:new i.Vector3(0,0,1),colour:"blue",hex:5592575}],r=d.getBoundingBox(),n=r.min.distanceTo(r.max),a=new i.Vector3(0,0,0);e&&a.copy(r.min),t.forEach((e=>{var t=new i.ArrowHelper(e.dir,a,n,e.hex);D.main.push(t);var s=new i.ArrowHelper(e.dir,r.getCenter(N),n/2,e.hex);D.mini.push(s);var o=c(e.name,.036,e.colour,"Asap",120,700),l=e.dir.clone().multiplyScalar(n).add(a);o.position.set(l.x,l.y,l.z),D.main.push(o)}))},this.enableAxisDisplay=function(e){var t,r=!!(1<arguments.length&&void 0!==arguments[1])&&arguments[1];r&&null!==(t=D)&&void 0!==t&&null!==(t=t.mini)&&void 0!==t&&t.length?(d.displayMiniAxes=e,D.mini.forEach((t=>{e?_.add(t):_.remove(t)}))):!r&&D.main&&D.main.forEach((t=>{e?w.add(t):w.remove(t)}))}}},3778:(e,t,r)=>{var i=r(370).r;t.O=function(e){var t=e;this.exportGLTF=e=>{var r=t.getRootRegion().getAllObjects(!0),n=[];r.forEach((e=>{e.animationClip&&n.push({clip:e.animationClip[0],mesh:e.getMorph()})}));var a=new i,s={binary:e,animations:n};return new Promise((e=>{a.parse(t.getThreeJSScene(),(function(t){e(t)}),s)}))}}},6264:(e,t,r)=>{var i=r(1515),n=r(2515).resolveURL,a=r(2515).createNewURL,s=r(2515).isRegionGroup,o=r(7270).t,l=r(654).L,h=r(1915)._;t.c=function(e){var t=e;this.toBeDownloaded=0,this.progressMap={};var c=!1,u=!1,d=new h;this.getDownloadProgress=()=>{var e=0,t=0,r=!1;for(var i in this.progressMap){var n=this.progressMap[i];e+=n[1],t+=n[0],0==n[1]&&(r=!0)}return r&&(e=0),[e,t,u]},this.onProgress=e=>t=>{this.progressMap[e]=[t.loaded,t.total]},this.onError=e=>t=>{--this.toBeDownloaded,u=!0,console.error("There is an issue with external resource ".concat(null!=t&&t.responseURL?": "+(null==t?void 0:t.responseURL):"",".")),e&&e({type:"Error",xhr:t})},this.loadViewURL=(e,r)=>{this.toBeDownloaded+=1;var i=new XMLHttpRequest;i.onreadystatechange=()=>{if(4==i.readyState)if(200==i.status){var n=JSON.parse(i.responseText);t.setupMultipleViews("default",{default:n}),t.resetView(),c=!0,--this.toBeDownloaded,null!=r&&"function"==typeof r&&r()}else this.onError(r)({responseURL:e})};var a=n(e);i.open("GET",a,!0),i.send()},this.loadModelsURL=(e,t,i,a,s,o,l)=>{var h=t.length;this.toBeDownloaded+=h;for(var c=0;c<h;c++){var u=t[c],p=r(1913).defaultMaterialColor,m=r(1913).defaultOpacity;null!=i&&null!=i[c]&&(p=!!i[c]),null!=a&&null!=a[c]&&(m=a[c]);var f=0;null!=s&&null!=s[c]&&(f=!!s[c]);var v=0;null!=o&&null!=o[c]&&(v=!!o[c]),d.load(n(u),x(e,p,m,f,v,void 0,void 0,void 0,void 0,l),this.onProgress(u),this.onError(l))}},this.loadFromViewURL=(e,r,i)=>{var a=new XMLHttpRequest;a.onreadystatechange=()=>{if(4==a.readyState&&200==a.status){var n=JSON.parse(a.responseText);t.loadView(n);for(var s,o=[],l=r+"_",h=0;h<n.numberOfResources;h++)s=l+(h+1)+".json",o.push(s);this.loadModelsURL(e,o,n.colour,n.opacity,n.timeEnabled,n.morphColour,i)}};var s=n(r+"_view.json");a.open("GET",s,!0),a.send()};var p=(e,n,a,s,o,l,h,c)=>(u,p)=>{var m=new(r(8145).q),f=void 0;p&&p[0]&&(f=new i.LineBasicMaterial({color:p[0].color.clone()}),1>p[0].opacity&&(f.transparent=!0),f.opacity=p[0].opacity,f.morphTargets=n,f.vertexColors=p[0].vertexColors);var v={localTimeEnabled:n,localMorphColour:a};if(m&&(m.createLineSegment(u,f,v),m.setName(s),m.setAnatomicalId(o),m.setRenderOrder(l),e.addZincObject(m),m.setDuration(t.getDuration()),h&&h.levels))for(var[g,y]of Object.entries(h.levels))m.addLOD(d,g,y.URL,y.Index,h.preload);--this.toBeDownloaded,u.dispose(),null!=c&&"function"==typeof c&&c(m)};this.loadLinesURL=(e,t,r,i,n,a,s)=>{var o=0;this.toBeDownloaded+=1;var l=!(!s||!s.isInline)&&s.isInline,h=s&&s.anatomicalId?s.anatomicalId:void 0,c=s&&s.renderOrder?s.renderOrder:void 0;null!=r&&(o=!!r);var u=0;if(null!=i&&(u=!!i),l){var m=d.parse(t);p(e,o,u,n,h,c,s.lod,a)(m.geometry,m.materials)}else d.load(t,p(e,o,u,n,h,c,s.lod,a),this.onProgress(t),this.onError(a),s.loaderOptions)};var m=(e,i,a,s,o,l)=>{var h=l&&l.isInline?l.isInline:void 0,c=l&&l.anatomicalId?l.anatomicalId:void 0,u=l&&l.displayLabels?l.displayLabels:void 0,d=l&&l.renderOrder?l.renderOrder:void 0,p=new(r(2842).V);p.setDuration(t.getDuration()),p.groupName=s;var m=()=>{--this.toBeDownloaded,null!=o&&"function"==typeof o&&o(p)};++this.toBeDownloaded,h?p.load(i,a,m,h,u):p.load(i,n(a),m,h,u),p.setAnatomicalId(c),p.setRenderOrder(d),e.addZincObject(p)},f=(e,n,a,s,o,l,h)=>(c,u)=>{var d=new(r(770).t),p=new i.PointsMaterial({alphaTest:.5,size:10,sizeAttenuation:!1});u&&u[0]&&(1>u[0].opacity&&(p.transparent=!0),p.opacity=u[0].opacity,p.color=u[0].color,p.morphTargets=n,p.vertexColors=u[0].vertexColors);var m={};m.localTimeEnabled=n,m.localMorphColour=a,d&&(d.createMesh(c,p,m),d.setName(s),d.setAnatomicalId(o),e.addZincObject(d),d.setDuration(t.getDuration()),d.setRenderOrder(l)),c.dispose(),--this.toBeDownloaded,null!=h&&"function"==typeof h&&h(d)};this.loadSTL=(e,t,i,a)=>{this.toBeDownloaded+=1;var s=r(1913).defaultMaterialColor,l=r(1913).defaultOpacity,h=new o;h.crossOrigin="Anonymous",h.load(n(t),x(e,s,l,!1,!1,i,void 0,void 0,void 0,a))},this.loadOBJ=(e,t,i,a)=>{this.toBeDownloaded+=1;var s=r(1913).defaultMaterialColor,o=r(1913).defaultOpacity,h=new l;h.crossOrigin="Anonymous",h.load(n(t),x(e,s,o,!1,!1,i,void 0,void 0,void 0,a))};var v=(e,t,i,n,a,s,h)=>{this.toBeDownloaded+=1;var c=r(1913).defaultMaterialColor,u=r(1913).defaultOpacity,p=0,m=!(!h||!h.isInline)&&h.isInline,f=h&&h.fileFormat?h.fileFormat:void 0,v=h&&h.anatomicalId?h.anatomicalId:void 0,g=h&&h.renderOrder?h.renderOrder:void 0;null!=i&&(p=!!i);var y=0;null!=n&&(y=!!n);var b=d;if(void 0!==f)if("STL"==f)b=new o;else if("OBJ"==f)return(b=new l).crossOrigin="Anonymous",void b.load(t,objloader(e,c,u,p,y,a,v,s),this.onProgress(t),this.onError,h.loaderOptions);if(m){var w=d.parse(t);x(e,c,u,p,y,a,v,g,h,s)(w.geometry,w.materials)}else b.crossOrigin="Anonymous",d.load(t,x(e,c,u,p,y,a,v,g,h,s),this.onProgress(t),this.onError(s),h.loaderOptions)},g=function(e,r,i){var n=0;return a=>{if(++n,a&&null!=r&&"function"==typeof r&&r(a),n==e&&(0==c&&t.viewAll(),null!=i&&"function"==typeof i)){i();var s=t.getZincCameraControls();s&&s.calculateMaxAllowedDistance(t)}}};this.loadPointsetURL=(e,t,r,i,n,a,s)=>{var o=0;this.toBeDownloaded+=1,null!=r&&(o=!!r);var l=0;null!=i&&(l=!!i);var h=!(!s||!s.isInline)&&s.isInline,c=s&&s.anatomicalId?s.anatomicalId:void 0,u=s&&s.renderOrder?s.renderOrder:void 0;if(h){var p=d.parse(t);f(e,o,l,n,c,u,a)(p.geometry,p.materials)}else d.load(t,f(e,o,l,n,c,u,a),this.onProgress(t),this.onError(a),s.loaderOptions)};var y=(e,t,i,n,s,o)=>{var l=o&&o.isInline?o.isInline:void 0,h=o&&o.anatomicalId?o.anatomicalId:void 0,c=o&&o.renderOrder?o.renderOrder:void 0,u=void 0;if(i){if(t&&i.images&&i.images.source)for(var d,p=i.images.source,m=0;m<p.length;m++)d=a(p[m],t),i.images.source[m]=d;"slides"===i.type&&(u=new(r(4291).W)),u&&(u.groupName=n,++this.toBeDownloaded,u.load(i,(()=>{--this.toBeDownloaded,null!=s&&"function"==typeof s&&s(u)}),l),u.setAnatomicalId(h),u.setRenderOrder(c),e.addZincObject(u))}};this.loadTextureURL=(e,t,r,i,a)=>{if(a&&a.isInline&&a.isInline)y(e,void 0,t,r,i,a);else{var s=new XMLHttpRequest;s.onreadystatechange=((e,t,r,i,n)=>()=>{if(4==t.readyState&&200==t.status){var a=JSON.parse(t.responseText);y(e,t.responseURL,a,r,i,n)}})(e,s,r,i,a),s.open("GET",n(t),!0),s.send()}},this.loadGlyphsetURL=(e,t,r,i,a,s)=>{if(s&&s.isInline&&s.isInline)m(e,t,r,i,a,s);else{var o=new XMLHttpRequest;o.onreadystatechange=((e,t,r,i,n,a)=>()=>{if(4==t.readyState&&200==t.status){var s=JSON.parse(t.responseText);m(e,s,r,i,n,a)}})(e,o,r,i,a,s),o.open("GET",n(t),!0),o.send()}};var x=(e,i,n,a,s,o,l,h,c,u)=>(p,m)=>{var f;m&&m[0]&&(f=m[0]);var v=((e,i,n,a,s,o,l,h,c,u,d)=>{var p={colour:n,opacity:a,localTimeEnabled:s,localMorphColour:o},m=new(r(5672).V);return m.createMesh(i,h,p),m.getMorph()?(m.setName(c),m.setRenderOrder(u),m.setAnatomicalId(d),e&&e.addZincObject(m),m.setDuration(t.getDuration()),m.videoHandler&&t.setVideoHandler(m.videoHandler),m):void 0})(e,p,i,n,a,s,0,f,o,h,l);if(c.lod&&c.lod.levels)for(var[g,y]of Object.entries(c.lod.levels))v.addLOD(d,g,y.URL,y.Index,c.lod.preload);--this.toBeDownloaded,p.dispose(),null!=u&&"function"==typeof u&&u(v)},b=e=>{var[,t,r,i,n,a,s,o]=e.match(/P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)W)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/);return{years:t,months:r,weeks:i,days:n,hours:a,mins:s,secs:o}};this.loadSettings=e=>{if(e){if(e.Duration){var r=b(e.Duration);t.setDurationFromObject(r)}if(e.OriginalDuration){var i=b(e.OriginalDuration);t.setOriginalDurationFromObject(i)}if(e.TimeStamps)for(var n in e.TimeStamps){var a=b(e.TimeStamps[n]);t.addMetadataTimeStamp(n,a)}}};var w=(e,t,r,i,n)=>{if(r){var s=void 0,o=!1;r.URL?(s=r.URL,t&&(s=a(s,t))):r.Inline&&(s=r.Inline.URL,o=!0);var l={};if(r.LOD&&r.LOD.Levels)for(var[h,c]of(l.preload=!!r.LOD.Preload,l.levels={},Object.entries(r.LOD.Levels)))l.levels[h]={},l.levels[h].URL=a(c.URL,t),l.levels[h].Index=c.Index;var u=r.GroupName;(void 0===u||""===u)&&(u="_Unnamed");var d={loaderOptions:{index:r.Index},isInline:o,fileFormat:r.FileFormat,anatomicalId:r.AnatomicalId,compression:r.compression,lod:l,renderOrder:i};switch(r.Type){case"Surfaces":v(e,s,r.MorphVertices,r.MorphColours,u,n,d);break;case"Glyph":var p;o?p=r.Inline.GlyphGeometriesURL:(p=r.GlyphGeometriesURL,p=a(r.GlyphGeometriesURL,t)),r.DisplayLabels&&(d.displayLabels=!0),this.loadGlyphsetURL(e,s,p,u,n,d);break;case"Points":this.loadPointsetURL(e,s,r.MorphVertices,r.MorphColours,u,n,d);break;case"Lines":this.loadLinesURL(e,s,r.MorphVertices,r.MorphColours,u,n,d);break;case"Texture":this.loadTextureURL(e,s,u,n,d)}}},_=(e,r,i)=>{if(r){var n=void 0,s=!1;switch(r.URL?(n=r.URL,e&&(n=a(r.URL,e))):r.Inline&&(n=r.Inline.URL,s=!0),r.Type){case"View":s?(t.setupMultipleViews("default",{default:n}),c=!0,null!=i&&"function"==typeof i&&i()):this.loadViewURL(n,i);break;case"Settings":this.loadSettings(r)}}};this.loadGLTF=(e,i,n,a,s)=>{(new(r(5576).H)).load(t,e,i,n,a,s)};var M=(e,t,r,i)=>{if(r.Primitives&&r.Primitives.forEach((r=>{var n=1;r.Order&&(n=r.Order),w(e,t,r,n,i)})),r.Transformation&&e.setTransformation(r.Transformation),r.Children)for(var[n,a]of Object.entries(r.Children)){var s=e.findOrCreateChildFromPath(n);s&&M(s,t,a,i)}},S=(e,t)=>{if(Array.isArray(e)){for(var r=0,i=0;i<e.length;i++)e[i].Type&&(t&&"View"===e[i].Type||"Surfaces"===e[i].Type||"Glyph"===e[i].Type||"Points"===e[i].Type||"Lines"===e[i].Type||"Texture"===e[i].Type)&&r++;return r}return 0},T=e=>{var t=e.Primitives?S(e.Primitives,!1):0;return e.Children&&Object.values(e.Children).forEach((e=>{t+=T(e)})),t},E=e=>Array.isArray(e)?S(e,!0):"object"==typeof e&&null!==e&&"2.0"===e.Version?T(e.Regions):void 0,A=(e,t,r,i,n)=>{var a=e;r.RegionPath&&""!==r.RegionPath&&(a=e.findOrCreateChildFromPath(r.RegionPath)),w(a,t,r,2*i,n)},L=(e,r,i,n,s)=>{var o=E(r),l=new g(o,n,s);r.Settings&&this.loadSettings(r.Settings),r.Views&&((e,r)=>{var i=r.Default;if(r.Inline)t.setupMultipleViews(i,r.Entries);else{var n=[],s=function(t){e&&(newURL=a(l,e),n.push(new Promise(((e,r)=>{fetch(newURL).then((e=>e.json())).then((r=>e({key:t,data:r}))).catch((e=>r(e)))}))))};for(var[o,l]of Object.entries(r.Entries))s(o);Promise.all(n).then((e=>{var r={};e.forEach((e=>{r[e.key]=e.data})),t.setupMultipleViews(i,r);var n=t.getZincCameraControls();n&&n.setCurrentViewport(i),c=!0}))}})(i,r.Views),r.Regions&&M(e,i,r.Regions,l)};this.loadMetadataURL=(e,r,i,a,o)=>{var l=new XMLHttpRequest,h=n(r);l.onreadystatechange=()=>{if(4==l.readyState&&200==l.status){t.resetMetadata(),t.resetDuration(),c=!1;var r=l.responseURL;void 0===r&&(r=new URL(h).href);var n=JSON.parse(l.responseText);Array.isArray(n)?((e,t,r,i,n,a)=>{for(var o=((e,t)=>Array.isArray(e)?((e,t)=>{var r,i,n=e,a=null==t||null===(r=t.enabled)||void 0===r?void 0:r.include,o=null==t||null===(i=t.enabled)||void 0===i?void 0:i.exclude;return(null!=a&&a.length||null!=o&&o.length)&&(a&&(n=e.filter((e=>{if("View"===e.Type)return!0;for(var t=0;t<a.length;t++)if(s(e.RegionPath,e.GroupName,a[t]))return!0;return!1}))),o&&(n=n.filter((e=>{if("View"===e.Type)return!0;for(var t=0;t<o.length;t++)if(s(e.RegionPath,e.GroupName,o[t]))return!1;return!0})))),n})(e,t):e)(t,a),l=E(o),h=new g(l,i,n),c=0;c<t.length;c++)_(r,o[c],h);for(var u=0;u<t.length;u++)A(e,r,o[u],u,h)})(e,n,r,i,a,o):"object"==typeof n&&null!==n&&"2.0"==n.Version&&L(e,n,r,i,a)}},l.open("GET",h,!0),l.send()}}},8612:(e,t,r)=>{var i=r(1515),n=i.GLSL3;t.fs="\nprecision highp float;\nprecision highp int;\nprecision highp sampler2DArray;\n\nuniform sampler2DArray diffuse;\nuniform bool discardAlpha;\nin vec3 vUw;\n\nout vec4 outColor;\n\nvoid main() {\n\n vec4 color = texture( diffuse, vUw );\n\n // lighten a bit\n if (discardAlpha && color.a == 0.0) discard;\n\n outColor = vec4( color.rgba );\n\n}\n",t.vs="\nout vec3 vUw;\nuniform float depth;\nuniform vec3 slide;\nuniform int direction;\nuniform bool flipY;\n\nvoid main() {\n\n vec3 slidePos = position.xyz;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position.xyz, 1.0 );\n\n if (direction == 1)\n slidePos = vec3(slide.x, position.y, position.x);\n if (direction == 2)\n slidePos = vec3(position.x, slide.y, position.y);\n if (direction == 3)\n slidePos = vec3(position.x, position.y, slide.z);\n\n if (flipY) \n slidePos.y = 1.0 - slidePos.y;\n\n vUw.xyz = vec3(slidePos.x, slidePos.y, slidePos.z * depth);\n\n}\n",t.glslVersion=n,t.getUniforms=function(){return{diffuse:{value:void 0},depth:{value:1},slide:{value:new i.Vector3(0,0,1)},direction:{value:1},flipY:{value:!0},discardAlpha:{value:!0}}}},1860:(e,t,r)=>{function i(e,t,r,i,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(i,n)}function n(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){function s(e){i(l,n,a,s,o,"next",e)}function o(e){i(l,n,a,s,o,"throw",e)}var l=e.apply(t,r);s(void 0)}))}}var a=r(1515),s=function(){this.isTexture=!0,this.impl=void 0,this.isLoading=!1,this.size={width:1,height:1,depth:0}};s.prototype.loadImage=function(e,t){return new Promise(((r,i)=>{e.onload=()=>r(e),e.onerror=i,e.src=t}))},s.prototype.imageToUint8Array=function(){var e=n((function*(e,t,r,i){yield e.loadImage(t,r),i.width=t.width,i.height=t.height;var n=i.getContext("2d");return n.drawImage(t,0,0),{array:new Uint8Array(n.getImageData(0,0,i.width,i.height).data.buffer),width:i.width,height:i.height}}));return function(){return e.apply(this,arguments)}}(),s.prototype.loadFromImages=function(){var e=n((function*(){}));return function(){return e.apply(this,arguments)}}(),s.prototype.isReady=function(){return!(!this.impl||this.isLoading)},s.prototype.getMaterial=function(){if(this.impl)return new a.MeshBasicMaterial({color:new a.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:a.DoubleSide})},t.g=s},3523:(e,t,r)=>{function i(e,t,r,i,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(i,n)}var n=r(1515),a=function(){var e=this;r(1860).g.call(this),this.isTextureArray=!0,this.loadFromImages=function(){var t,r=(t=function*(t){var r=1,i=1,a=0;if(t&&t.length){e.isLoading=!0;var s=new Image;s.crossOrigin="Anonymous";for(var o,l=document.createElement("canvas"),h=0,c=Array(t.length),u=0;u<t.length;u++)(o=yield e.imageToUint8Array(e,s,t[u],l))&&o.array&&(r=o.width,i=o.height,c[a]=o.array,h+=c[a].length,a++);var d=new Uint8Array(h);h=0,c.forEach((e=>{d.set(e,h),h+=e.length})),e.impl=new n.DataTexture2DArray(d,r,i,a),e.size={width:r,height:i,depth:a},e.isLoading=!1,e.impl.needsUpdate=!0}},function(){var e=this,r=arguments;return new Promise((function(n,a){function s(e){i(l,n,a,s,o,"next",e)}function o(e){i(l,n,a,s,o,"throw",e)}var l=t.apply(e,r);s(void 0)}))});return function(){return r.apply(this,arguments)}}(),this.getMaterial=e=>{if(this.impl){var t;if(e){if(e.vs&&e.fs){var r=!0;"transparent"in e&&(r=e.transparent);var i=n.FrontSide;e.side&&(i=e.side),t=new n.ShaderMaterial({transparent:r,uniforms:e.uniforms,vertexShader:e.vs,fragmentShader:e.fs,side:i}),e.glslVersion&&(t.glslVersion=e.glslVersion)}}else t=new n.MeshBasicMaterial({color:new n.Color(1,1,1),transparent:!1,opacity:1,map:this.impl,side:n.DoubleSide});if(t)return t.needsUpdate=!0,t}}};a.prototype=Object.create(r(1860).g.prototype),t.$=a},6133:e=>{"use strict";e.exports=function(e){var t=function(r){var i,n,a,s,o,l,h,c=[];if(r.isBufferGeometry&&(r=(new e.Geometry).fromBufferGeometry(r)),r instanceof e.Geometry)this.matrix=new e.Matrix4;else{if(!r.isMesh){if(r instanceof t.Node)return this.tree=r,this.matrix=new e.Matrix4,this;throw"ThreeBSP: Given geometry is unsupported"}r.updateMatrix(),this.matrix=r.matrix.clone(),(r=r.geometry).isBufferGeometry&&(r=(new e.Geometry).fromBufferGeometry(r)),r.mergeVertices(),r.computeVertexNormals(!1)}for(i=0,n=r.faces.length;i<n;i++)a=r.faces[i],o=r.faceVertexUvs[0][i],h=new t.Polygon,a instanceof e.Face3?(s=r.vertices[a.a],l=o?new e.Vector2(o[0].x,o[0].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[0],l)).applyMatrix4(this.matrix),h.vertices.push(s),s=r.vertices[a.b],l=o?new e.Vector2(o[1].x,o[1].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[2],l)).applyMatrix4(this.matrix),h.vertices.push(s),s=r.vertices[a.c],l=o?new e.Vector2(o[2].x,o[2].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[2],l)).applyMatrix4(this.matrix),h.vertices.push(s)):(e.Face4,s=r.vertices[a.a],l=o?new e.Vector2(o[0].x,o[0].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[0],l)).applyMatrix4(this.matrix),h.vertices.push(s),s=r.vertices[a.b],l=o?new e.Vector2(o[1].x,o[1].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[1],l)).applyMatrix4(this.matrix),h.vertices.push(s),s=r.vertices[a.c],l=o?new e.Vector2(o[2].x,o[2].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[2],l)).applyMatrix4(this.matrix),h.vertices.push(s),s=r.vertices[a.d],l=o?new e.Vector2(o[3].x,o[3].y):null,(s=new t.Vertex(s.x,s.y,s.z,a.vertexNormals[3],l)).applyMatrix4(this.matrix),h.vertices.push(s)),h.calculateProperties(),c.push(h);this.tree=new t.Node(c)};return t.prototype.subtract=function(e){var r=this.tree.clone(),i=e.tree.clone();return r.invert(),r.clipTo(i),i.clipTo(r),i.invert(),i.clipTo(r),i.invert(),r.build(i.allPolygons()),r.invert(),(r=new t(r)).matrix=this.matrix,r},t.prototype.union=function(e){var r=this.tree.clone(),i=e.tree.clone();return r.clipTo(i),i.clipTo(r),i.invert(),i.clipTo(r),i.invert(),r.build(i.allPolygons()),(r=new t(r)).matrix=this.matrix,r},t.prototype.intersect=function(e){var r=this.tree.clone(),i=e.tree.clone();return r.invert(),i.clipTo(r),i.invert(),r.clipTo(i),i.clipTo(r),r.build(i.allPolygons()),r.invert(),(r=new t(r)).matrix=this.matrix,r},t.prototype.toGeometry=function(){var t,r,i,n,a,s,o,l,h,c,u=(new e.Matrix4).getInverse(this.matrix),d=new e.Geometry,p=this.tree.allPolygons(),m=p.length,f={};for(t=0;t<m;t++)for(n=(i=p[t]).vertices.length,r=2;r<n;r++)c=[],l=i.vertices[0],c.push(new e.Vector2(l.uv.x,l.uv.y)),(l=new e.Vector3(l.x,l.y,l.z)).applyMatrix4(u),void 0===f[l.x+","+l.y+","+l.z]?(d.vertices.push(l),a=f[l.x+","+l.y+","+l.z]=d.vertices.length-1):a=f[l.x+","+l.y+","+l.z],l=i.vertices[r-1],c.push(new e.Vector2(l.uv.x,l.uv.y)),(l=new e.Vector3(l.x,l.y,l.z)).applyMatrix4(u),void 0===f[l.x+","+l.y+","+l.z]?(d.vertices.push(l),s=f[l.x+","+l.y+","+l.z]=d.vertices.length-1):s=f[l.x+","+l.y+","+l.z],l=i.vertices[r],c.push(new e.Vector2(l.uv.x,l.uv.y)),(l=new e.Vector3(l.x,l.y,l.z)).applyMatrix4(u),void 0===f[l.x+","+l.y+","+l.z]?(d.vertices.push(l),o=f[l.x+","+l.y+","+l.z]=d.vertices.length-1):o=f[l.x+","+l.y+","+l.z],h=new e.Face3(a,s,o,new e.Vector3(i.normal.x,i.normal.y,i.normal.z)),d.faces.push(h),d.faceVertexUvs[0].push(c);return d},t.prototype.toBufferGeometry=function(){var t=this.toGeometry();return(new e.BufferGeometry).fromGeometry(t)},t.prototype.toMesh=function(t){var r=this.toBufferGeometry(),i=new e.Mesh(r,t);return i.position.setFromMatrixPosition(this.matrix),i.rotation.setFromRotationMatrix(this.matrix),i},t.Polygon=function(e){e instanceof Array||(e=[]),this.vertices=e,0<e.length?this.calculateProperties():this.normal=this.w=void 0},t.Polygon.prototype.calculateProperties=function(){var e=this.vertices[0],t=this.vertices[1],r=this.vertices[2];return this.normal=t.clone().subtract(e).cross(r.clone().subtract(e)).normalize(),this.w=this.normal.clone().dot(e),this},t.Polygon.prototype.clone=function(){var e,r,i=new t.Polygon;for(e=0,r=this.vertices.length;e<r;e++)i.vertices.push(this.vertices[e].clone());return i.calculateProperties(),i},t.Polygon.prototype.flip=function(){var e,t=[];for(this.normal.multiplyScalar(-1),this.w*=-1,e=this.vertices.length-1;0<=e;e--)t.push(this.vertices[e]);return this.vertices=t,this},t.Polygon.prototype.classifyVertex=function(e){var t=this.normal.dot(e)-this.w;return t<-1e-5?2:t>1e-5?1:0},t.Polygon.prototype.classifySide=function(e){var t,r,i,n=0,a=0,s=e.vertices.length;for(t=0;t<s;t++)r=e.vertices[t],1===(i=this.classifyVertex(r))?n++:2===i&&a++;return 0<n&&0===a?1:0===n&&0<a?2:0===n&&0===a?0:3},t.Polygon.prototype.splitPolygon=function(e,r,i,n,a){var s=this.classifySide(e);if(0===s)(0<this.normal.dot(e.normal)?r:i).push(e);else if(1===s)n.push(e);else if(2===s)a.push(e);else{var o,l,h,c,u,d,p,m,f,v=[],g=[];for(l=0,o=e.vertices.length;l<o;l++)h=(l+1)%o,d=e.vertices[l],p=e.vertices[h],c=this.classifyVertex(d),u=this.classifyVertex(p),2!=c&&v.push(d),1!=c&&g.push(d),3==(c|u)&&(m=(this.w-this.normal.dot(d))/this.normal.dot(p.clone().subtract(d)),f=d.interpolate(p,m),v.push(f),g.push(f));3<=v.length&&n.push(new t.Polygon(v).calculateProperties()),3<=g.length&&a.push(new t.Polygon(g).calculateProperties())}},t.Vertex=function(t,r,i,n,a){this.x=t,this.y=r,this.z=i,this.normal=n||new e.Vector3,this.uv=a||new e.Vector2},t.Vertex.prototype.clone=function(){return new t.Vertex(this.x,this.y,this.z,this.normal.clone(),this.uv.clone())},t.Vertex.prototype.add=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},t.Vertex.prototype.subtract=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this},t.Vertex.prototype.multiplyScalar=function(e){return this.x*=e,this.y*=e,this.z*=e,this},t.Vertex.prototype.cross=function(e){var t=this.x,r=this.y,i=this.z;return this.x=r*e.z-i*e.y,this.y=i*e.x-t*e.z,this.z=t*e.y-r*e.x,this},t.Vertex.prototype.normalize=function(){var e=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);return this.x/=e,this.y/=e,this.z/=e,this},t.Vertex.prototype.dot=function(e){return this.x*e.x+this.y*e.y+this.z*e.z},t.Vertex.prototype.lerp=function(e,t){return this.add(e.clone().subtract(this).multiplyScalar(t)),this.normal.add(e.normal.clone().sub(this.normal).multiplyScalar(t)),this.uv.add(e.uv.clone().sub(this.uv).multiplyScalar(t)),this},t.Vertex.prototype.interpolate=function(e,t){return this.clone().lerp(e,t)},t.Vertex.prototype.applyMatrix4=function(e){var t=this.x,r=this.y,i=this.z,n=e.elements;return this.x=n[0]*t+n[4]*r+n[8]*i+n[12],this.y=n[1]*t+n[5]*r+n[9]*i+n[13],this.z=n[2]*t+n[6]*r+n[10]*i+n[14],this},t.Node=function(e){var r,i,n=[],a=[];if(this.polygons=[],this.front=this.back=void 0,e instanceof Array&&0!==e.length){for(this.divider=e[0].clone(),r=0,i=e.length;r<i;r++)this.divider.splitPolygon(e[r],this.polygons,this.polygons,n,a);0<n.length&&(this.front=new t.Node(n)),0<a.length&&(this.back=new t.Node(a))}},t.Node.isConvex=function(e){var t,r;for(t=0;t<e.length;t++)for(r=0;r<e.length;r++)if(t!==r&&2!==e[t].classifySide(e[r]))return!1;return!0},t.Node.prototype.build=function(e){var r,i,n=[],a=[];for(this.divider||(this.divider=e[0].clone()),r=0,i=e.length;r<i;r++)this.divider.splitPolygon(e[r],this.polygons,this.polygons,n,a);0<n.length&&(!this.front&&(this.front=new t.Node),this.front.build(n)),0<a.length&&(!this.back&&(this.back=new t.Node),this.back.build(a))},t.Node.prototype.allPolygons=function(){var e=this.polygons.slice();return this.front&&(e=e.concat(this.front.allPolygons())),this.back&&(e=e.concat(this.back.allPolygons())),e},t.Node.prototype.clone=function(){var e=new t.Node;return e.divider=this.divider.clone(),e.polygons=this.polygons.map((function(e){return e.clone()})),e.front=this.front&&this.front.clone(),e.back=this.back&&this.back.clone(),e},t.Node.prototype.invert=function(){var e,t,r;for(e=0,t=this.polygons.length;e<t;e++)this.polygons[e].flip();return this.divider.flip(),this.front&&this.front.invert(),this.back&&this.back.invert(),r=this.front,this.front=this.back,this.back=r,this},t.Node.prototype.clipPolygons=function(e){var t,r,i,n;if(!this.divider)return e.slice();for(i=[],n=[],t=0,r=e.length;t<r;t++)this.divider.splitPolygon(e[t],i,n,i,n);return this.front&&(i=this.front.clipPolygons(i)),n=this.back?this.back.clipPolygons(n):[],i.concat(n)},t.Node.prototype.clipTo=function(e){this.polygons=e.clipPolygons(this.polygons),this.front&&this.front.clipTo(e),this.back&&this.back.clipTo(e)},t}},370:(e,t,r)=>{"use strict";r.d(t,{r:()=>n});var i=r(1515);class n{constructor(){this.pluginCallbacks=[],this.register((function(e){return new m(e)})),this.register((function(e){return new f(e)})),this.register((function(e){return new v(e)}))}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r){for(var i=new p,n=[],a=0,s=this.pluginCallbacks.length;a<s;a++)n.push(this.pluginCallbacks[a](i));i.setPlugins(n),i.write(e,t,r)}}var a=5121,s=5123,o={};o[i.NearestFilter]=9728,o[i.NearestMipmapNearestFilter]=9984,o[i.NearestMipmapLinearFilter]=9986,o[i.LinearFilter]=9729,o[i.LinearMipmapNearestFilter]=9985,o[i.LinearMipmapLinearFilter]=9987,o[i.ClampToEdgeWrapping]=33071,o[i.RepeatWrapping]=10497,o[i.MirroredRepeatWrapping]=33648;var l={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"};function h(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function c(e){return 4*Math.ceil(e/4)}function u(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0,r=c(e.byteLength);if(r!==e.byteLength){var i=new Uint8Array(r);if(i.set(new Uint8Array(e)),0!==t)for(var n=e.byteLength;n<r;n++)i[n]=t;return i.buffer}return e}var d=null;class p{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}write(e,t,r){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),0<this.options.animations.length&&(this.options.trs=!0),this.processInput(e);var i=this;Promise.all(this.pending).then((function(){var e=i.buffers,r=i.json,n=i.options,a=i.extensionsUsed,s=new Blob(e,{type:"application/octet-stream"}),o=Object.keys(a);if(0<o.length&&(r.extensionsUsed=o),r.buffers&&0<r.buffers.length&&(r.buffers[0].byteLength=s.size),!0===n.binary){var l=new window.FileReader;l.readAsArrayBuffer(s),l.onloadend=function(){var e=u(l.result),i=new DataView(new ArrayBuffer(8));i.setUint32(0,e.byteLength,!0),i.setUint32(4,5130562,!0);var n=u(function(e){if(void 0!==window.TextEncoder)return(new TextEncoder).encode(e).buffer;for(var t,r=new Uint8Array(new ArrayBuffer(e.length)),i=0,n=e.length;i<n;i++)t=e.charCodeAt(i),r[i]=255<t?32:t;return r.buffer}(JSON.stringify(r)),32),a=new DataView(new ArrayBuffer(8));a.setUint32(0,n.byteLength,!0),a.setUint32(4,1313821514,!0);var s=new ArrayBuffer(12),o=new DataView(s);o.setUint32(0,1179937895,!0),o.setUint32(4,2,!0);var h=12+a.byteLength+n.byteLength+i.byteLength+e.byteLength;o.setUint32(8,h,!0);var c=new Blob([s,a,n,i,e],{type:"application/octet-stream"}),d=new window.FileReader;d.readAsArrayBuffer(c),d.onloadend=function(){t(d.result)}}}else if(r.buffers&&0<r.buffers.length){var h=new window.FileReader;h.readAsDataURL(s),h.onloadend=function(){var e=h.result;r.buffers[0].uri=e,t(r)}}else t(r)}))}serializeUserData(e,t){if(!(e.userData&&e.userData.isZincObject||0===Object.keys(e.userData).length)){var r=this.options,i=this.extensionsUsed;try{var n=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&n.gltfExtensions){for(var a in void 0===t.extensions&&(t.extensions={}),n.gltfExtensions)t.extensions[a]=n.gltfExtensions[a],i[a]=!0;delete n.gltfExtensions}0<Object.keys(n).length&&(t.extras=n)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}}getUID(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;for(var t=new i.Vector3,r=0,n=e.count;r<n;r++)if(5e-4<Math.abs(t.fromBufferAttribute(e,r).length()-1))return!1;return!0}createNormalizedNormalAttribute(e){var t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);for(var r=e.clone(),n=new i.Vector3,a=0,s=r.count;a<s;a++)n.fromBufferAttribute(r,a),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),r.setXYZ(a,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}applyTextureTransform(e,t){var r=!1,i={};(0!==t.offset.x||0!==t.offset.y)&&(i.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(i.rotation=t.rotation,r=!0),(1!==t.repeat.x||1!==t.repeat.y)&&(i.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=i,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(e){var t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,t,r,i,n){var o=this.json;o.bufferViews||(o.bufferViews=[]);for(var l=t===a?1:t===s?2:4,h=c(i*e.itemSize*l),u=new DataView(new ArrayBuffer(h)),d=0,p=r;p<r+i;p++)for(var m,f=0;f<e.itemSize;f++)m=void 0,4<e.itemSize?m=e.array[p*e.itemSize+f]:0===f?m=e.getX(p):1===f?m=e.getY(p):2===f?m=e.getZ(p):3==f&&(m=e.getW(p)),5126===t?u.setFloat32(d,m,!0):5125===t?u.setUint32(d,m,!0):t===s?u.setUint16(d,m,!0):t===a&&u.setUint8(d,m),d+=l;var v={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:h};return void 0!==n&&(v.target=n),34962===n&&(v.byteStride=e.itemSize*l),this.byteOffset+=h,o.bufferViews.push(v),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){var t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(i){var n=new window.FileReader;n.readAsArrayBuffer(e),n.onloadend=function(){var e=u(n.result),a={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,i(r.bufferViews.push(a)-1)}}))}processAccessor(e,t,r,i){var n,o=this.options,l=this.json;if(e.array.constructor===Float32Array)n=5126;else if(e.array.constructor===Uint32Array)n=5125;else if(e.array.constructor===Uint16Array)n=s;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");n=a}if(void 0===r&&(r=0),void 0===i&&(i=e.count),o.truncateDrawRange&&void 0!==t&&null===t.index){var h=r+i,c=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;r=Math.max(r,t.drawRange.start),0>(i=Math.min(h,c)-r)&&(i=0)}if(0===i)return null;var u,d=function(e,t,r){for(var i={min:Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)},n=t;n<t+r;n++)for(var a,s=0;s<e.itemSize;s++)a=void 0,4<e.itemSize?a=e.array[n*e.itemSize+s]:0===s?a=e.getX(n):1===s?a=e.getY(n):2===s?a=e.getZ(n):3==s&&(a=e.getW(n)),i.min[s]=Math.min(i.min[s],a),i.max[s]=Math.max(i.max[s],a);return i}(e,r,i);void 0!==t&&(u=e===t.index?34963:34962);var p=this.processBufferView(e,n,r,i,u),m={bufferView:p.id,byteOffset:p.byteOffset,componentType:n,count:i,max:d.max,min:d.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(m.normalized=!0),l.accessors||(l.accessors=[]),l.accessors.push(m)-1}processImage(e,t,r){var n=this,a=n.cache,s=n.json,o=n.options,l=n.pending;a.images.has(e)||a.images.set(e,{});var h=a.images.get(e),c=t===i.RGBAFormat?"image/png":"image/jpeg",u=c+":flipY/"+r.toString();if(void 0!==h[u])return h[u];s.images||(s.images=[]);var p={mimeType:c};if(o.embedImages){var m=d=d||document.createElement("canvas");m.width=Math.min(e.width,o.maxTextureSize),m.height=Math.min(e.height,o.maxTextureSize);var f=m.getContext("2d");if(!0===r&&(f.translate(0,m.height),f.scale(1,-1)),"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap)f.drawImage(e,0,0,m.width,m.height);else{t!==i.RGBAFormat&&t!==i.RGBFormat&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(e.width>o.maxTextureSize||e.height>o.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);var v=new Uint8ClampedArray(e.height*e.width*4);if(t===i.RGBAFormat)for(var g=0;g<v.length;g+=4)v[g+0]=e.data[g+0],v[g+1]=e.data[g+1],v[g+2]=e.data[g+2],v[g+3]=e.data[g+3];else for(var y=0,x=0;y<v.length;y+=4,x+=3)v[y+0]=e.data[x+0],v[y+1]=e.data[x+1],v[y+2]=e.data[x+2],v[y+3]=255;f.putImageData(new ImageData(v,e.width,e.height),0,0)}!0===o.binary?l.push(new Promise((function(e){m.toBlob((function(t){n.processBufferViewImage(t).then((function(t){p.bufferView=t,e()}))}),c)}))):p.uri=m.toDataURL(c)}else p.uri=e.src;var b=s.images.push(p)-1;return h[u]=b,b}processSampler(e){var t=this.json;t.samplers||(t.samplers=[]);var r={magFilter:o[e.magFilter],minFilter:o[e.minFilter],wrapS:o[e.wrapS],wrapT:o[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){var t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);var i={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY)};e.name&&(i.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,i)}));var n=r.textures.push(i)-1;return t.textures.set(e,n),n}processMaterial(e){var t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);var n={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");var a=e.color.toArray().concat([e.opacity]);if(h(a,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap)if(e.metalnessMap===e.roughnessMap){var s={index:this.processTexture(e.metalnessMap)};this.applyTextureTransform(s,e.metalnessMap),n.pbrMetallicRoughness.metallicRoughnessTexture=s}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(e.map){var o={index:this.processTexture(e.map)};this.applyTextureTransform(o,e.map),n.pbrMetallicRoughness.baseColorTexture=o}if(e.emissive){var l=e.emissive.clone().multiplyScalar(e.emissiveIntensity),c=Math.max(l.r,l.g,l.b);if(1<c&&(l.multiplyScalar(1/c),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),0<c&&(n.emissiveFactor=l.toArray()),e.emissiveMap){var u={index:this.processTexture(e.emissiveMap)};this.applyTextureTransform(u,e.emissiveMap),n.emissiveTexture=u}}if(e.normalMap){var d={index:this.processTexture(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),this.applyTextureTransform(d,e.normalMap),n.normalTexture=d}if(e.aoMap){var p={index:this.processTexture(e.aoMap),texCoord:1};1!==e.aoMapIntensity&&(p.strength=e.aoMapIntensity),this.applyTextureTransform(p,e.aoMap),n.occlusionTexture=p}e.transparent?n.alphaMode="BLEND":0<e.alphaTest&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===i.DoubleSide&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,n)}));var m=r.materials.push(n)-1;return t.materials.set(e,m),m}processMesh(e){var t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(var a=0,s=e.material.length;a<s;a++)n.push(e.material[a].uuid);else n.push(e.material.uuid);var o=n.join(":");if(t.meshes.has(o))return t.meshes.get(o);var l,h=e.geometry;if(l=e.isLineSegments?1:e.isLineLoop?2:e.isLine?3:e.isPoints?0:e.material.wireframe?1:4,!0!==h.isBufferGeometry)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");var c={},u={},d=[],p=[],m={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=h.getAttribute("normal");void 0===f||this.isNormalizedNormalAttribute(f)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),h.setAttribute("normal",this.createNormalizedNormalAttribute(f)));var v=null;for(var g in h.attributes)if("morph"!==g.substr(0,5)){var y=h.attributes[g];if(g=m[g]||g.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(g)||(g="_"+g),t.attributes.has(this.getUID(y))){u[g]=t.attributes.get(this.getUID(y));continue}v=null;var x=y.array;"JOINTS_0"!==g||x instanceof Uint16Array||x instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),v=new i.BufferAttribute(new Uint16Array(x),y.itemSize,y.normalized));var b=this.processAccessor(v||y,h);null!==b&&(u[g]=b,t.attributes.set(this.getUID(y),b))}if(void 0!==f&&h.setAttribute("normal",f),0===Object.keys(u).length)return null;if(void 0!==e.morphTargetInfluences&&0<e.morphTargetInfluences.length){var w=[],_=[],M={};if(void 0!==e.morphTargetDictionary)for(var S in e.morphTargetDictionary)M[e.morphTargetDictionary[S]]=S;for(var T=0;T<e.morphTargetInfluences.length;++T){var E={},A=!1;for(var L in h.morphAttributes)if("position"==L||"normal"===L||"color"===L){var R=h.morphAttributes[L][T],C=L.toUpperCase();m[L]&&(C=m[L]);var P=h.attributes[L];if(t.attributes.has(this.getUID(R)))E[C]=t.attributes.get(this.getUID(R));else{var I=P.clone();if(!h.morphTargetsRelative)if(P)for(var O=0,D=R.count;O<D;O++)P.count>O&&I.setXYZ(O,R.getX(O)-P.getX(O),R.getY(O)-P.getY(O),R.getZ(O)-P.getZ(O));else for(var N=0,B=R.count;N<B;N++)I.setXYZ(N,0,0,0);E[C]=this.processAccessor(I,h),t.attributes.set(this.getUID(P),E[C])}}else A||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),A=!0);p.push(E),w.push(e.morphTargetInfluences[T]),void 0!==e.morphTargetDictionary&&_.push(M[T])}c.weights=w,0<_.length&&(c.extras={},c.extras.targetNames=_)}var U=Array.isArray(e.material);if(U&&0===h.groups.length)return null;for(var z,F=U?e.material:[e.material],G=U?h.groups:[{materialIndex:0,start:void 0,count:void 0}],V=0,H=G.length;V<H;V++){if(z={mode:l,attributes:u},this.serializeUserData(h,z),0<p.length&&(z.targets=p),null!==h.index){var k=this.getUID(h.index);(void 0!==G[V].start||void 0!==G[V].count)&&(k+=":"+G[V].start+":"+G[V].count),t.attributes.has(k)?z.indices=t.attributes.get(k):(z.indices=this.processAccessor(h.index,h,G[V].start,G[V].count),t.attributes.set(k,z.indices)),null===z.indices&&delete z.indices}var j=this.processMaterial(F[G[V].materialIndex]);null!==j&&(z.material=j),d.push(z)}c.primitives=d,r.meshes||(r.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,c)}));var W=r.meshes.push(c)-1;return t.meshes.set(o,W),W}processCamera(e){var t=this.json;t.cameras||(t.cameras=[]);var r=e.isOrthographicCamera,n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:0>=e.far?.001:e.far,znear:0>e.near?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:i.MathUtils.degToRad(e.fov),zfar:0>=e.far?.001:e.far,znear:0>e.near?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}processAnimation(e,t){var r=this.json,a=this.nodeMap;r.animations||(r.animations=[]);for(var s=(e=n.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,o=[],h=[],c=0;c<s.length;++c){var u=s[c],d=i.PropertyBinding.parseTrackName(u.name),p=i.PropertyBinding.findNode(t,d.nodeName),m=l[d.propertyName];if("bones"===d.objectName&&(p=!0===p.isSkinnedMesh?p.skeleton.getBoneByName(d.objectIndex):void 0),!p||!m)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',u.name),null;var f=u.values.length/u.times.length;m===l.morphTargetInfluences&&(f/=p.morphTargetInfluences.length);var v=void 0;!0===u.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(v="CUBICSPLINE",f/=3):v=u.getInterpolation()===i.InterpolateDiscrete?"STEP":"LINEAR",h.push({input:this.processAccessor(new i.BufferAttribute(u.times,1)),output:this.processAccessor(new i.BufferAttribute(u.values,f)),interpolation:v}),o.push({sampler:h.length-1,target:{node:a.get(p),path:m}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:h,channels:o}),r.animations.length-1}processSkin(e){var t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],a=e.skeleton;if(void 0===a)return null;var s=e.skeleton.bones[0];if(void 0===s)return null;for(var o=[],l=new Float32Array(16*a.bones.length),h=new i.Matrix4,c=0;c<a.bones.length;++c)o.push(r.get(a.bones[c])),h.copy(a.boneInverses[c]),h.multiply(e.bindMatrix).toArray(l,16*c);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new i.BufferAttribute(l,16)),joints:o,skeleton:r.get(s)}),n.skin=t.skins.length-1}processNode(e){var t=this.json,r=this.options,i=this.nodeMap;t.nodes||(t.nodes=[]);var n={};if(r.trs){var a=e.quaternion.toArray(),s=e.position.toArray(),o=e.scale.toArray();h(a,[0,0,0,1])||(n.rotation=a),h(s,[0,0,0])||(n.translation=s),h(o,[1,1,1])||(n.scale=o)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===h(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(n.matrix=e.matrix.elements);if(""!==e.name&&(n.name=e.name+""),this.serializeUserData(e,n),e.isMesh||e.isLine||e.isPoints){var l=this.processMesh(e);null!==l&&(n.mesh=l)}else e.isCamera&&(n.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),0<e.children.length){for(var c,u=[],d=0,p=e.children.length;d<p;d++)if((c=e.children[d]).visible||!1===r.onlyVisible){var m=this.processNode(c);null!==m&&u.push(m)}0<u.length&&(n.children=u)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,n)}));var f=t.nodes.push(n)-1;return i.set(e,f),f}processScene(e){var t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);var i={};""!==e.name&&(i.name=e.name),t.scenes.push(i);for(var n,a=[],s=0,o=e.children.length;s<o;s++)if((n=e.children[s]).visible||!1===r.onlyVisible){var l=this.processNode(n);null!==l&&a.push(l)}0<a.length&&(i.nodes=a),this.serializeUserData(e,i)}processObjects(e){var t=new i.Scene;t.name="AuxScene";for(var r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}processInput(e){var t=this.options;e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)}));for(var r=[],n=0;n<e.length;n++)e[n]instanceof i.Scene?this.processScene(e[n]):r.push(e[n]);0<r.length&&this.processObjects(r);for(var a=0;a<this.skins.length;++a)this.processSkin(this.skins[a]);for(var s=0;s<t.animations.length;++s)this.processAnimation(t.animations[s].clip,t.animations[s].mesh);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}_invokeAll(e){for(var t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}}class m{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(e.isLight){if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);var r=this.writer,i=r.json,n=r.extensionsUsed,a={};e.name&&(a.name=e.name),a.color=e.color.toArray(),a.intensity=e.intensity,e.isDirectionalLight?a.type="directional":e.isPointLight?(a.type="point",0<e.distance&&(a.range=e.distance)):e.isSpotLight&&(a.type="spot",0<e.distance&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,a.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."),n[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},n[this.name]=!0);var s=i.extensions[this.name].lights;s.push(a),t.extensions=t.extensions||{},t.extensions[this.name]={light:s.length-1}}}}class f{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(e.isMeshBasicMaterial){var r=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},r[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}}class v{constructor(e){this.writer=e,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(e,t){if(e.isGLTFSpecularGlossinessMaterial){var r=this.writer,i=r.extensionsUsed,n={};t.pbrMetallicRoughness.baseColorFactor&&(n.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);var a=[1,1,1];if(e.specular.toArray(a,0),n.specularFactor=a,n.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(n.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap){var s={index:r.processTexture(e.specularMap)};r.applyTextureTransform(s,e.specularMap),n.specularGlossinessTexture=s}t.extensions=t.extensions||{},t.extensions[this.name]=n,i[this.name]=!0}}}n.Utils={insertKeyframe:function(e,t){var r,i=.001,n=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),s=new e.ValueBufferType(e.values.length+n),o=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){a[0]=t;for(var l=0;l<n;l++)s[l]=0;r=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),s.set(o.evaluate(t),0),s.set(e.values,n),r=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),s.set(e.values,0),s.set(o.evaluate(t),e.values.length),r=a.length-1}else for(var h=0;h<e.times.length;h++){if(Math.abs(e.times[h]-t)<i)return h;if(e.times[h]<t&&e.times[h+1]>t){a.set(e.times.slice(0,h+1),0),a[h+1]=t,a.set(e.times.slice(h+1),h+2),s.set(e.values.slice(0,(h+1)*n),0),s.set(o.evaluate(t),(h+1)*n),s.set(e.values.slice((h+1)*n),(h+2)*n),r=h+1;break}}return e.times=a,e.values=s,r},mergeMorphTargetTracks:function(e,t){for(var r=[],n={},a=e.tracks,s=0;s<a.length;++s){var o=a[s],l=i.PropertyBinding.parseTrackName(o.name),h=i.PropertyBinding.findNode(t,l.nodeName);if("morphTargetInfluences"===l.propertyName&&void 0!==l.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(i.InterpolateLinear)}var c=h.morphTargetInfluences.length,u=h.morphTargetDictionary[l.propertyIndex];if(void 0===u)throw new Error("THREE.GLTFExporter: Morph target name not found: "+l.propertyIndex);var d=void 0;if(void 0!==n[h.uuid]){var p=o.createInterpolant(new o.ValueBufferType(1));d=n[h.uuid];for(var m=0;m<d.times.length;m++)d.values[m*c+u]=p.evaluate(d.times[m]);for(var f,v=0;v<o.times.length;v++)f=this.insertKeyframe(d,o.times[v]),d.values[f*c+u]=o.values[v]}else{for(var g=new((d=o.clone()).ValueBufferType)(c*d.times.length),y=0;y<d.times.length;y++)g[y*c+u]=d.values[y];d.name=(l.nodeName||"")+".morphTargetInfluences",d.values=g,n[h.uuid]=d,r.push(d)}}else r.push(o)}return e.tracks=r,e}}},8154:(e,t,r)=>{"use strict";r.d(t,{V:()=>l,n:()=>c});var i=r(1515),n=new i.Matrix4,a=new i.Object3D,s=new i.Vector3,o=new i.Vector3;function l(){this.uuid=i.MathUtils.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.normals=[],this.uvs=[],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,this.morphNormalsReady=!1}l.prototype=Object.assign(Object.create(i.EventDispatcher.prototype),{constructor:l,isGeometry:!0,applyMatrix4:function(e){for(var t=(new i.Matrix3).getNormalMatrix(e),r=0,n=this.vertices.length;r<n;r++)this.vertices[r].applyMatrix4(e);for(var a,s=0,o=this.faces.length;s<o;s++){(a=this.faces[s]).normal.applyMatrix3(t).normalize();for(var l=0,h=a.vertexNormals.length;l<h;l++)a.vertexNormals[l].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 n.makeRotationX(e),this.applyMatrix4(n),this},rotateY:function(e){return n.makeRotationY(e),this.applyMatrix4(n),this},rotateZ:function(e){return n.makeRotationZ(e),this.applyMatrix4(n),this},translate:function(e,t,r){return n.makeTranslation(e,t,r),this.applyMatrix4(n),this},scale:function(e,t,r){return n.makeScale(e,t,r),this.applyMatrix4(n),this},lookAt:function(e){return a.lookAt(e),a.updateMatrix(),this.applyMatrix4(a.matrix),this},fromBufferGeometry:function(e){function t(e,t,n,a){var s=void 0===l?[]:[r.colors[e].clone(),r.colors[t].clone(),r.colors[n].clone()],d=void 0===o?[]:[(new i.Vector3).fromBufferAttribute(o,e),(new i.Vector3).fromBufferAttribute(o,t),(new i.Vector3).fromBufferAttribute(o,n)],p=new c(e,t,n,d,s,a);r.faces.push(p),void 0!==h&&r.faceVertexUvs[0].push([(new i.Vector2).fromBufferAttribute(h,e),(new i.Vector2).fromBufferAttribute(h,t),(new i.Vector2).fromBufferAttribute(h,n)]),void 0!==u&&r.faceVertexUvs[1].push([(new i.Vector2).fromBufferAttribute(u,e),(new i.Vector2).fromBufferAttribute(u,t),(new i.Vector2).fromBufferAttribute(u,n)])}var r=this,n=null===e.index?void 0:e.index,a=e.attributes;if(void 0===a.position)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var s=a.position,o=a.normal,l=a.color,h=a.uv,u=a.uv2;void 0!==u&&(this.faceVertexUvs[1]=[]);for(var d=0;d<s.count;d++)r.vertices.push((new i.Vector3).fromBufferAttribute(s,d)),void 0!==l&&r.colors.push((new i.Color).fromBufferAttribute(l,d));var p=e.groups;if(0<p.length)for(var m=0;m<p.length;m++)for(var f=p[m],v=f.start,g=v,y=v+f.count;g<y;g+=3)void 0===n?t(g,g+1,g+2,f.materialIndex):t(n.getX(g),n.getX(g+1),n.getX(g+2),f.materialIndex);else if(void 0!==n)for(var x=0;x<n.count;x+=3)t(n.getX(x),n.getX(x+1),n.getX(x+2));else for(var b=0;b<s.count;b+=3)t(b,b+1,b+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(s).negate(),this.translate(s.x,s.y,s.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,r=0===t?1:1/t,n=new i.Matrix4;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix4(n),this},computeFaceNormals:function(){for(var e=new i.Vector3,t=new i.Vector3,r=0,n=this.faces.length;r<n;r++){var a=this.faces[r],s=this.vertices[a.a],o=this.vertices[a.b],l=this.vertices[a.c];e.subVectors(l,o),t.subVectors(s,o),e.cross(t),e.normalize(),a.normal.copy(e)}},computeVertexNormals:function(){for(var e=!(0<arguments.length&&void 0!==arguments[0])||arguments[0],t=Array(this.vertices.length),r=0,n=this.vertices.length;r<n;r++)t[r]=new i.Vector3;if(e)for(var a=new i.Vector3,s=new i.Vector3,o=0,l=this.faces.length;o<l;o++){var h=this.faces[o],c=this.vertices[h.a],u=this.vertices[h.b],d=this.vertices[h.c];a.subVectors(d,u),s.subVectors(c,u),a.cross(s),t[h.a].add(a),t[h.b].add(a),t[h.c].add(a)}else{this.computeFaceNormals();for(var p,m=0,f=this.faces.length;m<f;m++)t[(p=this.faces[m]).a].add(p.normal),t[p.b].add(p.normal),t[p.c].add(p.normal)}for(var v=0,g=this.vertices.length;v<g;v++)t[v].normalize();for(var y=0,x=this.faces.length;y<x;y++){var b=this.faces[y],w=b.vertexNormals;3===w.length?(w[0].copy(t[b.a]),w[1].copy(t[b.b]),w[2].copy(t[b.c])):(w[0]=t[b.a].clone(),w[1]=t[b.b].clone(),w[2]=t[b.c].clone())}return 0<this.faces.length&&(this.normalsNeedUpdate=!0),t},computeFlatVertexNormals:function(){this.computeFaceNormals();for(var e=0,t=this.faces.length;e<t;e++){var r=this.faces[e],i=r.vertexNormals;3===i.length?(i[0].copy(r.normal),i[1].copy(r.normal),i[2].copy(r.normal)):(i[0]=r.normal.clone(),i[1]=r.normal.clone(),i[2]=r.normal.clone())}0<this.faces.length&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){for(var e,t=0,r=this.faces.length;t<r;t++){(e=this.faces[t]).__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone(),e.__originalVertexNormals||(e.__originalVertexNormals=[]);for(var n=0,a=e.vertexNormals.length;n<a;n++)e.__originalVertexNormals[n]?e.__originalVertexNormals[n].copy(e.vertexNormals[n]):e.__originalVertexNormals[n]=e.vertexNormals[n].clone()}var s=new l;s.faces=this.faces;for(var o=0,h=this.morphTargets.length;o<h;o++){if(!this.morphNormals[o]){this.morphNormals[o]={},this.morphNormals[o].faceNormals=[],this.morphNormals[o].vertexNormals=[];for(var c=this.morphNormals[o].faceNormals,u=this.morphNormals[o].vertexNormals,d=0,p=this.faces.length;d<p;d++){var m=new i.Vector3,f={a:new i.Vector3,b:new i.Vector3,c:new i.Vector3};c.push(m),u.push(f)}}var v=this.morphNormals[o];s.vertices=this.morphTargets[o].vertices,s.computeFaceNormals();var g=s.computeVertexNormals();if(g&&0<g.length){this.morphTargets[o].normals=Array(this.vertices.length);for(var y=0;y<g.length;y++)this.morphTargets[o].normals[y]=g[y].clone()}for(var x=0,b=this.faces.length;x<b;x++){var w=this.faces[x],_=v.faceNormals[x],M=v.vertexNormals[x];_.copy(w.normal),M.a.copy(w.vertexNormals[0]),M.b.copy(w.vertexNormals[1]),M.c.copy(w.vertexNormals[2])}}for(var S,T=0,E=this.faces.length;T<E;T++)(S=this.faces[T]).normal=S.__originalFaceNormal,S.vertexNormals=S.__originalVertexNormals;this.morphNormalsReady=!0},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new i.Box3),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new i.Sphere),this.boundingSphere.setFromPoints(this.vertices)},mergeMorph:function(e,t){var r=this.morphTargets.length,i=this.morphTargets,n=e.morphTargets,a=this.morphColors.length,s=this.morphColors,l=e.morphColors;if(0<r&&r==n.length)for(var h=0,c=i.length;h<c;h++){for(var u=i[h],d=n[h],p=0,m=d.vertices.length;p<m;p++){var f=d.vertices[p].clone();void 0!==t&&f.applyMatrix4(t),u.vertices.push(f)}if(u.normals&&d.normals)for(var v=0;v<d.normals.length;v+=3)o.set(d.normals2[v],d.normals2[v+1],d.normals2[v+2]),void 0!==t&&o.applyMatrix4(t),u.normals.push(o.x,o.y,o.z)}if(0<a&&a==l.length)for(var g=0,y=s.length;g<y;g++)for(var x=s[g],b=l[g],w=0,_=b.colors;w<_;w++)x.colors.push(b.colors[w].clone())},merge:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:0;if(e&&e.isGeometry){var n,a=this.vertices.length,s=this.vertices,l=e.vertices,h=e.normals,u=this.faces,d=e.faces,p=this.colors,m=e.colors;void 0!==t&&(n=(new i.Matrix3).getNormalMatrix(t));for(var f=0,v=l.length;f<v;f++){var g=l[f].clone();void 0!==t&&g.applyMatrix4(t),s.push(g)}for(var y=0;y<h.length;y+=3)o.set(h[y],h[y+1],h[y+2]),void 0!==t&&o.applyMatrix4(t),this.normals.push(o.x,o.y,o.z);for(var x=0,b=m.length;x<b;x++)"number"==typeof m[x]?p.push(m[x]):p.push(m[x].clone());for(var w=0,_=d.length;w<_;w++){var M=d[w],S=void 0,T=void 0,E=M.vertexNormals,A=M.vertexColors,L=new c(M.a+a,M.b+a,M.c+a);L.normal.copy(M.normal),void 0!==n&&L.normal.applyMatrix3(n).normalize();for(var R=0,C=E.length;R<C;R++)S=E[R].clone(),void 0!==n&&S.applyMatrix3(n).normalize(),L.vertexNormals.push(S);L.color.copy(M.color);for(var P=0,I=A.length;P<I;P++)T=A[P],L.vertexColors.push(T.clone());L.materialIndex=M.materialIndex+r,u.push(L)}for(var O,D=0,N=e.faceVertexUvs.length;D<N;D++){O=e.faceVertexUvs[D],void 0===this.faceVertexUvs[D]&&(this.faceVertexUvs[D]=[]);for(var B=0,U=O.length;B<U;B++){for(var z=O[B],F=[],G=0,V=z.length;G<V;G++)F.push(z[G].clone());this.faceVertexUvs[D].push(F)}}this.mergeMorph(e,t)}else console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e)},mergeMesh:function(e){return e&&e.isMesh?(e.matrixAutoUpdate&&e.updateMatrix(),void this.merge(e.geometry,e.matrix)):void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e)},mergeVertices:function(){for(var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:4,t={},r=[],i=[],n=Math.pow(10,e),a=0,s=this.vertices.length;a<s;a++){var o=this.vertices[a],l=Math.round(o.x*n)+"_"+Math.round(o.y*n)+"_"+Math.round(o.z*n);void 0===t[l]?(t[l]=a,r.push(this.vertices[a]),i[a]=r.length-1):i[a]=i[t[l]]}for(var h,c=[],u=0,d=this.faces.length;u<d;u++){(h=this.faces[u]).a=i[h.a],h.b=i[h.b],h.c=i[h.c];for(var p=[h.a,h.b,h.c],m=0;3>m;m++)if(p[m]===p[(m+1)%3]){c.push(u);break}}for(var f,v=c.length-1;0<=v;v--){f=c[v],this.faces.splice(f,1);for(var g=0,y=this.faceVertexUvs.length;g<y;g++)this.faceVertexUvs[g].splice(f,1)}var x=this.vertices.length-r.length;return this.vertices=r,x},setFromPoints:function(e){this.vertices=[];for(var t,r=0,n=e.length;r<n;r++)t=e[r],this.vertices.push(new i.Vector3(t.x,t.y,t.z||0));return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,r=0;r<t;r++)e[r]._id=r;e.sort((function(e,t){return e.materialIndex-t.materialIndex}));var i,n,a=this.faceVertexUvs[0],s=this.faceVertexUvs[1];a&&a.length===t&&(i=[]),s&&s.length===t&&(n=[]);for(var o,l=0;l<t;l++)o=e[l]._id,i&&i.push(a[o]),n&&n.push(s[o]);i&&(this.faceVertexUvs[0]=i),n&&(this.faceVertexUvs[1]=n)},toJSON:function(){function e(e,t,r){return r?e|1<<t:e&~(1<<t)}function t(e){var t=e.x.toString()+e.y.toString()+e.z.toString();return void 0===d[t]?(d[t]=u.length/3,u.push(e.x,e.y,e.z),d[t]):d[t]}function r(e){var t=e.r.toString()+e.g.toString()+e.b.toString();return void 0===m[t]?(m[t]=p.length,p.push(e.getHex()),m[t]):m[t]}function i(e){var t=e.x.toString()+e.y.toString();return void 0===v[t]?(v[t]=f.length/2,f.push(e.x,e.y),v[t]):v[t]}var n={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),void 0!==this.parameters){var a=this.parameters;for(var s in a)void 0!==a[s]&&(n[s]=a[s]);return n}for(var o,l=[],h=0;h<this.vertices.length;h++)o=this.vertices[h],l.push(o.x,o.y,o.z);for(var c=[],u=[],d={},p=[],m={},f=[],v={},g=0;g<this.faces.length;g++){var y=this.faces[g],x=void 0!==this.faceVertexUvs[0][g],b=0<y.normal.length(),w=0<y.vertexNormals.length,_=1!==y.color.r||1!==y.color.g||1!==y.color.b,M=0<y.vertexColors.length,S=0;if(S=e(S,0,0),S=e(S,1,!0),S=e(S,2,!1),S=e(S,3,x),S=e(S,4,b),S=e(S,5,w),S=e(S,6,_),S=e(S,7,M),c.push(S),c.push(y.a,y.b,y.c),c.push(y.materialIndex),x){var T=this.faceVertexUvs[0][g];c.push(i(T[0]),i(T[1]),i(T[2]))}if(b&&c.push(t(y.normal)),w){var E=y.vertexNormals;c.push(t(E[0]),t(E[1]),t(E[2]))}if(_&&c.push(r(y.color)),M){var A=y.vertexColors;c.push(r(A[0]),r(A[1]),r(A[2]))}}return n.data={},n.data.vertices=l,n.data.normals=u,0<p.length&&(n.data.colors=p),0<f.length&&(n.data.uvs=[f]),n.data.faces=c,n},clone:function(){return(new l).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,r=0,i=t.length;r<i;r++)this.vertices.push(t[r].clone());for(var n=e.colors,a=0,s=n.length;a<s;a++)this.colors.push(n[a].clone());for(var o=e.faces,l=0,h=o.length;l<h;l++)this.faces.push(o[l].clone());for(var c,u=0,d=e.faceVertexUvs.length;u<d;u++){c=e.faceVertexUvs[u],void 0===this.faceVertexUvs[u]&&(this.faceVertexUvs[u]=[]);for(var p=0,m=c.length;p<m;p++){for(var f,v=c[p],g=[],y=0,x=v.length;y<x;y++)f=v[y],g.push(f.clone());this.faceVertexUvs[u].push(g)}}for(var b,w=e.morphTargets,_=0,M=w.length;_<M;_++){if((b={}).name=w[_].name,void 0!==w[_].vertices){b.vertices=[];for(var S=0,T=w[_].vertices.length;S<T;S++)b.vertices.push(w[_].vertices[S].clone())}if(void 0!==w[_].normals){b.normals=[];for(var E=0,A=w[_].normals.length;E<A;E++)b.normals.push(w[_].normals[E].clone())}this.morphTargets.push(b)}for(var L,R=e.morphNormals,C=0,P=R.length;C<P;C++){if(L={},void 0!==R[C].vertexNormals){L.vertexNormals=[];for(var I=0,O=R[C].vertexNormals.length;I<O;I++){var D=R[C].vertexNormals[I],N={};N.a=D.a.clone(),N.b=D.b.clone(),N.c=D.c.clone(),L.vertexNormals.push(N)}}if(void 0!==R[C].faceNormals){L.faceNormals=[];for(var B=0,U=R[C].faceNormals.length;B<U;B++)L.faceNormals.push(R[C].faceNormals[B].clone())}this.morphNormals.push(L)}for(var z=e.skinWeights,F=0,G=z.length;F<G;F++)this.skinWeights.push(z[F].clone());for(var V=e.skinIndices,H=0,k=V.length;H<k;H++)this.skinIndices.push(V[H].clone());for(var j=e.lineDistances,W=0,Z=j.length;W<Z;W++)this.lineDistances.push(j[W]);var q=e.boundingBox;null!==q&&(this.boundingBox=q.clone());var X=e.boundingSphere;return null!==X&&(this.boundingSphere=X.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},computeGroups(){var e,t,r=[],i=void 0,n=this.faces;for(t=0;t<n.length;t++){var a=n[t];a.materialIndex!==i&&(i=a.materialIndex,void 0!==e&&(e.count=3*t-e.start,r.push(e)),e={start:3*t,materialIndex:i})}return void 0!==e&&(e.count=3*t-e.start,r.push(e)),r},toBufferGeometry:function(){var e=(new h).fromGeometry(this),t=new i.BufferGeometry,r=new Float32Array(3*e.vertices.length);if(t.setAttribute("position",new i.BufferAttribute(r,3).copyVector3sArray(e.vertices)),0<e.normals.length){var n=new Float32Array(3*e.normals.length);t.setAttribute("normal",new i.BufferAttribute(n,3).copyVector3sArray(e.normals))}if(0<e.colors.length){var a=new Float32Array(3*e.colors.length);t.setAttribute("color",new i.BufferAttribute(a,3).copyColorsArray(e.colors))}if(0<e.uvs.length){var s=new Float32Array(2*e.uvs.length);t.setAttribute("uv",new i.BufferAttribute(s,2).copyVector2sArray(e.uvs))}if(0<e.uvs2.length){var o=new Float32Array(2*e.uvs2.length);t.setAttribute("uv2",new i.BufferAttribute(o,2).copyVector2sArray(e.uvs2))}for(var l in t.groups=e.groups,e.morphTargets){for(var c=[],u=e.morphTargets[l],d=0,p=u.length;d<p;d++){var m=u[d],f=new i.Float32BufferAttribute(3*m.data.length,3);f.name=m.name,c.push(f.copyVector3sArray(m.data))}t.morphAttributes[l]=c}if(0<e.skinIndices.length){var v=new i.Float32BufferAttribute(4*e.skinIndices.length,4);t.setAttribute("skinIndex",v.copyVector4sArray(e.skinIndices))}if(0<e.skinWeights.length){var g=new i.Float32BufferAttribute(4*e.skinWeights.length,4);t.setAttribute("skinWeight",g.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(t.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(t.boundingBox=e.boundingBox.clone()),t},toIndexedBufferGeometry:function(){var e=new i.BufferGeometry,t=new Float32Array(3*this.vertices.length);if(e.setAttribute("position",new i.BufferAttribute(t,3).copyVector3sArray(this.vertices)),0<this.normals.length){var r=new Float32Array(this.normals.length),n=new i.BufferAttribute(r,3).copyArray(this.normals);e.setAttribute("normal",n)}if(0<this.uvs.length&&0<this.uvs[0].length){var a=new Float32Array(2*this.uvs[0].length);e.setAttribute("uv",new i.BufferAttribute(a,2).copyArray(this.uvs[0]))}if(1<this.uvs.length&&0<this.uvs[1].length){var s=new Float32Array(2*this.uvs[1].length);e.setAttribute("uv2",new i.BufferAttribute(s,2).copyArray(this.uvs[1]))}if(0<this.colors.length){for(var o=[],l=0;l<this.colors.length;l++)o.push(new i.Color(this.colors[l]));var h=new Float32Array(3*o.length);e.setAttribute("color",new i.BufferAttribute(h,3).copyColorsArray(o))}else{for(var c=new Float32Array(3*this.vertices.length),u=0;u<3*this.vertices.length;u++)c[u]=1;e.setAttribute("color",new i.BufferAttribute(c,3))}if(0<this.faces.length){for(var d=[],p=[],m=0;m<this.faces.length;m++){p.push(this.faces[m].a,this.faces[m].b,this.faces[m].c);var f=this.faces[m].vertexColors;if(3===f.length)d.push(f[0],f[1],f[2]);else{var v=this.faces[m].color;d.push(v,v,v)}}e.setIndex(p),e.groups=this.computeGroups()}if(0<this.morphTargets.length){for(var g=[],y=[],x=0,b=this.morphTargets.length;x<b;x++){var w=this.morphTargets[x],_=new i.Float32BufferAttribute(3*w.vertices.length,3);if(_.name=w.name,g.push(_.copyVector3sArray(w.vertices)),w.normals){var M=new i.Float32BufferAttribute(3*w.normals.length,3);M.name=w.name,y.push(M.copyVector3sArray(w.normals))}}e.morphAttributes.position=g,e.morphAttributes.normal=y}if(0<this.skinIndices.length){var S=new i.Float32BufferAttribute(4*this.skinIndices.length,4);e.setAttribute("skinIndex",S.copyVector4sArray(this.skinIndices))}if(0<this.skinWeights.length){var T=new i.Float32BufferAttribute(4*this.skinWeights.length,4);e.setAttribute("skinWeight",T.copyVector4sArray(this.skinWeights))}return null!==this.boundingSphere&&(e.boundingSphere=this.boundingSphere.clone()),null!==this.boundingBox&&(e.boundingBox=this.boundingBox.clone()),e},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)},dispose:function(){this.dispatchEvent({type:"dispose"})}}),l.createBufferGeometryFromObject=function(e){var t=new i.BufferGeometry,r=e.geometry;if(e.isPoints||e.isLine){var n=new i.Float32BufferAttribute(3*r.vertices.length,3),a=new i.Float32BufferAttribute(3*r.colors.length,3);if(t.setAttribute("position",n.copyVector3sArray(r.vertices)),t.setAttribute("color",a.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length){var s=new i.Float32BufferAttribute(r.lineDistances.length,1);t.setAttribute("lineDistance",s.copyArray(r.lineDistances))}null!==r.boundingSphere&&(t.boundingSphere=r.boundingSphere.clone()),null!==r.boundingBox&&(t.boundingBox=r.boundingBox.clone())}else e.isMesh&&(t=r.toBufferGeometry());return t};class h{constructor(){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}computeGroups(e){var t,r,i=[],n=void 0,a=e.faces;for(r=0;r<a.length;r++){var s=a[r];s.materialIndex!==n&&(n=s.materialIndex,void 0!==t&&(t.count=3*r-t.start,i.push(t)),t={start:3*r,materialIndex:n})}void 0!==t&&(t.count=3*r-t.start,i.push(t)),this.groups=i}fromGeometry(e){var t,r=e.faces,n=e.vertices,a=e.faceVertexUvs,s=a[0]&&0<a[0].length,o=a[1]&&0<a[1].length,l=e.morphTargets,h=l.length;if(0<h){t=[];for(var c=0;c<h;c++)t[c]={name:l[c].name,data:[]};this.morphTargets.position=t}var u,d=e.morphNormals,p=d.length;if(0<p){u=[];for(var m=0;m<p;m++)u[m]={name:d[m].name,data:[]};this.morphTargets.normal=u}var f=e.skinIndices,v=e.skinWeights,g=f.length===n.length,y=v.length===n.length;0<n.length&&0===r.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var x,b=0;b<r.length;b++){x=r[b],this.vertices.push(n[x.a],n[x.b],n[x.c]);var w=x.vertexNormals;if(3===w.length)this.normals.push(w[0],w[1],w[2]);else{var _=x.normal;this.normals.push(_,_,_)}var M=x.vertexColors;if(3===M.length)this.colors.push(M[0],M[1],M[2]);else{var S=x.color;this.colors.push(S,S,S)}if(!0===s){var T=a[0][b];void 0===T?(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",b),this.uvs.push(new i.Vector2,new i.Vector2,new i.Vector2)):this.uvs.push(T[0],T[1],T[2])}if(!0===o){var E=a[1][b];void 0===E?(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",b),this.uvs2.push(new i.Vector2,new i.Vector2,new i.Vector2)):this.uvs2.push(E[0],E[1],E[2])}for(var A,L=0;L<h;L++)A=l[L].vertices,t[L].data.push(A[x.a],A[x.b],A[x.c]);for(var R,C=0;C<p;C++)R=d[C].vertexNormals[b],u[C].data.push(R.a,R.b,R.c);g&&this.skinIndices.push(f[x.a],f[x.b],f[x.c]),y&&this.skinWeights.push(v[x.a],v[x.b],v[x.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}}class c{constructor(e,t,r,n,a){var s=5<arguments.length&&void 0!==arguments[5]?arguments[5]:0;this.a=e,this.b=t,this.c=r,this.normal=n&&n.isVector3?n:new i.Vector3,this.vertexNormals=Array.isArray(n)?n:[],this.color=a&&a.isColor?a:new i.Color,this.vertexColors=Array.isArray(a)?a:[],this.materialIndex=s}clone(){return(new this.constructor).copy(this)}copy(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,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var i=0,n=e.vertexColors.length;i<n;i++)this.vertexColors[i]=e.vertexColors[i].clone();return this}}},1781:(e,t,r)=>{"use strict";r.d(t,{a:()=>l});var i,n,a,s,o=r(1515);function l(){}r(1515),l.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,r=0,i=t.length;r<i;r+=2){var n=t[r],a=t[r+1];if(n.test(e))return a}return null}},Object.assign(l.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,r){for(var i=[],n=0;n<e.length;++n)i[n]=this.createMaterial(e[n],t,r);return i},createMaterial:(i={NoBlending:o.NoBlending,NormalBlending:o.NormalBlending,AdditiveBlending:o.AdditiveBlending,SubtractiveBlending:o.SubtractiveBlending,MultiplyBlending:o.MultiplyBlending,CustomBlending:o.CustomBlending},n=new o.Color,a=new o.TextureLoader,s=new o.MaterialLoader,function(e,t,r){function h(e,i,n,s,h){var u,d=t+e,p=l.Handlers.get(d);null===p?(a.setCrossOrigin(r),u=a.load(d)):u=p.load(d),void 0!==i&&(u.repeat.fromArray(i),1!==i[0]&&(u.wrapS=o.RepeatWrapping),1!==i[1]&&(u.wrapT=o.RepeatWrapping)),void 0!==n&&u.offset.fromArray(n),void 0!==s&&("repeat"===s[0]&&(u.wrapS=o.RepeatWrapping),"mirror"===s[0]&&(u.wrapS=o.MirroredRepeatWrapping),"repeat"===s[1]&&(u.wrapT=o.RepeatWrapping),"mirror"===s[1]&&(u.wrapT=o.MirroredRepeatWrapping)),void 0!==h&&(u.anisotropy=h);var m=o.MathUtils.generateUUID();return c[m]=u,m}var c={},u={uuid:o.MathUtils.generateUUID(),type:"MeshLambertMaterial"};for(var d in e){var p=e[d];switch(d){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"DbgName":u.name=p;break;case"blending":u.blending=i[p];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",d,"is no longer supported.");break;case"colorDiffuse":u.color=n.fromArray(p).getHex();break;case"colorSpecular":u.specular=n.fromArray(p).getHex();break;case"colorEmissive":u.emissive=n.fromArray(p).getHex();break;case"specularCoef":u.shininess=p;break;case"shading":"basic"===p.toLowerCase()&&(u.type="MeshBasicMaterial"),"phong"===p.toLowerCase()&&(u.type="MeshPhongMaterial"),"standard"===p.toLowerCase()&&(u.type="MeshStandardMaterial");break;case"mapDiffuse":u.map=h(p,e.mapDiffuseRepeat,e.mapDiffuseOffset,e.mapDiffuseWrap,e.mapDiffuseAnisotropy);break;case"mapEmissive":u.emissiveMap=h(p,e.mapEmissiveRepeat,e.mapEmissiveOffset,e.mapEmissiveWrap,e.mapEmissiveAnisotropy);break;case"mapLight":u.lightMap=h(p,e.mapLightRepeat,e.mapLightOffset,e.mapLightWrap,e.mapLightAnisotropy);break;case"mapAO":u.aoMap=h(p,e.mapAORepeat,e.mapAOOffset,e.mapAOWrap,e.mapAOAnisotropy);break;case"mapBump":u.bumpMap=h(p,e.mapBumpRepeat,e.mapBumpOffset,e.mapBumpWrap,e.mapBumpAnisotropy);break;case"mapBumpScale":u.bumpScale=p;break;case"mapNormal":u.normalMap=h(p,e.mapNormalRepeat,e.mapNormalOffset,e.mapNormalWrap,e.mapNormalAnisotropy);break;case"mapNormalFactor":u.normalScale=p;break;case"mapSpecular":u.specularMap=h(p,e.mapSpecularRepeat,e.mapSpecularOffset,e.mapSpecularWrap,e.mapSpecularAnisotropy);break;case"mapMetalness":u.metalnessMap=h(p,e.mapMetalnessRepeat,e.mapMetalnessOffset,e.mapMetalnessWrap,e.mapMetalnessAnisotropy);break;case"mapRoughness":u.roughnessMap=h(p,e.mapRoughnessRepeat,e.mapRoughnessOffset,e.mapRoughnessWrap,e.mapRoughnessAnisotropy);break;case"mapAlpha":u.alphaMap=h(p,e.mapAlphaRepeat,e.mapAlphaOffset,e.mapAlphaWrap,e.mapAlphaAnisotropy);break;case"flipSided":u.side=o.BackSide;break;case"doubleSided":u.side=o.DoubleSide;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),u.opacity=p;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":u[d]=p;break;case"vertexColors":!0===p&&(u.vertexColors=o.VertexColors),"face"===p&&(u.vertexColors=o.FaceColors);break;default:console.error("THREE.Loader.createMaterial: Unsupported",d,p)}}return"MeshBasicMaterial"===u.type&&delete u.emissive,"MeshPhongMaterial"!==u.type&&delete u.specular,1>u.opacity&&(u.transparent=!0),s.setTextures(c),s.parse(u)})})},377:(e,t,r)=>{"use strict";r.d(t,{O:()=>c});var i=r(1515),n=new i.Matrix4,a=new i.Ray,s=new i.Sphere,o=new i.Vector3,l=new i.Vector3,h=new i.Vector3;class c extends i.Object3D{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new i.BufferGeometry,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new i.PointsMaterial;super(),this.type="Points",this.geometry=e,this.material=t,this.sizePerPixel=1,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){var r=this.geometry,i=this.matrixWorld,l=e.params.Points.threshold,h=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),s.copy(r.boundingSphere),s.applyMatrix4(i),s.radius+=l,!1!==e.ray.intersectsSphere(s)){n.copy(i).invert(),a.copy(e.ray).applyMatrix4(n);var c=l/((this.scale.x+this.scale.y+this.scale.z)/3)*this.material.size*this.sizePerPixel,p=c*c;if(r.isBufferGeometry){var m=r.index,f=r.attributes.position,v=r.morphAttributes.position;if(null!==m)for(var g,y=Math.max(0,h.start),x=Math.min(m.count,h.start+h.count),b=y;b<x;b++)d(this,f,v,g=m.getX(b)),u(o,g,p,i,e,t,this);else for(var w=Math.max(0,h.start),_=Math.min(f.count,h.start+h.count),M=w;M<_;M++)d(this,f,v,M),u(o,M,p,i,e,t,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,r=Object.keys(t);if(0<r.length){var i=t[r[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var n,a=0,s=i.length;a<s;a++)n=i[a].name||a+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=a}}}else{var o=e.morphTargets;void 0!==o&&0<o.length&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function u(e,t,r,n,s,o,l){var h=a.distanceSqToPoint(e);if(h<r){var c=new i.Vector3;a.closestPointToPoint(e,c),c.applyMatrix4(n);var u=s.ray.origin.distanceTo(c);if(u<s.near||u>s.far)return;o.push({distance:u,distanceToRay:Math.sqrt(h),point:c,index:t,face:null,object:l})}}function d(e,t,r,i){o.fromBufferAttribute(t,i);var n=e.morphTargetInfluences;if(e.material.morphTargets&&r&&n){l.set(0,0,0);for(var a=0,s=r.length;a<s;a++){var c=n[a],u=r[a];0!==c&&(h.fromBufferAttribute(u,i),l.addScaledVector(h.sub(o),c))}o.add(l)}}c.prototype.isPoints=!0},9236:(e,t,r)=>{"use strict";r.d(t,{G:()=>n});var i=r(1515);i.UniformsLib.line={linewidth:{value:1},resolution:{value:new i.Vector2(1,1)},dashScale:{value:1},dashSize:{value:1},dashOffset:{value:0},gapSize:{value:1},opacity:{value:1}},i.ShaderLib.line={uniforms:i.UniformsUtils.merge([i.UniformsLib.common,i.UniformsLib.fog,i.UniformsLib.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\tvarying vec2 vUv;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\tvUv = uv;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec2 ndcStart = clipStart.xy / clipStart.w;\n\t\t\tvec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd - ndcStart;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t// perpendicular to dir\n\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\n\t\t\t// undo aspect ratio adjustment\n\t\t\tdir.x /= aspect;\n\t\t\toffset.x /= aspect;\n\n\t\t\t// sign flip\n\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t// endcaps\n\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\toffset += - dir;\n\n\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\toffset += dir;\n\n\t\t\t}\n\n\t\t\t// adjust for linewidth\n\t\t\toffset *= linewidth;\n\n\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\toffset /= resolution.y;\n\n\t\t\t// select end\n\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t// back to clip space\n\t\t\toffset *= clip.w;\n\n\t\t\tclip.xy += offset;\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashSize;\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef ALPHA_TO_COVERAGE\n\n\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\tfloat a = vUv.x;\n\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\tfloat len2 = a * a + b * b;\n\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t}\n\n\t\t\t#else\n\n\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\tfloat a = vUv.x;\n\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t}\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}"};class n extends i.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:i.UniformsUtils.clone(i.ShaderLib.line.uniforms),vertexShader:i.ShaderLib.line.vertexShader,fragmentShader:i.ShaderLib.line.fragmentShader,clipping:!0}),Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return!!("USE_DASH"in this.defines)},set(e){!!e!=!!("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return!!("ALPHA_TO_COVERAGE"in this.defines)},set:function(e){!!e!=!!("ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}n.prototype.isLineMaterial=!0},1491:(e,t,r)=>{"use strict";r.d(t,{D:()=>g});var i=r(1515),n=new i.Vector3,a=new i.Vector3,s=new i.Matrix4,o=new i.Ray,l=new i.Sphere,h=new i.Vector3,c=new i.Vector3,u=new i.Vector3,d=new i.Vector3;class p extends i.Object3D{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:new i.BufferGeometry,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:new i.LineBasicMaterial;super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[0],s=1,o=t.count;s<o;s++)n.fromBufferAttribute(t,s-1),a.fromBufferAttribute(t,s),r[s]=r[s-1],r[s]+=n.distanceTo(a);e.setAttribute("lineDistance",new i.Float32BufferAttribute(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){var r=this.geometry,n=this.matrixWorld,a=e.params.Line.threshold,h=r.drawRange,c=r.morphAttributes.position;if(null===r.boundingSphere&&r.computeBoundingSphere(),l.copy(r.boundingSphere),l.applyMatrix4(n),l.radius+=a,!1!==e.ray.intersectsSphere(l)){s.copy(n).invert(),o.copy(e.ray).applyMatrix4(s);var u=a/((this.scale.x+this.scale.y+this.scale.z)/3),d=u*u,p=new i.Vector3,f=new i.Vector3,v=new i.Vector3,g=new i.Vector3,y=this.isLineSegments?2:1;if(r.isBufferGeometry){var x=r.index,b=r.attributes.position;if(null!==x){for(var w=Math.max(0,h.start),_=Math.min(x.count,h.start+h.count),M=w;M<_-1;M+=y)if(m(p,f,this,b,c,x.getX(M),x.getX(M+1)),!(o.distanceSqToSegment(p,f,g,v)>d)){g.applyMatrix4(this.matrixWorld);var S=e.ray.origin.distanceTo(g);S<e.near||S>e.far||t.push({distance:S,point:v.clone().applyMatrix4(this.matrixWorld),index:M,face:null,faceIndex:null,object:this})}}else for(var T=Math.max(0,h.start),E=Math.min(b.count,h.start+h.count),A=T;A<E-1;A+=y)if(m(p,f,this,b,c,A,A+1),!(o.distanceSqToSegment(p,f,g,v)>d)){g.applyMatrix4(this.matrixWorld);var L=e.ray.origin.distanceTo(g);L<e.near||L>e.far||t.push({distance:L,point:v.clone().applyMatrix4(this.matrixWorld),index:A,face:null,faceIndex:null,object:this})}}else r.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}updateMorphTargets(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,r=Object.keys(t);if(0<r.length){var i=t[r[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(var n,a=0,s=i.length;a<s;a++)n=i[a].name||a+"",this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=a}}}else{var o=e.morphTargets;void 0!==o&&0<o.length&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function m(e,t,r,i,n,a,s){e.fromBufferAttribute(i,a),t.fromBufferAttribute(i,s);var o=r.morphTargetInfluences;if(r.material.morphTargets&&n&&o){h.set(0,0,0),c.set(0,0,0);for(var l=0,p=n.length;l<p;l++){var m=o[l],f=n[l];0!==m&&(u.fromBufferAttribute(f,a),d.fromBufferAttribute(f,s),h.addScaledVector(u.sub(e),m),c.addScaledVector(d.sub(t),m))}e.add(h),t.add(c)}}p.prototype.isLine=!0;var f=new i.Vector3,v=new i.Vector3;class g extends p{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,r=[],n=0,a=t.count;n<a;n+=2)f.fromBufferAttribute(t,n),v.fromBufferAttribute(t,n+1),r[n]=0==n?0:r[n-1],r[n+1]=r[n]+f.distanceTo(v);e.setAttribute("lineDistance",new i.Float32BufferAttribute(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}g.prototype.isLineSegments=!0},8233:(e,t,r)=>{"use strict";r.d(t,{b:()=>y});var i=r(1515),n=r(5807),a=r(9236),s=new i.Vector3,o=new i.Vector3,l=new i.Vector4,h=new i.Vector4,c=new i.Vector4,u=new i.Vector3,d=new i.Matrix4,p=new i.Line3,m=new i.Vector3,f=new i.Box3,v=new i.Sphere,g=new i.Vector4;class y extends i.Mesh{constructor(){super(0<arguments.length&&void 0!==arguments[0]?arguments[0]:new n.n,1<arguments.length&&void 0!==arguments[1]?arguments[1]:new a.G({color:16777215*Math.random()})),this.type="LineSegments2"}computeLineDistances(){for(var e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,n=new Float32Array(2*t.count),a=0,l=0,h=t.count;a<h;a++,l+=2)s.fromBufferAttribute(t,a),o.fromBufferAttribute(r,a),n[l]=0==l?0:n[l-1],n[l+1]=n[l]+s.distanceTo(o);var c=new i.InstancedInterleavedBuffer(n,2,1);return e.setAttribute("instanceDistanceStart",new i.InterleavedBufferAttribute(c,1,0)),e.setAttribute("instanceDistanceEnd",new i.InterleavedBufferAttribute(c,1,1)),this}raycast(e,t){null===e.camera&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');var r=void 0===e.params.Line2?0:e.params.Line2.threshold||0,n=e.ray,a=e.camera,s=a.projectionMatrix,o=this.matrixWorld,y=this.geometry,x=this.material,b=x.resolution,w=x.linewidth+r,_=y.attributes.instanceStart,M=y.attributes.instanceEnd,S=-a.near,T=2*Math.max(w/b.width,w/b.height);null===y.boundingSphere&&y.computeBoundingSphere(),v.copy(y.boundingSphere).applyMatrix4(o);var E=Math.max(a.near,v.distanceToPoint(n.origin));g.set(0,0,-E,1).applyMatrix4(a.projectionMatrix),g.multiplyScalar(1/g.w),g.applyMatrix4(a.projectionMatrixInverse);var A=.5*Math.abs(T/g.w);if(v.radius+=A,!1!==e.ray.intersectsSphere(v)){null===y.boundingBox&&y.computeBoundingBox(),f.copy(y.boundingBox).applyMatrix4(o);var L=Math.max(a.near,f.distanceToPoint(n.origin));g.set(0,0,-L,1).applyMatrix4(a.projectionMatrix),g.multiplyScalar(1/g.w),g.applyMatrix4(a.projectionMatrixInverse);var R=.5*Math.abs(T/g.w);if(f.max.x+=R,f.max.y+=R,f.max.z+=R,f.min.x-=R,f.min.y-=R,f.min.z-=R,!1!==e.ray.intersectsBox(f)){n.at(1,c),c.w=1,c.applyMatrix4(a.matrixWorldInverse),c.applyMatrix4(s),c.multiplyScalar(1/c.w),c.x*=b.x/2,c.y*=b.y/2,c.z=0,u.copy(c),d.multiplyMatrices(a.matrixWorldInverse,o);for(var C=0,P=_.count;C<P;C++)if(l.fromBufferAttribute(_,C),h.fromBufferAttribute(M,C),l.w=1,h.w=1,l.applyMatrix4(d),h.applyMatrix4(d),!(l.z>S&&h.z>S)){if(l.z>S){var I=l.z-h.z,O=(l.z-S)/I;l.lerp(h,O)}else if(h.z>S){var D=h.z-l.z,N=(h.z-S)/D;h.lerp(l,N)}l.applyMatrix4(s),h.applyMatrix4(s),l.multiplyScalar(1/l.w),h.multiplyScalar(1/h.w),l.x*=b.x/2,l.y*=b.y/2,h.x*=b.x/2,h.y*=b.y/2,p.start.copy(l),p.start.z=0,p.end.copy(h),p.end.z=0;var B=p.closestPointToPointParameter(u,!0);p.at(B,m);var U=i.MathUtils.lerp(l.z,h.z,B),z=-1<=U&&1>=U,F=u.distanceTo(m)<.5*w;if(z&&F){p.start.fromBufferAttribute(_,C),p.end.fromBufferAttribute(M,C),p.start.applyMatrix4(o),p.end.applyMatrix4(o);var G=new i.Vector3,V=new i.Vector3;n.distanceSqToSegment(p.start,p.end,V,G),t.push({point:V,pointOnLine:G,distance:n.origin.distanceTo(V),object:this,face:null,faceIndex:C,uv:null,uv2:null})}}}}}}y.prototype.LineSegments2=!0},5807:(e,t,r)=>{"use strict";r.d(t,{n:()=>s});var i=r(1515),n=new i.Box3,a=new i.Vector3;class s extends i.InstancedBufferGeometry{constructor(){super(),this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new i.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new i.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){var t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var r=new i.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new i.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceEnd",new i.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){var t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var r=new i.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceColorStart",new i.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceColorEnd",new i.InterleavedBufferAttribute(r,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new i.WireframeGeometry(e.geometry)),this}fromLineSegments(e){var t=e.geometry;return t.isGeometry?void console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead."):(t.isBufferGeometry&&this.setPositions(t.attributes.position.array),this)}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new i.Box3);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),n.setFromBufferAttribute(t),this.boundingBox.union(n))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new i.Sphere),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var r=this.boundingSphere.center;this.boundingBox.getCenter(r);for(var n=0,s=0,o=e.count;s<o;s++)a.fromBufferAttribute(e,s),n=Math.max(n,r.distanceToSquared(a)),a.fromBufferAttribute(t,s),n=Math.max(n,r.distanceToSquared(a));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}s.prototype.isLineSegmentsGeometry=!0},2515:(e,t,r)=>{var i=r(1515),n=r(8154).V,a=r(8221).A;function s(e){var t=e,i=r(1913).modelPrefix;return i&&("/"!=i[i.length-1]&&function(e){throw new TypeError('"prefix" is read-only')}(),/^(?:[a-z]+:)?\/\//i.test(e)||(t=i+e)),t}function o(e,t,r,i){var n=new XMLHttpRequest;n.open("GET",s(e),!0),n.onreadystatechange=()=>{4==n.readyState&&(200==n.status?r(n.responseText,t):i(e))},n.send(null)}t.getColorsRGB=(e,t)=>{var r=Math.floor(t/3),n=t%3,a=0;0==n?a=e[r].r:1==n?a=e[r].g:2==n&&(a=e[r].b);var s=new i.Color(a);return[s.r,s.g,s.b]},t.updateMorphColorAttribute=function(e,t){if(t&&e&&e.morphAttributes&&e.morphAttributes.color){var r=e.morphAttributes.color,i=t.morphTargetInfluences,n=i.length;e.deleteAttribute("morphColor0"),e.deleteAttribute("morphColor1");for(var a=0,s=[],o=0;1>a||o<n;o++)0<i[o]&&(a++,s.push([o,i[o]]));2==s.length?(e.setAttribute("morphColor0",r[s[0][0]]),e.setAttribute("morphColor1",r[s[1][0]])):1==s.length&&(e.setAttribute("morphColor0",r[s[0][0]]),e.setAttribute("morphColor1",r[s[0][0]]))}},t.toBufferGeometry=(e,t)=>{var r;return e instanceof n?(t.localTimeEnabled&&!e.morphNormalsReady&&(null==e.morphNormals||0==e.morphNormals.length)&&e.computeMorphNormals(),r=e.toIndexedBufferGeometry(),t.localMorphColour&&l(e,r)):e instanceof i.BufferGeometry&&(r=e.clone()),r.colorsNeedUpdate=!0,r.computeBoundingBox(),r.computeBoundingSphere(),e._video&&(r._video=e._video),r},t.copyMorphColorsToBufferGeometry=(e,t)=>{if(e&&e.morphColors&&0<e.morphColors.length){for(var n=[],a=e.morphColors,s=r(2515).getColorsRGB,o=0,l=a.length;o<l;o++){for(var h=a[o],c=[],u=0;u<e.faces.length;u++){var d=e.faces[u],p=s(h.colors,d.a);c.push(p[0],p[1],p[2]),p=s(h.colors,d.b),c.push(p[0],p[1],p[2]),p=s(h.colors,d.c),c.push(p[0],p[1],p[2])}var m=new i.Float32BufferAttribute(3*e.faces.length*3,3);m.name=h.name,n.push(m.copyArray(c))}t.morphAttributes.color=n}};var l=(e,t)=>{if(e&&e.morphColors&&0<e.morphColors.length){for(var n=[],a=e.morphColors,s=r(2515).getColorsRGB,o=0,l=a.length;o<l;o++){for(var h,c=a[o],u=[],d=0;d<3*c.colors.length;d++)h=s(c.colors,d),u.push(h[0],h[1],h[2]);var p=new i.Float32BufferAttribute(u,3);p.name=c.name,n.push(p)}t.morphAttributes.color=n}};t.mergeVertices=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:1e-4;t=Math.max(t,Number.EPSILON);for(var r={},n=e.getIndex(),a=e.getAttribute("position"),s=n?n.count:a.count,o=0,l=Object.keys(e.attributes),h={},c={},u=[],d=["getX","getY","getZ","getW"],p=0,m=l.length;p<m;p++)h[b=l[p]]=[],(T=e.morphAttributes[b])&&(c[b]=Array(T.length).fill().map((()=>[])));var f=Math.log10(1/t),v=Math.pow(10,f);for(p=0;p<s;p++){var g=n?n.getX(p):p,y="",x=0;for(m=l.length;x<m;x++)for(var b=l[x],w=(S=e.getAttribute(b)).itemSize,_=0;_<w;_++)y+="".concat(~~(S[d[_]](g)*v),",");if(y in r)u.push(r[y]);else{for(x=0,m=l.length;x<m;x++){b=l[x];var M,S=e.getAttribute(b),T=e.morphAttributes[b],E=(w=S.itemSize,h[b]),A=c[b];for(_=0;_<w;_++)if(M=d[_],E.push(S[M](g)),T)for(var L=0,R=T.length;L<R;L++)A[L].push(T[L][M](g))}r[y]=o,u.push(o),o++}}var C=e.clone();for(p=0,m=l.length;p<m;p++){b=l[p];var P,I=e.getAttribute(b),O=new I.array.constructor(h[b]);if(I.isInterleavedBufferAttribute?S=new i.BufferAttribute(O,I.itemSize,I.itemSize):(S=e.getAttribute(b).clone()).setArray(O),C.setAttribute(b,S),b in c)for(x=0;x<c[b].length;x++)(P=e.morphAttributes[b][x].clone()).setArray(new P.array.constructor(c[b][x])),C.morphAttributes[b][x]=P}var D=Uint8Array;u.length>=Math.pow(2,8)&&(D=Uint16Array),u.length>=Math.pow(2,16)&&(D=Uint32Array);var N=new D(u);return u=null,null===n?u=new i.BufferAttribute(N,1):(u=e.getIndex().clone()).setArray(N),C.setIndex(u),C},t.getBoundingBox=function(e,t,r,i,n){var a=e.morphTargetInfluences,s=void 0;e.geometry&&(s=e.geometry.morphAttributes);var o=!1;if(a&&s&&s.position){i.set(0,0,0),n.set(0,0,0);for(var l=0;l<a.length;l++)0<a[l]&&(o=!0,r.setFromArray(s.position[l].array),i.add(r.min.multiplyScalar(a[l])),n.add(r.max.multiplyScalar(a[l])));o&&t.set(i,n)}o||t.setFromBufferAttribute(e.geometry.attributes.position),e.updateWorldMatrix(!0,!0),t.applyMatrix4(e.matrixWorld)},t.createNewURL=function(e,t){var r=(e,t)=>{try{var r=new URL(e,t).href;if(e&&2>e.split("?").length){var i=t.split("?");2===i.length&&(r=r+"?"+i[1])}return r}catch(t){console.error("There is an issue creating the url link with: ".concat(e,"."))}};if(!Array.isArray(e))return r(e,t);var i=[];return e.forEach((e=>{i.push(r(e,t))})),i},t.createBufferGeometry=function(e,t){if(t&&e>=t.length){var r=new i.BufferGeometry,n=new Float32Array(3*e),a=0;return t.forEach((e=>{n[a++]=e[0],n[a++]=e[1],n[a++]=e[2]})),r.setAttribute("position",new i.BufferAttribute(n,3)),r.setDrawRange(0,t.length),r}},t.getCircularTexture=function(){var e=new Image;e.src=r(2978);var t=new i.Texture;return t.image=e,t.needsUpdate=!0,t},t.resolveURL=s,t.loadExternalFile=o,t.loadExternalFiles=function(e,t,r){function i(e,r){s[r]=e,++a==n&&t(s)}for(var n=e.length,a=0,s=[],l=0;l<n;l++)o(e[l],l,i,r)},t.PhongToToon=function(e){if(e.isMeshPhongMaterial){var t=new i.MeshToonMaterial({color:e.color.clone(),morphTargets:e.morphTargets,morphNormals:e.morphNormals,vertexColors:e.vertexColors,transparent:e.transparent,opacity:e.opacity,side:e.side});return e.map&&(t.map=e.map),t}return e},t.createNewSpriteText=function(e,t,r,i,n,s){var o=new a(e,t,r,i,n,s);return o.fontFace=i,o.fontSize=n,o.fontWeight=s,o.material.map.generateMipmaps=!1,o.material.map.anisotropy=4,o.material.sizeAttenuation=!1,o.material.alphaTest=.5,o.material.transparent=!0,o.material.depthWrite=!1,o.material.depthTest=!1,o.center.set(.5,-1.2),o.renderOrder=1e4,o},t.isRegionGroup=function(e,t,r){if(r){var i=e||"",n=t||"",a=r.lastIndexOf("/");if(-1<a){var s=void 0,o=void 0;if(s=r.substring(0,a),o=r.substring(a+1),!("*"!==s&&"**"!==s&&s.toLowerCase()!==i.toLowerCase()||"*"!==o&&"**"!==o&&o.toLowerCase()!==n.toLowerCase()))return!0}else if(i.toLowerCase()===r.toLowerCase()||n.toLowerCase()===r.toLowerCase())return!0}return!1}},1574:(e,t,r)=>{var i=r(1515);t.i=function(e){var t=this;this.video=void 0,this.videoTexture=void 0,this.setMorphTime=function(e,r){var i=e/r*t.video.duration;t.video.currentTime=i},this.getVideoDuration=function(){return t.video.duration},this.createCanvasVideoTexture=function(){return t.videoTexture=new i.VideoTexture(t.video),t.videoTexture.minFilter=i.LinearFilter,t.videoTexture.magFilter=i.LinearFilter,t.videoTexture.format=i.RGBFormat,t.video.currentTime=0,t.videoTexture},this.getCurrentTime=function(e){return t.video?e*(t.video.currentTime/t.video.duration):0},this.isReadyToPlay=function(){return!!(t.video&&3<=t.video.readyState)},document&&(t.video=document.createElement("video"),t.video.crossOrigin="anonymous",t.video.src=e,t.video.load(),t.video.loop=!0)}},4494:(e,t,r)=>{var i=r(5672).V,n=r(1515),a=n.BufferGeometryLoader;e.exports=function(e){var t=void 0,s=function(e){var t=(new a).parse(e),r=new n.MeshPhongMaterial,s=new n.Mesh(t.geometry,r),o=new i;return o.setMorph(s),o};e.addEventListener("message",(function(i){switch(i.data.action){case"initialise":n=i.data.object,a=s(n),t=new(r(8701).$)(a),e.postMessage({action:"message",message:"Initialised"});break;case"intersect":!function(r){if(t){var i=s(r),n=t.intersect(i).toBufferGeometry().toJSON();e.postMessage({action:"result",object:n})}}(i.data.object);break;case"subtract":!function(r){if(t){var i=s(r),n=t.subtract(i).toBufferGeometry().toJSON();e.postMessage({action:"result",object:n})}}(i.data.object);break;case"union":!function(r){if(t){var i=s(r),n=t.union(i).toBufferGeometry().toJSON();e.postMessage({action:"result",object:n})}}(i.data.object);break;default:throw"Cannot handle specified action."}var n,a}))}},8701:(e,t,r)=>{var i=r(1515),n=r(6133)(i);r(5672).V,r(3152).w,t.$=function(e){var t,r;e&&e.isGeometry&&(t=e),this.setGeometry=e=>{e&&e.isGeometry&&(t=e),r=void 0},this.setCSG=e=>{r=e};var i=e=>{if(t&&t.morph&&e&&e.morph)return void 0===r&&(r=new n(t.morph)),new n(e.morph)};this.intersect=e=>{var t=i(e);return r&&t?r.intersect(t):void 0},this.subtract=e=>{var t=i(e);return r&&t?r.subtract(t):void 0},this.union=e=>{var t=i(e);return r&&t?r.union(t):void 0}}},1913:(e,t,r)=>{r(6550);var i=r(8330).version;e.exports=new function(){this.Revision=i,this.defaultMaterialColor=16777215,this.defaultOpacity=1,this.modelPrefix=void 0,this.Geometry=r(5672).V,this.Glyph=r(9344).z,this.Glyphset=r(2842).V,this.Pointset=r(770).t,this.Label=r(4296).J,this.Lines=r(8145).q,this.TextureArray=r(3523).$,this.TextureSlides=r(4291).W,this.Renderer=r(3260).A,this.Scene=r(5015).Z,this.GeometryCSG=r(3152).w,this.GlyphsetCSG=r(1602).K,this.Viewport=r(701).Viewport,this.CameraControls=r(701).CameraControls,this.SmoothCameraTransition=r(701).SmoothCameraTransition,this.RayCaster=r(701).RayCaster,this.CameraAutoTumble=r(701).CameraAutoTumble,this.StereoEffect=r(701).StereoEffect,this.loadExternalFile=r(2515).loadExternalFile,this.loadExternalFiles=r(2515).loadExternalFiles,this.THREE=r(1515)}},2978:e=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sHDgwCEMBJZu0AAAAdaVRYdENvbW1lbnQAAAAAAENyZWF0ZWQgd2l0aCBHSU1QZC5lBwAABM5JREFUWMO1V0tPG2cUPZ4Hxh6DazIOrjFNqJs0FIMqWFgWQkatsmvVbtggKlSVRVf5AWz4AWz4AUSKEChll19QJYSXkECuhFxsHjEhxCYm+DWGMZ5HF72DJq4bAzFXurI0M/I5997v3u9cC65vTJVn2lX/xHINQOYSBLTLEuIuCWw4Z3IGAEvf6ASmVHjNzHCXBG4A0AjACsAOwEbO0nsFQBnAGYASAIl+ZRMR7SolMEdsByD09fV5R0ZGgg8ePPjW5/N1iqLYpuu6RZblciKR2I9Go69evnwZnZ+fjwI4IS8AKBIRzeQfJWCANwKwh0KhtrGxsYehUOin1tbW+zzP23ietzY2NnIAoGmaLsuyUiqVyvl8XtrY2NiamZn589mzZxsAUgCOAeQAnFI2tI+VxIjaAeDzoaGh7xYWFuZOTk6OZVk+12uYqqq6JEnn0Wg0OT4+/geAXwGEAdwDIFJQXC1wO4DWR48e/RCPxxclSSroVzRFUbSDg4P848ePFwH8DuAhkWih83TRQWxFOXgAwvDwcOfo6OhvXV1d39tsNtuVBwTDWBwOh1UUxVsMw1hXVlbSdCgNV43uYSvrHg6H24aHh38eHBz85TrgF9FYLHA4HLzH43FvbW2d7u/vG+dANp8FpqIlbd3d3V8Fg8EfBUFw4BONZVmL3+9vHhkZCQL4AoAHgJPK8G+yzC0XDofdoVAo5PP5vkadTBAEtr+/39ff3x8gAp/RPOEqx2qjx+NpvXv3bk9DQ0NDvQgwDIOWlhZrMBj8kgi0UJdxRgYMArzL5XJ7vd57qLPZ7Xamp6fnNgBXtQxcjFuHw+Hyer3t9SYgCAITCAScAJoBNNEY/08GOFVVrfVMv7kMNDntFD1vjIAPrlRN0xjckOm6biFQ3jwNPwDMZrOnqVTqfb3Bi8Wivru7W/VCYkwPlKOjo0IikXh7EwQikYgE4Nw0CfXKDCipVCoTj8df3QABbW1tLUc6oUgkFPMkVACUNjc337148eKvw8PDbJ2jP1taWkoCyNDVXDSECmNSK4qiKNLq6urW8+fPI/UicHx8rD59+jSVy+WOAKSJhKENwFItLtoxk8mwsixzHR0dHe3t7c5PAU+n09rs7OzJkydPYqVSaQfANoDXALIk31S2smU1TWMPDg7K5XKZ7+3t9TudTut1U7+wsFCcmJiIpdPpbQBxADsAknQWymYCOukBHYCuKApisdhpMpnURFEU79y503TVyKenpzOTk5M7e3t7MQKPV0Zv1gNm+awB0MvlshqLxfLb29uyJElWURSbXC4XXyvqxcXFs6mpqeTc3Nzu3t7e3wQcA7BPZ8Cov1pNlJplmQtAG8MwHV6v95tAINA5MDBwPxAIuLu6upr8fr/VAN3c3JQjkcjZ+vp6fnl5+d2bN29SuVzuNYAEpf01CdRChUL+X1VskHACuA3Ay3Fcu9vt7nA6nZ7m5uYWQRCaNE3jVVW15PP580KhIGUymWw2m00DOAJwSP4WwPtq4LX2Ao6USxNlQyS/RcQcdLGwlNIz6vEMAaZpNzCk2Pll94LK/cDYimxERiBwG10sxjgvEZBE0UpE6vxj+0Ct5bTaXthgEhRmja8QWNkkPGsuIpfdjpkK+cZUWTC0KredVmtD/gdlSl6EG4AMvQAAAABJRU5ErkJggg=="},2370:e=>{e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pg0KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgdmlld0JveD0iMCAwIDM2NSA1NjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4NCjxkZWZzPg0KPC9kZWZzPg0KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCAwKSIgaWQ9IjgwOGVkMjgzLTI1MjQtNDQwZi04OGFlLTNiZGI0N2JiNTc0OSIgID4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4NCjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItMTgyLjUiIHk9Ii0yODAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIC8+DQo8L2c+DQo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+DQo8ZyBzdHlsZT0iIiAgID4NCjwvZz4NCjwvZz4NCjxnIHRyYW5zZm9ybT0ibWF0cml4KDAgMCAwIDAgMCA5Ny41KSIgID4NCjxnIHN0eWxlPSIiICAgPg0KPC9nPg0KPC9nPg0KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMC45OSAwIDAgMC45OSAxODIuNSAyODApIiAgPg0KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii01NDAiIHk9Ii01NDAiIHJ4PSIwIiByeT0iMCIgd2lkdGg9IjEwODAiIGhlaWdodD0iMTA4MCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIDApIiAgPg0KPHBhdGggc3R5bGU9InN0cm9rZTogcmdiKDAsMCwwKTsgc3Ryb2tlLXdpZHRoOiAwOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMCw4OSwxMTYpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB0cmFuc2Zvcm09IiB0cmFuc2xhdGUoLTE4Mi45LCAtMjc5Ljg1KSIgZD0iTSAxODIuOSA1NTEuNyBDIDE4Mi45IDU1MS44MDAwMDAwMDAwMDAxIDE4My4xIDU1MiAxODMuMSA1NTIgQyAxODMuMSA1NTIgMzU4LjMgMjgzIDM1OC4zIDE5NC42IEMgMzU4LjMgNjQuNSAyNjkuNSA3LjkwMDAwMDAwMDAwMDAwNiAxODIuOSA3LjY5OTk5OTk5OTk5OTk4OSBDIDk2LjMgNy45IDcuNSA2NC41IDcuNSAxOTQuNiBDIDcuNSAyODMgMTgyLjggNTUyIDE4Mi44IDU1MiBDIDE4Mi44IDU1MiAxODIuOSA1NTEuNyAxODIuOSA1NTEuNyB6IE0gMTIyLjIgMTg3LjIgQyAxMjIuMiAxNTMuNiAxNDkuNCAxMjYuMzk5OTk5OTk5OTk5OTkgMTgzIDEyNi4zOTk5OTk5OTk5OTk5OSBDIDIxNi42IDEyNi4zOTk5OTk5OTk5OTk5OSAyNDMuOCAxNTMuNiAyNDMuOCAxODcuMiBDIDI0My44IDIyMC43OTk5OTk5OTk5OTk5OCAyMTYuNSAyNDggMTgyLjkgMjQ4IEMgMTQ5LjQgMjQ4IDEyMi4yIDIyMC44IDEyMi4yIDE4Ny4yIHoiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgLz4NCjwvZz4NCgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPg0KPGNpcmNsZSBzdHlsZT0ic3Ryb2tlOiByZ2IoMCwwLDApOyBzdHJva2Utd2lkdGg6IDA7IHN0cm9rZS1kYXNoYXJyYXk6IG5vbmU7IHN0cm9rZS1saW5lY2FwOiBidXR0OyBzdHJva2UtZGFzaG9mZnNldDogMDsgc3Ryb2tlLWxpbmVqb2luOiBtaXRlcjsgc3Ryb2tlLW1pdGVybGltaXQ6IDQ7IGZpbGw6IHJnYigyNTUsMjU1LDI1NSk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIGN4PSIwIiBjeT0iMCIgcj0iMzUiIC8+DQo8L2c+DQo8L2c+DQo8L2c+DQo8L3N2Zz4="},7328:e=>{e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIiA/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgd2lkdGg9IjM2NSIgaGVpZ2h0PSI1NjAiIHZpZXdCb3g9IjAgMCAzNjUgNTYwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGRlc2M+Q3JlYXRlZCB3aXRoIEZhYnJpYy5qcyA1LjIuNDwvZGVzYz4KPGRlZnM+CjwvZGVmcz4KPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0idHJhbnNwYXJlbnQiPjwvcmVjdD4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDApIiBpZD0iODA4ZWQyODMtMjUyNC00NDBmLTg4YWUtM2JkYjQ3YmI1NzQ5IiAgPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgMTgyLjUgMjgwKSIgaWQ9ImRiMzA0MTNkLTViZmYtNGI5OC1hYjU5LTQ2NDQ5N2VlMTk5ZSIgID4KPHJlY3Qgc3R5bGU9InN0cm9rZTogbm9uZTsgc3Ryb2tlLXdpZHRoOiAxOyBzdHJva2UtZGFzaGFycmF5OiBub25lOyBzdHJva2UtbGluZWNhcDogYnV0dDsgc3Ryb2tlLWRhc2hvZmZzZXQ6IDA7IHN0cm9rZS1saW5lam9pbjogbWl0ZXI7IHN0cm9rZS1taXRlcmxpbWl0OiA0OyBmaWxsOiByZ2IoMjU1LDI1NSwyNTUpOyBmaWxsLXJ1bGU6IG5vbnplcm87IG9wYWNpdHk6IDE7IHZpc2liaWxpdHk6IGhpZGRlbjsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHg9Ii0xODIuNSIgeT0iLTI4MCIgcng9IjAiIHJ5PSIwIiB3aWR0aD0iMzY1IiBoZWlnaHQ9IjU2MCIgLz4KPC9nPgo8ZyB0cmFuc2Zvcm09Im1hdHJpeCgwIDAgMCAwIDAgOTcuNSkiICA+CjxnIHN0eWxlPSIiICAgPgo8L2c+CjwvZz4KPGcgdHJhbnNmb3JtPSJtYXRyaXgoMCAwIDAgMCAwIDk3LjUpIiAgPgo8ZyBzdHlsZT0iIiAgID4KPC9nPgo8L2c+CjxnIHRyYW5zZm9ybT0ibWF0cml4KDAuOTkgMCAwIDAuOTkgMTgyLjUgMjgwKSIgID4KPGcgc3R5bGU9IiIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgID4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxyZWN0IHN0eWxlPSJzdHJva2U6IG5vbmU7IHN0cm9rZS13aWR0aDogMTsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyB2aXNpYmlsaXR5OiBoaWRkZW47IiB2ZWN0b3ItZWZmZWN0PSJub24tc2NhbGluZy1zdHJva2UiICB4PSItNTQwIiB5PSItNTQwIiByeD0iMCIgcnk9IjAiIHdpZHRoPSIxMDgwIiBoZWlnaHQ9IjEwODAiIC8+CjwvZz4KCQk8ZyB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgMCkiICA+CjxwYXRoIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwxNjUsMCk7IGZpbGwtcnVsZTogbm9uemVybzsgb3BhY2l0eTogMTsiIHZlY3Rvci1lZmZlY3Q9Im5vbi1zY2FsaW5nLXN0cm9rZSIgIHRyYW5zZm9ybT0iIHRyYW5zbGF0ZSgtMTgyLjksIC0yNzkuODUpIiBkPSJNIDE4Mi45IDU1MS43IEMgMTgyLjkgNTUxLjgwMDAwMDAwMDAwMDEgMTgzLjEgNTUyIDE4My4xIDU1MiBDIDE4My4xIDU1MiAzNTguMyAyODMgMzU4LjMgMTk0LjYgQyAzNTguMyA2NC41IDI2OS41IDcuOTAwMDAwMDAwMDAwMDA2IDE4Mi45IDcuNjk5OTk5OTk5OTk5OTg5IEMgOTYuMyA3LjkgNy41IDY0LjUgNy41IDE5NC42IEMgNy41IDI4MyAxODIuOCA1NTIgMTgyLjggNTUyIEMgMTgyLjggNTUyIDE4Mi45IDU1MS43IDE4Mi45IDU1MS43IHogTSAxMjIuMiAxODcuMiBDIDEyMi4yIDE1My42IDE0OS40IDEyNi4zOTk5OTk5OTk5OTk5OSAxODMgMTI2LjM5OTk5OTk5OTk5OTk5IEMgMjE2LjYgMTI2LjM5OTk5OTk5OTk5OTk5IDI0My44IDE1My42IDI0My44IDE4Ny4yIEMgMjQzLjggMjIwLjc5OTk5OTk5OTk5OTk4IDIxNi41IDI0OCAxODIuOSAyNDggQyAxNDkuNCAyNDggMTIyLjIgMjIwLjggMTIyLjIgMTg3LjIgeiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiAvPgo8L2c+CgkJPGcgdHJhbnNmb3JtPSJtYXRyaXgoMy44MiAwIDAgMy44MiAwIC0xMDAuNzcpIiAgPgo8Y2lyY2xlIHN0eWxlPSJzdHJva2U6IHJnYigwLDAsMCk7IHN0cm9rZS13aWR0aDogMDsgc3Ryb2tlLWRhc2hhcnJheTogbm9uZTsgc3Ryb2tlLWxpbmVjYXA6IGJ1dHQ7IHN0cm9rZS1kYXNob2Zmc2V0OiAwOyBzdHJva2UtbGluZWpvaW46IG1pdGVyOyBzdHJva2UtbWl0ZXJsaW1pdDogNDsgZmlsbDogcmdiKDI1NSwyNTUsMjU1KTsgZmlsbC1ydWxlOiBub256ZXJvOyBvcGFjaXR5OiAxOyIgdmVjdG9yLWVmZmVjdD0ibm9uLXNjYWxpbmctc3Ryb2tlIiAgY3g9IjAiIGN5PSIwIiByPSIzNSIgLz4KPC9nPgo8L2c+CjwvZz4KPC9zdmc+"},9425:(e,t,r)=>{"use strict";r.d(t,{B:()=>n});var i=r(1515);class n extends i.Loader{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new h(e)})),this.register((function(e){return new u(e)})),this.register((function(e){return new d(e)})),this.register((function(e){return new c(e)})),this.register((function(e){return new o(e)})),this.register((function(e){return new p(e)}))}load(e,t,r,n){var a,s=this;a=""===this.resourcePath?""===this.path?i.LoaderUtils.extractUrlBase(e):this.path:this.resourcePath,this.manager.itemStart(e);var o=function(t){n?n(t):console.error(t),s.manager.itemError(e),s.manager.itemEnd(e)},l=new i.FileLoader(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(function(r){try{s.parse(r,a,(function(r){t(r),s.manager.itemEnd(e)}),o)}catch(e){o(e)}}),r,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,n){var a,o={},h={};if("string"==typeof e)a=e;else if(i.LoaderUtils.decodeText(new Uint8Array(e,0,4))===m){try{o[s.KHR_BINARY_GLTF]=new f(e)}catch(e){return void(n&&n(e))}a=o[s.KHR_BINARY_GLTF].content}else a=i.LoaderUtils.decodeText(new Uint8Array(e));var c=JSON.parse(a);if(void 0===c.asset||2>c.asset.version[0])n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var u=new N(c,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(var d,p=0;p<this.pluginCallbacks.length;p++)h[(d=this.pluginCallbacks[p](u)).name]=d,o[d.name]=!0;if(c.extensionsUsed)for(var y=0;y<c.extensionsUsed.length;++y){var w=c.extensionsUsed[y],_=c.extensionsRequired||[];w===s.KHR_MATERIALS_UNLIT?o[w]=new l:w===s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS?o[w]=new x:w===s.KHR_DRACO_MESH_COMPRESSION?o[w]=new v(c,this.dracoLoader):w===s.KHR_TEXTURE_TRANSFORM?o[w]=new g:w===s.KHR_MESH_QUANTIZATION?o[w]=new b:0<=_.indexOf(w)&&void 0===h[w]&&console.warn('THREE.GLTFLoader: Unknown extension "'+w+'".')}u.setExtensions(o),u.setPlugins(h),u.parse(r,n)}}}function a(){var e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var s={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",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class o{constructor(e){this.parser=e,this.name=s.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){for(var e,t=this.parser,r=this.parser.json.nodes||[],i=0,n=r.length;i<n;i++)(e=r[i]).extensions&&e.extensions[this.name]&&void 0!==e.extensions[this.name].light&&t._addNodeRef(this.cache,e.extensions[this.name].light)}_loadLight(e){var t=this.parser,r="light:"+e,n=t.cache.get(r);if(n)return n;var a,s=t.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e],l=new i.Color(16777215);void 0!==o.color&&l.fromArray(o.color);var h=void 0===o.range?0:o.range;switch(o.type){case"directional":(a=new i.DirectionalLight(l)).target.position.set(0,0,-1),a.add(a.target);break;case"point":(a=new i.PointLight(l)).distance=h;break;case"spot":(a=new i.SpotLight(l)).distance=h,o.spot=o.spot||{},o.spot.innerConeAngle=void 0===o.spot.innerConeAngle?0:o.spot.innerConeAngle,o.spot.outerConeAngle=void 0===o.spot.outerConeAngle?Math.PI/4:o.spot.outerConeAngle,a.angle=o.spot.outerConeAngle,a.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return a.position.set(0,0,0),a.decay=2,void 0!==o.intensity&&(a.intensity=o.intensity),a.name=t.createUniqueName(o.name||"light_"+e),n=Promise.resolve(a),t.cache.add(r,n),n}createNodeAttachment(e){var t=this,r=this.parser,i=r.json.nodes[e],n=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===n?null:this._loadLight(n).then((function(e){return r._getNodeRef(t.cache,n,e)}))}}class l{constructor(){this.name=s.KHR_MATERIALS_UNLIT}getMaterialType(){return i.MeshBasicMaterial}extendParams(e,t,r){var n=[];e.color=new i.Color(1,1,1),e.opacity=1;var a=t.pbrMetallicRoughness;if(a){if(Array.isArray(a.baseColorFactor)){var s=a.baseColorFactor;e.color.fromArray(s),e.opacity=s[3]}void 0!==a.baseColorTexture&&n.push(r.assignTexture(e,"map",a.baseColorTexture))}return Promise.all(n)}}class h{constructor(e){this.parser=e,this.name=s.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?i.MeshPhysicalMaterial:null}extendMaterialParams(e,t){var r=this.parser,n=r.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();var a=[],s=n.extensions[this.name];if(void 0!==s.clearcoatFactor&&(t.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&a.push(r.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&a.push(r.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(a.push(r.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){var o=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new i.Vector2(o,-o)}return Promise.all(a)}}class c{constructor(e){this.parser=e,this.name=s.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){var t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?i.MeshPhysicalMaterial:null}extendMaterialParams(e,t){var r=this.parser,i=r.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();var n=[],a=i.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&n.push(r.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(n)}}class u{constructor(e){this.parser=e,this.name=s.KHR_TEXTURE_BASISU}loadTexture(e){var t=this.parser,r=t.json,i=r.textures[e];if(!i.extensions||!i.extensions[this.name])return null;var n=i.extensions[this.name],a=r.images[n.source],s=t.options.ktx2Loader;if(!s){if(r.extensionsRequired&&0<=r.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,a,s)}}class d{constructor(e){this.parser=e,this.name=s.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){var t=this.name,r=this.parser,i=r.json,n=i.textures[e];if(!n.extensions||!n.extensions[t])return null;var a=n.extensions[t],s=i.images[a.source],o=r.textureLoader;if(s.uri){var l=r.options.manager.getHandler(s.uri);null!==l&&(o=l)}return this.detectSupport().then((function(n){if(n)return r.loadTextureImage(e,s,o);if(i.extensionsRequired&&0<=i.extensionsRequired.indexOf(t))throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){var t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class p{constructor(e){this.name=s.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){var t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){var i=r.extensions[this.name],n=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&0<=t.extensionsRequired.indexOf(this.name))throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([n,a.ready]).then((function(e){var t=i.byteOffset||0,r=i.byteLength||0,n=i.count,s=i.byteStride,o=new ArrayBuffer(n*s),l=new Uint8Array(e[0],t,r);return a.decodeGltfBuffer(new Uint8Array(o),n,s,l,i.mode,i.filter),o}))}return null}}var m="glTF";class f{constructor(e){this.name=s.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,12);if(this.header={magic:i.LoaderUtils.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==m)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(2>this.header.version)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");for(var r,n=this.header.length-12,a=new DataView(e,12),o=0;o<n;){r=a.getUint32(o,!0),o+=4;var l=a.getUint32(o,!0);if(o+=4,1313821514===l){var h=new Uint8Array(e,12+o,r);this.content=i.LoaderUtils.decodeText(h)}else if(5130562===l){var c=12+o;this.body=e.slice(c,c+r)}o+=r}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class v{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=s.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){var r=this.json,i=this.dracoLoader,n=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,s={},o={},l={};for(var h in a){var c=E[h]||h.toLowerCase();s[c]=a[h]}for(var u in e.attributes){var d=E[u]||u.toLowerCase();if(void 0!==a[u]){var p=r.accessors[e.attributes[u]],m=_[p.componentType];l[d]=m,o[d]=!0===p.normalized}}return t.getDependency("bufferView",n).then((function(e){return new Promise((function(t){i.decodeDracoFile(e,(function(e){for(var r in e.attributes){var i=e.attributes[r],n=o[r];void 0!==n&&(i.normalized=n)}t(e)}),s,l)}))}))}}class g{constructor(){this.name=s.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(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),e.needsUpdate=!0),e}}class y extends i.MeshStandardMaterial{constructor(e){super(),this.isGLTFSpecularGlossinessMaterial=!0;var t=["#ifdef USE_SPECULARMAP","\tuniform sampler2D specularMap;","#endif"].join("\n"),r=["#ifdef USE_GLOSSINESSMAP","\tuniform sampler2D glossinessMap;","#endif"].join("\n"),n=["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"),a=["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"),s=["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 i.Color).setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=o,this.onBeforeCompile=function(e){for(var i in o)e.uniforms[i]=o[i];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>",r).replace("#include <roughnessmap_fragment>",n).replace("#include <metalnessmap_fragment>",a).replace("#include <lights_physical_fragment>",s)},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)}copy(e){return super.copy(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}}class x{constructor(){this.name=s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.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(){return y}extendParams(e,t,r){var n=t.extensions[this.name];e.color=new i.Color(1,1,1),e.opacity=1;var a=[];if(Array.isArray(n.diffuseFactor)){var s=n.diffuseFactor;e.color.fromArray(s),e.opacity=s[3]}if(void 0!==n.diffuseTexture&&a.push(r.assignTexture(e,"map",n.diffuseTexture)),e.emissive=new i.Color(0,0,0),e.glossiness=void 0===n.glossinessFactor?1:n.glossinessFactor,e.specular=new i.Color(1,1,1),Array.isArray(n.specularFactor)&&e.specular.fromArray(n.specularFactor),void 0!==n.specularGlossinessTexture){var o=n.specularGlossinessTexture;a.push(r.assignTexture(e,"glossinessMap",o)),a.push(r.assignTexture(e,"specularMap",o))}return Promise.all(a)}createMaterial(e){var t=new y(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=i.TangentSpaceNormalMap,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}}class b{constructor(){this.name=s.KHR_MESH_QUANTIZATION}}class w extends i.Interpolant{constructor(e,t,r,i){super(e,t,r,i)}copySampleValue_(e){for(var t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,n=0;n!==i;n++)t[n]=r[e*i*3+i+n];return t}}w.prototype.beforeStart_=w.prototype.copySampleValue_,w.prototype.afterEnd_=w.prototype.copySampleValue_,w.prototype.interpolate_=function(e,t,r,i){for(var n=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=3*s,l=i-t,h=(r-t)/l,c=h*h,u=c*h,d=e*o,p=d-o,m=-2*u+3*c,f=u-c,v=0;v!==s;v++){var g=a[p+v+s],y=a[p+v+2*s]*l,x=a[d+v+s],b=a[d+v]*l;n[v]=(1-m)*g+(f-c+h)*y+m*x+f*b}return n};var _={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},M={9728:i.NearestFilter,9729:i.LinearFilter,9984:i.NearestMipmapNearestFilter,9985:i.LinearMipmapNearestFilter,9986:i.NearestMipmapLinearFilter,9987:i.LinearMipmapLinearFilter},S={33071:i.ClampToEdgeWrapping,33648:i.MirroredRepeatWrapping,10497:i.RepeatWrapping},T={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},E={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},A={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},L={CUBICSPLINE:void 0,LINEAR:i.InterpolateLinear,STEP:i.InterpolateDiscrete};function R(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 C(e,t,r){for(var i in r.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=r.extensions[i])}function P(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 I(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(var r=0,i=t.weights.length;r<i;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){var n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(var a=0,s=n.length;a<s;a++)e.morphTargetDictionary[n[a]]=a}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function O(e){for(var t="",r=Object.keys(e).sort(),i=0,n=r.length;i<n;i++)t+=r[i]+":"+e[r[i]]+";";return t}function D(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}class N{constructor(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new a,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.textureCache={},this.nodeNamesUsed={},this.textureLoader="undefined"!=typeof createImageBitmap&&!1===/Firefox/.test(navigator.userAgent)?new i.ImageBitmapLoader(this.options.manager):new i.TextureLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new i.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){var r=this,i=this.json,n=this.extensions;this.cache.removeAll(),this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.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:r,userData:{}};C(n,a,i),P(a,i),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(a)}))).then((function(){e(a)}))})).catch(t)}_markDefs(){for(var e,t=this.json.nodes||[],r=this.json.skins||[],i=this.json.meshes||[],n=0,a=r.length;n<a;n++)for(var s=0,o=(e=r[n].joints).length;s<o;s++)t[e[s]].isBone=!0;for(var l,h=0,c=t.length;h<c;h++)void 0!==(l=t[h]).mesh&&(this._addNodeRef(this.meshCache,l.mesh),void 0!==l.skin&&(i[l.mesh].isSkinnedMesh=!0)),void 0!==l.camera&&this._addNodeRef(this.cameraCache,l.camera)}_addNodeRef(e,t){void 0===t||(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(1>=e.refs[t])return r;var i=r.clone();return i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){var t=Object.values(this.plugins);t.push(this);for(var r,i=0;i<t.length;i++)if(r=e(t[i]))return r;return null}_invokeAll(e){var t=Object.values(this.plugins);t.unshift(this);for(var r,i=[],n=0;n<t.length;n++)(r=e(t[n]))&&i.push(r);return i}getDependency(e,t){var r=e+":"+t,i=this.cache.get(r);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this.loadNode(t);break;case"mesh":i=this._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(r,i)}return i}getDependencies(e){var t=this.cache.get(e);if(!t){var r=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map((function(t,i){return r.getDependency(e,i)}))),this.cache.add(e,t)}return t}loadBuffer(e){var t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[s.KHR_BINARY_GLTF].body);var i=this.options;return new Promise((function(e,n){r.load(R(t.uri,i.path),e,void 0,(function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}loadBufferView(e){var t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){var r=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+r)}))}loadAccessor(e){var t=this,r=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse)return Promise.resolve(null);var a=[];return void 0===n.bufferView?a.push(null):a.push(this.getDependency("bufferView",n.bufferView)),void 0!==n.sparse&&(a.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),a.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(a).then((function(e){var a,s,o=e[0],l=T[n.type],h=_[n.componentType],c=h.BYTES_PER_ELEMENT,u=n.byteOffset||0,d=void 0===n.bufferView?void 0:r.bufferViews[n.bufferView].byteStride,p=!0===n.normalized;if(d&&d!==c*l){var m=Math.floor(u/d),f="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+m+":"+n.count,v=t.cache.get(f);v||(a=new h(o,m*d,n.count*d/c),v=new i.InterleavedBuffer(a,d/c),t.cache.add(f,v)),s=new i.InterleavedBufferAttribute(v,l,u%d/c,p)}else a=null===o?new h(n.count*l):new h(o,u,n.count*l),s=new i.BufferAttribute(a,l,p);if(void 0!==n.sparse){var g=T.SCALAR,y=_[n.sparse.indices.componentType],x=n.sparse.indices.byteOffset||0,b=n.sparse.values.byteOffset||0,w=new y(e[1],x,n.sparse.count*g),M=new h(e[2],b,n.sparse.count*l);null!==o&&(s=new i.BufferAttribute(s.array.slice(),s.itemSize,s.normalized));for(var S,E=0,A=w.length;E<A;E++)if(S=w[E],s.setX(S,M[E*l]),2<=l&&s.setY(S,M[E*l+1]),3<=l&&s.setZ(S,M[E*l+2]),4<=l&&s.setW(S,M[E*l+3]),5<=l)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}return s}))}loadTexture(e){var t=this.json,r=this.options,i=t.textures[e],n=t.images[i.source],a=this.textureLoader;if(n.uri){var s=r.manager.getHandler(n.uri);null!==s&&(a=s)}return this.loadTextureImage(e,n,a)}loadTextureImage(e,t,r){var n=this,a=this.json,s=this.options,o=a.textures[e],l=(t.uri||t.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];var h=self.URL||self.webkitURL,c=t.uri||"",u=!1,d=!0,p=0<c.search(/\.jpe?g($|\?)/i)||0===c.search(/^data\:image\/jpeg/);if(("image/jpeg"===t.mimeType||p)&&(d=!1),void 0!==t.bufferView)c=n.getDependency("bufferView",t.bufferView).then((function(e){if("image/png"===t.mimeType){var r=new DataView(e,25,1).getUint8(0,!1);d=6===r||4===r||3===r}u=!0;var i=new Blob([e],{type:t.mimeType});return c=h.createObjectURL(i)}));else if(void 0===t.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");var m=Promise.resolve(c).then((function(e){return new Promise((function(t,n){var a=t;!0===r.isImageBitmapLoader&&(a=function(e){var r=new i.Texture(e);r.needsUpdate=!0,t(r)}),r.load(R(e,s.path),a,void 0,n)}))})).then((function(t){!0===u&&h.revokeObjectURL(c),t.flipY=!1,o.name&&(t.name=o.name),d||(t.format=i.RGBFormat);var r=(a.samplers||{})[o.sampler]||{};return t.magFilter=M[r.magFilter]||i.LinearFilter,t.minFilter=M[r.minFilter]||i.LinearMipmapLinearFilter,t.wrapS=S[r.wrapS]||i.RepeatWrapping,t.wrapT=S[r.wrapT]||i.RepeatWrapping,n.associations.set(t,{type:"textures",index:e}),t})).catch((function(){return console.error("THREE.GLTFLoader: Couldn't load texture",c),null}));return this.textureCache[l]=m,m}assignTexture(e,t,r){var i=this;return this.getDependency("texture",r.index).then((function(n){if(void 0===r.texCoord||0==r.texCoord||"aoMap"===t&&1==r.texCoord||console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),i.extensions[s.KHR_TEXTURE_TRANSFORM]){var a=void 0===r.extensions?void 0:r.extensions[s.KHR_TEXTURE_TRANSFORM];if(a){var o=i.associations.get(n);n=i.extensions[s.KHR_TEXTURE_TRANSFORM].extendTexture(n,a),i.associations.set(n,o)}}e[t]=n}))}assignFinalMaterial(e){var t=e.geometry,r=e.material,n=void 0!==t.attributes.tangent,a=void 0!==t.attributes.color,s=void 0===t.attributes.normal,o=0<Object.keys(t.morphAttributes).length,l=o&&void 0!==t.morphAttributes.normal;if(e.isPoints){var h="PointsMaterial:"+r.uuid,c=this.cache.get(h);c||(c=new i.PointsMaterial,i.Material.prototype.copy.call(c,r),c.color.copy(r.color),c.map=r.map,c.sizeAttenuation=!1,this.cache.add(h,c)),r=c}else if(e.isLine){var u="LineBasicMaterial:"+r.uuid,d=this.cache.get(u);d||(d=new i.LineBasicMaterial,i.Material.prototype.copy.call(d,r),d.color.copy(r.color),this.cache.add(u,d)),r=d}if(n||a||s||o){var p="ClonedMaterial:"+r.uuid+":";r.isGLTFSpecularGlossinessMaterial&&(p+="specular-glossiness:"),n&&(p+="vertex-tangents:"),a&&(p+="vertex-colors:"),s&&(p+="flat-shading:"),o&&(p+="morph-targets:"),l&&(p+="morph-normals:");var m=this.cache.get(p);m||(m=r.clone(),a&&(m.vertexColors=!0),s&&(m.flatShading=!0),o&&(m.morphTargets=!0),l&&(m.morphNormals=!0),n&&(m.vertexTangents=!0,m.normalScale&&(m.normalScale.y*=-1),m.clearcoatNormalScale&&(m.clearcoatNormalScale.y*=-1)),this.cache.add(p,m),this.associations.set(m,this.associations.get(r))),r=m}r.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv),e.material=r}getMaterialType(){return i.MeshStandardMaterial}loadMaterial(e){var t,r=this,n=this.json,a=this.extensions,o=n.materials[e],l={},h=o.extensions||{},c=[];if(h[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var u=a[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=u.getMaterialType(),c.push(u.extendParams(l,o,r))}else if(h[s.KHR_MATERIALS_UNLIT]){var d=a[s.KHR_MATERIALS_UNLIT];t=d.getMaterialType(),c.push(d.extendParams(l,o,r))}else{var p=o.pbrMetallicRoughness||{};if(l.color=new i.Color(1,1,1),l.opacity=1,Array.isArray(p.baseColorFactor)){var m=p.baseColorFactor;l.color.fromArray(m),l.opacity=m[3]}void 0!==p.baseColorTexture&&c.push(r.assignTexture(l,"map",p.baseColorTexture)),l.metalness=void 0===p.metallicFactor?1:p.metallicFactor,l.roughness=void 0===p.roughnessFactor?1:p.roughnessFactor,void 0!==p.metallicRoughnessTexture&&(c.push(r.assignTexture(l,"metalnessMap",p.metallicRoughnessTexture)),c.push(r.assignTexture(l,"roughnessMap",p.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,l)}))))}!0===o.doubleSided&&(l.side=i.DoubleSide);var f=o.alphaMode||"OPAQUE";return"BLEND"===f?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,"MASK"===f&&(l.alphaTest=void 0===o.alphaCutoff?.5:o.alphaCutoff)),void 0!==o.normalTexture&&t!==i.MeshBasicMaterial&&(c.push(r.assignTexture(l,"normalMap",o.normalTexture)),l.normalScale=new i.Vector2(1,-1),void 0!==o.normalTexture.scale&&l.normalScale.set(o.normalTexture.scale,-o.normalTexture.scale)),void 0!==o.occlusionTexture&&t!==i.MeshBasicMaterial&&(c.push(r.assignTexture(l,"aoMap",o.occlusionTexture)),void 0!==o.occlusionTexture.strength&&(l.aoMapIntensity=o.occlusionTexture.strength)),void 0!==o.emissiveFactor&&t!==i.MeshBasicMaterial&&(l.emissive=(new i.Color).fromArray(o.emissiveFactor)),void 0!==o.emissiveTexture&&t!==i.MeshBasicMaterial&&c.push(r.assignTexture(l,"emissiveMap",o.emissiveTexture)),Promise.all(c).then((function(){var n;return n=t===y?a[s.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(l):new t(l),o.name&&(n.name=o.name),n.map&&(n.map.encoding=i.sRGBEncoding),n.emissiveMap&&(n.emissiveMap.encoding=i.sRGBEncoding),P(n,o),r.associations.set(n,{type:"materials",index:e}),o.extensions&&C(a,n,o),n}))}createUniqueName(e){for(var t=i.PropertyBinding.sanitizeNodeName(e||""),r=t,n=1;this.nodeNamesUsed[r];++n)r=t+"_"+n;return this.nodeNamesUsed[r]=!0,r}loadGeometries(e){function t(e){return n[s.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then((function(t){return U(t,e,r)}))}for(var r=this,n=this.extensions,a=this.primitiveCache,o=[],l=0,h=e.length;l<h;l++){var c,u=e[l],d=(void 0,(f=(m=u).extensions&&m.extensions[s.KHR_DRACO_MESH_COMPRESSION])?"draco:"+f.bufferView+":"+f.indices+":"+O(f.attributes):m.indices+":"+O(m.attributes)+":"+m.mode),p=a[d];if(p)o.push(p.promise);else c=u.extensions&&u.extensions[s.KHR_DRACO_MESH_COMPRESSION]?t(u):U(new i.BufferGeometry,u,r),a[d]={primitive:u,promise:c},o.push(c)}var m,f;return Promise.all(o)}loadMesh(e){for(var t,r=this,n=this.json,a=this.extensions,s=n.meshes[e],o=s.primitives,l=[],h=0,c=o.length;h<c;h++)t=void 0===o[h].material?(void 0===(u=this.cache).DefaultMaterial&&(u.DefaultMaterial=new i.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:i.FrontSide})),u.DefaultMaterial):this.getDependency("material",o[h].material),l.push(t);var u;return l.push(r.loadGeometries(o)),Promise.all(l).then((function(t){for(var n=t.slice(0,t.length-1),l=t[t.length-1],h=[],c=0,u=l.length;c<u;c++){var d=l[c],p=o[c],m=void 0,f=n[c];if(4===p.mode||5===p.mode||6===p.mode||void 0===p.mode)!0!==(m=!0===s.isSkinnedMesh?new i.SkinnedMesh(d,f):new i.Mesh(d,f)).isSkinnedMesh||m.geometry.attributes.skinWeight.normalized||m.normalizeSkinWeights(),5===p.mode?m.geometry=z(m.geometry,i.TriangleStripDrawMode):6===p.mode&&(m.geometry=z(m.geometry,i.TriangleFanDrawMode));else if(1===p.mode)m=new i.LineSegments(d,f);else if(3===p.mode)m=new i.Line(d,f);else if(2===p.mode)m=new i.LineLoop(d,f);else{if(0!==p.mode)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);m=new i.Points(d,f)}0<Object.keys(m.geometry.morphAttributes).length&&I(m,s),m.name=r.createUniqueName(s.name||"mesh_"+e),P(m,s),p.extensions&&C(a,m,p),r.assignFinalMaterial(m),h.push(m)}if(1===h.length)return h[0];for(var v=new i.Group,g=0,y=h.length;g<y;g++)v.add(h[g]);return v}))}loadCamera(e){var t,r=this.json.cameras[e],n=r[r.type];return n?("perspective"===r.type?t=new i.PerspectiveCamera(i.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===r.type&&(t=new i.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),P(t,r),Promise.resolve(t)):void console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){var t=this.json.skins[e],r={joints:t.joints};return void 0===t.inverseBindMatrices?Promise.resolve(r):this.getDependency("accessor",t.inverseBindMatrices).then((function(e){return r.inverseBindMatrices=e,r}))}loadAnimation(e){for(var t=this.json.animations[e],r=[],n=[],a=[],s=[],o=[],l=0,h=t.channels.length;l<h;l++){var c=t.channels[l],u=t.samplers[c.sampler],d=c.target,p=void 0===d.node?d.id:d.node,m=void 0===t.parameters?u.input:t.parameters[u.input],f=void 0===t.parameters?u.output:t.parameters[u.output];r.push(this.getDependency("node",p)),n.push(this.getDependency("accessor",m)),a.push(this.getDependency("accessor",f)),s.push(u),o.push(d)}return Promise.all([Promise.all(r),Promise.all(n),Promise.all(a),Promise.all(s),Promise.all(o)]).then((function(r){for(var n=r[0],a=r[1],s=r[2],o=r[3],l=r[4],h=[],c=function(){var e,t=n[u],r=a[u],c=s[u],d=o[u],p=l[u];if(void 0===t)return 1;switch(t.updateMatrix(),t.matrixAutoUpdate=!0,A[p.path]){case A.weights:e=i.NumberKeyframeTrack;break;case A.rotation:e=i.QuaternionKeyframeTrack;break;default:e=i.VectorKeyframeTrack}var m=t.name?t.name:t.uuid,f=void 0===d.interpolation?i.InterpolateLinear:L[d.interpolation],v=[];A[p.path]===A.weights?t.traverse((function(e){!0===e.isMesh&&e.morphTargetInfluences&&v.push(e.name?e.name:e.uuid)})):v.push(m);var g=c.array;if(c.normalized){for(var y=D(g.constructor),x=new Float32Array(g.length),b=0,_=g.length;b<_;b++)x[b]=g[b]*y;g=x}for(var M,S=0,T=v.length;S<T;S++)M=new e(v[S]+"."+A[p.path],r.array,g,f),"CUBICSPLINE"===d.interpolation&&(M.createInterpolant=function(e){return new w(this.times,this.values,this.getValueSize()/3,e)},M.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),h.push(M)},u=0,d=n.length;u<d;u++)c();var p=t.name?t.name:"animation_"+e;return new i.AnimationClip(p,void 0,h)}))}createNodeMesh(e){var t=this.json,r=this,i=t.nodes[e];return void 0===i.mesh?null:r.getDependency("mesh",i.mesh).then((function(e){var t=r._getNodeRef(r.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse((function(e){if(e.isMesh)for(var t=0,r=i.weights.length;t<r;t++)e.morphTargetInfluences[t]=i.weights[t]})),t}))}loadNode(e){var t,r,n=this.json,a=this.extensions,s=this,o=n.nodes[e],l=o.name?s.createUniqueName(o.name):"";return(t=[],r=s._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)})),r&&t.push(r),void 0!==o.camera&&t.push(s.getDependency("camera",o.camera).then((function(e){return s._getNodeRef(s.cameraCache,o.camera,e)}))),s._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){t.push(e)})),Promise.all(t)).then((function(t){var r;if((r=!0===o.isBone?new i.Bone:1<t.length?new i.Group:1===t.length?t[0]:new i.Object3D)!==t[0])for(var n=0,h=t.length;n<h;n++)r.add(t[n]);if(o.name&&(r.userData.name=o.name,r.name=l),P(r,o),o.extensions&&C(a,r,o),void 0!==o.matrix){var c=new i.Matrix4;c.fromArray(o.matrix),r.applyMatrix4(c)}else void 0!==o.translation&&r.position.fromArray(o.translation),void 0!==o.rotation&&r.quaternion.fromArray(o.rotation),void 0!==o.scale&&r.scale.fromArray(o.scale);return s.associations.set(r,{type:"nodes",index:e}),r}))}loadScene(e){var t=this.json,r=this.extensions,n=this.json.scenes[e],a=new i.Group;n.name&&(a.name=this.createUniqueName(n.name)),P(a,n),n.extensions&&C(r,a,n);for(var s=n.nodes||[],o=[],l=0,h=s.length;l<h;l++)o.push(B(s[l],a,t,this));return Promise.all(o).then((function(){return a}))}}function B(e,t,r,n){var a=r.nodes[e];return n.getDependency("node",e).then((function(e){return void 0===a.skin?e:n.getDependency("skin",a.skin).then((function(e){for(var r=[],i=0,a=(t=e).joints.length;i<a;i++)r.push(n.getDependency("node",t.joints[i]));return Promise.all(r)})).then((function(r){return e.traverse((function(e){if(e.isMesh){for(var n,a=[],s=[],o=0,l=r.length;o<l;o++)if(n=r[o]){a.push(n);var h=new i.Matrix4;void 0!==t.inverseBindMatrices&&h.fromArray(t.inverseBindMatrices.array,16*o),s.push(h)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[o]);e.bind(new i.Skeleton(a,s),e.matrixWorld)}})),e}));var t})).then((function(e){t.add(e);var i=[];if(a.children)for(var s,o=a.children,l=0,h=o.length;l<h;l++)s=o[l],i.push(B(s,e,r,n));return Promise.all(i)}))}function U(e,t,r){function n(t,i){return r.getDependency("accessor",t).then((function(t){e.setAttribute(i,t)}))}var a=t.attributes,s=[];for(var o in a){var l=E[o]||o.toLowerCase();l in e.attributes||s.push(n(a[o],l))}if(void 0!==t.indices&&!e.index){var h=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));s.push(h)}return P(e,t),function(e,t,r){var n=t.attributes,a=new i.Box3;if(void 0!==n.POSITION){var s=r.json.accessors[n.POSITION],o=s.min,l=s.max;if(void 0!==o&&void 0!==l){if(a.set(new i.Vector3(o[0],o[1],o[2]),new i.Vector3(l[0],l[1],l[2])),s.normalized){var h=D(_[s.componentType]);a.min.multiplyScalar(h),a.max.multiplyScalar(h)}var c=t.targets;if(void 0!==c){for(var u,d=new i.Vector3,p=new i.Vector3,m=0,f=c.length;m<f;m++)if(void 0!==(u=c[m]).POSITION){var v=r.json.accessors[u.POSITION],g=v.min,y=v.max;if(void 0!==g&&void 0!==y){if(p.setX(Math.max(Math.abs(g[0]),Math.abs(y[0]))),p.setY(Math.max(Math.abs(g[1]),Math.abs(y[1]))),p.setZ(Math.max(Math.abs(g[2]),Math.abs(y[2]))),v.normalized){var x=D(_[v.componentType]);p.multiplyScalar(x)}d.max(p)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}a.expandByVector(d)}e.boundingBox=a;var b=new i.Sphere;a.getCenter(b.center),b.radius=a.min.distanceTo(a.max)/2,e.boundingSphere=b}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}(e,t,r),Promise.all(s).then((function(){return void 0===t.targets?e:function(e,t,r){for(var i,n=!1,a=!1,s=0,o=t.length;s<o&&(void 0!==(i=t[s]).POSITION&&(n=!0),void 0!==i.NORMAL&&(a=!0),!n||!a);s++);if(!n&&!a)return Promise.resolve(e);for(var l,h=[],c=[],u=0,d=t.length;u<d;u++){if(l=t[u],n){var p=void 0===l.POSITION?e.attributes.position:r.getDependency("accessor",l.POSITION);h.push(p)}if(a){var m=void 0===l.NORMAL?e.attributes.normal:r.getDependency("accessor",l.NORMAL);c.push(m)}}return Promise.all([Promise.all(h),Promise.all(c)]).then((function(t){var r=t[0],i=t[1];return n&&(e.morphAttributes.position=r),a&&(e.morphAttributes.normal=i),e.morphTargetsRelative=!0,e}))}(e,t.targets,r)}))}function z(e,t){var r=e.getIndex();if(null===r){var n=[],a=e.getAttribute("position");if(void 0===a)return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(var s=0;s<a.count;s++)n.push(s);e.setIndex(n),r=e.getIndex()}var o=r.count-2,l=[];if(t===i.TriangleFanDrawMode)for(var h=1;h<=o;h++)l.push(r.getX(0)),l.push(r.getX(h)),l.push(r.getX(h+1));else for(var c=0;c<o;c++)0==c%2?(l.push(r.getX(c)),l.push(r.getX(c+1)),l.push(r.getX(c+2))):(l.push(r.getX(c+2)),l.push(r.getX(c+1)),l.push(r.getX(c)));l.length/3!=o&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");var u=e.clone();return u.setIndex(l),u}},8330:e=>{"use strict";e.exports=JSON.parse('{"name":"zincjs","version":"1.14.2","description":"ZincJS (Web-based-Zinc-Visualisation)","main":"build/zinc.js","directories":{"doc":"docs"},"files":["package.json","LICENSE","README.md","src/*","build/zinc.js","build/zinc.frontend.js","build/zinc.js.map","webpack.config.js"],"scripts":{"build-bundle":"webpack --config webpack.frontend.js; webpack --config webpack.backend.js","build-backend":"webpack --config webpack.backend.js","test":"npm --prefix ./test install && npm --prefix ./test run test-ci","changelog":"auto-changelog -p --output CHANGELOG.md --template keepachangelog","jsdoc":"jsdoc -c jsdoc_conf.json","version":"npm run build-bundle;npm run jsdoc;npm run changelog; git add CHANGELOG.md docs","release:beta":"npm version prerelease --preid=beta; npm publish --tag beta","release:minor":"npm version minor; npm publish","release:patch":"npm version patch; npm publish"},"repository":{"type":"git","url":"git+https://github.com/alan-wu/ZincJS.git"},"keywords":["library","webgl","3d","zincjs"],"author":"Alan Wu <alan.wu@auckland.ac.nz>","license":"MIT","bugs":{"url":"https://github.com/alan-wu/ZincJS/issues"},"homepage":"http://alan-wu.github.io/ZincJS/","devDependencies":{"@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","auto-changelog":"^2.4.0","babel-loader":"^9.1.3","babel-preset-minify":"^0.5.1","file-loader":"^6.2.0","jsdoc":"^4.0.2","raw-loader":"^4.0.2","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"dependencies":{"css-element-queries":"^1.2.2","lodash":"^4.17.19","promise-polyfill":"^8.1.3","three":"^0.130.1","three-spritetext":"1.6.2","url-loader":"^4.1.1","url-polyfill":"^1.1.7","webworkify-webpack":"^2.1.5"}}')}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var a=t[i]={exports:{}};return e[i].call(a.exports,a,a.exports,r),a.exports}return r.m=e,r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(1913)})()));
3
3
  //# sourceMappingURL=zinc.frontend.js.map