@realsee/five 6.2.0 → 6.2.1

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.
package/plugins/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five
4
- * Generated: 10/30/2024
5
- * Version: 6.2.0
4
+ * Generated: 10/31/2024
5
+ * Version: 6.2.1
6
6
  * Terms:
7
7
  * Realsee SDK License Agreement
8
8
  * Update: July 28, 2021
@@ -252,13 +252,13 @@
252
252
  * No amendment to or modification of this Agreement will be binding unless in
253
253
  * writing and signed by Realsee. You and Realsee hereto confirm that this
254
254
  * Agreement and all related documents shall be drafted in English.
255
- */"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const yc=require("@realsee/five"),bf=require("three"),wf=require("@realsee/five/plugins");function Mf(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const we=Mf(bf);function Ef(e){return/^https?:\/\/|^\/\//.test(e)||/^data:/.test(e)}function Tf(e,t){return Ef(t)?t:"".concat(e).concat(t)}exports.BasePlugin=void 0;(function(e){var t=function(){function n(r,i){this.hooks=new yc.Subscribe,this.staticPrefix="//vr-image-4.realsee-cdn.cn",this.five=r,i!=null&&i.staticPrefix&&(this.staticPrefix=i.staticPrefix)}return n.prototype.getCurrentState=function(){return this.state},n.prototype.absoluteUrl=function(r){return Tf(this.staticPrefix,r)},n}();e.Controller=t})(exports.BasePlugin||(exports.BasePlugin={}));var xl=function(e,t){return xl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},xl(e,t)};function Es(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");xl(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Ut=function(){return Ut=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},Ut.apply(this,arguments)};function Fo(e,t,n,r){function i(a){return a instanceof n?a:new n(function(o){o(a)})}return new(n||(n=Promise))(function(a,o){function s(u){try{l(r.next(u))}catch(h){o(h)}}function c(u){try{l(r.throw(u))}catch(h){o(h)}}function l(u){u.done?a(u.value):i(u.value).then(s,c)}l((r=r.apply(e,t||[])).next())})}function Bo(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(n=0)),n;)try{if(r=1,i&&(a=l[0]&2?i.return:l[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,l[1])).done)return a;switch(i=0,a&&(l=[l[0]&2,a.value]),l[0]){case 0:case 1:a=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,i=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){n.label=l[1];break}if(l[0]===6&&n.label<a[1]){n.label=a[1],a=l;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(l);break}a[2]&&n.ops.pop(),n.trys.pop();continue}l=t.call(e,n)}catch(u){l=[6,u],i=0}finally{r=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Uc(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function Sf(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){r.onload=r.onerror=function(){},t(r)},r.onerror=function(i){r.onload=r.onerror=function(){},n(i)},r.crossOrigin="",r.src=e})}var Af=typeof performance!="undefined"&&typeof performance.timing!="undefined"?performance.timing.navigationStart:Date.now(),Bs=typeof performance!="undefined"?function(){return Af+performance.now()}:function(){return Date.now()};function Do(e,t,n){return e+(t-e)*n}function Lf(e,t,n,r){var i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t,s=e;return i*Math.pow(r,3)+a*Math.pow(r,2)+o*r+s}function Pf(e,t,n,r){var i=(t*n+2*e)/Math.pow(n,3),a=-(2*t*n+3*e)/Math.pow(n,2),o=t;return 3*i*Math.pow(r,2)+2*a*r+o}function Cf(e,t,n,r){var i=r[1]-r[0];return e=Uo(e,r),t=Uo(t,r),t-e>i/2?Do(e+i,t,n):e-t>i/2?Do(e-i,t,n):Do(e,t,n)}function Uo(e,t){var n=t[1]-t[0];return e<t[0]?Uo(e+n,t):e>=t[1]?Uo(e-n,t):e}function Rf(e,t,n,r){return r?Cf(e,t,n,r):Do(e,t,n)}var zc=function(){function e(t){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=Bs(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(var n in t){var r=t[n];typeof r=="number"?(this.value[n]=r,this.config[n]={circle:!1}):(this.value[n]=r.value,this.config[n]={circle:r.circle})}this.keyframes=[{progress:0,value:Ut({},this.value)},{progress:1,value:Ut({},this.value)}]}return e.prototype.getProgress=function(t){var n=t-this.startTime;return n<0?0:n>=this.duration?1:1-Lf(1,this.startVelocity,this.duration,n)},e.prototype.getValue=function(t){for(var n=1;n<this.keyframes.length;n++)if(this.keyframes[n].progress>t){var r=this.keyframes[n-1],i=this.keyframes[n],a={};for(var o in this.config){var s=(t-r.progress)/(i.progress-r.progress);a[o]=Rf(r.value[o],i.value[o],s,this.config[o].circle)}return a}return Ut({},this.keyframes[this.keyframes.length-1].value)},e.prototype.getProgressVelocity=function(t){var n=t-this.startTime;return n>=this.duration?0:Pf(1,this.startVelocity,this.duration,n)},e.prototype.update=function(t){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(t))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},e.prototype.getKeyFrameSegment=function(t){for(var n=this.getProgress(t),r=1;r<this.keyframes.length;r++)if(this.keyframes[r].progress>n)return[this.keyframes[r-1],this.keyframes[r]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},e.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},e.prototype.set=function(t,n,r,i){var a;r===void 0&&(r=0),isNaN(n)&&(n=0),isNaN(r)&&(r=0),i=i!=null?i:Bs();var o=this.getProgress(i),s=this.getValue(o),c={};for(var l in this.config)c[l]=(a=t[l])!==null&&a!==void 0?a:s[l];var u=[{progress:0,value:s},{progress:1,value:c}];return this.setKeyframes(u,n,r,i)},e.prototype.setKeyframes=function(t,n,r,i){var a=this;if(r===void 0&&(r=0),t.length<2)throw new Error("keyframes invalid.");return isNaN(n)&&(n=0),isNaN(r)&&(r=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise(function(o,s){i=i!=null?i:Bs(),a.progress=0,a.ended=!1,a.startTime=i,a.startVelocity=r,a.keyframes=t,a.duration=n,n===0?(a.progress=1,a.value=Ut({},t[t.length-1].value)):a.value=Ut({},t[0].value),a.callbacks=[o,s]})},e.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},e}(),Of=[{progress:0,value:{scale:0,opacity:0,shadow:2}},{progress:.2,value:{scale:.5,opacity:1,shadow:1}},{progress:.8,value:{scale:2,opacity:0,shadow:.5}},{progress:1,value:{scale:2,opacity:0,shadow:.5}}],Df=[{progress:0,value:{scale:0,opacity:0,shadow:2}},{progress:.2,value:{scale:.4,opacity:1,shadow:2}},{progress:.8,value:{scale:1.6,opacity:.4,shadow:.5}},{progress:1,value:{scale:2,opacity:0,shadow:.5}}],If=`
255
+ */"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const nt=require("@realsee/five"),er=require("three"),tr=require("three/examples/jsm/controls/OrbitControls"),it=require("three/examples/jsm/renderers/CSS3DRenderer"),rr=require("@realsee/five/plugins");function nr(c){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const n in c)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(c,n);Object.defineProperty(o,n,a.get?a:{enumerable:!0,get:()=>c[n]})}}return o.default=c,Object.freeze(o)}const g=nr(er);function ir(c){return/^https?:\/\/|^\/\//.test(c)||/^data:/.test(c)}function ar(c,o){return ir(o)?o:"".concat(c).concat(o)}exports.BasePlugin=void 0;(function(c){var o=function(){function n(a,t){this.hooks=new nt.Subscribe,this.staticPrefix="//vr-image-4.realsee-cdn.cn",this.five=a,t!=null&&t.staticPrefix&&(this.staticPrefix=t.staticPrefix)}return n.prototype.getCurrentState=function(){return this.state},n.prototype.absoluteUrl=function(a){return ar(this.staticPrefix,a)},n}();c.Controller=o})(exports.BasePlugin||(exports.BasePlugin={}));var rt=function(c,o){return rt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(n[t]=a[t])},rt(c,o)};function He(c,o){if(typeof o!="function"&&o!==null)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");rt(c,o);function n(){this.constructor=c}c.prototype=o===null?Object.create(o):(n.prototype=o.prototype,new n)}var W=function(){return W=Object.assign||function(o){for(var n,a=1,t=arguments.length;a<t;a++){n=arguments[a];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(o[l]=n[l])}return o},W.apply(this,arguments)};function Ve(c,o,n,a){function t(l){return l instanceof n?l:new n(function(h){h(l)})}return new(n||(n=Promise))(function(l,h){function u(y){try{p(a.next(y))}catch(T){h(T)}}function m(y){try{p(a.throw(y))}catch(T){h(T)}}function p(y){y.done?l(y.value):t(y.value).then(u,m)}p((a=a.apply(c,o||[])).next())})}function Ge(c,o){var n={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,t,l,h=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return h.next=u(0),h.throw=u(1),h.return=u(2),typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function u(p){return function(y){return m([p,y])}}function m(p){if(a)throw new TypeError("Generator is already executing.");for(;h&&(h=0,p[0]&&(n=0)),n;)try{if(a=1,t&&(l=p[0]&2?t.return:p[0]?t.throw||((l=t.return)&&l.call(t),0):t.next)&&!(l=l.call(t,p[1])).done)return l;switch(t=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,t=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(l=n.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){n.label=p[1];break}if(p[0]===6&&n.label<l[1]){n.label=l[1],l=p;break}if(l&&n.label<l[2]){n.label=l[2],n.ops.push(p);break}l[2]&&n.ops.pop(),n.trys.pop();continue}p=o.call(c,n)}catch(y){p=[6,y],t=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}function Mt(c,o,n){if(n||arguments.length===2)for(var a=0,t=o.length,l;a<t;a++)(l||!(a in o))&&(l||(l=Array.prototype.slice.call(o,0,a)),l[a]=o[a]);return c.concat(l||Array.prototype.slice.call(o))}function or(c){return new Promise(function(o,n){var a=new Image;a.onload=function(){a.onload=a.onerror=function(){},o(a)},a.onerror=function(t){a.onload=a.onerror=function(){},n(t)},a.crossOrigin="",a.src=c})}var sr=typeof performance!="undefined"&&typeof performance.timing!="undefined"?performance.timing.navigationStart:Date.now(),et=typeof performance!="undefined"?function(){return sr+performance.now()}:function(){return Date.now()};function Re(c,o,n){return c+(o-c)*n}function lr(c,o,n,a){var t=(o*n+2*c)/Math.pow(n,3),l=-(2*o*n+3*c)/Math.pow(n,2),h=o,u=c;return t*Math.pow(a,3)+l*Math.pow(a,2)+h*a+u}function cr(c,o,n,a){var t=(o*n+2*c)/Math.pow(n,3),l=-(2*o*n+3*c)/Math.pow(n,2),h=o;return 3*t*Math.pow(a,2)+2*l*a+h}function ur(c,o,n,a){var t=a[1]-a[0];return c=Ye(c,a),o=Ye(o,a),o-c>t/2?Re(c+t,o,n):c-o>t/2?Re(c-t,o,n):Re(c,o,n)}function Ye(c,o){var n=o[1]-o[0];return c<o[0]?Ye(c+n,o):c>=o[1]?Ye(c-n,o):c}function hr(c,o,n,a){return a?ur(c,o,n,a):Re(c,o,n)}var Ct=function(){function c(o){this.config={},this.progress=1,this.ended=!0,this.value={},this.startTime=et(),this.startVelocity=0,this.duration=0,this.keyframes=[];for(var n in o){var a=o[n];typeof a=="number"?(this.value[n]=a,this.config[n]={circle:!1}):(this.value[n]=a.value,this.config[n]={circle:a.circle})}this.keyframes=[{progress:0,value:W({},this.value)},{progress:1,value:W({},this.value)}]}return c.prototype.getProgress=function(o){var n=o-this.startTime;return n<0?0:n>=this.duration?1:1-lr(1,this.startVelocity,this.duration,n)},c.prototype.getValue=function(o){for(var n=1;n<this.keyframes.length;n++)if(this.keyframes[n].progress>o){var a=this.keyframes[n-1],t=this.keyframes[n],l={};for(var h in this.config){var u=(o-a.progress)/(t.progress-a.progress);l[h]=hr(a.value[h],t.value[h],u,this.config[h].circle)}return l}return W({},this.keyframes[this.keyframes.length-1].value)},c.prototype.getProgressVelocity=function(o){var n=o-this.startTime;return n>=this.duration?0:cr(1,this.startVelocity,this.duration,n)},c.prototype.update=function(o){return this.ended?!0:(this.progress=Math.min(1,Math.max(0,this.progress,this.getProgress(o))),this.value=this.getValue(this.progress),this.ended=this.progress>=1,this.ended&&this.callbacks&&(this.callbacks[0](),this.callbacks=void 0),this.ended)},c.prototype.getKeyFrameSegment=function(o){for(var n=this.getProgress(o),a=1;a<this.keyframes.length;a++)if(this.keyframes[a].progress>n)return[this.keyframes[a-1],this.keyframes[a]];return[this.keyframes[this.keyframes.length-2],this.keyframes[this.keyframes.length-1]]},c.prototype.getTargetKeyframe=function(){return this.keyframes[this.keyframes.length-1]},c.prototype.set=function(o,n,a,t){var l;a===void 0&&(a=0),isNaN(n)&&(n=0),isNaN(a)&&(a=0),t=t!=null?t:et();var h=this.getProgress(t),u=this.getValue(h),m={};for(var p in this.config)m[p]=(l=o[p])!==null&&l!==void 0?l:u[p];var y=[{progress:0,value:u},{progress:1,value:m}];return this.setKeyframes(y,n,a,t)},c.prototype.setKeyframes=function(o,n,a,t){var l=this;if(a===void 0&&(a=0),o.length<2)throw new Error("keyframes invalid.");return isNaN(n)&&(n=0),isNaN(a)&&(a=0),this.callbacks&&(this.callbacks[1](new Error("motion aborted.")),this.callbacks=void 0),new Promise(function(h,u){t=t!=null?t:et(),l.progress=0,l.ended=!1,l.startTime=t,l.startVelocity=a,l.keyframes=o,l.duration=n,n===0?(l.progress=1,l.value=W({},o[o.length-1].value)):l.value=W({},o[0].value),l.callbacks=[h,u]})},c.prototype.dispose=function(){this.callbacks&&(this.callbacks[1](new Error("motion dispose.")),this.callbacks=void 0)},c}(),fr=[{progress:0,value:{scale:0,opacity:0,shadow:2}},{progress:.2,value:{scale:.5,opacity:1,shadow:1}},{progress:.8,value:{scale:2,opacity:0,shadow:.5}},{progress:1,value:{scale:2,opacity:0,shadow:.5}}],vr=[{progress:0,value:{scale:0,opacity:0,shadow:2}},{progress:.2,value:{scale:.4,opacity:1,shadow:2}},{progress:.8,value:{scale:1.6,opacity:.4,shadow:.5}},{progress:1,value:{scale:2,opacity:0,shadow:.5}}],pr=`
256
256
  varying vec2 vUv;
257
257
  void main() {
258
258
  vUv = uv;
259
259
  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
260
260
  }
261
- `,Nf=`
261
+ `,dr=`
262
262
  varying vec2 vUv;
263
263
  uniform sampler2D map;
264
264
  uniform vec4 color;
@@ -304,7 +304,7 @@ void main() {
304
304
  }
305
305
  }
306
306
  }
307
- `,Ff=function(e){Es(t,e);function t(n,r){var i=e.call(this,n)||this;i.canvas=document.createElement("canvas"),i.group=new we.Group,i.wrapper=document.createElement("div"),i.style=document.createElement("style"),i.itemMaskMesh=function(){var s=new we.Mesh(new we.SphereBufferGeometry(1,60,40),new we.ShaderMaterial({vertexShader:If,fragmentShader:Nf,uniforms:{map:{value:new we.Texture},color:{value:new we.Vector4}},depthWrite:!1,depthTest:!1,transparent:!0}));return s.renderOrder=-3,s.geometry.rotateY(-Math.PI/2),s.geometry.scale(-1,1,1),s}(),i.onFivePanoArrived=function(s){i.state.mode==="mask"&&i.loadPanoMask(s)},i.onFiveWantsMoveToPano=function(s){i.state.mode==="box"&&i.select()},i.loadPanoMask=function(s){return Fo(i,void 0,void 0,function(){var c,l,u,h,f,d,m,g,y,p;return Bo(this,function(v){switch(v.label){case 0:return c=this,l=c.five,u=c.canvas,h=c.itemMaskMesh,f=c.data,d=u.getContext("2d"),m=l.observers[s],g=(p=f==null?void 0:f.object_mask_list.find(function(_){return _.derived_id===String(m.derivedId)}))===null||p===void 0?void 0:p.object_mask_url,g?[4,Sf(g)]:[2];case 1:return y=v.sent(),u.width=y.width,u.height=y.height,d==null||d.drawImage(y,0,0,y.width,y.height),h.material.uniforms.map.value.image=y,h.material.uniforms.map.value.minFilter=we.LinearFilter,h.material.uniforms.map.value.needsUpdate=!0,h.position.copy(m.position),h.quaternion.copy(m.quaternion),l.scene.add(h),l.needsRender=!0,[2]}})})},i.onFiveMouseMove=function(s){var c;if(i.state.mode==="mask"&&i.five.state.mode==="Panorama"){var l=i,u=l.five,h=l.itemMaskMesh,f=u.observers[u.state.panoIndex],d=(c=s.pointers[0])===null||c===void 0?void 0:c.raycaster;if(d){var m=d.intersectObjects(i.group.children.filter(function(g){return g.userData.visible_viewpoint.includes(String(f.derivedId))}),!0)[0];m?h.material.uniforms.color.value=m.object.userData.color:h.material.uniforms.color.value=new we.Vector4(0,0,0,1)}}},i.onFiveTapGesture=function(s){var c=i.five,l=c.observers[c.state.panoIndex];if(s){var u=s.intersectObjects(i.group.children.filter(function(d){return d.userData.visible_viewpoint.includes(String(l.derivedId))}),!0)[0];if(u){i.select(u.object.name),i.stopAnimation&&i.stopAnimation(),i.tapPosition=u.point,i.changeTapScreenPosition();var h=new zc({opacity:0,scale:0,shadow:2}),f=new zc({opacity:0,scale:0,shadow:2});return h.setKeyframes(Of,1e3),f.setKeyframes(Df,1e3),i.stopAnimation=yc.AnimationFrameLoop.shared.add(function(d,m){var g,y=h.update(d),p=f.update(d);i.wrapper.firstChild.style.opacity="".concat(h.value.opacity),i.wrapper.firstChild.style.transform="scale(".concat(h.value.scale,")"),i.wrapper.firstChild.style.boxShadow="0 0 0 ".concat(h.value.shadow,"px #fff"),i.wrapper.lastChild.style.opacity="".concat(f.value.opacity),i.wrapper.lastChild.style.transform="scale(".concat(f.value.scale,")"),i.wrapper.lastChild.style.boxShadow="0 0 0 ".concat(f.value.shadow,"px #fff"),y&&p&&((g=i.stopAnimation)===null||g===void 0||g.call(i),i.stopAnimation=void 0,c.getElement().parentElement.removeChild(i.wrapper))},!1,0,10),c.getElement().parentElement.appendChild(i.wrapper),!1}}},i.changeTapScreenPosition=function(){if(i.tapPosition){var s=i.tapPosition.clone().project(i.five.camera),c=(s.x+1)/2,l=-(s.y-1)/2;i.wrapper.style.opacity=s.z>0&&s.z<1?"1":"0",i.wrapper.style.transform="translate(".concat(c*100,"%, ").concat(l*100,"%)")}},i.onFiveCameraUpdate=function(s){i.changeTapScreenPosition()},i.dispose=function(){i.disable()},i.five=n;var a={enabled:!0,visible:!0,mode:"box",selectedId:null,selectAll:!1};i.state=Object.assign(a,r==null?void 0:r.initialState);var o=Ut({},r==null?void 0:r.config);return i._config=o,i.group.rotateX(Math.PI),i.wrapper.className="ItemMaskPlugin",i.wrapper.innerHTML='<span class="ItemMaskPluginCircle"></span><span class="ItemMaskPluginCircle"></span>',i.style.innerHTML=`
307
+ `,mr=function(c){He(o,c);function o(n,a){var t=c.call(this,n)||this;t.canvas=document.createElement("canvas"),t.group=new g.Group,t.wrapper=document.createElement("div"),t.style=document.createElement("style"),t.itemMaskMesh=function(){var u=new g.Mesh(new g.SphereBufferGeometry(1,60,40),new g.ShaderMaterial({vertexShader:pr,fragmentShader:dr,uniforms:{map:{value:new g.Texture},color:{value:new g.Vector4}},depthWrite:!1,depthTest:!1,transparent:!0}));return u.renderOrder=-3,u.geometry.rotateY(-Math.PI/2),u.geometry.scale(-1,1,1),u}(),t.onFivePanoArrived=function(u){t.state.mode==="mask"&&t.loadPanoMask(u)},t.onFiveWantsMoveToPano=function(u){t.state.mode==="box"&&t.select()},t.loadPanoMask=function(u){return Ve(t,void 0,void 0,function(){var m,p,y,T,M,N,C,F,G,O;return Ge(this,function(j){switch(j.label){case 0:return m=this,p=m.five,y=m.canvas,T=m.itemMaskMesh,M=m.data,N=y.getContext("2d"),C=p.observers[u],F=(O=M==null?void 0:M.object_mask_list.find(function(q){return q.derived_id===String(C.derivedId)}))===null||O===void 0?void 0:O.object_mask_url,F?[4,or(F)]:[2];case 1:return G=j.sent(),y.width=G.width,y.height=G.height,N==null||N.drawImage(G,0,0,G.width,G.height),T.material.uniforms.map.value.image=G,T.material.uniforms.map.value.minFilter=g.LinearFilter,T.material.uniforms.map.value.needsUpdate=!0,T.position.copy(C.position),T.quaternion.copy(C.quaternion),p.scene.add(T),p.needsRender=!0,[2]}})})},t.onFiveMouseMove=function(u){var m;if(t.state.mode==="mask"&&t.five.state.mode==="Panorama"){var p=t,y=p.five,T=p.itemMaskMesh,M=y.observers[y.state.panoIndex],N=(m=u.pointers[0])===null||m===void 0?void 0:m.raycaster;if(N){var C=N.intersectObjects(t.group.children.filter(function(F){return F.userData.visible_viewpoint.includes(String(M.derivedId))}),!0)[0];C?T.material.uniforms.color.value=C.object.userData.color:T.material.uniforms.color.value=new g.Vector4(0,0,0,1)}}},t.onFiveTapGesture=function(u){var m=t.five,p=m.observers[m.state.panoIndex];if(u){var y=u.intersectObjects(t.group.children.filter(function(N){return N.userData.visible_viewpoint.includes(String(p.derivedId))}),!0)[0];if(y){t.select(y.object.name),t.stopAnimation&&t.stopAnimation(),t.tapPosition=y.point,t.changeTapScreenPosition();var T=new Ct({opacity:0,scale:0,shadow:2}),M=new Ct({opacity:0,scale:0,shadow:2});return T.setKeyframes(fr,1e3),M.setKeyframes(vr,1e3),t.stopAnimation=nt.AnimationFrameLoop.shared.add(function(N,C){var F,G=T.update(N),O=M.update(N);t.wrapper.firstChild.style.opacity="".concat(T.value.opacity),t.wrapper.firstChild.style.transform="scale(".concat(T.value.scale,")"),t.wrapper.firstChild.style.boxShadow="0 0 0 ".concat(T.value.shadow,"px #fff"),t.wrapper.lastChild.style.opacity="".concat(M.value.opacity),t.wrapper.lastChild.style.transform="scale(".concat(M.value.scale,")"),t.wrapper.lastChild.style.boxShadow="0 0 0 ".concat(M.value.shadow,"px #fff"),G&&O&&((F=t.stopAnimation)===null||F===void 0||F.call(t),t.stopAnimation=void 0,m.getElement().parentElement.removeChild(t.wrapper))},!1,0,10),m.getElement().parentElement.appendChild(t.wrapper),!1}}},t.changeTapScreenPosition=function(){if(t.tapPosition){var u=t.tapPosition.clone().project(t.five.camera),m=(u.x+1)/2,p=-(u.y-1)/2;t.wrapper.style.opacity=u.z>0&&u.z<1?"1":"0",t.wrapper.style.transform="translate(".concat(m*100,"%, ").concat(p*100,"%)")}},t.onFiveCameraUpdate=function(u){t.changeTapScreenPosition()},t.dispose=function(){t.disable()},t.five=n;var l={enabled:!0,visible:!0,mode:"box",selectedId:null,selectAll:!1};t.state=Object.assign(l,a==null?void 0:a.initialState);var h=W({},a==null?void 0:a.config);return t._config=h,t.group.rotateX(Math.PI),t.wrapper.className="ItemMaskPlugin",t.wrapper.innerHTML='<span class="ItemMaskPluginCircle"></span><span class="ItemMaskPluginCircle"></span>',t.style.innerHTML=`
308
308
  .ItemMaskPlugin {
309
309
  position: absolute;
310
310
  top: 0;
@@ -322,7 +322,7 @@ void main() {
322
322
  border-radius: 50%;
323
323
  box-shadow: 0px 0px 0px 2px #fff;
324
324
  }
325
- `,i.state.enabled&&i._enable({userAction:!1}),i}return Object.defineProperty(t.prototype,"config",{get:function(){return Ut({},this._config)},enumerable:!1,configurable:!0}),t.prototype.updateState=function(n,r){var i=this.state;this.state=Ut(Ut({},this.state),n),this.hooks.emit("stateChange",{state:this.state,prevState:i,userAction:r})},t.prototype.load=function(n){return Fo(this,void 0,void 0,function(){var r,i,a=this;return Bo(this,function(o){return this.data=n,r=n.data_list.map(function(s){var c,l=s.position.end.map(function(b){return Number(b)}),u=s.position.start.map(function(b){return Number(b)}),h=Math.abs(l[0]-u[0]),f=Math.abs(l[1]-u[1]),d=Math.abs(l[2]-u[2]),m=l[0]/2+u[0]/2,g=l[1]/2+u[1]/2,y=l[2]/2+u[2]/2,p=new we.Vector3(m,g,y),v=new we.BoxBufferGeometry(h,f,d),_=new we.ShaderMaterial({vertexShader:`
325
+ `,t.state.enabled&&t._enable({userAction:!1}),t}return Object.defineProperty(o.prototype,"config",{get:function(){return W({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(n,a){var t=this.state;this.state=W(W({},this.state),n),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:a})},o.prototype.load=function(n){return Ve(this,void 0,void 0,function(){var a,t,l=this;return Ge(this,function(h){return this.data=n,a=n.data_list.map(function(u){var m,p=u.position.end.map(function(V){return Number(V)}),y=u.position.start.map(function(V){return Number(V)}),T=Math.abs(p[0]-y[0]),M=Math.abs(p[1]-y[1]),N=Math.abs(p[2]-y[2]),C=p[0]/2+y[0]/2,F=p[1]/2+y[1]/2,G=p[2]/2+y[2]/2,O=new g.Vector3(C,F,G),j=new g.BoxBufferGeometry(T,M,N),q=new g.ShaderMaterial({vertexShader:`
326
326
  varying vec2 vUv;
327
327
  void main() {
328
328
  vUv = uv;
@@ -347,2934 +347,13 @@ void main() {
347
347
  gl_FragColor = vec4(1.0, 1.0, 1.0, alpha / 4.0 * opacity);
348
348
  }
349
349
  }
350
- `,side:we.DoubleSide,visible:a.state.selectedId==="".concat(s.category_name).concat(s.index),uniforms:{opacity:{value:a.state.mode==="box"?1:0}},depthWrite:!1,depthTest:!1,transparent:!0}),x=new we.Mesh(v,_);return x.position.copy(p),x.name="".concat(s.category_name).concat(s.index),x.userData.color=new((c=we.Vector4).bind.apply(c,Uc(Uc([void 0],s.mask_color.map(function(b){return b/255}).reverse(),!1),[1],!1))),x.userData.visible_viewpoint=Object.keys(s.visible_viewpoint),x}),(i=this.group).add.apply(i,r),[2]})})},t.prototype.setState=function(n,r){r===void 0&&(r={});var i=this.state,a=r.userAction!==void 0?r.userAction:!0;if(this.updateState(n,a),n.enabled!==void 0&&i.enabled!==n.enabled){var o={userAction:a};n.enabled?this._enable(o):this._disable(o)}},t.prototype.setMode=function(n){this.updateState({mode:n},!1),n==="mask"?(this.group.children.forEach(function(r){r.material.uniforms.opacity.value=0}),this.loadPanoMask(this.five.state.panoIndex)):n==="box"&&(this.itemMaskMesh.material.uniforms.color.value=new we.Vector4(0,0,0,1),this.group.children.forEach(function(r){r.material.uniforms.opacity.value=1}),this.five.needsRender=!0)},t.prototype.select=function(n,r){var i=this,a;this.updateState({selectedId:n!=null?n:null},(a=r==null?void 0:r.userAction)!==null&&a!==void 0?a:!1),this.group.children.forEach(function(o){o.material.visible=i.state.selectAll||o.name===n}),this.five.needsRender=!0},t.prototype.selectAll=function(n){n===void 0&&(n=!0),this.updateState({selectAll:!!n},!1),this.select()},t.prototype._enable=function(n){this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.on("gesture.mousemove",this.onFiveMouseMove),this.five.on("wantsTapGesture",this.onFiveTapGesture),this.five.on("cameraUpdate",this.onFiveCameraUpdate),this.five.scene.add(this.group),document.head.appendChild(this.style)},t.prototype._disable=function(n){this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.off("gesture.mousemove",this.onFiveMouseMove),this.five.off("wantsTapGesture",this.onFiveTapGesture),this.five.off("cameraUpdate",this.onFiveCameraUpdate),this.five.scene.remove(this.group),document.head.removeChild(this.style)},t.prototype.enable=function(n){var r;if(!this.state.enabled){var i=(r=n==null?void 0:n.userAction)!==null&&r!==void 0?r:!0;this.updateState({enabled:!0},i),this._enable({userAction:i})}},t.prototype.disable=function(n){var r;if(this.state.enabled!==!1){var i=(r=n==null?void 0:n.userAction)!==null&&r!==void 0?r:!0;this.updateState({enabled:!1},i),this._disable({userAction:i})}},t}(exports.BasePlugin.Controller),Bf=function(e,t){return new Ff(e,t)};/*! Hammer.JS - v2.0.7 - 2016-04-22
350
+ `,side:g.DoubleSide,visible:l.state.selectedId==="".concat(u.category_name).concat(u.index),uniforms:{opacity:{value:l.state.mode==="box"?1:0}},depthWrite:!1,depthTest:!1,transparent:!0}),f=new g.Mesh(j,q);return f.position.copy(O),f.name="".concat(u.category_name).concat(u.index),f.userData.color=new((m=g.Vector4).bind.apply(m,Mt(Mt([void 0],u.mask_color.map(function(V){return V/255}).reverse(),!1),[1],!1))),f.userData.visible_viewpoint=Object.keys(u.visible_viewpoint),f}),(t=this.group).add.apply(t,a),[2]})})},o.prototype.setState=function(n,a){a===void 0&&(a={});var t=this.state,l=a.userAction!==void 0?a.userAction:!0;if(this.updateState(n,l),n.enabled!==void 0&&t.enabled!==n.enabled){var h={userAction:l};n.enabled?this._enable(h):this._disable(h)}},o.prototype.setMode=function(n){this.updateState({mode:n},!1),n==="mask"?(this.group.children.forEach(function(a){a.material.uniforms.opacity.value=0}),this.loadPanoMask(this.five.state.panoIndex)):n==="box"&&(this.itemMaskMesh.material.uniforms.color.value=new g.Vector4(0,0,0,1),this.group.children.forEach(function(a){a.material.uniforms.opacity.value=1}),this.five.needsRender=!0)},o.prototype.select=function(n,a){var t=this,l;this.updateState({selectedId:n!=null?n:null},(l=a==null?void 0:a.userAction)!==null&&l!==void 0?l:!1),this.group.children.forEach(function(h){h.material.visible=t.state.selectAll||h.name===n}),this.five.needsRender=!0},o.prototype.selectAll=function(n){n===void 0&&(n=!0),this.updateState({selectAll:!!n},!1),this.select()},o.prototype._enable=function(n){this.five.on("panoArrived",this.onFivePanoArrived),this.five.on("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.on("gesture.mousemove",this.onFiveMouseMove),this.five.on("wantsTapGesture",this.onFiveTapGesture),this.five.on("cameraUpdate",this.onFiveCameraUpdate),this.five.scene.add(this.group),document.head.appendChild(this.style)},o.prototype._disable=function(n){this.five.off("panoArrived",this.onFivePanoArrived),this.five.off("wantsMoveToPano",this.onFiveWantsMoveToPano),this.five.off("gesture.mousemove",this.onFiveMouseMove),this.five.off("wantsTapGesture",this.onFiveTapGesture),this.five.off("cameraUpdate",this.onFiveCameraUpdate),this.five.scene.remove(this.group),document.head.removeChild(this.style)},o.prototype.enable=function(n){var a;if(!this.state.enabled){var t=(a=n==null?void 0:n.userAction)!==null&&a!==void 0?a:!0;this.updateState({enabled:!0},t),this._enable({userAction:t})}},o.prototype.disable=function(n){var a;if(this.state.enabled!==!1){var t=(a=n==null?void 0:n.userAction)!==null&&a!==void 0?a:!0;this.updateState({enabled:!1},t),this._disable({userAction:t})}},o}(exports.BasePlugin.Controller),gr=function(c,o){return new mr(c,o)};/*! Hammer.JS - v2.0.7 - 2016-04-22
351
351
  * http://hammerjs.github.io/
352
352
  *
353
353
  * Copyright (c) 2016 Jorik Tangelder;
354
- * Licensed under the MIT license */var Us=function(e,t,n,r){var i=["","webkit","Moz","MS","ms","o"],a=t.createElement?t.createElement("div"):r,o="function",s=Math.round,c=Math.abs,l=Date.now;function u(w,M,P){return setTimeout(v(w,P),M)}function h(w,M,P){return Array.isArray(w)?(f(w,P[M],P),!0):!1}function f(w,M,P){var U;if(w)if(w.forEach)w.forEach(M,P);else if(w.length!==r)for(U=0;U<w.length;)M.call(P,w[U],U,w),U++;else for(U in w)w.hasOwnProperty(U)&&M.call(P,w[U],U,w)}function d(w,M,P){var U="DEPRECATED METHOD: "+M+`
355
- `+P+` AT
356
- `;return function(){var Q=new Error("get-stack-trace"),me=Q&&Q.stack?Q.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Xe=e.console&&(e.console.warn||e.console.log);return Xe&&Xe.call(e.console,U,me),w.apply(this,arguments)}}var m;typeof Object.assign!="function"?m=function(M){if(M===r||M===null)throw new TypeError("Cannot convert undefined or null to object");for(var P=Object(M),U=1;U<arguments.length;U++){var Q=arguments[U];if(Q!==r&&Q!==null)for(var me in Q)Q.hasOwnProperty(me)&&(P[me]=Q[me])}return P}:m=Object.assign;var g=d(function(M,P,U){for(var Q=Object.keys(P),me=0;me<Q.length;)(!U||U&&M[Q[me]]===r)&&(M[Q[me]]=P[Q[me]]),me++;return M},"extend","Use `assign`."),y=d(function(M,P){return g(M,P,!0)},"merge","Use `assign`.");function p(w,M,P){var U=M.prototype,Q;Q=w.prototype=Object.create(U),Q.constructor=w,Q._super=U,P&&m(Q,P)}function v(w,M){return function(){return w.apply(M,arguments)}}function _(w,M){return typeof w==o?w.apply(M&&M[0]||r,M):w}function x(w,M){return w===r?M:w}function b(w,M,P){f(O(M),function(U){w.addEventListener(U,P,!1)})}function T(w,M,P){f(O(M),function(U){w.removeEventListener(U,P,!1)})}function C(w,M){for(;w;){if(w==M)return!0;w=w.parentNode}return!1}function N(w,M){return w.indexOf(M)>-1}function O(w){return w.trim().split(/\s+/g)}function J(w,M,P){if(w.indexOf&&!P)return w.indexOf(M);for(var U=0;U<w.length;){if(P&&w[U][P]==M||!P&&w[U]===M)return U;U++}return-1}function F(w){return Array.prototype.slice.call(w,0)}function B(w,M,P){for(var U=[],Q=[],me=0;me<w.length;){var Xe=w[me][M];J(Q,Xe)<0&&U.push(w[me]),Q[me]=Xe,me++}return U=U.sort(function(Ht,pt){return Ht[M]>pt[M]}),U}function V(w,M){for(var P,U,Q=M[0].toUpperCase()+M.slice(1),me=0;me<i.length;){if(P=i[me],U=P?P+Q:M,U in w)return U;me++}return r}var Y=1;function D(){return Y++}function z(w){var M=w.ownerDocument||w;return M.defaultView||M.parentWindow||e}var k=/mobile|tablet|ip(ad|hone|od)|android/i,q="ontouchstart"in e,Z=V(e,"PointerEvent")!==r,ee=q&&k.test(navigator.userAgent),te="touch",ae="pen",Pe="mouse",_e="kinect",re=25,G=1,Be=2,xe=4,Te=8,ue=1,K=2,Ce=4,Ye=8,Qe=16,et=K|Ce,Ke=Ye|Qe,A=et|Ke,L=["x","y"],ne=["clientX","clientY"];function $(w,M){var P=this;this.manager=w,this.callback=M,this.element=w.element,this.target=w.options.inputTarget,this.domHandler=function(U){_(w.options.enable,[w])&&P.handler(U)},this.init()}$.prototype={handler:function(){},init:function(){this.evEl&&b(this.element,this.evEl,this.domHandler),this.evTarget&&b(this.target,this.evTarget,this.domHandler),this.evWin&&b(z(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&T(this.element,this.evEl,this.domHandler),this.evTarget&&T(this.target,this.evTarget,this.domHandler),this.evWin&&T(z(this.element),this.evWin,this.domHandler)}};function Ne(w){var M,P=w.options.inputClass;return P?M=P:Z?M=Ct:ee?M=j:q?M=Ae:M=rt,new M(w,ye)}function ye(w,M,P){var U=P.pointers.length,Q=P.changedPointers.length,me=M&G&&U-Q===0,Xe=M&(xe|Te)&&U-Q===0;P.isFirst=!!me,P.isFinal=!!Xe,me&&(w.session={}),P.eventType=M,R(w,P),w.emit("hammer.input",P),w.recognize(P),w.session.prevInput=P}function R(w,M){var P=w.session,U=M.pointers,Q=U.length;P.firstInput||(P.firstInput=ve(M)),Q>1&&!P.firstMultiple?P.firstMultiple=ve(M):Q===1&&(P.firstMultiple=!1);var me=P.firstInput,Xe=P.firstMultiple,Tt=Xe?Xe.center:me.center,Ht=M.center=ie(U);M.timeStamp=l(),M.deltaTime=M.timeStamp-me.timeStamp,M.angle=I(Tt,Ht),M.distance=Re(Tt,Ht),he(P,M),M.offsetDirection=de(M.deltaX,M.deltaY);var pt=Se(M.deltaTime,M.deltaX,M.deltaY);M.overallVelocityX=pt.x,M.overallVelocityY=pt.y,M.overallVelocity=c(pt.x)>c(pt.y)?pt.x:pt.y,M.scale=Xe?Me(Xe.pointers,U):1,M.rotation=Xe?be(Xe.pointers,U):0,M.maxPointers=P.prevInput?M.pointers.length>P.prevInput.maxPointers?M.pointers.length:P.prevInput.maxPointers:M.pointers.length,fe(P,M);var gn=w.element;C(M.srcEvent.target,gn)&&(gn=M.srcEvent.target),M.target=gn}function he(w,M){var P=M.center,U=w.offsetDelta||{},Q=w.prevDelta||{},me=w.prevInput||{};(M.eventType===G||me.eventType===xe)&&(Q=w.prevDelta={x:me.deltaX||0,y:me.deltaY||0},U=w.offsetDelta={x:P.x,y:P.y}),M.deltaX=Q.x+(P.x-U.x),M.deltaY=Q.y+(P.y-U.y)}function fe(w,M){var P=w.lastInterval||M,U=M.timeStamp-P.timeStamp,Q,me,Xe,Tt;if(M.eventType!=Te&&(U>re||P.velocity===r)){var Ht=M.deltaX-P.deltaX,pt=M.deltaY-P.deltaY,gn=Se(U,Ht,pt);me=gn.x,Xe=gn.y,Q=c(gn.x)>c(gn.y)?gn.x:gn.y,Tt=de(Ht,pt),w.lastInterval=M}else Q=P.velocity,me=P.velocityX,Xe=P.velocityY,Tt=P.direction;M.velocity=Q,M.velocityX=me,M.velocityY=Xe,M.direction=Tt}function ve(w){for(var M=[],P=0;P<w.pointers.length;)M[P]={clientX:s(w.pointers[P].clientX),clientY:s(w.pointers[P].clientY)},P++;return{timeStamp:l(),pointers:M,center:ie(M),deltaX:w.deltaX,deltaY:w.deltaY}}function ie(w){var M=w.length;if(M===1)return{x:s(w[0].clientX),y:s(w[0].clientY)};for(var P=0,U=0,Q=0;Q<M;)P+=w[Q].clientX,U+=w[Q].clientY,Q++;return{x:s(P/M),y:s(U/M)}}function Se(w,M,P){return{x:M/w||0,y:P/w||0}}function de(w,M){return w===M?ue:c(w)>=c(M)?w<0?K:Ce:M<0?Ye:Qe}function Re(w,M,P){P||(P=L);var U=M[P[0]]-w[P[0]],Q=M[P[1]]-w[P[1]];return Math.sqrt(U*U+Q*Q)}function I(w,M,P){P||(P=L);var U=M[P[0]]-w[P[0]],Q=M[P[1]]-w[P[1]];return Math.atan2(Q,U)*180/Math.PI}function be(w,M){return I(M[1],M[0],ne)+I(w[1],w[0],ne)}function Me(w,M){return Re(M[0],M[1],ne)/Re(w[0],w[1],ne)}var Ve={mousedown:G,mousemove:Be,mouseup:xe},Ee="mousedown",Ze="mousemove mouseup";function rt(){this.evEl=Ee,this.evWin=Ze,this.pressed=!1,$.apply(this,arguments)}p(rt,$,{handler:function(M){var P=Ve[M.type];P&G&&(M.button===0||M.button===2)&&(this.pressed=!0),P&Be&&M.which!==1&&(P=xe),this.pressed&&(P&xe&&(this.pressed=!1),this.callback(this.manager,P,{pointers:[M],changedPointers:[M],pointerType:Pe,srcEvent:M}))}});var dt={pointerdown:G,pointermove:Be,pointerup:xe,pointercancel:Te,pointerout:Te},Ft={2:te,3:ae,4:Pe,5:_e},it="pointerdown",At="pointermove pointerup pointercancel";e.MSPointerEvent&&!e.PointerEvent&&(it="MSPointerDown",At="MSPointerMove MSPointerUp MSPointerCancel");function Ct(){this.evEl=it,this.evWin=At,$.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}p(Ct,$,{handler:function(M){var P=this.store,U=!1,Q=!1,me=M.type.toLowerCase().replace("ms",""),Xe=dt[me],Tt=Ft[M.pointerType]||M.pointerType,Ht=Tt==te,pt=J(P,M.pointerId,"pointerId");Xe&G&&(M.button===0||M.button===2||Ht)?pt<0&&(P.push(M),pt=P.length-1):Xe&(xe|Te)?U=!0:!Ht&&M.buttons===0&&(U=!0,Q=!0,Xe=dt.pointerup),!(pt<0)&&(Q||(P[pt]=M),this.callback(this.manager,Xe,{pointers:P,changedPointers:[M],pointerType:Tt,srcEvent:P[pt]}),U&&P.splice(pt,1))}});var Xt={touchstart:G,touchmove:Be,touchend:xe,touchcancel:Te},Fr="touchstart",Br="touchstart touchmove touchend touchcancel";function gr(){this.evTarget=Fr,this.evWin=Br,this.started=!1,$.apply(this,arguments)}p(gr,$,{handler:function(M){var P=Xt[M.type];if(P===G&&(this.started=!0),!!this.started){var U=S.call(this,M,P);P&(xe|Te)&&U[0].length-U[1].length===0&&(this.started=!1),this.callback(this.manager,P,{pointers:U[0],changedPointers:U[1],pointerType:te,srcEvent:M})}}});function S(w,M){var P=F(w.touches),U=F(w.changedTouches);return M&(xe|Te)&&(P=B(P.concat(U),"identifier")),[P,U]}var W={touchstart:G,touchmove:Be,touchend:xe,touchcancel:Te},H="touchstart touchmove touchend touchcancel";function j(){this.evTarget=H,this.targetIds={},$.apply(this,arguments)}p(j,$,{handler:function(M){var P=W[M.type],U=oe.call(this,M,P);U&&this.callback(this.manager,P,{pointers:U[0],changedPointers:U[1],pointerType:te,srcEvent:M})}});function oe(w,M){var P=F(w.touches),U=this.targetIds;if(M&(G|Be)&&P.length===1)return U[P[0].identifier]=!0,[P,P];var Q,me,Xe=F(w.changedTouches),Tt=[],Ht=this.target;if(me=P.filter(function(pt){return C(pt.target,Ht)}),M===G)for(Q=0;Q<me.length;)U[me[Q].identifier]=!0,Q++;for(Q=0;Q<Xe.length;)U[Xe[Q].identifier]&&Tt.push(Xe[Q]),M&(xe|Te)&&delete U[Xe[Q].identifier],Q++;if(Tt.length)return[B(me.concat(Tt),"identifier"),Tt]}var Ge=2500,Oe=25;function Ae(){$.apply(this,arguments);var w=v(this.handler,this);this.touch=new j(this.manager,w),this.mouse=new rt(this.manager,w),this.primaryTouch=null,this.lastTouches=[]}p(Ae,$,{handler:function(M,P,U){var Q=U.pointerType==te,me=U.pointerType==Pe;if(!(me&&U.sourceCapabilities&&U.sourceCapabilities.firesTouchEvents)){if(Q)Ue.call(this,P,U);else if(me&&lt.call(this,U))return;this.callback(M,P,U)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function Ue(w,M){w&G?(this.primaryTouch=M.changedPointers[0].identifier,He.call(this,M)):w&(xe|Te)&&He.call(this,M)}function He(w){var M=w.changedPointers[0];if(M.identifier===this.primaryTouch){var P={x:M.clientX,y:M.clientY};this.lastTouches.push(P);var U=this.lastTouches,Q=function(){var me=U.indexOf(P);me>-1&&U.splice(me,1)};setTimeout(Q,Ge)}}function lt(w){for(var M=w.srcEvent.clientX,P=w.srcEvent.clientY,U=0;U<this.lastTouches.length;U++){var Q=this.lastTouches[U],me=Math.abs(M-Q.x),Xe=Math.abs(P-Q.y);if(me<=Oe&&Xe<=Oe)return!0}return!1}var $e=a?V(a.style,"touchAction"):r,Je=$e!==r,ze="compute",je="auto",mt="manipulation",Et="none",gt="pan-x",an="pan-y",st=Bi();function Cn(w,M){this.manager=w,this.set(M)}Cn.prototype={set:function(w){w==ze&&(w=this.compute()),Je&&this.manager.element.style&&st[w]&&(this.manager.element.style[$e]=w),this.actions=w.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var w=[];return f(this.manager.recognizers,function(M){_(M.options.enable,[M])&&(w=w.concat(M.getTouchAction()))}),qn(w.join(" "))},preventDefaults:function(w){var M=w.srcEvent,P=w.offsetDirection;if(this.manager.session.prevented){M.preventDefault();return}var U=this.actions,Q=N(U,Et)&&!st[Et],me=N(U,an)&&!st[an],Xe=N(U,gt)&&!st[gt];if(Q){var Tt=w.pointers.length===1,Ht=w.distance<2,pt=w.deltaTime<250;if(Tt&&Ht&&pt)return}if(!(Xe&&me)&&(Q||me&&P&et||Xe&&P&Ke))return this.preventSrc(M)},preventSrc:function(w){this.manager.session.prevented=!0,w.preventDefault()}};function qn(w){if(N(w,Et))return Et;var M=N(w,gt),P=N(w,an);return M&&P?Et:M||P?M?gt:an:N(w,mt)?mt:je}function Bi(){if(!Je)return!1;var w={},M=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(P){w[P]=M?e.CSS.supports("touch-action",P):!0}),w}var Ur=1,$t=2,zr=4,Yn=8,Rn=Yn,Ui=16,mn=32;function On(w){this.options=m({},this.defaults,w||{}),this.id=D(),this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=Ur,this.simultaneous={},this.requireFail=[]}On.prototype={defaults:{},set:function(w){return m(this.options,w),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(w){if(h(w,"recognizeWith",this))return this;var M=this.simultaneous;return w=ja(w,this),M[w.id]||(M[w.id]=w,w.recognizeWith(this)),this},dropRecognizeWith:function(w){return h(w,"dropRecognizeWith",this)?this:(w=ja(w,this),delete this.simultaneous[w.id],this)},requireFailure:function(w){if(h(w,"requireFailure",this))return this;var M=this.requireFail;return w=ja(w,this),J(M,w)===-1&&(M.push(w),w.requireFailure(this)),this},dropRequireFailure:function(w){if(h(w,"dropRequireFailure",this))return this;w=ja(w,this);var M=J(this.requireFail,w);return M>-1&&this.requireFail.splice(M,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(w){return!!this.simultaneous[w.id]},emit:function(w){var M=this,P=this.state;function U(Q){M.manager.emit(Q,w)}P<Yn&&U(M.options.event+Ic(P)),U(M.options.event),w.additionalEvent&&U(w.additionalEvent),P>=Yn&&U(M.options.event+Ic(P))},tryEmit:function(w){if(this.canEmit())return this.emit(w);this.state=mn},canEmit:function(){for(var w=0;w<this.requireFail.length;){if(!(this.requireFail[w].state&(mn|Ur)))return!1;w++}return!0},recognize:function(w){var M=m({},w);if(!_(this.options.enable,[this,M])){this.reset(),this.state=mn;return}this.state&(Rn|Ui|mn)&&(this.state=Ur),this.state=this.process(M),this.state&($t|zr|Yn|Ui)&&this.tryEmit(M)},process:function(w){},getTouchAction:function(){},reset:function(){}};function Ic(w){return w&Ui?"cancel":w&Yn?"end":w&zr?"move":w&$t?"start":""}function Nc(w){return w==Qe?"down":w==Ye?"up":w==K?"left":w==Ce?"right":""}function ja(w,M){var P=M.manager;return P?P.get(w):w}function on(){On.apply(this,arguments)}p(on,On,{defaults:{pointers:1},attrTest:function(w){var M=this.options.pointers;return M===0||w.pointers.length===M},process:function(w){var M=this.state,P=w.eventType,U=M&($t|zr),Q=this.attrTest(w);return U&&(P&Te||!Q)?M|Ui:U||Q?P&xe?M|Yn:M&$t?M|zr:$t:mn}});function qa(){on.apply(this,arguments),this.pX=null,this.pY=null}p(qa,on,{defaults:{event:"pan",threshold:10,pointers:1,direction:A},getTouchAction:function(){var w=this.options.direction,M=[];return w&et&&M.push(an),w&Ke&&M.push(gt),M},directionTest:function(w){var M=this.options,P=!0,U=w.distance,Q=w.direction,me=w.deltaX,Xe=w.deltaY;return Q&M.direction||(M.direction&et?(Q=me===0?ue:me<0?K:Ce,P=me!=this.pX,U=Math.abs(w.deltaX)):(Q=Xe===0?ue:Xe<0?Ye:Qe,P=Xe!=this.pY,U=Math.abs(w.deltaY))),w.direction=Q,P&&U>M.threshold&&Q&M.direction},attrTest:function(w){return on.prototype.attrTest.call(this,w)&&(this.state&$t||!(this.state&$t)&&this.directionTest(w))},emit:function(w){this.pX=w.deltaX,this.pY=w.deltaY;var M=Nc(w.direction);M&&(w.additionalEvent=this.options.event+M),this._super.emit.call(this,w)}});function Os(){on.apply(this,arguments)}p(Os,on,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Et]},attrTest:function(w){return this._super.attrTest.call(this,w)&&(Math.abs(w.scale-1)>this.options.threshold||this.state&$t)},emit:function(w){if(w.scale!==1){var M=w.scale<1?"in":"out";w.additionalEvent=this.options.event+M}this._super.emit.call(this,w)}});function Ds(){On.apply(this,arguments),this._timer=null,this._input=null}p(Ds,On,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[je]},process:function(w){var M=this.options,P=w.pointers.length===M.pointers,U=w.distance<M.threshold,Q=w.deltaTime>M.time;if(this._input=w,!U||!P||w.eventType&(xe|Te)&&!Q)this.reset();else if(w.eventType&G)this.reset(),this._timer=u(function(){this.state=Rn,this.tryEmit()},M.time,this);else if(w.eventType&xe)return Rn;return mn},reset:function(){clearTimeout(this._timer)},emit:function(w){this.state===Rn&&(w&&w.eventType&xe?this.manager.emit(this.options.event+"up",w):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}});function Is(){on.apply(this,arguments)}p(Is,on,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Et]},attrTest:function(w){return this._super.attrTest.call(this,w)&&(Math.abs(w.rotation)>this.options.threshold||this.state&$t)}});function Ns(){on.apply(this,arguments)}p(Ns,on,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:et|Ke,pointers:1},getTouchAction:function(){return qa.prototype.getTouchAction.call(this)},attrTest:function(w){var M=this.options.direction,P;return M&(et|Ke)?P=w.overallVelocity:M&et?P=w.overallVelocityX:M&Ke&&(P=w.overallVelocityY),this._super.attrTest.call(this,w)&&M&w.offsetDirection&&w.distance>this.options.threshold&&w.maxPointers==this.options.pointers&&c(P)>this.options.velocity&&w.eventType&xe},emit:function(w){var M=Nc(w.offsetDirection);M&&this.manager.emit(this.options.event+M,w),this.manager.emit(this.options.event,w)}});function Ya(){On.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}p(Ya,On,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[mt]},process:function(w){var M=this.options,P=w.pointers.length===M.pointers,U=w.distance<M.threshold,Q=w.deltaTime<M.time;if(this.reset(),w.eventType&G&&this.count===0)return this.failTimeout();if(U&&Q&&P){if(w.eventType!=xe)return this.failTimeout();var me=this.pTime?w.timeStamp-this.pTime<M.interval:!0,Xe=!this.pCenter||Re(this.pCenter,w.center)<M.posThreshold;this.pTime=w.timeStamp,this.pCenter=w.center,!Xe||!me?this.count=1:this.count+=1,this._input=w;var Tt=this.count%M.taps;if(Tt===0)return this.hasRequireFailures()?(this._timer=u(function(){this.state=Rn,this.tryEmit()},M.interval,this),$t):Rn}return mn},failTimeout:function(){return this._timer=u(function(){this.state=mn},this.options.interval,this),mn},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Rn&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function Gr(w,M){return M=M||{},M.recognizers=x(M.recognizers,Gr.defaults.preset),new Fs(w,M)}Gr.VERSION="2.0.7",Gr.defaults={domEvents:!1,touchAction:ze,enable:!0,inputTarget:null,inputClass:null,preset:[[Is,{enable:!1}],[Os,{enable:!1},["rotate"]],[Ns,{direction:et}],[qa,{direction:et},["swipe"]],[Ya],[Ya,{event:"doubletap",taps:2},["tap"]],[Ds]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var xf=1,Fc=2;function Fs(w,M){this.options=m({},Gr.defaults,M||{}),this.options.inputTarget=this.options.inputTarget||w,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=w,this.input=Ne(this),this.touchAction=new Cn(this,this.options.touchAction),Bc(this,!0),f(this.options.recognizers,function(P){var U=this.add(new P[0](P[1]));P[2]&&U.recognizeWith(P[2]),P[3]&&U.requireFailure(P[3])},this)}Fs.prototype={set:function(w){return m(this.options,w),w.touchAction&&this.touchAction.update(),w.inputTarget&&(this.input.destroy(),this.input.target=w.inputTarget,this.input.init()),this},stop:function(w){this.session.stopped=w?Fc:xf},recognize:function(w){var M=this.session;if(!M.stopped){this.touchAction.preventDefaults(w);var P,U=this.recognizers,Q=M.curRecognizer;(!Q||Q&&Q.state&Rn)&&(Q=M.curRecognizer=null);for(var me=0;me<U.length;)P=U[me],M.stopped!==Fc&&(!Q||P==Q||P.canRecognizeWith(Q))?P.recognize(w):P.reset(),!Q&&P.state&($t|zr|Yn)&&(Q=M.curRecognizer=P),me++}},get:function(w){if(w instanceof On)return w;for(var M=this.recognizers,P=0;P<M.length;P++)if(M[P].options.event==w)return M[P];return null},add:function(w){if(h(w,"add",this))return this;var M=this.get(w.options.event);return M&&this.remove(M),this.recognizers.push(w),w.manager=this,this.touchAction.update(),w},remove:function(w){if(h(w,"remove",this))return this;if(w=this.get(w),w){var M=this.recognizers,P=J(M,w);P!==-1&&(M.splice(P,1),this.touchAction.update())}return this},on:function(w,M){if(w!==r&&M!==r){var P=this.handlers;return f(O(w),function(U){P[U]=P[U]||[],P[U].push(M)}),this}},off:function(w,M){if(w!==r){var P=this.handlers;return f(O(w),function(U){M?P[U]&&P[U].splice(J(P[U],M),1):delete P[U]}),this}},emit:function(w,M){this.options.domEvents&&_f(w,M);var P=this.handlers[w]&&this.handlers[w].slice();if(!(!P||!P.length)){M.type=w,M.preventDefault=function(){M.srcEvent.preventDefault()};for(var U=0;U<P.length;)P[U](M),U++}},destroy:function(){this.element&&Bc(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function Bc(w,M){var P=w.element;if(P.style){var U;f(w.options.cssProps,function(Q,me){U=V(P.style,me),M?(w.oldCssProps[U]=P.style[U],P.style[U]=Q):P.style[U]=w.oldCssProps[U]||""}),M||(w.oldCssProps={})}}function _f(w,M){var P=t.createEvent("Event");P.initEvent(w,!0,!0),P.gesture=M,M.target.dispatchEvent(P)}return m(Gr,{INPUT_START:G,INPUT_MOVE:Be,INPUT_END:xe,INPUT_CANCEL:Te,STATE_POSSIBLE:Ur,STATE_BEGAN:$t,STATE_CHANGED:zr,STATE_ENDED:Yn,STATE_RECOGNIZED:Rn,STATE_CANCELLED:Ui,STATE_FAILED:mn,DIRECTION_NONE:ue,DIRECTION_LEFT:K,DIRECTION_RIGHT:Ce,DIRECTION_UP:Ye,DIRECTION_DOWN:Qe,DIRECTION_HORIZONTAL:et,DIRECTION_VERTICAL:Ke,DIRECTION_ALL:A,Manager:Fs,Input:$,TouchAction:Cn,TouchInput:j,MouseInput:rt,PointerEventInput:Ct,TouchMouseInput:Ae,SingleTouchInput:gr,Recognizer:On,AttrRecognizer:on,Tap:Ya,Pan:qa,Swipe:Ns,Pinch:Os,Rotate:Is,Press:Ds,on:b,off:T,each:f,merge:y,extend:g,assign:m,inherit:p,bindFn:v,prefixed:V}),Gr}(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{});Number.EPSILON===void 0&&(Number.EPSILON=Math.pow(2,-52));Number.isInteger===void 0&&(Number.isInteger=function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e});Math.sign===void 0&&(Math.sign=function(e){return e<0?-1:e>0?1:+e});"name"in Function.prototype||Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}});Object.assign===void 0&&(Object.assign=function(e){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const t=Object(e);for(let n=1;n<arguments.length;n++){const r=arguments[n];if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t});const Uf="117",rr={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ir={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},zf=0,Gc=1,Gf=2,bh=1,Hf=2,Ki=3,Va=0,Pt=1,Ts=2,wh=1,sr=0,ta=1,Hc=2,Vc=3,kc=4,Vf=5,ii=100,kf=101,Wf=102,Wc=103,Xc=104,Xf=200,jf=201,qf=202,Yf=203,Mh=204,Eh=205,Zf=206,Jf=207,Qf=208,$f=209,Kf=210,ed=0,td=1,nd=2,_l=3,rd=4,id=5,ad=6,od=7,Ss=0,sd=1,ld=2,na=0,Th=1,cd=2,ud=3,hd=4,fd=5,xc=300,_c=301,bc=302,Sh=303,wc=304,Ah=305,ka=306,Mc=307,zo=1e3,Vt=1001,Go=1002,bt=1003,bl=1004,wl=1005,It=1006,Lh=1007,As=1008,Wa=1009,dd=1010,pd=1011,Ho=1012,vd=1013,Io=1014,ar=1015,Vo=1016,md=1017,gd=1018,yd=1019,ra=1020,xd=1021,Ar=1022,fn=1023,_d=1024,bd=1025,wd=fn,hi=1026,sa=1027,Md=1028,Ed=1029,Td=1030,Sd=1031,Ad=1032,Ld=1033,jc=33776,qc=33777,Yc=33778,Zc=33779,Jc=35840,Qc=35841,$c=35842,Kc=35843,Pd=36196,eu=37492,tu=37496,Cd=37808,Rd=37809,Od=37810,Dd=37811,Id=37812,Nd=37813,Fd=37814,Bd=37815,Ud=37816,zd=37817,Gd=37818,Hd=37819,Vd=37820,kd=37821,Wd=36492,Xd=37840,jd=37841,qd=37842,Yd=37843,Zd=37844,Jd=37845,Qd=37846,$d=37847,Kd=37848,ep=37849,tp=37850,np=37851,rp=37852,ip=37853,ap=2200,op=2201,sp=2202,ko=2300,No=2301,zs=2302,di=2400,oi=2401,Wo=2402,Ec=2500,Ph=2501,lp=0,kt=3e3,Ls=3001,Tc=3007,Sc=3002,cp=3003,Ch=3004,Rh=3005,Oh=3006,up=3200,hp=3201,Di=0,fp=1,Gs=7680,dp=519,Ps=35044,la=35048;function vn(){}Object.assign(vn.prototype,{addEventListener:function(e,t){this._listeners===void 0&&(this._listeners={});var n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)},hasEventListener:function(e,t){if(this._listeners===void 0)return!1;var n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1},removeEventListener:function(e,t){if(this._listeners!==void 0){var n=this._listeners,r=n[e];if(r!==void 0){var i=r.indexOf(t);i!==-1&&r.splice(i,1)}}},dispatchEvent:function(e){if(this._listeners!==void 0){var t=this._listeners,n=t[e.type];if(n!==void 0){e.target=this;for(var r=n.slice(0),i=0,a=r.length;i<a;i++)r[i].call(this,e)}}}});var Rt=[];for(var zi=0;zi<256;zi++)Rt[zi]=(zi<16?"0":"")+zi.toString(16);var ke={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){var e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0,i=Rt[e&255]+Rt[e>>8&255]+Rt[e>>16&255]+Rt[e>>24&255]+"-"+Rt[t&255]+Rt[t>>8&255]+"-"+Rt[t>>16&15|64]+Rt[t>>24&255]+"-"+Rt[n&63|128]+Rt[n>>8&255]+"-"+Rt[n>>16&255]+Rt[n>>24&255]+Rt[r&255]+Rt[r>>8&255]+Rt[r>>16&255]+Rt[r>>24&255];return i.toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*ke.DEG2RAD},radToDeg:function(e){return e*ke.RAD2DEG},isPowerOfTwo:function(e){return(e&e-1)===0&&e!==0},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,r,i){var a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),h=a((t-r)/2),f=o((t-r)/2),d=a((r-t)/2),m=o((r-t)/2);switch(i){case"XYX":e.set(s*u,c*h,c*f,s*l);break;case"YZY":e.set(c*f,s*u,c*h,s*l);break;case"ZXZ":e.set(c*h,c*f,s*u,s*l);break;case"XZX":e.set(s*u,c*m,c*d,s*l);break;case"YXY":e.set(c*d,s*u,c*m,s*l);break;case"ZYZ":e.set(c*m,c*d,s*u,s*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}};function X(e,t){this.x=e||0,this.y=t||0}Object.defineProperties(X.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}});Object.assign(X.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(-this.y,-this.x)+Math.PI;return e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this},random:function(){return this.x=Math.random(),this.y=Math.random(),this}});function zt(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.assign(zt.prototype,{isMatrix3:!0,set:function(e,t,n,r,i,a,o,s,c){var l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return new this.constructor().fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},extractBasis:function(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],h=n[2],f=n[5],d=n[8],m=r[0],g=r[3],y=r[6],p=r[1],v=r[4],_=r[7],x=r[2],b=r[5],T=r[8];return i[0]=a*m+o*p+s*x,i[3]=a*g+o*v+s*b,i[6]=a*y+o*_+s*T,i[1]=c*m+l*p+u*x,i[4]=c*g+l*v+u*b,i[7]=c*y+l*_+u*T,i[2]=h*m+f*p+d*x,i[5]=h*g+f*v+d*b,i[8]=h*y+f*_+d*T,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s},getInverse:function(e,t){t!==void 0&&console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");var n=e.elements,r=this.elements,i=n[0],a=n[1],o=n[2],s=n[3],c=n[4],l=n[5],u=n[6],h=n[7],f=n[8],d=f*c-l*h,m=l*u-f*s,g=h*s-c*u,y=i*d+a*m+o*g;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);var p=1/y;return r[0]=d*p,r[1]=(o*h-f*a)*p,r[2]=(l*a-o*c)*p,r[3]=m*p,r[4]=(f*i-o*u)*p,r[5]=(o*s-l*i)*p,r[6]=g*p,r[7]=(a*u-h*i)*p,r[8]=(c*i-a*s)*p,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,r,i,a,o){var s=Math.cos(i),c=Math.sin(i);this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),r=this.elements,i=r[0],a=r[3],o=r[6],s=r[1],c=r[4],l=r[7];return r[0]=t*i+n*s,r[3]=t*a+n*c,r[6]=t*o+n*l,r[1]=-n*i+t*s,r[4]=-n*a+t*c,r[7]=-n*o+t*l,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<9;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}});var Hr,Pr={getDataURL:function(e){var t;if(typeof HTMLCanvasElement=="undefined")return e.src;if(e instanceof HTMLCanvasElement)t=e;else{Hr===void 0&&(Hr=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Hr.width=e.width,Hr.height=e.height;var n=Hr.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Hr}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},pp=0;function ot(e,t,n,r,i,a,o,s,c,l){Object.defineProperty(this,"id",{value:pp++}),this.uuid=ke.generateUUID(),this.name="",this.image=e!==void 0?e:ot.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=t!==void 0?t:ot.DEFAULT_MAPPING,this.wrapS=n!==void 0?n:Vt,this.wrapT=r!==void 0?r:Vt,this.magFilter=i!==void 0?i:It,this.minFilter=a!==void 0?a:As,this.anisotropy=c!==void 0?c:1,this.format=o!==void 0?o:fn,this.internalFormat=null,this.type=s!==void 0?s:Wa,this.offset=new X(0,0),this.repeat=new X(1,1),this.center=new X(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new zt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=l!==void 0?l:kt,this.version=0,this.onUpdate=null}ot.DEFAULT_IMAGE=void 0;ot.DEFAULT_MAPPING=xc;ot.prototype=Object.assign(Object.create(vn.prototype),{constructor:ot,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){var r=this.image;if(r.uuid===void 0&&(r.uuid=ke.generateUUID()),!t&&e.images[r.uuid]===void 0){var i;if(Array.isArray(r)){i=[];for(var a=0,o=r.length;a<o;a++)i.push(Pr.getDataURL(r[a]))}else i=Pr.getDataURL(r);e.images[r.uuid]={uuid:r.uuid,url:i}}n.image=r.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping!==xc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case zo:e.x=e.x-Math.floor(e.x);break;case Vt:e.x=e.x<0?0:1;break;case Go:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case zo:e.y=e.y-Math.floor(e.y);break;case Vt:e.y=e.y<0?0:1;break;case Go:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}});Object.defineProperty(ot.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}});function tt(e,t,n,r){this.x=e||0,this.y=t||0,this.z=n||0,this.w=r!==void 0?r:1}Object.defineProperties(tt.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}});Object.assign(tt.prototype,{isVector4:!0,set:function(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this},add:function(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],h=s[1],f=s[5],d=s[9],m=s[2],g=s[6],y=s[10];if(Math.abs(l-h)<a&&Math.abs(u-m)<a&&Math.abs(d-g)<a){if(Math.abs(l+h)<o&&Math.abs(u+m)<o&&Math.abs(d+g)<o&&Math.abs(c+f+y-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var p=(c+1)/2,v=(f+1)/2,_=(y+1)/2,x=(l+h)/4,b=(u+m)/4,T=(d+g)/4;return p>v&&p>_?p<a?(n=0,r=.707106781,i=.707106781):(n=Math.sqrt(p),r=x/n,i=b/n):v>_?v<a?(n=.707106781,r=0,i=.707106781):(r=Math.sqrt(v),n=x/r,i=T/r):_<a?(n=.707106781,r=.707106781,i=0):(i=Math.sqrt(_),n=b/i,r=T/i),this.set(n,r,i,t),this}var C=Math.sqrt((g-d)*(g-d)+(u-m)*(u-m)+(h-l)*(h-l));return Math.abs(C)<.001&&(C=1),this.x=(g-d)/C,this.y=(u-m)/C,this.z=(h-l)/C,this.w=Math.acos((c+f+y-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}});function Kt(e,t,n){this.width=e,this.height=t,this.scissor=new tt(0,0,e,t),this.scissorTest=!1,this.viewport=new tt(0,0,e,t),n=n||{},this.texture=new ot(void 0,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:It,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!0,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null}Kt.prototype=Object.assign(Object.create(vn.prototype),{constructor:Kt,isWebGLRenderTarget:!0,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});function nu(e,t,n){Kt.call(this,e,t,n),this.samples=4}nu.prototype=Object.assign(Object.create(Kt.prototype),{constructor:nu,isWebGLMultisampleRenderTarget:!0,copy:function(e){return Kt.prototype.copy.call(this,e),this.samples=e.samples,this}});function wt(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._w=r!==void 0?r:1}Object.assign(wt,{slerp:function(e,t,n,r){return n.copy(e).slerp(t,r)},slerpFlat:function(e,t,n,r,i,a,o){var s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],h=i[a+0],f=i[a+1],d=i[a+2],m=i[a+3];if(u!==m||s!==h||c!==f||l!==d){var g=1-o,y=s*h+c*f+l*d+u*m,p=y>=0?1:-1,v=1-y*y;if(v>Number.EPSILON){var _=Math.sqrt(v),x=Math.atan2(_,y*p);g=Math.sin(g*x)/_,o=Math.sin(o*x)/_}var b=o*p;if(s=s*g+h*b,c=c*g+f*b,l=l*g+d*b,u=u*g+m*b,g===1-o){var T=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=T,c*=T,l*=T,u*=T}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u},multiplyQuaternionsFlat:function(e,t,n,r,i,a){var o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],h=i[a+1],f=i[a+2],d=i[a+3];return e[t]=o*d+l*u+s*f-c*h,e[t+1]=s*d+l*h+c*u-o*f,e[t+2]=c*d+l*f+o*h-s*u,e[t+3]=l*d-o*u-s*h-c*f,e}});Object.defineProperties(wt.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}});Object.assign(wt.prototype,{isQuaternion:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,r=e._y,i=e._z,a=e.order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),h=s(n/2),f=s(r/2),d=s(i/2);switch(a){case"XYZ":this._x=h*l*u+c*f*d,this._y=c*f*u-h*l*d,this._z=c*l*d+h*f*u,this._w=c*l*u-h*f*d;break;case"YXZ":this._x=h*l*u+c*f*d,this._y=c*f*u-h*l*d,this._z=c*l*d-h*f*u,this._w=c*l*u+h*f*d;break;case"ZXY":this._x=h*l*u-c*f*d,this._y=c*f*u+h*l*d,this._z=c*l*d+h*f*u,this._w=c*l*u-h*f*d;break;case"ZYX":this._x=h*l*u-c*f*d,this._y=c*f*u+h*l*d,this._z=c*l*d-h*f*u,this._w=c*l*u+h*f*d;break;case"YZX":this._x=h*l*u+c*f*d,this._y=c*f*u+h*l*d,this._z=c*l*d-h*f*u,this._w=c*l*u-h*f*d;break;case"XZY":this._x=h*l*u-c*f*d,this._y=c*f*u-h*l*d,this._z=c*l*d+h*f*u,this._w=c*l*u+h*f*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],h=n+o+u,f;return h>0?(f=.5/Math.sqrt(h+1),this._w=.25/f,this._x=(l-s)*f,this._y=(i-c)*f,this._z=(a-r)*f):n>o&&n>u?(f=2*Math.sqrt(1+n-o-u),this._w=(l-s)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(i+c)/f):o>u?(f=2*Math.sqrt(1+o-n-u),this._w=(i-c)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(s+l)/f):(f=2*Math.sqrt(1+u-n-o),this._w=(a-r)/f,this._x=(i+c)/f,this._y=(s+l)/f,this._z=.25*f),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=1e-6,r=e.dot(t)+1;return r<n?(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:function(e){return 2*Math.acos(Math.abs(ke.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(n===0)return this;var r=Math.min(1,t/n);return this.slerp(e,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this},slerp:function(e,t){if(t===0)return this;if(t===1)return this.copy(e);var n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;var s=1-o*o;if(s<=Number.EPSILON){var c=1-t;return this._w=c*a+t*this._w,this._x=c*n+t*this._x,this._y=c*r+t*this._y,this._z=c*i+t*this._z,this.normalize(),this._onChangeCallback(),this}var l=Math.sqrt(s),u=Math.atan2(l,o),h=Math.sin((1-t)*u)/l,f=Math.sin(t*u)/l;return this._w=a*h+this._w*f,this._x=n*h+this._x*f,this._y=r*h+this._y*f,this._z=i*h+this._z*f,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return t===void 0&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},fromBufferAttribute:function(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var Hs=new E,ru=new wt;function E(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}Object.assign(E.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(ru.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(ru.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=s*t+a*r-o*n,l=s*n+o*t-i*r,u=s*r+i*n-a*t,h=-i*t-a*n-o*r;return this.x=c*s+h*-i+l*-o-u*-a,this.y=l*s+h*-a+u*-i-c*-o,this.z=u*s+h*-o+c*-a-l*-i,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this},cross:function(e,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this},projectOnVector:function(e){var t=e.lengthSq();if(t===0)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return Hs.copy(this).projectOnVector(e),this.sub(Hs)},reflect:function(e){return this.sub(Hs.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(ke.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,t*4)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,t*3)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this},random:function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}});var Vr=new E,sn=new We,vp=new E(0,0,0),mp=new E(1,1,1),Zn=new E,Za=new E,jt=new E;function We(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.assign(We.prototype,{isMatrix4:!0,set:function(e,t,n,r,i,a,o,s,c,l,u,h,f,d,m,g){var y=this.elements;return y[0]=e,y[4]=t,y[8]=n,y[12]=r,y[1]=i,y[5]=a,y[9]=o,y[13]=s,y[2]=c,y[6]=l,y[10]=u,y[14]=h,y[3]=f,y[7]=d,y[11]=m,y[15]=g,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return new We().fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(e){var t=this.elements,n=e.elements,r=1/Vr.setFromMatrixColumn(e,0).length(),i=1/Vr.setFromMatrixColumn(e,1).length(),a=1/Vr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order==="XYZ"){var h=a*l,f=a*u,d=o*l,m=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=f+d*c,t[5]=h-m*c,t[9]=-o*s,t[2]=m-h*c,t[6]=d+f*c,t[10]=a*s}else if(e.order==="YXZ"){var g=s*l,y=s*u,p=c*l,v=c*u;t[0]=g+v*o,t[4]=p*o-y,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=y*o-p,t[6]=v+g*o,t[10]=a*s}else if(e.order==="ZXY"){var g=s*l,y=s*u,p=c*l,v=c*u;t[0]=g-v*o,t[4]=-a*u,t[8]=p+y*o,t[1]=y+p*o,t[5]=a*l,t[9]=v-g*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order==="ZYX"){var h=a*l,f=a*u,d=o*l,m=o*u;t[0]=s*l,t[4]=d*c-f,t[8]=h*c+m,t[1]=s*u,t[5]=m*c+h,t[9]=f*c-d,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order==="YZX"){var _=a*s,x=a*c,b=o*s,T=o*c;t[0]=s*l,t[4]=T-_*u,t[8]=b*u+x,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=x*u+b,t[10]=_-T*u}else if(e.order==="XZY"){var _=a*s,x=a*c,b=o*s,T=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=_*u+T,t[5]=a*l,t[9]=x*u-b,t[2]=b*u-x,t[6]=o*l,t[10]=T*u+_}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(vp,e,mp)},lookAt:function(e,t,n){var r=this.elements;return jt.subVectors(e,t),jt.lengthSq()===0&&(jt.z=1),jt.normalize(),Zn.crossVectors(n,jt),Zn.lengthSq()===0&&(Math.abs(n.z)===1?jt.x+=1e-4:jt.z+=1e-4,jt.normalize(),Zn.crossVectors(n,jt)),Zn.normalize(),Za.crossVectors(jt,Zn),r[0]=Zn.x,r[4]=Za.x,r[8]=jt.x,r[1]=Zn.y,r[5]=Za.y,r[9]=jt.y,r[2]=Zn.z,r[6]=Za.z,r[10]=jt.z,this},multiply:function(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],h=n[9],f=n[13],d=n[2],m=n[6],g=n[10],y=n[14],p=n[3],v=n[7],_=n[11],x=n[15],b=r[0],T=r[4],C=r[8],N=r[12],O=r[1],J=r[5],F=r[9],B=r[13],V=r[2],Y=r[6],D=r[10],z=r[14],k=r[3],q=r[7],Z=r[11],ee=r[15];return i[0]=a*b+o*O+s*V+c*k,i[4]=a*T+o*J+s*Y+c*q,i[8]=a*C+o*F+s*D+c*Z,i[12]=a*N+o*B+s*z+c*ee,i[1]=l*b+u*O+h*V+f*k,i[5]=l*T+u*J+h*Y+f*q,i[9]=l*C+u*F+h*D+f*Z,i[13]=l*N+u*B+h*z+f*ee,i[2]=d*b+m*O+g*V+y*k,i[6]=d*T+m*J+g*Y+y*q,i[10]=d*C+m*F+g*D+y*Z,i[14]=d*N+m*B+g*z+y*ee,i[3]=p*b+v*O+_*V+x*k,i[7]=p*T+v*J+_*Y+x*q,i[11]=p*C+v*F+_*D+x*Z,i[15]=p*N+v*B+_*z+x*ee,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],h=e[10],f=e[14],d=e[3],m=e[7],g=e[11],y=e[15];return d*(+i*s*u-r*c*u-i*o*h+n*c*h+r*o*f-n*s*f)+m*(+t*s*f-t*c*h+i*a*h-r*a*f+r*c*l-i*s*l)+g*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+y*(-r*o*l-t*s*u+t*o*h+r*a*u-n*a*h+n*s*l)},transpose:function(){var e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(e,t,n){var r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this},getInverse:function(e,t){t!==void 0&&console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");var n=this.elements,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],h=r[7],f=r[8],d=r[9],m=r[10],g=r[11],y=r[12],p=r[13],v=r[14],_=r[15],x=d*v*h-p*m*h+p*u*g-l*v*g-d*u*_+l*m*_,b=y*m*h-f*v*h-y*u*g+c*v*g+f*u*_-c*m*_,T=f*p*h-y*d*h+y*l*g-c*p*g-f*l*_+c*d*_,C=y*d*u-f*p*u-y*l*m+c*p*m+f*l*v-c*d*v,N=i*x+a*b+o*T+s*C;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var O=1/N;return n[0]=x*O,n[1]=(p*m*s-d*v*s-p*o*g+a*v*g+d*o*_-a*m*_)*O,n[2]=(l*v*s-p*u*s+p*o*h-a*v*h-l*o*_+a*u*_)*O,n[3]=(d*u*s-l*m*s-d*o*h+a*m*h+l*o*g-a*u*g)*O,n[4]=b*O,n[5]=(f*v*s-y*m*s+y*o*g-i*v*g-f*o*_+i*m*_)*O,n[6]=(y*u*s-c*v*s-y*o*h+i*v*h+c*o*_-i*u*_)*O,n[7]=(c*m*s-f*u*s+f*o*h-i*m*h-c*o*g+i*u*g)*O,n[8]=T*O,n[9]=(y*d*s-f*p*s-y*a*g+i*p*g+f*a*_-i*d*_)*O,n[10]=(c*p*s-y*l*s+y*a*h-i*p*h-c*a*_+i*l*_)*O,n[11]=(f*l*s-c*d*s-f*a*h+i*d*h+c*a*g-i*l*g)*O,n[12]=C*O,n[13]=(f*p*o-y*d*o+y*a*m-i*p*m-f*a*v+i*d*v)*O,n[14]=(y*l*o-c*p*o-y*a*u+i*p*u+c*a*v-i*l*v)*O,n[15]=(c*d*o-f*l*o+f*a*u-i*d*u-c*a*m+i*l*m)*O,this},scale:function(e){var t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,h=i*c,f=i*l,d=i*u,m=a*l,g=a*u,y=o*u,p=s*c,v=s*l,_=s*u,x=n.x,b=n.y,T=n.z;return r[0]=(1-(m+y))*x,r[1]=(f+_)*x,r[2]=(d-v)*x,r[3]=0,r[4]=(f-_)*b,r[5]=(1-(h+y))*b,r[6]=(g+p)*b,r[7]=0,r[8]=(d+v)*T,r[9]=(g-p)*T,r[10]=(1-(h+m))*T,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this},decompose:function(e,t,n){var r=this.elements,i=Vr.set(r[0],r[1],r[2]).length(),a=Vr.set(r[4],r[5],r[6]).length(),o=Vr.set(r[8],r[9],r[10]).length(),s=this.determinant();s<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],sn.copy(this);var c=1/i,l=1/a,u=1/o;return sn.elements[0]*=c,sn.elements[1]*=c,sn.elements[2]*=c,sn.elements[4]*=l,sn.elements[5]*=l,sn.elements[6]*=l,sn.elements[8]*=u,sn.elements[9]*=u,sn.elements[10]*=u,t.setFromRotationMatrix(sn),n.x=i,n.y=a,n.z=o,this},makePerspective:function(e,t,n,r,i,a){a===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*i/(t-e),c=2*i/(n-r),l=(t+e)/(t-e),u=(n+r)/(n-r),h=-(a+i)/(a-i),f=-2*a*i/(a-i);return o[0]=s,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=f,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,r,i,a){var o=this.elements,s=1/(t-e),c=1/(n-r),l=1/(a-i),u=(t+e)*s,h=(n+r)*c,f=(a+i)*l;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*l,o[14]=-f,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,r=0;r<16;r++)if(t[r]!==n[r])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}});var iu=new We,au=new wt;function Ii(e,t,n,r){this._x=e||0,this._y=t||0,this._z=n||0,this._order=r||Ii.DefaultOrder}Ii.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];Ii.DefaultOrder="XYZ";Object.defineProperties(Ii.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}});Object.assign(Ii.prototype,{isEuler:!0,set:function(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._order=r||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var r=ke.clamp,i=e.elements,a=i[0],o=i[4],s=i[8],c=i[1],l=i[5],u=i[9],h=i[2],f=i[6],d=i[10];switch(t=t||this._order,t){case"XYZ":this._y=Math.asin(r(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(f,l),this._z=0);break;case"YXZ":this._x=Math.asin(-r(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(r(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,a));break;case"ZYX":this._y=Math.asin(-r(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(r(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-r(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n!==!1&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return iu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(iu,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return au.setFromEuler(this),this.setFromQuaternion(au,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new E(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});function Ac(){this.mask=1}Object.assign(Ac.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},enableAll:function(){this.mask=-1},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},disableAll:function(){this.mask=0},test:function(e){return(this.mask&e.mask)!==0}});let gp=0;const ou=new E,kr=new wt,Dn=new We,Ja=new E,Gi=new E,yp=new E,xp=new wt,su=new E(1,0,0),lu=new E(0,1,0),cu=new E(0,0,1),_p={type:"added"},bp={type:"removed"};function se(){Object.defineProperty(this,"id",{value:gp++}),this.uuid=ke.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=se.DefaultUp.clone();var e=new E,t=new Ii,n=new wt,r=new E(1,1,1);function i(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(i),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new We},normalMatrix:{value:new zt}}),this.matrix=new We,this.matrixWorld=new We,this.matrixAutoUpdate=se.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new Ac,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}se.DefaultUp=new E(0,1,0);se.DefaultMatrixAutoUpdate=!0;se.prototype=Object.assign(Object.create(vn.prototype),{constructor:se,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix4:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(e,t){return kr.setFromAxisAngle(e,t),this.quaternion.multiply(kr),this},rotateOnWorldAxis:function(e,t){return kr.setFromAxisAngle(e,t),this.quaternion.premultiply(kr),this},rotateX:function(e){return this.rotateOnAxis(su,e)},rotateY:function(e){return this.rotateOnAxis(lu,e)},rotateZ:function(e){return this.rotateOnAxis(cu,e)},translateOnAxis:function(e,t){return ou.copy(e).applyQuaternion(this.quaternion),this.position.add(ou.multiplyScalar(t)),this},translateX:function(e){return this.translateOnAxis(su,e)},translateY:function(e){return this.translateOnAxis(lu,e)},translateZ:function(e){return this.translateOnAxis(cu,e)},localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(e){return e.applyMatrix4(Dn.getInverse(this.matrixWorld))},lookAt:function(e,t,n){e.isVector3?Ja.copy(e):Ja.set(e,t,n);var r=this.parent;this.updateWorldMatrix(!0,!1),Gi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Dn.lookAt(Gi,Ja,this.up):Dn.lookAt(Ja,Gi,this.up),this.quaternion.setFromRotationMatrix(Dn),r&&(Dn.extractRotation(r.matrixWorld),kr.setFromRotationMatrix(Dn),this.quaternion.premultiply(kr.inverse()))},add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(_p)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(bp)),this},attach:function(e){return this.updateWorldMatrix(!0,!1),Dn.getInverse(this.matrixWorld),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Dn.multiply(e.parent.matrixWorld)),e.applyMatrix4(Dn),e.updateWorldMatrix(!1,!1),this.add(e),this},getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,r=this.children.length;n<r;n++){var i=this.children[n],a=i.getObjectByProperty(e,t);if(a!==void 0)return a}},getWorldPosition:function(e){return e===void 0&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new E),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(e){return e===void 0&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new wt),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Gi,e,yp),e},getWorldScale:function(e){return e===void 0&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new E),this.updateMatrixWorld(!0),this.matrixWorld.decompose(Gi,xp,e),e},getWorldDirection:function(e){e===void 0&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new E),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0)for(var r=this.children,i=0,a=r.length;i<a;i++)r[i].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON());function i(y,p){return y[p.uuid]===void 0&&(y[p.uuid]=p.toJSON(e)),p.uuid}if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);var a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){var o=a.shapes;if(Array.isArray(o))for(var s=0,c=o.length;s<c;s++){var l=o[s];i(e.shapes,l)}else i(e.shapes,o)}}if(this.material!==void 0)if(Array.isArray(this.material)){for(var u=[],s=0,c=this.material.length;s<c;s++)u.push(i(e.materials,this.material[s]));r.material=u}else r.material=i(e.materials,this.material);if(this.children.length>0){r.children=[];for(var s=0;s<this.children.length;s++)r.children.push(this.children[s].toJSON(e).object)}if(t){var h=g(e.geometries),f=g(e.materials),d=g(e.textures),m=g(e.images),o=g(e.shapes);h.length>0&&(n.geometries=h),f.length>0&&(n.materials=f),d.length>0&&(n.textures=d),m.length>0&&(n.images=m),o.length>0&&(n.shapes=o)}return n.object=r,n;function g(y){var p=[];for(var v in y){var _=y[v];delete _.metadata,p.push(_)}return p}},clone:function(e){return new this.constructor().copy(this,e)},copy:function(e,t){if(t===void 0&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var n=0;n<e.children.length;n++){var r=e.children[n];this.add(r.clone())}return this}});function ca(){se.call(this),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}ca.prototype=Object.assign(Object.create(se.prototype),{constructor:ca,isScene:!0,copy:function(e,t){return se.prototype.copy.call(this,e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=se.prototype.toJSON.call(this,e);return this.background!==null&&(t.object.background=this.background.toJSON(e)),this.environment!==null&&(t.object.environment=this.environment.toJSON(e)),this.fog!==null&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}});var In=[new E,new E,new E,new E,new E,new E,new E,new E],Hi=new E,Vs=new Pn,Wr=new E,Xr=new E,jr=new E,Jn=new E,Qn=new E,yr=new E,Vi=new E,Qa=new E,$a=new E,xr=new E;function Pn(e,t){this.min=e!==void 0?e:new E(1/0,1/0,1/0),this.max=t!==void 0?t:new E(-1/0,-1/0,-1/0)}Object.assign(Pn.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.length;s<c;s+=3){var l=e[s],u=e[s+1],h=e[s+2];l<t&&(t=l),u<n&&(n=u),h<r&&(r=h),l>i&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,r=1/0,i=-1/0,a=-1/0,o=-1/0,s=0,c=e.count;s<c;s++){var l=e.getX(s),u=e.getY(s),h=e.getZ(s);l<t&&(t=l),u<n&&(n=u),h<r&&(r=h),l>i&&(i=l),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,r),this.max.set(i,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=Hi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return e===void 0&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new E),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new E),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(e){e.updateWorldMatrix(!1,!1);var t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),Vs.copy(t.boundingBox),Vs.applyMatrix4(e.matrixWorld),this.union(Vs));for(var n=e.children,r=0,i=n.length;r<i;r++)this.expandByObject(n[r]);return this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return t===void 0&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new E),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,Hi),Hi.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(Vi),Qa.subVectors(this.max,Vi),Wr.subVectors(e.a,Vi),Xr.subVectors(e.b,Vi),jr.subVectors(e.c,Vi),Jn.subVectors(Xr,Wr),Qn.subVectors(jr,Xr),yr.subVectors(Wr,jr);var t=[0,-Jn.z,Jn.y,0,-Qn.z,Qn.y,0,-yr.z,yr.y,Jn.z,0,-Jn.x,Qn.z,0,-Qn.x,yr.z,0,-yr.x,-Jn.y,Jn.x,0,-Qn.y,Qn.x,0,-yr.y,yr.x,0];return!ks(t,Wr,Xr,jr,Qa)||(t=[1,0,0,0,1,0,0,0,1],!ks(t,Wr,Xr,jr,Qa))?!1:($a.crossVectors(Jn,Qn),t=[$a.x,$a.y,$a.z],ks(t,Wr,Xr,jr,Qa))},clampPoint:function(e,t){return t===void 0&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new E),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){var t=Hi.copy(e).clamp(this.min,this.max);return t.sub(e).length()},getBoundingSphere:function(e){return e===void 0&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=this.getSize(Hi).length()*.5,e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()?this:(In[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),In[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),In[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),In[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),In[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),In[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),In[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),In[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(In),this)},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});function ks(e,t,n,r,i){var a,o;for(a=0,o=e.length-3;a<=o;a+=3){xr.fromArray(e,a);var s=i.x*Math.abs(xr.x)+i.y*Math.abs(xr.y)+i.z*Math.abs(xr.z),c=t.dot(xr),l=n.dot(xr),u=r.dot(xr);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>s)return!1}return!0}var wp=new Pn;function jn(e,t){this.center=e!==void 0?e:new E,this.radius=t!==void 0?t:-1}Object.assign(jn.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;t!==void 0?n.copy(t):wp.setFromPoints(e).getCenter(n);for(var r=0,i=0,a=e.length;i<a;i++)r=Math.max(r,n.distanceToSquared(e[i]));return this.radius=Math.sqrt(r),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},isEmpty:function(){return this.radius<0},makeEmpty:function(){return this.center.set(0,0,0),this.radius=-1,this},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return t===void 0&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new E),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return e===void 0&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new Pn),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var Nn=new E,Ws=new E,Ka=new E,$n=new E,Xs=new E,eo=new E,js=new E;function Ni(e,t){this.origin=e!==void 0?e:new E,this.direction=t!==void 0?t:new E(0,0,-1)}Object.assign(Ni.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return t===void 0&&(console.warn("THREE.Ray: .at() target is now required"),t=new E),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,Nn)),this},closestPointToPoint:function(e,t){t===void 0&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new E),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=Nn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Nn.copy(this.direction).multiplyScalar(t).add(this.origin),Nn.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,r){Ws.copy(e).add(t).multiplyScalar(.5),Ka.copy(t).sub(e).normalize(),$n.copy(this.origin).sub(Ws);var i=e.distanceTo(t)*.5,a=-this.direction.dot(Ka),o=$n.dot(this.direction),s=-$n.dot(Ka),c=$n.lengthSq(),l=Math.abs(1-a*a),u,h,f,d;if(l>0)if(u=a*s-o,h=a*o-s,d=i*l,u>=0)if(h>=-d)if(h<=d){var m=1/l;u*=m,h*=m,f=u*(u+a*h+2*o)+h*(a*u+h+2*s)+c}else h=i,u=Math.max(0,-(a*h+o)),f=-u*u+h*(h+2*s)+c;else h=-i,u=Math.max(0,-(a*h+o)),f=-u*u+h*(h+2*s)+c;else h<=-d?(u=Math.max(0,-(-a*i+o)),h=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+h*(h+2*s)+c):h<=d?(u=0,h=Math.min(Math.max(-i,-s),i),f=h*(h+2*s)+c):(u=Math.max(0,-(a*i+o)),h=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+h*(h+2*s)+c);else h=a>0?-i:i,u=Math.max(0,-(a*h+o)),f=-u*u+h*(h+2*s)+c;return n&&n.copy(this.direction).multiplyScalar(u).add(this.origin),r&&r.copy(Ka).multiplyScalar(h).add(Ws),f},intersectSphere:function(e,t){Nn.subVectors(e.center,this.origin);var n=Nn.dot(this.direction),r=Nn.dot(Nn)-n*n,i=e.radius*e.radius;if(r>i)return null;var a=Math.sqrt(i-r),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return n===null?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);if(t===0)return!0;var n=e.normal.dot(this.direction);return n*t<0},intersectBox:function(e,t){var n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),l>=0?(i=(e.min.y-h.y)*l,a=(e.max.y-h.y)*l):(i=(e.max.y-h.y)*l,a=(e.min.y-h.y)*l),n>a||i>r||((i>n||n!==n)&&(n=i),(a<r||r!==r)&&(r=a),u>=0?(o=(e.min.z-h.z)*u,s=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,s=(e.min.z-h.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s<r||r!==r)&&(r=s),r<0)?null:this.at(n>=0?n:r,t)},intersectsBox:function(e){return this.intersectBox(e,Nn)!==null},intersectTriangle:function(e,t,n,r,i){Xs.subVectors(t,e),eo.subVectors(n,e),js.crossVectors(Xs,eo);var a=this.direction.dot(js),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;$n.subVectors(this.origin,e);var s=o*this.direction.dot(eo.crossVectors($n,eo));if(s<0)return null;var c=o*this.direction.dot(Xs.cross($n));if(c<0||s+c>a)return null;var l=-o*$n.dot(js);return l<0?null:this.at(l/a,i)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var qs=new E,Mp=new E,Ep=new zt;function bn(e,t){this.normal=e!==void 0?e:new E(1,0,0),this.constant=t!==void 0?t:0}Object.assign(bn.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,r){return this.normal.set(e,t,n),this.constant=r,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var r=qs.subVectors(n,t).cross(Mp.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return t===void 0&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new E),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){t===void 0&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new E);var n=e.delta(qs),r=this.normal.dot(n);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):void 0;var i=-(e.start.dot(this.normal)+this.constant)/r;if(!(i<0||i>1))return t.copy(n).multiplyScalar(i).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return e===void 0&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new E),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||Ep.getNormalMatrix(e),r=this.coplanarPoint(qs).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var un=new E,Bn=new E,Ys=new E,Fn=new E,qr=new E,Yr=new E,uu=new E,Zs=new E,Js=new E,Qs=new E;function Ot(e,t,n){this.a=e!==void 0?e:new E,this.b=t!==void 0?t:new E,this.c=n!==void 0?n:new E}Object.assign(Ot,{getNormal:function(e,t,n,r){r===void 0&&(console.warn("THREE.Triangle: .getNormal() target is now required"),r=new E),r.subVectors(n,t),un.subVectors(e,t),r.cross(un);var i=r.lengthSq();return i>0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)},getBarycoord:function(e,t,n,r,i){un.subVectors(r,t),Bn.subVectors(n,t),Ys.subVectors(e,t);var a=un.dot(un),o=un.dot(Bn),s=un.dot(Ys),c=Bn.dot(Bn),l=Bn.dot(Ys),u=a*c-o*o;if(i===void 0&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),i=new E),u===0)return i.set(-2,-1,-1);var h=1/u,f=(c*s-o*l)*h,d=(a*l-o*s)*h;return i.set(1-f-d,d,f)},containsPoint:function(e,t,n,r){return Ot.getBarycoord(e,t,n,r,Fn),Fn.x>=0&&Fn.y>=0&&Fn.x+Fn.y<=1},getUV:function(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,Fn),s.set(0,0),s.addScaledVector(i,Fn.x),s.addScaledVector(a,Fn.y),s.addScaledVector(o,Fn.z),s},isFrontFacing:function(e,t,n,r){return un.subVectors(n,t),Bn.subVectors(e,t),un.cross(Bn).dot(r)<0}});Object.assign(Ot.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return un.subVectors(this.c,this.b),Bn.subVectors(this.a,this.b),un.cross(Bn).length()*.5},getMidpoint:function(e){return e===void 0&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new E),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return Ot.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return e===void 0&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new bn),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return Ot.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,r,i){return Ot.getUV(e,this.a,this.b,this.c,t,n,r,i)},containsPoint:function(e){return Ot.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return Ot.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){t===void 0&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new E);var n=this.a,r=this.b,i=this.c,a,o;qr.subVectors(r,n),Yr.subVectors(i,n),Zs.subVectors(e,n);var s=qr.dot(Zs),c=Yr.dot(Zs);if(s<=0&&c<=0)return t.copy(n);Js.subVectors(e,r);var l=qr.dot(Js),u=Yr.dot(Js);if(l>=0&&u<=l)return t.copy(r);var h=s*u-l*c;if(h<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(qr,a);Qs.subVectors(e,i);var f=qr.dot(Qs),d=Yr.dot(Qs);if(d>=0&&f<=d)return t.copy(i);var m=f*c-s*d;if(m<=0&&c>=0&&d<=0)return o=c/(c-d),t.copy(n).addScaledVector(Yr,o);var g=l*d-f*u;if(g<=0&&u-l>=0&&f-d>=0)return uu.subVectors(i,r),o=(u-l)/(u-l+(f-d)),t.copy(r).addScaledVector(uu,o);var y=1/(g+m+h);return a=m*y,o=h*y,t.copy(n).addScaledVector(qr,a).addScaledVector(Yr,o)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var Dh={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},to={h:0,s:0,l:0};function pe(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}function $s(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}function Ks(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}function el(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}Object.assign(pe.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=ke.euclideanModulo(e,1),t=ke.clamp(t,0,1),n=ke.clamp(n,0,1),t===0)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=$s(i,r,e+1/3),this.g=$s(i,r,e),this.b=$s(i,r,e-1/3)}return this},setStyle:function(e){function t(h){h!==void 0&&parseFloat(h)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var r,i=n[1],a=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,t(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,t(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,c=parseInt(r[3],10)/100;return t(r[5]),this.setHSL(o,s,c)}break}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var l=n[1],u=l.length;if(u===3)return this.r=parseInt(l.charAt(0)+l.charAt(0),16)/255,this.g=parseInt(l.charAt(1)+l.charAt(1),16)/255,this.b=parseInt(l.charAt(2)+l.charAt(2),16)/255,this;if(u===6)return this.r=parseInt(l.charAt(0)+l.charAt(1),16)/255,this.g=parseInt(l.charAt(2)+l.charAt(3),16)/255,this.b=parseInt(l.charAt(4)+l.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=Dh[e];return t!==void 0?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return t===void 0&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){t===void 0&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=Ks(e.r),this.g=Ks(e.g),this.b=Ks(e.b),this},copyLinearToSRGB:function(e){return this.r=el(e.r),this.g=el(e.g),this.b=el(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){e===void 0&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t=this.r,n=this.g,r=this.b,i=Math.max(t,n,r),a=Math.min(t,n,r),o,s,c=(a+i)/2;if(a===i)o=0,s=0;else{var l=i-a;switch(s=c<=.5?l/(i+a):l/(2-i-a),i){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;case r:o=(t-n)/l+4;break}o/=6}return e.h=o,e.s=s,e.l=c,e},getStyle:function(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"},offsetHSL:function(e,t,n){return this.getHSL(ln),ln.h+=e,ln.s+=t,ln.l+=n,this.setHSL(ln.h,ln.s,ln.l),this},add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(e,t){this.getHSL(ln),e.getHSL(to);var n=ke.lerp(ln.h,to.h,t),r=ke.lerp(ln.s,to.s,t),i=ke.lerp(ln.l,to.l,t);return this.setHSL(n,r,i),this},equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return t===void 0&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}});pe.NAMES=Dh;function Xo(e,t,n,r,i,a){this.a=e,this.b=t,this.c=n,this.normal=r&&r.isVector3?r:new E,this.vertexNormals=Array.isArray(r)?r:[],this.color=i&&i.isColor?i:new pe,this.vertexColors=Array.isArray(i)?i:[],this.materialIndex=a!==void 0?a:0}Object.assign(Xo.prototype,{clone:function(){return new this.constructor().copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var Tp=0;function Ie(){Object.defineProperty(this,"id",{value:Tp++}),this.uuid=ke.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.blending=ta,this.side=Va,this.flatShading=!1,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=Mh,this.blendDst=Eh,this.blendEquation=ii,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=_l,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=dp,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Gs,this.stencilZFail=Gs,this.stencilZPass=Gs,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}Ie.prototype=Object.assign(Object.create(vn.prototype),{constructor:Ie,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(e!==void 0)for(var t in e){var n=e[t];if(n===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===wh;continue}var r=this[t];if(r===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}},toJSON:function(e){var t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,this.combine!==void 0&&(n.combine=this.combine),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ta&&(n.blending=this.blending),this.flatShading===!0&&(n.flatShading=this.flatShading),this.side!==Va&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.morphTargets===!0&&(n.morphTargets=!0),this.morphNormals===!0&&(n.morphNormals=!0),this.skinning===!0&&(n.skinning=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function r(o){var s=[];for(var c in o){var l=o[c];delete l.metadata,s.push(l)}return s}if(t){var i=r(e.textures),a=r(e.images);i.length>0&&(n.textures=i),a.length>0&&(n.images=a)}return n},clone:function(){return new this.constructor().copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(t!==null){var r=t.length;n=new Array(r);for(var i=0;i!==r;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Object.defineProperty(Ie.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}});function pn(e){Ie.call(this),this.type="MeshBasicMaterial",this.color=new pe(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=Ss,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.setValues(e)}pn.prototype=Object.create(Ie.prototype);pn.prototype.constructor=pn;pn.prototype.isMeshBasicMaterial=!0;pn.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};var at=new E;function De(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n===!0,this.usage=Ps,this.updateRange={offset:0,count:-1},this.version=0}Object.defineProperty(De.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}});Object.assign(De.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var r=0,i=this.itemSize;r<i;r++)this.array[e+r]=t.array[n+r];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",r),a=new pe),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",r),a=new X),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",r),a=new E),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,r=0,i=e.length;r<i;r++){var a=e[r];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",r),a=new tt),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},applyMatrix3:function(e){for(var t=0,n=this.count;t<n;t++)at.x=this.getX(t),at.y=this.getY(t),at.z=this.getZ(t),at.applyMatrix3(e),this.setXYZ(t,at.x,at.y,at.z);return this},applyMatrix4:function(e){for(var t=0,n=this.count;t<n;t++)at.x=this.getX(t),at.y=this.getY(t),at.z=this.getZ(t),at.applyMatrix4(e),this.setXYZ(t,at.x,at.y,at.z);return this},applyNormalMatrix:function(e){for(var t=0,n=this.count;t<n;t++)at.x=this.getX(t),at.y=this.getY(t),at.z=this.getZ(t),at.applyNormalMatrix(e),this.setXYZ(t,at.x,at.y,at.z);return this},transformDirection:function(e){for(var t=0,n=this.count;t<n;t++)at.x=this.getX(t),at.y=this.getY(t),at.z=this.getZ(t),at.transformDirection(e),this.setXYZ(t,at.x,at.y,at.z);return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=i,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}});function Ml(e,t,n){De.call(this,new Int8Array(e),t,n)}Ml.prototype=Object.create(De.prototype);Ml.prototype.constructor=Ml;function El(e,t,n){De.call(this,new Uint8Array(e),t,n)}El.prototype=Object.create(De.prototype);El.prototype.constructor=El;function Tl(e,t,n){De.call(this,new Uint8ClampedArray(e),t,n)}Tl.prototype=Object.create(De.prototype);Tl.prototype.constructor=Tl;function Sl(e,t,n){De.call(this,new Int16Array(e),t,n)}Sl.prototype=Object.create(De.prototype);Sl.prototype.constructor=Sl;function ua(e,t,n){De.call(this,new Uint16Array(e),t,n)}ua.prototype=Object.create(De.prototype);ua.prototype.constructor=ua;function Al(e,t,n){De.call(this,new Int32Array(e),t,n)}Al.prototype=Object.create(De.prototype);Al.prototype.constructor=Al;function ha(e,t,n){De.call(this,new Uint32Array(e),t,n)}ha.prototype=Object.create(De.prototype);ha.prototype.constructor=ha;function ce(e,t,n){De.call(this,new Float32Array(e),t,n)}ce.prototype=Object.create(De.prototype);ce.prototype.constructor=ce;function Ll(e,t,n){De.call(this,new Float64Array(e),t,n)}Ll.prototype=Object.create(De.prototype);Ll.prototype.constructor=Ll;function Ih(){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}Object.assign(Ih.prototype,{computeGroups:function(e){for(var t,n=[],r=void 0,i=e.faces,a=0;a<i.length;a++){var o=i[a];o.materialIndex!==r&&(r=o.materialIndex,t!==void 0&&(t.count=a*3-t.start,n.push(t)),t={start:a*3,materialIndex:r})}t!==void 0&&(t.count=a*3-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t=e.faces,n=e.vertices,r=e.faceVertexUvs,i=r[0]&&r[0].length>0,a=r[1]&&r[1].length>0,o=e.morphTargets,s=o.length,c;if(s>0){c=[];for(var l=0;l<s;l++)c[l]={name:o[l].name,data:[]};this.morphTargets.position=c}var u=e.morphNormals,h=u.length,f;if(h>0){f=[];for(var l=0;l<h;l++)f[l]={name:u[l].name,data:[]};this.morphTargets.normal=f}var d=e.skinIndices,m=e.skinWeights,g=d.length===n.length,y=m.length===n.length;n.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var l=0;l<t.length;l++){var p=t[l];this.vertices.push(n[p.a],n[p.b],n[p.c]);var v=p.vertexNormals;if(v.length===3)this.normals.push(v[0],v[1],v[2]);else{var _=p.normal;this.normals.push(_,_,_)}var x=p.vertexColors;if(x.length===3)this.colors.push(x[0],x[1],x[2]);else{var b=p.color;this.colors.push(b,b,b)}if(i===!0){var T=r[0][l];T!==void 0?this.uvs.push(T[0],T[1],T[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",l),this.uvs.push(new X,new X,new X))}if(a===!0){var T=r[1][l];T!==void 0?this.uvs2.push(T[0],T[1],T[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",l),this.uvs2.push(new X,new X,new X))}for(var C=0;C<s;C++){var N=o[C].vertices;c[C].data.push(N[p.a],N[p.b],N[p.c])}for(var C=0;C<h;C++){var O=u[C].vertexNormals[l];f[C].data.push(O.a,O.b,O.c)}g&&this.skinIndices.push(d[p.a],d[p.b],d[p.c]),y&&this.skinWeights.push(m[p.a],m[p.b],m[p.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,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}});function Nh(e){if(e.length===0)return-1/0;let t=e[0];for(let n=1,r=e.length;n<r;++n)e[n]>t&&(t=e[n]);return t}var Sp=1,yn=new We,tl=new se,Zr=new E,qt=new Pn,ki=new Pn,_t=new E;function ge(){Object.defineProperty(this,"id",{value:Sp+=2}),this.uuid=ke.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}ge.prototype=Object.assign(Object.create(vn.prototype),{constructor:ge,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(Nh(e)>65535?ha:ua)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:n!==void 0?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix4:function(e){var t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);var n=this.attributes.normal;if(n!==void 0){var r=new zt().getNormalMatrix(e);n.applyNormalMatrix(r),n.needsUpdate=!0}var i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},rotateX:function(e){return yn.makeRotationX(e),this.applyMatrix4(yn),this},rotateY:function(e){return yn.makeRotationY(e),this.applyMatrix4(yn),this},rotateZ:function(e){return yn.makeRotationZ(e),this.applyMatrix4(yn),this},translate:function(e,t,n){return yn.makeTranslation(e,t,n),this.applyMatrix4(yn),this},scale:function(e,t,n){return yn.makeScale(e,t,n),this.applyMatrix4(yn),this},lookAt:function(e){return tl.lookAt(e),tl.updateMatrix(),this.applyMatrix4(tl.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Zr).negate(),this.translate(Zr.x,Zr.y,Zr.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new ce(t.vertices.length*3,3),r=new ce(t.colors.length*3,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",r.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var i=new ce(t.lineDistances.length,1);this.setAttribute("lineDistance",i.copyArray(t.lineDistances))}t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];t.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new ce(t,3)),this},updateFromObject:function(e){var t=e.geometry;if(e.isMesh){var n=t.__directGeometry;if(t.elementsNeedUpdate===!0&&(n=void 0,t.elementsNeedUpdate=!1),n===void 0)return this.fromGeometry(t);n.verticesNeedUpdate=t.verticesNeedUpdate,n.normalsNeedUpdate=t.normalsNeedUpdate,n.colorsNeedUpdate=t.colorsNeedUpdate,n.uvsNeedUpdate=t.uvsNeedUpdate,n.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=n}var r;return t.verticesNeedUpdate===!0&&(r=this.attributes.position,r!==void 0&&(r.copyVector3sArray(t.vertices),r.needsUpdate=!0),t.verticesNeedUpdate=!1),t.normalsNeedUpdate===!0&&(r=this.attributes.normal,r!==void 0&&(r.copyVector3sArray(t.normals),r.needsUpdate=!0),t.normalsNeedUpdate=!1),t.colorsNeedUpdate===!0&&(r=this.attributes.color,r!==void 0&&(r.copyColorsArray(t.colors),r.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(r=this.attributes.uv,r!==void 0&&(r.copyVector2sArray(t.uvs),r.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(r=this.attributes.lineDistance,r!==void 0&&(r.copyArray(t.lineDistances),r.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=new Ih().fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(e.vertices.length*3);if(this.setAttribute("position",new De(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(e.normals.length*3);this.setAttribute("normal",new De(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var r=new Float32Array(e.colors.length*3);this.setAttribute("color",new De(r,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var i=new Float32Array(e.uvs.length*2);this.setAttribute("uv",new De(i,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(e.uvs2.length*2);this.setAttribute("uv2",new De(a,2).copyVector2sArray(e.uvs2))}this.groups=e.groups;for(var o in e.morphTargets){for(var s=[],c=e.morphTargets[o],l=0,u=c.length;l<u;l++){var h=c[l],f=new ce(h.data.length*3,3);f.name=h.name,s.push(f.copyVector3sArray(h.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var d=new ce(e.skinIndices.length*4,4);this.setAttribute("skinIndex",d.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var m=new ce(e.skinWeights.length*4,4);this.setAttribute("skinWeight",m.copyVector4sArray(e.skinWeights))}return e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new Pn);var e=this.attributes.position,t=this.morphAttributes.position;if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,r=t.length;n<r;n++){var i=t[n];qt.setFromBufferAttribute(i),this.morphTargetsRelative?(_t.addVectors(this.boundingBox.min,qt.min),this.boundingBox.expandByPoint(_t),_t.addVectors(this.boundingBox.max,qt.max),this.boundingBox.expandByPoint(_t)):(this.boundingBox.expandByPoint(qt.min),this.boundingBox.expandByPoint(qt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new jn);var e=this.attributes.position,t=this.morphAttributes.position;if(e){var n=this.boundingSphere.center;if(qt.setFromBufferAttribute(e),t)for(var r=0,i=t.length;r<i;r++){var a=t[r];ki.setFromBufferAttribute(a),this.morphTargetsRelative?(_t.addVectors(qt.min,ki.min),qt.expandByPoint(_t),_t.addVectors(qt.max,ki.max),qt.expandByPoint(_t)):(qt.expandByPoint(ki.min),qt.expandByPoint(ki.max))}qt.getCenter(n);for(var o=0,r=0,i=e.count;r<i;r++)_t.fromBufferAttribute(e,r),o=Math.max(o,n.distanceToSquared(_t));if(t)for(var r=0,i=t.length;r<i;r++)for(var a=t[r],s=this.morphTargetsRelative,c=0,l=a.count;c<l;c++)_t.fromBufferAttribute(a,c),s&&(Zr.fromBufferAttribute(e,c),_t.add(Zr)),o=Math.max(o,n.distanceToSquared(_t));this.boundingSphere.radius=Math.sqrt(o),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}},computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(t.normal===void 0)this.setAttribute("normal",new De(new Float32Array(n.length),3));else for(var r=t.normal.array,i=0,a=r.length;i<a;i++)r[i]=0;var o=t.normal.array,s,c,l,u=new E,h=new E,f=new E,d=new E,m=new E;if(e)for(var g=e.array,i=0,a=e.count;i<a;i+=3)s=g[i+0]*3,c=g[i+1]*3,l=g[i+2]*3,u.fromArray(n,s),h.fromArray(n,c),f.fromArray(n,l),d.subVectors(f,h),m.subVectors(u,h),d.cross(m),o[s]+=d.x,o[s+1]+=d.y,o[s+2]+=d.z,o[c]+=d.x,o[c+1]+=d.y,o[c+2]+=d.z,o[l]+=d.x,o[l+1]+=d.y,o[l+2]+=d.z;else for(var i=0,a=n.length;i<a;i+=9)u.fromArray(n,i),h.fromArray(n,i+3),f.fromArray(n,i+6),d.subVectors(f,h),m.subVectors(u,h),d.cross(m),o[i]=d.x,o[i+1]=d.y,o[i+2]=d.z,o[i+3]=d.x,o[i+4]=d.y,o[i+5]=d.z,o[i+6]=d.x,o[i+7]=d.y,o[i+8]=d.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var r in n)if(e.attributes[r]!==void 0)for(var i=n[r],a=i.array,o=e.attributes[r],s=o.array,c=o.itemSize*t,l=Math.min(s.length,a.length-c),u=0,h=c;u<l;u++,h++)a[h]=s[u];return this},normalizeNormals:function(){for(var e=this.attributes.normal,t=0,n=e.count;t<n;t++)_t.x=e.getX(t),_t.y=e.getY(t),_t.z=e.getZ(t),_t.normalize(),e.setXYZ(t,_t.x,_t.y,_t.z)},toNonIndexed:function(){function e(g,y){for(var p=g.array,v=g.itemSize,_=g.normalized,x=new p.constructor(y.length*v),b=0,T=0,C=0,N=y.length;C<N;C++){b=y[C]*v;for(var O=0;O<v;O++)x[T++]=p[b++]}return new De(x,v,_)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new ge,n=this.index.array,r=this.attributes;for(var i in r){var a=r[i],o=e(a,n);t.setAttribute(i,o)}var s=this.morphAttributes;for(i in s){for(var c=[],l=s[i],u=0,h=l.length;u<h;u++){var a=l[u],o=e(a,n);c.push(o)}t.morphAttributes[i]=c}t.morphTargetsRelative=this.morphTargetsRelative;for(var f=this.groups,u=0,d=f.length;u<d;u++){var m=f[u];t.addGroup(m.start,m.count,m.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};var r=this.index;r!==null&&(e.data.index={type:r.array.constructor.name,array:Array.prototype.slice.call(r.array)});var i=this.attributes;for(var n in i){var a=i[n],o=a.toJSON();a.name!==""&&(o.name=a.name),e.data.attributes[n]=o}var s={},c=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],u=[],h=0,f=l.length;h<f;h++){var a=l[h],o=a.toJSON();a.name!==""&&(o.name=a.name),u.push(o)}u.length>0&&(s[n]=u,c=!0)}c&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);var d=this.groups;d.length>0&&(e.data.groups=JSON.parse(JSON.stringify(d)));var m=this.boundingSphere;return m!==null&&(e.data.boundingSphere={center:m.center.toArray(),radius:m.radius}),e},clone:function(){return new ge().copy(this)},copy:function(e){var t,n,r;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var i=e.index;i!==null&&this.setIndex(i.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var c=[],l=s[t];for(n=0,r=l.length;n<r;n++)c.push(l[n].clone());this.morphAttributes[t]=c}this.morphTargetsRelative=e.morphTargetsRelative;var u=e.groups;for(n=0,r=u.length;n<r;n++){var h=u[n];this.addGroup(h.start,h.count,h.materialIndex)}var f=e.boundingBox;f!==null&&(this.boundingBox=f.clone());var d=e.boundingSphere;return d!==null&&(this.boundingSphere=d.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});var hu=new We,_r=new Ni,nl=new jn,Kn=new E,er=new E,tr=new E,rl=new E,il=new E,al=new E,no=new E,ro=new E,io=new E,si=new X,li=new X,ci=new X,ia=new E,ao=new E;function ft(e,t){se.call(this),this.type="Mesh",this.geometry=e!==void 0?e:new ge,this.material=t!==void 0?t:new pn,this.updateMorphTargets()}ft.prototype=Object.assign(Object.create(se.prototype),{constructor:ft,isMesh:!0,copy:function(e){return se.prototype.copy.call(this,e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var n=this.geometry,r=this.material,i=this.matrixWorld;if(r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),nl.copy(n.boundingSphere),nl.applyMatrix4(i),e.ray.intersectsSphere(nl)!==!1&&(hu.getInverse(i),_r.copy(e.ray).applyMatrix4(hu),!(n.boundingBox!==null&&_r.intersectsBox(n.boundingBox)===!1)))){var a;if(n.isBufferGeometry){var o,s,c,l=n.index,u=n.attributes.position,h=n.morphAttributes.position,f=n.morphTargetsRelative,d=n.attributes.uv,m=n.attributes.uv2,g=n.groups,y=n.drawRange,p,v,_,x,b,T,C,N;if(l!==null)if(Array.isArray(r))for(p=0,_=g.length;p<_;p++)for(b=g[p],T=r[b.materialIndex],C=Math.max(b.start,y.start),N=Math.min(b.start+b.count,y.start+y.count),v=C,x=N;v<x;v+=3)o=l.getX(v),s=l.getX(v+1),c=l.getX(v+2),a=oo(this,T,e,_r,u,h,f,d,m,o,s,c),a&&(a.faceIndex=Math.floor(v/3),a.face.materialIndex=b.materialIndex,t.push(a));else for(C=Math.max(0,y.start),N=Math.min(l.count,y.start+y.count),p=C,_=N;p<_;p+=3)o=l.getX(p),s=l.getX(p+1),c=l.getX(p+2),a=oo(this,r,e,_r,u,h,f,d,m,o,s,c),a&&(a.faceIndex=Math.floor(p/3),t.push(a));else if(u!==void 0)if(Array.isArray(r))for(p=0,_=g.length;p<_;p++)for(b=g[p],T=r[b.materialIndex],C=Math.max(b.start,y.start),N=Math.min(b.start+b.count,y.start+y.count),v=C,x=N;v<x;v+=3)o=v,s=v+1,c=v+2,a=oo(this,T,e,_r,u,h,f,d,m,o,s,c),a&&(a.faceIndex=Math.floor(v/3),a.face.materialIndex=b.materialIndex,t.push(a));else for(C=Math.max(0,y.start),N=Math.min(u.count,y.start+y.count),p=C,_=N;p<_;p+=3)o=p,s=p+1,c=p+2,a=oo(this,r,e,_r,u,h,f,d,m,o,s,c),a&&(a.faceIndex=Math.floor(p/3),t.push(a))}else if(n.isGeometry){var O,J,F,B=Array.isArray(r),V=n.vertices,Y=n.faces,D,z=n.faceVertexUvs[0];z.length>0&&(D=z);for(var k=0,q=Y.length;k<q;k++){var Z=Y[k],ee=B?r[Z.materialIndex]:r;if(ee!==void 0&&(O=V[Z.a],J=V[Z.b],F=V[Z.c],a=Fh(this,ee,e,_r,O,J,F,ia),a)){if(D&&D[k]){var te=D[k];si.copy(te[0]),li.copy(te[1]),ci.copy(te[2]),a.uv=Ot.getUV(ia,O,J,F,si,li,ci,new X)}a.face=Z,a.faceIndex=k,t.push(a)}}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});function Fh(e,t,n,r,i,a,o,s){var c;if(t.side===Pt?c=r.intersectTriangle(o,a,i,!0,s):c=r.intersectTriangle(i,a,o,t.side!==Ts,s),c===null)return null;ao.copy(s),ao.applyMatrix4(e.matrixWorld);var l=n.ray.origin.distanceTo(ao);return l<n.near||l>n.far?null:{distance:l,point:ao.clone(),object:e}}function oo(e,t,n,r,i,a,o,s,c,l,u,h){Kn.fromBufferAttribute(i,l),er.fromBufferAttribute(i,u),tr.fromBufferAttribute(i,h);var f=e.morphTargetInfluences;if(t.morphTargets&&a&&f){no.set(0,0,0),ro.set(0,0,0),io.set(0,0,0);for(var d=0,m=a.length;d<m;d++){var g=f[d],y=a[d];g!==0&&(rl.fromBufferAttribute(y,l),il.fromBufferAttribute(y,u),al.fromBufferAttribute(y,h),o?(no.addScaledVector(rl,g),ro.addScaledVector(il,g),io.addScaledVector(al,g)):(no.addScaledVector(rl.sub(Kn),g),ro.addScaledVector(il.sub(er),g),io.addScaledVector(al.sub(tr),g)))}Kn.add(no),er.add(ro),tr.add(io)}e.isSkinnedMesh&&(e.boneTransform(l,Kn),e.boneTransform(u,er),e.boneTransform(h,tr));var p=Fh(e,t,n,r,Kn,er,tr,ia);if(p){s&&(si.fromBufferAttribute(s,l),li.fromBufferAttribute(s,u),ci.fromBufferAttribute(s,h),p.uv=Ot.getUV(ia,Kn,er,tr,si,li,ci,new X)),c&&(si.fromBufferAttribute(c,l),li.fromBufferAttribute(c,u),ci.fromBufferAttribute(c,h),p.uv2=Ot.getUV(ia,Kn,er,tr,si,li,ci,new X));var v=new Xo(l,u,h);Ot.getNormal(Kn,er,tr,v.normal),p.face=v}return p}var Ap=0,xn=new We,ol=new se,so=new E;function Fe(){Object.defineProperty(this,"id",{value:Ap+=2}),this.uuid=ke.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}Fe.prototype=Object.assign(Object.create(vn.prototype),{constructor:Fe,isGeometry:!0,applyMatrix4:function(e){for(var t=new zt().getNormalMatrix(e),n=0,r=this.vertices.length;n<r;n++){var i=this.vertices[n];i.applyMatrix4(e)}for(var n=0,r=this.faces.length;n<r;n++){var a=this.faces[n];a.normal.applyMatrix3(t).normalize();for(var o=0,s=a.vertexNormals.length;o<s;o++)a.vertexNormals[o].applyMatrix3(t).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(e){return xn.makeRotationX(e),this.applyMatrix4(xn),this},rotateY:function(e){return xn.makeRotationY(e),this.applyMatrix4(xn),this},rotateZ:function(e){return xn.makeRotationZ(e),this.applyMatrix4(xn),this},translate:function(e,t,n){return xn.makeTranslation(e,t,n),this.applyMatrix4(xn),this},scale:function(e,t,n){return xn.makeScale(e,t,n),this.applyMatrix4(xn),this},lookAt:function(e){return ol.lookAt(e),ol.updateMatrix(),this.applyMatrix4(ol.matrix),this},fromBufferGeometry:function(e){var t=this,n=e.index!==null?e.index.array:void 0,r=e.attributes;if(r.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;var i=r.position.array,a=r.normal!==void 0?r.normal.array:void 0,o=r.color!==void 0?r.color.array:void 0,s=r.uv!==void 0?r.uv.array:void 0,c=r.uv2!==void 0?r.uv2.array:void 0;c!==void 0&&(this.faceVertexUvs[1]=[]);for(var l=0;l<i.length;l+=3)t.vertices.push(new E().fromArray(i,l)),o!==void 0&&t.colors.push(new pe().fromArray(o,l));function u(p,v,_,x){var b=o===void 0?[]:[t.colors[p].clone(),t.colors[v].clone(),t.colors[_].clone()],T=a===void 0?[]:[new E().fromArray(a,p*3),new E().fromArray(a,v*3),new E().fromArray(a,_*3)],C=new Xo(p,v,_,T,b,x);t.faces.push(C),s!==void 0&&t.faceVertexUvs[0].push([new X().fromArray(s,p*2),new X().fromArray(s,v*2),new X().fromArray(s,_*2)]),c!==void 0&&t.faceVertexUvs[1].push([new X().fromArray(c,p*2),new X().fromArray(c,v*2),new X().fromArray(c,_*2)])}var h=e.groups;if(h.length>0)for(var l=0;l<h.length;l++)for(var f=h[l],d=f.start,m=f.count,g=d,y=d+m;g<y;g+=3)n!==void 0?u(n[g],n[g+1],n[g+2],f.materialIndex):u(g,g+1,g+2,f.materialIndex);else if(n!==void 0)for(var l=0;l<n.length;l+=3)u(n[l],n[l+1],n[l+2]);else for(var l=0;l<i.length/3;l+=3)u(l,l+1,l+2);return this.computeFaceNormals(),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(so).negate(),this.translate(so.x,so.y,so.z),this},normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=t===0?1:1/t,r=new We;return r.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix4(r),this},computeFaceNormals:function(){for(var e=new E,t=new E,n=0,r=this.faces.length;n<r;n++){var i=this.faces[n],a=this.vertices[i.a],o=this.vertices[i.b],s=this.vertices[i.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),i.normal.copy(e)}},computeVertexNormals:function(e){e===void 0&&(e=!0);var t,n,r,i,a,o;for(o=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)o[t]=new E;if(e){var s,c,l,u=new E,h=new E;for(r=0,i=this.faces.length;r<i;r++)a=this.faces[r],s=this.vertices[a.a],c=this.vertices[a.b],l=this.vertices[a.c],u.subVectors(l,c),h.subVectors(s,c),u.cross(h),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),r=0,i=this.faces.length;r<i;r++)a=this.faces[r],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(r=0,i=this.faces.length;r<i;r++){a=this.faces[r];var f=a.vertexNormals;f.length===3?(f[0].copy(o[a.a]),f[1].copy(o[a.b]),f[2].copy(o[a.c])):(f[0]=o[a.a].clone(),f[1]=o[a.b].clone(),f[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){n=this.faces[e];var r=n.vertexNormals;r.length===3?(r[0].copy(n.normal),r[1].copy(n.normal),r[2].copy(n.normal)):(r[0]=n.normal.clone(),r[1]=n.normal.clone(),r[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,r,i;for(n=0,r=this.faces.length;n<r;n++)for(i=this.faces[n],i.__originalFaceNormal?i.__originalFaceNormal.copy(i.normal):i.__originalFaceNormal=i.normal.clone(),i.__originalVertexNormals||(i.__originalVertexNormals=[]),e=0,t=i.vertexNormals.length;e<t;e++)i.__originalVertexNormals[e]?i.__originalVertexNormals[e].copy(i.vertexNormals[e]):i.__originalVertexNormals[e]=i.vertexNormals[e].clone();var a=new Fe;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals,l,u;for(n=0,r=this.faces.length;n<r;n++)l=new E,u={a:new E,b:new E,c:new E},o.push(l),s.push(u)}var c=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var l,u;for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],l=c.faceNormals[n],u=c.vertexNormals[n],l.copy(i.normal),u.a.copy(i.vertexNormals[0]),u.b.copy(i.vertexNormals[1]),u.c.copy(i.vertexNormals[2])}for(n=0,r=this.faces.length;n<r;n++)i=this.faces[n],i.normal=i.__originalFaceNormal,i.vertexNormals=i.__originalVertexNormals},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new Pn),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new jn),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(!(e&&e.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);return}var r,i=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,c=e.faces,l=this.colors,u=e.colors;n===void 0&&(n=0),t!==void 0&&(r=new zt().getNormalMatrix(t));for(var h=0,f=o.length;h<f;h++){var d=o[h],m=d.clone();t!==void 0&&m.applyMatrix4(t),a.push(m)}for(var h=0,f=u.length;h<f;h++)l.push(u[h].clone());for(h=0,f=c.length;h<f;h++){var g=c[h],y,p,v,_=g.vertexNormals,x=g.vertexColors;y=new Xo(g.a+i,g.b+i,g.c+i),y.normal.copy(g.normal),r!==void 0&&y.normal.applyMatrix3(r).normalize();for(var b=0,T=_.length;b<T;b++)p=_[b].clone(),r!==void 0&&p.applyMatrix3(r).normalize(),y.vertexNormals.push(p);y.color.copy(g.color);for(var b=0,T=x.length;b<T;b++)v=x[b],y.vertexColors.push(v.clone());y.materialIndex=g.materialIndex+n,s.push(y)}for(var h=0,f=e.faceVertexUvs.length;h<f;h++){var C=e.faceVertexUvs[h];this.faceVertexUvs[h]===void 0&&(this.faceVertexUvs[h]=[]);for(var b=0,T=C.length;b<T;b++){for(var N=C[b],O=[],J=0,F=N.length;J<F;J++)O.push(N[J].clone());this.faceVertexUvs[h].push(O)}}},mergeMesh:function(e){if(!(e&&e.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)},mergeVertices:function(){var e={},t=[],n=[],r,i,a=4,o=Math.pow(10,a),s,c,l,u,h,f;for(s=0,c=this.vertices.length;s<c;s++)r=this.vertices[s],i=Math.round(r.x*o)+"_"+Math.round(r.y*o)+"_"+Math.round(r.z*o),e[i]===void 0?(e[i]=s,t.push(this.vertices[s]),n[s]=t.length-1):n[s]=n[e[i]];var d=[];for(s=0,c=this.faces.length;s<c;s++){l=this.faces[s],l.a=n[l.a],l.b=n[l.b],l.c=n[l.c],u=[l.a,l.b,l.c];for(var m=0;m<3;m++)if(u[m]===u[(m+1)%3]){d.push(s);break}}for(s=d.length-1;s>=0;s--){var g=d[s];for(this.faces.splice(g,1),h=0,f=this.faceVertexUvs.length;h<f;h++)this.faceVertexUvs[h].splice(g,1)}var y=this.vertices.length-t.length;return this.vertices=t,y},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];this.vertices.push(new E(r.x,r.y,r.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;function r(l,u){return l.materialIndex-u.materialIndex}e.sort(r);var i=this.faceVertexUvs[0],a=this.faceVertexUvs[1],o,s;i&&i.length===t&&(o=[]),a&&a.length===t&&(s=[]);for(var n=0;n<t;n++){var c=e[n]._id;o&&o.push(i[c]),s&&s.push(a[c])}o&&(this.faceVertexUvs[0]=o),s&&(this.faceVertexUvs[1]=s)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),this.parameters!==void 0){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}for(var r=[],i=0;i<this.vertices.length;i++){var a=this.vertices[i];r.push(a.x,a.y,a.z)}for(var o=[],s=[],c={},l=[],u={},h=[],f={},i=0;i<this.faces.length;i++){var d=this.faces[i],m=!0,g=!1,y=this.faceVertexUvs[0][i]!==void 0,p=d.normal.length()>0,v=d.vertexNormals.length>0,_=d.color.r!==1||d.color.g!==1||d.color.b!==1,x=d.vertexColors.length>0,b=0;if(b=O(b,0,0),b=O(b,1,m),b=O(b,2,g),b=O(b,3,y),b=O(b,4,p),b=O(b,5,v),b=O(b,6,_),b=O(b,7,x),o.push(b),o.push(d.a,d.b,d.c),o.push(d.materialIndex),y){var T=this.faceVertexUvs[0][i];o.push(B(T[0]),B(T[1]),B(T[2]))}if(p&&o.push(J(d.normal)),v){var C=d.vertexNormals;o.push(J(C[0]),J(C[1]),J(C[2]))}if(_&&o.push(F(d.color)),x){var N=d.vertexColors;o.push(F(N[0]),F(N[1]),F(N[2]))}}function O(V,Y,D){return D?V|1<<Y:V&~(1<<Y)}function J(V){var Y=V.x.toString()+V.y.toString()+V.z.toString();return c[Y]!==void 0||(c[Y]=s.length/3,s.push(V.x,V.y,V.z)),c[Y]}function F(V){var Y=V.r.toString()+V.g.toString()+V.b.toString();return u[Y]!==void 0||(u[Y]=l.length,l.push(V.getHex())),u[Y]}function B(V){var Y=V.x.toString()+V.y.toString();return f[Y]!==void 0||(f[Y]=h.length/2,h.push(V.x,V.y)),f[Y]}return e.data={},e.data.vertices=r,e.data.normals=s,l.length>0&&(e.data.colors=l),h.length>0&&(e.data.uvs=[h]),e.data.faces=o,e},clone:function(){return new Fe().copy(this)},copy:function(e){var t,n,r,i,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var c=e.colors;for(t=0,n=c.length;t<n;t++)this.colors.push(c[t].clone());var l=e.faces;for(t=0,n=l.length;t<n;t++)this.faces.push(l[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var u=e.faceVertexUvs[t];for(this.faceVertexUvs[t]===void 0&&(this.faceVertexUvs[t]=[]),r=0,i=u.length;r<i;r++){var h=u[r],f=[];for(a=0,o=h.length;a<o;a++){var d=h[a];f.push(d.clone())}this.faceVertexUvs[t].push(f)}}var m=e.morphTargets;for(t=0,n=m.length;t<n;t++){var g={};if(g.name=m[t].name,m[t].vertices!==void 0)for(g.vertices=[],r=0,i=m[t].vertices.length;r<i;r++)g.vertices.push(m[t].vertices[r].clone());if(m[t].normals!==void 0)for(g.normals=[],r=0,i=m[t].normals.length;r<i;r++)g.normals.push(m[t].normals[r].clone());this.morphTargets.push(g)}var y=e.morphNormals;for(t=0,n=y.length;t<n;t++){var p={};if(y[t].vertexNormals!==void 0)for(p.vertexNormals=[],r=0,i=y[t].vertexNormals.length;r<i;r++){var v=y[t].vertexNormals[r],_={};_.a=v.a.clone(),_.b=v.b.clone(),_.c=v.c.clone(),p.vertexNormals.push(_)}if(y[t].faceNormals!==void 0)for(p.faceNormals=[],r=0,i=y[t].faceNormals.length;r<i;r++)p.faceNormals.push(y[t].faceNormals[r].clone());this.morphNormals.push(p)}var x=e.skinWeights;for(t=0,n=x.length;t<n;t++)this.skinWeights.push(x[t].clone());var b=e.skinIndices;for(t=0,n=b.length;t<n;t++)this.skinIndices.push(b[t].clone());var T=e.lineDistances;for(t=0,n=T.length;t<n;t++)this.lineDistances.push(T[t]);var C=e.boundingBox;C!==null&&(this.boundingBox=C.clone());var N=e.boundingSphere;return N!==null&&(this.boundingSphere=N.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});class Lp extends Fe{constructor(t,n,r,i,a,o){super(),this.type="BoxGeometry",this.parameters={width:t,height:n,depth:r,widthSegments:i,heightSegments:a,depthSegments:o},this.fromBufferGeometry(new Cs(t,n,r,i,a,o)),this.mergeVertices()}}class Cs extends ge{constructor(t,n,r,i,a,o){super(),this.type="BoxBufferGeometry",this.parameters={width:t,height:n,depth:r,widthSegments:i,heightSegments:a,depthSegments:o};const s=this;t=t||1,n=n||1,r=r||1,i=Math.floor(i)||1,a=Math.floor(a)||1,o=Math.floor(o)||1;const c=[],l=[],u=[],h=[];let f=0,d=0;m("z","y","x",-1,-1,r,n,t,o,a,0),m("z","y","x",1,-1,r,n,-t,o,a,1),m("x","z","y",1,1,t,r,n,i,o,2),m("x","z","y",1,-1,t,r,-n,i,o,3),m("x","y","z",1,-1,t,n,r,i,a,4),m("x","y","z",-1,-1,t,n,-r,i,a,5),this.setIndex(c),this.setAttribute("position",new ce(l,3)),this.setAttribute("normal",new ce(u,3)),this.setAttribute("uv",new ce(h,2));function m(g,y,p,v,_,x,b,T,C,N,O){const J=x/C,F=b/N,B=x/2,V=b/2,Y=T/2,D=C+1,z=N+1;let k=0,q=0;const Z=new E;for(let ee=0;ee<z;ee++){const te=ee*F-V;for(let ae=0;ae<D;ae++){const Pe=ae*J-B;Z[g]=Pe*v,Z[y]=te*_,Z[p]=Y,l.push(Z.x,Z.y,Z.z),Z[g]=0,Z[y]=0,Z[p]=T>0?1:-1,u.push(Z.x,Z.y,Z.z),h.push(ae/C),h.push(1-ee/N),k+=1}}for(let ee=0;ee<N;ee++)for(let te=0;te<C;te++){const ae=f+te+D*ee,Pe=f+te+D*(ee+1),_e=f+(te+1)+D*(ee+1),re=f+(te+1)+D*ee;c.push(ae,Pe,re),c.push(Pe,_e,re),q+=6}s.addGroup(d,q,O),d+=q,f+=k}}}function pi(e){var t={};for(var n in e){t[n]={};for(var r in e[n]){var i=e[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture)?t[n][r]=i.clone():Array.isArray(i)?t[n][r]=i.slice():t[n][r]=i}}return t}function Dt(e){for(var t={},n=0;n<e.length;n++){var r=pi(e[n]);for(var i in r)t[i]=r[i]}return t}var Pp={clone:pi,merge:Dt},Cp=`void main() {
357
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
358
- }`,Rp=`void main() {
359
- gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
360
- }`;function Wt(e){Ie.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=Cp,this.fragmentShader=Rp,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,e!==void 0&&(e.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}Wt.prototype=Object.create(Ie.prototype);Wt.prototype.constructor=Wt;Wt.prototype.isShaderMaterial=!0;Wt.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=pi(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this};Wt.prototype.toJSON=function(e){var t=Ie.prototype.toJSON.call(this,e);t.uniforms={};for(var n in this.uniforms){var r=this.uniforms[n],i=r.value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var a={};for(var o in this.extensions)this.extensions[o]===!0&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t};function zn(){se.call(this),this.type="Camera",this.matrixWorldInverse=new We,this.projectionMatrix=new We,this.projectionMatrixInverse=new We}zn.prototype=Object.assign(Object.create(se.prototype),{constructor:zn,isCamera:!0,copy:function(e,t){return se.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){e===void 0&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new E),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){se.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){se.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return new this.constructor().copy(this)}});function St(e,t,n,r){zn.call(this),this.type="PerspectiveCamera",this.fov=e!==void 0?e:50,this.zoom=1,this.near=n!==void 0?n:.1,this.far=r!==void 0?r:2e3,this.focus=10,this.aspect=t!==void 0?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}St.prototype=Object.assign(Object.create(zn.prototype),{constructor:St,isPerspectiveCamera:!0,copy:function(e,t){return zn.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=ke.RAD2DEG*2*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(ke.DEG2RAD*.5*this.fov);return .5*this.getFilmHeight()/e},getEffectiveFOV:function(){return ke.RAD2DEG*2*Math.atan(Math.tan(ke.DEG2RAD*.5*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(ke.DEG2RAD*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;i+=a.offsetX*r/o,t-=a.offsetY*n/s,r*=a.width/o,n*=a.height/s}var c=this.filmOffset;c!==0&&(i+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=se.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});var Jr=90,Qr=1;function fa(e,t,n){if(se.call(this),this.type="CubeCamera",n.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=n;var r=new St(Jr,Qr,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new E(1,0,0)),this.add(r);var i=new St(Jr,Qr,e,t);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new E(-1,0,0)),this.add(i);var a=new St(Jr,Qr,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(new E(0,1,0)),this.add(a);var o=new St(Jr,Qr,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new E(0,-1,0)),this.add(o);var s=new St(Jr,Qr,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new E(0,0,1)),this.add(s);var c=new St(Jr,Qr,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new E(0,0,-1)),this.add(c),this.update=function(l,u){this.parent===null&&this.updateMatrixWorld();var h=l.xr.enabled,f=l.getRenderTarget();l.xr.enabled=!1;var d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,l.setRenderTarget(n,0),l.render(u,r),l.setRenderTarget(n,1),l.render(u,i),l.setRenderTarget(n,2),l.render(u,a),l.setRenderTarget(n,3),l.render(u,o),l.setRenderTarget(n,4),l.render(u,s),n.texture.generateMipmaps=d,l.setRenderTarget(n,5),l.render(u,c),l.setRenderTarget(f),l.xr.enabled=h},this.clear=function(l,u,h,f){for(var d=l.getRenderTarget(),m=0;m<6;m++)l.setRenderTarget(n,m),l.clear(u,h,f);l.setRenderTarget(d)}}fa.prototype=Object.create(se.prototype);fa.prototype.constructor=fa;function da(e,t,n){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=n),Kt.call(this,e,e,t)}da.prototype=Object.create(Kt.prototype);da.prototype.constructor=da;da.prototype.isWebGLCubeRenderTarget=!0;da.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new ca,r={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {"," return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {"," vWorldDirection = transformDirection( position, modelMatrix );"," #include <begin_vertex>"," #include <project_vertex>","}"].join(`
361
- `),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#include <common>","void main() {"," vec3 direction = normalize( vWorldDirection );"," vec2 sampleUV = equirectUv( direction );"," gl_FragColor = texture2D( tEquirect, sampleUV );","}"].join(`
362
- `)},i=new Wt({type:"CubemapFromEquirect",uniforms:pi(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Pt,blending:sr});i.uniforms.tEquirect.value=t;var a=new ft(new Cs(5,5,5),i);n.add(a);var o=new fa(1,10,this);return o.update(e,n),a.geometry.dispose(),a.material.dispose(),this};function vi(e,t,n,r,i,a,o,s,c,l,u,h){ot.call(this,null,a,o,s,c,l,r,i,u,h),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=c!==void 0?c:bt,this.minFilter=l!==void 0?l:bt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}vi.prototype=Object.create(ot.prototype);vi.prototype.constructor=vi;vi.prototype.isDataTexture=!0;var $r=new jn,lo=new E;function Xa(e,t,n,r,i,a){this.planes=[e!==void 0?e:new bn,t!==void 0?t:new bn,n!==void 0?n:new bn,r!==void 0?r:new bn,i!==void 0?i:new bn,a!==void 0?a:new bn]}Object.assign(Xa.prototype,{set:function(e,t,n,r,i,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],i=n[1],a=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],h=n[8],f=n[9],d=n[10],m=n[11],g=n[12],y=n[13],p=n[14],v=n[15];return t[0].setComponents(o-r,u-s,m-h,v-g).normalize(),t[1].setComponents(o+r,u+s,m+h,v+g).normalize(),t[2].setComponents(o+i,u+c,m+f,v+y).normalize(),t[3].setComponents(o-i,u-c,m-f,v-y).normalize(),t[4].setComponents(o-a,u-l,m-d,v-p).normalize(),t[5].setComponents(o+a,u+l,m+d,v+p).normalize(),this},intersectsObject:function(e){var t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),$r.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere($r)},intersectsSprite:function(e){return $r.center.set(0,0,0),$r.radius=.7071067811865476,$r.applyMatrix4(e.matrixWorld),this.intersectsSphere($r)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,i=0;i<6;i++){var a=t[i].distanceToPoint(n);if(a<r)return!1}return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(lo.x=r.normal.x>0?e.max.x:e.min.x,lo.y=r.normal.y>0?e.max.y:e.min.y,lo.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(lo)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var le={common:{diffuse:{value:new pe(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new zt},uv2Transform:{value:new zt},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 X(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 pe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new pe(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new zt}},sprite:{diffuse:{value:new pe(15658734)},opacity:{value:1},center:{value:new X(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new zt}}};function Bh(){var e=null,t=!1,n=null;function r(i,a){t!==!1&&(n(i,a),e.requestAnimationFrame(r))}return{start:function(){t!==!0&&n!==null&&(e.requestAnimationFrame(r),t=!0)},stop:function(){t=!1},setAnimationLoop:function(i){n=i},setContext:function(i){e=i}}}function Op(e,t){var n=t.isWebGL2,r=new WeakMap;function i(l,u){var h=l.array,f=l.usage,d=e.createBuffer();e.bindBuffer(u,d),e.bufferData(u,h,f),l.onUploadCallback();var m=5126;return h instanceof Float32Array?m=5126:h instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):h instanceof Uint16Array?m=5123:h instanceof Int16Array?m=5122:h instanceof Uint32Array?m=5125:h instanceof Int32Array?m=5124:h instanceof Int8Array?m=5120:h instanceof Uint8Array&&(m=5121),{buffer:d,type:m,bytesPerElement:h.BYTES_PER_ELEMENT,version:l.version}}function a(l,u,h){var f=u.array,d=u.updateRange;e.bindBuffer(h,l),d.count===-1?e.bufferSubData(h,0,f):(n?e.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f,d.offset,d.count):e.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f.subarray(d.offset,d.offset+d.count)),d.count=-1)}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),r.get(l)}function s(l){l.isInterleavedBufferAttribute&&(l=l.data);var u=r.get(l);u&&(e.deleteBuffer(u.buffer),r.delete(l))}function c(l,u){l.isInterleavedBufferAttribute&&(l=l.data);var h=r.get(l);h===void 0?r.set(l,i(l,u)):h.version<l.version&&(a(h.buffer,l,u),h.version=l.version)}return{get:o,remove:s,update:c}}function jo(e,t,n,r){Fe.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},this.fromBufferGeometry(new mi(e,t,n,r)),this.mergeVertices()}jo.prototype=Object.create(Fe.prototype);jo.prototype.constructor=jo;function mi(e,t,n,r){ge.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r},e=e||1,t=t||1;var i=e/2,a=t/2,o=Math.floor(n)||1,s=Math.floor(r)||1,c=o+1,l=s+1,u=e/o,h=t/s,f,d,m=[],g=[],y=[],p=[];for(d=0;d<l;d++){var v=d*h-a;for(f=0;f<c;f++){var _=f*u-i;g.push(_,-v,0),y.push(0,0,1),p.push(f/o),p.push(1-d/s)}}for(d=0;d<s;d++)for(f=0;f<o;f++){var x=f+c*d,b=f+c*(d+1),T=f+1+c*(d+1),C=f+1+c*d;m.push(x,b,C),m.push(b,T,C)}this.setIndex(m),this.setAttribute("position",new ce(g,3)),this.setAttribute("normal",new ce(y,3)),this.setAttribute("uv",new ce(p,2))}mi.prototype=Object.create(ge.prototype);mi.prototype.constructor=mi;var Dp=`#ifdef USE_ALPHAMAP
363
- diffuseColor.a *= texture2D( alphaMap, vUv ).g;
364
- #endif`,Ip=`#ifdef USE_ALPHAMAP
365
- uniform sampler2D alphaMap;
366
- #endif`,Np=`#ifdef ALPHATEST
367
- if ( diffuseColor.a < ALPHATEST ) discard;
368
- #endif`,Fp=`#ifdef USE_AOMAP
369
- float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
370
- reflectedLight.indirectDiffuse *= ambientOcclusion;
371
- #if defined( USE_ENVMAP ) && defined( STANDARD )
372
- float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
373
- reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );
374
- #endif
375
- #endif`,Bp=`#ifdef USE_AOMAP
376
- uniform sampler2D aoMap;
377
- uniform float aoMapIntensity;
378
- #endif`,Up="vec3 transformed = vec3( position );",zp=`vec3 objectNormal = vec3( normal );
379
- #ifdef USE_TANGENT
380
- vec3 objectTangent = vec3( tangent.xyz );
381
- #endif`,Gp=`vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {
382
- const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
383
- const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
384
- vec4 r = roughness * c0 + c1;
385
- float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
386
- return vec2( -1.04, 1.04 ) * a004 + r.zw;
387
- }
388
- float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
389
- #if defined ( PHYSICALLY_CORRECT_LIGHTS )
390
- float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
391
- if( cutoffDistance > 0.0 ) {
392
- distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
393
- }
394
- return distanceFalloff;
395
- #else
396
- if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
397
- return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );
398
- }
399
- return 1.0;
400
- #endif
401
- }
402
- vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {
403
- return RECIPROCAL_PI * diffuseColor;
404
- }
405
- vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {
406
- float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );
407
- return ( 1.0 - specularColor ) * fresnel + specularColor;
408
- }
409
- vec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {
410
- float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );
411
- vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;
412
- return Fr * fresnel + F0;
413
- }
414
- float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {
415
- float a2 = pow2( alpha );
416
- float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
417
- float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
418
- return 1.0 / ( gl * gv );
419
- }
420
- float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
421
- float a2 = pow2( alpha );
422
- float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
423
- float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
424
- return 0.5 / max( gv + gl, EPSILON );
425
- }
426
- float D_GGX( const in float alpha, const in float dotNH ) {
427
- float a2 = pow2( alpha );
428
- float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
429
- return RECIPROCAL_PI * a2 / pow2( denom );
430
- }
431
- vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
432
- float alpha = pow2( roughness );
433
- vec3 halfDir = normalize( incidentLight.direction + viewDir );
434
- float dotNL = saturate( dot( normal, incidentLight.direction ) );
435
- float dotNV = saturate( dot( normal, viewDir ) );
436
- float dotNH = saturate( dot( normal, halfDir ) );
437
- float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
438
- vec3 F = F_Schlick( specularColor, dotLH );
439
- float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );
440
- float D = D_GGX( alpha, dotNH );
441
- return F * ( G * D );
442
- }
443
- vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
444
- const float LUT_SIZE = 64.0;
445
- const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
446
- const float LUT_BIAS = 0.5 / LUT_SIZE;
447
- float dotNV = saturate( dot( N, V ) );
448
- vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
449
- uv = uv * LUT_SCALE + LUT_BIAS;
450
- return uv;
451
- }
452
- float LTC_ClippedSphereFormFactor( const in vec3 f ) {
453
- float l = length( f );
454
- return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
455
- }
456
- vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
457
- float x = dot( v1, v2 );
458
- float y = abs( x );
459
- float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
460
- float b = 3.4175940 + ( 4.1616724 + y ) * y;
461
- float v = a / b;
462
- float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
463
- return cross( v1, v2 ) * theta_sintheta;
464
- }
465
- vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
466
- vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
467
- vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
468
- vec3 lightNormal = cross( v1, v2 );
469
- if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
470
- vec3 T1, T2;
471
- T1 = normalize( V - N * dot( V, N ) );
472
- T2 = - cross( N, T1 );
473
- mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
474
- vec3 coords[ 4 ];
475
- coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
476
- coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
477
- coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
478
- coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
479
- coords[ 0 ] = normalize( coords[ 0 ] );
480
- coords[ 1 ] = normalize( coords[ 1 ] );
481
- coords[ 2 ] = normalize( coords[ 2 ] );
482
- coords[ 3 ] = normalize( coords[ 3 ] );
483
- vec3 vectorFormFactor = vec3( 0.0 );
484
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
485
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
486
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
487
- vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
488
- float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
489
- return vec3( result );
490
- }
491
- vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
492
- float dotNV = saturate( dot( normal, viewDir ) );
493
- vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
494
- return specularColor * brdf.x + brdf.y;
495
- }
496
- void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
497
- float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
498
- vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );
499
- vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
500
- vec3 FssEss = F * brdf.x + brdf.y;
501
- float Ess = brdf.x + brdf.y;
502
- float Ems = 1.0 - Ess;
503
- vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
504
- singleScatter += FssEss;
505
- multiScatter += Fms * Ems;
506
- }
507
- float G_BlinnPhong_Implicit( ) {
508
- return 0.25;
509
- }
510
- float D_BlinnPhong( const in float shininess, const in float dotNH ) {
511
- return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
512
- }
513
- vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {
514
- vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
515
- float dotNH = saturate( dot( geometry.normal, halfDir ) );
516
- float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
517
- vec3 F = F_Schlick( specularColor, dotLH );
518
- float G = G_BlinnPhong_Implicit( );
519
- float D = D_BlinnPhong( shininess, dotNH );
520
- return F * ( G * D );
521
- }
522
- float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {
523
- return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );
524
- }
525
- float BlinnExponentToGGXRoughness( const in float blinnExponent ) {
526
- return sqrt( 2.0 / ( blinnExponent + 2.0 ) );
527
- }
528
- #if defined( USE_SHEEN )
529
- float D_Charlie(float roughness, float NoH) {
530
- float invAlpha = 1.0 / roughness;
531
- float cos2h = NoH * NoH;
532
- float sin2h = max(1.0 - cos2h, 0.0078125); return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);
533
- }
534
- float V_Neubelt(float NoV, float NoL) {
535
- return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));
536
- }
537
- vec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {
538
- vec3 N = geometry.normal;
539
- vec3 V = geometry.viewDir;
540
- vec3 H = normalize( V + L );
541
- float dotNH = saturate( dot( N, H ) );
542
- return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );
543
- }
544
- #endif`,Hp=`#ifdef USE_BUMPMAP
545
- uniform sampler2D bumpMap;
546
- uniform float bumpScale;
547
- vec2 dHdxy_fwd() {
548
- vec2 dSTdx = dFdx( vUv );
549
- vec2 dSTdy = dFdy( vUv );
550
- float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
551
- float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
552
- float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
553
- return vec2( dBx, dBy );
554
- }
555
- vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {
556
- vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
557
- vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
558
- vec3 vN = surf_norm;
559
- vec3 R1 = cross( vSigmaY, vN );
560
- vec3 R2 = cross( vN, vSigmaX );
561
- float fDet = dot( vSigmaX, R1 );
562
- fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
563
- vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
564
- return normalize( abs( fDet ) * surf_norm - vGrad );
565
- }
566
- #endif`,Vp=`#if NUM_CLIPPING_PLANES > 0
567
- vec4 plane;
568
- #pragma unroll_loop_start
569
- for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
570
- plane = clippingPlanes[ i ];
571
- if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
572
- }
573
- #pragma unroll_loop_end
574
- #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
575
- bool clipped = true;
576
- #pragma unroll_loop_start
577
- for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
578
- plane = clippingPlanes[ i ];
579
- clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
580
- }
581
- #pragma unroll_loop_end
582
- if ( clipped ) discard;
583
- #endif
584
- #endif`,kp=`#if NUM_CLIPPING_PLANES > 0
585
- varying vec3 vClipPosition;
586
- uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
587
- #endif`,Wp=`#if NUM_CLIPPING_PLANES > 0
588
- varying vec3 vClipPosition;
589
- #endif`,Xp=`#if NUM_CLIPPING_PLANES > 0
590
- vClipPosition = - mvPosition.xyz;
591
- #endif`,jp=`#ifdef USE_COLOR
592
- diffuseColor.rgb *= vColor;
593
- #endif`,qp=`#ifdef USE_COLOR
594
- varying vec3 vColor;
595
- #endif`,Yp=`#ifdef USE_COLOR
596
- varying vec3 vColor;
597
- #endif`,Zp=`#ifdef USE_COLOR
598
- vColor.xyz = color.xyz;
599
- #endif`,Jp=`#define PI 3.14159265359
600
- #define PI2 6.28318530718
601
- #define PI_HALF 1.5707963267949
602
- #define RECIPROCAL_PI 0.31830988618
603
- #define RECIPROCAL_PI2 0.15915494
604
- #define LOG2 1.442695
605
- #define EPSILON 1e-6
606
- #ifndef saturate
607
- #define saturate(a) clamp( a, 0.0, 1.0 )
608
- #endif
609
- #define whiteComplement(a) ( 1.0 - saturate( a ) )
610
- float pow2( const in float x ) { return x*x; }
611
- float pow3( const in float x ) { return x*x*x; }
612
- float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
613
- float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
614
- highp float rand( const in vec2 uv ) {
615
- const highp float a = 12.9898, b = 78.233, c = 43758.5453;
616
- highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
617
- return fract(sin(sn) * c);
618
- }
619
- #ifdef HIGH_PRECISION
620
- float precisionSafeLength( vec3 v ) { return length( v ); }
621
- #else
622
- float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }
623
- float precisionSafeLength( vec3 v ) {
624
- float maxComponent = max3( abs( v ) );
625
- return length( v / maxComponent ) * maxComponent;
626
- }
627
- #endif
628
- struct IncidentLight {
629
- vec3 color;
630
- vec3 direction;
631
- bool visible;
632
- };
633
- struct ReflectedLight {
634
- vec3 directDiffuse;
635
- vec3 directSpecular;
636
- vec3 indirectDiffuse;
637
- vec3 indirectSpecular;
638
- };
639
- struct GeometricContext {
640
- vec3 position;
641
- vec3 normal;
642
- vec3 viewDir;
643
- #ifdef CLEARCOAT
644
- vec3 clearcoatNormal;
645
- #endif
646
- };
647
- vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
648
- return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
649
- }
650
- vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
651
- return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
652
- }
653
- vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
654
- float distance = dot( planeNormal, point - pointOnPlane );
655
- return - distance * planeNormal + point;
656
- }
657
- float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
658
- return sign( dot( point - pointOnPlane, planeNormal ) );
659
- }
660
- vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
661
- return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
662
- }
663
- mat3 transposeMat3( const in mat3 m ) {
664
- mat3 tmp;
665
- tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
666
- tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
667
- tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
668
- return tmp;
669
- }
670
- float linearToRelativeLuminance( const in vec3 color ) {
671
- vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
672
- return dot( weights, color.rgb );
673
- }
674
- bool isPerspectiveMatrix( mat4 m ) {
675
- return m[ 2 ][ 3 ] == - 1.0;
676
- }
677
- vec2 equirectUv( in vec3 dir ) {
678
- float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
679
- float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
680
- return vec2( u, v );
681
- }`,Qp=`#ifdef ENVMAP_TYPE_CUBE_UV
682
- #define cubeUV_maxMipLevel 8.0
683
- #define cubeUV_minMipLevel 4.0
684
- #define cubeUV_maxTileSize 256.0
685
- #define cubeUV_minTileSize 16.0
686
- float getFace(vec3 direction) {
687
- vec3 absDirection = abs(direction);
688
- float face = -1.0;
689
- if (absDirection.x > absDirection.z) {
690
- if (absDirection.x > absDirection.y)
691
- face = direction.x > 0.0 ? 0.0 : 3.0;
692
- else
693
- face = direction.y > 0.0 ? 1.0 : 4.0;
694
- } else {
695
- if (absDirection.z > absDirection.y)
696
- face = direction.z > 0.0 ? 2.0 : 5.0;
697
- else
698
- face = direction.y > 0.0 ? 1.0 : 4.0;
699
- }
700
- return face;
701
- }
702
- vec2 getUV(vec3 direction, float face) {
703
- vec2 uv;
704
- if (face == 0.0) {
705
- uv = vec2(direction.z, direction.y) / abs(direction.x); } else if (face == 1.0) {
706
- uv = vec2(-direction.x, -direction.z) / abs(direction.y); } else if (face == 2.0) {
707
- uv = vec2(-direction.x, direction.y) / abs(direction.z); } else if (face == 3.0) {
708
- uv = vec2(-direction.z, direction.y) / abs(direction.x); } else if (face == 4.0) {
709
- uv = vec2(-direction.x, direction.z) / abs(direction.y); } else {
710
- uv = vec2(direction.x, direction.y) / abs(direction.z); }
711
- return 0.5 * (uv + 1.0);
712
- }
713
- vec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {
714
- float face = getFace(direction);
715
- float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);
716
- mipInt = max(mipInt, cubeUV_minMipLevel);
717
- float faceSize = exp2(mipInt);
718
- float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);
719
- vec2 uv = getUV(direction, face) * (faceSize - 1.0);
720
- vec2 f = fract(uv);
721
- uv += 0.5 - f;
722
- if (face > 2.0) {
723
- uv.y += faceSize;
724
- face -= 3.0;
725
- }
726
- uv.x += face * faceSize;
727
- if(mipInt < cubeUV_maxMipLevel){
728
- uv.y += 2.0 * cubeUV_maxTileSize;
729
- }
730
- uv.y += filterInt * 2.0 * cubeUV_minTileSize;
731
- uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);
732
- uv *= texelSize;
733
- vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
734
- uv.x += texelSize;
735
- vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
736
- uv.y += texelSize;
737
- vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
738
- uv.x -= texelSize;
739
- vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
740
- vec3 tm = mix(tl, tr, f.x);
741
- vec3 bm = mix(bl, br, f.x);
742
- return mix(tm, bm, f.y);
743
- }
744
- #define r0 1.0
745
- #define v0 0.339
746
- #define m0 -2.0
747
- #define r1 0.8
748
- #define v1 0.276
749
- #define m1 -1.0
750
- #define r4 0.4
751
- #define v4 0.046
752
- #define m4 2.0
753
- #define r5 0.305
754
- #define v5 0.016
755
- #define m5 3.0
756
- #define r6 0.21
757
- #define v6 0.0038
758
- #define m6 4.0
759
- float roughnessToMip(float roughness) {
760
- float mip = 0.0;
761
- if (roughness >= r1) {
762
- mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;
763
- } else if (roughness >= r4) {
764
- mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;
765
- } else if (roughness >= r5) {
766
- mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;
767
- } else if (roughness >= r6) {
768
- mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;
769
- } else {
770
- mip = -2.0 * log2(1.16 * roughness); }
771
- return mip;
772
- }
773
- vec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {
774
- float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);
775
- float mipF = fract(mip);
776
- float mipInt = floor(mip);
777
- vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);
778
- if (mipF == 0.0) {
779
- return vec4(color0, 1.0);
780
- } else {
781
- vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);
782
- return vec4(mix(color0, color1, mipF), 1.0);
783
- }
784
- }
785
- #endif`,$p=`vec3 transformedNormal = objectNormal;
786
- #ifdef USE_INSTANCING
787
- mat3 m = mat3( instanceMatrix );
788
- transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
789
- transformedNormal = m * transformedNormal;
790
- #endif
791
- transformedNormal = normalMatrix * transformedNormal;
792
- #ifdef FLIP_SIDED
793
- transformedNormal = - transformedNormal;
794
- #endif
795
- #ifdef USE_TANGENT
796
- vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
797
- #ifdef FLIP_SIDED
798
- transformedTangent = - transformedTangent;
799
- #endif
800
- #endif`,Kp=`#ifdef USE_DISPLACEMENTMAP
801
- uniform sampler2D displacementMap;
802
- uniform float displacementScale;
803
- uniform float displacementBias;
804
- #endif`,ev=`#ifdef USE_DISPLACEMENTMAP
805
- transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
806
- #endif`,tv=`#ifdef USE_EMISSIVEMAP
807
- vec4 emissiveColor = texture2D( emissiveMap, vUv );
808
- emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
809
- totalEmissiveRadiance *= emissiveColor.rgb;
810
- #endif`,nv=`#ifdef USE_EMISSIVEMAP
811
- uniform sampler2D emissiveMap;
812
- #endif`,rv="gl_FragColor = linearToOutputTexel( gl_FragColor );",iv=`
813
- vec4 LinearToLinear( in vec4 value ) {
814
- return value;
815
- }
816
- vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
817
- return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );
818
- }
819
- vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
820
- return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );
821
- }
822
- vec4 sRGBToLinear( in vec4 value ) {
823
- return 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 );
824
- }
825
- vec4 LinearTosRGB( in vec4 value ) {
826
- return 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 );
827
- }
828
- vec4 RGBEToLinear( in vec4 value ) {
829
- return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
830
- }
831
- vec4 LinearToRGBE( in vec4 value ) {
832
- float maxComponent = max( max( value.r, value.g ), value.b );
833
- float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
834
- return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
835
- }
836
- vec4 RGBMToLinear( in vec4 value, in float maxRange ) {
837
- return vec4( value.rgb * value.a * maxRange, 1.0 );
838
- }
839
- vec4 LinearToRGBM( in vec4 value, in float maxRange ) {
840
- float maxRGB = max( value.r, max( value.g, value.b ) );
841
- float M = clamp( maxRGB / maxRange, 0.0, 1.0 );
842
- M = ceil( M * 255.0 ) / 255.0;
843
- return vec4( value.rgb / ( M * maxRange ), M );
844
- }
845
- vec4 RGBDToLinear( in vec4 value, in float maxRange ) {
846
- return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );
847
- }
848
- vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
849
- float maxRGB = max( value.r, max( value.g, value.b ) );
850
- float D = max( maxRange / maxRGB, 1.0 );
851
- D = clamp( floor( D ) / 255.0, 0.0, 1.0 );
852
- return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
853
- }
854
- const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
855
- vec4 LinearToLogLuv( in vec4 value ) {
856
- vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
857
- Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
858
- vec4 vResult;
859
- vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
860
- float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
861
- vResult.w = fract( Le );
862
- vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;
863
- return vResult;
864
- }
865
- const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
866
- vec4 LogLuvToLinear( in vec4 value ) {
867
- float Le = value.z * 255.0 + value.w;
868
- vec3 Xp_Y_XYZp;
869
- Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );
870
- Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
871
- Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
872
- vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
873
- return vec4( max( vRGB, 0.0 ), 1.0 );
874
- }`,av=`#ifdef USE_ENVMAP
875
- #ifdef ENV_WORLDPOS
876
- vec3 cameraToFrag;
877
-
878
- if ( isOrthographic ) {
879
- cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
880
- } else {
881
- cameraToFrag = normalize( vWorldPosition - cameraPosition );
882
- }
883
- vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
884
- #ifdef ENVMAP_MODE_REFLECTION
885
- vec3 reflectVec = reflect( cameraToFrag, worldNormal );
886
- #else
887
- vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
888
- #endif
889
- #else
890
- vec3 reflectVec = vReflect;
891
- #endif
892
- #ifdef ENVMAP_TYPE_CUBE
893
- vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
894
- #elif defined( ENVMAP_TYPE_CUBE_UV )
895
- vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
896
- #elif defined( ENVMAP_TYPE_EQUIREC )
897
- reflectVec = normalize( reflectVec );
898
- vec2 sampleUV = equirectUv( reflectVec );
899
- vec4 envColor = texture2D( envMap, sampleUV );
900
- #elif defined( ENVMAP_TYPE_SPHERE )
901
- reflectVec = normalize( reflectVec );
902
- vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );
903
- vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );
904
- #else
905
- vec4 envColor = vec4( 0.0 );
906
- #endif
907
- #ifndef ENVMAP_TYPE_CUBE_UV
908
- envColor = envMapTexelToLinear( envColor );
909
- #endif
910
- #ifdef ENVMAP_BLENDING_MULTIPLY
911
- outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
912
- #elif defined( ENVMAP_BLENDING_MIX )
913
- outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
914
- #elif defined( ENVMAP_BLENDING_ADD )
915
- outgoingLight += envColor.xyz * specularStrength * reflectivity;
916
- #endif
917
- #endif`,ov=`#ifdef USE_ENVMAP
918
- uniform float envMapIntensity;
919
- uniform float flipEnvMap;
920
- uniform int maxMipLevel;
921
- #ifdef ENVMAP_TYPE_CUBE
922
- uniform samplerCube envMap;
923
- #else
924
- uniform sampler2D envMap;
925
- #endif
926
-
927
- #endif`,sv=`#ifdef USE_ENVMAP
928
- uniform float reflectivity;
929
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
930
- #define ENV_WORLDPOS
931
- #endif
932
- #ifdef ENV_WORLDPOS
933
- varying vec3 vWorldPosition;
934
- uniform float refractionRatio;
935
- #else
936
- varying vec3 vReflect;
937
- #endif
938
- #endif`,lv=`#ifdef USE_ENVMAP
939
- #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
940
- #define ENV_WORLDPOS
941
- #endif
942
- #ifdef ENV_WORLDPOS
943
-
944
- varying vec3 vWorldPosition;
945
- #else
946
- varying vec3 vReflect;
947
- uniform float refractionRatio;
948
- #endif
949
- #endif`,cv=`#ifdef USE_ENVMAP
950
- #ifdef ENV_WORLDPOS
951
- vWorldPosition = worldPosition.xyz;
952
- #else
953
- vec3 cameraToVertex;
954
- if ( isOrthographic ) {
955
- cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
956
- } else {
957
- cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
958
- }
959
- vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
960
- #ifdef ENVMAP_MODE_REFLECTION
961
- vReflect = reflect( cameraToVertex, worldNormal );
962
- #else
963
- vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
964
- #endif
965
- #endif
966
- #endif`,uv=`#ifdef USE_FOG
967
- fogDepth = -mvPosition.z;
968
- #endif`,hv=`#ifdef USE_FOG
969
- varying float fogDepth;
970
- #endif`,fv=`#ifdef USE_FOG
971
- #ifdef FOG_EXP2
972
- float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );
973
- #else
974
- float fogFactor = smoothstep( fogNear, fogFar, fogDepth );
975
- #endif
976
- gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
977
- #endif`,dv=`#ifdef USE_FOG
978
- uniform vec3 fogColor;
979
- varying float fogDepth;
980
- #ifdef FOG_EXP2
981
- uniform float fogDensity;
982
- #else
983
- uniform float fogNear;
984
- uniform float fogFar;
985
- #endif
986
- #endif`,pv=`#ifdef USE_GRADIENTMAP
987
- uniform sampler2D gradientMap;
988
- #endif
989
- vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
990
- float dotNL = dot( normal, lightDirection );
991
- vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
992
- #ifdef USE_GRADIENTMAP
993
- return texture2D( gradientMap, coord ).rgb;
994
- #else
995
- return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
996
- #endif
997
- }`,vv=`#ifdef USE_LIGHTMAP
998
- vec4 lightMapTexel= texture2D( lightMap, vUv2 );
999
- reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
1000
- #endif`,mv=`#ifdef USE_LIGHTMAP
1001
- uniform sampler2D lightMap;
1002
- uniform float lightMapIntensity;
1003
- #endif`,gv=`vec3 diffuse = vec3( 1.0 );
1004
- GeometricContext geometry;
1005
- geometry.position = mvPosition.xyz;
1006
- geometry.normal = normalize( transformedNormal );
1007
- geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
1008
- GeometricContext backGeometry;
1009
- backGeometry.position = geometry.position;
1010
- backGeometry.normal = -geometry.normal;
1011
- backGeometry.viewDir = geometry.viewDir;
1012
- vLightFront = vec3( 0.0 );
1013
- vIndirectFront = vec3( 0.0 );
1014
- #ifdef DOUBLE_SIDED
1015
- vLightBack = vec3( 0.0 );
1016
- vIndirectBack = vec3( 0.0 );
1017
- #endif
1018
- IncidentLight directLight;
1019
- float dotNL;
1020
- vec3 directLightColor_Diffuse;
1021
- vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
1022
- vIndirectFront += getLightProbeIrradiance( lightProbe, geometry );
1023
- #ifdef DOUBLE_SIDED
1024
- vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
1025
- vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );
1026
- #endif
1027
- #if NUM_POINT_LIGHTS > 0
1028
- #pragma unroll_loop_start
1029
- for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1030
- getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );
1031
- dotNL = dot( geometry.normal, directLight.direction );
1032
- directLightColor_Diffuse = PI * directLight.color;
1033
- vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
1034
- #ifdef DOUBLE_SIDED
1035
- vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
1036
- #endif
1037
- }
1038
- #pragma unroll_loop_end
1039
- #endif
1040
- #if NUM_SPOT_LIGHTS > 0
1041
- #pragma unroll_loop_start
1042
- for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1043
- getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );
1044
- dotNL = dot( geometry.normal, directLight.direction );
1045
- directLightColor_Diffuse = PI * directLight.color;
1046
- vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
1047
- #ifdef DOUBLE_SIDED
1048
- vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
1049
- #endif
1050
- }
1051
- #pragma unroll_loop_end
1052
- #endif
1053
- #if NUM_DIR_LIGHTS > 0
1054
- #pragma unroll_loop_start
1055
- for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1056
- getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );
1057
- dotNL = dot( geometry.normal, directLight.direction );
1058
- directLightColor_Diffuse = PI * directLight.color;
1059
- vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
1060
- #ifdef DOUBLE_SIDED
1061
- vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
1062
- #endif
1063
- }
1064
- #pragma unroll_loop_end
1065
- #endif
1066
- #if NUM_HEMI_LIGHTS > 0
1067
- #pragma unroll_loop_start
1068
- for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1069
- vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
1070
- #ifdef DOUBLE_SIDED
1071
- vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
1072
- #endif
1073
- }
1074
- #pragma unroll_loop_end
1075
- #endif`,yv=`uniform bool receiveShadow;
1076
- uniform vec3 ambientLightColor;
1077
- uniform vec3 lightProbe[ 9 ];
1078
- vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
1079
- float x = normal.x, y = normal.y, z = normal.z;
1080
- vec3 result = shCoefficients[ 0 ] * 0.886227;
1081
- result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
1082
- result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
1083
- result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
1084
- result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
1085
- result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
1086
- result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
1087
- result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
1088
- result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
1089
- return result;
1090
- }
1091
- vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {
1092
- vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
1093
- vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
1094
- return irradiance;
1095
- }
1096
- vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
1097
- vec3 irradiance = ambientLightColor;
1098
- #ifndef PHYSICALLY_CORRECT_LIGHTS
1099
- irradiance *= PI;
1100
- #endif
1101
- return irradiance;
1102
- }
1103
- #if NUM_DIR_LIGHTS > 0
1104
- struct DirectionalLight {
1105
- vec3 direction;
1106
- vec3 color;
1107
- };
1108
- uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
1109
- #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1110
- struct DirectionalLightShadow {
1111
- float shadowBias;
1112
- float shadowRadius;
1113
- vec2 shadowMapSize;
1114
- };
1115
- uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1116
- #endif
1117
- void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {
1118
- directLight.color = directionalLight.color;
1119
- directLight.direction = directionalLight.direction;
1120
- directLight.visible = true;
1121
- }
1122
- #endif
1123
- #if NUM_POINT_LIGHTS > 0
1124
- struct PointLight {
1125
- vec3 position;
1126
- vec3 color;
1127
- float distance;
1128
- float decay;
1129
- };
1130
- uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
1131
- #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1132
- struct PointLightShadow {
1133
- float shadowBias;
1134
- float shadowRadius;
1135
- vec2 shadowMapSize;
1136
- float shadowCameraNear;
1137
- float shadowCameraFar;
1138
- };
1139
- uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1140
- #endif
1141
- void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {
1142
- vec3 lVector = pointLight.position - geometry.position;
1143
- directLight.direction = normalize( lVector );
1144
- float lightDistance = length( lVector );
1145
- directLight.color = pointLight.color;
1146
- directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );
1147
- directLight.visible = ( directLight.color != vec3( 0.0 ) );
1148
- }
1149
- #endif
1150
- #if NUM_SPOT_LIGHTS > 0
1151
- struct SpotLight {
1152
- vec3 position;
1153
- vec3 direction;
1154
- vec3 color;
1155
- float distance;
1156
- float decay;
1157
- float coneCos;
1158
- float penumbraCos;
1159
- };
1160
- uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
1161
- #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1162
- struct SpotLightShadow {
1163
- float shadowBias;
1164
- float shadowRadius;
1165
- vec2 shadowMapSize;
1166
- };
1167
- uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1168
- #endif
1169
- void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {
1170
- vec3 lVector = spotLight.position - geometry.position;
1171
- directLight.direction = normalize( lVector );
1172
- float lightDistance = length( lVector );
1173
- float angleCos = dot( directLight.direction, spotLight.direction );
1174
- if ( angleCos > spotLight.coneCos ) {
1175
- float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );
1176
- directLight.color = spotLight.color;
1177
- directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );
1178
- directLight.visible = true;
1179
- } else {
1180
- directLight.color = vec3( 0.0 );
1181
- directLight.visible = false;
1182
- }
1183
- }
1184
- #endif
1185
- #if NUM_RECT_AREA_LIGHTS > 0
1186
- struct RectAreaLight {
1187
- vec3 color;
1188
- vec3 position;
1189
- vec3 halfWidth;
1190
- vec3 halfHeight;
1191
- };
1192
- uniform sampler2D ltc_1; uniform sampler2D ltc_2;
1193
- uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
1194
- #endif
1195
- #if NUM_HEMI_LIGHTS > 0
1196
- struct HemisphereLight {
1197
- vec3 direction;
1198
- vec3 skyColor;
1199
- vec3 groundColor;
1200
- };
1201
- uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
1202
- vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {
1203
- float dotNL = dot( geometry.normal, hemiLight.direction );
1204
- float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
1205
- vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
1206
- #ifndef PHYSICALLY_CORRECT_LIGHTS
1207
- irradiance *= PI;
1208
- #endif
1209
- return irradiance;
1210
- }
1211
- #endif`,xv=`#if defined( USE_ENVMAP )
1212
- #ifdef ENVMAP_MODE_REFRACTION
1213
- uniform float refractionRatio;
1214
- #endif
1215
- vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {
1216
- vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
1217
- #ifdef ENVMAP_TYPE_CUBE
1218
- vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
1219
- #ifdef TEXTURE_LOD_EXT
1220
- vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );
1221
- #else
1222
- vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );
1223
- #endif
1224
- envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
1225
- #elif defined( ENVMAP_TYPE_CUBE_UV )
1226
- vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
1227
- #else
1228
- vec4 envMapColor = vec4( 0.0 );
1229
- #endif
1230
- return PI * envMapColor.rgb * envMapIntensity;
1231
- }
1232
- float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {
1233
- float maxMIPLevelScalar = float( maxMIPLevel );
1234
- float sigma = PI * roughness * roughness / ( 1.0 + roughness );
1235
- float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );
1236
- return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );
1237
- }
1238
- vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {
1239
- #ifdef ENVMAP_MODE_REFLECTION
1240
- vec3 reflectVec = reflect( -viewDir, normal );
1241
- reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
1242
- #else
1243
- vec3 reflectVec = refract( -viewDir, normal, refractionRatio );
1244
- #endif
1245
- reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
1246
- float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );
1247
- #ifdef ENVMAP_TYPE_CUBE
1248
- vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
1249
- #ifdef TEXTURE_LOD_EXT
1250
- vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );
1251
- #else
1252
- vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );
1253
- #endif
1254
- envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
1255
- #elif defined( ENVMAP_TYPE_CUBE_UV )
1256
- vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
1257
- #elif defined( ENVMAP_TYPE_EQUIREC )
1258
- vec2 sampleUV = equirectUv( reflectVec );
1259
- #ifdef TEXTURE_LOD_EXT
1260
- vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );
1261
- #else
1262
- vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );
1263
- #endif
1264
- envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
1265
- #elif defined( ENVMAP_TYPE_SPHERE )
1266
- vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );
1267
- #ifdef TEXTURE_LOD_EXT
1268
- vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
1269
- #else
1270
- vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
1271
- #endif
1272
- envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
1273
- #endif
1274
- return envMapColor.rgb * envMapIntensity;
1275
- }
1276
- #endif`,_v=`ToonMaterial material;
1277
- material.diffuseColor = diffuseColor.rgb;
1278
- material.specularColor = specular;
1279
- material.specularShininess = shininess;
1280
- material.specularStrength = specularStrength;`,bv=`varying vec3 vViewPosition;
1281
- #ifndef FLAT_SHADED
1282
- varying vec3 vNormal;
1283
- #endif
1284
- struct ToonMaterial {
1285
- vec3 diffuseColor;
1286
- vec3 specularColor;
1287
- float specularShininess;
1288
- float specularStrength;
1289
- };
1290
- void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
1291
- vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
1292
- #ifndef PHYSICALLY_CORRECT_LIGHTS
1293
- irradiance *= PI;
1294
- #endif
1295
- reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
1296
- reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
1297
- }
1298
- void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
1299
- reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
1300
- }
1301
- #define RE_Direct RE_Direct_Toon
1302
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
1303
- #define Material_LightProbeLOD( material ) (0)`,wv=`BlinnPhongMaterial material;
1304
- material.diffuseColor = diffuseColor.rgb;
1305
- material.specularColor = specular;
1306
- material.specularShininess = shininess;
1307
- material.specularStrength = specularStrength;`,Mv=`varying vec3 vViewPosition;
1308
- #ifndef FLAT_SHADED
1309
- varying vec3 vNormal;
1310
- #endif
1311
- struct BlinnPhongMaterial {
1312
- vec3 diffuseColor;
1313
- vec3 specularColor;
1314
- float specularShininess;
1315
- float specularStrength;
1316
- };
1317
- void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
1318
- float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
1319
- vec3 irradiance = dotNL * directLight.color;
1320
- #ifndef PHYSICALLY_CORRECT_LIGHTS
1321
- irradiance *= PI;
1322
- #endif
1323
- reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
1324
- reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
1325
- }
1326
- void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
1327
- reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
1328
- }
1329
- #define RE_Direct RE_Direct_BlinnPhong
1330
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
1331
- #define Material_LightProbeLOD( material ) (0)`,Ev=`PhysicalMaterial material;
1332
- material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
1333
- vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
1334
- float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
1335
- material.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;
1336
- material.specularRoughness = min( material.specularRoughness, 1.0 );
1337
- #ifdef REFLECTIVITY
1338
- material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );
1339
- #else
1340
- material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );
1341
- #endif
1342
- #ifdef CLEARCOAT
1343
- material.clearcoat = clearcoat;
1344
- material.clearcoatRoughness = clearcoatRoughness;
1345
- #ifdef USE_CLEARCOATMAP
1346
- material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
1347
- #endif
1348
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1349
- material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
1350
- #endif
1351
- material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
1352
- material.clearcoatRoughness += geometryRoughness;
1353
- material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
1354
- #endif
1355
- #ifdef USE_SHEEN
1356
- material.sheenColor = sheen;
1357
- #endif`,Tv=`struct PhysicalMaterial {
1358
- vec3 diffuseColor;
1359
- float specularRoughness;
1360
- vec3 specularColor;
1361
- #ifdef CLEARCOAT
1362
- float clearcoat;
1363
- float clearcoatRoughness;
1364
- #endif
1365
- #ifdef USE_SHEEN
1366
- vec3 sheenColor;
1367
- #endif
1368
- };
1369
- #define MAXIMUM_SPECULAR_COEFFICIENT 0.16
1370
- #define DEFAULT_SPECULAR_COEFFICIENT 0.04
1371
- float clearcoatDHRApprox( const in float roughness, const in float dotNL ) {
1372
- return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );
1373
- }
1374
- #if NUM_RECT_AREA_LIGHTS > 0
1375
- void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1376
- vec3 normal = geometry.normal;
1377
- vec3 viewDir = geometry.viewDir;
1378
- vec3 position = geometry.position;
1379
- vec3 lightPos = rectAreaLight.position;
1380
- vec3 halfWidth = rectAreaLight.halfWidth;
1381
- vec3 halfHeight = rectAreaLight.halfHeight;
1382
- vec3 lightColor = rectAreaLight.color;
1383
- float roughness = material.specularRoughness;
1384
- vec3 rectCoords[ 4 ];
1385
- rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1386
- rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1387
- rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1388
- vec2 uv = LTC_Uv( normal, viewDir, roughness );
1389
- vec4 t1 = texture2D( ltc_1, uv );
1390
- vec4 t2 = texture2D( ltc_2, uv );
1391
- mat3 mInv = mat3(
1392
- vec3( t1.x, 0, t1.y ),
1393
- vec3( 0, 1, 0 ),
1394
- vec3( t1.z, 0, t1.w )
1395
- );
1396
- vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1397
- reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1398
- reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1399
- }
1400
- #endif
1401
- void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1402
- float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
1403
- vec3 irradiance = dotNL * directLight.color;
1404
- #ifndef PHYSICALLY_CORRECT_LIGHTS
1405
- irradiance *= PI;
1406
- #endif
1407
- #ifdef CLEARCOAT
1408
- float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
1409
- vec3 ccIrradiance = ccDotNL * directLight.color;
1410
- #ifndef PHYSICALLY_CORRECT_LIGHTS
1411
- ccIrradiance *= PI;
1412
- #endif
1413
- float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
1414
- reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
1415
- #else
1416
- float clearcoatDHR = 0.0;
1417
- #endif
1418
- #ifdef USE_SHEEN
1419
- reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(
1420
- material.specularRoughness,
1421
- directLight.direction,
1422
- geometry,
1423
- material.sheenColor
1424
- );
1425
- #else
1426
- reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);
1427
- #endif
1428
- reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
1429
- }
1430
- void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1431
- reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
1432
- }
1433
- void 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) {
1434
- #ifdef CLEARCOAT
1435
- float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
1436
- reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
1437
- float ccDotNL = ccDotNV;
1438
- float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
1439
- #else
1440
- float clearcoatDHR = 0.0;
1441
- #endif
1442
- float clearcoatInv = 1.0 - clearcoatDHR;
1443
- vec3 singleScattering = vec3( 0.0 );
1444
- vec3 multiScattering = vec3( 0.0 );
1445
- vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1446
- BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );
1447
- vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );
1448
- reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;
1449
- reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1450
- reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1451
- }
1452
- #define RE_Direct RE_Direct_Physical
1453
- #define RE_Direct_RectArea RE_Direct_RectArea_Physical
1454
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
1455
- #define RE_IndirectSpecular RE_IndirectSpecular_Physical
1456
- float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1457
- return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1458
- }`,Sv=`
1459
- GeometricContext geometry;
1460
- geometry.position = - vViewPosition;
1461
- geometry.normal = normal;
1462
- geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1463
- #ifdef CLEARCOAT
1464
- geometry.clearcoatNormal = clearcoatNormal;
1465
- #endif
1466
- IncidentLight directLight;
1467
- #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1468
- PointLight pointLight;
1469
- #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1470
- PointLightShadow pointLightShadow;
1471
- #endif
1472
- #pragma unroll_loop_start
1473
- for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1474
- pointLight = pointLights[ i ];
1475
- getPointDirectLightIrradiance( pointLight, geometry, directLight );
1476
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1477
- pointLightShadow = pointLightShadows[ i ];
1478
- directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1479
- #endif
1480
- RE_Direct( directLight, geometry, material, reflectedLight );
1481
- }
1482
- #pragma unroll_loop_end
1483
- #endif
1484
- #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1485
- SpotLight spotLight;
1486
- #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1487
- SpotLightShadow spotLightShadow;
1488
- #endif
1489
- #pragma unroll_loop_start
1490
- for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1491
- spotLight = spotLights[ i ];
1492
- getSpotDirectLightIrradiance( spotLight, geometry, directLight );
1493
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1494
- spotLightShadow = spotLightShadows[ i ];
1495
- directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
1496
- #endif
1497
- RE_Direct( directLight, geometry, material, reflectedLight );
1498
- }
1499
- #pragma unroll_loop_end
1500
- #endif
1501
- #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1502
- DirectionalLight directionalLight;
1503
- #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1504
- DirectionalLightShadow directionalLightShadow;
1505
- #endif
1506
- #pragma unroll_loop_start
1507
- for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1508
- directionalLight = directionalLights[ i ];
1509
- getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
1510
- #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1511
- directionalLightShadow = directionalLightShadows[ i ];
1512
- directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1513
- #endif
1514
- RE_Direct( directLight, geometry, material, reflectedLight );
1515
- }
1516
- #pragma unroll_loop_end
1517
- #endif
1518
- #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1519
- RectAreaLight rectAreaLight;
1520
- #pragma unroll_loop_start
1521
- for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1522
- rectAreaLight = rectAreaLights[ i ];
1523
- RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
1524
- }
1525
- #pragma unroll_loop_end
1526
- #endif
1527
- #if defined( RE_IndirectDiffuse )
1528
- vec3 iblIrradiance = vec3( 0.0 );
1529
- vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1530
- irradiance += getLightProbeIrradiance( lightProbe, geometry );
1531
- #if ( NUM_HEMI_LIGHTS > 0 )
1532
- #pragma unroll_loop_start
1533
- for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1534
- irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
1535
- }
1536
- #pragma unroll_loop_end
1537
- #endif
1538
- #endif
1539
- #if defined( RE_IndirectSpecular )
1540
- vec3 radiance = vec3( 0.0 );
1541
- vec3 clearcoatRadiance = vec3( 0.0 );
1542
- #endif`,Av=`#if defined( RE_IndirectDiffuse )
1543
- #ifdef USE_LIGHTMAP
1544
- vec4 lightMapTexel= texture2D( lightMap, vUv2 );
1545
- vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
1546
- #ifndef PHYSICALLY_CORRECT_LIGHTS
1547
- lightMapIrradiance *= PI;
1548
- #endif
1549
- irradiance += lightMapIrradiance;
1550
- #endif
1551
- #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1552
- iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );
1553
- #endif
1554
- #endif
1555
- #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1556
- radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );
1557
- #ifdef CLEARCOAT
1558
- clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );
1559
- #endif
1560
- #endif`,Lv=`#if defined( RE_IndirectDiffuse )
1561
- RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
1562
- #endif
1563
- #if defined( RE_IndirectSpecular )
1564
- RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
1565
- #endif`,Pv=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1566
- gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1567
- #endif`,Cv=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1568
- uniform float logDepthBufFC;
1569
- varying float vFragDepth;
1570
- varying float vIsPerspective;
1571
- #endif`,Rv=`#ifdef USE_LOGDEPTHBUF
1572
- #ifdef USE_LOGDEPTHBUF_EXT
1573
- varying float vFragDepth;
1574
- varying float vIsPerspective;
1575
- #else
1576
- uniform float logDepthBufFC;
1577
- #endif
1578
- #endif`,Ov=`#ifdef USE_LOGDEPTHBUF
1579
- #ifdef USE_LOGDEPTHBUF_EXT
1580
- vFragDepth = 1.0 + gl_Position.w;
1581
- vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1582
- #else
1583
- if ( isPerspectiveMatrix( projectionMatrix ) ) {
1584
- gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
1585
- gl_Position.z *= gl_Position.w;
1586
- }
1587
- #endif
1588
- #endif`,Dv=`#ifdef USE_MAP
1589
- vec4 texelColor = texture2D( map, vUv );
1590
- texelColor = mapTexelToLinear( texelColor );
1591
- diffuseColor *= texelColor;
1592
- #endif`,Iv=`#ifdef USE_MAP
1593
- uniform sampler2D map;
1594
- #endif`,Nv=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1595
- vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1596
- #endif
1597
- #ifdef USE_MAP
1598
- vec4 mapTexel = texture2D( map, uv );
1599
- diffuseColor *= mapTexelToLinear( mapTexel );
1600
- #endif
1601
- #ifdef USE_ALPHAMAP
1602
- diffuseColor.a *= texture2D( alphaMap, uv ).g;
1603
- #endif`,Fv=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1604
- uniform mat3 uvTransform;
1605
- #endif
1606
- #ifdef USE_MAP
1607
- uniform sampler2D map;
1608
- #endif
1609
- #ifdef USE_ALPHAMAP
1610
- uniform sampler2D alphaMap;
1611
- #endif`,Bv=`float metalnessFactor = metalness;
1612
- #ifdef USE_METALNESSMAP
1613
- vec4 texelMetalness = texture2D( metalnessMap, vUv );
1614
- metalnessFactor *= texelMetalness.b;
1615
- #endif`,Uv=`#ifdef USE_METALNESSMAP
1616
- uniform sampler2D metalnessMap;
1617
- #endif`,zv=`#ifdef USE_MORPHNORMALS
1618
- objectNormal *= morphTargetBaseInfluence;
1619
- objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
1620
- objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
1621
- objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
1622
- objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
1623
- #endif`,Gv=`#ifdef USE_MORPHTARGETS
1624
- uniform float morphTargetBaseInfluence;
1625
- #ifndef USE_MORPHNORMALS
1626
- uniform float morphTargetInfluences[ 8 ];
1627
- #else
1628
- uniform float morphTargetInfluences[ 4 ];
1629
- #endif
1630
- #endif`,Hv=`#ifdef USE_MORPHTARGETS
1631
- transformed *= morphTargetBaseInfluence;
1632
- transformed += morphTarget0 * morphTargetInfluences[ 0 ];
1633
- transformed += morphTarget1 * morphTargetInfluences[ 1 ];
1634
- transformed += morphTarget2 * morphTargetInfluences[ 2 ];
1635
- transformed += morphTarget3 * morphTargetInfluences[ 3 ];
1636
- #ifndef USE_MORPHNORMALS
1637
- transformed += morphTarget4 * morphTargetInfluences[ 4 ];
1638
- transformed += morphTarget5 * morphTargetInfluences[ 5 ];
1639
- transformed += morphTarget6 * morphTargetInfluences[ 6 ];
1640
- transformed += morphTarget7 * morphTargetInfluences[ 7 ];
1641
- #endif
1642
- #endif`,Vv=`#ifdef FLAT_SHADED
1643
- vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
1644
- vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
1645
- vec3 normal = normalize( cross( fdx, fdy ) );
1646
- #else
1647
- vec3 normal = normalize( vNormal );
1648
- #ifdef DOUBLE_SIDED
1649
- normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
1650
- #endif
1651
- #ifdef USE_TANGENT
1652
- vec3 tangent = normalize( vTangent );
1653
- vec3 bitangent = normalize( vBitangent );
1654
- #ifdef DOUBLE_SIDED
1655
- tangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
1656
- bitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
1657
- #endif
1658
- #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
1659
- mat3 vTBN = mat3( tangent, bitangent, normal );
1660
- #endif
1661
- #endif
1662
- #endif
1663
- vec3 geometryNormal = normal;`,kv=`#ifdef OBJECTSPACE_NORMALMAP
1664
- normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
1665
- #ifdef FLIP_SIDED
1666
- normal = - normal;
1667
- #endif
1668
- #ifdef DOUBLE_SIDED
1669
- normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
1670
- #endif
1671
- normal = normalize( normalMatrix * normal );
1672
- #elif defined( TANGENTSPACE_NORMALMAP )
1673
- vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
1674
- mapN.xy *= normalScale;
1675
- #ifdef USE_TANGENT
1676
- normal = normalize( vTBN * mapN );
1677
- #else
1678
- normal = perturbNormal2Arb( -vViewPosition, normal, mapN );
1679
- #endif
1680
- #elif defined( USE_BUMPMAP )
1681
- normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );
1682
- #endif`,Wv=`#ifdef USE_NORMALMAP
1683
- uniform sampler2D normalMap;
1684
- uniform vec2 normalScale;
1685
- #endif
1686
- #ifdef OBJECTSPACE_NORMALMAP
1687
- uniform mat3 normalMatrix;
1688
- #endif
1689
- #if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
1690
- vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {
1691
- vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
1692
- vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
1693
- vec2 st0 = dFdx( vUv.st );
1694
- vec2 st1 = dFdy( vUv.st );
1695
- float scale = sign( st1.t * st0.s - st0.t * st1.s );
1696
- vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );
1697
- vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );
1698
- vec3 N = normalize( surf_norm );
1699
- mat3 tsn = mat3( S, T, N );
1700
- mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
1701
- return normalize( tsn * mapN );
1702
- }
1703
- #endif`,Xv=`#ifdef CLEARCOAT
1704
- vec3 clearcoatNormal = geometryNormal;
1705
- #endif`,jv=`#ifdef USE_CLEARCOAT_NORMALMAP
1706
- vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
1707
- clearcoatMapN.xy *= clearcoatNormalScale;
1708
- #ifdef USE_TANGENT
1709
- clearcoatNormal = normalize( vTBN * clearcoatMapN );
1710
- #else
1711
- clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );
1712
- #endif
1713
- #endif`,qv=`#ifdef USE_CLEARCOATMAP
1714
- uniform sampler2D clearcoatMap;
1715
- #endif
1716
- #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1717
- uniform sampler2D clearcoatRoughnessMap;
1718
- #endif
1719
- #ifdef USE_CLEARCOAT_NORMALMAP
1720
- uniform sampler2D clearcoatNormalMap;
1721
- uniform vec2 clearcoatNormalScale;
1722
- #endif`,Yv=`vec3 packNormalToRGB( const in vec3 normal ) {
1723
- return normalize( normal ) * 0.5 + 0.5;
1724
- }
1725
- vec3 unpackRGBToNormal( const in vec3 rgb ) {
1726
- return 2.0 * rgb.xyz - 1.0;
1727
- }
1728
- const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
1729
- const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
1730
- const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
1731
- const float ShiftRight8 = 1. / 256.;
1732
- vec4 packDepthToRGBA( const in float v ) {
1733
- vec4 r = vec4( fract( v * PackFactors ), v );
1734
- r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
1735
- }
1736
- float unpackRGBAToDepth( const in vec4 v ) {
1737
- return dot( v, UnpackFactors );
1738
- }
1739
- vec4 pack2HalfToRGBA( vec2 v ) {
1740
- vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));
1741
- return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);
1742
- }
1743
- vec2 unpackRGBATo2Half( vec4 v ) {
1744
- return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1745
- }
1746
- float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1747
- return ( viewZ + near ) / ( near - far );
1748
- }
1749
- float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
1750
- return linearClipZ * ( near - far ) - near;
1751
- }
1752
- float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1753
- return (( near + viewZ ) * far ) / (( far - near ) * viewZ );
1754
- }
1755
- float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
1756
- return ( near * far ) / ( ( far - near ) * invClipZ - far );
1757
- }`,Zv=`#ifdef PREMULTIPLIED_ALPHA
1758
- gl_FragColor.rgb *= gl_FragColor.a;
1759
- #endif`,Jv=`vec4 mvPosition = vec4( transformed, 1.0 );
1760
- #ifdef USE_INSTANCING
1761
- mvPosition = instanceMatrix * mvPosition;
1762
- #endif
1763
- mvPosition = modelViewMatrix * mvPosition;
1764
- gl_Position = projectionMatrix * mvPosition;`,Qv=`#ifdef DITHERING
1765
- gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1766
- #endif`,$v=`#ifdef DITHERING
1767
- vec3 dithering( vec3 color ) {
1768
- float grid_position = rand( gl_FragCoord.xy );
1769
- vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1770
- dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1771
- return color + dither_shift_RGB;
1772
- }
1773
- #endif`,Kv=`float roughnessFactor = roughness;
1774
- #ifdef USE_ROUGHNESSMAP
1775
- vec4 texelRoughness = texture2D( roughnessMap, vUv );
1776
- roughnessFactor *= texelRoughness.g;
1777
- #endif`,em=`#ifdef USE_ROUGHNESSMAP
1778
- uniform sampler2D roughnessMap;
1779
- #endif`,tm=`#ifdef USE_SHADOWMAP
1780
- #if NUM_DIR_LIGHT_SHADOWS > 0
1781
- uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1782
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1783
- #endif
1784
- #if NUM_SPOT_LIGHT_SHADOWS > 0
1785
- uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1786
- varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
1787
- #endif
1788
- #if NUM_POINT_LIGHT_SHADOWS > 0
1789
- uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1790
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1791
- #endif
1792
- float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1793
- return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1794
- }
1795
- vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1796
- return unpackRGBATo2Half( texture2D( shadow, uv ) );
1797
- }
1798
- float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1799
- float occlusion = 1.0;
1800
- vec2 distribution = texture2DDistribution( shadow, uv );
1801
- float hard_shadow = step( compare , distribution.x );
1802
- if (hard_shadow != 1.0 ) {
1803
- float distance = compare - distribution.x ;
1804
- float variance = max( 0.00000, distribution.y * distribution.y );
1805
- float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
1806
- }
1807
- return occlusion;
1808
- }
1809
- float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1810
- float shadow = 1.0;
1811
- shadowCoord.xyz /= shadowCoord.w;
1812
- shadowCoord.z += shadowBias;
1813
- bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
1814
- bool inFrustum = all( inFrustumVec );
1815
- bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
1816
- bool frustumTest = all( frustumTestVec );
1817
- if ( frustumTest ) {
1818
- #if defined( SHADOWMAP_TYPE_PCF )
1819
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1820
- float dx0 = - texelSize.x * shadowRadius;
1821
- float dy0 = - texelSize.y * shadowRadius;
1822
- float dx1 = + texelSize.x * shadowRadius;
1823
- float dy1 = + texelSize.y * shadowRadius;
1824
- float dx2 = dx0 / 2.0;
1825
- float dy2 = dy0 / 2.0;
1826
- float dx3 = dx1 / 2.0;
1827
- float dy3 = dy1 / 2.0;
1828
- shadow = (
1829
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1830
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1831
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1832
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1833
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1834
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1835
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1836
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1837
- texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1838
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1839
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1840
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1841
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1842
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1843
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1844
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1845
- texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1846
- ) * ( 1.0 / 17.0 );
1847
- #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1848
- vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1849
- float dx = texelSize.x;
1850
- float dy = texelSize.y;
1851
- vec2 uv = shadowCoord.xy;
1852
- vec2 f = fract( uv * shadowMapSize + 0.5 );
1853
- uv -= f * texelSize;
1854
- shadow = (
1855
- texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1856
- texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1857
- texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1858
- texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1859
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
1860
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1861
- f.x ) +
1862
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
1863
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1864
- f.x ) +
1865
- mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
1866
- texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1867
- f.y ) +
1868
- mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
1869
- texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1870
- f.y ) +
1871
- mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
1872
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1873
- f.x ),
1874
- mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
1875
- texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1876
- f.x ),
1877
- f.y )
1878
- ) * ( 1.0 / 9.0 );
1879
- #elif defined( SHADOWMAP_TYPE_VSM )
1880
- shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1881
- #else
1882
- shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1883
- #endif
1884
- }
1885
- return shadow;
1886
- }
1887
- vec2 cubeToUV( vec3 v, float texelSizeY ) {
1888
- vec3 absV = abs( v );
1889
- float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1890
- absV *= scaleToCube;
1891
- v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1892
- vec2 planar = v.xy;
1893
- float almostATexel = 1.5 * texelSizeY;
1894
- float almostOne = 1.0 - almostATexel;
1895
- if ( absV.z >= almostOne ) {
1896
- if ( v.z > 0.0 )
1897
- planar.x = 4.0 - v.x;
1898
- } else if ( absV.x >= almostOne ) {
1899
- float signX = sign( v.x );
1900
- planar.x = v.z * signX + 2.0 * signX;
1901
- } else if ( absV.y >= almostOne ) {
1902
- float signY = sign( v.y );
1903
- planar.x = v.x + 2.0 * signY + 2.0;
1904
- planar.y = v.z * signY - 2.0;
1905
- }
1906
- return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1907
- }
1908
- float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1909
- vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1910
- vec3 lightToPosition = shadowCoord.xyz;
1911
- float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
1912
- vec3 bd3D = normalize( lightToPosition );
1913
- #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1914
- vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1915
- return (
1916
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1917
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1918
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1919
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1920
- texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1921
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1922
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1923
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1924
- texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1925
- ) * ( 1.0 / 9.0 );
1926
- #else
1927
- return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1928
- #endif
1929
- }
1930
- #endif`,nm=`#ifdef USE_SHADOWMAP
1931
- #if NUM_DIR_LIGHT_SHADOWS > 0
1932
- uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1933
- varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1934
- #endif
1935
- #if NUM_SPOT_LIGHT_SHADOWS > 0
1936
- uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
1937
- varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
1938
- #endif
1939
- #if NUM_POINT_LIGHT_SHADOWS > 0
1940
- uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1941
- varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1942
- #endif
1943
- #endif`,rm=`#ifdef USE_SHADOWMAP
1944
- #if NUM_DIR_LIGHT_SHADOWS > 0
1945
- #pragma unroll_loop_start
1946
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1947
- vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;
1948
- }
1949
- #pragma unroll_loop_end
1950
- #endif
1951
- #if NUM_SPOT_LIGHT_SHADOWS > 0
1952
- #pragma unroll_loop_start
1953
- for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1954
- vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;
1955
- }
1956
- #pragma unroll_loop_end
1957
- #endif
1958
- #if NUM_POINT_LIGHT_SHADOWS > 0
1959
- #pragma unroll_loop_start
1960
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1961
- vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;
1962
- }
1963
- #pragma unroll_loop_end
1964
- #endif
1965
- #endif`,im=`float getShadowMask() {
1966
- float shadow = 1.0;
1967
- #ifdef USE_SHADOWMAP
1968
- #if NUM_DIR_LIGHT_SHADOWS > 0
1969
- DirectionalLightShadow directionalLight;
1970
- #pragma unroll_loop_start
1971
- for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1972
- directionalLight = directionalLightShadows[ i ];
1973
- shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1974
- }
1975
- #pragma unroll_loop_end
1976
- #endif
1977
- #if NUM_SPOT_LIGHT_SHADOWS > 0
1978
- SpotLightShadow spotLight;
1979
- #pragma unroll_loop_start
1980
- for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1981
- spotLight = spotLightShadows[ i ];
1982
- shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
1983
- }
1984
- #pragma unroll_loop_end
1985
- #endif
1986
- #if NUM_POINT_LIGHT_SHADOWS > 0
1987
- PointLightShadow pointLight;
1988
- #pragma unroll_loop_start
1989
- for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1990
- pointLight = pointLightShadows[ i ];
1991
- shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1992
- }
1993
- #pragma unroll_loop_end
1994
- #endif
1995
- #endif
1996
- return shadow;
1997
- }`,am=`#ifdef USE_SKINNING
1998
- mat4 boneMatX = getBoneMatrix( skinIndex.x );
1999
- mat4 boneMatY = getBoneMatrix( skinIndex.y );
2000
- mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2001
- mat4 boneMatW = getBoneMatrix( skinIndex.w );
2002
- #endif`,om=`#ifdef USE_SKINNING
2003
- uniform mat4 bindMatrix;
2004
- uniform mat4 bindMatrixInverse;
2005
- #ifdef BONE_TEXTURE
2006
- uniform highp sampler2D boneTexture;
2007
- uniform int boneTextureSize;
2008
- mat4 getBoneMatrix( const in float i ) {
2009
- float j = i * 4.0;
2010
- float x = mod( j, float( boneTextureSize ) );
2011
- float y = floor( j / float( boneTextureSize ) );
2012
- float dx = 1.0 / float( boneTextureSize );
2013
- float dy = 1.0 / float( boneTextureSize );
2014
- y = dy * ( y + 0.5 );
2015
- vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
2016
- vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
2017
- vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
2018
- vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
2019
- mat4 bone = mat4( v1, v2, v3, v4 );
2020
- return bone;
2021
- }
2022
- #else
2023
- uniform mat4 boneMatrices[ MAX_BONES ];
2024
- mat4 getBoneMatrix( const in float i ) {
2025
- mat4 bone = boneMatrices[ int(i) ];
2026
- return bone;
2027
- }
2028
- #endif
2029
- #endif`,sm=`#ifdef USE_SKINNING
2030
- vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2031
- vec4 skinned = vec4( 0.0 );
2032
- skinned += boneMatX * skinVertex * skinWeight.x;
2033
- skinned += boneMatY * skinVertex * skinWeight.y;
2034
- skinned += boneMatZ * skinVertex * skinWeight.z;
2035
- skinned += boneMatW * skinVertex * skinWeight.w;
2036
- transformed = ( bindMatrixInverse * skinned ).xyz;
2037
- #endif`,lm=`#ifdef USE_SKINNING
2038
- mat4 skinMatrix = mat4( 0.0 );
2039
- skinMatrix += skinWeight.x * boneMatX;
2040
- skinMatrix += skinWeight.y * boneMatY;
2041
- skinMatrix += skinWeight.z * boneMatZ;
2042
- skinMatrix += skinWeight.w * boneMatW;
2043
- skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2044
- objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2045
- #ifdef USE_TANGENT
2046
- objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2047
- #endif
2048
- #endif`,cm=`float specularStrength;
2049
- #ifdef USE_SPECULARMAP
2050
- vec4 texelSpecular = texture2D( specularMap, vUv );
2051
- specularStrength = texelSpecular.r;
2052
- #else
2053
- specularStrength = 1.0;
2054
- #endif`,um=`#ifdef USE_SPECULARMAP
2055
- uniform sampler2D specularMap;
2056
- #endif`,hm=`#if defined( TONE_MAPPING )
2057
- gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2058
- #endif`,fm=`#ifndef saturate
2059
- #define saturate(a) clamp( a, 0.0, 1.0 )
2060
- #endif
2061
- uniform float toneMappingExposure;
2062
- uniform float toneMappingWhitePoint;
2063
- vec3 LinearToneMapping( vec3 color ) {
2064
- return toneMappingExposure * color;
2065
- }
2066
- vec3 ReinhardToneMapping( vec3 color ) {
2067
- color *= toneMappingExposure;
2068
- return saturate( color / ( vec3( 1.0 ) + color ) );
2069
- }
2070
- #define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )
2071
- vec3 Uncharted2ToneMapping( vec3 color ) {
2072
- color *= toneMappingExposure;
2073
- return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );
2074
- }
2075
- vec3 OptimizedCineonToneMapping( vec3 color ) {
2076
- color *= toneMappingExposure;
2077
- color = max( vec3( 0.0 ), color - 0.004 );
2078
- return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2079
- }
2080
- vec3 ACESFilmicToneMapping( vec3 color ) {
2081
- color *= toneMappingExposure;
2082
- return saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );
2083
- }`,dm=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
2084
- varying vec2 vUv;
2085
- #endif`,pm=`#ifdef USE_UV
2086
- #ifdef UVS_VERTEX_ONLY
2087
- vec2 vUv;
2088
- #else
2089
- varying vec2 vUv;
2090
- #endif
2091
- uniform mat3 uvTransform;
2092
- #endif`,vm=`#ifdef USE_UV
2093
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2094
- #endif`,mm=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
2095
- varying vec2 vUv2;
2096
- #endif`,gm=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
2097
- attribute vec2 uv2;
2098
- varying vec2 vUv2;
2099
- uniform mat3 uv2Transform;
2100
- #endif`,ym=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
2101
- vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
2102
- #endif`,xm=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )
2103
- vec4 worldPosition = vec4( transformed, 1.0 );
2104
- #ifdef USE_INSTANCING
2105
- worldPosition = instanceMatrix * worldPosition;
2106
- #endif
2107
- worldPosition = modelMatrix * worldPosition;
2108
- #endif`,_m=`uniform sampler2D t2D;
2109
- varying vec2 vUv;
2110
- void main() {
2111
- vec4 texColor = texture2D( t2D, vUv );
2112
- gl_FragColor = mapTexelToLinear( texColor );
2113
- #include <tonemapping_fragment>
2114
- #include <encodings_fragment>
2115
- }`,bm=`varying vec2 vUv;
2116
- uniform mat3 uvTransform;
2117
- void main() {
2118
- vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2119
- gl_Position = vec4( position.xy, 1.0, 1.0 );
2120
- }`,wm=`#include <envmap_common_pars_fragment>
2121
- uniform float opacity;
2122
- varying vec3 vWorldDirection;
2123
- #include <cube_uv_reflection_fragment>
2124
- void main() {
2125
- vec3 vReflect = vWorldDirection;
2126
- #include <envmap_fragment>
2127
- gl_FragColor = envColor;
2128
- gl_FragColor.a *= opacity;
2129
- #include <tonemapping_fragment>
2130
- #include <encodings_fragment>
2131
- }`,Mm=`varying vec3 vWorldDirection;
2132
- #include <common>
2133
- void main() {
2134
- vWorldDirection = transformDirection( position, modelMatrix );
2135
- #include <begin_vertex>
2136
- #include <project_vertex>
2137
- gl_Position.z = gl_Position.w;
2138
- }`,Em=`#if DEPTH_PACKING == 3200
2139
- uniform float opacity;
2140
- #endif
2141
- #include <common>
2142
- #include <packing>
2143
- #include <uv_pars_fragment>
2144
- #include <map_pars_fragment>
2145
- #include <alphamap_pars_fragment>
2146
- #include <logdepthbuf_pars_fragment>
2147
- #include <clipping_planes_pars_fragment>
2148
- varying vec2 vHighPrecisionZW;
2149
- void main() {
2150
- #include <clipping_planes_fragment>
2151
- vec4 diffuseColor = vec4( 1.0 );
2152
- #if DEPTH_PACKING == 3200
2153
- diffuseColor.a = opacity;
2154
- #endif
2155
- #include <map_fragment>
2156
- #include <alphamap_fragment>
2157
- #include <alphatest_fragment>
2158
- #include <logdepthbuf_fragment>
2159
- float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
2160
- #if DEPTH_PACKING == 3200
2161
- gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2162
- #elif DEPTH_PACKING == 3201
2163
- gl_FragColor = packDepthToRGBA( fragCoordZ );
2164
- #endif
2165
- }`,Tm=`#include <common>
2166
- #include <uv_pars_vertex>
2167
- #include <displacementmap_pars_vertex>
2168
- #include <morphtarget_pars_vertex>
2169
- #include <skinning_pars_vertex>
2170
- #include <logdepthbuf_pars_vertex>
2171
- #include <clipping_planes_pars_vertex>
2172
- varying vec2 vHighPrecisionZW;
2173
- void main() {
2174
- #include <uv_vertex>
2175
- #include <skinbase_vertex>
2176
- #ifdef USE_DISPLACEMENTMAP
2177
- #include <beginnormal_vertex>
2178
- #include <morphnormal_vertex>
2179
- #include <skinnormal_vertex>
2180
- #endif
2181
- #include <begin_vertex>
2182
- #include <morphtarget_vertex>
2183
- #include <skinning_vertex>
2184
- #include <displacementmap_vertex>
2185
- #include <project_vertex>
2186
- #include <logdepthbuf_vertex>
2187
- #include <clipping_planes_vertex>
2188
- vHighPrecisionZW = gl_Position.zw;
2189
- }`,Sm=`#define DISTANCE
2190
- uniform vec3 referencePosition;
2191
- uniform float nearDistance;
2192
- uniform float farDistance;
2193
- varying vec3 vWorldPosition;
2194
- #include <common>
2195
- #include <packing>
2196
- #include <uv_pars_fragment>
2197
- #include <map_pars_fragment>
2198
- #include <alphamap_pars_fragment>
2199
- #include <clipping_planes_pars_fragment>
2200
- void main () {
2201
- #include <clipping_planes_fragment>
2202
- vec4 diffuseColor = vec4( 1.0 );
2203
- #include <map_fragment>
2204
- #include <alphamap_fragment>
2205
- #include <alphatest_fragment>
2206
- float dist = length( vWorldPosition - referencePosition );
2207
- dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2208
- dist = saturate( dist );
2209
- gl_FragColor = packDepthToRGBA( dist );
2210
- }`,Am=`#define DISTANCE
2211
- varying vec3 vWorldPosition;
2212
- #include <common>
2213
- #include <uv_pars_vertex>
2214
- #include <displacementmap_pars_vertex>
2215
- #include <morphtarget_pars_vertex>
2216
- #include <skinning_pars_vertex>
2217
- #include <clipping_planes_pars_vertex>
2218
- void main() {
2219
- #include <uv_vertex>
2220
- #include <skinbase_vertex>
2221
- #ifdef USE_DISPLACEMENTMAP
2222
- #include <beginnormal_vertex>
2223
- #include <morphnormal_vertex>
2224
- #include <skinnormal_vertex>
2225
- #endif
2226
- #include <begin_vertex>
2227
- #include <morphtarget_vertex>
2228
- #include <skinning_vertex>
2229
- #include <displacementmap_vertex>
2230
- #include <project_vertex>
2231
- #include <worldpos_vertex>
2232
- #include <clipping_planes_vertex>
2233
- vWorldPosition = worldPosition.xyz;
2234
- }`,Lm=`uniform sampler2D tEquirect;
2235
- varying vec3 vWorldDirection;
2236
- #include <common>
2237
- void main() {
2238
- vec3 direction = normalize( vWorldDirection );
2239
- vec2 sampleUV = equirectUv( direction );
2240
- vec4 texColor = texture2D( tEquirect, sampleUV );
2241
- gl_FragColor = mapTexelToLinear( texColor );
2242
- #include <tonemapping_fragment>
2243
- #include <encodings_fragment>
2244
- }`,Pm=`varying vec3 vWorldDirection;
2245
- #include <common>
2246
- void main() {
2247
- vWorldDirection = transformDirection( position, modelMatrix );
2248
- #include <begin_vertex>
2249
- #include <project_vertex>
2250
- }`,Cm=`uniform vec3 diffuse;
2251
- uniform float opacity;
2252
- uniform float dashSize;
2253
- uniform float totalSize;
2254
- varying float vLineDistance;
2255
- #include <common>
2256
- #include <color_pars_fragment>
2257
- #include <fog_pars_fragment>
2258
- #include <logdepthbuf_pars_fragment>
2259
- #include <clipping_planes_pars_fragment>
2260
- void main() {
2261
- #include <clipping_planes_fragment>
2262
- if ( mod( vLineDistance, totalSize ) > dashSize ) {
2263
- discard;
2264
- }
2265
- vec3 outgoingLight = vec3( 0.0 );
2266
- vec4 diffuseColor = vec4( diffuse, opacity );
2267
- #include <logdepthbuf_fragment>
2268
- #include <color_fragment>
2269
- outgoingLight = diffuseColor.rgb;
2270
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2271
- #include <tonemapping_fragment>
2272
- #include <encodings_fragment>
2273
- #include <fog_fragment>
2274
- #include <premultiplied_alpha_fragment>
2275
- }`,Rm=`uniform float scale;
2276
- attribute float lineDistance;
2277
- varying float vLineDistance;
2278
- #include <common>
2279
- #include <color_pars_vertex>
2280
- #include <fog_pars_vertex>
2281
- #include <morphtarget_pars_vertex>
2282
- #include <logdepthbuf_pars_vertex>
2283
- #include <clipping_planes_pars_vertex>
2284
- void main() {
2285
- vLineDistance = scale * lineDistance;
2286
- #include <color_vertex>
2287
- #include <begin_vertex>
2288
- #include <morphtarget_vertex>
2289
- #include <project_vertex>
2290
- #include <logdepthbuf_vertex>
2291
- #include <clipping_planes_vertex>
2292
- #include <fog_vertex>
2293
- }`,Om=`uniform vec3 diffuse;
2294
- uniform float opacity;
2295
- #ifndef FLAT_SHADED
2296
- varying vec3 vNormal;
2297
- #endif
2298
- #include <common>
2299
- #include <dithering_pars_fragment>
2300
- #include <color_pars_fragment>
2301
- #include <uv_pars_fragment>
2302
- #include <uv2_pars_fragment>
2303
- #include <map_pars_fragment>
2304
- #include <alphamap_pars_fragment>
2305
- #include <aomap_pars_fragment>
2306
- #include <lightmap_pars_fragment>
2307
- #include <envmap_common_pars_fragment>
2308
- #include <envmap_pars_fragment>
2309
- #include <cube_uv_reflection_fragment>
2310
- #include <fog_pars_fragment>
2311
- #include <specularmap_pars_fragment>
2312
- #include <logdepthbuf_pars_fragment>
2313
- #include <clipping_planes_pars_fragment>
2314
- void main() {
2315
- #include <clipping_planes_fragment>
2316
- vec4 diffuseColor = vec4( diffuse, opacity );
2317
- #include <logdepthbuf_fragment>
2318
- #include <map_fragment>
2319
- #include <color_fragment>
2320
- #include <alphamap_fragment>
2321
- #include <alphatest_fragment>
2322
- #include <specularmap_fragment>
2323
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2324
- #ifdef USE_LIGHTMAP
2325
-
2326
- vec4 lightMapTexel= texture2D( lightMap, vUv2 );
2327
- reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
2328
- #else
2329
- reflectedLight.indirectDiffuse += vec3( 1.0 );
2330
- #endif
2331
- #include <aomap_fragment>
2332
- reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2333
- vec3 outgoingLight = reflectedLight.indirectDiffuse;
2334
- #include <envmap_fragment>
2335
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2336
- #include <tonemapping_fragment>
2337
- #include <encodings_fragment>
2338
- #include <fog_fragment>
2339
- #include <premultiplied_alpha_fragment>
2340
- #include <dithering_fragment>
2341
- }`,Dm=`#include <common>
2342
- #include <uv_pars_vertex>
2343
- #include <uv2_pars_vertex>
2344
- #include <envmap_pars_vertex>
2345
- #include <color_pars_vertex>
2346
- #include <fog_pars_vertex>
2347
- #include <morphtarget_pars_vertex>
2348
- #include <skinning_pars_vertex>
2349
- #include <logdepthbuf_pars_vertex>
2350
- #include <clipping_planes_pars_vertex>
2351
- void main() {
2352
- #include <uv_vertex>
2353
- #include <uv2_vertex>
2354
- #include <color_vertex>
2355
- #include <skinbase_vertex>
2356
- #ifdef USE_ENVMAP
2357
- #include <beginnormal_vertex>
2358
- #include <morphnormal_vertex>
2359
- #include <skinnormal_vertex>
2360
- #include <defaultnormal_vertex>
2361
- #endif
2362
- #include <begin_vertex>
2363
- #include <morphtarget_vertex>
2364
- #include <skinning_vertex>
2365
- #include <project_vertex>
2366
- #include <logdepthbuf_vertex>
2367
- #include <worldpos_vertex>
2368
- #include <clipping_planes_vertex>
2369
- #include <envmap_vertex>
2370
- #include <fog_vertex>
2371
- }`,Im=`uniform vec3 diffuse;
2372
- uniform vec3 emissive;
2373
- uniform float opacity;
2374
- varying vec3 vLightFront;
2375
- varying vec3 vIndirectFront;
2376
- #ifdef DOUBLE_SIDED
2377
- varying vec3 vLightBack;
2378
- varying vec3 vIndirectBack;
2379
- #endif
2380
- #include <common>
2381
- #include <packing>
2382
- #include <dithering_pars_fragment>
2383
- #include <color_pars_fragment>
2384
- #include <uv_pars_fragment>
2385
- #include <uv2_pars_fragment>
2386
- #include <map_pars_fragment>
2387
- #include <alphamap_pars_fragment>
2388
- #include <aomap_pars_fragment>
2389
- #include <lightmap_pars_fragment>
2390
- #include <emissivemap_pars_fragment>
2391
- #include <envmap_common_pars_fragment>
2392
- #include <envmap_pars_fragment>
2393
- #include <cube_uv_reflection_fragment>
2394
- #include <bsdfs>
2395
- #include <lights_pars_begin>
2396
- #include <fog_pars_fragment>
2397
- #include <shadowmap_pars_fragment>
2398
- #include <shadowmask_pars_fragment>
2399
- #include <specularmap_pars_fragment>
2400
- #include <logdepthbuf_pars_fragment>
2401
- #include <clipping_planes_pars_fragment>
2402
- void main() {
2403
- #include <clipping_planes_fragment>
2404
- vec4 diffuseColor = vec4( diffuse, opacity );
2405
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2406
- vec3 totalEmissiveRadiance = emissive;
2407
- #include <logdepthbuf_fragment>
2408
- #include <map_fragment>
2409
- #include <color_fragment>
2410
- #include <alphamap_fragment>
2411
- #include <alphatest_fragment>
2412
- #include <specularmap_fragment>
2413
- #include <emissivemap_fragment>
2414
- #ifdef DOUBLE_SIDED
2415
- reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
2416
- #else
2417
- reflectedLight.indirectDiffuse += vIndirectFront;
2418
- #endif
2419
- #include <lightmap_fragment>
2420
- reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
2421
- #ifdef DOUBLE_SIDED
2422
- reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
2423
- #else
2424
- reflectedLight.directDiffuse = vLightFront;
2425
- #endif
2426
- reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();
2427
- #include <aomap_fragment>
2428
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2429
- #include <envmap_fragment>
2430
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2431
- #include <tonemapping_fragment>
2432
- #include <encodings_fragment>
2433
- #include <fog_fragment>
2434
- #include <premultiplied_alpha_fragment>
2435
- #include <dithering_fragment>
2436
- }`,Nm=`#define LAMBERT
2437
- varying vec3 vLightFront;
2438
- varying vec3 vIndirectFront;
2439
- #ifdef DOUBLE_SIDED
2440
- varying vec3 vLightBack;
2441
- varying vec3 vIndirectBack;
2442
- #endif
2443
- #include <common>
2444
- #include <uv_pars_vertex>
2445
- #include <uv2_pars_vertex>
2446
- #include <envmap_pars_vertex>
2447
- #include <bsdfs>
2448
- #include <lights_pars_begin>
2449
- #include <color_pars_vertex>
2450
- #include <fog_pars_vertex>
2451
- #include <morphtarget_pars_vertex>
2452
- #include <skinning_pars_vertex>
2453
- #include <shadowmap_pars_vertex>
2454
- #include <logdepthbuf_pars_vertex>
2455
- #include <clipping_planes_pars_vertex>
2456
- void main() {
2457
- #include <uv_vertex>
2458
- #include <uv2_vertex>
2459
- #include <color_vertex>
2460
- #include <beginnormal_vertex>
2461
- #include <morphnormal_vertex>
2462
- #include <skinbase_vertex>
2463
- #include <skinnormal_vertex>
2464
- #include <defaultnormal_vertex>
2465
- #include <begin_vertex>
2466
- #include <morphtarget_vertex>
2467
- #include <skinning_vertex>
2468
- #include <project_vertex>
2469
- #include <logdepthbuf_vertex>
2470
- #include <clipping_planes_vertex>
2471
- #include <worldpos_vertex>
2472
- #include <envmap_vertex>
2473
- #include <lights_lambert_vertex>
2474
- #include <shadowmap_vertex>
2475
- #include <fog_vertex>
2476
- }`,Fm=`#define MATCAP
2477
- uniform vec3 diffuse;
2478
- uniform float opacity;
2479
- uniform sampler2D matcap;
2480
- varying vec3 vViewPosition;
2481
- #ifndef FLAT_SHADED
2482
- varying vec3 vNormal;
2483
- #endif
2484
- #include <common>
2485
- #include <dithering_pars_fragment>
2486
- #include <color_pars_fragment>
2487
- #include <uv_pars_fragment>
2488
- #include <map_pars_fragment>
2489
- #include <alphamap_pars_fragment>
2490
- #include <fog_pars_fragment>
2491
- #include <bumpmap_pars_fragment>
2492
- #include <normalmap_pars_fragment>
2493
- #include <logdepthbuf_pars_fragment>
2494
- #include <clipping_planes_pars_fragment>
2495
- void main() {
2496
- #include <clipping_planes_fragment>
2497
- vec4 diffuseColor = vec4( diffuse, opacity );
2498
- #include <logdepthbuf_fragment>
2499
- #include <map_fragment>
2500
- #include <color_fragment>
2501
- #include <alphamap_fragment>
2502
- #include <alphatest_fragment>
2503
- #include <normal_fragment_begin>
2504
- #include <normal_fragment_maps>
2505
- vec3 viewDir = normalize( vViewPosition );
2506
- vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
2507
- vec3 y = cross( viewDir, x );
2508
- vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
2509
- #ifdef USE_MATCAP
2510
- vec4 matcapColor = texture2D( matcap, uv );
2511
- matcapColor = matcapTexelToLinear( matcapColor );
2512
- #else
2513
- vec4 matcapColor = vec4( 1.0 );
2514
- #endif
2515
- vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
2516
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2517
- #include <tonemapping_fragment>
2518
- #include <encodings_fragment>
2519
- #include <fog_fragment>
2520
- #include <premultiplied_alpha_fragment>
2521
- #include <dithering_fragment>
2522
- }`,Bm=`#define MATCAP
2523
- varying vec3 vViewPosition;
2524
- #ifndef FLAT_SHADED
2525
- varying vec3 vNormal;
2526
- #endif
2527
- #include <common>
2528
- #include <uv_pars_vertex>
2529
- #include <color_pars_vertex>
2530
- #include <displacementmap_pars_vertex>
2531
- #include <fog_pars_vertex>
2532
- #include <morphtarget_pars_vertex>
2533
- #include <skinning_pars_vertex>
2534
- #include <logdepthbuf_pars_vertex>
2535
- #include <clipping_planes_pars_vertex>
2536
- void main() {
2537
- #include <uv_vertex>
2538
- #include <color_vertex>
2539
- #include <beginnormal_vertex>
2540
- #include <morphnormal_vertex>
2541
- #include <skinbase_vertex>
2542
- #include <skinnormal_vertex>
2543
- #include <defaultnormal_vertex>
2544
- #ifndef FLAT_SHADED
2545
- vNormal = normalize( transformedNormal );
2546
- #endif
2547
- #include <begin_vertex>
2548
- #include <morphtarget_vertex>
2549
- #include <skinning_vertex>
2550
- #include <displacementmap_vertex>
2551
- #include <project_vertex>
2552
- #include <logdepthbuf_vertex>
2553
- #include <clipping_planes_vertex>
2554
- #include <fog_vertex>
2555
- vViewPosition = - mvPosition.xyz;
2556
- }`,Um=`#define TOON
2557
- uniform vec3 diffuse;
2558
- uniform vec3 emissive;
2559
- uniform vec3 specular;
2560
- uniform float shininess;
2561
- uniform float opacity;
2562
- #include <common>
2563
- #include <packing>
2564
- #include <dithering_pars_fragment>
2565
- #include <color_pars_fragment>
2566
- #include <uv_pars_fragment>
2567
- #include <uv2_pars_fragment>
2568
- #include <map_pars_fragment>
2569
- #include <alphamap_pars_fragment>
2570
- #include <aomap_pars_fragment>
2571
- #include <lightmap_pars_fragment>
2572
- #include <emissivemap_pars_fragment>
2573
- #include <gradientmap_pars_fragment>
2574
- #include <fog_pars_fragment>
2575
- #include <bsdfs>
2576
- #include <lights_pars_begin>
2577
- #include <lights_toon_pars_fragment>
2578
- #include <shadowmap_pars_fragment>
2579
- #include <bumpmap_pars_fragment>
2580
- #include <normalmap_pars_fragment>
2581
- #include <specularmap_pars_fragment>
2582
- #include <logdepthbuf_pars_fragment>
2583
- #include <clipping_planes_pars_fragment>
2584
- void main() {
2585
- #include <clipping_planes_fragment>
2586
- vec4 diffuseColor = vec4( diffuse, opacity );
2587
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2588
- vec3 totalEmissiveRadiance = emissive;
2589
- #include <logdepthbuf_fragment>
2590
- #include <map_fragment>
2591
- #include <color_fragment>
2592
- #include <alphamap_fragment>
2593
- #include <alphatest_fragment>
2594
- #include <specularmap_fragment>
2595
- #include <normal_fragment_begin>
2596
- #include <normal_fragment_maps>
2597
- #include <emissivemap_fragment>
2598
- #include <lights_toon_fragment>
2599
- #include <lights_fragment_begin>
2600
- #include <lights_fragment_maps>
2601
- #include <lights_fragment_end>
2602
- #include <aomap_fragment>
2603
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
2604
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2605
- #include <tonemapping_fragment>
2606
- #include <encodings_fragment>
2607
- #include <fog_fragment>
2608
- #include <premultiplied_alpha_fragment>
2609
- #include <dithering_fragment>
2610
- }`,zm=`#define TOON
2611
- varying vec3 vViewPosition;
2612
- #ifndef FLAT_SHADED
2613
- varying vec3 vNormal;
2614
- #endif
2615
- #include <common>
2616
- #include <uv_pars_vertex>
2617
- #include <uv2_pars_vertex>
2618
- #include <displacementmap_pars_vertex>
2619
- #include <color_pars_vertex>
2620
- #include <fog_pars_vertex>
2621
- #include <morphtarget_pars_vertex>
2622
- #include <skinning_pars_vertex>
2623
- #include <shadowmap_pars_vertex>
2624
- #include <logdepthbuf_pars_vertex>
2625
- #include <clipping_planes_pars_vertex>
2626
- void main() {
2627
- #include <uv_vertex>
2628
- #include <uv2_vertex>
2629
- #include <color_vertex>
2630
- #include <beginnormal_vertex>
2631
- #include <morphnormal_vertex>
2632
- #include <skinbase_vertex>
2633
- #include <skinnormal_vertex>
2634
- #include <defaultnormal_vertex>
2635
- #ifndef FLAT_SHADED
2636
- vNormal = normalize( transformedNormal );
2637
- #endif
2638
- #include <begin_vertex>
2639
- #include <morphtarget_vertex>
2640
- #include <skinning_vertex>
2641
- #include <displacementmap_vertex>
2642
- #include <project_vertex>
2643
- #include <logdepthbuf_vertex>
2644
- #include <clipping_planes_vertex>
2645
- vViewPosition = - mvPosition.xyz;
2646
- #include <worldpos_vertex>
2647
- #include <shadowmap_vertex>
2648
- #include <fog_vertex>
2649
- }`,Gm=`#define PHONG
2650
- uniform vec3 diffuse;
2651
- uniform vec3 emissive;
2652
- uniform vec3 specular;
2653
- uniform float shininess;
2654
- uniform float opacity;
2655
- #include <common>
2656
- #include <packing>
2657
- #include <dithering_pars_fragment>
2658
- #include <color_pars_fragment>
2659
- #include <uv_pars_fragment>
2660
- #include <uv2_pars_fragment>
2661
- #include <map_pars_fragment>
2662
- #include <alphamap_pars_fragment>
2663
- #include <aomap_pars_fragment>
2664
- #include <lightmap_pars_fragment>
2665
- #include <emissivemap_pars_fragment>
2666
- #include <envmap_common_pars_fragment>
2667
- #include <envmap_pars_fragment>
2668
- #include <cube_uv_reflection_fragment>
2669
- #include <fog_pars_fragment>
2670
- #include <bsdfs>
2671
- #include <lights_pars_begin>
2672
- #include <lights_phong_pars_fragment>
2673
- #include <shadowmap_pars_fragment>
2674
- #include <bumpmap_pars_fragment>
2675
- #include <normalmap_pars_fragment>
2676
- #include <specularmap_pars_fragment>
2677
- #include <logdepthbuf_pars_fragment>
2678
- #include <clipping_planes_pars_fragment>
2679
- void main() {
2680
- #include <clipping_planes_fragment>
2681
- vec4 diffuseColor = vec4( diffuse, opacity );
2682
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2683
- vec3 totalEmissiveRadiance = emissive;
2684
- #include <logdepthbuf_fragment>
2685
- #include <map_fragment>
2686
- #include <color_fragment>
2687
- #include <alphamap_fragment>
2688
- #include <alphatest_fragment>
2689
- #include <specularmap_fragment>
2690
- #include <normal_fragment_begin>
2691
- #include <normal_fragment_maps>
2692
- #include <emissivemap_fragment>
2693
- #include <lights_phong_fragment>
2694
- #include <lights_fragment_begin>
2695
- #include <lights_fragment_maps>
2696
- #include <lights_fragment_end>
2697
- #include <aomap_fragment>
2698
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
2699
- #include <envmap_fragment>
2700
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2701
- #include <tonemapping_fragment>
2702
- #include <encodings_fragment>
2703
- #include <fog_fragment>
2704
- #include <premultiplied_alpha_fragment>
2705
- #include <dithering_fragment>
2706
- }`,Hm=`#define PHONG
2707
- varying vec3 vViewPosition;
2708
- #ifndef FLAT_SHADED
2709
- varying vec3 vNormal;
2710
- #endif
2711
- #include <common>
2712
- #include <uv_pars_vertex>
2713
- #include <uv2_pars_vertex>
2714
- #include <displacementmap_pars_vertex>
2715
- #include <envmap_pars_vertex>
2716
- #include <color_pars_vertex>
2717
- #include <fog_pars_vertex>
2718
- #include <morphtarget_pars_vertex>
2719
- #include <skinning_pars_vertex>
2720
- #include <shadowmap_pars_vertex>
2721
- #include <logdepthbuf_pars_vertex>
2722
- #include <clipping_planes_pars_vertex>
2723
- void main() {
2724
- #include <uv_vertex>
2725
- #include <uv2_vertex>
2726
- #include <color_vertex>
2727
- #include <beginnormal_vertex>
2728
- #include <morphnormal_vertex>
2729
- #include <skinbase_vertex>
2730
- #include <skinnormal_vertex>
2731
- #include <defaultnormal_vertex>
2732
- #ifndef FLAT_SHADED
2733
- vNormal = normalize( transformedNormal );
2734
- #endif
2735
- #include <begin_vertex>
2736
- #include <morphtarget_vertex>
2737
- #include <skinning_vertex>
2738
- #include <displacementmap_vertex>
2739
- #include <project_vertex>
2740
- #include <logdepthbuf_vertex>
2741
- #include <clipping_planes_vertex>
2742
- vViewPosition = - mvPosition.xyz;
2743
- #include <worldpos_vertex>
2744
- #include <envmap_vertex>
2745
- #include <shadowmap_vertex>
2746
- #include <fog_vertex>
2747
- }`,Vm=`#define STANDARD
2748
- #ifdef PHYSICAL
2749
- #define REFLECTIVITY
2750
- #define CLEARCOAT
2751
- #define TRANSPARENCY
2752
- #endif
2753
- uniform vec3 diffuse;
2754
- uniform vec3 emissive;
2755
- uniform float roughness;
2756
- uniform float metalness;
2757
- uniform float opacity;
2758
- #ifdef TRANSPARENCY
2759
- uniform float transparency;
2760
- #endif
2761
- #ifdef REFLECTIVITY
2762
- uniform float reflectivity;
2763
- #endif
2764
- #ifdef CLEARCOAT
2765
- uniform float clearcoat;
2766
- uniform float clearcoatRoughness;
2767
- #endif
2768
- #ifdef USE_SHEEN
2769
- uniform vec3 sheen;
2770
- #endif
2771
- varying vec3 vViewPosition;
2772
- #ifndef FLAT_SHADED
2773
- varying vec3 vNormal;
2774
- #ifdef USE_TANGENT
2775
- varying vec3 vTangent;
2776
- varying vec3 vBitangent;
2777
- #endif
2778
- #endif
2779
- #include <common>
2780
- #include <packing>
2781
- #include <dithering_pars_fragment>
2782
- #include <color_pars_fragment>
2783
- #include <uv_pars_fragment>
2784
- #include <uv2_pars_fragment>
2785
- #include <map_pars_fragment>
2786
- #include <alphamap_pars_fragment>
2787
- #include <aomap_pars_fragment>
2788
- #include <lightmap_pars_fragment>
2789
- #include <emissivemap_pars_fragment>
2790
- #include <bsdfs>
2791
- #include <cube_uv_reflection_fragment>
2792
- #include <envmap_common_pars_fragment>
2793
- #include <envmap_physical_pars_fragment>
2794
- #include <fog_pars_fragment>
2795
- #include <lights_pars_begin>
2796
- #include <lights_physical_pars_fragment>
2797
- #include <shadowmap_pars_fragment>
2798
- #include <bumpmap_pars_fragment>
2799
- #include <normalmap_pars_fragment>
2800
- #include <clearcoat_pars_fragment>
2801
- #include <roughnessmap_pars_fragment>
2802
- #include <metalnessmap_pars_fragment>
2803
- #include <logdepthbuf_pars_fragment>
2804
- #include <clipping_planes_pars_fragment>
2805
- void main() {
2806
- #include <clipping_planes_fragment>
2807
- vec4 diffuseColor = vec4( diffuse, opacity );
2808
- ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2809
- vec3 totalEmissiveRadiance = emissive;
2810
- #include <logdepthbuf_fragment>
2811
- #include <map_fragment>
2812
- #include <color_fragment>
2813
- #include <alphamap_fragment>
2814
- #include <alphatest_fragment>
2815
- #include <roughnessmap_fragment>
2816
- #include <metalnessmap_fragment>
2817
- #include <normal_fragment_begin>
2818
- #include <normal_fragment_maps>
2819
- #include <clearcoat_normal_fragment_begin>
2820
- #include <clearcoat_normal_fragment_maps>
2821
- #include <emissivemap_fragment>
2822
- #include <lights_physical_fragment>
2823
- #include <lights_fragment_begin>
2824
- #include <lights_fragment_maps>
2825
- #include <lights_fragment_end>
2826
- #include <aomap_fragment>
2827
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
2828
- #ifdef TRANSPARENCY
2829
- diffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );
2830
- #endif
2831
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2832
- #include <tonemapping_fragment>
2833
- #include <encodings_fragment>
2834
- #include <fog_fragment>
2835
- #include <premultiplied_alpha_fragment>
2836
- #include <dithering_fragment>
2837
- }`,km=`#define STANDARD
2838
- varying vec3 vViewPosition;
2839
- #ifndef FLAT_SHADED
2840
- varying vec3 vNormal;
2841
- #ifdef USE_TANGENT
2842
- varying vec3 vTangent;
2843
- varying vec3 vBitangent;
2844
- #endif
2845
- #endif
2846
- #include <common>
2847
- #include <uv_pars_vertex>
2848
- #include <uv2_pars_vertex>
2849
- #include <displacementmap_pars_vertex>
2850
- #include <color_pars_vertex>
2851
- #include <fog_pars_vertex>
2852
- #include <morphtarget_pars_vertex>
2853
- #include <skinning_pars_vertex>
2854
- #include <shadowmap_pars_vertex>
2855
- #include <logdepthbuf_pars_vertex>
2856
- #include <clipping_planes_pars_vertex>
2857
- void main() {
2858
- #include <uv_vertex>
2859
- #include <uv2_vertex>
2860
- #include <color_vertex>
2861
- #include <beginnormal_vertex>
2862
- #include <morphnormal_vertex>
2863
- #include <skinbase_vertex>
2864
- #include <skinnormal_vertex>
2865
- #include <defaultnormal_vertex>
2866
- #ifndef FLAT_SHADED
2867
- vNormal = normalize( transformedNormal );
2868
- #ifdef USE_TANGENT
2869
- vTangent = normalize( transformedTangent );
2870
- vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
2871
- #endif
2872
- #endif
2873
- #include <begin_vertex>
2874
- #include <morphtarget_vertex>
2875
- #include <skinning_vertex>
2876
- #include <displacementmap_vertex>
2877
- #include <project_vertex>
2878
- #include <logdepthbuf_vertex>
2879
- #include <clipping_planes_vertex>
2880
- vViewPosition = - mvPosition.xyz;
2881
- #include <worldpos_vertex>
2882
- #include <shadowmap_vertex>
2883
- #include <fog_vertex>
2884
- }`,Wm=`#define NORMAL
2885
- uniform float opacity;
2886
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2887
- varying vec3 vViewPosition;
2888
- #endif
2889
- #ifndef FLAT_SHADED
2890
- varying vec3 vNormal;
2891
- #ifdef USE_TANGENT
2892
- varying vec3 vTangent;
2893
- varying vec3 vBitangent;
2894
- #endif
2895
- #endif
2896
- #include <packing>
2897
- #include <uv_pars_fragment>
2898
- #include <bumpmap_pars_fragment>
2899
- #include <normalmap_pars_fragment>
2900
- #include <logdepthbuf_pars_fragment>
2901
- #include <clipping_planes_pars_fragment>
2902
- void main() {
2903
- #include <clipping_planes_fragment>
2904
- #include <logdepthbuf_fragment>
2905
- #include <normal_fragment_begin>
2906
- #include <normal_fragment_maps>
2907
- gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
2908
- }`,Xm=`#define NORMAL
2909
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2910
- varying vec3 vViewPosition;
2911
- #endif
2912
- #ifndef FLAT_SHADED
2913
- varying vec3 vNormal;
2914
- #ifdef USE_TANGENT
2915
- varying vec3 vTangent;
2916
- varying vec3 vBitangent;
2917
- #endif
2918
- #endif
2919
- #include <common>
2920
- #include <uv_pars_vertex>
2921
- #include <displacementmap_pars_vertex>
2922
- #include <morphtarget_pars_vertex>
2923
- #include <skinning_pars_vertex>
2924
- #include <logdepthbuf_pars_vertex>
2925
- #include <clipping_planes_pars_vertex>
2926
- void main() {
2927
- #include <uv_vertex>
2928
- #include <beginnormal_vertex>
2929
- #include <morphnormal_vertex>
2930
- #include <skinbase_vertex>
2931
- #include <skinnormal_vertex>
2932
- #include <defaultnormal_vertex>
2933
- #ifndef FLAT_SHADED
2934
- vNormal = normalize( transformedNormal );
2935
- #ifdef USE_TANGENT
2936
- vTangent = normalize( transformedTangent );
2937
- vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
2938
- #endif
2939
- #endif
2940
- #include <begin_vertex>
2941
- #include <morphtarget_vertex>
2942
- #include <skinning_vertex>
2943
- #include <displacementmap_vertex>
2944
- #include <project_vertex>
2945
- #include <logdepthbuf_vertex>
2946
- #include <clipping_planes_vertex>
2947
- #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2948
- vViewPosition = - mvPosition.xyz;
2949
- #endif
2950
- }`,jm=`uniform vec3 diffuse;
2951
- uniform float opacity;
2952
- #include <common>
2953
- #include <color_pars_fragment>
2954
- #include <map_particle_pars_fragment>
2955
- #include <fog_pars_fragment>
2956
- #include <logdepthbuf_pars_fragment>
2957
- #include <clipping_planes_pars_fragment>
2958
- void main() {
2959
- #include <clipping_planes_fragment>
2960
- vec3 outgoingLight = vec3( 0.0 );
2961
- vec4 diffuseColor = vec4( diffuse, opacity );
2962
- #include <logdepthbuf_fragment>
2963
- #include <map_particle_fragment>
2964
- #include <color_fragment>
2965
- #include <alphatest_fragment>
2966
- outgoingLight = diffuseColor.rgb;
2967
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2968
- #include <tonemapping_fragment>
2969
- #include <encodings_fragment>
2970
- #include <fog_fragment>
2971
- #include <premultiplied_alpha_fragment>
2972
- }`,qm=`uniform float size;
2973
- uniform float scale;
2974
- #include <common>
2975
- #include <color_pars_vertex>
2976
- #include <fog_pars_vertex>
2977
- #include <morphtarget_pars_vertex>
2978
- #include <logdepthbuf_pars_vertex>
2979
- #include <clipping_planes_pars_vertex>
2980
- void main() {
2981
- #include <color_vertex>
2982
- #include <begin_vertex>
2983
- #include <morphtarget_vertex>
2984
- #include <project_vertex>
2985
- gl_PointSize = size;
2986
- #ifdef USE_SIZEATTENUATION
2987
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
2988
- if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
2989
- #endif
2990
- #include <logdepthbuf_vertex>
2991
- #include <clipping_planes_vertex>
2992
- #include <worldpos_vertex>
2993
- #include <fog_vertex>
2994
- }`,Ym=`uniform vec3 color;
2995
- uniform float opacity;
2996
- #include <common>
2997
- #include <packing>
2998
- #include <fog_pars_fragment>
2999
- #include <bsdfs>
3000
- #include <lights_pars_begin>
3001
- #include <shadowmap_pars_fragment>
3002
- #include <shadowmask_pars_fragment>
3003
- void main() {
3004
- gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3005
- #include <tonemapping_fragment>
3006
- #include <encodings_fragment>
3007
- #include <fog_fragment>
3008
- }`,Zm=`#include <fog_pars_vertex>
3009
- #include <shadowmap_pars_vertex>
3010
- void main() {
3011
- #include <begin_vertex>
3012
- #include <project_vertex>
3013
- #include <worldpos_vertex>
3014
- #include <shadowmap_vertex>
3015
- #include <fog_vertex>
3016
- }`,Jm=`uniform vec3 diffuse;
3017
- uniform float opacity;
3018
- #include <common>
3019
- #include <uv_pars_fragment>
3020
- #include <map_pars_fragment>
3021
- #include <alphamap_pars_fragment>
3022
- #include <fog_pars_fragment>
3023
- #include <logdepthbuf_pars_fragment>
3024
- #include <clipping_planes_pars_fragment>
3025
- void main() {
3026
- #include <clipping_planes_fragment>
3027
- vec3 outgoingLight = vec3( 0.0 );
3028
- vec4 diffuseColor = vec4( diffuse, opacity );
3029
- #include <logdepthbuf_fragment>
3030
- #include <map_fragment>
3031
- #include <alphamap_fragment>
3032
- #include <alphatest_fragment>
3033
- outgoingLight = diffuseColor.rgb;
3034
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );
3035
- #include <tonemapping_fragment>
3036
- #include <encodings_fragment>
3037
- #include <fog_fragment>
3038
- }`,Qm=`uniform float rotation;
3039
- uniform vec2 center;
3040
- #include <common>
3041
- #include <uv_pars_vertex>
3042
- #include <fog_pars_vertex>
3043
- #include <logdepthbuf_pars_vertex>
3044
- #include <clipping_planes_pars_vertex>
3045
- void main() {
3046
- #include <uv_vertex>
3047
- vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
3048
- vec2 scale;
3049
- scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
3050
- scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
3051
- #ifndef USE_SIZEATTENUATION
3052
- bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3053
- if ( isPerspective ) scale *= - mvPosition.z;
3054
- #endif
3055
- vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3056
- vec2 rotatedPosition;
3057
- rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3058
- rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3059
- mvPosition.xy += rotatedPosition;
3060
- gl_Position = projectionMatrix * mvPosition;
3061
- #include <logdepthbuf_vertex>
3062
- #include <clipping_planes_vertex>
3063
- #include <fog_vertex>
3064
- }`,qe={alphamap_fragment:Dp,alphamap_pars_fragment:Ip,alphatest_fragment:Np,aomap_fragment:Fp,aomap_pars_fragment:Bp,begin_vertex:Up,beginnormal_vertex:zp,bsdfs:Gp,bumpmap_pars_fragment:Hp,clipping_planes_fragment:Vp,clipping_planes_pars_fragment:kp,clipping_planes_pars_vertex:Wp,clipping_planes_vertex:Xp,color_fragment:jp,color_pars_fragment:qp,color_pars_vertex:Yp,color_vertex:Zp,common:Jp,cube_uv_reflection_fragment:Qp,defaultnormal_vertex:$p,displacementmap_pars_vertex:Kp,displacementmap_vertex:ev,emissivemap_fragment:tv,emissivemap_pars_fragment:nv,encodings_fragment:rv,encodings_pars_fragment:iv,envmap_fragment:av,envmap_common_pars_fragment:ov,envmap_pars_fragment:sv,envmap_pars_vertex:lv,envmap_physical_pars_fragment:xv,envmap_vertex:cv,fog_vertex:uv,fog_pars_vertex:hv,fog_fragment:fv,fog_pars_fragment:dv,gradientmap_pars_fragment:pv,lightmap_fragment:vv,lightmap_pars_fragment:mv,lights_lambert_vertex:gv,lights_pars_begin:yv,lights_toon_fragment:_v,lights_toon_pars_fragment:bv,lights_phong_fragment:wv,lights_phong_pars_fragment:Mv,lights_physical_fragment:Ev,lights_physical_pars_fragment:Tv,lights_fragment_begin:Sv,lights_fragment_maps:Av,lights_fragment_end:Lv,logdepthbuf_fragment:Pv,logdepthbuf_pars_fragment:Cv,logdepthbuf_pars_vertex:Rv,logdepthbuf_vertex:Ov,map_fragment:Dv,map_pars_fragment:Iv,map_particle_fragment:Nv,map_particle_pars_fragment:Fv,metalnessmap_fragment:Bv,metalnessmap_pars_fragment:Uv,morphnormal_vertex:zv,morphtarget_pars_vertex:Gv,morphtarget_vertex:Hv,normal_fragment_begin:Vv,normal_fragment_maps:kv,normalmap_pars_fragment:Wv,clearcoat_normal_fragment_begin:Xv,clearcoat_normal_fragment_maps:jv,clearcoat_pars_fragment:qv,packing:Yv,premultiplied_alpha_fragment:Zv,project_vertex:Jv,dithering_fragment:Qv,dithering_pars_fragment:$v,roughnessmap_fragment:Kv,roughnessmap_pars_fragment:em,shadowmap_pars_fragment:tm,shadowmap_pars_vertex:nm,shadowmap_vertex:rm,shadowmask_pars_fragment:im,skinbase_vertex:am,skinning_pars_vertex:om,skinning_vertex:sm,skinnormal_vertex:lm,specularmap_fragment:cm,specularmap_pars_fragment:um,tonemapping_fragment:hm,tonemapping_pars_fragment:fm,uv_pars_fragment:dm,uv_pars_vertex:pm,uv_vertex:vm,uv2_pars_fragment:mm,uv2_pars_vertex:gm,uv2_vertex:ym,worldpos_vertex:xm,background_frag:_m,background_vert:bm,cube_frag:wm,cube_vert:Mm,depth_frag:Em,depth_vert:Tm,distanceRGBA_frag:Sm,distanceRGBA_vert:Am,equirect_frag:Lm,equirect_vert:Pm,linedashed_frag:Cm,linedashed_vert:Rm,meshbasic_frag:Om,meshbasic_vert:Dm,meshlambert_frag:Im,meshlambert_vert:Nm,meshmatcap_frag:Fm,meshmatcap_vert:Bm,meshtoon_frag:Um,meshtoon_vert:zm,meshphong_frag:Gm,meshphong_vert:Hm,meshphysical_frag:Vm,meshphysical_vert:km,normal_frag:Wm,normal_vert:Xm,points_frag:jm,points_vert:qm,shadow_frag:Ym,shadow_vert:Zm,sprite_frag:Jm,sprite_vert:Qm},Un={basic:{uniforms:Dt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.fog]),vertexShader:qe.meshbasic_vert,fragmentShader:qe.meshbasic_frag},lambert:{uniforms:Dt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.fog,le.lights,{emissive:{value:new pe(0)}}]),vertexShader:qe.meshlambert_vert,fragmentShader:qe.meshlambert_frag},phong:{uniforms:Dt([le.common,le.specularmap,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.fog,le.lights,{emissive:{value:new pe(0)},specular:{value:new pe(1118481)},shininess:{value:30}}]),vertexShader:qe.meshphong_vert,fragmentShader:qe.meshphong_frag},standard:{uniforms:Dt([le.common,le.envmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.roughnessmap,le.metalnessmap,le.fog,le.lights,{emissive:{value:new pe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:qe.meshphysical_vert,fragmentShader:qe.meshphysical_frag},toon:{uniforms:Dt([le.common,le.specularmap,le.aomap,le.lightmap,le.emissivemap,le.bumpmap,le.normalmap,le.displacementmap,le.gradientmap,le.fog,le.lights,{emissive:{value:new pe(0)},specular:{value:new pe(1118481)},shininess:{value:30}}]),vertexShader:qe.meshtoon_vert,fragmentShader:qe.meshtoon_frag},matcap:{uniforms:Dt([le.common,le.bumpmap,le.normalmap,le.displacementmap,le.fog,{matcap:{value:null}}]),vertexShader:qe.meshmatcap_vert,fragmentShader:qe.meshmatcap_frag},points:{uniforms:Dt([le.points,le.fog]),vertexShader:qe.points_vert,fragmentShader:qe.points_frag},dashed:{uniforms:Dt([le.common,le.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:qe.linedashed_vert,fragmentShader:qe.linedashed_frag},depth:{uniforms:Dt([le.common,le.displacementmap]),vertexShader:qe.depth_vert,fragmentShader:qe.depth_frag},normal:{uniforms:Dt([le.common,le.bumpmap,le.normalmap,le.displacementmap,{opacity:{value:1}}]),vertexShader:qe.normal_vert,fragmentShader:qe.normal_frag},sprite:{uniforms:Dt([le.sprite,le.fog]),vertexShader:qe.sprite_vert,fragmentShader:qe.sprite_frag},background:{uniforms:{uvTransform:{value:new zt},t2D:{value:null}},vertexShader:qe.background_vert,fragmentShader:qe.background_frag},cube:{uniforms:Dt([le.envmap,{opacity:{value:1}}]),vertexShader:qe.cube_vert,fragmentShader:qe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:qe.equirect_vert,fragmentShader:qe.equirect_frag},distanceRGBA:{uniforms:Dt([le.common,le.displacementmap,{referencePosition:{value:new E},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:qe.distanceRGBA_vert,fragmentShader:qe.distanceRGBA_frag},shadow:{uniforms:Dt([le.lights,le.fog,{color:{value:new pe(0)},opacity:{value:1}}]),vertexShader:qe.shadow_vert,fragmentShader:qe.shadow_frag}};Un.physical={uniforms:Dt([Un.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new X(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new pe(0)},transparency:{value:0}}]),vertexShader:qe.meshphysical_vert,fragmentShader:qe.meshphysical_frag};function $m(e,t,n,r){var i=new pe(0),a=0,o,s,c=null,l=0,u=null;function h(d,m,g,y){var p=m.background,v=e.xr,_=v.getSession&&v.getSession();if(_&&_.environmentBlendMode==="additive"&&(p=null),p===null?f(i,a):p&&p.isColor&&(f(p,1),y=!0),(e.autoClear||y)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),p&&(p.isCubeTexture||p.isWebGLCubeRenderTarget||p.mapping===ka)){s===void 0&&(s=new ft(new Cs(1,1,1),new Wt({type:"BackgroundCubeMaterial",uniforms:pi(Un.cube.uniforms),vertexShader:Un.cube.vertexShader,fragmentShader:Un.cube.fragmentShader,side:Pt,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(b,T,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(s));var x=p.isWebGLCubeRenderTarget?p.texture:p;s.material.uniforms.envMap.value=x,s.material.uniforms.flipEnvMap.value=x.isCubeTexture?-1:1,(c!==p||l!==x.version||u!==e.toneMapping)&&(s.material.needsUpdate=!0,c=p,l=x.version,u=e.toneMapping),d.unshift(s,s.geometry,s.material,0,0,null)}else p&&p.isTexture&&(o===void 0&&(o=new ft(new mi(2,2),new Wt({type:"BackgroundMaterial",uniforms:pi(Un.background.uniforms),vertexShader:Un.background.vertexShader,fragmentShader:Un.background.fragmentShader,side:Va,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=p,p.matrixAutoUpdate===!0&&p.updateMatrix(),o.material.uniforms.uvTransform.value.copy(p.matrix),(c!==p||l!==p.version||u!==e.toneMapping)&&(o.material.needsUpdate=!0,c=p,l=p.version,u=e.toneMapping),d.unshift(o,o.geometry,o.material,0,0,null))}function f(d,m){t.buffers.color.setClear(d.r,d.g,d.b,m,r)}return{getClearColor:function(){return i},setClearColor:function(d,m){i.set(d),a=m!==void 0?m:1,f(i,a)},getClearAlpha:function(){return a},setClearAlpha:function(d){a=d,f(i,a)},render:h}}function Km(e,t,n,r){var i=r.isWebGL2,a;function o(l){a=l}function s(l,u){e.drawArrays(a,l,u),n.update(u,a)}function c(l,u,h,f){if(f!==0){var d,m;if(i)d=e,m="drawArraysInstanced";else if(d=t.get("ANGLE_instanced_arrays"),m="drawArraysInstancedANGLE",d===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}d[m](a,u,h,f),n.update(h,a,f)}}this.setMode=o,this.render=s,this.renderInstances=c}function eg(e,t,n){var r;function i(){if(r!==void 0)return r;var T=t.get("EXT_texture_filter_anisotropic");return T!==null?r=e.getParameter(T.MAX_TEXTURE_MAX_ANISOTROPY_EXT):r=0,r}function a(T){if(T==="highp"){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";T="mediump"}return T==="mediump"&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var o=typeof WebGL2RenderingContext!="undefined"&&e instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext!="undefined"&&e instanceof WebGL2ComputeRenderingContext,s=n.precision!==void 0?n.precision:"highp",c=a(s);c!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",c,"instead."),s=c);var l=n.logarithmicDepthBuffer===!0,u=e.getParameter(34930),h=e.getParameter(35660),f=e.getParameter(3379),d=e.getParameter(34076),m=e.getParameter(34921),g=e.getParameter(36347),y=e.getParameter(36348),p=e.getParameter(36349),v=h>0,_=o||!!t.get("OES_texture_float"),x=v&&_,b=o?e.getParameter(36183):0;return{isWebGL2:o,getMaxAnisotropy:i,getMaxPrecision:a,precision:s,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:h,maxTextureSize:f,maxCubemapSize:d,maxAttributes:m,maxVertexUniforms:g,maxVaryings:y,maxFragmentUniforms:p,vertexTextures:v,floatFragmentTextures:_,floatVertexTextures:x,maxSamples:b}}function tg(){var e=this,t=null,n=0,r=!1,i=!1,a=new bn,o=new zt,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(u,h,f){var d=u.length!==0||h||n!==0||r;return r=h,t=l(u,f,0),n=u.length,d},this.beginShadows=function(){i=!0,l(null)},this.endShadows=function(){i=!1,c()},this.setState=function(u,h,f,d,m,g){if(!r||u===null||u.length===0||i&&!f)i?l(null):c();else{var y=i?0:n,p=y*4,v=m.clippingState||null;s.value=v,v=l(u,d,p,g);for(var _=0;_!==p;++_)v[_]=t[_];m.clippingState=v,this.numIntersection=h?this.numPlanes:0,this.numPlanes+=y}};function c(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function l(u,h,f,d){var m=u!==null?u.length:0,g=null;if(m!==0){if(g=s.value,d!==!0||g===null){var y=f+m*4,p=h.matrixWorldInverse;o.getNormalMatrix(p),(g===null||g.length<y)&&(g=new Float32Array(y));for(var v=0,_=f;v!==m;++v,_+=4)a.copy(u[v]).applyMatrix4(p,o),a.normal.toArray(g,_),g[_+3]=a.constant}s.value=g,s.needsUpdate=!0}return e.numPlanes=m,e.numIntersection=0,g}}function ng(e){var t={};return{get:function(n){if(t[n]!==void 0)return t[n];var r;switch(n){case"WEBGL_depth_texture":r=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=e.getExtension(n)}return r===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=r,r}}}function rg(e,t,n){var r=new WeakMap,i=new WeakMap;function a(u){var h=u.target,f=r.get(h);f.index!==null&&t.remove(f.index);for(var d in f.attributes)t.remove(f.attributes[d]);h.removeEventListener("dispose",a),r.delete(h);var m=i.get(f);m&&(t.remove(m),i.delete(f)),n.memory.geometries--}function o(u,h){var f=r.get(h);return f||(h.addEventListener("dispose",a),h.isBufferGeometry?f=h:h.isGeometry&&(h._bufferGeometry===void 0&&(h._bufferGeometry=new ge().setFromObject(u)),f=h._bufferGeometry),r.set(h,f),n.memory.geometries++,f)}function s(u){var h=u.index,f=u.attributes;h!==null&&t.update(h,34963);for(var d in f)t.update(f[d],34962);var m=u.morphAttributes;for(var d in m)for(var g=m[d],y=0,p=g.length;y<p;y++)t.update(g[y],34962)}function c(u){var h=[],f=u.index,d=u.attributes.position,m=0;if(f!==null){var g=f.array;m=f.version;for(var y=0,p=g.length;y<p;y+=3){var v=g[y+0],_=g[y+1],x=g[y+2];h.push(v,_,_,x,x,v)}}else{var g=d.array;m=d.version;for(var y=0,p=g.length/3-1;y<p;y+=3){var v=y+0,_=y+1,x=y+2;h.push(v,_,_,x,x,v)}}var b=new(Nh(h)>65535?ha:ua)(h,1);b.version=m,t.update(b,34963);var T=i.get(u);T&&t.remove(T),i.set(u,b)}function l(u){var h=i.get(u);if(h){var f=u.index;f!==null&&h.version<f.version&&c(u)}else c(u);return i.get(u)}return{get:o,update:s,getWireframeAttribute:l}}function ig(e,t,n,r){var i=r.isWebGL2,a;function o(f){a=f}var s,c;function l(f){s=f.type,c=f.bytesPerElement}function u(f,d){e.drawElements(a,d,s,f*c),n.update(d,a)}function h(f,d,m,g){if(g!==0){var y,p;if(i)y=e,p="drawElementsInstanced";else if(y=t.get("ANGLE_instanced_arrays"),p="drawElementsInstancedANGLE",y===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}y[p](a,m,s,d*c,g),n.update(m,a,g)}}this.setMode=o,this.setIndex=l,this.render=u,this.renderInstances=h}function ag(e){var t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(a,o,s){switch(s=s||1,n.calls++,o){case 4:n.triangles+=s*(a/3);break;case 1:n.lines+=s*(a/2);break;case 3:n.lines+=s*(a-1);break;case 2:n.lines+=s*a;break;case 0:n.points+=s*a;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function i(){n.frame++,n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:i,update:r}}function og(e,t){return Math.abs(t[1])-Math.abs(e[1])}function sg(e){var t={},n=new Float32Array(8);function r(i,a,o,s){var c=i.morphTargetInfluences,l=c===void 0?0:c.length,u=t[a.id];if(u===void 0){u=[];for(var h=0;h<l;h++)u[h]=[h,0];t[a.id]=u}for(var f=o.morphTargets&&a.morphAttributes.position,d=o.morphNormals&&a.morphAttributes.normal,h=0;h<l;h++){var m=u[h];m[1]!==0&&(f&&a.deleteAttribute("morphTarget"+h),d&&a.deleteAttribute("morphNormal"+h))}for(var h=0;h<l;h++){var m=u[h];m[0]=h,m[1]=c[h]}u.sort(og);for(var g=0,h=0;h<8;h++){var m=u[h];if(m){var y=m[0],p=m[1];if(p){f&&a.setAttribute("morphTarget"+h,f[y]),d&&a.setAttribute("morphNormal"+h,d[y]),n[h]=p,g+=p;continue}}n[h]=0}var v=a.morphTargetsRelative?1:1-g;s.getUniforms().setValue(e,"morphTargetBaseInfluence",v),s.getUniforms().setValue(e,"morphTargetInfluences",n)}return{update:r}}function lg(e,t,n,r){var i=new WeakMap;function a(s){var c=r.render.frame,l=s.geometry,u=t.get(s,l);return i.get(u)!==c&&(l.isGeometry&&u.updateFromObject(s),t.update(u),i.set(u,c)),s.isInstancedMesh&&n.update(s.instanceMatrix,34962),u}function o(){i=new WeakMap}return{update:a,dispose:o}}function hr(e,t,n,r,i,a,o,s,c,l){e=e!==void 0?e:[],t=t!==void 0?t:_c,o=o!==void 0?o:Ar,ot.call(this,e,t,n,r,i,a,o,s,c,l),this.flipY=!1}hr.prototype=Object.create(ot.prototype);hr.prototype.constructor=hr;hr.prototype.isCubeTexture=!0;Object.defineProperty(hr.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});function pa(e,t,n,r){ot.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=bt,this.minFilter=bt,this.wrapR=Vt,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}pa.prototype=Object.create(ot.prototype);pa.prototype.constructor=pa;pa.prototype.isDataTexture2DArray=!0;function va(e,t,n,r){ot.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:r||1},this.magFilter=bt,this.minFilter=bt,this.wrapR=Vt,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}va.prototype=Object.create(ot.prototype);va.prototype.constructor=va;va.prototype.isDataTexture3D=!0;var Uh=new ot,cg=new pa,ug=new va,zh=new hr,fu=[],du=[],pu=new Float32Array(16),vu=new Float32Array(9),mu=new Float32Array(4);function Fi(e,t,n){var r=e[0];if(r<=0||r>0)return e;var i=t*n,a=fu[i];if(a===void 0&&(a=new Float32Array(i),fu[i]=a),t!==0){r.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function tn(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function Yt(e,t){for(var n=0,r=t.length;n<r;n++)e[n]=t[n]}function Gh(e,t){var n=du[t];n===void 0&&(n=new Int32Array(t),du[t]=n);for(var r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function hg(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function fg(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(tn(n,t))return;e.uniform2fv(this.addr,t),Yt(n,t)}}function dg(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(t.r!==void 0)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(tn(n,t))return;e.uniform3fv(this.addr,t),Yt(n,t)}}function pg(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(tn(n,t))return;e.uniform4fv(this.addr,t),Yt(n,t)}}function vg(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(tn(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Yt(n,t)}else{if(tn(n,r))return;mu.set(r),e.uniformMatrix2fv(this.addr,!1,mu),Yt(n,r)}}function mg(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(tn(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Yt(n,t)}else{if(tn(n,r))return;vu.set(r),e.uniformMatrix3fv(this.addr,!1,vu),Yt(n,r)}}function gg(e,t){var n=this.cache,r=t.elements;if(r===void 0){if(tn(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Yt(n,t)}else{if(tn(n,r))return;pu.set(r),e.uniformMatrix4fv(this.addr,!1,pu),Yt(n,r)}}function yg(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTexture2D(t||Uh,i)}function xg(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(t||cg,i)}function _g(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(t||ug,i)}function bg(e,t,n){var r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(e.uniform1i(this.addr,i),r[0]=i),n.safeSetTextureCube(t||zh,i)}function wg(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Mg(e,t){var n=this.cache;tn(n,t)||(e.uniform2iv(this.addr,t),Yt(n,t))}function Eg(e,t){var n=this.cache;tn(n,t)||(e.uniform3iv(this.addr,t),Yt(n,t))}function Tg(e,t){var n=this.cache;tn(n,t)||(e.uniform4iv(this.addr,t),Yt(n,t))}function Sg(e,t){var n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Ag(e){switch(e){case 5126:return hg;case 35664:return fg;case 35665:return dg;case 35666:return pg;case 35674:return vg;case 35675:return mg;case 35676:return gg;case 5124:case 35670:return wg;case 35667:case 35671:return Mg;case 35668:case 35672:return Eg;case 35669:case 35673:return Tg;case 5125:return Sg;case 35678:case 36198:case 36298:case 36306:case 35682:return yg;case 35679:case 36299:case 36307:return _g;case 35680:case 36300:case 36308:case 36293:return bg;case 36289:case 36303:case 36311:case 36292:return xg}}function Lg(e,t){e.uniform1fv(this.addr,t)}function Pg(e,t){e.uniform1iv(this.addr,t)}function Cg(e,t){e.uniform2iv(this.addr,t)}function Rg(e,t){e.uniform3iv(this.addr,t)}function Og(e,t){e.uniform4iv(this.addr,t)}function Dg(e,t){var n=Fi(t,this.size,2);e.uniform2fv(this.addr,n)}function Ig(e,t){var n=Fi(t,this.size,3);e.uniform3fv(this.addr,n)}function Ng(e,t){var n=Fi(t,this.size,4);e.uniform4fv(this.addr,n)}function Fg(e,t){var n=Fi(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Bg(e,t){var n=Fi(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Ug(e,t){var n=Fi(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function zg(e,t,n){var r=t.length,i=Gh(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTexture2D(t[a]||Uh,i[a])}function Gg(e,t,n){var r=t.length,i=Gh(n,r);e.uniform1iv(this.addr,i);for(var a=0;a!==r;++a)n.safeSetTextureCube(t[a]||zh,i[a])}function Hg(e){switch(e){case 5126:return Lg;case 35664:return Dg;case 35665:return Ig;case 35666:return Ng;case 35674:return Fg;case 35675:return Bg;case 35676:return Ug;case 5124:case 35670:return Pg;case 35667:case 35671:return Cg;case 35668:case 35672:return Rg;case 35669:case 35673:return Og;case 35678:case 36198:case 36298:case 36306:case 35682:return zg;case 35680:case 36300:case 36308:case 36293:return Gg}}function Vg(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=Ag(t.type)}function Hh(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=Hg(t.type)}Hh.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Yt(t,e)};function Vh(e){this.id=e,this.seq=[],this.map={}}Vh.prototype.setValue=function(e,t,n){for(var r=this.seq,i=0,a=r.length;i!==a;++i){var o=r[i];o.setValue(e,t[o.id],n)}};var sl=/([\w\d_]+)(\])?(\[|\.)?/g;function gu(e,t){e.seq.push(t),e.map[t.id]=t}function kg(e,t,n){var r=e.name,i=r.length;for(sl.lastIndex=0;;){var a=sl.exec(r),o=sl.lastIndex,s=a[1],c=a[2]==="]",l=a[3];if(c&&(s=s|0),l===void 0||l==="["&&o+2===i){gu(n,l===void 0?new Vg(s,e,t):new Hh(s,e,t));break}else{var u=n.map,h=u[s];h===void 0&&(h=new Vh(s),gu(n,h)),n=h}}}function lr(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),r=0;r<n;++r){var i=e.getActiveUniform(t,r),a=e.getUniformLocation(t,i.name);kg(i,a,this)}}lr.prototype.setValue=function(e,t,n,r){var i=this.map[t];i!==void 0&&i.setValue(e,n,r)};lr.prototype.setOptional=function(e,t,n){var r=t[n];r!==void 0&&this.setValue(e,n,r)};lr.upload=function(e,t,n,r){for(var i=0,a=t.length;i!==a;++i){var o=t[i],s=n[o.id];s.needsUpdate!==!1&&o.setValue(e,s.value,r)}};lr.seqWithValue=function(e,t){for(var n=[],r=0,i=e.length;r!==i;++r){var a=e[r];a.id in t&&n.push(a)}return n};function yu(e,t,n){var r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}var Wg=0;function Xg(e){for(var t=e.split(`
3065
- `),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join(`
3066
- `)}function kh(e){switch(e){case kt:return["Linear","( value )"];case Ls:return["sRGB","( value )"];case Sc:return["RGBE","( value )"];case Ch:return["RGBM","( value, 7.0 )"];case Rh:return["RGBM","( value, 16.0 )"];case Oh:return["RGBD","( value, 256.0 )"];case Tc:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case cp:return["LogLuv","( value )"];default:throw new Error("unsupported encoding: "+e)}}function xu(e,t,n){var r=e.getShaderParameter(t,35713),i=e.getShaderInfoLog(t).trim();if(r&&i==="")return"";var a=e.getShaderSource(t);return"THREE.WebGLShader: gl.getShaderInfoLog() "+n+`
3067
- `+i+Xg(a)}function Wi(e,t){var n=kh(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function jg(e,t){var n=kh(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function qg(e,t){var n;switch(t){case Th:n="Linear";break;case cd:n="Reinhard";break;case ud:n="Uncharted2";break;case hd:n="OptimizedCineon";break;case fd:n="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function Yg(e){var t=[e.extensionDerivatives||e.envMapCubeUV||e.bumpMap||e.tangentSpaceNormalMap||e.clearcoatNormalMap||e.flatShading||e.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(e.extensionFragDepth||e.logarithmicDepthBuffer)&&e.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",e.extensionDrawBuffers&&e.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(e.extensionShaderTextureLOD||e.envMap)&&e.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""];return t.filter(ea).join(`
3068
- `)}function Zg(e){var t=[];for(var n in e){var r=e[n];r!==!1&&t.push("#define "+n+" "+r)}return t.join(`
3069
- `)}function Jg(e,t){for(var n={},r=e.getProgramParameter(t,35721),i=0;i<r;i++){var a=e.getActiveAttrib(t,i),o=a.name;n[o]=e.getAttribLocation(t,o)}return n}function ea(e){return e!==""}function _u(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 bu(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}var Qg=/^[ \t]*#include +<([\w\d./]+)>/gm;function Pl(e){return e.replace(Qg,$g)}function $g(e,t){var n=qe[t];if(n===void 0)throw new Error("Can not resolve #include <"+t+">");return Pl(n)}var Kg=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,ey=/#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g;function wu(e){return e.replace(ey,Wh).replace(Kg,ty)}function ty(e,t,n,r){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Wh(e,t,n,r)}function Wh(e,t,n,r){for(var i="",a=parseInt(t);a<parseInt(n);a++)i+=r.replace(/\[ i \]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return i}function Mu(e){var t="precision "+e.precision+` float;
3070
- precision `+e.precision+" int;";return e.precision==="highp"?t+=`
3071
- #define HIGH_PRECISION`:e.precision==="mediump"?t+=`
3072
- #define MEDIUM_PRECISION`:e.precision==="lowp"&&(t+=`
3073
- #define LOW_PRECISION`),t}function ny(e){var t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===bh?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===Hf?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===Ki&&(t="SHADOWMAP_TYPE_VSM"),t}function ry(e){var t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case _c:case bc:t="ENVMAP_TYPE_CUBE";break;case ka:case Mc:t="ENVMAP_TYPE_CUBE_UV";break;case Sh:case wc:t="ENVMAP_TYPE_EQUIREC";break;case Ah:t="ENVMAP_TYPE_SPHERE";break}return t}function iy(e){var t="ENVMAP_MODE_REFLECTION";if(e.envMap)switch(e.envMapMode){case bc:case wc:t="ENVMAP_MODE_REFRACTION";break}return t}function ay(e){var t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case Ss:t="ENVMAP_BLENDING_MULTIPLY";break;case sd:t="ENVMAP_BLENDING_MIX";break;case ld:t="ENVMAP_BLENDING_ADD";break}return t}function oy(e,t,n){var r=e.getContext(),i=n.defines,a=n.vertexShader,o=n.fragmentShader,s=ny(n),c=ry(n),l=iy(n),u=ay(n),h=e.gammaFactor>0?e.gammaFactor:1,f=n.isWebGL2?"":Yg(n),d=Zg(i),m=r.createProgram(),g,y;if(n.isRawShaderMaterial?(g=[d].filter(ea).join(`
3074
- `),g.length>0&&(g+=`
3075
- `),y=[f,d].filter(ea).join(`
3076
- `),y.length>0&&(y+=`
3077
- `)):(g=[Mu(n),"#define SHADER_NAME "+n.shaderName,d,n.instancing?"#define USE_INSTANCING":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+h,"#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+l:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+s:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
3078
- `].filter(ea).join(`
3079
- `),y=[f,Mu(n),"#define SHADER_NAME "+n.shaderName,d,n.alphaTest?"#define ALPHATEST "+n.alphaTest+(n.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+h,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+l:"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.sheen?"#define USE_SHEEN":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+s:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==na?"#define TONE_MAPPING":"",n.toneMapping!==na?qe.tonemapping_pars_fragment:"",n.toneMapping!==na?qg("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.outputEncoding||n.mapEncoding||n.matcapEncoding||n.envMapEncoding||n.emissiveMapEncoding||n.lightMapEncoding?qe.encodings_pars_fragment:"",n.mapEncoding?Wi("mapTexelToLinear",n.mapEncoding):"",n.matcapEncoding?Wi("matcapTexelToLinear",n.matcapEncoding):"",n.envMapEncoding?Wi("envMapTexelToLinear",n.envMapEncoding):"",n.emissiveMapEncoding?Wi("emissiveMapTexelToLinear",n.emissiveMapEncoding):"",n.lightMapEncoding?Wi("lightMapTexelToLinear",n.lightMapEncoding):"",n.outputEncoding?jg("linearToOutputTexel",n.outputEncoding):"",n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
3080
- `].filter(ea).join(`
3081
- `)),a=Pl(a),a=_u(a,n),a=bu(a,n),o=Pl(o),o=_u(o,n),o=bu(o,n),a=wu(a),o=wu(o),n.isWebGL2&&!n.isRawShaderMaterial){var p=!1,v=/^\s*#version\s+300\s+es\s*\n/;n.isShaderMaterial&&a.match(v)!==null&&o.match(v)!==null&&(p=!0,a=a.replace(v,""),o=o.replace(v,"")),g=[`#version 300 es
3082
- `,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3083
- `)+`
3084
- `+g,y=[`#version 300 es
3085
- `,"#define varying in",p?"":"out highp vec4 pc_fragColor;",p?"":"#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(`
3086
- `)+`
3087
- `+y}var _=g+a,x=y+o,b=yu(r,35633,_),T=yu(r,35632,x);if(r.attachShader(m,b),r.attachShader(m,T),n.index0AttributeName!==void 0?r.bindAttribLocation(m,0,n.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),e.debug.checkShaderErrors){var C=r.getProgramInfoLog(m).trim(),N=r.getShaderInfoLog(b).trim(),O=r.getShaderInfoLog(T).trim(),J=!0,F=!0;if(r.getProgramParameter(m,35714)===!1){J=!1;var B=xu(r,b,"vertex"),V=xu(r,T,"fragment");console.error("THREE.WebGLProgram: shader error: ",r.getError(),"35715",r.getProgramParameter(m,35715),"gl.getProgramInfoLog",C,B,V)}else C!==""?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",C):(N===""||O==="")&&(F=!1);F&&(this.diagnostics={runnable:J,programLog:C,vertexShader:{log:N,prefix:g},fragmentShader:{log:O,prefix:y}})}r.deleteShader(b),r.deleteShader(T);var Y;this.getUniforms=function(){return Y===void 0&&(Y=new lr(r,m)),Y};var D;return this.getAttributes=function(){return D===void 0&&(D=Jg(r,m)),D},this.destroy=function(){r.deleteProgram(m),this.program=void 0},this.name=n.shaderName,this.id=Wg++,this.cacheKey=t,this.usedTimes=1,this.program=m,this.vertexShader=b,this.fragmentShader=T,this}function sy(e,t,n){var r=[],i=n.isWebGL2,a=n.logarithmicDepthBuffer,o=n.floatVertexTextures,s=n.precision,c=n.maxVertexUniforms,l=n.vertexTextures,u={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"},h=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen"];function f(g,y){var p;if(y){var v=Un[y];p={name:g.type,uniforms:Pp.clone(v.uniforms),vertexShader:v.vertexShader,fragmentShader:v.fragmentShader}}else p={name:g.type,uniforms:g.uniforms,vertexShader:g.vertexShader,fragmentShader:g.fragmentShader};return p}function d(g){var y=g.skeleton,p=y.bones;if(o)return 1024;var v=c,_=Math.floor((v-20)/4),x=Math.min(_,p.length);return x<p.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+p.length+" bones. This GPU supports "+x+"."),0):x}function m(g){var y;return g?g.isTexture?y=g.encoding:g.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),y=g.texture.encoding):y=kt,y}this.getParameters=function(g,y,p,v,_,x,b){var T=v.fog,C=g.isMeshStandardMaterial?v.environment:null,N=g.envMap||C,O=u[g.type],J=b.isSkinnedMesh?d(b):0;g.precision!==null&&(s=n.getMaxPrecision(g.precision),s!==g.precision&&console.warn("THREE.WebGLProgram.getParameters:",g.precision,"not supported, using",s,"instead."));var F=f(g,O);g.onBeforeCompile(F,e);var B=e.getRenderTarget(),V={isWebGL2:i,shaderID:O,shaderName:F.name,uniforms:F.uniforms,vertexShader:F.vertexShader,fragmentShader:F.fragmentShader,defines:g.defines,isRawShaderMaterial:g.isRawShaderMaterial,isShaderMaterial:g.isShaderMaterial,precision:s,instancing:b.isInstancedMesh===!0,supportsVertexTextures:l,outputEncoding:B!==null?m(B.texture):e.outputEncoding,map:!!g.map,mapEncoding:m(g.map),matcap:!!g.matcap,matcapEncoding:m(g.matcap),envMap:!!N,envMapMode:N&&N.mapping,envMapEncoding:m(N),envMapCubeUV:!!N&&(N.mapping===ka||N.mapping===Mc),lightMap:!!g.lightMap,lightMapEncoding:m(g.lightMap),aoMap:!!g.aoMap,emissiveMap:!!g.emissiveMap,emissiveMapEncoding:m(g.emissiveMap),bumpMap:!!g.bumpMap,normalMap:!!g.normalMap,objectSpaceNormalMap:g.normalMapType===fp,tangentSpaceNormalMap:g.normalMapType===Di,clearcoatMap:!!g.clearcoatMap,clearcoatRoughnessMap:!!g.clearcoatRoughnessMap,clearcoatNormalMap:!!g.clearcoatNormalMap,displacementMap:!!g.displacementMap,roughnessMap:!!g.roughnessMap,metalnessMap:!!g.metalnessMap,specularMap:!!g.specularMap,alphaMap:!!g.alphaMap,gradientMap:!!g.gradientMap,sheen:!!g.sheen,combine:g.combine,vertexTangents:g.normalMap&&g.vertexTangents,vertexColors:g.vertexColors,vertexUvs:!!g.map||!!g.bumpMap||!!g.normalMap||!!g.specularMap||!!g.alphaMap||!!g.emissiveMap||!!g.roughnessMap||!!g.metalnessMap||!!g.clearcoatMap||!!g.clearcoatRoughnessMap||!!g.clearcoatNormalMap||!!g.displacementMap,uvsVertexOnly:!(g.map||g.bumpMap||g.normalMap||g.specularMap||g.alphaMap||g.emissiveMap||g.roughnessMap||g.metalnessMap||g.clearcoatNormalMap)&&!!g.displacementMap,fog:!!T,useFog:g.fog,fogExp2:T&&T.isFogExp2,flatShading:g.flatShading,sizeAttenuation:g.sizeAttenuation,logarithmicDepthBuffer:a,skinning:g.skinning&&J>0,maxBones:J,useVertexTexture:o,morphTargets:g.morphTargets,morphNormals:g.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:y.directional.length,numPointLights:y.point.length,numSpotLights:y.spot.length,numRectAreaLights:y.rectArea.length,numHemiLights:y.hemi.length,numDirLightShadows:y.directionalShadowMap.length,numPointLightShadows:y.pointShadowMap.length,numSpotLightShadows:y.spotShadowMap.length,numClippingPlanes:_,numClipIntersection:x,dithering:g.dithering,shadowMapEnabled:e.shadowMap.enabled&&p.length>0,shadowMapType:e.shadowMap.type,toneMapping:g.toneMapped?e.toneMapping:na,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:g.premultipliedAlpha,alphaTest:g.alphaTest,doubleSided:g.side===Ts,flipSided:g.side===Pt,depthPacking:g.depthPacking!==void 0?g.depthPacking:!1,index0AttributeName:g.index0AttributeName,extensionDerivatives:g.extensions&&g.extensions.derivatives,extensionFragDepth:g.extensions&&g.extensions.fragDepth,extensionDrawBuffers:g.extensions&&g.extensions.drawBuffers,extensionShaderTextureLOD:g.extensions&&g.extensions.shaderTextureLOD,rendererExtensionFragDepth:i||t.get("EXT_frag_depth")!==null,rendererExtensionDrawBuffers:i||t.get("WEBGL_draw_buffers")!==null,rendererExtensionShaderTextureLod:i||t.get("EXT_shader_texture_lod")!==null,onBeforeCompile:g.onBeforeCompile};return V},this.getProgramCacheKey=function(g){var y=[];if(g.shaderID?y.push(g.shaderID):(y.push(g.fragmentShader),y.push(g.vertexShader)),g.defines!==void 0)for(var p in g.defines)y.push(p),y.push(g.defines[p]);if(g.isRawShaderMaterial===void 0){for(var v=0;v<h.length;v++)y.push(g[h[v]]);y.push(e.outputEncoding),y.push(e.gammaFactor)}return y.push(g.onBeforeCompile.toString()),y.join()},this.acquireProgram=function(g,y){for(var p,v=0,_=r.length;v<_;v++){var x=r[v];if(x.cacheKey===y){p=x,++p.usedTimes;break}}return p===void 0&&(p=new oy(e,y,g),r.push(p)),p},this.releaseProgram=function(g){if(--g.usedTimes===0){var y=r.indexOf(g);r[y]=r[r.length-1],r.pop(),g.destroy()}},this.programs=r}function ly(){var e=new WeakMap;function t(a){var o=e.get(a);return o===void 0&&(o={},e.set(a,o)),o}function n(a){e.delete(a)}function r(a,o,s){e.get(a)[o]=s}function i(){e=new WeakMap}return{get:t,remove:n,update:r,dispose:i}}function cy(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function uy(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Eu(){var e=[],t=0,n=[],r=[],i={id:-1};function a(){t=0,n.length=0,r.length=0}function o(h,f,d,m,g,y){var p=e[t];return p===void 0?(p={id:h.id,object:h,geometry:f,material:d,program:d.program||i,groupOrder:m,renderOrder:h.renderOrder,z:g,group:y},e[t]=p):(p.id=h.id,p.object=h,p.geometry=f,p.material=d,p.program=d.program||i,p.groupOrder=m,p.renderOrder=h.renderOrder,p.z=g,p.group=y),t++,p}function s(h,f,d,m,g,y){var p=o(h,f,d,m,g,y);(d.transparent===!0?r:n).push(p)}function c(h,f,d,m,g,y){var p=o(h,f,d,m,g,y);(d.transparent===!0?r:n).unshift(p)}function l(h,f){n.length>1&&n.sort(h||cy),r.length>1&&r.sort(f||uy)}function u(){for(var h=t,f=e.length;h<f;h++){var d=e[h];if(d.id===null)break;d.id=null,d.object=null,d.geometry=null,d.material=null,d.program=null,d.group=null}}return{opaque:n,transparent:r,init:a,push:s,unshift:c,finish:u,sort:l}}function hy(){var e=new WeakMap;function t(i){var a=i.target;a.removeEventListener("dispose",t),e.delete(a)}function n(i,a){var o=e.get(i),s;return o===void 0?(s=new Eu,e.set(i,new WeakMap),e.get(i).set(a,s),i.addEventListener("dispose",t)):(s=o.get(a),s===void 0&&(s=new Eu,o.set(a,s))),s}function r(){e=new WeakMap}return{get:n,dispose:r}}function fy(){var e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new E,color:new pe};break;case"SpotLight":n={position:new E,direction:new E,color:new pe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new E,color:new pe,distance:0,decay:0};break;case"HemisphereLight":n={direction:new E,skyColor:new pe,groundColor:new pe};break;case"RectAreaLight":n={color:new pe,position:new E,halfWidth:new E,halfHeight:new E};break}return e[t.id]=n,n}}}function dy(){var e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];var n;switch(t.type){case"DirectionalLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new X};break;case"SpotLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new X};break;case"PointLight":n={shadowBias:0,shadowRadius:1,shadowMapSize:new X,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}var py=0;function vy(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function my(){for(var e=new fy,t=dy(),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:[],point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},r=0;r<9;r++)n.probe.push(new E);var i=new E,a=new We,o=new We;function s(c,l,u){for(var h=0,f=0,d=0,m=0;m<9;m++)n.probe[m].set(0,0,0);var g=0,y=0,p=0,v=0,_=0,x=0,b=0,T=0,C=u.matrixWorldInverse;c.sort(vy);for(var m=0,N=c.length;m<N;m++){var O=c[m],J=O.color,F=O.intensity,B=O.distance,V=O.shadow&&O.shadow.map?O.shadow.map.texture:null;if(O.isAmbientLight)h+=J.r*F,f+=J.g*F,d+=J.b*F;else if(O.isLightProbe)for(var Y=0;Y<9;Y++)n.probe[Y].addScaledVector(O.sh.coefficients[Y],F);else if(O.isDirectionalLight){var D=e.get(O);if(D.color.copy(O.color).multiplyScalar(O.intensity),D.direction.setFromMatrixPosition(O.matrixWorld),i.setFromMatrixPosition(O.target.matrixWorld),D.direction.sub(i),D.direction.transformDirection(C),O.castShadow){var z=O.shadow,k=t.get(O);k.shadowBias=z.bias,k.shadowRadius=z.radius,k.shadowMapSize=z.mapSize,n.directionalShadow[g]=k,n.directionalShadowMap[g]=V,n.directionalShadowMatrix[g]=O.shadow.matrix,x++}n.directional[g]=D,g++}else if(O.isSpotLight){var D=e.get(O);if(D.position.setFromMatrixPosition(O.matrixWorld),D.position.applyMatrix4(C),D.color.copy(J).multiplyScalar(F),D.distance=B,D.direction.setFromMatrixPosition(O.matrixWorld),i.setFromMatrixPosition(O.target.matrixWorld),D.direction.sub(i),D.direction.transformDirection(C),D.coneCos=Math.cos(O.angle),D.penumbraCos=Math.cos(O.angle*(1-O.penumbra)),D.decay=O.decay,O.castShadow){var z=O.shadow,k=t.get(O);k.shadowBias=z.bias,k.shadowRadius=z.radius,k.shadowMapSize=z.mapSize,n.spotShadow[p]=k,n.spotShadowMap[p]=V,n.spotShadowMatrix[p]=O.shadow.matrix,T++}n.spot[p]=D,p++}else if(O.isRectAreaLight){var D=e.get(O);D.color.copy(J).multiplyScalar(F),D.position.setFromMatrixPosition(O.matrixWorld),D.position.applyMatrix4(C),o.identity(),a.copy(O.matrixWorld),a.premultiply(C),o.extractRotation(a),D.halfWidth.set(O.width*.5,0,0),D.halfHeight.set(0,O.height*.5,0),D.halfWidth.applyMatrix4(o),D.halfHeight.applyMatrix4(o),n.rectArea[v]=D,v++}else if(O.isPointLight){var D=e.get(O);if(D.position.setFromMatrixPosition(O.matrixWorld),D.position.applyMatrix4(C),D.color.copy(O.color).multiplyScalar(O.intensity),D.distance=O.distance,D.decay=O.decay,O.castShadow){var z=O.shadow,k=t.get(O);k.shadowBias=z.bias,k.shadowRadius=z.radius,k.shadowMapSize=z.mapSize,k.shadowCameraNear=z.camera.near,k.shadowCameraFar=z.camera.far,n.pointShadow[y]=k,n.pointShadowMap[y]=V,n.pointShadowMatrix[y]=O.shadow.matrix,b++}n.point[y]=D,y++}else if(O.isHemisphereLight){var D=e.get(O);D.direction.setFromMatrixPosition(O.matrixWorld),D.direction.transformDirection(C),D.direction.normalize(),D.skyColor.copy(O.color).multiplyScalar(F),D.groundColor.copy(O.groundColor).multiplyScalar(F),n.hemi[_]=D,_++}}n.ambient[0]=h,n.ambient[1]=f,n.ambient[2]=d;var q=n.hash;(q.directionalLength!==g||q.pointLength!==y||q.spotLength!==p||q.rectAreaLength!==v||q.hemiLength!==_||q.numDirectionalShadows!==x||q.numPointShadows!==b||q.numSpotShadows!==T)&&(n.directional.length=g,n.spot.length=p,n.rectArea.length=v,n.point.length=y,n.hemi.length=_,n.directionalShadow.length=x,n.directionalShadowMap.length=x,n.pointShadow.length=b,n.pointShadowMap.length=b,n.spotShadow.length=T,n.spotShadowMap.length=T,n.directionalShadowMatrix.length=x,n.pointShadowMatrix.length=b,n.spotShadowMatrix.length=T,q.directionalLength=g,q.pointLength=y,q.spotLength=p,q.rectAreaLength=v,q.hemiLength=_,q.numDirectionalShadows=x,q.numPointShadows=b,q.numSpotShadows=T,n.version=py++)}return{setup:s,state:n}}function Tu(){var e=new my,t=[],n=[];function r(){t.length=0,n.length=0}function i(c){t.push(c)}function a(c){n.push(c)}function o(c){e.setup(t,n,c)}var s={lightsArray:t,shadowsArray:n,lights:e};return{init:r,state:s,setupLights:o,pushLight:i,pushShadow:a}}function gy(){var e=new WeakMap;function t(i){var a=i.target;a.removeEventListener("dispose",t),e.delete(a)}function n(i,a){var o;return e.has(i)===!1?(o=new Tu,e.set(i,new WeakMap),e.get(i).set(a,o),i.addEventListener("dispose",t)):e.get(i).has(a)===!1?(o=new Tu,e.get(i).set(a,o)):o=e.get(i).get(a),o}function r(){e=new WeakMap}return{get:n,dispose:r}}function Cr(e){Ie.call(this),this.type="MeshDepthMaterial",this.depthPacking=up,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}Cr.prototype=Object.create(Ie.prototype);Cr.prototype.constructor=Cr;Cr.prototype.isMeshDepthMaterial=!0;Cr.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this};function Rr(e){Ie.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new E,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}Rr.prototype=Object.create(Ie.prototype);Rr.prototype.constructor=Rr;Rr.prototype.isMeshDistanceMaterial=!0;Rr.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};var yy=`uniform sampler2D shadow_pass;
3088
- uniform vec2 resolution;
3089
- uniform float radius;
3090
- #include <packing>
3091
- void main() {
3092
- float mean = 0.0;
3093
- float squared_mean = 0.0;
3094
- float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );
3095
- for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {
3096
- #ifdef HORIZONAL_PASS
3097
- vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );
3098
- mean += distribution.x;
3099
- squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3100
- #else
3101
- float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );
3102
- mean += depth;
3103
- squared_mean += depth * depth;
3104
- #endif
3105
- }
3106
- mean = mean * HALF_SAMPLE_RATE;
3107
- squared_mean = squared_mean * HALF_SAMPLE_RATE;
3108
- float std_dev = sqrt( squared_mean - mean * mean );
3109
- gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3110
- }`,xy=`void main() {
3111
- gl_Position = vec4( position, 1.0 );
3112
- }`;function Xh(e,t,n){var r=new Xa,i=new X,a=new X,o=new tt,s=[],c=[],l={},u={0:Pt,1:Va,2:Ts},h=new Wt({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new X},radius:{value:4}},vertexShader:xy,fragmentShader:yy}),f=h.clone();f.defines.HORIZONAL_PASS=1;var d=new ge;d.setAttribute("position",new De(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var m=new ft(d,h),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=bh,this.render=function(b,T,C){if(g.enabled!==!1&&!(g.autoUpdate===!1&&g.needsUpdate===!1)&&b.length!==0){var N=e.getRenderTarget(),O=e.getActiveCubeFace(),J=e.getActiveMipmapLevel(),F=e.state;F.setBlending(sr),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);for(var B=0,V=b.length;B<V;B++){var Y=b[B],D=Y.shadow;if(D===void 0){console.warn("THREE.WebGLShadowMap:",Y,"has no shadow.");continue}i.copy(D.mapSize);var z=D.getFrameExtents();if(i.multiply(z),a.copy(D.mapSize),(i.x>n||i.y>n)&&(i.x>n&&(a.x=Math.floor(n/z.x),i.x=a.x*z.x,D.mapSize.x=a.x),i.y>n&&(a.y=Math.floor(n/z.y),i.y=a.y*z.y,D.mapSize.y=a.y)),D.map===null&&!D.isPointLightShadow&&this.type===Ki){var k={minFilter:It,magFilter:It,format:fn};D.map=new Kt(i.x,i.y,k),D.map.texture.name=Y.name+".shadowMap",D.mapPass=new Kt(i.x,i.y,k),D.camera.updateProjectionMatrix()}if(D.map===null){var k={minFilter:bt,magFilter:bt,format:fn};D.map=new Kt(i.x,i.y,k),D.map.texture.name=Y.name+".shadowMap",D.camera.updateProjectionMatrix()}e.setRenderTarget(D.map),e.clear();for(var q=D.getViewportCount(),Z=0;Z<q;Z++){var ee=D.getViewport(Z);o.set(a.x*ee.x,a.y*ee.y,a.x*ee.z,a.y*ee.w),F.viewport(o),D.updateMatrices(Y,Z),r=D.getFrustum(),x(T,C,D.camera,Y,this.type)}!D.isPointLightShadow&&this.type===Ki&&y(D,C)}g.needsUpdate=!1,e.setRenderTarget(N,O,J)}};function y(b,T){var C=t.update(m);h.uniforms.shadow_pass.value=b.map.texture,h.uniforms.resolution.value=b.mapSize,h.uniforms.radius.value=b.radius,e.setRenderTarget(b.mapPass),e.clear(),e.renderBufferDirect(T,null,C,h,m,null),f.uniforms.shadow_pass.value=b.mapPass.texture,f.uniforms.resolution.value=b.mapSize,f.uniforms.radius.value=b.radius,e.setRenderTarget(b.map),e.clear(),e.renderBufferDirect(T,null,C,f,m,null)}function p(b,T,C){var N=b<<0|T<<1|C<<2,O=s[N];return O===void 0&&(O=new Cr({depthPacking:hp,morphTargets:b,skinning:T}),s[N]=O),O}function v(b,T,C){var N=b<<0|T<<1|C<<2,O=c[N];return O===void 0&&(O=new Rr({morphTargets:b,skinning:T}),c[N]=O),O}function _(b,T,C,N,O,J,F){var B=null,V=p,Y=b.customDepthMaterial;if(N.isPointLight===!0&&(V=v,Y=b.customDistanceMaterial),Y===void 0){var D=!1;C.morphTargets===!0&&(D=T.morphAttributes&&T.morphAttributes.position&&T.morphAttributes.position.length>0);var z=!1;b.isSkinnedMesh===!0&&(C.skinning===!0?z=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",b));var k=b.isInstancedMesh===!0;B=V(D,z,k)}else B=Y;if(e.localClippingEnabled&&C.clipShadows===!0&&C.clippingPlanes.length!==0){var q=B.uuid,Z=C.uuid,ee=l[q];ee===void 0&&(ee={},l[q]=ee);var te=ee[Z];te===void 0&&(te=B.clone(),ee[Z]=te),B=te}return B.visible=C.visible,B.wireframe=C.wireframe,F===Ki?B.side=C.shadowSide!==null?C.shadowSide:C.side:B.side=C.shadowSide!==null?C.shadowSide:u[C.side],B.clipShadows=C.clipShadows,B.clippingPlanes=C.clippingPlanes,B.clipIntersection=C.clipIntersection,B.wireframeLinewidth=C.wireframeLinewidth,B.linewidth=C.linewidth,N.isPointLight===!0&&B.isMeshDistanceMaterial===!0&&(B.referencePosition.setFromMatrixPosition(N.matrixWorld),B.nearDistance=O,B.farDistance=J),B}function x(b,T,C,N,O){if(b.visible!==!1){var J=b.layers.test(T.layers);if(J&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&O===Ki)&&(!b.frustumCulled||r.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,b.matrixWorld);var F=t.update(b),B=b.material;if(Array.isArray(B))for(var V=F.groups,Y=0,D=V.length;Y<D;Y++){var z=V[Y],k=B[z.materialIndex];if(k&&k.visible){var q=_(b,F,k,N,C.near,C.far,O);e.renderBufferDirect(C,null,F,q,b,z)}}else if(B.visible){var q=_(b,F,B,N,C.near,C.far,O);e.renderBufferDirect(C,null,F,q,b,null)}}for(var Z=b.children,ee=0,te=Z.length;ee<te;ee++)x(Z[ee],T,C,N,O)}}}function _y(e,t,n){var r=n.isWebGL2;function i(){var I=!1,be=new tt,Me=null,Ve=new tt(0,0,0,0);return{setMask:function(Ee){Me!==Ee&&!I&&(e.colorMask(Ee,Ee,Ee,Ee),Me=Ee)},setLocked:function(Ee){I=Ee},setClear:function(Ee,Ze,rt,dt,Ft){Ft===!0&&(Ee*=dt,Ze*=dt,rt*=dt),be.set(Ee,Ze,rt,dt),Ve.equals(be)===!1&&(e.clearColor(Ee,Ze,rt,dt),Ve.copy(be))},reset:function(){I=!1,Me=null,Ve.set(-1,0,0,0)}}}function a(){var I=!1,be=null,Me=null,Ve=null;return{setTest:function(Ee){Ee?Te(2929):ue(2929)},setMask:function(Ee){be!==Ee&&!I&&(e.depthMask(Ee),be=Ee)},setFunc:function(Ee){if(Me!==Ee){if(Ee)switch(Ee){case ed:e.depthFunc(512);break;case td:e.depthFunc(519);break;case nd:e.depthFunc(513);break;case _l:e.depthFunc(515);break;case rd:e.depthFunc(514);break;case id:e.depthFunc(518);break;case ad:e.depthFunc(516);break;case od:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);Me=Ee}},setLocked:function(Ee){I=Ee},setClear:function(Ee){Ve!==Ee&&(e.clearDepth(Ee),Ve=Ee)},reset:function(){I=!1,be=null,Me=null,Ve=null}}}function o(){var I=!1,be=null,Me=null,Ve=null,Ee=null,Ze=null,rt=null,dt=null,Ft=null;return{setTest:function(it){I||(it?Te(2960):ue(2960))},setMask:function(it){be!==it&&!I&&(e.stencilMask(it),be=it)},setFunc:function(it,At,Ct){(Me!==it||Ve!==At||Ee!==Ct)&&(e.stencilFunc(it,At,Ct),Me=it,Ve=At,Ee=Ct)},setOp:function(it,At,Ct){(Ze!==it||rt!==At||dt!==Ct)&&(e.stencilOp(it,At,Ct),Ze=it,rt=At,dt=Ct)},setLocked:function(it){I=it},setClear:function(it){Ft!==it&&(e.clearStencil(it),Ft=it)},reset:function(){I=!1,be=null,Me=null,Ve=null,Ee=null,Ze=null,rt=null,dt=null,Ft=null}}}var s=new i,c=new a,l=new o,u=e.getParameter(34921),h=new Uint8Array(u),f=new Uint8Array(u),d=new Uint8Array(u),m={},g=null,y=null,p=null,v=null,_=null,x=null,b=null,T=null,C=null,N=!1,O=null,J=null,F=null,B=null,V=null,Y=e.getParameter(35661),D=!1,z=0,k=e.getParameter(7938);k.indexOf("WebGL")!==-1?(z=parseFloat(/^WebGL\ ([0-9])/.exec(k)[1]),D=z>=1):k.indexOf("OpenGL ES")!==-1&&(z=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(k)[1]),D=z>=2);var q=null,Z={},ee=new tt,te=new tt;function ae(I,be,Me){var Ve=new Uint8Array(4),Ee=e.createTexture();e.bindTexture(I,Ee),e.texParameteri(I,10241,9728),e.texParameteri(I,10240,9728);for(var Ze=0;Ze<Me;Ze++)e.texImage2D(be+Ze,0,6408,1,1,0,6408,5121,Ve);return Ee}var Pe={};Pe[3553]=ae(3553,3553,1),Pe[34067]=ae(34067,34069,6),s.setClear(0,0,0,1),c.setClear(1),l.setClear(0),Te(2929),c.setFunc(_l),A(!1),L(Gc),Te(2884),et(sr);function _e(){for(var I=0,be=h.length;I<be;I++)h[I]=0}function re(I){G(I,0)}function G(I,be){if(h[I]=1,f[I]===0&&(e.enableVertexAttribArray(I),f[I]=1),d[I]!==be){var Me=r?e:t.get("ANGLE_instanced_arrays");Me[r?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](I,be),d[I]=be}}function Be(){for(var I=0,be=f.length;I!==be;++I)f[I]!==h[I]&&(e.disableVertexAttribArray(I),f[I]=0)}function xe(I,be,Me,Ve,Ee,Ze){r===!0&&(Me===5124||Me===5125)?e.vertexAttribIPointer(I,be,Me,Ve,Ee,Ze):e.vertexAttribPointer(I,be,Me,Ve,Ee,Ze)}function Te(I){m[I]!==!0&&(e.enable(I),m[I]=!0)}function ue(I){m[I]!==!1&&(e.disable(I),m[I]=!1)}function K(I){return g!==I?(e.useProgram(I),g=I,!0):!1}var Ce={[ii]:32774,[kf]:32778,[Wf]:32779};if(r)Ce[Wc]=32775,Ce[Xc]=32776;else{var Ye=t.get("EXT_blend_minmax");Ye!==null&&(Ce[Wc]=Ye.MIN_EXT,Ce[Xc]=Ye.MAX_EXT)}var Qe={[Xf]:0,[jf]:1,[qf]:768,[Mh]:770,[Kf]:776,[Qf]:774,[Zf]:772,[Yf]:769,[Eh]:771,[$f]:775,[Jf]:773};function et(I,be,Me,Ve,Ee,Ze,rt,dt){if(I===sr){y&&(ue(3042),y=!1);return}if(y||(Te(3042),y=!0),I!==Vf){if(I!==p||dt!==N){if((v!==ii||b!==ii)&&(e.blendEquation(32774),v=ii,b=ii),dt)switch(I){case ta:e.blendFuncSeparate(1,771,1,771);break;case Hc:e.blendFunc(1,1);break;case Vc:e.blendFuncSeparate(0,0,769,771);break;case kc:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",I);break}else switch(I){case ta:e.blendFuncSeparate(770,771,1,771);break;case Hc:e.blendFunc(770,1);break;case Vc:e.blendFunc(0,769);break;case kc:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",I);break}_=null,x=null,T=null,C=null,p=I,N=dt}return}Ee=Ee||be,Ze=Ze||Me,rt=rt||Ve,(be!==v||Ee!==b)&&(e.blendEquationSeparate(Ce[be],Ce[Ee]),v=be,b=Ee),(Me!==_||Ve!==x||Ze!==T||rt!==C)&&(e.blendFuncSeparate(Qe[Me],Qe[Ve],Qe[Ze],Qe[rt]),_=Me,x=Ve,T=Ze,C=rt),p=I,N=null}function Ke(I,be){I.side===Ts?ue(2884):Te(2884);var Me=I.side===Pt;be&&(Me=!Me),A(Me),I.blending===ta&&I.transparent===!1?et(sr):et(I.blending,I.blendEquation,I.blendSrc,I.blendDst,I.blendEquationAlpha,I.blendSrcAlpha,I.blendDstAlpha,I.premultipliedAlpha),c.setFunc(I.depthFunc),c.setTest(I.depthTest),c.setMask(I.depthWrite),s.setMask(I.colorWrite);var Ve=I.stencilWrite;l.setTest(Ve),Ve&&(l.setMask(I.stencilWriteMask),l.setFunc(I.stencilFunc,I.stencilRef,I.stencilFuncMask),l.setOp(I.stencilFail,I.stencilZFail,I.stencilZPass)),$(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits)}function A(I){O!==I&&(I?e.frontFace(2304):e.frontFace(2305),O=I)}function L(I){I!==zf?(Te(2884),I!==J&&(I===Gc?e.cullFace(1029):I===Gf?e.cullFace(1028):e.cullFace(1032))):ue(2884),J=I}function ne(I){I!==F&&(D&&e.lineWidth(I),F=I)}function $(I,be,Me){I?(Te(32823),(B!==be||V!==Me)&&(e.polygonOffset(be,Me),B=be,V=Me)):ue(32823)}function Ne(I){I?Te(3089):ue(3089)}function ye(I){I===void 0&&(I=33984+Y-1),q!==I&&(e.activeTexture(I),q=I)}function R(I,be){q===null&&ye();var Me=Z[q];Me===void 0&&(Me={type:void 0,texture:void 0},Z[q]=Me),(Me.type!==I||Me.texture!==be)&&(e.bindTexture(I,be||Pe[I]),Me.type=I,Me.texture=be)}function he(){var I=Z[q];I!==void 0&&I.type!==void 0&&(e.bindTexture(I.type,null),I.type=void 0,I.texture=void 0)}function fe(){try{e.compressedTexImage2D.apply(e,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function ve(){try{e.texImage2D.apply(e,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function ie(){try{e.texImage3D.apply(e,arguments)}catch(I){console.error("THREE.WebGLState:",I)}}function Se(I){ee.equals(I)===!1&&(e.scissor(I.x,I.y,I.z,I.w),ee.copy(I))}function de(I){te.equals(I)===!1&&(e.viewport(I.x,I.y,I.z,I.w),te.copy(I))}function Re(){for(var I=0;I<f.length;I++)f[I]===1&&(e.disableVertexAttribArray(I),f[I]=0);m={},q=null,Z={},g=null,p=null,O=null,J=null,s.reset(),c.reset(),l.reset()}return{buffers:{color:s,depth:c,stencil:l},initAttributes:_e,enableAttribute:re,enableAttributeAndDivisor:G,disableUnusedAttributes:Be,vertexAttribPointer:xe,enable:Te,disable:ue,useProgram:K,setBlending:et,setMaterial:Ke,setFlipSided:A,setCullFace:L,setLineWidth:ne,setPolygonOffset:$,setScissorTest:Ne,activeTexture:ye,bindTexture:R,unbindTexture:he,compressedTexImage2D:fe,texImage2D:ve,texImage3D:ie,scissor:Se,viewport:de,reset:Re}}function by(e,t,n,r,i,a,o){var s=i.isWebGL2,c=i.maxTextures,l=i.maxCubemapSize,u=i.maxTextureSize,h=i.maxSamples,f=new WeakMap,d,m=!1;try{m=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(A){}function g(A,L){return m?new OffscreenCanvas(A,L):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function y(A,L,ne,$){var Ne=1;if((A.width>$||A.height>$)&&(Ne=$/Math.max(A.width,A.height)),Ne<1||L===!0)if(typeof HTMLImageElement!="undefined"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&A instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&A instanceof ImageBitmap){var ye=L?ke.floorPowerOfTwo:Math.floor,R=ye(Ne*A.width),he=ye(Ne*A.height);d===void 0&&(d=g(R,he));var fe=ne?g(R,he):d;fe.width=R,fe.height=he;var ve=fe.getContext("2d");return ve.drawImage(A,0,0,R,he),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+A.width+"x"+A.height+") to ("+R+"x"+he+")."),fe}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+A.width+"x"+A.height+")."),A;return A}function p(A){return ke.isPowerOfTwo(A.width)&&ke.isPowerOfTwo(A.height)}function v(A){return s?!1:A.wrapS!==Vt||A.wrapT!==Vt||A.minFilter!==bt&&A.minFilter!==It}function _(A,L){return A.generateMipmaps&&L&&A.minFilter!==bt&&A.minFilter!==It}function x(A,L,ne,$){e.generateMipmap(A);var Ne=r.get(L);Ne.__maxMipLevel=Math.log(Math.max(ne,$))*Math.LOG2E}function b(A,L,ne){if(s===!1)return L;if(A!==null){if(e[A]!==void 0)return e[A];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}var $=L;return L===6403&&(ne===5126&&($=33326),ne===5131&&($=33325),ne===5121&&($=33321)),L===6407&&(ne===5126&&($=34837),ne===5131&&($=34843),ne===5121&&($=32849)),L===6408&&(ne===5126&&($=34836),ne===5131&&($=34842),ne===5121&&($=32856)),($===33325||$===33326||$===34842||$===34836)&&t.get("EXT_color_buffer_float"),$}function T(A){return A===bt||A===bl||A===wl?9728:9729}function C(A){var L=A.target;L.removeEventListener("dispose",C),O(L),L.isVideoTexture&&f.delete(L),o.memory.textures--}function N(A){var L=A.target;L.removeEventListener("dispose",N),J(L),o.memory.textures--}function O(A){var L=r.get(A);L.__webglInit!==void 0&&(e.deleteTexture(L.__webglTexture),r.remove(A))}function J(A){var L=r.get(A),ne=r.get(A.texture);if(A){if(ne.__webglTexture!==void 0&&e.deleteTexture(ne.__webglTexture),A.depthTexture&&A.depthTexture.dispose(),A.isWebGLCubeRenderTarget)for(var $=0;$<6;$++)e.deleteFramebuffer(L.__webglFramebuffer[$]),L.__webglDepthbuffer&&e.deleteRenderbuffer(L.__webglDepthbuffer[$]);else e.deleteFramebuffer(L.__webglFramebuffer),L.__webglDepthbuffer&&e.deleteRenderbuffer(L.__webglDepthbuffer),L.__webglMultisampledFramebuffer&&e.deleteFramebuffer(L.__webglMultisampledFramebuffer),L.__webglColorRenderbuffer&&e.deleteRenderbuffer(L.__webglColorRenderbuffer),L.__webglDepthRenderbuffer&&e.deleteRenderbuffer(L.__webglDepthRenderbuffer);r.remove(A.texture),r.remove(A)}}var F=0;function B(){F=0}function V(){var A=F;return A>=c&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+c),F+=1,A}function Y(A,L){var ne=r.get(A);if(A.isVideoTexture&&Ce(A),A.version>0&&ne.__version!==A.version){var $=A.image;if($===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if($.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Pe(ne,A,L);return}}n.activeTexture(33984+L),n.bindTexture(3553,ne.__webglTexture)}function D(A,L){var ne=r.get(A);if(A.version>0&&ne.__version!==A.version){Pe(ne,A,L);return}n.activeTexture(33984+L),n.bindTexture(35866,ne.__webglTexture)}function z(A,L){var ne=r.get(A);if(A.version>0&&ne.__version!==A.version){Pe(ne,A,L);return}n.activeTexture(33984+L),n.bindTexture(32879,ne.__webglTexture)}function k(A,L){if(A.image.length===6){var ne=r.get(A);if(A.version>0&&ne.__version!==A.version){ae(ne,A),n.activeTexture(33984+L),n.bindTexture(34067,ne.__webglTexture),e.pixelStorei(37440,A.flipY);for(var $=A&&(A.isCompressedTexture||A.image[0].isCompressedTexture),Ne=A.image[0]&&A.image[0].isDataTexture,ye=[],R=0;R<6;R++)!$&&!Ne?ye[R]=y(A.image[R],!1,!0,l):ye[R]=Ne?A.image[R].image:A.image[R];var he=ye[0],fe=p(he)||s,ve=a.convert(A.format),ie=a.convert(A.type),Se=b(A.internalFormat,ve,ie);te(34067,A,fe);var de;if($){for(var R=0;R<6;R++){de=ye[R].mipmaps;for(var Re=0;Re<de.length;Re++){var I=de[Re];A.format!==fn&&A.format!==Ar?ve!==null?n.compressedTexImage2D(34069+R,Re,Se,I.width,I.height,0,I.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+R,Re,Se,I.width,I.height,0,ve,ie,I.data)}}ne.__maxMipLevel=de.length-1}else{de=A.mipmaps;for(var R=0;R<6;R++)if(Ne){n.texImage2D(34069+R,0,Se,ye[R].width,ye[R].height,0,ve,ie,ye[R].data);for(var Re=0;Re<de.length;Re++){var I=de[Re],be=I.image[R].image;n.texImage2D(34069+R,Re+1,Se,be.width,be.height,0,ve,ie,be.data)}}else{n.texImage2D(34069+R,0,Se,ve,ie,ye[R]);for(var Re=0;Re<de.length;Re++){var I=de[Re];n.texImage2D(34069+R,Re+1,Se,ve,ie,I.image[R])}}ne.__maxMipLevel=de.length}_(A,fe)&&x(34067,A,he.width,he.height),ne.__version=A.version,A.onUpdate&&A.onUpdate(A)}else n.activeTexture(33984+L),n.bindTexture(34067,ne.__webglTexture)}}function q(A,L){n.activeTexture(33984+L),n.bindTexture(34067,r.get(A).__webglTexture)}var Z={[zo]:10497,[Vt]:33071,[Go]:33648},ee={[bt]:9728,[bl]:9984,[wl]:9986,[It]:9729,[Lh]:9985,[As]:9987};function te(A,L,ne){ne?(e.texParameteri(A,10242,Z[L.wrapS]),e.texParameteri(A,10243,Z[L.wrapT]),(A===32879||A===35866)&&e.texParameteri(A,32882,Z[L.wrapR]),e.texParameteri(A,10240,ee[L.magFilter]),e.texParameteri(A,10241,ee[L.minFilter])):(e.texParameteri(A,10242,33071),e.texParameteri(A,10243,33071),(A===32879||A===35866)&&e.texParameteri(A,32882,33071),(L.wrapS!==Vt||L.wrapT!==Vt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(A,10240,T(L.magFilter)),e.texParameteri(A,10241,T(L.minFilter)),L.minFilter!==bt&&L.minFilter!==It&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));var $=t.get("EXT_texture_filter_anisotropic");if($){if(L.type===ar&&t.get("OES_texture_float_linear")===null||L.type===Vo&&(s||t.get("OES_texture_half_float_linear"))===null)return;(L.anisotropy>1||r.get(L).__currentAnisotropy)&&(e.texParameterf(A,$.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,i.getMaxAnisotropy())),r.get(L).__currentAnisotropy=L.anisotropy)}}function ae(A,L){A.__webglInit===void 0&&(A.__webglInit=!0,L.addEventListener("dispose",C),A.__webglTexture=e.createTexture(),o.memory.textures++)}function Pe(A,L,ne){var $=3553;L.isDataTexture2DArray&&($=35866),L.isDataTexture3D&&($=32879),ae(A,L),n.activeTexture(33984+ne),n.bindTexture($,A.__webglTexture),e.pixelStorei(37440,L.flipY),e.pixelStorei(37441,L.premultiplyAlpha),e.pixelStorei(3317,L.unpackAlignment);var Ne=v(L)&&p(L.image)===!1,ye=y(L.image,Ne,!1,u),R=p(ye)||s,he=a.convert(L.format),fe=a.convert(L.type),ve=b(L.internalFormat,he,fe);te($,L,R);var ie,Se=L.mipmaps;if(L.isDepthTexture)ve=6402,s?L.type===ar?ve=36012:L.type===Io?ve=33190:L.type===ra?ve=35056:ve=33189:L.type===ar&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===hi&&ve===6402&&L.type!==Ho&&L.type!==Io&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=Ho,fe=a.convert(L.type)),L.format===sa&&ve===6402&&(ve=34041,L.type!==ra&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=ra,fe=a.convert(L.type))),n.texImage2D(3553,0,ve,ye.width,ye.height,0,he,fe,null);else if(L.isDataTexture)if(Se.length>0&&R){for(var de=0,Re=Se.length;de<Re;de++)ie=Se[de],n.texImage2D(3553,de,ve,ie.width,ie.height,0,he,fe,ie.data);L.generateMipmaps=!1,A.__maxMipLevel=Se.length-1}else n.texImage2D(3553,0,ve,ye.width,ye.height,0,he,fe,ye.data),A.__maxMipLevel=0;else if(L.isCompressedTexture){for(var de=0,Re=Se.length;de<Re;de++)ie=Se[de],L.format!==fn&&L.format!==Ar?he!==null?n.compressedTexImage2D(3553,de,ve,ie.width,ie.height,0,ie.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,de,ve,ie.width,ie.height,0,he,fe,ie.data);A.__maxMipLevel=Se.length-1}else if(L.isDataTexture2DArray)n.texImage3D(35866,0,ve,ye.width,ye.height,ye.depth,0,he,fe,ye.data),A.__maxMipLevel=0;else if(L.isDataTexture3D)n.texImage3D(32879,0,ve,ye.width,ye.height,ye.depth,0,he,fe,ye.data),A.__maxMipLevel=0;else if(Se.length>0&&R){for(var de=0,Re=Se.length;de<Re;de++)ie=Se[de],n.texImage2D(3553,de,ve,he,fe,ie);L.generateMipmaps=!1,A.__maxMipLevel=Se.length-1}else n.texImage2D(3553,0,ve,he,fe,ye),A.__maxMipLevel=0;_(L,R)&&x($,L,ye.width,ye.height),A.__version=L.version,L.onUpdate&&L.onUpdate(L)}function _e(A,L,ne,$){var Ne=a.convert(L.texture.format),ye=a.convert(L.texture.type),R=b(L.texture.internalFormat,Ne,ye);n.texImage2D($,0,R,L.width,L.height,0,Ne,ye,null),e.bindFramebuffer(36160,A),e.framebufferTexture2D(36160,ne,$,r.get(L.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function re(A,L,ne){if(e.bindRenderbuffer(36161,A),L.depthBuffer&&!L.stencilBuffer){var $=33189;if(ne){var Ne=L.depthTexture;Ne&&Ne.isDepthTexture&&(Ne.type===ar?$=36012:Ne.type===Io&&($=33190));var ye=K(L);e.renderbufferStorageMultisample(36161,ye,$,L.width,L.height)}else e.renderbufferStorage(36161,$,L.width,L.height);e.framebufferRenderbuffer(36160,36096,36161,A)}else if(L.depthBuffer&&L.stencilBuffer){if(ne){var ye=K(L);e.renderbufferStorageMultisample(36161,ye,35056,L.width,L.height)}else e.renderbufferStorage(36161,34041,L.width,L.height);e.framebufferRenderbuffer(36160,33306,36161,A)}else{var R=a.convert(L.texture.format),he=a.convert(L.texture.type),$=b(L.texture.internalFormat,R,he);if(ne){var ye=K(L);e.renderbufferStorageMultisample(36161,ye,$,L.width,L.height)}else e.renderbufferStorage(36161,$,L.width,L.height)}e.bindRenderbuffer(36161,null)}function G(A,L){var ne=L&&L.isWebGLCubeRenderTarget;if(ne)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,A),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(L.depthTexture).__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),Y(L.depthTexture,0);var $=r.get(L.depthTexture).__webglTexture;if(L.depthTexture.format===hi)e.framebufferTexture2D(36160,36096,3553,$,0);else if(L.depthTexture.format===sa)e.framebufferTexture2D(36160,33306,3553,$,0);else throw new Error("Unknown depthTexture format")}function Be(A){var L=r.get(A),ne=A.isWebGLCubeRenderTarget===!0;if(A.depthTexture){if(ne)throw new Error("target.depthTexture not supported in Cube render targets");G(L.__webglFramebuffer,A)}else if(ne){L.__webglDepthbuffer=[];for(var $=0;$<6;$++)e.bindFramebuffer(36160,L.__webglFramebuffer[$]),L.__webglDepthbuffer[$]=e.createRenderbuffer(),re(L.__webglDepthbuffer[$],A,!1)}else e.bindFramebuffer(36160,L.__webglFramebuffer),L.__webglDepthbuffer=e.createRenderbuffer(),re(L.__webglDepthbuffer,A,!1);e.bindFramebuffer(36160,null)}function xe(A){var L=r.get(A),ne=r.get(A.texture);A.addEventListener("dispose",N),ne.__webglTexture=e.createTexture(),o.memory.textures++;var $=A.isWebGLCubeRenderTarget===!0,Ne=A.isWebGLMultisampleRenderTarget===!0,ye=p(A)||s;if(s&&A.texture.format===Ar&&(A.texture.type===ar||A.texture.type===Vo)&&(A.texture.format=fn,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),$){L.__webglFramebuffer=[];for(var R=0;R<6;R++)L.__webglFramebuffer[R]=e.createFramebuffer()}else if(L.__webglFramebuffer=e.createFramebuffer(),Ne)if(s){L.__webglMultisampledFramebuffer=e.createFramebuffer(),L.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,L.__webglColorRenderbuffer);var he=a.convert(A.texture.format),fe=a.convert(A.texture.type),ve=b(A.texture.internalFormat,he,fe),ie=K(A);e.renderbufferStorageMultisample(36161,ie,ve,A.width,A.height),e.bindFramebuffer(36160,L.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,L.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),A.depthBuffer&&(L.__webglDepthRenderbuffer=e.createRenderbuffer(),re(L.__webglDepthRenderbuffer,A,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if($){n.bindTexture(34067,ne.__webglTexture),te(34067,A.texture,ye);for(var R=0;R<6;R++)_e(L.__webglFramebuffer[R],A,36064,34069+R);_(A.texture,ye)&&x(34067,A.texture,A.width,A.height),n.bindTexture(34067,null)}else n.bindTexture(3553,ne.__webglTexture),te(3553,A.texture,ye),_e(L.__webglFramebuffer,A,36064,3553),_(A.texture,ye)&&x(3553,A.texture,A.width,A.height),n.bindTexture(3553,null);A.depthBuffer&&Be(A)}function Te(A){var L=A.texture,ne=p(A)||s;if(_(L,ne)){var $=A.isWebGLCubeRenderTarget?34067:3553,Ne=r.get(L).__webglTexture;n.bindTexture($,Ne),x($,L,A.width,A.height),n.bindTexture($,null)}}function ue(A){if(A.isWebGLMultisampleRenderTarget)if(s){var L=r.get(A);e.bindFramebuffer(36008,L.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,L.__webglFramebuffer);var ne=A.width,$=A.height,Ne=16384;A.depthBuffer&&(Ne|=256),A.stencilBuffer&&(Ne|=1024),e.blitFramebuffer(0,0,ne,$,0,0,ne,$,Ne,9728),e.bindFramebuffer(36160,L.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function K(A){return s&&A.isWebGLMultisampleRenderTarget?Math.min(h,A.samples):0}function Ce(A){var L=o.render.frame;f.get(A)!==L&&(f.set(A,L),A.update())}var Ye=!1,Qe=!1;function et(A,L){A&&A.isWebGLRenderTarget&&(Ye===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Ye=!0),A=A.texture),Y(A,L)}function Ke(A,L){A&&A.isWebGLCubeRenderTarget&&(Qe===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Qe=!0),A=A.texture),A&&A.isCubeTexture||Array.isArray(A.image)&&A.image.length===6?k(A,L):q(A,L)}this.allocateTextureUnit=V,this.resetTextureUnits=B,this.setTexture2D=Y,this.setTexture2DArray=D,this.setTexture3D=z,this.setTextureCube=k,this.setTextureCubeDynamic=q,this.setupRenderTarget=xe,this.updateRenderTargetMipmap=Te,this.updateMultisampleRenderTarget=ue,this.safeSetTexture2D=et,this.safeSetTextureCube=Ke}function wy(e,t,n){var r=n.isWebGL2;function i(a){var o;if(a===Wa)return 5121;if(a===md)return 32819;if(a===gd)return 32820;if(a===yd)return 33635;if(a===dd)return 5120;if(a===pd)return 5122;if(a===Ho)return 5123;if(a===vd)return 5124;if(a===Io)return 5125;if(a===ar)return 5126;if(a===Vo)return r?5131:(o=t.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(a===xd)return 6406;if(a===Ar)return 6407;if(a===fn)return 6408;if(a===_d)return 6409;if(a===bd)return 6410;if(a===hi)return 6402;if(a===sa)return 34041;if(a===Md)return 6403;if(a===Ed)return 36244;if(a===Td)return 33319;if(a===Sd)return 33320;if(a===Ad)return 36248;if(a===Ld)return 36249;if(a===jc||a===qc||a===Yc||a===Zc)if(o=t.get("WEBGL_compressed_texture_s3tc"),o!==null){if(a===jc)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(a===qc)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===Yc)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===Zc)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(a===Jc||a===Qc||a===$c||a===Kc)if(o=t.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(a===Jc)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(a===Qc)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(a===$c)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(a===Kc)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(a===Pd)return o=t.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if((a===eu||a===tu)&&(o=t.get("WEBGL_compressed_texture_etc"),o!==null)){if(a===eu)return o.COMPRESSED_RGB8_ETC2;if(a===tu)return o.COMPRESSED_RGBA8_ETC2_EAC}if(a===Cd||a===Rd||a===Od||a===Dd||a===Id||a===Nd||a===Fd||a===Bd||a===Ud||a===zd||a===Gd||a===Hd||a===Vd||a===kd||a===Xd||a===jd||a===qd||a===Yd||a===Zd||a===Jd||a===Qd||a===$d||a===Kd||a===ep||a===tp||a===np||a===rp||a===ip)return o=t.get("WEBGL_compressed_texture_astc"),o!==null?a:null;if(a===Wd)return o=t.get("EXT_texture_compression_bptc"),o!==null?a:null;if(a===ra)return r?34042:(o=t.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:i}}function Cl(e){St.call(this),this.cameras=e||[]}Cl.prototype=Object.assign(Object.create(St.prototype),{constructor:Cl,isArrayCamera:!0});function ma(){se.call(this),this.type="Group"}ma.prototype=Object.assign(Object.create(se.prototype),{constructor:ma,isGroup:!0});function qo(){this._targetRay=null,this._grip=null}Object.assign(qo.prototype,{constructor:qo,getTargetRaySpace:function(){return this._targetRay===null&&(this._targetRay=new ma,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1),this._targetRay},getGripSpace:function(){return this._grip===null&&(this._grip=new ma,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1),this._grip},dispatchEvent:function(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this},disconnect:function(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this},update:function(e,t,n){var r=null,i=null,a=this._targetRay,o=this._grip;return e&&(a!==null&&(r=t.getPose(e.targetRaySpace,n),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale))),o!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale)))),a!==null&&(a.visible=r!==null),o!==null&&(o.visible=i!==null),this}});function jh(e,t){var n=this,r=null,i=1,a=null,o="local-floor",s=null,c=[],l=new Map,u=new St;u.layers.enable(1),u.viewport=new tt;var h=new St;h.layers.enable(2),h.viewport=new tt;var f=[u,h],d=new Cl;d.layers.enable(1),d.layers.enable(2);var m=null,g=null;this.enabled=!1,this.isPresenting=!1,this.getController=function(F){var B=c[F];return B===void 0&&(B=new qo,c[F]=B),B.getTargetRaySpace()},this.getControllerGrip=function(F){var B=c[F];return B===void 0&&(B=new qo,c[F]=B),B.getGripSpace()};function y(F){var B=l.get(F.inputSource);B&&B.dispatchEvent({type:F.type})}function p(){l.forEach(function(F,B){F.disconnect(B)}),l.clear(),e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),J.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function v(F){a=F,J.setContext(r),J.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}this.setFramebufferScaleFactor=function(F){i=F,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(F){o=F,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getSession=function(){return r},this.setSession=function(F){if(r=F,r!==null){r.addEventListener("select",y),r.addEventListener("selectstart",y),r.addEventListener("selectend",y),r.addEventListener("squeeze",y),r.addEventListener("squeezestart",y),r.addEventListener("squeezeend",y),r.addEventListener("end",p);var B=t.getContextAttributes();B.xrCompatible!==!0&&t.makeXRCompatible();var V={antialias:B.antialias,alpha:B.alpha,depth:B.depth,stencil:B.stencil,framebufferScaleFactor:i},Y=new XRWebGLLayer(r,t,V);r.updateRenderState({baseLayer:Y}),r.requestReferenceSpace(o).then(v),r.addEventListener("inputsourceschange",_)}};function _(F){for(var B=r.inputSources,V=0;V<c.length;V++)l.set(B[V],c[V]);for(var V=0;V<F.removed.length;V++){var Y=F.removed[V],D=l.get(Y);D&&(D.dispatchEvent({type:"disconnected",data:Y}),l.delete(Y))}for(var V=0;V<F.added.length;V++){var Y=F.added[V],D=l.get(Y);D&&D.dispatchEvent({type:"connected",data:Y})}}var x=new E,b=new E;function T(F,B,V){x.setFromMatrixPosition(B.matrixWorld),b.setFromMatrixPosition(V.matrixWorld);var Y=x.distanceTo(b),D=B.projectionMatrix.elements,z=V.projectionMatrix.elements,k=D[14]/(D[10]-1),q=D[14]/(D[10]+1),Z=(D[9]+1)/D[5],ee=(D[9]-1)/D[5],te=(D[8]-1)/D[0],ae=(z[8]+1)/z[0],Pe=k*te,_e=k*ae,re=Y/(-te+ae),G=re*-te;B.matrixWorld.decompose(F.position,F.quaternion,F.scale),F.translateX(G),F.translateZ(re),F.matrixWorld.compose(F.position,F.quaternion,F.scale),F.matrixWorldInverse.getInverse(F.matrixWorld);var Be=k+re,xe=q+re,Te=Pe-G,ue=_e+(Y-G),K=Z*q/xe*Be,Ce=ee*q/xe*Be;F.projectionMatrix.makePerspective(Te,ue,K,Ce,Be,xe)}function C(F,B){B===null?F.matrixWorld.copy(F.matrix):F.matrixWorld.multiplyMatrices(B.matrixWorld,F.matrix),F.matrixWorldInverse.getInverse(F.matrixWorld)}this.getCamera=function(F){d.near=h.near=u.near=F.near,d.far=h.far=u.far=F.far,(m!==d.near||g!==d.far)&&(r.updateRenderState({depthNear:d.near,depthFar:d.far}),m=d.near,g=d.far);var B=F.parent,V=d.cameras;C(d,B);for(var Y=0;Y<V.length;Y++)C(V[Y],B);F.matrixWorld.copy(d.matrixWorld);for(var D=F.children,Y=0,z=D.length;Y<z;Y++)D[Y].updateMatrixWorld(!0);return V.length===2?T(d,u,h):d.projectionMatrix.copy(u.projectionMatrix),d};var N=null;function O(F,B){if(s=B.getViewerPose(a),s!==null){var V=s.views,Y=r.renderState.baseLayer;e.setFramebuffer(Y.framebuffer);var D=!1;V.length!==d.cameras.length&&(d.cameras.length=0,D=!0);for(var z=0;z<V.length;z++){var k=V[z],q=Y.getViewport(k),Z=f[z];Z.matrix.fromArray(k.transform.matrix),Z.projectionMatrix.fromArray(k.projectionMatrix),Z.viewport.set(q.x,q.y,q.width,q.height),z===0&&d.matrix.copy(Z.matrix),D===!0&&d.cameras.push(Z)}}for(var ee=r.inputSources,z=0;z<c.length;z++){var te=c[z],ae=ee[z];te.update(ae,B,a)}N&&N(F,B)}var J=new Bh;J.setAnimationLoop(O),this.setAnimationLoop=function(F){N=F},this.dispose=function(){}}Object.assign(jh.prototype,vn.prototype);function My(e){function t(p,v){p.fogColor.value.copy(v.color),v.isFog?(p.fogNear.value=v.near,p.fogFar.value=v.far):v.isFogExp2&&(p.fogDensity.value=v.density)}function n(p,v,_,x,b){v.isMeshBasicMaterial?r(p,v):v.isMeshLambertMaterial?(r(p,v),c(p,v)):v.isMeshToonMaterial?(r(p,v),u(p,v)):v.isMeshPhongMaterial?(r(p,v),l(p,v)):v.isMeshStandardMaterial?(r(p,v,_),v.isMeshPhysicalMaterial?f(p,v,_):h(p,v,_)):v.isMeshMatcapMaterial?(r(p,v),d(p,v)):v.isMeshDepthMaterial?(r(p,v),m(p,v)):v.isMeshDistanceMaterial?(r(p,v),g(p,v)):v.isMeshNormalMaterial?(r(p,v),y(p,v)):v.isLineBasicMaterial?(i(p,v),v.isLineDashedMaterial&&a(p,v)):v.isPointsMaterial?o(p,v,x,b):v.isSpriteMaterial?s(p,v):v.isShadowMaterial?(p.color.value.copy(v.color),p.opacity.value=v.opacity):v.isShaderMaterial&&(v.uniformsNeedUpdate=!1)}function r(p,v,_){p.opacity.value=v.opacity,v.color&&p.diffuse.value.copy(v.color),v.emissive&&p.emissive.value.copy(v.emissive).multiplyScalar(v.emissiveIntensity),v.map&&(p.map.value=v.map),v.alphaMap&&(p.alphaMap.value=v.alphaMap),v.specularMap&&(p.specularMap.value=v.specularMap);var x=v.envMap||_;x&&(p.envMap.value=x,p.flipEnvMap.value=x.isCubeTexture?-1:1,p.reflectivity.value=v.reflectivity,p.refractionRatio.value=v.refractionRatio,p.maxMipLevel.value=e.get(x).__maxMipLevel),v.lightMap&&(p.lightMap.value=v.lightMap,p.lightMapIntensity.value=v.lightMapIntensity),v.aoMap&&(p.aoMap.value=v.aoMap,p.aoMapIntensity.value=v.aoMapIntensity);var b;v.map?b=v.map:v.specularMap?b=v.specularMap:v.displacementMap?b=v.displacementMap:v.normalMap?b=v.normalMap:v.bumpMap?b=v.bumpMap:v.roughnessMap?b=v.roughnessMap:v.metalnessMap?b=v.metalnessMap:v.alphaMap?b=v.alphaMap:v.emissiveMap&&(b=v.emissiveMap),b!==void 0&&(b.isWebGLRenderTarget&&(b=b.texture),b.matrixAutoUpdate===!0&&b.updateMatrix(),p.uvTransform.value.copy(b.matrix));var T;v.aoMap?T=v.aoMap:v.lightMap&&(T=v.lightMap),T!==void 0&&(T.isWebGLRenderTarget&&(T=T.texture),T.matrixAutoUpdate===!0&&T.updateMatrix(),p.uv2Transform.value.copy(T.matrix))}function i(p,v){p.diffuse.value.copy(v.color),p.opacity.value=v.opacity}function a(p,v){p.dashSize.value=v.dashSize,p.totalSize.value=v.dashSize+v.gapSize,p.scale.value=v.scale}function o(p,v,_,x){p.diffuse.value.copy(v.color),p.opacity.value=v.opacity,p.size.value=v.size*_,p.scale.value=x*.5,v.map&&(p.map.value=v.map),v.alphaMap&&(p.alphaMap.value=v.alphaMap);var b;v.map?b=v.map:v.alphaMap&&(b=v.alphaMap),b!==void 0&&(b.matrixAutoUpdate===!0&&b.updateMatrix(),p.uvTransform.value.copy(b.matrix))}function s(p,v){p.diffuse.value.copy(v.color),p.opacity.value=v.opacity,p.rotation.value=v.rotation,v.map&&(p.map.value=v.map),v.alphaMap&&(p.alphaMap.value=v.alphaMap);var _;v.map?_=v.map:v.alphaMap&&(_=v.alphaMap),_!==void 0&&(_.matrixAutoUpdate===!0&&_.updateMatrix(),p.uvTransform.value.copy(_.matrix))}function c(p,v){v.emissiveMap&&(p.emissiveMap.value=v.emissiveMap)}function l(p,v){p.specular.value.copy(v.specular),p.shininess.value=Math.max(v.shininess,1e-4),v.emissiveMap&&(p.emissiveMap.value=v.emissiveMap),v.bumpMap&&(p.bumpMap.value=v.bumpMap,p.bumpScale.value=v.bumpScale,v.side===Pt&&(p.bumpScale.value*=-1)),v.normalMap&&(p.normalMap.value=v.normalMap,p.normalScale.value.copy(v.normalScale),v.side===Pt&&p.normalScale.value.negate()),v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias)}function u(p,v){p.specular.value.copy(v.specular),p.shininess.value=Math.max(v.shininess,1e-4),v.gradientMap&&(p.gradientMap.value=v.gradientMap),v.emissiveMap&&(p.emissiveMap.value=v.emissiveMap),v.bumpMap&&(p.bumpMap.value=v.bumpMap,p.bumpScale.value=v.bumpScale,v.side===Pt&&(p.bumpScale.value*=-1)),v.normalMap&&(p.normalMap.value=v.normalMap,p.normalScale.value.copy(v.normalScale),v.side===Pt&&p.normalScale.value.negate()),v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias)}function h(p,v,_){p.roughness.value=v.roughness,p.metalness.value=v.metalness,v.roughnessMap&&(p.roughnessMap.value=v.roughnessMap),v.metalnessMap&&(p.metalnessMap.value=v.metalnessMap),v.emissiveMap&&(p.emissiveMap.value=v.emissiveMap),v.bumpMap&&(p.bumpMap.value=v.bumpMap,p.bumpScale.value=v.bumpScale,v.side===Pt&&(p.bumpScale.value*=-1)),v.normalMap&&(p.normalMap.value=v.normalMap,p.normalScale.value.copy(v.normalScale),v.side===Pt&&p.normalScale.value.negate()),v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias),(v.envMap||_)&&(p.envMapIntensity.value=v.envMapIntensity)}function f(p,v,_){h(p,v,_),p.reflectivity.value=v.reflectivity,p.clearcoat.value=v.clearcoat,p.clearcoatRoughness.value=v.clearcoatRoughness,v.sheen&&p.sheen.value.copy(v.sheen),v.clearcoatMap&&(p.clearcoatMap.value=v.clearcoatMap),v.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=v.clearcoatRoughnessMap),v.clearcoatNormalMap&&(p.clearcoatNormalScale.value.copy(v.clearcoatNormalScale),p.clearcoatNormalMap.value=v.clearcoatNormalMap,v.side===Pt&&p.clearcoatNormalScale.value.negate()),p.transparency.value=v.transparency}function d(p,v){v.matcap&&(p.matcap.value=v.matcap),v.bumpMap&&(p.bumpMap.value=v.bumpMap,p.bumpScale.value=v.bumpScale,v.side===Pt&&(p.bumpScale.value*=-1)),v.normalMap&&(p.normalMap.value=v.normalMap,p.normalScale.value.copy(v.normalScale),v.side===Pt&&p.normalScale.value.negate()),v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias)}function m(p,v){v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias)}function g(p,v){v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias),p.referencePosition.value.copy(v.referencePosition),p.nearDistance.value=v.nearDistance,p.farDistance.value=v.farDistance}function y(p,v){v.bumpMap&&(p.bumpMap.value=v.bumpMap,p.bumpScale.value=v.bumpScale,v.side===Pt&&(p.bumpScale.value*=-1)),v.normalMap&&(p.normalMap.value=v.normalMap,p.normalScale.value.copy(v.normalScale),v.side===Pt&&p.normalScale.value.negate()),v.displacementMap&&(p.displacementMap.value=v.displacementMap,p.displacementScale.value=v.displacementScale,p.displacementBias.value=v.displacementBias)}return{refreshFogUniforms:t,refreshMaterialUniforms:n}}function qh(e){e=e||{};var t=e.canvas!==void 0?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=e.context!==void 0?e.context:null,r=e.alpha!==void 0?e.alpha:!1,i=e.depth!==void 0?e.depth:!0,a=e.stencil!==void 0?e.stencil:!0,o=e.antialias!==void 0?e.antialias:!1,s=e.premultipliedAlpha!==void 0?e.premultipliedAlpha:!0,c=e.preserveDrawingBuffer!==void 0?e.preserveDrawingBuffer:!1,l=e.powerPreference!==void 0?e.powerPreference:"default",u=e.failIfMajorPerformanceCaveat!==void 0?e.failIfMajorPerformanceCaveat:!1,h=null,f=null;this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=kt,this.physicallyCorrectLights=!1,this.toneMapping=na,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var d=this,m=!1,g=null,y=0,p=0,v=null,_=null,x=-1,b={geometry:null,program:null,wireframe:!1},T=null,C=null,N=new tt,O=new tt,J=null,F=t.width,B=t.height,V=1,Y=null,D=null,z=new tt(0,0,F,B),k=new tt(0,0,F,B),q=!1,Z=new Xa,ee=new tg,te=!1,ae=!1,Pe=new We,_e=new E;function re(){return v===null?V:1}var G;try{var Be={alpha:r,depth:i,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(t.addEventListener("webglcontextlost",de,!1),t.addEventListener("webglcontextrestored",Re,!1),G=n||t.getContext("webgl",Be)||t.getContext("experimental-webgl",Be),G===null)throw t.getContext("webgl")!==null?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");G.getShaderPrecisionFormat===void 0&&(G.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(S){throw console.error("THREE.WebGLRenderer: "+S.message),S}var xe,Te,ue,K,Ce,Ye,Qe,et,Ke,A,L,ne,$,Ne,ye,R,he,fe;function ve(){xe=new ng(G),Te=new eg(G,xe,e),Te.isWebGL2===!1&&(xe.get("WEBGL_depth_texture"),xe.get("OES_texture_float"),xe.get("OES_texture_half_float"),xe.get("OES_texture_half_float_linear"),xe.get("OES_standard_derivatives"),xe.get("OES_element_index_uint"),xe.get("ANGLE_instanced_arrays")),xe.get("OES_texture_float_linear"),fe=new wy(G,xe,Te),ue=new _y(G,xe,Te),ue.scissor(O.copy(k).multiplyScalar(V).floor()),ue.viewport(N.copy(z).multiplyScalar(V).floor()),K=new ag,Ce=new ly,Ye=new by(G,xe,ue,Ce,Te,fe,K),Qe=new Op(G,Te),et=new rg(G,Qe,K),Ke=new lg(G,et,Qe,K),ye=new sg(G),A=new sy(d,xe,Te),L=new My(Ce),ne=new hy,$=new gy,Ne=new $m(d,ue,Ke,s),R=new Km(G,xe,K,Te),he=new ig(G,xe,K,Te),K.programs=A.programs,d.capabilities=Te,d.extensions=xe,d.properties=Ce,d.renderLists=ne,d.state=ue,d.info=K}ve();var ie=new jh(d,G);this.xr=ie;var Se=new Xh(d,Ke,Te.maxTextureSize);this.shadowMap=Se,this.getContext=function(){return G},this.getContextAttributes=function(){return G.getContextAttributes()},this.forceContextLoss=function(){var S=xe.get("WEBGL_lose_context");S&&S.loseContext()},this.forceContextRestore=function(){var S=xe.get("WEBGL_lose_context");S&&S.restoreContext()},this.getPixelRatio=function(){return V},this.setPixelRatio=function(S){S!==void 0&&(V=S,this.setSize(F,B,!1))},this.getSize=function(S){return S===void 0&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),S=new X),S.set(F,B)},this.setSize=function(S,W,H){if(ie.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}F=S,B=W,t.width=Math.floor(S*V),t.height=Math.floor(W*V),H!==!1&&(t.style.width=S+"px",t.style.height=W+"px"),this.setViewport(0,0,S,W)},this.getDrawingBufferSize=function(S){return S===void 0&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),S=new X),S.set(F*V,B*V).floor()},this.setDrawingBufferSize=function(S,W,H){F=S,B=W,V=H,t.width=Math.floor(S*H),t.height=Math.floor(W*H),this.setViewport(0,0,S,W)},this.getCurrentViewport=function(S){return S===void 0&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),S=new tt),S.copy(N)},this.getViewport=function(S){return S.copy(z)},this.setViewport=function(S,W,H,j){S.isVector4?z.set(S.x,S.y,S.z,S.w):z.set(S,W,H,j),ue.viewport(N.copy(z).multiplyScalar(V).floor())},this.getScissor=function(S){return S.copy(k)},this.setScissor=function(S,W,H,j){S.isVector4?k.set(S.x,S.y,S.z,S.w):k.set(S,W,H,j),ue.scissor(O.copy(k).multiplyScalar(V).floor())},this.getScissorTest=function(){return q},this.setScissorTest=function(S){ue.setScissorTest(q=S)},this.setOpaqueSort=function(S){Y=S},this.setTransparentSort=function(S){D=S},this.getClearColor=function(){return Ne.getClearColor()},this.setClearColor=function(){Ne.setClearColor.apply(Ne,arguments)},this.getClearAlpha=function(){return Ne.getClearAlpha()},this.setClearAlpha=function(){Ne.setClearAlpha.apply(Ne,arguments)},this.clear=function(S,W,H){var j=0;(S===void 0||S)&&(j|=16384),(W===void 0||W)&&(j|=256),(H===void 0||H)&&(j|=1024),G.clear(j)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",de,!1),t.removeEventListener("webglcontextrestored",Re,!1),ne.dispose(),$.dispose(),Ce.dispose(),Ke.dispose(),ie.dispose(),Ft.stop()};function de(S){S.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),m=!0}function Re(){console.log("THREE.WebGLRenderer: Context Restored."),m=!1,ve()}function I(S){var W=S.target;W.removeEventListener("dispose",I),be(W)}function be(S){Me(S),Ce.remove(S)}function Me(S){var W=Ce.get(S).program;S.program=void 0,W!==void 0&&A.releaseProgram(W)}function Ve(S,W){S.render(function(H){d.renderBufferImmediate(H,W)})}this.renderBufferImmediate=function(S,W){ue.initAttributes();var H=Ce.get(S);S.hasPositions&&!H.position&&(H.position=G.createBuffer()),S.hasNormals&&!H.normal&&(H.normal=G.createBuffer()),S.hasUvs&&!H.uv&&(H.uv=G.createBuffer()),S.hasColors&&!H.color&&(H.color=G.createBuffer());var j=W.getAttributes();S.hasPositions&&(G.bindBuffer(34962,H.position),G.bufferData(34962,S.positionArray,35048),ue.enableAttribute(j.position),G.vertexAttribPointer(j.position,3,5126,!1,0,0)),S.hasNormals&&(G.bindBuffer(34962,H.normal),G.bufferData(34962,S.normalArray,35048),ue.enableAttribute(j.normal),G.vertexAttribPointer(j.normal,3,5126,!1,0,0)),S.hasUvs&&(G.bindBuffer(34962,H.uv),G.bufferData(34962,S.uvArray,35048),ue.enableAttribute(j.uv),G.vertexAttribPointer(j.uv,2,5126,!1,0,0)),S.hasColors&&(G.bindBuffer(34962,H.color),G.bufferData(34962,S.colorArray,35048),ue.enableAttribute(j.color),G.vertexAttribPointer(j.color,3,5126,!1,0,0)),ue.disableUnusedAttributes(),G.drawArrays(4,0,S.count),S.count=0};var Ee=new ca;this.renderBufferDirect=function(S,W,H,j,oe,Ge){W===null&&(W=Ee);var Oe=oe.isMesh&&oe.matrixWorld.determinant()<0,Ae=Fr(S,W,j,oe);ue.setMaterial(j,Oe);var Ue=!1;(b.geometry!==H.id||b.program!==Ae.id||b.wireframe!==(j.wireframe===!0))&&(b.geometry=H.id,b.program=Ae.id,b.wireframe=j.wireframe===!0,Ue=!0),(j.morphTargets||j.morphNormals)&&(ye.update(oe,H,j,Ae),Ue=!0),oe.isInstancedMesh===!0&&(Ue=!0);var He=H.index,lt=H.attributes.position;if(He===null){if(lt===void 0||lt.count===0)return}else if(He.count===0)return;var $e=1;j.wireframe===!0&&(He=et.getWireframeAttribute(H),$e=2);var Je,ze=R;He!==null&&(Je=Qe.get(He),ze=he,ze.setIndex(Je)),Ue&&(Ze(oe,H,j,Ae),He!==null&&G.bindBuffer(34963,Je.buffer));var je=He!==null?He.count:lt.count,mt=H.drawRange.start*$e,Et=H.drawRange.count*$e,gt=Ge!==null?Ge.start*$e:0,an=Ge!==null?Ge.count*$e:1/0,st=Math.max(mt,gt),Cn=Math.min(je,mt+Et,gt+an)-1,qn=Math.max(0,Cn-st+1);if(qn!==0){if(oe.isMesh)j.wireframe===!0?(ue.setLineWidth(j.wireframeLinewidth*re()),ze.setMode(1)):ze.setMode(4);else if(oe.isLine){var Bi=j.linewidth;Bi===void 0&&(Bi=1),ue.setLineWidth(Bi*re()),oe.isLineSegments?ze.setMode(1):oe.isLineLoop?ze.setMode(2):ze.setMode(3)}else oe.isPoints?ze.setMode(0):oe.isSprite&&ze.setMode(4);if(oe.isInstancedMesh)ze.renderInstances(H,st,qn,oe.count);else if(H.isInstancedBufferGeometry){var Ur=Math.min(H.instanceCount,H._maxInstanceCount);ze.renderInstances(H,st,qn,Ur)}else ze.render(st,qn)}};function Ze(S,W,H,j){if(!(Te.isWebGL2===!1&&(S.isInstancedMesh||W.isInstancedBufferGeometry)&&xe.get("ANGLE_instanced_arrays")===null)){ue.initAttributes();var oe=W.attributes,Ge=j.getAttributes(),Oe=H.defaultAttributeValues;for(var Ae in Ge){var Ue=Ge[Ae];if(Ue>=0){var He=oe[Ae];if(He!==void 0){var lt=He.normalized,$e=He.itemSize,Je=Qe.get(He);if(Je===void 0)continue;var ze=Je.buffer,je=Je.type,mt=Je.bytesPerElement;if(He.isInterleavedBufferAttribute){var Et=He.data,gt=Et.stride,an=He.offset;Et&&Et.isInstancedInterleavedBuffer?(ue.enableAttributeAndDivisor(Ue,Et.meshPerAttribute),W._maxInstanceCount===void 0&&(W._maxInstanceCount=Et.meshPerAttribute*Et.count)):ue.enableAttribute(Ue),G.bindBuffer(34962,ze),ue.vertexAttribPointer(Ue,$e,je,lt,gt*mt,an*mt)}else He.isInstancedBufferAttribute?(ue.enableAttributeAndDivisor(Ue,He.meshPerAttribute),W._maxInstanceCount===void 0&&(W._maxInstanceCount=He.meshPerAttribute*He.count)):ue.enableAttribute(Ue),G.bindBuffer(34962,ze),ue.vertexAttribPointer(Ue,$e,je,lt,0,0)}else if(Ae==="instanceMatrix"){var Je=Qe.get(S.instanceMatrix);if(Je===void 0)continue;var ze=Je.buffer,je=Je.type;ue.enableAttributeAndDivisor(Ue+0,1),ue.enableAttributeAndDivisor(Ue+1,1),ue.enableAttributeAndDivisor(Ue+2,1),ue.enableAttributeAndDivisor(Ue+3,1),G.bindBuffer(34962,ze),G.vertexAttribPointer(Ue+0,4,je,!1,64,0),G.vertexAttribPointer(Ue+1,4,je,!1,64,16),G.vertexAttribPointer(Ue+2,4,je,!1,64,32),G.vertexAttribPointer(Ue+3,4,je,!1,64,48)}else if(Oe!==void 0){var st=Oe[Ae];if(st!==void 0)switch(st.length){case 2:G.vertexAttrib2fv(Ue,st);break;case 3:G.vertexAttrib3fv(Ue,st);break;case 4:G.vertexAttrib4fv(Ue,st);break;default:G.vertexAttrib1fv(Ue,st)}}}}ue.disableUnusedAttributes()}}this.compile=function(S,W){f=$.get(S,W),f.init(),S.traverse(function(j){j.isLight&&(f.pushLight(j),j.castShadow&&f.pushShadow(j))}),f.setupLights(W);const H={};S.traverse(function(j){let oe=j.material;if(oe)if(Array.isArray(oe))for(let Ge=0;Ge<oe.length;Ge++){let Oe=oe[Ge];Oe.uuid in H||(Xt(Oe,S,j),H[Oe.uuid]=!0)}else oe.uuid in H||(Xt(oe,S,j),H[oe.uuid]=!0)})};var rt=null;function dt(S){ie.isPresenting||rt&&rt(S)}var Ft=new Bh;Ft.setAnimationLoop(dt),typeof window!="undefined"&&Ft.setContext(window),this.setAnimationLoop=function(S){rt=S,ie.setAnimationLoop(S),Ft.start()},this.render=function(S,W){var H,j;if(arguments[2]!==void 0&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),H=arguments[2]),arguments[3]!==void 0&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),j=arguments[3]),!(W&&W.isCamera)){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(!m){b.geometry=null,b.program=null,b.wireframe=!1,x=-1,T=null,S.autoUpdate===!0&&S.updateMatrixWorld(),W.parent===null&&W.updateMatrixWorld(),ie.enabled&&ie.isPresenting&&(W=ie.getCamera(W)),S.onBeforeRender(d,S,W,H||v),f=$.get(S,W),f.init(),Pe.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),Z.setFromProjectionMatrix(Pe),ae=this.localClippingEnabled,te=ee.init(this.clippingPlanes,ae,W),h=ne.get(S,W),h.init(),it(S,W,0,d.sortObjects),h.finish(),d.sortObjects===!0&&h.sort(Y,D),te&&ee.beginShadows();var oe=f.state.shadowsArray;Se.render(oe,S,W),f.setupLights(W),te&&ee.endShadows(),this.info.autoReset&&this.info.reset(),H!==void 0&&this.setRenderTarget(H),Ne.render(h,S,W,j);var Ge=h.opaque,Oe=h.transparent;if(S.overrideMaterial){var Ae=S.overrideMaterial;Ge.length&&At(Ge,S,W,Ae),Oe.length&&At(Oe,S,W,Ae)}else Ge.length&&At(Ge,S,W),Oe.length&&At(Oe,S,W);S.onAfterRender(d,S,W),v!==null&&(Ye.updateRenderTargetMipmap(v),Ye.updateMultisampleRenderTarget(v)),ue.buffers.depth.setTest(!0),ue.buffers.depth.setMask(!0),ue.buffers.color.setMask(!0),ue.setPolygonOffset(!1),h=null,f=null}};function it(S,W,H,j){if(S.visible!==!1){var oe=S.layers.test(W.layers);if(oe){if(S.isGroup)H=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(W);else if(S.isLight)f.pushLight(S),S.castShadow&&f.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||Z.intersectsSprite(S)){j&&_e.setFromMatrixPosition(S.matrixWorld).applyMatrix4(Pe);var Ge=Ke.update(S),Oe=S.material;Oe.visible&&h.push(S,Ge,Oe,H,_e.z,null)}}else if(S.isImmediateRenderObject)j&&_e.setFromMatrixPosition(S.matrixWorld).applyMatrix4(Pe),h.push(S,null,S.material,H,_e.z,null);else if((S.isMesh||S.isLine||S.isPoints)&&(S.isSkinnedMesh&&S.skeleton.frame!==K.render.frame&&(S.skeleton.update(),S.skeleton.frame=K.render.frame),!S.frustumCulled||Z.intersectsObject(S))){j&&_e.setFromMatrixPosition(S.matrixWorld).applyMatrix4(Pe);var Ge=Ke.update(S),Oe=S.material;if(Array.isArray(Oe))for(var Ae=Ge.groups,Ue=0,He=Ae.length;Ue<He;Ue++){var lt=Ae[Ue],$e=Oe[lt.materialIndex];$e&&$e.visible&&h.push(S,Ge,$e,H,_e.z,lt)}else Oe.visible&&h.push(S,Ge,Oe,H,_e.z,null)}}for(var Je=S.children,Ue=0,He=Je.length;Ue<He;Ue++)it(Je[Ue],W,H,j)}}function At(S,W,H,j){for(var oe=0,Ge=S.length;oe<Ge;oe++){var Oe=S[oe],Ae=Oe.object,Ue=Oe.geometry,He=j===void 0?Oe.material:j,lt=Oe.group;if(H.isArrayCamera){C=H;for(var $e=H.cameras,Je=0,ze=$e.length;Je<ze;Je++){var je=$e[Je];Ae.layers.test(je.layers)&&(ue.viewport(N.copy(je.viewport)),f.setupLights(je),Ct(Ae,W,je,Ue,He,lt))}}else C=null,Ct(Ae,W,H,Ue,He,lt)}}function Ct(S,W,H,j,oe,Ge){if(S.onBeforeRender(d,W,H,j,oe,Ge),f=$.get(W,C||H),S.modelViewMatrix.multiplyMatrices(H.matrixWorldInverse,S.matrixWorld),S.normalMatrix.getNormalMatrix(S.modelViewMatrix),S.isImmediateRenderObject){var Oe=Fr(H,W,oe,S);ue.setMaterial(oe),b.geometry=null,b.program=null,b.wireframe=!1,Ve(S,Oe)}else d.renderBufferDirect(H,W,j,oe,S,Ge);S.onAfterRender(d,W,H,j,oe,Ge),f=$.get(W,C||H)}function Xt(S,W,H){var j=Ce.get(S),oe=f.state.lights,Ge=f.state.shadowsArray,Oe=oe.state.version,Ae=A.getParameters(S,oe.state,Ge,W,ee.numPlanes,ee.numIntersection,H),Ue=A.getProgramCacheKey(Ae),He=j.program,lt=!0;if(He===void 0)S.addEventListener("dispose",I);else if(He.cacheKey!==Ue)Me(S);else if(j.lightsStateVersion!==Oe)j.lightsStateVersion=Oe,lt=!1;else{if(Ae.shaderID!==void 0)return;lt=!1}lt&&(He=A.acquireProgram(Ae,Ue),j.program=He,j.uniforms=Ae.uniforms,j.outputEncoding=Ae.outputEncoding,S.program=He);var $e=He.getAttributes();if(S.morphTargets){S.numSupportedMorphTargets=0;for(var Je=0;Je<d.maxMorphTargets;Je++)$e["morphTarget"+Je]>=0&&S.numSupportedMorphTargets++}if(S.morphNormals){S.numSupportedMorphNormals=0;for(var Je=0;Je<d.maxMorphNormals;Je++)$e["morphNormal"+Je]>=0&&S.numSupportedMorphNormals++}var ze=j.uniforms;(!S.isShaderMaterial&&!S.isRawShaderMaterial||S.clipping===!0)&&(j.numClippingPlanes=ee.numPlanes,j.numIntersection=ee.numIntersection,ze.clippingPlanes=ee.uniform),j.environment=S.isMeshStandardMaterial?W.environment:null,j.fog=W.fog,j.needsLights=gr(S),j.lightsStateVersion=Oe,j.needsLights&&(ze.ambientLightColor.value=oe.state.ambient,ze.lightProbe.value=oe.state.probe,ze.directionalLights.value=oe.state.directional,ze.directionalLightShadows.value=oe.state.directionalShadow,ze.spotLights.value=oe.state.spot,ze.spotLightShadows.value=oe.state.spotShadow,ze.rectAreaLights.value=oe.state.rectArea,ze.pointLights.value=oe.state.point,ze.pointLightShadows.value=oe.state.pointShadow,ze.hemisphereLights.value=oe.state.hemi,ze.directionalShadowMap.value=oe.state.directionalShadowMap,ze.directionalShadowMatrix.value=oe.state.directionalShadowMatrix,ze.spotShadowMap.value=oe.state.spotShadowMap,ze.spotShadowMatrix.value=oe.state.spotShadowMatrix,ze.pointShadowMap.value=oe.state.pointShadowMap,ze.pointShadowMatrix.value=oe.state.pointShadowMatrix);var je=j.program.getUniforms(),mt=lr.seqWithValue(je.seq,ze);j.uniformsList=mt}function Fr(S,W,H,j){Ye.resetTextureUnits();var oe=W.fog,Ge=H.isMeshStandardMaterial?W.environment:null,Oe=v===null?d.outputEncoding:v.texture.encoding,Ae=Ce.get(H),Ue=f.state.lights;if(te&&(ae||S!==T)){var He=S===T&&H.id===x;ee.setState(H.clippingPlanes,H.clipIntersection,H.clipShadows,S,Ae,He)}H.version===Ae.__version?(Ae.program===void 0||H.fog&&Ae.fog!==oe||Ae.environment!==Ge||Ae.needsLights&&Ae.lightsStateVersion!==Ue.state.version||Ae.numClippingPlanes!==void 0&&(Ae.numClippingPlanes!==ee.numPlanes||Ae.numIntersection!==ee.numIntersection)||Ae.outputEncoding!==Oe)&&Xt(H,W,j):(Xt(H,W,j),Ae.__version=H.version);var lt=!1,$e=!1,Je=!1,ze=Ae.program,je=ze.getUniforms(),mt=Ae.uniforms;if(ue.useProgram(ze.program)&&(lt=!0,$e=!0,Je=!0),H.id!==x&&(x=H.id,$e=!0),lt||T!==S){if(je.setValue(G,"projectionMatrix",S.projectionMatrix),Te.logarithmicDepthBuffer&&je.setValue(G,"logDepthBufFC",2/(Math.log(S.far+1)/Math.LN2)),T!==S&&(T=S,$e=!0,Je=!0),H.isShaderMaterial||H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshStandardMaterial||H.envMap){var Et=je.map.cameraPosition;Et!==void 0&&Et.setValue(G,_e.setFromMatrixPosition(S.matrixWorld))}(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&je.setValue(G,"isOrthographic",S.isOrthographicCamera===!0),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial||H.skinning)&&je.setValue(G,"viewMatrix",S.matrixWorldInverse)}if(H.skinning){je.setOptional(G,j,"bindMatrix"),je.setOptional(G,j,"bindMatrixInverse");var gt=j.skeleton;if(gt){var an=gt.bones;if(Te.floatVertexTextures){if(gt.boneTexture===void 0){var st=Math.sqrt(an.length*4);st=ke.ceilPowerOfTwo(st),st=Math.max(st,4);var Cn=new Float32Array(st*st*4);Cn.set(gt.boneMatrices);var qn=new vi(Cn,st,st,fn,ar);gt.boneMatrices=Cn,gt.boneTexture=qn,gt.boneTextureSize=st}je.setValue(G,"boneTexture",gt.boneTexture,Ye),je.setValue(G,"boneTextureSize",gt.boneTextureSize)}else je.setOptional(G,gt,"boneMatrices")}}return($e||Ae.receiveShadow!==j.receiveShadow)&&(Ae.receiveShadow=j.receiveShadow,je.setValue(G,"receiveShadow",j.receiveShadow)),$e&&(je.setValue(G,"toneMappingExposure",d.toneMappingExposure),je.setValue(G,"toneMappingWhitePoint",d.toneMappingWhitePoint),Ae.needsLights&&Br(mt,Je),oe&&H.fog&&L.refreshFogUniforms(mt,oe),L.refreshMaterialUniforms(mt,H,Ge,V,B),mt.ltc_1!==void 0&&(mt.ltc_1.value=le.LTC_1),mt.ltc_2!==void 0&&(mt.ltc_2.value=le.LTC_2),lr.upload(G,Ae.uniformsList,mt,Ye)),H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(lr.upload(G,Ae.uniformsList,mt,Ye),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&je.setValue(G,"center",j.center),je.setValue(G,"modelViewMatrix",j.modelViewMatrix),je.setValue(G,"normalMatrix",j.normalMatrix),je.setValue(G,"modelMatrix",j.matrixWorld),ze}function Br(S,W){S.ambientLightColor.needsUpdate=W,S.lightProbe.needsUpdate=W,S.directionalLights.needsUpdate=W,S.directionalLightShadows.needsUpdate=W,S.pointLights.needsUpdate=W,S.pointLightShadows.needsUpdate=W,S.spotLights.needsUpdate=W,S.spotLightShadows.needsUpdate=W,S.rectAreaLights.needsUpdate=W,S.hemisphereLights.needsUpdate=W}function gr(S){return S.isMeshLambertMaterial||S.isMeshToonMaterial||S.isMeshPhongMaterial||S.isMeshStandardMaterial||S.isShadowMaterial||S.isShaderMaterial&&S.lights===!0}this.setFramebuffer=function(S){g!==S&&v===null&&G.bindFramebuffer(36160,S),g=S},this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return p},this.getRenderTarget=function(){return v},this.setRenderTarget=function(S,W,H){v=S,y=W,p=H,S&&Ce.get(S).__webglFramebuffer===void 0&&Ye.setupRenderTarget(S);var j=g,oe=!1;if(S){var Ge=Ce.get(S).__webglFramebuffer;S.isWebGLCubeRenderTarget?(j=Ge[W||0],oe=!0):S.isWebGLMultisampleRenderTarget?j=Ce.get(S).__webglMultisampledFramebuffer:j=Ge,N.copy(S.viewport),O.copy(S.scissor),J=S.scissorTest}else N.copy(z).multiplyScalar(V).floor(),O.copy(k).multiplyScalar(V).floor(),J=q;if(_!==j&&(G.bindFramebuffer(36160,j),_=j),ue.viewport(N),ue.scissor(O),ue.setScissorTest(J),oe){var Oe=Ce.get(S.texture);G.framebufferTexture2D(36160,36064,34069+(W||0),Oe.__webglTexture,H||0)}},this.readRenderTargetPixels=function(S,W,H,j,oe,Ge,Oe){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}var Ae=Ce.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&Oe!==void 0&&(Ae=Ae[Oe]),Ae){var Ue=!1;Ae!==_&&(G.bindFramebuffer(36160,Ae),Ue=!0);try{var He=S.texture,lt=He.format,$e=He.type;if(lt!==fn&&fe.convert(lt)!==G.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if($e!==Wa&&fe.convert($e)!==G.getParameter(35738)&&!($e===ar&&(Te.isWebGL2||xe.get("OES_texture_float")||xe.get("WEBGL_color_buffer_float")))&&!($e===Vo&&(Te.isWebGL2?xe.get("EXT_color_buffer_float"):xe.get("EXT_color_buffer_half_float")))){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}G.checkFramebufferStatus(36160)===36053?W>=0&&W<=S.width-j&&H>=0&&H<=S.height-oe&&G.readPixels(W,H,j,oe,fe.convert(lt),fe.convert($e),Ge):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{Ue&&G.bindFramebuffer(36160,_)}}},this.copyFramebufferToTexture=function(S,W,H){H===void 0&&(H=0);var j=Math.pow(2,-H),oe=Math.floor(W.image.width*j),Ge=Math.floor(W.image.height*j),Oe=fe.convert(W.format);Ye.setTexture2D(W,0),G.copyTexImage2D(3553,H,Oe,S.x,S.y,oe,Ge,0),ue.unbindTexture()},this.copyTextureToTexture=function(S,W,H,j){j===void 0&&(j=0);var oe=W.image.width,Ge=W.image.height,Oe=fe.convert(H.format),Ae=fe.convert(H.type);Ye.setTexture2D(H,0),W.isDataTexture?G.texSubImage2D(3553,j,S.x,S.y,oe,Ge,Oe,Ae,W.image.data):W.isCompressedTexture?G.compressedTexSubImage2D(3553,j,S.x,S.y,W.mipmaps[0].width,W.mipmaps[0].height,Oe,W.mipmaps[0].data):G.texSubImage2D(3553,j,S.x,S.y,Oe,Ae,W.image),j===0&&H.generateMipmaps&&G.generateMipmap(3553),ue.unbindTexture()},this.initTexture=function(S){Ye.setTexture2D(S,0),ue.unbindTexture()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Rl(e,t){this.name="",this.color=new pe(e),this.density=t!==void 0?t:25e-5}Object.assign(Rl.prototype,{isFogExp2:!0,clone:function(){return new Rl(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}});function Ol(e,t,n){this.name="",this.color=new pe(e),this.near=t!==void 0?t:1,this.far=n!==void 0?n:1e3}Object.assign(Ol.prototype,{isFog:!0,clone:function(){return new Ol(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}});function fr(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ps,this.updateRange={offset:0,count:-1},this.version=0}Object.defineProperty(fr.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}});Object.assign(fr.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var r=0,i=this.stride;r<i;r++)this.array[e+r]=t.array[n+r];return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},clone:function(){return new this.constructor().copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}});var br=new E;function Yo(e,t,n,r){this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r===!0}Object.defineProperties(Yo.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}});Object.assign(Yo.prototype,{isInterleavedBufferAttribute:!0,applyMatrix4:function(e){for(var t=0,n=this.data.count;t<n;t++)br.x=this.getX(t),br.y=this.getY(t),br.z=this.getZ(t),br.applyMatrix4(e),this.setXYZ(t,br.x,br.y,br.z);return this},setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this},setXYZW:function(e,t,n,r,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=i,this},clone:function(){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return new De(new this.array.constructor(e),this.itemSize,this.normalized)},toJSON:function(){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");for(var e=[],t=0;t<this.count;t++)for(var n=t*this.data.stride+this.offset,r=0;r<this.itemSize;r++)e.push(this.data.array[n+r]);return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}});function Or(e){Ie.call(this),this.type="SpriteMaterial",this.color=new pe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Or.prototype=Object.create(Ie.prototype);Or.prototype.constructor=Or;Or.prototype.isSpriteMaterial=!0;Or.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};var Kr,Xi=new E,ei=new E,ti=new E,ni=new X,ji=new X,Yh=new We,co=new E,qi=new E,uo=new E,Su=new X,ll=new X,Au=new X;function Dl(e){if(se.call(this),this.type="Sprite",Kr===void 0){Kr=new ge;var t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new fr(t,5);Kr.setIndex([0,1,2,0,2,3]),Kr.setAttribute("position",new Yo(n,3,0,!1)),Kr.setAttribute("uv",new Yo(n,2,3,!1))}this.geometry=Kr,this.material=e!==void 0?e:new Or,this.center=new X(.5,.5)}Dl.prototype=Object.assign(Object.create(se.prototype),{constructor:Dl,isSprite:!0,raycast:function(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ei.setFromMatrixScale(this.matrixWorld),Yh.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),ti.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&ei.multiplyScalar(-ti.z);var n=this.material.rotation,r,i;n!==0&&(i=Math.cos(n),r=Math.sin(n));var a=this.center;ho(co.set(-.5,-.5,0),ti,a,ei,r,i),ho(qi.set(.5,-.5,0),ti,a,ei,r,i),ho(uo.set(.5,.5,0),ti,a,ei,r,i),Su.set(0,0),ll.set(1,0),Au.set(1,1);var o=e.ray.intersectTriangle(co,qi,uo,!1,Xi);if(!(o===null&&(ho(qi.set(-.5,.5,0),ti,a,ei,r,i),ll.set(0,1),o=e.ray.intersectTriangle(co,uo,qi,!1,Xi),o===null))){var s=e.ray.origin.distanceTo(Xi);s<e.near||s>e.far||t.push({distance:s,point:Xi.clone(),uv:Ot.getUV(Xi,co,qi,uo,Su,ll,Au,new X),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return se.prototype.copy.call(this,e),e.center!==void 0&&this.center.copy(e.center),this}});function ho(e,t,n,r,i,a){ni.subVectors(e,n).addScalar(.5).multiply(r),i!==void 0?(ji.x=a*ni.x-i*ni.y,ji.y=i*ni.x+a*ni.y):ji.copy(ni),e.copy(t),e.x+=ji.x,e.y+=ji.y,e.applyMatrix4(Yh)}var fo=new E,Lu=new E;function Zo(){se.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}Zo.prototype=Object.assign(Object.create(se.prototype),{constructor:Zo,isLOD:!0,copy:function(e){se.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,r=t.length;n<r;n++){var i=t[n];this.addLevel(i.object.clone(),i.distance)}return this.autoUpdate=e.autoUpdate,this},addLevel:function(e,t){t===void 0&&(t=0),t=Math.abs(t);for(var n=this.levels,r=0;r<n.length&&!(t<n[r].distance);r++);return n.splice(r,0,{distance:t,object:e}),this.add(e),this},getCurrentLevel:function(){return this._currentLevel},getObjectForDistance:function(e){var t=this.levels;if(t.length>0){for(var n=1,r=t.length;n<r&&!(e<t[n].distance);n++);return t[n-1].object}return null},raycast:function(e,t){var n=this.levels;if(n.length>0){fo.setFromMatrixPosition(this.matrixWorld);var r=e.ray.origin.distanceTo(fo);this.getObjectForDistance(r).raycast(e,t)}},update:function(e){var t=this.levels;if(t.length>1){fo.setFromMatrixPosition(e.matrixWorld),Lu.setFromMatrixPosition(this.matrixWorld);var n=fo.distanceTo(Lu)/e.zoom;t[0].object.visible=!0;for(var 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:function(e){var t=se.prototype.toJSON.call(this,e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];for(var n=this.levels,r=0,i=n.length;r<i;r++){var a=n[r];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}});function Il(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),ft.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new We,this.bindMatrixInverse=new We}Il.prototype=Object.assign(Object.create(ft.prototype),{constructor:Il,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new tt,t=this.geometry.attributes.skinWeight,n=0,r=t.count;n<r;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){ft.prototype.updateMatrixWorld.call(this,e),this.bindMode==="attached"?this.bindMatrixInverse.getInverse(this.matrixWorld):this.bindMode==="detached"?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)},boneTransform:function(){var e=new E,t=new tt,n=new tt,r=new E,i=new We;return function(a,o){var s=this.skeleton,c=this.geometry;t.fromBufferAttribute(c.attributes.skinIndex,a),n.fromBufferAttribute(c.attributes.skinWeight,a),e.fromBufferAttribute(c.attributes.position,a).applyMatrix4(this.bindMatrix),o.set(0,0,0);for(var l=0;l<4;l++){var u=n.getComponent(l);if(u!==0){var h=t.getComponent(l);i.multiplyMatrices(s.bones[h].matrixWorld,s.boneInverses[h]),o.addScaledVector(r.copy(e).applyMatrix4(i),u)}}return o.applyMatrix4(this.bindMatrixInverse)}}()});var Pu=new We,Ey=new We;function Nl(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(this.bones.length*16),this.frame=-1,t===void 0)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new We)}}Object.assign(Nl.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new We;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){for(var e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture,i=0,a=e.length;i<a;i++){var o=e[i]?e[i].matrixWorld:Ey;Pu.multiplyMatrices(o,t[i]),Pu.toArray(n,i*16)}r!==void 0&&(r.needsUpdate=!0)},clone:function(){return new Nl(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var r=this.bones[t];if(r.name===e)return r}},dispose:function(){this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=void 0)}});function Cu(){se.call(this),this.type="Bone"}Cu.prototype=Object.assign(Object.create(se.prototype),{constructor:Cu,isBone:!0});var Ru=new We,Ou=new We,po=[],Yi=new ft;function Fl(e,t,n){ft.call(this,e,t),this.instanceMatrix=new De(new Float32Array(n*16),16),this.count=n,this.frustumCulled=!1}Fl.prototype=Object.assign(Object.create(ft.prototype),{constructor:Fl,isInstancedMesh:!0,getMatrixAt:function(e,t){t.fromArray(this.instanceMatrix.array,e*16)},raycast:function(e,t){var n=this.matrixWorld,r=this.count;if(Yi.geometry=this.geometry,Yi.material=this.material,Yi.material!==void 0)for(var i=0;i<r;i++){this.getMatrixAt(i,Ru),Ou.multiplyMatrices(n,Ru),Yi.matrixWorld=Ou,Yi.raycast(e,po);for(var a=0,o=po.length;a<o;a++){var s=po[a];s.instanceId=i,s.object=this,t.push(s)}po.length=0}},setMatrixAt:function(e,t){t.toArray(this.instanceMatrix.array,e*16)},updateMorphTargets:function(){}});function xt(e){Ie.call(this),this.type="LineBasicMaterial",this.color=new pe(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}xt.prototype=Object.create(Ie.prototype);xt.prototype.constructor=xt;xt.prototype.isLineBasicMaterial=!0;xt.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this};var Du=new E,Iu=new E,Nu=new We,vo=new Ni,mo=new jn;function nn(e,t,n){n===1&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),se.call(this),this.type="Line",this.geometry=e!==void 0?e:new ge,this.material=t!==void 0?t:new xt,this.updateMorphTargets()}nn.prototype=Object.assign(Object.create(se.prototype),{constructor:nn,isLine:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(e.index===null){for(var t=e.attributes.position,n=[0],r=1,i=t.count;r<i;r++)Du.fromBufferAttribute(t,r-1),Iu.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Du.distanceTo(Iu);e.setAttribute("lineDistance",new ce(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry){var a=e.vertices,n=e.lineDistances;n[0]=0;for(var r=1,i=a.length;r<i;r++)n[r]=n[r-1],n[r]+=a[r-1].distanceTo(a[r])}return this},raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Line.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),mo.copy(n.boundingSphere),mo.applyMatrix4(r),mo.radius+=i,e.ray.intersectsSphere(mo)!==!1){Nu.getInverse(r),vo.copy(e.ray).applyMatrix4(Nu);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,s=new E,c=new E,l=new E,u=new E,h=this&&this.isLineSegments?2:1;if(n.isBufferGeometry){var f=n.index,d=n.attributes,m=d.position.array;if(f!==null)for(var g=f.array,y=0,p=g.length-1;y<p;y+=h){var v=g[y],_=g[y+1];s.fromArray(m,v*3),c.fromArray(m,_*3);var x=vo.distanceSqToSegment(s,c,u,l);if(!(x>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else for(var y=0,p=m.length/3-1;y<p;y+=h){s.fromArray(m,3*y),c.fromArray(m,3*y+3);var x=vo.distanceSqToSegment(s,c,u,l);if(!(x>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}else if(n.isGeometry)for(var T=n.vertices,C=T.length,y=0;y<C-1;y+=h){var x=vo.distanceSqToSegment(T[y],T[y+1],u,l);if(!(x>o)){u.applyMatrix4(this.matrixWorld);var b=e.ray.origin.distanceTo(u);b<e.near||b>e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var go=new E,yo=new E;function Mt(e,t){nn.call(this,e,t),this.type="LineSegments"}Mt.prototype=Object.assign(Object.create(nn.prototype),{constructor:Mt,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(e.index===null){for(var t=e.attributes.position,n=[],r=0,i=t.count;r<i;r+=2)go.fromBufferAttribute(t,r),yo.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+go.distanceTo(yo);e.setAttribute("lineDistance",new ce(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(e.isGeometry)for(var a=e.vertices,n=e.lineDistances,r=0,i=a.length;r<i;r+=2)go.copy(a[r]),yo.copy(a[r+1]),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+go.distanceTo(yo);return this}});function Bl(e,t){nn.call(this,e,t),this.type="LineLoop"}Bl.prototype=Object.assign(Object.create(nn.prototype),{constructor:Bl,isLineLoop:!0});function Dr(e){Ie.call(this),this.type="PointsMaterial",this.color=new pe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}Dr.prototype=Object.create(Ie.prototype);Dr.prototype.constructor=Dr;Dr.prototype.isPointsMaterial=!0;Dr.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};var Fu=new We,Ul=new Ni,xo=new jn,_o=new E;function zl(e,t){se.call(this),this.type="Points",this.geometry=e!==void 0?e:new ge,this.material=t!==void 0?t:new Dr,this.updateMorphTargets()}zl.prototype=Object.assign(Object.create(se.prototype),{constructor:zl,isPoints:!0,raycast:function(e,t){var n=this.geometry,r=this.matrixWorld,i=e.params.Points.threshold;if(n.boundingSphere===null&&n.computeBoundingSphere(),xo.copy(n.boundingSphere),xo.applyMatrix4(r),xo.radius+=i,e.ray.intersectsSphere(xo)!==!1){Fu.getInverse(r),Ul.copy(e.ray).applyMatrix4(Fu);var a=i/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a;if(n.isBufferGeometry){var s=n.index,c=n.attributes,l=c.position.array;if(s!==null)for(var u=s.array,h=0,f=u.length;h<f;h++){var d=u[h];_o.fromArray(l,d*3),cl(_o,d,o,r,e,t,this)}else for(var h=0,m=l.length/3;h<m;h++)_o.fromArray(l,h*3),cl(_o,h,o,r,e,t,this)}else for(var g=n.vertices,h=0,m=g.length;h<m;h++)cl(g[h],h,o,r,e,t,this)}},updateMorphTargets:function(){var e=this.geometry,t,n,r;if(e.isBufferGeometry){var i=e.morphAttributes,a=Object.keys(i);if(a.length>0){var o=i[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)r=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[r]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});function cl(e,t,n,r,i,a,o){var s=Ul.distanceSqToPoint(e);if(s<n){var c=new E;Ul.closestPointToPoint(e,c),c.applyMatrix4(r);var l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;a.push({distance:l,distanceToRay:Math.sqrt(s),point:c,index:t,face:null,object:o})}}function Bu(e,t,n,r,i,a,o,s,c){ot.call(this,e,t,n,r,i,a,o,s,c),this.format=o!==void 0?o:Ar,this.minFilter=a!==void 0?a:It,this.magFilter=i!==void 0?i:It,this.generateMipmaps=!1}Bu.prototype=Object.assign(Object.create(ot.prototype),{constructor:Bu,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});function ga(e,t,n,r,i,a,o,s,c,l,u,h){ot.call(this,null,a,o,s,c,l,r,i,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}ga.prototype=Object.create(ot.prototype);ga.prototype.constructor=ga;ga.prototype.isCompressedTexture=!0;function Jo(e,t,n,r,i,a,o,s,c){ot.call(this,e,t,n,r,i,a,o,s,c),this.needsUpdate=!0}Jo.prototype=Object.create(ot.prototype);Jo.prototype.constructor=Jo;Jo.prototype.isCanvasTexture=!0;function Qo(e,t,n,r,i,a,o,s,c,l){if(l=l!==void 0?l:hi,l!==hi&&l!==sa)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&l===hi&&(n=Ho),n===void 0&&l===sa&&(n=ra),ot.call(this,null,r,i,a,o,s,l,n,c),this.image={width:e,height:t},this.magFilter=o!==void 0?o:bt,this.minFilter=s!==void 0?s:bt,this.flipY=!1,this.generateMipmaps=!1}Qo.prototype=Object.create(ot.prototype);Qo.prototype.constructor=Qo;Qo.prototype.isDepthTexture=!0;function $o(e){ge.call(this),this.type="WireframeGeometry";var t=[],n,r,i,a,o,s=[0,0],c={},l,u,h,f,d=["a","b","c"],m;if(e&&e.isGeometry){var g=e.faces;for(n=0,i=g.length;n<i;n++){var y=g[n];for(r=0;r<3;r++)u=y[d[r]],h=y[d[(r+1)%3]],s[0]=Math.min(u,h),s[1]=Math.max(u,h),f=s[0]+","+s[1],c[f]===void 0&&(c[f]={index1:s[0],index2:s[1]})}for(f in c)l=c[f],m=e.vertices[l.index1],t.push(m.x,m.y,m.z),m=e.vertices[l.index2],t.push(m.x,m.y,m.z)}else if(e&&e.isBufferGeometry){var p,v,_,x,b,T,C,N;if(m=new E,e.index!==null){for(p=e.attributes.position,v=e.index,_=e.groups,_.length===0&&(_=[{start:0,count:v.count,materialIndex:0}]),a=0,o=_.length;a<o;++a)for(x=_[a],b=x.start,T=x.count,n=b,i=b+T;n<i;n+=3)for(r=0;r<3;r++)u=v.getX(n+r),h=v.getX(n+(r+1)%3),s[0]=Math.min(u,h),s[1]=Math.max(u,h),f=s[0]+","+s[1],c[f]===void 0&&(c[f]={index1:s[0],index2:s[1]});for(f in c)l=c[f],m.fromBufferAttribute(p,l.index1),t.push(m.x,m.y,m.z),m.fromBufferAttribute(p,l.index2),t.push(m.x,m.y,m.z)}else for(p=e.attributes.position,n=0,i=p.count/3;n<i;n++)for(r=0;r<3;r++)C=3*n+r,m.fromBufferAttribute(p,C),t.push(m.x,m.y,m.z),N=3*n+(r+1)%3,m.fromBufferAttribute(p,N),t.push(m.x,m.y,m.z)}this.setAttribute("position",new ce(t,3))}$o.prototype=Object.create(ge.prototype);$o.prototype.constructor=$o;function Ko(e,t,n){Fe.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new ya(e,t,n)),this.mergeVertices()}Ko.prototype=Object.create(Fe.prototype);Ko.prototype.constructor=Ko;function ya(e,t,n){ge.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var r=[],i=[],a=[],o=[],s=1e-5,c=new E,l=new E,u=new E,h=new E,f=new E,d,m;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var g=t+1;for(d=0;d<=n;d++){var y=d/n;for(m=0;m<=t;m++){var p=m/t;e(p,y,l),i.push(l.x,l.y,l.z),p-s>=0?(e(p-s,y,u),h.subVectors(l,u)):(e(p+s,y,u),h.subVectors(u,l)),y-s>=0?(e(p,y-s,u),f.subVectors(l,u)):(e(p,y+s,u),f.subVectors(u,l)),c.crossVectors(h,f).normalize(),a.push(c.x,c.y,c.z),o.push(p,y)}}for(d=0;d<n;d++)for(m=0;m<t;m++){var v=d*g+m,_=d*g+m+1,x=(d+1)*g+m+1,b=(d+1)*g+m;r.push(v,_,b),r.push(_,x,b)}this.setIndex(r),this.setAttribute("position",new ce(i,3)),this.setAttribute("normal",new ce(a,3)),this.setAttribute("uv",new ce(o,2))}ya.prototype=Object.create(ge.prototype);ya.prototype.constructor=ya;function es(e,t,n,r){Fe.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},this.fromBufferGeometry(new Zt(e,t,n,r)),this.mergeVertices()}es.prototype=Object.create(Fe.prototype);es.prototype.constructor=es;function Zt(e,t,n,r){ge.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r},n=n||1,r=r||0;var i=[],a=[];o(r),c(n),l(),this.setAttribute("position",new ce(i,3)),this.setAttribute("normal",new ce(i.slice(),3)),this.setAttribute("uv",new ce(a,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function o(p){for(var v=new E,_=new E,x=new E,b=0;b<t.length;b+=3)f(t[b+0],v),f(t[b+1],_),f(t[b+2],x),s(v,_,x,p)}function s(p,v,_,x){var b=Math.pow(2,x),T=[],C,N;for(C=0;C<=b;C++){T[C]=[];var O=p.clone().lerp(_,C/b),J=v.clone().lerp(_,C/b),F=b-C;for(N=0;N<=F;N++)N===0&&C===b?T[C][N]=O:T[C][N]=O.clone().lerp(J,N/F)}for(C=0;C<b;C++)for(N=0;N<2*(b-C)-1;N++){var B=Math.floor(N/2);N%2===0?(h(T[C][B+1]),h(T[C+1][B]),h(T[C][B])):(h(T[C][B+1]),h(T[C+1][B+1]),h(T[C+1][B]))}}function c(p){for(var v=new E,_=0;_<i.length;_+=3)v.x=i[_+0],v.y=i[_+1],v.z=i[_+2],v.normalize().multiplyScalar(p),i[_+0]=v.x,i[_+1]=v.y,i[_+2]=v.z}function l(){for(var p=new E,v=0;v<i.length;v+=3){p.x=i[v+0],p.y=i[v+1],p.z=i[v+2];var _=g(p)/2/Math.PI+.5,x=y(p)/Math.PI+.5;a.push(_,1-x)}d(),u()}function u(){for(var p=0;p<a.length;p+=6){var v=a[p+0],_=a[p+2],x=a[p+4],b=Math.max(v,_,x),T=Math.min(v,_,x);b>.9&&T<.1&&(v<.2&&(a[p+0]+=1),_<.2&&(a[p+2]+=1),x<.2&&(a[p+4]+=1))}}function h(p){i.push(p.x,p.y,p.z)}function f(p,v){var _=p*3;v.x=e[_+0],v.y=e[_+1],v.z=e[_+2]}function d(){for(var p=new E,v=new E,_=new E,x=new E,b=new X,T=new X,C=new X,N=0,O=0;N<i.length;N+=9,O+=6){p.set(i[N+0],i[N+1],i[N+2]),v.set(i[N+3],i[N+4],i[N+5]),_.set(i[N+6],i[N+7],i[N+8]),b.set(a[O+0],a[O+1]),T.set(a[O+2],a[O+3]),C.set(a[O+4],a[O+5]),x.copy(p).add(v).add(_).divideScalar(3);var J=g(x);m(b,O+0,p,J),m(T,O+2,v,J),m(C,O+4,_,J)}}function m(p,v,_,x){x<0&&p.x===1&&(a[v]=p.x-1),_.x===0&&_.z===0&&(a[v]=x/2/Math.PI+.5)}function g(p){return Math.atan2(p.z,-p.x)}function y(p){return Math.atan2(-p.y,Math.sqrt(p.x*p.x+p.z*p.z))}}Zt.prototype=Object.create(ge.prototype);Zt.prototype.constructor=Zt;function ts(e,t){Fe.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new xa(e,t)),this.mergeVertices()}ts.prototype=Object.create(Fe.prototype);ts.prototype.constructor=ts;function xa(e,t){var n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];Zt.call(this,n,r,e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}xa.prototype=Object.create(Zt.prototype);xa.prototype.constructor=xa;function ns(e,t){Fe.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new gi(e,t)),this.mergeVertices()}ns.prototype=Object.create(Fe.prototype);ns.prototype.constructor=ns;function gi(e,t){var n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];Zt.call(this,n,r,e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}gi.prototype=Object.create(Zt.prototype);gi.prototype.constructor=gi;function rs(e,t){Fe.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new _a(e,t)),this.mergeVertices()}rs.prototype=Object.create(Fe.prototype);rs.prototype.constructor=rs;function _a(e,t){var n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],i=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];Zt.call(this,r,i,e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}_a.prototype=Object.create(Zt.prototype);_a.prototype.constructor=_a;function is(e,t){Fe.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ba(e,t)),this.mergeVertices()}is.prototype=Object.create(Fe.prototype);is.prototype.constructor=is;function ba(e,t){var n=(1+Math.sqrt(5))/2,r=1/n,i=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],a=[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];Zt.call(this,i,a,e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}ba.prototype=Object.create(Zt.prototype);ba.prototype.constructor=ba;function as(e,t,n,r,i,a){Fe.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},a!==void 0&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new yi(e,t,n,r,i);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}as.prototype=Object.create(Fe.prototype);as.prototype.constructor=as;function yi(e,t,n,r,i){ge.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:i},t=t||64,n=n||1,r=r||8,i=i||!1;var a=e.computeFrenetFrames(t,i);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o=new E,s=new E,c=new X,l=new E,u,h,f=[],d=[],m=[],g=[];y(),this.setIndex(g),this.setAttribute("position",new ce(f,3)),this.setAttribute("normal",new ce(d,3)),this.setAttribute("uv",new ce(m,2));function y(){for(u=0;u<t;u++)p(u);p(i===!1?t:0),_(),v()}function p(x){l=e.getPointAt(x/t,l);var b=a.normals[x],T=a.binormals[x];for(h=0;h<=r;h++){var C=h/r*Math.PI*2,N=Math.sin(C),O=-Math.cos(C);s.x=O*b.x+N*T.x,s.y=O*b.y+N*T.y,s.z=O*b.z+N*T.z,s.normalize(),d.push(s.x,s.y,s.z),o.x=l.x+n*s.x,o.y=l.y+n*s.y,o.z=l.z+n*s.z,f.push(o.x,o.y,o.z)}}function v(){for(h=1;h<=t;h++)for(u=1;u<=r;u++){var x=(r+1)*(h-1)+(u-1),b=(r+1)*h+(u-1),T=(r+1)*h+u,C=(r+1)*(h-1)+u;g.push(x,b,C),g.push(b,T,C)}}function _(){for(u=0;u<=t;u++)for(h=0;h<=r;h++)c.x=u/t,c.y=h/r,m.push(c.x,c.y)}}yi.prototype=Object.create(ge.prototype);yi.prototype.constructor=yi;yi.prototype.toJSON=function(){var e=ge.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e};function os(e,t,n,r,i,a,o){Fe.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},o!==void 0&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new wa(e,t,n,r,i,a)),this.mergeVertices()}os.prototype=Object.create(Fe.prototype);os.prototype.constructor=os;function wa(e,t,n,r,i,a){ge.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:i,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,r=Math.floor(r)||8,i=i||2,a=a||3;var o=[],s=[],c=[],l=[],u,h,f=new E,d=new E,m=new E,g=new E,y=new E,p=new E,v=new E;for(u=0;u<=n;++u){var _=u/n*i*Math.PI*2;for(F(_,i,a,e,m),F(_+.01,i,a,e,g),p.subVectors(g,m),v.addVectors(g,m),y.crossVectors(p,v),v.crossVectors(y,p),y.normalize(),v.normalize(),h=0;h<=r;++h){var x=h/r*Math.PI*2,b=-t*Math.cos(x),T=t*Math.sin(x);f.x=m.x+(b*v.x+T*y.x),f.y=m.y+(b*v.y+T*y.y),f.z=m.z+(b*v.z+T*y.z),s.push(f.x,f.y,f.z),d.subVectors(f,m).normalize(),c.push(d.x,d.y,d.z),l.push(u/n),l.push(h/r)}}for(h=1;h<=n;h++)for(u=1;u<=r;u++){var C=(r+1)*(h-1)+(u-1),N=(r+1)*h+(u-1),O=(r+1)*h+u,J=(r+1)*(h-1)+u;o.push(C,N,J),o.push(N,O,J)}this.setIndex(o),this.setAttribute("position",new ce(s,3)),this.setAttribute("normal",new ce(c,3)),this.setAttribute("uv",new ce(l,2));function F(B,V,Y,D,z){var k=Math.cos(B),q=Math.sin(B),Z=Y/V*B,ee=Math.cos(Z);z.x=D*(2+ee)*.5*k,z.y=D*(2+ee)*q*.5,z.z=D*Math.sin(Z)*.5}}wa.prototype=Object.create(ge.prototype);wa.prototype.constructor=wa;function ss(e,t,n,r,i){Fe.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},this.fromBufferGeometry(new Ma(e,t,n,r,i)),this.mergeVertices()}ss.prototype=Object.create(Fe.prototype);ss.prototype.constructor=ss;function Ma(e,t,n,r,i){ge.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i},e=e||1,t=t||.4,n=Math.floor(n)||8,r=Math.floor(r)||6,i=i||Math.PI*2;var a=[],o=[],s=[],c=[],l=new E,u=new E,h=new E,f,d;for(f=0;f<=n;f++)for(d=0;d<=r;d++){var m=d/r*i,g=f/n*Math.PI*2;u.x=(e+t*Math.cos(g))*Math.cos(m),u.y=(e+t*Math.cos(g))*Math.sin(m),u.z=t*Math.sin(g),o.push(u.x,u.y,u.z),l.x=e*Math.cos(m),l.y=e*Math.sin(m),h.subVectors(u,l).normalize(),s.push(h.x,h.y,h.z),c.push(d/r),c.push(f/n)}for(f=1;f<=n;f++)for(d=1;d<=r;d++){var y=(r+1)*f+d-1,p=(r+1)*(f-1)+d-1,v=(r+1)*(f-1)+d,_=(r+1)*f+d;a.push(y,p,_),a.push(p,v,_)}this.setIndex(a),this.setAttribute("position",new ce(o,3)),this.setAttribute("normal",new ce(s,3)),this.setAttribute("uv",new ce(c,2))}Ma.prototype=Object.create(ge.prototype);Ma.prototype.constructor=Ma;var Ty={triangulate:function(e,t,n){n=n||2;var r=t&&t.length,i=r?t[0]*n:e.length,a=Zh(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;var s,c,l,u,h,f,d;if(r&&(a=Cy(e,t,a,n)),e.length>80*n){s=l=e[0],c=u=e[1];for(var m=n;m<i;m+=n)h=e[m],f=e[m+1],h<s&&(s=h),f<c&&(c=f),h>l&&(l=h),f>u&&(u=f);d=Math.max(l-s,u-c),d=d!==0?1/d:0}return Ea(a,o,n,s,c,d),o}};function Zh(e,t,n,r,i){var a,o;if(i===Hy(e,t,n,r)>0)for(a=t;a<n;a+=r)o=Uu(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=Uu(a,e[a],e[a+1],o);return o&&Rs(o,o.next)&&(Sa(o),o=o.next),o}function dr(e,t){if(!e)return e;t||(t=e);var n=e,r;do if(r=!1,!n.steiner&&(Rs(n,n.next)||ht(n.prev,n,n.next)===0)){if(Sa(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function Ea(e,t,n,r,i,a,o){if(e){!o&&a&&Ny(e,r,i,a);for(var s=e,c,l;e.prev!==e.next;){if(c=e.prev,l=e.next,a?Ay(e,r,i,a):Sy(e)){t.push(c.i/n),t.push(e.i/n),t.push(l.i/n),Sa(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=Ly(dr(e),t,n),Ea(e,t,n,r,i,a,2)):o===2&&Py(e,t,n,r,i,a):Ea(dr(e),t,n,r,i,a,1);break}}}}function Sy(e){var t=e.prev,n=e,r=e.next;if(ht(t,n,r)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(ui(t.x,t.y,n.x,n.y,r.x,r.y,i.x,i.y)&&ht(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Ay(e,t,n,r){var i=e.prev,a=e,o=e.next;if(ht(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,c=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,l=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,u=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=Gl(s,c,t,n,r),f=Gl(l,u,t,n,r),d=e.prevZ,m=e.nextZ;d&&d.z>=h&&m&&m.z<=f;){if(d!==e.prev&&d!==e.next&&ui(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&ht(d.prev,d,d.next)>=0||(d=d.prevZ,m!==e.prev&&m!==e.next&&ui(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&ht(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;d&&d.z>=h;){if(d!==e.prev&&d!==e.next&&ui(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&ht(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;m&&m.z<=f;){if(m!==e.prev&&m!==e.next&&ui(i.x,i.y,a.x,a.y,o.x,o.y,m.x,m.y)&&ht(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function Ly(e,t,n){var r=e;do{var i=r.prev,a=r.next.next;!Rs(i,a)&&Jh(i,r,r.next,a)&&Ta(i,a)&&Ta(a,i)&&(t.push(i.i/n),t.push(r.i/n),t.push(a.i/n),Sa(r),Sa(r.next),r=e=a),r=r.next}while(r!==e);return dr(r)}function Py(e,t,n,r,i,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Uy(o,s)){var c=Qh(o,s);o=dr(o,o.next),c=dr(c,c.next),Ea(o,t,n,r,i,a),Ea(c,t,n,r,i,a);return}s=s.next}o=o.next}while(o!==e)}function Cy(e,t,n,r){var i=[],a,o,s,c,l;for(a=0,o=t.length;a<o;a++)s=t[a]*r,c=a<o-1?t[a+1]*r:e.length,l=Zh(e,s,c,r,!1),l===l.next&&(l.steiner=!0),i.push(By(l));for(i.sort(Ry),a=0;a<i.length;a++)Oy(i[a],n),n=dr(n,n.next);return n}function Ry(e,t){return e.x-t.x}function Oy(e,t){if(t=Dy(e,t),t){var n=Qh(t,e);dr(t,t.next),dr(n,n.next)}}function Dy(e,t){var n=t,r=e.x,i=e.y,a=-1/0,o;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a){if(a=s,s===r){if(i===n.y)return n;if(i===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!o)return null;if(r===a)return o;var c=o,l=o.x,u=o.y,h=1/0,f;n=o;do r>=n.x&&n.x>=l&&r!==n.x&&ui(i<u?r:a,i,l,u,i<u?a:r,i,n.x,n.y)&&(f=Math.abs(i-n.y)/(r-n.x),Ta(n,e)&&(f<h||f===h&&(n.x>o.x||n.x===o.x&&Iy(o,n)))&&(o=n,h=f)),n=n.next;while(n!==c);return o}function Iy(e,t){return ht(e.prev,e,t.prev)<0&&ht(t.next,e,e.next)<0}function Ny(e,t,n,r){var i=e;do i.z===null&&(i.z=Gl(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,Fy(i)}function Fy(e){var t,n,r,i,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<l&&(s++,r=r.nextZ,!!r);t++);for(c=l;s>0||c>0&&r;)s!==0&&(c===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1);return e}function Gl(e,t,n,r,i){return e=32767*(e-n)*i,t=32767*(t-r)*i,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function By(e){var t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function ui(e,t,n,r,i,a,o,s){return(i-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(r-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(i-o)*(r-s)>=0}function Uy(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!zy(e,t)&&(Ta(e,t)&&Ta(t,e)&&Gy(e,t)&&(ht(e.prev,e,t.prev)||ht(e,t.prev,t))||Rs(e,t)&&ht(e.prev,e,e.next)>0&&ht(t.prev,t,t.next)>0)}function ht(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Rs(e,t){return e.x===t.x&&e.y===t.y}function Jh(e,t,n,r){var i=wo(ht(e,t,n)),a=wo(ht(e,t,r)),o=wo(ht(n,r,e)),s=wo(ht(n,r,t));return!!(i!==a&&o!==s||i===0&&bo(e,n,t)||a===0&&bo(e,r,t)||o===0&&bo(n,e,r)||s===0&&bo(n,t,r))}function bo(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function wo(e){return e>0?1:e<0?-1:0}function zy(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Jh(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Ta(e,t){return ht(e.prev,e,e.next)<0?ht(e,t,e.next)>=0&&ht(e,e.prev,t)>=0:ht(e,t,e.prev)<0||ht(e,e.next,t)<0}function Gy(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Qh(e,t){var n=new Hl(e.i,e.x,e.y),r=new Hl(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Uu(e,t,n,r){var i=new Hl(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Sa(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 Hl(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Hy(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}var cr={area:function(e){for(var t=e.length,n=0,r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5},isClockWise:function(e){return cr.area(e)<0},triangulateShape:function(e,t){var n=[],r=[],i=[];zu(e),Gu(n,e);var a=e.length;t.forEach(zu);for(var o=0;o<t.length;o++)r.push(a),a+=t[o].length,Gu(n,t[o]);for(var s=Ty.triangulate(n,r),o=0;o<s.length;o+=3)i.push(s.slice(o,o+3));return i}};function zu(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Gu(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function xi(e,t){Fe.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Gn(e,t)),this.mergeVertices()}xi.prototype=Object.create(Fe.prototype);xi.prototype.constructor=xi;xi.prototype.toJSON=function(){var e=Fe.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return $h(t,n,e)};function Gn(e,t){ge.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,r=[],i=[],a=0,o=e.length;a<o;a++){var s=e[a];c(s)}this.setAttribute("position",new ce(r,3)),this.setAttribute("uv",new ce(i,2)),this.computeVertexNormals();function c(l){var u=[],h=t.curveSegments!==void 0?t.curveSegments:12,f=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:100,m=t.bevelEnabled!==void 0?t.bevelEnabled:!0,g=t.bevelThickness!==void 0?t.bevelThickness:6,y=t.bevelSize!==void 0?t.bevelSize:g-2,p=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3,_=t.extrudePath,x=t.UVGenerator!==void 0?t.UVGenerator:Vy;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),d=t.amount);var b,T=!1,C,N,O,J;_&&(b=_.getSpacedPoints(f),T=!0,m=!1,C=_.computeFrenetFrames(f,!1),N=new E,O=new E,J=new E),m||(v=0,g=0,y=0,p=0);var F,B,V,Y=l.extractPoints(h),D=Y.shape,z=Y.holes,k=!cr.isClockWise(D);if(k)for(D=D.reverse(),B=0,V=z.length;B<V;B++)F=z[B],cr.isClockWise(F)&&(z[B]=F.reverse());var q=cr.triangulateShape(D,z),Z=D;for(B=0,V=z.length;B<V;B++)F=z[B],D=D.concat(F);function ee(ie,Se,de){return Se||console.error("THREE.ExtrudeGeometry: vec does not exist"),Se.clone().multiplyScalar(de).add(ie)}var te,ae,Pe,_e,re,G=D.length,Be,xe=q.length;function Te(ie,Se,de){var Re,I,be,Me=ie.x-Se.x,Ve=ie.y-Se.y,Ee=de.x-ie.x,Ze=de.y-ie.y,rt=Me*Me+Ve*Ve,dt=Me*Ze-Ve*Ee;if(Math.abs(dt)>Number.EPSILON){var Ft=Math.sqrt(rt),it=Math.sqrt(Ee*Ee+Ze*Ze),At=Se.x-Ve/Ft,Ct=Se.y+Me/Ft,Xt=de.x-Ze/it,Fr=de.y+Ee/it,Br=((Xt-At)*Ze-(Fr-Ct)*Ee)/(Me*Ze-Ve*Ee);Re=At+Me*Br-ie.x,I=Ct+Ve*Br-ie.y;var gr=Re*Re+I*I;if(gr<=2)return new X(Re,I);be=Math.sqrt(gr/2)}else{var S=!1;Me>Number.EPSILON?Ee>Number.EPSILON&&(S=!0):Me<-Number.EPSILON?Ee<-Number.EPSILON&&(S=!0):Math.sign(Ve)===Math.sign(Ze)&&(S=!0),S?(Re=-Ve,I=Me,be=Math.sqrt(rt)):(Re=Me,I=Ve,be=Math.sqrt(rt/2))}return new X(Re/be,I/be)}for(var ue=[],K=0,Ce=Z.length,Ye=Ce-1,Qe=K+1;K<Ce;K++,Ye++,Qe++)Ye===Ce&&(Ye=0),Qe===Ce&&(Qe=0),ue[K]=Te(Z[K],Z[Ye],Z[Qe]);var et=[],Ke,A=ue.concat();for(B=0,V=z.length;B<V;B++){for(F=z[B],Ke=[],K=0,Ce=F.length,Ye=Ce-1,Qe=K+1;K<Ce;K++,Ye++,Qe++)Ye===Ce&&(Ye=0),Qe===Ce&&(Qe=0),Ke[K]=Te(F[K],F[Ye],F[Qe]);et.push(Ke),A=A.concat(Ke)}for(te=0;te<v;te++){for(Pe=te/v,_e=g*Math.cos(Pe*Math.PI/2),ae=y*Math.sin(Pe*Math.PI/2)+p,K=0,Ce=Z.length;K<Ce;K++)re=ee(Z[K],ue[K],ae),ye(re.x,re.y,-_e);for(B=0,V=z.length;B<V;B++)for(F=z[B],Ke=et[B],K=0,Ce=F.length;K<Ce;K++)re=ee(F[K],Ke[K],ae),ye(re.x,re.y,-_e)}for(ae=y+p,K=0;K<G;K++)re=m?ee(D[K],A[K],ae):D[K],T?(O.copy(C.normals[0]).multiplyScalar(re.x),N.copy(C.binormals[0]).multiplyScalar(re.y),J.copy(b[0]).add(O).add(N),ye(J.x,J.y,J.z)):ye(re.x,re.y,0);var L;for(L=1;L<=f;L++)for(K=0;K<G;K++)re=m?ee(D[K],A[K],ae):D[K],T?(O.copy(C.normals[L]).multiplyScalar(re.x),N.copy(C.binormals[L]).multiplyScalar(re.y),J.copy(b[L]).add(O).add(N),ye(J.x,J.y,J.z)):ye(re.x,re.y,d/f*L);for(te=v-1;te>=0;te--){for(Pe=te/v,_e=g*Math.cos(Pe*Math.PI/2),ae=y*Math.sin(Pe*Math.PI/2)+p,K=0,Ce=Z.length;K<Ce;K++)re=ee(Z[K],ue[K],ae),ye(re.x,re.y,d+_e);for(B=0,V=z.length;B<V;B++)for(F=z[B],Ke=et[B],K=0,Ce=F.length;K<Ce;K++)re=ee(F[K],Ke[K],ae),T?ye(re.x,re.y+b[f-1].y,b[f-1].x+_e):ye(re.x,re.y,d+_e)}ne(),$();function ne(){var ie=r.length/3;if(m){var Se=0,de=G*Se;for(K=0;K<xe;K++)Be=q[K],R(Be[2]+de,Be[1]+de,Be[0]+de);for(Se=f+v*2,de=G*Se,K=0;K<xe;K++)Be=q[K],R(Be[0]+de,Be[1]+de,Be[2]+de)}else{for(K=0;K<xe;K++)Be=q[K],R(Be[2],Be[1],Be[0]);for(K=0;K<xe;K++)Be=q[K],R(Be[0]+G*f,Be[1]+G*f,Be[2]+G*f)}n.addGroup(ie,r.length/3-ie,0)}function $(){var ie=r.length/3,Se=0;for(Ne(Z,Se),Se+=Z.length,B=0,V=z.length;B<V;B++)F=z[B],Ne(F,Se),Se+=F.length;n.addGroup(ie,r.length/3-ie,1)}function Ne(ie,Se){var de,Re;for(K=ie.length;--K>=0;){de=K,Re=K-1,Re<0&&(Re=ie.length-1);var I=0,be=f+v*2;for(I=0;I<be;I++){var Me=G*I,Ve=G*(I+1),Ee=Se+de+Me,Ze=Se+Re+Me,rt=Se+Re+Ve,dt=Se+de+Ve;he(Ee,Ze,rt,dt)}}}function ye(ie,Se,de){u.push(ie),u.push(Se),u.push(de)}function R(ie,Se,de){fe(ie),fe(Se),fe(de);var Re=r.length/3,I=x.generateTopUV(n,r,Re-3,Re-2,Re-1);ve(I[0]),ve(I[1]),ve(I[2])}function he(ie,Se,de,Re){fe(ie),fe(Se),fe(Re),fe(Se),fe(de),fe(Re);var I=r.length/3,be=x.generateSideWallUV(n,r,I-6,I-3,I-2,I-1);ve(be[0]),ve(be[1]),ve(be[3]),ve(be[1]),ve(be[2]),ve(be[3])}function fe(ie){r.push(u[ie*3+0]),r.push(u[ie*3+1]),r.push(u[ie*3+2])}function ve(ie){i.push(ie.x),i.push(ie.y)}}}Gn.prototype=Object.create(ge.prototype);Gn.prototype.constructor=Gn;Gn.prototype.toJSON=function(){var e=ge.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return $h(t,n,e)};var Vy={generateTopUV:function(e,t,n,r,i){var a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new X(a,o),new X(s,c),new X(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){var o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],h=t[r*3+2],f=t[i*3],d=t[i*3+1],m=t[i*3+2],g=t[a*3],y=t[a*3+1],p=t[a*3+2];return Math.abs(s-u)<.01?[new X(o,1-c),new X(l,1-h),new X(f,1-m),new X(g,1-p)]:[new X(s,1-c),new X(u,1-h),new X(d,1-m),new X(y,1-p)]}};function $h(e,t,n){if(n.shapes=[],Array.isArray(e))for(var r=0,i=e.length;r<i;r++){var a=e[r];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function ls(e,t){Fe.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new Aa(e,t)),this.mergeVertices()}ls.prototype=Object.create(Fe.prototype);ls.prototype.constructor=ls;function Aa(e,t){t=t||{};var n=t.font;if(!(n&&n.isFont))return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Fe;var r=n.generateShapes(e,t.size);t.depth=t.height!==void 0?t.height:50,t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),Gn.call(this,r,t),this.type="TextBufferGeometry"}Aa.prototype=Object.create(Gn.prototype);Aa.prototype.constructor=Aa;function cs(e,t,n,r,i,a,o){Fe.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new _i(e,t,n,r,i,a,o)),this.mergeVertices()}cs.prototype=Object.create(Fe.prototype);cs.prototype.constructor=cs;function _i(e,t,n,r,i,a,o){ge.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),r=r!==void 0?r:0,i=i!==void 0?i:Math.PI*2,a=a!==void 0?a:0,o=o!==void 0?o:Math.PI;var s=Math.min(a+o,Math.PI),c,l,u=0,h=[],f=new E,d=new E,m=[],g=[],y=[],p=[];for(l=0;l<=n;l++){var v=[],_=l/n,x=0;for(l==0&&a==0?x=.5/t:l==n&&s==Math.PI&&(x=-.5/t),c=0;c<=t;c++){var b=c/t;f.x=-e*Math.cos(r+b*i)*Math.sin(a+_*o),f.y=e*Math.cos(a+_*o),f.z=e*Math.sin(r+b*i)*Math.sin(a+_*o),g.push(f.x,f.y,f.z),d.copy(f).normalize(),y.push(d.x,d.y,d.z),p.push(b+x,1-_),v.push(u++)}h.push(v)}for(l=0;l<n;l++)for(c=0;c<t;c++){var T=h[l][c+1],C=h[l][c],N=h[l+1][c],O=h[l+1][c+1];(l!==0||a>0)&&m.push(T,C,O),(l!==n-1||s<Math.PI)&&m.push(C,N,O)}this.setIndex(m),this.setAttribute("position",new ce(g,3)),this.setAttribute("normal",new ce(y,3)),this.setAttribute("uv",new ce(p,2))}_i.prototype=Object.create(ge.prototype);_i.prototype.constructor=_i;function us(e,t,n,r,i,a){Fe.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},this.fromBufferGeometry(new La(e,t,n,r,i,a)),this.mergeVertices()}us.prototype=Object.create(Fe.prototype);us.prototype.constructor=us;function La(e,t,n,r,i,a){ge.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:i,thetaLength:a},e=e||.5,t=t||1,i=i!==void 0?i:0,a=a!==void 0?a:Math.PI*2,n=n!==void 0?Math.max(3,n):8,r=r!==void 0?Math.max(1,r):1;var o=[],s=[],c=[],l=[],u,h=e,f=(t-e)/r,d=new E,m=new X,g,y;for(g=0;g<=r;g++){for(y=0;y<=n;y++)u=i+y/n*a,d.x=h*Math.cos(u),d.y=h*Math.sin(u),s.push(d.x,d.y,d.z),c.push(0,0,1),m.x=(d.x/t+1)/2,m.y=(d.y/t+1)/2,l.push(m.x,m.y);h+=f}for(g=0;g<r;g++){var p=g*(n+1);for(y=0;y<n;y++){u=y+p;var v=u,_=u+n+1,x=u+n+2,b=u+1;o.push(v,_,b),o.push(_,x,b)}}this.setIndex(o),this.setAttribute("position",new ce(s,3)),this.setAttribute("normal",new ce(c,3)),this.setAttribute("uv",new ce(l,2))}La.prototype=Object.create(ge.prototype);La.prototype.constructor=La;function hs(e,t,n,r){Fe.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},this.fromBufferGeometry(new Pa(e,t,n,r)),this.mergeVertices()}hs.prototype=Object.create(Fe.prototype);hs.prototype.constructor=hs;function Pa(e,t,n,r){ge.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t)||12,n=n||0,r=r||Math.PI*2,r=ke.clamp(r,0,Math.PI*2);var i=[],a=[],o=[],s,c=1/t,l=new E,u=new X,h,f;for(h=0;h<=t;h++){var d=n+h*c*r,m=Math.sin(d),g=Math.cos(d);for(f=0;f<=e.length-1;f++)l.x=e[f].x*m,l.y=e[f].y,l.z=e[f].x*g,a.push(l.x,l.y,l.z),u.x=h/t,u.y=f/(e.length-1),o.push(u.x,u.y)}for(h=0;h<t;h++)for(f=0;f<e.length-1;f++){s=f+h*e.length;var y=s,p=s+e.length,v=s+e.length+1,_=s+1;i.push(y,p,_),i.push(p,v,_)}if(this.setIndex(i),this.setAttribute("position",new ce(a,3)),this.setAttribute("uv",new ce(o,2)),this.computeVertexNormals(),r===Math.PI*2){var x=this.attributes.normal.array,b=new E,T=new E,C=new E;for(s=t*e.length*3,h=0,f=0;h<e.length;h++,f+=3)b.x=x[f+0],b.y=x[f+1],b.z=x[f+2],T.x=x[s+f+0],T.y=x[s+f+1],T.z=x[s+f+2],C.addVectors(b,T).normalize(),x[f+0]=x[s+f+0]=C.x,x[f+1]=x[s+f+1]=C.y,x[f+2]=x[s+f+2]=C.z}}Pa.prototype=Object.create(ge.prototype);Pa.prototype.constructor=Pa;function bi(e,t){Fe.call(this),this.type="ShapeGeometry",typeof t=="object"&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new wi(e,t)),this.mergeVertices()}bi.prototype=Object.create(Fe.prototype);bi.prototype.constructor=bi;bi.prototype.toJSON=function(){var e=Fe.prototype.toJSON.call(this),t=this.parameters.shapes;return Kh(t,e)};function wi(e,t){ge.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],r=[],i=[],a=[],o=0,s=0;if(Array.isArray(e)===!1)l(e);else for(var c=0;c<e.length;c++)l(e[c]),this.addGroup(o,s,c),o+=s,s=0;this.setIndex(n),this.setAttribute("position",new ce(r,3)),this.setAttribute("normal",new ce(i,3)),this.setAttribute("uv",new ce(a,2));function l(u){var h,f,d,m=r.length/3,g=u.extractPoints(t),y=g.shape,p=g.holes;for(cr.isClockWise(y)===!1&&(y=y.reverse()),h=0,f=p.length;h<f;h++)d=p[h],cr.isClockWise(d)===!0&&(p[h]=d.reverse());var v=cr.triangulateShape(y,p);for(h=0,f=p.length;h<f;h++)d=p[h],y=y.concat(d);for(h=0,f=y.length;h<f;h++){var _=y[h];r.push(_.x,_.y,0),i.push(0,0,1),a.push(_.x,_.y)}for(h=0,f=v.length;h<f;h++){var x=v[h],b=x[0]+m,T=x[1]+m,C=x[2]+m;n.push(b,T,C),s+=3}}}wi.prototype=Object.create(ge.prototype);wi.prototype.constructor=wi;wi.prototype.toJSON=function(){var e=ge.prototype.toJSON.call(this),t=this.parameters.shapes;return Kh(t,e)};function Kh(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,r=e.length;n<r;n++){var i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}function fs(e,t){ge.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=t!==void 0?t:1;var n=[],r=Math.cos(ke.DEG2RAD*t),i=[0,0],a={},o,s,c,l=["a","b","c"],u;e.isBufferGeometry?(u=new Fe,u.fromBufferGeometry(e)):u=e.clone(),u.mergeVertices(),u.computeFaceNormals();for(var h=u.vertices,f=u.faces,d=0,m=f.length;d<m;d++)for(var g=f[d],y=0;y<3;y++)o=g[l[y]],s=g[l[(y+1)%3]],i[0]=Math.min(o,s),i[1]=Math.max(o,s),c=i[0]+","+i[1],a[c]===void 0?a[c]={index1:i[0],index2:i[1],face1:d,face2:void 0}:a[c].face2=d;for(c in a){var p=a[c];if(p.face2===void 0||f[p.face1].normal.dot(f[p.face2].normal)<=r){var v=h[p.index1];n.push(v.x,v.y,v.z),v=h[p.index2],n.push(v.x,v.y,v.z)}}this.setAttribute("position",new ce(n,3))}fs.prototype=Object.create(ge.prototype);fs.prototype.constructor=fs;function Mi(e,t,n,r,i,a,o,s){Fe.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new pr(e,t,n,r,i,a,o,s)),this.mergeVertices()}Mi.prototype=Object.create(Fe.prototype);Mi.prototype.constructor=Mi;function pr(e,t,n,r,i,a,o,s){ge.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};var c=this;e=e!==void 0?e:1,t=t!==void 0?t:1,n=n||1,r=Math.floor(r)||8,i=Math.floor(i)||1,a=a!==void 0?a:!1,o=o!==void 0?o:0,s=s!==void 0?s:Math.PI*2;var l=[],u=[],h=[],f=[],d=0,m=[],g=n/2,y=0;p(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute("position",new ce(u,3)),this.setAttribute("normal",new ce(h,3)),this.setAttribute("uv",new ce(f,2));function p(){var _,x,b=new E,T=new E,C=0,N=(t-e)/n;for(x=0;x<=i;x++){var O=[],J=x/i,F=J*(t-e)+e;for(_=0;_<=r;_++){var B=_/r,V=B*s+o,Y=Math.sin(V),D=Math.cos(V);T.x=F*Y,T.y=-J*n+g,T.z=F*D,u.push(T.x,T.y,T.z),b.set(Y,N,D).normalize(),h.push(b.x,b.y,b.z),f.push(B,1-J),O.push(d++)}m.push(O)}for(_=0;_<r;_++)for(x=0;x<i;x++){var z=m[x][_],k=m[x+1][_],q=m[x+1][_+1],Z=m[x][_+1];l.push(z,k,Z),l.push(k,q,Z),C+=6}c.addGroup(y,C,0),y+=C}function v(_){var x,b,T,C=new X,N=new E,O=0,J=_===!0?e:t,F=_===!0?1:-1;for(b=d,x=1;x<=r;x++)u.push(0,g*F,0),h.push(0,F,0),f.push(.5,.5),d++;for(T=d,x=0;x<=r;x++){var B=x/r,V=B*s+o,Y=Math.cos(V),D=Math.sin(V);N.x=J*D,N.y=g*F,N.z=J*Y,u.push(N.x,N.y,N.z),h.push(0,F,0),C.x=Y*.5+.5,C.y=D*.5*F+.5,f.push(C.x,C.y),d++}for(x=0;x<r;x++){var z=b+x,k=T+x;_===!0?l.push(k,k+1,z):l.push(k+1,k,z),O+=3}c.addGroup(y,O,_===!0?1:2),y+=O}}pr.prototype=Object.create(ge.prototype);pr.prototype.constructor=pr;function ds(e,t,n,r,i,a,o){Mi.call(this,0,e,t,n,r,i,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}ds.prototype=Object.create(Mi.prototype);ds.prototype.constructor=ds;function ps(e,t,n,r,i,a,o){pr.call(this,0,e,t,n,r,i,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:i,thetaStart:a,thetaLength:o}}ps.prototype=Object.create(pr.prototype);ps.prototype.constructor=ps;function vs(e,t,n,r){Fe.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},this.fromBufferGeometry(new Ca(e,t,n,r)),this.mergeVertices()}vs.prototype=Object.create(Fe.prototype);vs.prototype.constructor=vs;function Ca(e,t,n,r){ge.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},e=e||1,t=t!==void 0?Math.max(3,t):8,n=n!==void 0?n:0,r=r!==void 0?r:Math.PI*2;var i=[],a=[],o=[],s=[],c,l,u=new E,h=new X;for(a.push(0,0,0),o.push(0,0,1),s.push(.5,.5),l=0,c=3;l<=t;l++,c+=3){var f=n+l/t*r;u.x=e*Math.cos(f),u.y=e*Math.sin(f),a.push(u.x,u.y,u.z),o.push(0,0,1),h.x=(a[c]/e+1)/2,h.y=(a[c+1]/e+1)/2,s.push(h.x,h.y)}for(c=1;c<=t;c++)i.push(c,c+1,0);this.setIndex(i),this.setAttribute("position",new ce(a,3)),this.setAttribute("normal",new ce(o,3)),this.setAttribute("uv",new ce(s,2))}Ca.prototype=Object.create(ge.prototype);Ca.prototype.constructor=Ca;var Bt=Object.freeze({__proto__:null,WireframeGeometry:$o,ParametricGeometry:Ko,ParametricBufferGeometry:ya,TetrahedronGeometry:ts,TetrahedronBufferGeometry:xa,OctahedronGeometry:ns,OctahedronBufferGeometry:gi,IcosahedronGeometry:rs,IcosahedronBufferGeometry:_a,DodecahedronGeometry:is,DodecahedronBufferGeometry:ba,PolyhedronGeometry:es,PolyhedronBufferGeometry:Zt,TubeGeometry:as,TubeBufferGeometry:yi,TorusKnotGeometry:os,TorusKnotBufferGeometry:wa,TorusGeometry:ss,TorusBufferGeometry:Ma,TextGeometry:ls,TextBufferGeometry:Aa,SphereGeometry:cs,SphereBufferGeometry:_i,RingGeometry:us,RingBufferGeometry:La,PlaneGeometry:jo,PlaneBufferGeometry:mi,LatheGeometry:hs,LatheBufferGeometry:Pa,ShapeGeometry:bi,ShapeBufferGeometry:wi,ExtrudeGeometry:xi,ExtrudeBufferGeometry:Gn,EdgesGeometry:fs,ConeGeometry:ds,ConeBufferGeometry:ps,CylinderGeometry:Mi,CylinderBufferGeometry:pr,CircleGeometry:vs,CircleBufferGeometry:Ca,BoxGeometry:Lp,BoxBufferGeometry:Cs});function Ei(e){Ie.call(this),this.type="ShadowMaterial",this.color=new pe(0),this.transparent=!0,this.setValues(e)}Ei.prototype=Object.create(Ie.prototype);Ei.prototype.constructor=Ei;Ei.prototype.isShadowMaterial=!0;Ei.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.color.copy(e.color),this};function vr(e){Wt.call(this,e),this.type="RawShaderMaterial"}vr.prototype=Object.create(Wt.prototype);vr.prototype.constructor=vr;vr.prototype.isRawShaderMaterial=!0;function Hn(e){Ie.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new pe(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 pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Di,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.vertexTangents=!1,this.setValues(e)}Hn.prototype=Object.create(Ie.prototype);Hn.prototype.constructor=Hn;Hn.prototype.isMeshStandardMaterial=!0;Hn.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.vertexTangents=e.vertexTangents,this};function Ti(e){Hn.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new X(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,this.sheen=null,this.transparency=0,this.setValues(e)}Ti.prototype=Object.create(Hn.prototype);Ti.prototype.constructor=Ti;Ti.prototype.isMeshPhysicalMaterial=!0;Ti.prototype.copy=function(e){return Hn.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new pe).copy(e.sheen):this.sheen=null,this.transparency=e.transparency,this};function Ir(e){Ie.call(this),this.type="MeshPhongMaterial",this.color=new pe(16777215),this.specular=new pe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Di,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Ss,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}Ir.prototype=Object.create(Ie.prototype);Ir.prototype.constructor=Ir;Ir.prototype.isMeshPhongMaterial=!0;Ir.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function Si(e){Ie.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new pe(16777215),this.specular=new pe(1118481),this.shininess=30,this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Di,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}Si.prototype=Object.create(Ie.prototype);Si.prototype.constructor=Si;Si.prototype.isMeshToonMaterial=!0;Si.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function Ai(e){Ie.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Di,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}Ai.prototype=Object.create(Ie.prototype);Ai.prototype.constructor=Ai;Ai.prototype.isMeshNormalMaterial=!0;Ai.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function Li(e){Ie.call(this),this.type="MeshLambertMaterial",this.color=new pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Ss,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}Li.prototype=Object.create(Ie.prototype);Li.prototype.constructor=Li;Li.prototype.isMeshLambertMaterial=!0;Li.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function Pi(e){Ie.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new pe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Di,this.normalScale=new X(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}Pi.prototype=Object.create(Ie.prototype);Pi.prototype.constructor=Pi;Pi.prototype.isMeshMatcapMaterial=!0;Pi.prototype.copy=function(e){return Ie.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function Ci(e){xt.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}Ci.prototype=Object.create(xt.prototype);Ci.prototype.constructor=Ci;Ci.prototype.isLineDashedMaterial=!0;Ci.prototype.copy=function(e){return xt.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var ky=Object.freeze({__proto__:null,ShadowMaterial:Ei,SpriteMaterial:Or,RawShaderMaterial:vr,ShaderMaterial:Wt,PointsMaterial:Dr,MeshPhysicalMaterial:Ti,MeshStandardMaterial:Hn,MeshPhongMaterial:Ir,MeshToonMaterial:Si,MeshNormalMaterial:Ai,MeshLambertMaterial:Li,MeshDepthMaterial:Cr,MeshDistanceMaterial:Rr,MeshBasicMaterial:pn,MeshMatcapMaterial:Pi,LineDashedMaterial:Ci,LineBasicMaterial:xt,Material:Ie}),ut={arraySlice:function(e,t,n){return ut.isTypedArray(e)?new e.constructor(e.subarray(t,n!==void 0?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:typeof t.BYTES_PER_ELEMENT=="number"?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(a,o){return e[a]-e[o]}for(var n=e.length,r=new Array(n),i=0;i!==n;++i)r[i]=i;return r.sort(t),r},sortedArray:function(e,t,n){for(var r=e.length,i=new e.constructor(r),a=0,o=0;o!==r;++a)for(var s=n[a]*t,c=0;c!==t;++c)i[o++]=e[s+c];return i},flattenJSON:function(e,t,n,r){for(var i=1,a=e[0];a!==void 0&&a[r]===void 0;)a=e[i++];if(a!==void 0){var o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push.apply(n,o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}},subclip:function(e,t,n,r,i){i=i||30;var a=e.clone();a.name=t;for(var o=[],s=0;s<a.tracks.length;++s){for(var c=a.tracks[s],l=c.getValueSize(),u=[],h=[],f=0;f<c.times.length;++f){var d=c.times[f]*i;if(!(d<n||d>=r)){u.push(c.times[f]);for(var m=0;m<l;++m)h.push(c.values[f*l+m])}}u.length!==0&&(c.times=ut.convertArray(u,c.times.constructor),c.values=ut.convertArray(h,c.values.constructor),o.push(c))}a.tracks=o;for(var g=1/0,s=0;s<a.tracks.length;++s)g>a.tracks[s].times[0]&&(g=a.tracks[s].times[0]);for(var s=0;s<a.tracks.length;++s)a.tracks[s].shift(-1*g);return a.resetDuration(),a},makeClipAdditive:function(e,t,n,r){t===void 0&&(t=0),n===void 0&&(n=e),(r===void 0||r<=0)&&(r=30);for(var i=e.tracks.length,a=t/r,o=0;o<i;++o){var s=n.tracks[o],c=s.ValueTypeName;if(!(c==="bool"||c==="string")){var l=e.tracks.find(function(x){return x.name===s.name&&x.ValueTypeName===c});if(l!==void 0){var u=s.getValueSize(),h=s.times.length-1,f;if(a<=s.times[0])f=ut.arraySlice(s.values,0,s.valueSize);else if(a>=s.times[h]){var d=h*u;f=ut.arraySlice(s.values,d)}else{var m=s.createInterpolant();m.evaluate(a),f=m.resultBuffer}if(c==="quaternion"){var g=new wt(f[0],f[1],f[2],f[3]).normalize().conjugate();g.toArray(f)}for(var y=l.times.length,p=0;p<y;++p){var v=p*u;if(c==="quaternion")wt.multiplyQuaternionsFlat(l.values,v,f,0,l.values,v);else for(var _=0;_<u;++_)l.values[v+_]-=f[_]}}}}return e.blendMode=Ph,e}};function en(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n}Object.assign(en.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];e:{t:{var a;n:{r:if(!(e<r)){for(var o=n+2;;){if(r===void 0){if(e<i)break r;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,i)}if(n===o)break;if(i=r,r=t[++n],e<r)break t}a=t.length;break n}if(!(e>=i)){var s=t[1];e<s&&(n=2,i=s);for(var o=n-2;;){if(i===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(n===o)break;if(r=i,i=t[--n-1],e>=i)break t}a=n,n=0;break n}break e}for(;n<a;){var c=n+a>>>1;e<t[c]?a=c:n=c+1}if(r=t[n],i=t[n-1],i===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,r);if(r===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,i,e)}this._cachedIndex=n,this.intervalChanged_(n,i,r)}return this.interpolate_(n,i,e,r)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,i=e*r,a=0;a!==r;++a)t[a]=n[i+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}});Object.assign(en.prototype,{beforeStart_:en.prototype.copySampleValue_,afterEnd_:en.prototype.copySampleValue_});function Vl(e,t,n,r){en.call(this,e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}Vl.prototype=Object.assign(Object.create(en.prototype),{constructor:Vl,DefaultSettings_:{endingStart:di,endingEnd:di},intervalChanged_:function(e,t,n){var r=this.parameterPositions,i=e-2,a=e+1,o=r[i],s=r[a];if(o===void 0)switch(this.getSettings_().endingStart){case oi:i=e,o=2*t-n;break;case Wo:i=r.length-2,o=t+r[i]-r[i+1];break;default:i=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case oi:a=e,s=2*n-t;break;case Wo:a=1,s=n+r[1]-r[0];break;default:a=e-1,s=t}var c=(n-t)*.5,l=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(s-n),this._offsetPrev=i*l,this._offsetNext=a*l},interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,f=this._weightNext,d=(n-t)/(r-t),m=d*d,g=m*d,y=-h*g+2*h*m-h*d,p=(1+h)*g+(-1.5-2*h)*m+(-.5+h)*d+1,v=(-1-f)*g+(1.5+f)*m+.5*d,_=f*g-f*m,x=0;x!==o;++x)i[x]=y*a[l+x]+p*a[c+x]+v*a[s+x]+_*a[u+x];return i}});function ms(e,t,n,r){en.call(this,e,t,n,r)}ms.prototype=Object.assign(Object.create(en.prototype),{constructor:ms,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=s-o,l=(n-t)/(r-t),u=1-l,h=0;h!==o;++h)i[h]=a[c+h]*u+a[s+h]*l;return i}});function kl(e,t,n,r){en.call(this,e,t,n,r)}kl.prototype=Object.assign(Object.create(en.prototype),{constructor:kl,interpolate_:function(e){return this.copySampleValue_(e-1)}});function Nt(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ut.convertArray(t,this.TimeBufferType),this.values=ut.convertArray(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}Object.assign(Nt,{toJSON:function(e){var t=e.constructor,n;if(t.toJSON!==void 0)n=t.toJSON(e);else{n={name:e.name,times:ut.convertArray(e.times,Array),values:ut.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}});Object.assign(Nt.prototype,{constructor:Nt,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:No,InterpolantFactoryMethodDiscrete:function(e){return new kl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new ms(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Vl(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case ko:t=this.InterpolantFactoryMethodDiscrete;break;case No:t=this.InterpolantFactoryMethodLinear;break;case zs:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ko;case this.InterpolantFactoryMethodLinear:return No;case this.InterpolantFactoryMethodSmooth:return zs}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(e!==0)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(e!==1)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,i=0,a=r-1;i!==r&&n[i]<e;)++i;for(;a!==-1&&n[a]>t;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);var o=this.getValueSize();this.times=ut.arraySlice(n,i,a),this.values=ut.arraySlice(this.values,i*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,r=this.values,i=n.length;i===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==i;o++){var s=n[o];if(typeof s=="number"&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(a!==null&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(r!==void 0&&ut.isTypedArray(r))for(var o=0,c=r.length;o!==c;++o){var l=r[o];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e},optimize:function(){for(var e=ut.arraySlice(this.times),t=ut.arraySlice(this.values),n=this.getValueSize(),r=this.getInterpolation()===zs,i=1,a=e.length-1,o=1;o<a;++o){var s=!1,c=e[o],l=e[o+1];if(c!==l&&(o!==1||c!==c[0]))if(r)s=!0;else for(var u=o*n,h=u-n,f=u+n,d=0;d!==n;++d){var m=t[u+d];if(m!==t[h+d]||m!==t[f+d]){s=!0;break}}if(s){if(o!==i){e[i]=e[o];for(var g=o*n,y=i*n,d=0;d!==n;++d)t[y+d]=t[g+d]}++i}}if(a>0){e[i]=e[a];for(var g=a*n,y=i*n,d=0;d!==n;++d)t[y+d]=t[g+d];++i}return i!==e.length?(this.times=ut.arraySlice(e,0,i),this.values=ut.arraySlice(t,0,i*n)):(this.times=e,this.values=t),this},clone:function(){var e=ut.arraySlice(this.times,0),t=ut.arraySlice(this.values,0),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}});function Wl(e,t,n){Nt.call(this,e,t,n)}Wl.prototype=Object.assign(Object.create(Nt.prototype),{constructor:Wl,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:ko,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});function Xl(e,t,n,r){Nt.call(this,e,t,n,r)}Xl.prototype=Object.assign(Object.create(Nt.prototype),{constructor:Xl,ValueTypeName:"color"});function Ra(e,t,n,r){Nt.call(this,e,t,n,r)}Ra.prototype=Object.assign(Object.create(Nt.prototype),{constructor:Ra,ValueTypeName:"number"});function jl(e,t,n,r){en.call(this,e,t,n,r)}jl.prototype=Object.assign(Object.create(en.prototype),{constructor:jl,interpolate_:function(e,t,n,r){for(var i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,c=(n-t)/(r-t),l=s+o;s!==l;s+=4)wt.slerpFlat(i,0,a,s-o,a,s,c);return i}});function gs(e,t,n,r){Nt.call(this,e,t,n,r)}gs.prototype=Object.assign(Object.create(Nt.prototype),{constructor:gs,ValueTypeName:"quaternion",DefaultInterpolation:No,InterpolantFactoryMethodLinear:function(e){return new jl(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0});function ql(e,t,n,r){Nt.call(this,e,t,n,r)}ql.prototype=Object.assign(Object.create(Nt.prototype),{constructor:ql,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:ko,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});function Oa(e,t,n,r){Nt.call(this,e,t,n,r)}Oa.prototype=Object.assign(Object.create(Nt.prototype),{constructor:Oa,ValueTypeName:"vector"});function hn(e,t,n,r){this.name=e,this.tracks=n,this.duration=t!==void 0?t:-1,this.blendMode=r!==void 0?r:Ec,this.uuid=ke.generateUUID(),this.duration<0&&this.resetDuration()}function Wy(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ra;case"vector":case"vector2":case"vector3":case"vector4":return Oa;case"color":return Xl;case"quaternion":return gs;case"bool":case"boolean":return Wl;case"string":return ql}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function Xy(e){if(e.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=Wy(e.type);if(e.times===void 0){var n=[],r=[];ut.flattenJSON(e.keys,n,r,"value"),e.times=n,e.values=r}return t.parse!==void 0?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(hn,{parse:function(e){for(var t=[],n=e.tracks,r=1/(e.fps||1),i=0,a=n.length;i!==a;++i)t.push(Xy(n[i]).scale(r));return new hn(e.name,e.duration,t,e.blendMode)},toJSON:function(e){for(var t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode},i=0,a=n.length;i!==a;++i)t.push(Nt.toJSON(n[i]));return r},CreateFromMorphTargetSequence:function(e,t,n,r){for(var i=t.length,a=[],o=0;o<i;o++){var s=[],c=[];s.push((o+i-1)%i,o,(o+1)%i),c.push(0,1,0);var l=ut.getKeyframeOrder(s);s=ut.sortedArray(s,1,l),c=ut.sortedArray(c,1,l),!r&&s[0]===0&&(s.push(i),c.push(c[0])),a.push(new Ra(".morphTargetInfluences["+t[o].name+"]",s,c).scale(1/n))}return new hn(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var r=e;n=r.geometry&&r.geometry.animations||r.animations}for(var i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var r={},i=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],c=s.name.match(i);if(c&&c.length>1){var l=c[1],u=r[l];u||(r[l]=u=[]),u.push(s)}}var h=[];for(var l in r)h.push(hn.CreateFromMorphTargetSequence(l,r[l],t,n));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(x,b,T,C,N){if(T.length!==0){var O=[],J=[];ut.flattenJSON(T,O,J,C),O.length!==0&&N.push(new x(b,O,J))}},r=[],i=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.blendMode,c=e.hierarchy||[],l=0;l<c.length;l++){var u=c[l].keys;if(!(!u||u.length===0))if(u[0].morphTargets){for(var h={},f=0;f<u.length;f++)if(u[f].morphTargets)for(var d=0;d<u[f].morphTargets.length;d++)h[u[f].morphTargets[d]]=-1;for(var m in h){for(var g=[],y=[],d=0;d!==u[f].morphTargets.length;++d){var p=u[f];g.push(p.time),y.push(p.morphTarget===m?1:0)}r.push(new Ra(".morphTargetInfluence["+m+"]",g,y))}a=h.length*(o||1)}else{var v=".bones["+t[l].name+"]";n(Oa,v+".position",u,"pos",r),n(gs,v+".quaternion",u,"rot",r),n(Oa,v+".scale",u,"scl",r)}}if(r.length===0)return null;var _=new hn(i,a,r,s);return _}});Object.assign(hn.prototype,{resetDuration:function(){for(var e=this.tracks,t=0,n=0,r=e.length;n!==r;++n){var i=this.tracks[n];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new hn(this.name,this.duration,e,this.blendMode)}});var Ri={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){if(this.enabled!==!1)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function ef(e,t,n){var r=this,i=!1,a=0,o=0,s=void 0,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(l){o++,i===!1&&r.onStart!==void 0&&r.onStart(l,a,o),i=!0},this.itemEnd=function(l){a++,r.onProgress!==void 0&&r.onProgress(l,a,o),a===o&&(i=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(l){r.onError!==void 0&&r.onError(l)},this.resolveURL=function(l){return s?s(l):l},this.setURLModifier=function(l){return s=l,this},this.addHandler=function(l,u){return c.push(l,u),this},this.removeHandler=function(l){var u=c.indexOf(l);return u!==-1&&c.splice(u,2),this},this.getHandler=function(l){for(var u=0,h=c.length;u<h;u+=2){var f=c[u],d=c[u+1];if(f.global&&(f.lastIndex=0),f.test(l))return d}return null}}var jy=new ef;function nt(e){this.manager=e!==void 0?e:jy,this.crossOrigin="anonymous",this.path="",this.resourcePath="",this.requestHeader={}}Object.assign(nt.prototype,{load:function(){},loadAsync:function(e,t){var n=this;return new Promise(function(r,i){n.load(e,r,t,i)})},parse:function(){},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}});var cn={};function En(e){nt.call(this,e)}En.prototype=Object.assign(Object.create(nt.prototype),{constructor:En,load:function(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Ri.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;if(cn[e]!==void 0){cn[e].push({onLoad:t,onProgress:n,onError:r});return}var o=/^data:(.*?)(;base64)?,(.*)$/,s=e.match(o);if(s){var c=s[1],l=!!s[2],u=s[3];u=decodeURIComponent(u),l&&(u=atob(u));try{var h,f=(this.responseType||"").toLowerCase();switch(f){case"arraybuffer":case"blob":for(var d=new Uint8Array(u.length),m=0;m<u.length;m++)d[m]=u.charCodeAt(m);f==="blob"?h=new Blob([d.buffer],{type:c}):h=d.buffer;break;case"document":var g=new DOMParser;h=g.parseFromString(u,c);break;case"json":h=JSON.parse(u);break;default:h=u;break}setTimeout(function(){t&&t(h),i.manager.itemEnd(e)},0)}catch(v){setTimeout(function(){r&&r(v),i.manager.itemError(e),i.manager.itemEnd(e)},0)}}else{cn[e]=[],cn[e].push({onLoad:t,onProgress:n,onError:r});var y=new XMLHttpRequest;y.open("GET",e,!0),y.addEventListener("load",function(v){var _=this.response,x=cn[e];if(delete cn[e],this.status===200||this.status===0){this.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),Ri.add(e,_);for(var b=0,T=x.length;b<T;b++){var C=x[b];C.onLoad&&C.onLoad(_)}i.manager.itemEnd(e)}else{for(var b=0,T=x.length;b<T;b++){var C=x[b];C.onError&&C.onError(v)}i.manager.itemError(e),i.manager.itemEnd(e)}},!1),y.addEventListener("progress",function(v){for(var _=cn[e],x=0,b=_.length;x<b;x++){var T=_[x];T.onProgress&&T.onProgress(v)}},!1),y.addEventListener("error",function(v){var _=cn[e];delete cn[e];for(var x=0,b=_.length;x<b;x++){var T=_[x];T.onError&&T.onError(v)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),y.addEventListener("abort",function(v){var _=cn[e];delete cn[e];for(var x=0,b=_.length;x<b;x++){var T=_[x];T.onError&&T.onError(v)}i.manager.itemError(e),i.manager.itemEnd(e)},!1),this.responseType!==void 0&&(y.responseType=this.responseType),this.withCredentials!==void 0&&(y.withCredentials=this.withCredentials),y.overrideMimeType&&y.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain");for(var p in this.requestHeader)y.setRequestHeader(p,this.requestHeader[p]);y.send(null)}return i.manager.itemStart(e),y},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this}});function Hu(e){nt.call(this,e)}Hu.prototype=Object.assign(Object.create(nt.prototype),{constructor:Hu,load:function(e,t,n,r){var i=this,a=new En(i.manager);a.setPath(i.path),a.load(e,function(o){try{t(i.parse(JSON.parse(o)))}catch(s){r?r(s):console.error(s),i.manager.itemError(e)}},n,r)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var r=hn.parse(e[n]);t.push(r)}return t}});function Vu(e){nt.call(this,e)}Vu.prototype=Object.assign(Object.create(nt.prototype),{constructor:Vu,load:function(e,t,n,r){var i=this,a=[],o=new ga;o.image=a;var s=new En(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer");function c(f){s.load(e[f],function(d){var m=i.parse(d,!0);a[f]={width:m.width,height:m.height,format:m.format,mipmaps:m.mipmaps},l+=1,l===6&&(m.mipmapCount===1&&(o.minFilter=It),o.format=m.format,o.needsUpdate=!0,t&&t(o))},n,r)}if(Array.isArray(e))for(var l=0,u=0,h=e.length;u<h;++u)c(u);else s.load(e,function(f){var d=i.parse(f,!0);if(d.isCubemap)for(var m=d.mipmaps.length/d.mipmapCount,g=0;g<m;g++){a[g]={mipmaps:[]};for(var y=0;y<d.mipmapCount;y++)a[g].mipmaps.push(d.mipmaps[g*d.mipmapCount+y]),a[g].format=d.format,a[g].width=d.width,a[g].height=d.height}else o.image.width=d.width,o.image.height=d.height,o.mipmaps=d.mipmaps;d.mipmapCount===1&&(o.minFilter=It),o.format=d.format,o.needsUpdate=!0,t&&t(o)},n,r);return o}});function ku(e){nt.call(this,e)}ku.prototype=Object.assign(Object.create(nt.prototype),{constructor:ku,load:function(e,t,n,r){var i=this,a=new vi,o=new En(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,function(s){var c=i.parse(s);c&&(c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:Vt,a.wrapT=c.wrapT!==void 0?c.wrapT:Vt,a.magFilter=c.magFilter!==void 0?c.magFilter:It,a.minFilter=c.minFilter!==void 0?c.minFilter:It,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=As),c.mipmapCount===1&&(a.minFilter=It),a.needsUpdate=!0,t&&t(a,c))},n,r),a}});function Da(e){nt.call(this,e)}Da.prototype=Object.assign(Object.create(nt.prototype),{constructor:Da,load:function(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Ri.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),Ri.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(l){o.removeEventListener("load",s,!1),o.removeEventListener("error",c,!1),r&&r(l),i.manager.itemError(e),i.manager.itemEnd(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",c,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}});function Yl(e){nt.call(this,e)}Yl.prototype=Object.assign(Object.create(nt.prototype),{constructor:Yl,load:function(e,t,n,r){var i=new hr,a=new Da(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(l){a.load(e[l],function(u){i.images[l]=u,o++,o===6&&(i.needsUpdate=!0,t&&t(i))},void 0,r)}for(var c=0;c<e.length;++c)s(c);return i}});function Zl(e){nt.call(this,e)}Zl.prototype=Object.assign(Object.create(nt.prototype),{constructor:Zl,load:function(e,t,n,r){var i=new ot,a=new Da(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){i.image=o;var s=e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0;i.format=s?Ar:fn,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}});function Le(){this.type="Curve",this.arcLengthDivisions=200}Object.assign(Le.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e===void 0&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t=[],n,r=this.getPoint(0),i,a=0;for(t.push(0),i=1;i<=e;i++)n=this.getPoint(i/e),a+=n.distanceTo(r),t.push(a),r=n;return this.cacheArcLengths=t,t},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n=this.getLengths(),r=0,i=n.length,a;t?a=t:a=e*n[i-1];for(var o=0,s=i-1,c;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);var l=n[r],u=n[r+1],h=u-l,f=(a-l)/h,d=(r+f)/(i-1);return d},getTangent:function(e,t){var n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);var a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new X:new E);return s.copy(o).sub(a).normalize(),s},getTangentAt:function(e,t){var n=this.getUtoTmapping(e);return this.getTangent(n,t)},computeFrenetFrames:function(e,t){var n=new E,r=[],i=[],a=[],o=new E,s=new We,c,l,u;for(c=0;c<=e;c++)l=c/e,r[c]=this.getTangentAt(l,new E),r[c].normalize();i[0]=new E,a[0]=new E;var h=Number.MAX_VALUE,f=Math.abs(r[0].x),d=Math.abs(r[0].y),m=Math.abs(r[0].z);for(f<=h&&(h=f,n.set(1,0,0)),d<=h&&(h=d,n.set(0,1,0)),m<=h&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]),c=1;c<=e;c++)i[c]=i[c-1].clone(),a[c]=a[c-1].clone(),o.crossVectors(r[c-1],r[c]),o.length()>Number.EPSILON&&(o.normalize(),u=Math.acos(ke.clamp(r[c-1].dot(r[c]),-1,1)),i[c].applyMatrix4(s.makeRotationAxis(o,u))),a[c].crossVectors(r[c],i[c]);if(t===!0)for(u=Math.acos(ke.clamp(i[0].dot(i[e]),-1,1)),u/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(u=-u),c=1;c<=e;c++)i[c].applyMatrix4(s.makeRotationAxis(r[c],u*c)),a[c].crossVectors(r[c],i[c]);return{tangents:r,normals:i,binormals:a}},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}});function rn(e,t,n,r,i,a,o,s){Le.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=r||1,this.aStartAngle=i||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}rn.prototype=Object.create(Le.prototype);rn.prototype.constructor=rn;rn.prototype.isEllipseCurve=!0;rn.prototype.getPoint=function(e,t){for(var n=t||new X,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<Number.EPSILON;i<0;)i+=r;for(;i>r;)i-=r;i<Number.EPSILON&&(a?i=0:i=r),this.aClockwise===!0&&!a&&(i===r?i=-r:i=i-r);var o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){var l=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,f=c-this.aY;s=h*l-f*u+this.aX,c=h*u+f*l+this.aY}return n.set(s,c)};rn.prototype.copy=function(e){return Le.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this};rn.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e};rn.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this};function Ia(e,t,n,r,i,a){rn.call(this,e,t,n,n,r,i,a),this.type="ArcCurve"}Ia.prototype=Object.create(rn.prototype);Ia.prototype.constructor=Ia;Ia.prototype.isArcCurve=!0;function Lc(){var e=0,t=0,n=0,r=0;function i(a,o,s,c){e=a,t=s,n=-3*a+3*o-2*s-c,r=2*a-2*o+s+c}return{initCatmullRom:function(a,o,s,c,l){i(o,s,l*(s-a),l*(c-o))},initNonuniformCatmullRom:function(a,o,s,c,l,u,h){var f=(o-a)/l-(s-a)/(l+u)+(s-o)/u,d=(s-o)/u-(c-o)/(u+h)+(c-s)/h;f*=u,d*=u,i(o,s,f,d)},calc:function(a){var o=a*a,s=o*a;return e+t*a+n*o+r*s}}}var Mo=new E,ul=new Lc,hl=new Lc,fl=new Lc;function Jt(e,t,n,r){Le.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=r||.5}Jt.prototype=Object.create(Le.prototype);Jt.prototype.constructor=Jt;Jt.prototype.isCatmullRomCurve3=!0;Jt.prototype.getPoint=function(e,t){var n=t||new E,r=this.points,i=r.length,a=(i-(this.closed?0:1))*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);var c,l,u,h;if(this.closed||o>0?c=r[(o-1)%i]:(Mo.subVectors(r[0],r[1]).add(r[0]),c=Mo),l=r[o%i],u=r[(o+1)%i],this.closed||o+2<i?h=r[(o+2)%i]:(Mo.subVectors(r[i-1],r[i-2]).add(r[i-1]),h=Mo),this.curveType==="centripetal"||this.curveType==="chordal"){var f=this.curveType==="chordal"?.5:.25,d=Math.pow(c.distanceToSquared(l),f),m=Math.pow(l.distanceToSquared(u),f),g=Math.pow(u.distanceToSquared(h),f);m<1e-4&&(m=1),d<1e-4&&(d=m),g<1e-4&&(g=m),ul.initNonuniformCatmullRom(c.x,l.x,u.x,h.x,d,m,g),hl.initNonuniformCatmullRom(c.y,l.y,u.y,h.y,d,m,g),fl.initNonuniformCatmullRom(c.z,l.z,u.z,h.z,d,m,g)}else this.curveType==="catmullrom"&&(ul.initCatmullRom(c.x,l.x,u.x,h.x,this.tension),hl.initCatmullRom(c.y,l.y,u.y,h.y,this.tension),fl.initCatmullRom(c.z,l.z,u.z,h.z,this.tension));return n.set(ul.calc(s),hl.calc(s),fl.calc(s)),n};Jt.prototype.copy=function(e){Le.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this};Jt.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e};Jt.prototype.fromJSON=function(e){Le.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(new E().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this};function Wu(e,t,n,r,i){var a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function qy(e,t){var n=1-e;return n*n*t}function Yy(e,t){return 2*(1-e)*e*t}function Zy(e,t){return e*e*t}function aa(e,t,n,r){return qy(e,t)+Yy(e,n)+Zy(e,r)}function Jy(e,t){var n=1-e;return n*n*n*t}function Qy(e,t){var n=1-e;return 3*n*n*e*t}function $y(e,t){return 3*(1-e)*e*e*t}function Ky(e,t){return e*e*e*t}function oa(e,t,n,r,i){return Jy(e,t)+Qy(e,n)+$y(e,r)+Ky(e,i)}function Tn(e,t,n,r){Le.call(this),this.type="CubicBezierCurve",this.v0=e||new X,this.v1=t||new X,this.v2=n||new X,this.v3=r||new X}Tn.prototype=Object.create(Le.prototype);Tn.prototype.constructor=Tn;Tn.prototype.isCubicBezierCurve=!0;Tn.prototype.getPoint=function(e,t){var n=t||new X,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(oa(e,r.x,i.x,a.x,o.x),oa(e,r.y,i.y,a.y,o.y)),n};Tn.prototype.copy=function(e){return Le.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this};Tn.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e};Tn.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this};function Vn(e,t,n,r){Le.call(this),this.type="CubicBezierCurve3",this.v0=e||new E,this.v1=t||new E,this.v2=n||new E,this.v3=r||new E}Vn.prototype=Object.create(Le.prototype);Vn.prototype.constructor=Vn;Vn.prototype.isCubicBezierCurve3=!0;Vn.prototype.getPoint=function(e,t){var n=t||new E,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(oa(e,r.x,i.x,a.x,o.x),oa(e,r.y,i.y,a.y,o.y),oa(e,r.z,i.z,a.z,o.z)),n};Vn.prototype.copy=function(e){return Le.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this};Vn.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e};Vn.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this};function Qt(e,t){Le.call(this),this.type="LineCurve",this.v1=e||new X,this.v2=t||new X}Qt.prototype=Object.create(Le.prototype);Qt.prototype.constructor=Qt;Qt.prototype.isLineCurve=!0;Qt.prototype.getPoint=function(e,t){var n=t||new X;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n};Qt.prototype.getPointAt=function(e,t){return this.getPoint(e,t)};Qt.prototype.getTangent=function(e,t){var n=t||new X,n=n.copy(this.v2).sub(this.v1).normalize();return n};Qt.prototype.copy=function(e){return Le.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this};Qt.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e};Qt.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this};function Sn(e,t){Le.call(this),this.type="LineCurve3",this.v1=e||new E,this.v2=t||new E}Sn.prototype=Object.create(Le.prototype);Sn.prototype.constructor=Sn;Sn.prototype.isLineCurve3=!0;Sn.prototype.getPoint=function(e,t){var n=t||new E;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n};Sn.prototype.getPointAt=function(e,t){return this.getPoint(e,t)};Sn.prototype.copy=function(e){return Le.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this};Sn.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e};Sn.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this};function An(e,t,n){Le.call(this),this.type="QuadraticBezierCurve",this.v0=e||new X,this.v1=t||new X,this.v2=n||new X}An.prototype=Object.create(Le.prototype);An.prototype.constructor=An;An.prototype.isQuadraticBezierCurve=!0;An.prototype.getPoint=function(e,t){var n=t||new X,r=this.v0,i=this.v1,a=this.v2;return n.set(aa(e,r.x,i.x,a.x),aa(e,r.y,i.y,a.y)),n};An.prototype.copy=function(e){return Le.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this};An.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e};An.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this};function kn(e,t,n){Le.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new E,this.v1=t||new E,this.v2=n||new E}kn.prototype=Object.create(Le.prototype);kn.prototype.constructor=kn;kn.prototype.isQuadraticBezierCurve3=!0;kn.prototype.getPoint=function(e,t){var n=t||new E,r=this.v0,i=this.v1,a=this.v2;return n.set(aa(e,r.x,i.x,a.x),aa(e,r.y,i.y,a.y),aa(e,r.z,i.z,a.z)),n};kn.prototype.copy=function(e){return Le.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this};kn.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e};kn.prototype.fromJSON=function(e){return Le.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this};function Ln(e){Le.call(this),this.type="SplineCurve",this.points=e||[]}Ln.prototype=Object.create(Le.prototype);Ln.prototype.constructor=Ln;Ln.prototype.isSplineCurve=!0;Ln.prototype.getPoint=function(e,t){var n=t||new X,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Wu(o,s.x,c.x,l.x,u.x),Wu(o,s.y,c.y,l.y,u.y)),n};Ln.prototype.copy=function(e){Le.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(r.clone())}return this};Ln.prototype.toJSON=function(){var e=Le.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var r=this.points[t];e.points.push(r.toArray())}return e};Ln.prototype.fromJSON=function(e){Le.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var r=e.points[t];this.points.push(new X().fromArray(r))}return this};var Jl=Object.freeze({__proto__:null,ArcCurve:Ia,CatmullRomCurve3:Jt,CubicBezierCurve:Tn,CubicBezierCurve3:Vn,EllipseCurve:rn,LineCurve:Qt,LineCurve3:Sn,QuadraticBezierCurve:An,QuadraticBezierCurve3:kn,SplineCurve:Ln});function or(){Le.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}or.prototype=Object.assign(Object.create(Le.prototype),{constructor:or,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Qt(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),r=0;r<n.length;){if(n[r]>=t){var i=n[r]-t,a=this.curves[r],o=a.getLength(),s=o===0?0:1-i/o;return a.getPointAt(s)}r++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){e===void 0&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t=[],n,r=0,i=this.curves;r<i.length;r++)for(var a=i[r],o=a&&a.isEllipseCurve?e*2:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),c=0;c<s.length;c++){var l=s[c];n&&n.equals(l)||(t.push(l),n=l)}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t},copy:function(e){Le.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=Le.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var r=this.curves[t];e.curves.push(r.toJSON())}return e},fromJSON:function(e){Le.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var r=e.curves[t];this.curves.push(new Jl[r.type]().fromJSON(r))}return this}});function wn(e){or.call(this),this.type="Path",this.currentPoint=new X,e&&this.setFromPoints(e)}wn.prototype=Object.assign(Object.create(or.prototype),{constructor:wn,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this},moveTo:function(e,t){return this.currentPoint.set(e,t),this},lineTo:function(e,t){var n=new Qt(this.currentPoint.clone(),new X(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this},quadraticCurveTo:function(e,t,n,r){var i=new An(this.currentPoint.clone(),new X(e,t),new X(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this},bezierCurveTo:function(e,t,n,r,i,a){var o=new Tn(this.currentPoint.clone(),new X(e,t),new X(n,r),new X(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this},splineThru:function(e){var t=[this.currentPoint.clone()].concat(e),n=new Ln(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this},arc:function(e,t,n,r,i,a){var o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this},absarc:function(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this},ellipse:function(e,t,n,r,i,a,o,s){var c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this},absellipse:function(e,t,n,r,i,a,o,s){var c=new rn(e,t,n,r,i,a,o,s);if(this.curves.length>0){var l=c.getPoint(0);l.equals(this.currentPoint)||this.lineTo(l.x,l.y)}this.curves.push(c);var u=c.getPoint(1);return this.currentPoint.copy(u),this},copy:function(e){return or.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=or.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return or.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}});function Lr(e){wn.call(this,e),this.uuid=ke.generateUUID(),this.type="Shape",this.holes=[]}Lr.prototype=Object.assign(Object.create(wn.prototype),{constructor:Lr,getPointsHoles:function(e){for(var t=[],n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){wn.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(r.clone())}return this},toJSON:function(){var e=wn.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var r=this.holes[t];e.holes.push(r.toJSON())}return e},fromJSON:function(e){wn.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var r=e.holes[t];this.holes.push(new wn().fromJSON(r))}return this}});function ct(e,t){se.call(this),this.type="Light",this.color=new pe(e),this.intensity=t!==void 0?t:1,this.receiveShadow=void 0}ct.prototype=Object.assign(Object.create(se.prototype),{constructor:ct,isLight:!0,copy:function(e){return se.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=se.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}});function Ql(e,t,n){ct.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(se.DefaultUp),this.updateMatrix(),this.groundColor=new pe(t)}Ql.prototype=Object.assign(Object.create(ct.prototype),{constructor:Ql,isHemisphereLight:!0,copy:function(e){return ct.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}});function Wn(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new X(512,512),this.map=null,this.mapPass=null,this.matrix=new We,this._frustum=new Xa,this._frameExtents=new X(1,1),this._viewportCount=1,this._viewports=[new tt(0,0,1,1)]}Object.assign(Wn.prototype,{_projScreenMatrix:new We,_lightPositionWorld:new E,_lookTarget:new E,getViewportCount:function(){return this._viewportCount},getFrustum:function(){return this._frustum},updateMatrices:function(e){var t=this.camera,n=this.matrix,r=this._projScreenMatrix,i=this._lookTarget,a=this._lightPositionWorld;a.setFromMatrixPosition(e.matrixWorld),t.position.copy(a),i.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(i),t.updateMatrixWorld(),r.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(r),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(t.projectionMatrix),n.multiply(t.matrixWorldInverse)},getViewport:function(e){return this._viewports[e]},getFrameExtents:function(){return this._frameExtents},copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e={};return this.bias!==0&&(e.bias=this.bias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}});function $l(){Wn.call(this,new St(50,1,.5,500))}$l.prototype=Object.assign(Object.create(Wn.prototype),{constructor:$l,isSpotLightShadow:!0,updateMatrices:function(e){var t=this.camera,n=ke.RAD2DEG*2*e.angle,r=this.mapSize.width/this.mapSize.height,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),Wn.prototype.updateMatrices.call(this,e)}});function Kl(e,t,n,r,i,a){ct.call(this,e,t),this.type="SpotLight",this.position.copy(se.DefaultUp),this.updateMatrix(),this.target=new se,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(o){this.intensity=o/Math.PI}}),this.distance=n!==void 0?n:0,this.angle=r!==void 0?r:Math.PI/3,this.penumbra=i!==void 0?i:0,this.decay=a!==void 0?a:1,this.shadow=new $l}Kl.prototype=Object.assign(Object.create(ct.prototype),{constructor:Kl,isSpotLight:!0,copy:function(e){return ct.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}});function ec(){Wn.call(this,new St(90,1,.5,500)),this._frameExtents=new X(4,2),this._viewportCount=6,this._viewports=[new tt(2,1,1,1),new tt(0,1,1,1),new tt(3,1,1,1),new tt(1,1,1,1),new tt(3,0,1,1),new tt(1,0,1,1)],this._cubeDirections=[new E(1,0,0),new E(-1,0,0),new E(0,0,1),new E(0,0,-1),new E(0,1,0),new E(0,-1,0)],this._cubeUps=[new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,0,1),new E(0,0,-1)]}ec.prototype=Object.assign(Object.create(Wn.prototype),{constructor:ec,isPointLightShadow:!0,updateMatrices:function(e,t){t===void 0&&(t=0);var n=this.camera,r=this.matrix,i=this._lightPositionWorld,a=this._lookTarget,o=this._projScreenMatrix;i.setFromMatrixPosition(e.matrixWorld),n.position.copy(i),a.copy(n.position),a.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(a),n.updateMatrixWorld(),r.makeTranslation(-i.x,-i.y,-i.z),o.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(o)}});function tc(e,t,n,r){ct.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return this.intensity*4*Math.PI},set:function(i){this.intensity=i/(4*Math.PI)}}),this.distance=n!==void 0?n:0,this.decay=r!==void 0?r:1,this.shadow=new ec}tc.prototype=Object.assign(Object.create(ct.prototype),{constructor:tc,isPointLight:!0,copy:function(e){return ct.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}});function Na(e,t,n,r,i,a){zn.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e!==void 0?e:-1,this.right=t!==void 0?t:1,this.top=n!==void 0?n:1,this.bottom=r!==void 0?r:-1,this.near=i!==void 0?i:.1,this.far=a!==void 0?a:2e3,this.updateProjectionMatrix()}Na.prototype=Object.assign(Object.create(zn.prototype),{constructor:Na,isOrthographicCamera:!0,copy:function(e,t){return zn.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){var c=(this.right-this.left)/this.view.fullWidth/this.zoom,l=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=c*this.view.offsetX,a=i+c*this.view.width,o-=l*this.view.offsetY,s=o-l*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=se.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}});function nc(){Wn.call(this,new Na(-5,5,5,-5,.5,500))}nc.prototype=Object.assign(Object.create(Wn.prototype),{constructor:nc,isDirectionalLightShadow:!0,updateMatrices:function(e){Wn.prototype.updateMatrices.call(this,e)}});function rc(e,t){ct.call(this,e,t),this.type="DirectionalLight",this.position.copy(se.DefaultUp),this.updateMatrix(),this.target=new se,this.shadow=new nc}rc.prototype=Object.assign(Object.create(ct.prototype),{constructor:rc,isDirectionalLight:!0,copy:function(e){return ct.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}});function ic(e,t){ct.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}ic.prototype=Object.assign(Object.create(ct.prototype),{constructor:ic,isAmbientLight:!0});function ac(e,t,n,r){ct.call(this,e,t),this.type="RectAreaLight",this.width=n!==void 0?n:10,this.height=r!==void 0?r:10}ac.prototype=Object.assign(Object.create(ct.prototype),{constructor:ac,isRectAreaLight:!0,copy:function(e){return ct.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=ct.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}});function Pc(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new E)}Object.assign(Pc.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*r),t.addScaledVector(a[2],.488603*i),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*r)),t.addScaledVector(a[5],1.092548*(r*i)),t.addScaledVector(a[6],.315392*(3*i*i-1)),t.addScaledVector(a[7],1.092548*(n*i)),t.addScaledVector(a[8],.546274*(n*n-r*r)),t},getIrradianceAt:function(e,t){var n=e.x,r=e.y,i=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*r),t.addScaledVector(a[2],2*.511664*i),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*r),t.addScaledVector(a[5],2*.429043*r*i),t.addScaledVector(a[6],.743125*i*i-.247708),t.addScaledVector(a[7],2*.429043*n*i),t.addScaledVector(a[8],.429043*(n*n-r*r)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},addScaledSH:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return new this.constructor().copy(this)},fromArray:function(e,t){t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}});Object.assign(Pc,{getBasisAt:function(e,t){var n=e.x,r=e.y,i=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*i,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*i,t[6]=.315392*(3*i*i-1),t[7]=1.092548*n*i,t[8]=.546274*(n*n-r*r)}});function dn(e,t){ct.call(this,void 0,t),this.type="LightProbe",this.sh=e!==void 0?e:new Pc}dn.prototype=Object.assign(Object.create(ct.prototype),{constructor:dn,isLightProbe:!0,copy:function(e){return ct.prototype.copy.call(this,e),this.sh.copy(e.sh),this},fromJSON:function(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this},toJSON:function(e){var t=ct.prototype.toJSON.call(this,e);return t.object.sh=this.sh.toArray(),t}});function oc(e){nt.call(this,e),this.textures={}}oc.prototype=Object.assign(Object.create(nt.prototype),{constructor:oc,load:function(e,t,n,r){var i=this,a=new En(i.manager);a.setPath(i.path),a.load(e,function(o){try{t(i.parse(JSON.parse(o)))}catch(s){r?r(s):console.error(s),i.manager.itemError(e)}},n,r)},parse:function(e){var t=this.textures;function n(c){return t[c]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",c),t[c]}var r=new ky[e.type];if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=new pe().setHex(e.sheen)),e.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular.setHex(e.specular),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==1&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.skinning!==void 0&&(r.skinning=e.skinning),e.morphTargets!==void 0&&(r.morphTargets=e.morphTargets),e.morphNormals!==void 0&&(r.morphNormals=e.morphNormals),e.dithering!==void 0&&(r.dithering=e.dithering),e.vertexTangents!==void 0&&(r.vertexTangents=e.vertexTangents),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(var i in e.uniforms){var a=e.uniforms[i];switch(r.uniforms[i]={},a.type){case"t":r.uniforms[i].value=n(a.value);break;case"c":r.uniforms[i].value=new pe().setHex(a.value);break;case"v2":r.uniforms[i].value=new X().fromArray(a.value);break;case"v3":r.uniforms[i].value=new E().fromArray(a.value);break;case"v4":r.uniforms[i].value=new tt().fromArray(a.value);break;case"m3":r.uniforms[i].value=new zt().fromArray(a.value);case"m4":r.uniforms[i].value=new We().fromArray(a.value);break;default:r.uniforms[i].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(var o in e.extensions)r.extensions[o]=e.extensions[o];if(e.shading!==void 0&&(r.flatShading=e.shading===1),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=n(e.map)),e.matcap!==void 0&&(r.matcap=n(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){var s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new X().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=n(e.specularMap)),e.envMap!==void 0&&(r.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new X().fromArray(e.clearcoatNormalScale)),r},setTextures:function(e){return this.textures=e,this}});var tf={decodeText:function(e){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(e);for(var t="",n=0,r=e.length;n<r;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(i){return t}},extractUrlBase:function(e){var t=e.lastIndexOf("/");return t===-1?"./":e.substr(0,t+1)}};function ys(){ge.call(this),this.type="InstancedBufferGeometry",this.instanceCount=1/0}ys.prototype=Object.assign(Object.create(ge.prototype),{constructor:ys,isInstancedBufferGeometry:!0,copy:function(e){return ge.prototype.copy.call(this,e),this.instanceCount=e.instanceCount,this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e=ge.prototype.toJSON.call(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}});function sc(e,t,n,r){typeof n=="number"&&(r=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),De.call(this,e,t,n),this.meshPerAttribute=r||1}sc.prototype=Object.assign(Object.create(De.prototype),{constructor:sc,isInstancedBufferAttribute:!0,copy:function(e){return De.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=De.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}});function lc(e){nt.call(this,e)}lc.prototype=Object.assign(Object.create(nt.prototype),{constructor:lc,load:function(e,t,n,r){var i=this,a=new En(i.manager);a.setPath(i.path),a.load(e,function(o){try{t(i.parse(JSON.parse(o)))}catch(s){r?r(s):console.error(s),i.manager.itemError(e)}},n,r)},parse:function(e){var t=e.isInstancedBufferGeometry?new ys:new ge,n=e.data.index;if(n!==void 0){var r=new dl[n.type](n.array);t.setIndex(new De(r,1))}var i=e.data.attributes;for(var a in i){var o=i[a],r=new dl[o.type](o.array),s=o.isInstancedBufferAttribute?sc:De,c=new s(r,o.itemSize,o.normalized);o.name!==void 0&&(c.name=o.name),t.setAttribute(a,c)}var l=e.data.morphAttributes;if(l)for(var a in l){for(var u=l[a],h=[],f=0,d=u.length;f<d;f++){var o=u[f],r=new dl[o.type](o.array),c=new De(r,o.itemSize,o.normalized);o.name!==void 0&&(c.name=o.name),h.push(c)}t.morphAttributes[a]=h}var m=e.data.morphTargetsRelative;m&&(t.morphTargetsRelative=!0);var g=e.data.groups||e.data.drawcalls||e.data.offsets;if(g!==void 0)for(var f=0,y=g.length;f!==y;++f){var p=g[f];t.addGroup(p.start,p.count,p.materialIndex)}var v=e.data.boundingSphere;if(v!==void 0){var _=new E;v.center!==void 0&&_.fromArray(v.center),t.boundingSphere=new jn(_,v.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t}});var dl={Int8Array,Uint8Array,Uint8ClampedArray:typeof Uint8ClampedArray!="undefined"?Uint8ClampedArray:Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function cc(e){nt.call(this,e)}cc.prototype=Object.assign(Object.create(nt.prototype),{constructor:cc,load:function(e,t,n,r){var i=this,a=this.path===""?tf.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new En(i.manager);o.setPath(this.path),o.load(e,function(s){var c=null;try{c=JSON.parse(s)}catch(u){r!==void 0&&r(u),console.error("THREE:ObjectLoader: Can't parse "+e+".",u.message);return}var l=c.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}i.parse(c,t)},n,r)},parse:function(e,t){var n=this.parseShape(e.shapes),r=this.parseGeometries(e.geometries,n),i=this.parseImages(e.images,function(){t!==void 0&&t(s)}),a=this.parseTextures(e.textures,i),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,r,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),(e.images===void 0||e.images.length===0)&&t!==void 0&&t(s),s},parseShape:function(e){var t={};if(e!==void 0)for(var n=0,r=e.length;n<r;n++){var i=new Lr().fromJSON(e[n]);t[i.uuid]=i}return t},parseGeometries:function(e,t){var n={};if(e!==void 0)for(var r=new lc,i=0,a=e.length;i<a;i++){var o,s=e[i];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Bt[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Bt[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Bt[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Bt[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Bt[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Bt[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new Bt[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Bt[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Bt[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Bt[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new Bt[s.type](new Jl[s.path.type]().fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Bt[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new Bt[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var h=[],c=0,l=s.shapes.length;c<l;c++){var u=t[s.shapes[c]];h.push(u)}o=new Bt[s.type](h,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(var h=[],c=0,l=s.shapes.length;c<l;c++){var u=t[s.shapes[c]];h.push(u)}var f=s.options.extrudePath;f!==void 0&&(s.options.extrudePath=new Jl[f.type]().fromJSON(f)),o=new Bt[s.type](h,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=r.parse(s);break;case"Geometry":console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,s.name!==void 0&&(o.name=s.name),o.isBufferGeometry===!0&&s.userData!==void 0&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},r={};if(e!==void 0){var i=new oc;i.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if(s.type==="MultiMaterial"){for(var c=[],l=0;l<s.materials.length;l++){var u=s.materials[l];n[u.uuid]===void 0&&(n[u.uuid]=i.parse(u)),c.push(n[u.uuid])}r[s.uuid]=c}else n[s.uuid]===void 0&&(n[s.uuid]=i.parse(s)),r[s.uuid]=n[s.uuid]}}return r},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=hn.parse(r);r.uuid!==void 0&&(i.uuid=r.uuid),t.push(i)}return t},parseImages:function(e,t){var n=this,r={};function i(g){return n.manager.itemStart(g),o.load(g,function(){n.manager.itemEnd(g)},void 0,function(){n.manager.itemError(g),n.manager.itemEnd(g)})}if(e!==void 0&&e.length>0){var a=new ef(t),o=new Da(a);o.setCrossOrigin(this.crossOrigin);for(var s=0,c=e.length;s<c;s++){var l=e[s],u=l.url;if(Array.isArray(u)){r[l.uuid]=[];for(var h=0,f=u.length;h<f;h++){var d=u[h],m=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:n.resourcePath+d;r[l.uuid].push(i(m))}}else{var m=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(l.url)?l.url:n.resourcePath+l.url;r[l.uuid]=i(m)}}}return r},parseTextures:function(e,t){function n(c,l){return typeof c=="number"?c:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",c),l[c])}var r={};if(e!==void 0)for(var i=0,a=e.length;i<a;i++){var o=e[i];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s;Array.isArray(t[o.image])?s=new hr(t[o.image]):s=new ot(t[o.image]),s.needsUpdate=!0,s.uuid=o.uuid,o.name!==void 0&&(s.name=o.name),o.mapping!==void 0&&(s.mapping=n(o.mapping,e0)),o.offset!==void 0&&s.offset.fromArray(o.offset),o.repeat!==void 0&&s.repeat.fromArray(o.repeat),o.center!==void 0&&s.center.fromArray(o.center),o.rotation!==void 0&&(s.rotation=o.rotation),o.wrap!==void 0&&(s.wrapS=n(o.wrap[0],Xu),s.wrapT=n(o.wrap[1],Xu)),o.format!==void 0&&(s.format=o.format),o.type!==void 0&&(s.type=o.type),o.encoding!==void 0&&(s.encoding=o.encoding),o.minFilter!==void 0&&(s.minFilter=n(o.minFilter,ju)),o.magFilter!==void 0&&(s.magFilter=n(o.magFilter,ju)),o.anisotropy!==void 0&&(s.anisotropy=o.anisotropy),o.flipY!==void 0&&(s.flipY=o.flipY),o.premultiplyAlpha!==void 0&&(s.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(s.unpackAlignment=o.unpackAlignment),r[o.uuid]=s}return r},parseObject:function(e,t,n){var r;function i(y){return t[y]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",y),t[y]}function a(y){if(y!==void 0){if(Array.isArray(y)){for(var p=[],v=0,_=y.length;v<_;v++){var x=y[v];n[x]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",x),p.push(n[x])}return p}return n[y]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",y),n[y]}}switch(e.type){case"Scene":r=new ca,e.background!==void 0&&Number.isInteger(e.background)&&(r.background=new pe(e.background)),e.fog!==void 0&&(e.fog.type==="Fog"?r.fog=new Ol(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(r.fog=new Rl(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":r=new St(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(r.focus=e.focus),e.zoom!==void 0&&(r.zoom=e.zoom),e.filmGauge!==void 0&&(r.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(r.filmOffset=e.filmOffset),e.view!==void 0&&(r.view=Object.assign({},e.view));break;case"OrthographicCamera":r=new Na(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(r.zoom=e.zoom),e.view!==void 0&&(r.view=Object.assign({},e.view));break;case"AmbientLight":r=new ic(e.color,e.intensity);break;case"DirectionalLight":r=new rc(e.color,e.intensity);break;case"PointLight":r=new tc(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":r=new ac(e.color,e.intensity,e.width,e.height);break;case"SpotLight":r=new Kl(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":r=new Ql(e.color,e.groundColor,e.intensity);break;case"LightProbe":r=new dn().fromJSON(e);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var o=i(e.geometry),s=a(e.material);r=new ft(o,s);break;case"InstancedMesh":var o=i(e.geometry),s=a(e.material),c=e.count,l=e.instanceMatrix;r=new Fl(o,s,c),r.instanceMatrix=new De(new Float32Array(l.array),16);break;case"LOD":r=new Zo;break;case"Line":r=new nn(i(e.geometry),a(e.material),e.mode);break;case"LineLoop":r=new Bl(i(e.geometry),a(e.material));break;case"LineSegments":r=new Mt(i(e.geometry),a(e.material));break;case"PointCloud":case"Points":r=new zl(i(e.geometry),a(e.material));break;case"Sprite":r=new Dl(a(e.material));break;case"Group":r=new ma;break;default:r=new se}if(r.uuid=e.uuid,e.name!==void 0&&(r.name=e.name),e.matrix!==void 0?(r.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(r.matrixAutoUpdate=e.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(e.position!==void 0&&r.position.fromArray(e.position),e.rotation!==void 0&&r.rotation.fromArray(e.rotation),e.quaternion!==void 0&&r.quaternion.fromArray(e.quaternion),e.scale!==void 0&&r.scale.fromArray(e.scale)),e.castShadow!==void 0&&(r.castShadow=e.castShadow),e.receiveShadow!==void 0&&(r.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(r.shadow.bias=e.shadow.bias),e.shadow.radius!==void 0&&(r.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&r.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(r.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(r.visible=e.visible),e.frustumCulled!==void 0&&(r.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(r.renderOrder=e.renderOrder),e.userData!==void 0&&(r.userData=e.userData),e.layers!==void 0&&(r.layers.mask=e.layers),e.children!==void 0)for(var u=e.children,h=0;h<u.length;h++)r.add(this.parseObject(u[h],t,n));if(e.type==="LOD"){e.autoUpdate!==void 0&&(r.autoUpdate=e.autoUpdate);for(var f=e.levels,d=0;d<f.length;d++){var m=f[d],g=r.getObjectByProperty("uuid",m.object);g!==void 0&&r.addLevel(g,m.distance)}}return r}});var e0={UVMapping:xc,CubeReflectionMapping:_c,CubeRefractionMapping:bc,EquirectangularReflectionMapping:Sh,EquirectangularRefractionMapping:wc,SphericalReflectionMapping:Ah,CubeUVReflectionMapping:ka,CubeUVRefractionMapping:Mc},Xu={RepeatWrapping:zo,ClampToEdgeWrapping:Vt,MirroredRepeatWrapping:Go},ju={NearestFilter:bt,NearestMipmapNearestFilter:bl,NearestMipmapLinearFilter:wl,LinearFilter:It,LinearMipmapNearestFilter:Lh,LinearMipmapLinearFilter:As};function qu(e){typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),nt.call(this,e),this.options=void 0}qu.prototype=Object.assign(Object.create(nt.prototype),{constructor:qu,setOptions:function(t){return this.options=t,this},load:function(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var i=this,a=Ri.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;fetch(e).then(function(o){return o.blob()}).then(function(o){return i.options===void 0?createImageBitmap(o):createImageBitmap(o,i.options)}).then(function(o){Ri.add(e,o),t&&t(o),i.manager.itemEnd(e)}).catch(function(o){r&&r(o),i.manager.itemError(e),i.manager.itemEnd(e)}),i.manager.itemStart(e)}});function nf(){this.type="ShapePath",this.color=new pe,this.subPaths=[],this.currentPath=null}Object.assign(nf.prototype,{moveTo:function(e,t){return this.currentPath=new wn,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this},lineTo:function(e,t){return this.currentPath.lineTo(e,t),this},quadraticCurveTo:function(e,t,n,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this},bezierCurveTo:function(e,t,n,r,i,a){return this.currentPath.bezierCurveTo(e,t,n,r,i,a),this},splineThru:function(e){return this.currentPath.splineThru(e),this},toShapes:function(e,t){function n(D){for(var z=[],k=0,q=D.length;k<q;k++){var Z=D[k],ee=new Lr;ee.curves=Z.curves,z.push(ee)}return z}function r(D,z){for(var k=z.length,q=!1,Z=k-1,ee=0;ee<k;Z=ee++){var te=z[Z],ae=z[ee],Pe=ae.x-te.x,_e=ae.y-te.y;if(Math.abs(_e)>Number.EPSILON){if(_e<0&&(te=z[ee],Pe=-Pe,ae=z[Z],_e=-_e),D.y<te.y||D.y>ae.y)continue;if(D.y===te.y){if(D.x===te.x)return!0}else{var re=_e*(D.x-te.x)-Pe*(D.y-te.y);if(re===0)return!0;if(re<0)continue;q=!q}}else{if(D.y!==te.y)continue;if(ae.x<=D.x&&D.x<=te.x||te.x<=D.x&&D.x<=ae.x)return!0}}return q}var i=cr.isClockWise,a=this.subPaths;if(a.length===0)return[];if(t===!0)return n(a);var o,s,c,l=[];if(a.length===1)return s=a[0],c=new Lr,c.curves=s.curves,l.push(c),l;var u=!i(a[0].getPoints());u=e?!u:u;var h=[],f=[],d=[],m=0,g;f[m]=void 0,d[m]=[];for(var y=0,p=a.length;y<p;y++)s=a[y],g=s.getPoints(),o=i(g),o=e?!o:o,o?(!u&&f[m]&&m++,f[m]={s:new Lr,p:g},f[m].s.curves=s.curves,u&&m++,d[m]=[]):d[m].push({h:s,p:g[0]});if(!f[0])return n(a);if(f.length>1){for(var v=!1,_=[],x=0,b=f.length;x<b;x++)h[x]=[];for(var x=0,b=f.length;x<b;x++)for(var T=d[x],C=0;C<T.length;C++){for(var N=T[C],O=!0,J=0;J<f.length;J++)r(N.p,f[J].p)&&(x!==J&&_.push({froms:x,tos:J,hole:C}),O?(O=!1,h[J].push(N)):v=!0);O&&h[x].push(N)}_.length>0&&(v||(d=h))}for(var F,y=0,B=f.length;y<B;y++){c=f[y].s,l.push(c),F=d[y];for(var V=0,Y=F.length;V<Y;V++)c.holes.push(F[V].h)}return l}});function rf(e){this.type="Font",this.data=e}Object.assign(rf.prototype,{isFont:!0,generateShapes:function(e,t){t===void 0&&(t=100);for(var n=[],r=t0(e,t,this.data),i=0,a=r.length;i<a;i++)Array.prototype.push.apply(n,r[i].toShapes());return n}});function t0(e,t,n){for(var r=Array.from?Array.from(e):String(e).split(""),i=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*i,o=[],s=0,c=0,l=0;l<r.length;l++){var u=r[l];if(u===`
3113
- `)s=0,c-=a;else{var h=n0(u,i,s,c,n);s+=h.offsetX,o.push(h.path)}}return o}function n0(e,t,n,r,i){var a=i.glyphs[e]||i.glyphs["?"];if(!a){console.error('THREE.Font: character "'+e+'" does not exists in font family '+i.familyName+".");return}var o=new nf,s,c,l,u,h,f,d,m;if(a.o)for(var g=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),y=0,p=g.length;y<p;){var v=g[y++];switch(v){case"m":s=g[y++]*t+n,c=g[y++]*t+r,o.moveTo(s,c);break;case"l":s=g[y++]*t+n,c=g[y++]*t+r,o.lineTo(s,c);break;case"q":l=g[y++]*t+n,u=g[y++]*t+r,h=g[y++]*t+n,f=g[y++]*t+r,o.quadraticCurveTo(h,f,l,u);break;case"b":l=g[y++]*t+n,u=g[y++]*t+r,h=g[y++]*t+n,f=g[y++]*t+r,d=g[y++]*t+n,m=g[y++]*t+r,o.bezierCurveTo(h,f,d,m,l,u);break}}return{offsetX:a.ha*t,path:o}}function Yu(e){nt.call(this,e)}Yu.prototype=Object.assign(Object.create(nt.prototype),{constructor:Yu,load:function(e,t,n,r){var i=this,a=new En(this.manager);a.setPath(this.path),a.load(e,function(o){var s;try{s=JSON.parse(o)}catch(l){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),s=JSON.parse(o.substring(65,o.length-2))}var c=i.parse(s);t&&t(c)},n,r)},parse:function(e){return new rf(e)}});var Eo,af={getContext:function(){return Eo===void 0&&(Eo=new(window.AudioContext||window.webkitAudioContext)),Eo},setContext:function(e){Eo=e}};function uc(e){nt.call(this,e)}uc.prototype=Object.assign(Object.create(nt.prototype),{constructor:uc,load:function(e,t,n,r){var i=this,a=new En(i.manager);a.setResponseType("arraybuffer"),a.setPath(i.path),a.load(e,function(o){try{var s=o.slice(0),c=af.getContext();c.decodeAudioData(s,function(l){t(l)})}catch(l){r?r(l):console.error(l),i.manager.itemError(e)}},n,r)}});function Zu(e,t,n){dn.call(this,void 0,n);var r=new pe().set(e),i=new pe().set(t),a=new E(r.r,r.g,r.b),o=new E(i.r,i.g,i.b),s=Math.sqrt(Math.PI),c=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}Zu.prototype=Object.assign(Object.create(dn.prototype),{constructor:Zu,isHemisphereLightProbe:!0,copy:function(e){return dn.prototype.copy.call(this,e),this},toJSON:function(e){var t=dn.prototype.toJSON.call(this,e);return t}});function Ju(e,t){dn.call(this,void 0,t);var n=new pe().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}Ju.prototype=Object.assign(Object.create(dn.prototype),{constructor:Ju,isAmbientLightProbe:!0,copy:function(e){return dn.prototype.copy.call(this,e),this},toJSON:function(e){var t=dn.prototype.toJSON.call(this,e);return t}});var Qu=new We,$u=new We;function r0(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new St,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new St,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}}Object.assign(r0.prototype,{update:function(e){var t=this._cache,n=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;if(n){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=e.projectionMatrix.clone(),i=t.eyeSep/2,a=i*t.near/t.focus,o=t.near*Math.tan(ke.DEG2RAD*t.fov*.5)/t.zoom,s,c;$u.elements[12]=-i,Qu.elements[12]=i,s=-o*t.aspect+a,c=o*t.aspect+a,r.elements[0]=2*t.near/(c-s),r.elements[8]=(c+s)/(c-s),this.cameraL.projectionMatrix.copy(r),s=-o*t.aspect-a,c=o*t.aspect-a,r.elements[0]=2*t.near/(c-s),r.elements[8]=(c+s)/(c-s),this.cameraR.projectionMatrix.copy(r)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply($u),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Qu)}});function of(e){this.autoStart=e!==void 0?e:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(of.prototype,{start:function(){this.startTime=(typeof performance=="undefined"?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=(typeof performance=="undefined"?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}});var wr=new E,Ku=new wt,i0=new E,Mr=new E;function eh(){se.call(this),this.type="AudioListener",this.context=af.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new of}eh.prototype=Object.assign(Object.create(se.prototype),{constructor:eh,getInput:function(){return this.gain},removeFilter:function(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(e){se.prototype.updateMatrixWorld.call(this,e);var t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(wr,Ku,i0),Mr.set(0,0,-1).applyQuaternion(Ku),t.positionX){var r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(wr.x,r),t.positionY.linearRampToValueAtTime(wr.y,r),t.positionZ.linearRampToValueAtTime(wr.z,r),t.forwardX.linearRampToValueAtTime(Mr.x,r),t.forwardY.linearRampToValueAtTime(Mr.y,r),t.forwardZ.linearRampToValueAtTime(Mr.z,r),t.upX.linearRampToValueAtTime(n.x,r),t.upY.linearRampToValueAtTime(n.y,r),t.upZ.linearRampToValueAtTime(n.z,r)}else t.setPosition(wr.x,wr.y,wr.z),t.setOrientation(Mr.x,Mr.y,Mr.z,n.x,n.y,n.z)}});function Fa(e){se.call(this),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this._startedAt=0,this._progress=0,this.filters=[]}Fa.prototype=Object.assign(Object.create(se.prototype),{constructor:Fa,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setMediaStreamSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(e){if(e===void 0&&(e=0),this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}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()},pause:function(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this},stop:function(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),this.isPlaying===!0?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this},setLoopStart:function(e){return this.loopStart=e,this},setLoopEnd:function(e){return this.loopEnd=e,this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}});var Er=new E,th=new wt,a0=new E,Tr=new E;function nh(e){Fa.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}nh.prototype=Object.assign(Object.create(Fa.prototype),{constructor:nh,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(e){if(se.prototype.updateMatrixWorld.call(this,e),!(this.hasPlaybackControl===!0&&this.isPlaying===!1)){this.matrixWorld.decompose(Er,th,a0),Tr.set(0,0,1).applyQuaternion(th);var t=this.panner;if(t.positionX){var n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Er.x,n),t.positionY.linearRampToValueAtTime(Er.y,n),t.positionZ.linearRampToValueAtTime(Er.z,n),t.orientationX.linearRampToValueAtTime(Tr.x,n),t.orientationY.linearRampToValueAtTime(Tr.y,n),t.orientationZ.linearRampToValueAtTime(Tr.z,n)}else t.setPosition(Er.x,Er.y,Er.z),t.setOrientation(Tr.x,Tr.y,Tr.z)}}});function sf(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t!==void 0?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}Object.assign(sf.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}});function lf(e,t,n){this.binding=e,this.valueSize=n;var r,i,a;switch(t){case"quaternion":r=this._slerp,i=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":r=this._select,i=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:r=this._lerp,i=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=i,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}Object.assign(lf.prototype,{accumulate:function(e,t){var n=this.buffer,r=this.valueSize,i=e*r+r,a=this.cumulativeWeight;if(a===0){for(var o=0;o!==r;++o)n[i+o]=n[o];a=t}else{a+=t;var s=t/a;this._mixBufferRegion(n,i,0,s,r)}this.cumulativeWeight=a},accumulateAdditive:function(e){var t=this.buffer,n=this.valueSize,r=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e},apply:function(e){var t=this.valueSize,n=this.buffer,r=e*t+t,i=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,i<1){var s=t*this._origIndex;this._mixBufferRegion(n,r,s,1-i,t)}a>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(var c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,r);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(var i=n,a=r;i!==a;++i)t[i]=t[r+i%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0},restoreOriginalState:function(){var e=this.valueSize*3;this.binding.setValue(this.buffer,e)},_setAdditiveIdentityNumeric:function(){for(var e=this._addIndex*this.valueSize,t=e+this.valueSize,n=e;n<t;n++)this.buffer[n]=0},_setAdditiveIdentityQuaternion:function(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*4+3]=1},_setAdditiveIdentityOther:function(){for(var e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize,n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]},_select:function(e,t,n,r,i){if(r>=.5)for(var a=0;a!==i;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,r){wt.slerpFlat(e,t,e,t,e,n,r)},_slerpAdditive:function(e,t,n,r,i){var a=this._workIndex*i;wt.multiplyQuaternionsFlat(e,a,e,t,e,n),wt.slerpFlat(e,t,e,t,e,a,r)},_lerp:function(e,t,n,r,i){for(var a=1-r,o=0;o!==i;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*r}},_lerpAdditive:function(e,t,n,r,i){for(var a=0;a!==i;++a){var o=t+a;e[o]=e[o]+e[n+a]*r}}});var Cc="\\[\\]\\.:\\/",o0=new RegExp("["+Cc+"]","g"),Rc="[^"+Cc+"]",s0="[^"+Cc.replace("\\.","")+"]",l0=/((?:WC+[\/:])*)/.source.replace("WC",Rc),c0=/(WCOD+)?/.source.replace("WCOD",s0),u0=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Rc),h0=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Rc),f0=new RegExp("^"+l0+c0+u0+h0+"$"),d0=["material","materials","bones"];function cf(e,t,n){var r=n||Gt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}Object.assign(cf.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}});function Gt(e,t,n){this.path=t,this.parsedPath=n||Gt.parseTrackName(t),this.node=Gt.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}Object.assign(Gt,{Composite:cf,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Gt.Composite(e,t,n):new Gt(e,t,n)},sanitizeNodeName:function(e){return e.replace(/\s/g,"_").replace(o0,"")},parseTrackName:function(e){var t=f0.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);var n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){var i=n.nodeName.substring(r+1);d0.indexOf(i)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=i)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n},findNode:function(e,t){if(!t||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){var r=function(a){for(var o=0;o<a.length;o++){var s=a[o];if(s.name===t||s.uuid===t)return s;var c=r(s.children);if(c)return c}return null},i=r(e.children);if(i)return i}return null}});Object.assign(Gt.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,n){t[n]=this.node[this.propertyName]},function(t,n){for(var r=this.resolvedProperty,i=0,a=r.length;i!==a;++i)t[n++]=r[i]},function(t,n){t[n]=this.resolvedProperty[this.propertyIndex]},function(t,n){this.resolvedProperty.toArray(t,n)}],SetterByBindingTypeAndVersioning:[[function(t,n){this.targetObject[this.propertyName]=t[n]},function(t,n){this.targetObject[this.propertyName]=t[n],this.targetObject.needsUpdate=!0},function(t,n){this.targetObject[this.propertyName]=t[n],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,n){for(var r=this.resolvedProperty,i=0,a=r.length;i!==a;++i)r[i]=t[n++]},function(t,n){for(var r=this.resolvedProperty,i=0,a=r.length;i!==a;++i)r[i]=t[n++];this.targetObject.needsUpdate=!0},function(t,n){for(var r=this.resolvedProperty,i=0,a=r.length;i!==a;++i)r[i]=t[n++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,n){this.resolvedProperty[this.propertyIndex]=t[n]},function(t,n){this.resolvedProperty[this.propertyIndex]=t[n],this.targetObject.needsUpdate=!0},function(t,n){this.resolvedProperty[this.propertyIndex]=t[n],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,n){this.resolvedProperty.fromArray(t,n)},function(t,n){this.resolvedProperty.fromArray(t,n),this.targetObject.needsUpdate=!0},function(t,n){this.resolvedProperty.fromArray(t,n),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,n){this.bind(),this.getValue(t,n)},setValue:function(t,n){this.bind(),this.setValue(t,n)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,r=t.propertyName,i=t.propertyIndex;if(e||(e=Gt.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){var a=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(a!==void 0){if(e[a]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[a]}}var s=e[r];if(s===void 0){var c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}var l=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?l=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(l=this.Versioning.MatrixWorldNeedsUpdate);var u=this.BindingType.Direct;if(i!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[i]!==void 0&&(i=e.morphTargetDictionary[i])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}u=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=i}else s.fromArray!==void 0&&s.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(u=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=r;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][l]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}});Object.assign(Gt.prototype,{_getValue_unbound:Gt.prototype.getValue,_setValue_unbound:Gt.prototype.setValue});function p0(){this.uuid=ke.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var r=this;this.stats={objects:{get total(){return r._objects.length},get inUse(){return this.total-r.nCachedObjects_}},get bindingsPerObject(){return r._bindings.length}}}Object.assign(p0.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,c=void 0,l=0,u=arguments.length;l!==u;++l){var h=arguments[l],f=h.uuid,d=r[f];if(d===void 0){d=t++,r[f]=d,e.push(h);for(var m=0,g=s;m!==g;++m)o[m].push(new Gt(h,i[m],a[m]))}else if(d<n){c=e[d];var y=--n,p=e[y];r[p.uuid]=d,e[d]=p,r[f]=y,e[y]=h;for(var m=0,g=s;m!==g;++m){var v=o[m],_=v[y],x=v[d];v[d]=_,x===void 0&&(x=new Gt(h,i[m],a[m])),v[y]=x}}else e[d]!==c&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,i=r.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],c=s.uuid,l=n[c];if(l!==void 0&&l>=t){var u=t++,h=e[u];n[h.uuid]=l,e[l]=h,n[c]=u,e[u]=s;for(var f=0,d=i;f!==d;++f){var m=r[f],g=m[u],y=m[l];m[l]=g,m[u]=y}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,i=this._bindings,a=i.length,o=0,s=arguments.length;o!==s;++o){var c=arguments[o],l=c.uuid,u=r[l];if(u!==void 0)if(delete r[l],u<n){var h=--n,f=e[h],d=--t,m=e[d];r[f.uuid]=u,e[u]=f,r[m.uuid]=h,e[h]=m,e.pop();for(var g=0,y=a;g!==y;++g){var p=i[g],v=p[h],_=p[d];p[u]=v,p[h]=_,p.pop()}}else{var d=--t,m=e[d];r[m.uuid]=u,e[u]=m,e.pop();for(var g=0,y=a;g!==y;++g){var p=i[g];p[u]=p[d],p.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],i=this._bindings;if(r!==void 0)return i[r];var a=this._paths,o=this._parsedPaths,s=this._objects,c=s.length,l=this.nCachedObjects_,u=new Array(c);r=i.length,n[e]=r,a.push(e),o.push(t),i.push(u);for(var h=l,f=s.length;h!==f;++h){var d=s[h];u[h]=new Gt(d,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){var r=this._paths,i=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],c=e[o];t[c]=n,a[n]=s,a.pop(),i[n]=i[o],i.pop(),r[n]=r[o],r.pop()}}});function uf(e,t,n,r){this._mixer=e,this._clip=t,this._localRoot=n||null,this.blendMode=r||t.blendMode;for(var i=t.tracks,a=i.length,o=new Array(a),s={endingStart:di,endingEnd:di},c=0;c!==a;++c){var l=i[c].createInterpolant(null);o[c]=l,l.settings=s}this._interpolantSettings=s,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=op,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}Object.assign(uf.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var r=this._clip.duration,i=e._clip.duration,a=i/r,o=r/i;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var r=this._mixer,i=r.time,a=this._timeScaleInterpolant,o=this.timeScale;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,c=a.sampleValues;return s[0]=i,s[1]=i+n,c[0]=e/o,c[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,r){if(!this.enabled){this._updateWeight(e);return}var i=this._startTime;if(i!==null){var a=(e-i)*n;if(a<0||n===0)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0){var c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case Ph:for(var u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulateAdditive(s);break;case Ec:default:for(var u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(r,s)}}},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(n!==null){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(n!==null){var r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,r=this.loop,i=this._loopCount,a=r===sp;if(e===0)return i===-1?t:a&&(i&1)===1?n-t:t;if(r===ap){i===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else if(t<0)t=0;else{this.time=t;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(i===-1&&(e>=0?(i=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,i+=Math.abs(o);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(s===1){var c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=i,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=t;if(a&&(i&1)===1)return n-t}return t},_setEndings:function(e,t,n){var r=this._interpolantSettings;n?(r.endingStart=oi,r.endingEnd=oi):(e?r.endingStart=this.zeroSlopeAtStart?oi:di:r.endingStart=Wo,t?r.endingEnd=this.zeroSlopeAtEnd?oi:di:r.endingEnd=Wo)},_scheduleFading:function(e,t,n){var r=this._mixer,i=r.time,a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=i,s[0]=t,o[1]=i+e,s[1]=n,this}});function rh(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}rh.prototype=Object.assign(Object.create(vn.prototype),{constructor:rh,_bindAction:function(e,t){var n=e._localRoot||this._root,r=e._clip.tracks,i=r.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,c=this._bindingsByRootAndName,l=c[s];l===void 0&&(l={},c[s]=l);for(var u=0;u!==i;++u){var h=r[u],f=h.name,d=l[f];if(d!==void 0)a[u]=d;else{if(d=a[u],d!==void 0){d._cacheIndex===null&&(++d.referenceCount,this._addInactiveBinding(d,s,f));continue}var m=t&&t._propertyBindings[u].binding.parsedPath;d=new lf(Gt.create(n,f,m),h.ValueTypeName,h.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,s,f),a[u]=d}o[u].resultBuffer=d.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,r=this._actionsByClip[n];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,n,t)}for(var i=e._propertyBindings,a=0,o=i.length;a!==o;++a){var s=i[a];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];--i.useCount===0&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return t!==null&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var r=this._actions,i=this._actionsByClip,a=i[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,i[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=r.length,r.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;var i=e._clip.uuid,a=this._actionsByClip,o=a[i],s=o.knownActions,c=s[s.length-1],l=e._byClipCacheIndex;c._byClipCacheIndex=l,s[l]=c,s.pop(),e._byClipCacheIndex=null;var u=o.actionByRoot,h=(e._localRoot||this._root).uuid;delete u[h],s.length===0&&delete a[i],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,r=t.length;n!==r;++n){var i=t[n];--i.referenceCount===0&&this._removeInactiveBinding(i)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_addInactiveBinding:function(e,t,n){var r=this._bindingsByRootAndName,i=r[t],a=this._bindings;i===void 0&&(i={},r[t]=i),i[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,r=n.rootNode.uuid,i=n.path,a=this._bindingsByRootAndName,o=a[r],s=t[t.length-1],c=e._cacheIndex;s._cacheIndex=c,t[c]=s,t.pop(),delete o[i],Object.keys(o).length===0&&delete a[r]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,i=t[r];e._cacheIndex=r,t[r]=e,i._cacheIndex=n,t[n]=i},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new ms(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,i=t[r];e.__cacheIndex=r,t[r]=e,i.__cacheIndex=n,t[n]=i},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t,n){var r=t||this._root,i=r.uuid,a=typeof e=="string"?hn.findByName(r,e):e,o=a!==null?a.uuid:e,s=this._actionsByClip[o],c=null;if(n===void 0&&(a!==null?n=a.blendMode:n=Ec),s!==void 0){var l=s.actionByRoot[i];if(l!==void 0&&l.blendMode===n)return l;c=s.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;var u=new uf(this,a,t,n);return this._bindAction(u,c),this._addInactiveAction(u,o,i),u},existingAction:function(e,t){var n=t||this._root,r=n.uuid,i=typeof e=="string"?hn.findByName(n,e):e,a=i?i.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[r]||null},stopAllAction:function(){for(var e=this._actions,t=this._nActiveActions,n=t-1;n>=0;--n)e[n].stop();return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,r=this.time+=e,i=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){var s=t[o];s._update(r,e,i,a)}for(var c=this._bindings,l=this._nActiveBindings,o=0;o!==l;++o)c[o].apply(a);return this},setTime:function(e){this.time=0;for(var t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,r=this._actionsByClip,i=r[n];if(i!==void 0){for(var a=i.knownActions,o=0,s=a.length;o!==s;++o){var c=a[o];this._deactivateAction(c);var l=c._cacheIndex,u=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,u._cacheIndex=l,t[l]=u,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var r in n){var i=n[r].actionByRoot,a=i[t];a!==void 0&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o=this._bindingsByRootAndName,s=o[t];if(s!==void 0)for(var c in s){var l=s[c];l.restoreOriginalState(),this._removeInactiveBinding(l)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}});function hc(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}hc.prototype.clone=function(){return new hc(this.value.clone===void 0?this.value:this.value.clone())};function ih(e,t,n){fr.call(this,e,t),this.meshPerAttribute=n||1}ih.prototype=Object.assign(Object.create(fr.prototype),{constructor:ih,isInstancedInterleavedBuffer:!0,copy:function(e){return fr.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}});function hf(e,t,n,r){this.ray=new Ni(e,t),this.near=n||0,this.far=r||1/0,this.camera=null,this.layers=new Ac,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function ah(e,t){return e.distance-t.distance}function fc(e,t,n,r){if(e.layers.test(t.layers)&&e.raycast(t,n),r===!0)for(var i=e.children,a=0,o=i.length;a<o;a++)fc(i[a],t,n,!0)}Object.assign(hf.prototype,{set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,n){var r=n||[];return fc(e,this,r,t),r.sort(ah),r},intersectObjects:function(e,t,n){var r=n||[];if(Array.isArray(e)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),r;for(var i=0,a=e.length;i<a;i++)fc(e[i],this,r,t);return r.sort(ah),r}});function dc(e,t,n){return this.radius=e!==void 0?e:1,this.phi=t!==void 0?t:0,this.theta=n!==void 0?n:0,this}Object.assign(dc.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(ke.clamp(t/this.radius,-1,1))),this}});function v0(e,t,n){return this.radius=e!==void 0?e:1,this.theta=t!==void 0?t:0,this.y=n!==void 0?n:0,this}Object.assign(v0.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}});var oh=new X;function ff(e,t){this.min=e!==void 0?e:new X(1/0,1/0),this.max=t!==void 0?t:new X(-1/0,-1/0)}Object.assign(ff.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(e,t){var n=oh.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return e===void 0&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new X),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new X),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return t===void 0&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new X),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return t===void 0&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new X),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){var t=oh.copy(e).clamp(this.min,this.max);return t.sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var sh=new E,To=new E;function df(e,t){this.start=e!==void 0?e:new E,this.end=t!==void 0?t:new E}Object.assign(df.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return e===void 0&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new E),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return e===void 0&&(console.warn("THREE.Line3: .delta() target is now required"),e=new E),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return t===void 0&&(console.warn("THREE.Line3: .at() target is now required"),t=new E),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){sh.subVectors(e,this.start),To.subVectors(this.end,this.start);var n=To.dot(To),r=To.dot(sh),i=r/n;return t&&(i=ke.clamp(i,0,1)),i},closestPointToPoint:function(e,t,n){var r=this.closestPointToPointParameter(e,t);return n===void 0&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new E),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}});function xs(e){se.call(this),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}xs.prototype=Object.create(se.prototype);xs.prototype.constructor=xs;xs.prototype.isImmediateRenderObject=!0;var lh=new E;function Ba(e,t){se.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new ge,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],i=0,a=1,o=32;i<o;i++,a++){var s=i/o*Math.PI*2,c=a/o*Math.PI*2;r.push(Math.cos(s),Math.sin(s),1,Math.cos(c),Math.sin(c),1)}n.setAttribute("position",new ce(r,3));var l=new xt({fog:!1,toneMapped:!1});this.cone=new Mt(n,l),this.add(this.cone),this.update()}Ba.prototype=Object.create(se.prototype);Ba.prototype.constructor=Ba;Ba.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()};Ba.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),lh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(lh),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var nr=new E,So=new We,pl=new We;function pf(e){var t=[];e&&e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,pf(e.children[n]));return t}function Oi(e){for(var t=pf(e),n=new ge,r=[],i=[],a=new pe(0,0,1),o=new pe(0,1,0),s=0;s<t.length;s++){var c=t[s];c.parent&&c.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),i.push(a.r,a.g,a.b),i.push(o.r,o.g,o.b))}n.setAttribute("position",new ce(r,3)),n.setAttribute("color",new ce(i,3));var l=new xt({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});Mt.call(this,n,l),this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}Oi.prototype=Object.create(Mt.prototype);Oi.prototype.constructor=Oi;Oi.prototype.isSkeletonHelper=!0;Oi.prototype.updateMatrixWorld=function(e){var t=this.bones,n=this.geometry,r=n.getAttribute("position");pl.getInverse(this.root.matrixWorld);for(var i=0,a=0;i<t.length;i++){var o=t[i];o.parent&&o.parent.isBone&&(So.multiplyMatrices(pl,o.matrixWorld),nr.setFromMatrixPosition(So),r.setXYZ(a,nr.x,nr.y,nr.z),So.multiplyMatrices(pl,o.parent.matrixWorld),nr.setFromMatrixPosition(So),r.setXYZ(a+1,nr.x,nr.y,nr.z),a+=2)}n.getAttribute("position").needsUpdate=!0,se.prototype.updateMatrixWorld.call(this,e)};function Ua(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var r=new _i(t,4,2),i=new pn({wireframe:!0,fog:!1,toneMapped:!1});ft.call(this,r,i),this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}Ua.prototype=Object.create(ft.prototype);Ua.prototype.constructor=Ua;Ua.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()};Ua.prototype.update=function(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)};var m0=new E,ch=new pe,uh=new pe;function za(e,t,n){se.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var r=new gi(t);r.rotateY(Math.PI*.5),this.material=new pn({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);var i=r.getAttribute("position"),a=new Float32Array(i.count*3);r.setAttribute("color",new De(a,3)),this.add(new ft(r,this.material)),this.update()}za.prototype=Object.create(se.prototype);za.prototype.constructor=za;za.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()};za.prototype.update=function(){var e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{var t=e.geometry.getAttribute("color");ch.copy(this.light.color),uh.copy(this.light.groundColor);for(var n=0,r=t.count;n<r;n++){var i=n<r/2?ch:uh;t.setXYZ(n,i.r,i.g,i.b)}t.needsUpdate=!0}e.lookAt(m0.setFromMatrixPosition(this.light.matrixWorld).negate())};function pc(e,t,n,r){e=e||10,t=t||10,n=new pe(n!==void 0?n:4473924),r=new pe(r!==void 0?r:8947848);for(var i=t/2,a=e/t,o=e/2,s=[],c=[],l=0,u=0,h=-o;l<=t;l++,h+=a){s.push(-o,0,h,o,0,h),s.push(h,0,-o,h,0,o);var f=l===i?n:r;f.toArray(c,u),u+=3,f.toArray(c,u),u+=3,f.toArray(c,u),u+=3,f.toArray(c,u),u+=3}var d=new ge;d.setAttribute("position",new ce(s,3)),d.setAttribute("color",new ce(c,3));var m=new xt({vertexColors:!0,toneMapped:!1});Mt.call(this,d,m),this.type="GridHelper"}pc.prototype=Object.assign(Object.create(Mt.prototype),{constructor:pc,copy:function(e){return Mt.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return new this.constructor().copy(this)}});function vc(e,t,n,r,i,a){e=e||10,t=t||16,n=n||8,r=r||64,i=new pe(i!==void 0?i:4473924),a=new pe(a!==void 0?a:8947848);var o=[],s=[],c,l,u,h,f,d,m;for(h=0;h<=t;h++)u=h/t*(Math.PI*2),c=Math.sin(u)*e,l=Math.cos(u)*e,o.push(0,0,0),o.push(c,0,l),m=h&1?i:a,s.push(m.r,m.g,m.b),s.push(m.r,m.g,m.b);for(h=0;h<=n;h++)for(m=h&1?i:a,d=e-e/n*h,f=0;f<r;f++)u=f/r*(Math.PI*2),c=Math.sin(u)*d,l=Math.cos(u)*d,o.push(c,0,l),s.push(m.r,m.g,m.b),u=(f+1)/r*(Math.PI*2),c=Math.sin(u)*d,l=Math.cos(u)*d,o.push(c,0,l),s.push(m.r,m.g,m.b);var g=new ge;g.setAttribute("position",new ce(o,3)),g.setAttribute("color",new ce(s,3));var y=new xt({vertexColors:!0,toneMapped:!1});Mt.call(this,g,y),this.type="PolarGridHelper"}vc.prototype=Object.create(Mt.prototype);vc.prototype.constructor=vc;var hh=new E,Ao=new E,fh=new E;function Ga(e,t,n){se.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);var r=new ge;r.setAttribute("position",new ce([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var i=new xt({fog:!1,toneMapped:!1});this.lightPlane=new nn(r,i),this.add(this.lightPlane),r=new ge,r.setAttribute("position",new ce([0,0,0,0,0,1],3)),this.targetLine=new nn(r,i),this.add(this.targetLine),this.update()}Ga.prototype=Object.create(se.prototype);Ga.prototype.constructor=Ga;Ga.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()};Ga.prototype.update=function(){hh.setFromMatrixPosition(this.light.matrixWorld),Ao.setFromMatrixPosition(this.light.target.matrixWorld),fh.subVectors(Ao,hh),this.lightPlane.lookAt(Ao),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Ao),this.targetLine.scale.z=fh.length()};var Lo=new E,vt=new zn;function _s(e){var t=new ge,n=new xt({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],i=[],a={},o=new pe(16755200),s=new pe(16711680),c=new pe(43775),l=new pe(16777215),u=new pe(3355443);h("n1","n2",o),h("n2","n4",o),h("n4","n3",o),h("n3","n1",o),h("f1","f2",o),h("f2","f4",o),h("f4","f3",o),h("f3","f1",o),h("n1","f1",o),h("n2","f2",o),h("n3","f3",o),h("n4","f4",o),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c),h("c","t",l),h("p","c",u),h("cn1","cn2",u),h("cn3","cn4",u),h("cf1","cf2",u),h("cf3","cf4",u);function h(d,m,g){f(d,g),f(m,g)}function f(d,m){r.push(0,0,0),i.push(m.r,m.g,m.b),a[d]===void 0&&(a[d]=[]),a[d].push(r.length/3-1)}t.setAttribute("position",new ce(r,3)),t.setAttribute("color",new ce(i,3)),Mt.call(this,t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}_s.prototype=Object.create(Mt.prototype);_s.prototype.constructor=_s;_s.prototype.update=function(){var e=this.geometry,t=this.pointMap,n=1,r=1;vt.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),yt("c",t,e,vt,0,0,-1),yt("t",t,e,vt,0,0,1),yt("n1",t,e,vt,-n,-r,-1),yt("n2",t,e,vt,n,-r,-1),yt("n3",t,e,vt,-n,r,-1),yt("n4",t,e,vt,n,r,-1),yt("f1",t,e,vt,-n,-r,1),yt("f2",t,e,vt,n,-r,1),yt("f3",t,e,vt,-n,r,1),yt("f4",t,e,vt,n,r,1),yt("u1",t,e,vt,n*.7,r*1.1,-1),yt("u2",t,e,vt,-n*.7,r*1.1,-1),yt("u3",t,e,vt,0,r*2,-1),yt("cf1",t,e,vt,-n,0,1),yt("cf2",t,e,vt,n,0,1),yt("cf3",t,e,vt,0,-r,1),yt("cf4",t,e,vt,0,r,1),yt("cn1",t,e,vt,-n,0,-1),yt("cn2",t,e,vt,n,0,-1),yt("cn3",t,e,vt,0,-r,-1),yt("cn4",t,e,vt,0,r,-1),e.getAttribute("position").needsUpdate=!0};function yt(e,t,n,r,i,a,o){Lo.set(i,a,o).unproject(r);var s=t[e];if(s!==void 0)for(var c=n.getAttribute("position"),l=0,u=s.length;l<u;l++)c.setXYZ(s[l],Lo.x,Lo.y,Lo.z)}var Po=new Pn;function Nr(e,t){this.object=e,t===void 0&&(t=16776960);var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(8*3),i=new ge;i.setIndex(new De(n,1)),i.setAttribute("position",new De(r,3)),Mt.call(this,i,new xt({color:t,toneMapped:!1})),this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}Nr.prototype=Object.create(Mt.prototype);Nr.prototype.constructor=Nr;Nr.prototype.update=function(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&Po.setFromObject(this.object),!Po.isEmpty()){var t=Po.min,n=Po.max,r=this.geometry.attributes.position,i=r.array;i[0]=n.x,i[1]=n.y,i[2]=n.z,i[3]=t.x,i[4]=n.y,i[5]=n.z,i[6]=t.x,i[7]=t.y,i[8]=n.z,i[9]=n.x,i[10]=t.y,i[11]=n.z,i[12]=n.x,i[13]=n.y,i[14]=t.z,i[15]=t.x,i[16]=n.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=n.x,i[22]=t.y,i[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}};Nr.prototype.setFromObject=function(e){return this.object=e,this.update(),this};Nr.prototype.copy=function(e){return Mt.prototype.copy.call(this,e),this.object=e.object,this};Nr.prototype.clone=function(){return new this.constructor().copy(this)};function bs(e,t){this.type="Box3Helper",this.box=e,t=t||16776960;var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],i=new ge;i.setIndex(new De(n,1)),i.setAttribute("position",new ce(r,3)),Mt.call(this,i,new xt({color:t,toneMapped:!1})),this.type="Box3Helper",this.geometry.computeBoundingSphere()}bs.prototype=Object.create(Mt.prototype);bs.prototype.constructor=bs;bs.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),se.prototype.updateMatrixWorld.call(this,e))};function ws(e,t,n){this.plane=e,this.size=t===void 0?1:t;var r=n!==void 0?n:16776960,i=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],a=new ge;a.setAttribute("position",new ce(i,3)),a.computeBoundingSphere(),nn.call(this,a,new xt({color:r,toneMapped:!1})),this.type="PlaneHelper";var o=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],s=new ge;s.setAttribute("position",new ce(o,3)),s.computeBoundingSphere(),this.add(new ft(s,new pn({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}ws.prototype=Object.create(nn.prototype);ws.prototype.constructor=ws;ws.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?Pt:Va,this.lookAt(this.plane.normal),se.prototype.updateMatrixWorld.call(this,e)};var dh=new E,Co,vl;function mr(e,t,n,r,i,a){se.call(this),this.type="ArrowHelper",e===void 0&&(e=new E(0,0,1)),t===void 0&&(t=new E(0,0,0)),n===void 0&&(n=1),r===void 0&&(r=16776960),i===void 0&&(i=.2*n),a===void 0&&(a=.2*i),Co===void 0&&(Co=new ge,Co.setAttribute("position",new ce([0,0,0,0,1,0],3)),vl=new pr(0,.5,1,5,1),vl.translate(0,-.5,0)),this.position.copy(t),this.line=new nn(Co,new xt({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ft(vl,new pn({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,i,a)}mr.prototype=Object.create(se.prototype);mr.prototype.constructor=mr;mr.prototype.setDirection=function(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{dh.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(dh,t)}};mr.prototype.setLength=function(e,t,n){t===void 0&&(t=.2*e),n===void 0&&(n=.2*t),this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()};mr.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)};mr.prototype.copy=function(e){return se.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this};mr.prototype.clone=function(){return new this.constructor().copy(this)};function mc(e){e=e||1;var t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new ge;r.setAttribute("position",new ce(t,3)),r.setAttribute("color",new ce(n,3));var i=new xt({vertexColors:!0,toneMapped:!1});Mt.call(this,r,i),this.type="AxesHelper"}mc.prototype=Object.create(Mt.prototype);mc.prototype.constructor=mc;var fi=4,ur=8,_n=Math.pow(2,ur),vf=[.125,.215,.35,.446,.526,.582],mf=ur-fi+1+vf.length,ai=20,Mn={[kt]:0,[Ls]:1,[Sc]:2,[Ch]:3,[Rh]:4,[Oh]:5,[Tc]:6},ml=new Na,{_lodPlanes:Zi,_sizeLods:ph,_sigmas:Ro}=y0(),gl=null,Sr=(1+Math.sqrt(5))/2,ri=1/Sr,vh=[new E(1,1,1),new E(-1,1,1),new E(1,1,-1),new E(-1,1,-1),new E(0,Sr,ri),new E(0,Sr,-ri),new E(ri,0,Sr),new E(-ri,0,Sr),new E(Sr,ri,0),new E(-Sr,ri,0)];function mh(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=x0(ai),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}mh.prototype={constructor:mh,fromScene:function(e,t=0,n=.1,r=100){gl=this._renderer.getRenderTarget();var i=this._allocateTargets();return this._sceneToCubeUV(e,n,r,i),t>0&&this._blur(i,0,0,t),this._applyPMREM(i),this._cleanup(i),i},fromEquirectangular:function(e){return e.magFilter=bt,e.minFilter=bt,e.generateMipmaps=!1,this.fromCubemap(e)},fromCubemap:function(e){gl=this._renderer.getRenderTarget();var t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t},compileCubemapShader:function(){this._cubemapShader===null&&(this._cubemapShader=xh(),this._compileMaterial(this._cubemapShader))},compileEquirectangularShader:function(){this._equirectShader===null&&(this._equirectShader=yh(),this._compileMaterial(this._equirectShader))},dispose:function(){this._blurMaterial.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(var e=0;e<Zi.length;e++)Zi[e].dispose()},_cleanup:function(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(gl),e.scissorTest=!1,e.setSize(e.width,e.height)},_allocateTargets:function(e){var t={magFilter:bt,minFilter:bt,generateMipmaps:!1,type:Wa,format:wd,encoding:g0(e)?e.encoding:Sc,depthBuffer:!1,stencilBuffer:!1},n=gh(t);return n.depthBuffer=!e,this._pingPongRenderTarget=gh(t),n},_compileMaterial:function(e){var t=new ft(Zi[0],e);this._renderer.compile(t,ml)},_sceneToCubeUV:function(e,t,n,r){var i=90,a=1,o=new St(i,a,t,n),s=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],l=this._renderer,u=l.outputEncoding,h=l.toneMapping,f=l.toneMappingExposure,d=l.getClearColor(),m=l.getClearAlpha();l.toneMapping=Th,l.toneMappingExposure=1,l.outputEncoding=kt;var g=e.background;if(g&&g.isColor){g.convertSRGBToLinear();var y=Math.max(g.r,g.g,g.b),p=Math.min(Math.max(Math.ceil(Math.log2(y)),-128),127);g=g.multiplyScalar(Math.pow(2,-p));var v=(p+128)/255;l.setClearColor(g,v),e.background=null}for(var _=0;_<6;_++){var x=_%3;x==0?(o.up.set(0,s[_],0),o.lookAt(c[_],0,0)):x==1?(o.up.set(0,0,s[_]),o.lookAt(0,c[_],0)):(o.up.set(0,s[_],0),o.lookAt(0,0,c[_])),yl(r,x*_n,_>2?_n:0,_n,_n),l.setRenderTarget(r),l.render(e,o)}l.toneMapping=h,l.toneMappingExposure=f,l.outputEncoding=u,l.setClearColor(d,m)},_textureToCubeUV:function(e,t){var n=this._renderer;e.isCubeTexture?this._cubemapShader==null&&(this._cubemapShader=xh()):this._equirectShader==null&&(this._equirectShader=yh());var r=e.isCubeTexture?this._cubemapShader:this._equirectShader,i=new ft(Zi[0],r),a=r.uniforms;a.envMap.value=e,e.isCubeTexture||a.texelSize.value.set(1/e.image.width,1/e.image.height),a.inputEncoding.value=Mn[e.encoding],a.outputEncoding.value=Mn[t.texture.encoding],yl(t,0,0,3*_n,2*_n),n.setRenderTarget(t),n.render(i,ml)},_applyPMREM:function(e){var t=this._renderer,n=t.autoClear;t.autoClear=!1;for(var r=1;r<mf;r++){var i=Math.sqrt(Ro[r]*Ro[r]-Ro[r-1]*Ro[r-1]),a=vh[(r-1)%vh.length];this._blur(e,r-1,r,i,a)}t.autoClear=n},_blur:function(e,t,n,r,i){var a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,r,"latitudinal",i),this._halfBlur(a,e,n,n,r,"longitudinal",i)},_halfBlur:function(e,t,n,r,i,a,o){var s=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");var l=3,u=new ft(Zi[r],c),h=c.uniforms,f=ph[n]-1,d=isFinite(i)?Math.PI/(2*f):2*Math.PI/(2*ai-1),m=i/d,g=isFinite(i)?1+Math.floor(l*m):ai;g>ai&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${ai}`);for(var y=[],p=0,v=0;v<ai;++v){var b=v/m,_=Math.exp(-b*b/2);y.push(_),v==0?p+=_:v<g&&(p+=2*_)}for(var v=0;v<y.length;v++)y[v]=y[v]/p;h.envMap.value=e.texture,h.samples.value=g,h.weights.value=y,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o),h.dTheta.value=d,h.mipInt.value=ur-n,h.inputEncoding.value=Mn[e.texture.encoding],h.outputEncoding.value=Mn[e.texture.encoding];var x=ph[r],b=3*Math.max(0,_n-2*x),T=(r===0?0:2*_n)+2*x*(r>ur-fi?r-ur+fi:0);yl(t,b,T,3*x,2*x),s.setRenderTarget(t),s.render(u,ml)}};function g0(e){return e===void 0||e.type!==Wa?!1:e.encoding===kt||e.encoding===Ls||e.encoding===Tc}function y0(){for(var e=[],t=[],n=[],r=ur,i=0;i<mf;i++){var a=Math.pow(2,r);t.push(a);var o=1/a;i>ur-fi?o=vf[i-ur+fi-1]:i==0&&(o=0),n.push(o);for(var s=1/(a-1),c=-s/2,l=1+s/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],h=6,f=6,d=3,m=2,g=1,y=new Float32Array(d*f*h),p=new Float32Array(m*f*h),v=new Float32Array(g*f*h),_=0;_<h;_++){var x=_%3*2/3-1,b=_>2?0:-1,T=[x,b,0,x+2/3,b,0,x+2/3,b+1,0,x,b,0,x+2/3,b+1,0,x,b+1,0];y.set(T,d*f*_),p.set(u,m*f*_);var C=[_,_,_,_,_,_];v.set(C,g*f*_)}var N=new ge;N.setAttribute("position",new De(y,d)),N.setAttribute("uv",new De(p,m)),N.setAttribute("faceIndex",new De(v,g)),e.push(N),r>fi&&r--}return{_lodPlanes:e,_sizeLods:t,_sigmas:n}}function gh(e){var t=new Kt(3*_n,3*_n,e);return t.texture.mapping=ka,t.texture.name="PMREM.cubeUv",t.scissorTest=!0,t}function yl(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function x0(e){var t=new Float32Array(e),n=new E(0,1,0),r=new vr({defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:Mn[kt]},outputEncoding:{value:Mn[kt]}},vertexShader:Oc(),fragmentShader:`
3114
- precision mediump float;
3115
- precision mediump int;
3116
- varying vec3 vOutputDirection;
3117
- uniform sampler2D envMap;
3118
- uniform int samples;
3119
- uniform float weights[n];
3120
- uniform bool latitudinal;
3121
- uniform float dTheta;
3122
- uniform float mipInt;
3123
- uniform vec3 poleAxis;
3124
-
3125
- ${Dc()}
3126
-
3127
- #define ENVMAP_TYPE_CUBE_UV
3128
- #include <cube_uv_reflection_fragment>
3129
-
3130
- vec3 getSample(float theta, vec3 axis) {
3131
- float cosTheta = cos(theta);
3132
- // Rodrigues' axis-angle rotation
3133
- vec3 sampleDirection = vOutputDirection * cosTheta
3134
- + cross(axis, vOutputDirection) * sin(theta)
3135
- + axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);
3136
- return bilinearCubeUV(envMap, sampleDirection, mipInt);
3137
- }
3138
-
3139
- void main() {
3140
- vec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);
3141
- if (all(equal(axis, vec3(0.0))))
3142
- axis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);
3143
- axis = normalize(axis);
3144
- gl_FragColor = vec4(0.0);
3145
- gl_FragColor.rgb += weights[0] * getSample(0.0, axis);
3146
- for (int i = 1; i < n; i++) {
3147
- if (i >= samples)
3148
- break;
3149
- float theta = dTheta * float(i);
3150
- gl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);
3151
- gl_FragColor.rgb += weights[i] * getSample(theta, axis);
3152
- }
3153
- gl_FragColor = linearToOutputTexel(gl_FragColor);
3154
- }
3155
- `,blending:sr,depthTest:!1,depthWrite:!1});return r.type="SphericalGaussianBlur",r}function yh(){var e=new X(1,1),t=new vr({uniforms:{envMap:{value:null},texelSize:{value:e},inputEncoding:{value:Mn[kt]},outputEncoding:{value:Mn[kt]}},vertexShader:Oc(),fragmentShader:`
3156
- precision mediump float;
3157
- precision mediump int;
3158
- varying vec3 vOutputDirection;
3159
- uniform sampler2D envMap;
3160
- uniform vec2 texelSize;
3161
-
3162
- ${Dc()}
3163
-
3164
- #include <common>
3165
-
3166
- void main() {
3167
- gl_FragColor = vec4(0.0);
3168
- vec3 outputDirection = normalize(vOutputDirection);
3169
- vec2 uv = equirectUv( outputDirection );
3170
- vec2 f = fract(uv / texelSize - 0.5);
3171
- uv -= f * texelSize;
3172
- vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
3173
- uv.x += texelSize.x;
3174
- vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
3175
- uv.y += texelSize.y;
3176
- vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
3177
- uv.x -= texelSize.x;
3178
- vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
3179
- vec3 tm = mix(tl, tr, f.x);
3180
- vec3 bm = mix(bl, br, f.x);
3181
- gl_FragColor.rgb = mix(tm, bm, f.y);
3182
- gl_FragColor = linearToOutputTexel(gl_FragColor);
3183
- }
3184
- `,blending:sr,depthTest:!1,depthWrite:!1});return t.type="EquirectangularToCubeUV",t}function xh(){var e=new vr({uniforms:{envMap:{value:null},inputEncoding:{value:Mn[kt]},outputEncoding:{value:Mn[kt]}},vertexShader:Oc(),fragmentShader:`
3185
- precision mediump float;
3186
- precision mediump int;
3187
- varying vec3 vOutputDirection;
3188
- uniform samplerCube envMap;
3189
-
3190
- ${Dc()}
3191
-
3192
- void main() {
3193
- gl_FragColor = vec4(0.0);
3194
- gl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;
3195
- gl_FragColor = linearToOutputTexel(gl_FragColor);
3196
- }
3197
- `,blending:sr,depthTest:!1,depthWrite:!1});return e.type="CubemapToCubeUV",e}function Oc(){return`
3198
- precision mediump float;
3199
- precision mediump int;
3200
- attribute vec3 position;
3201
- attribute vec2 uv;
3202
- attribute float faceIndex;
3203
- varying vec3 vOutputDirection;
3204
-
3205
- // RH coordinate system; PMREM face-indexing convention
3206
- vec3 getDirection(vec2 uv, float face) {
3207
- uv = 2.0 * uv - 1.0;
3208
- vec3 direction = vec3(uv, 1.0);
3209
- if (face == 0.0) {
3210
- direction = direction.zyx; // ( 1, v, u ) pos x
3211
- } else if (face == 1.0) {
3212
- direction = direction.xzy;
3213
- direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3214
- } else if (face == 2.0) {
3215
- direction.x *= -1.0; // ( -u, v, 1 ) pos z
3216
- } else if (face == 3.0) {
3217
- direction = direction.zyx;
3218
- direction.xz *= -1.0; // ( -1, v, -u ) neg x
3219
- } else if (face == 4.0) {
3220
- direction = direction.xzy;
3221
- direction.xy *= -1.0; // ( -u, -1, v ) neg y
3222
- } else if (face == 5.0) {
3223
- direction.z *= -1.0; // ( u, v, -1 ) neg z
3224
- }
3225
- return direction;
3226
- }
3227
-
3228
- void main() {
3229
- vOutputDirection = getDirection(uv, faceIndex);
3230
- gl_Position = vec4( position, 1.0 );
3231
- }
3232
- `}function Dc(){return`
3233
- uniform int inputEncoding;
3234
- uniform int outputEncoding;
3235
-
3236
- #include <encodings_pars_fragment>
3237
-
3238
- vec4 inputTexelToLinear(vec4 value){
3239
- if(inputEncoding == 0){
3240
- return value;
3241
- }else if(inputEncoding == 1){
3242
- return sRGBToLinear(value);
3243
- }else if(inputEncoding == 2){
3244
- return RGBEToLinear(value);
3245
- }else if(inputEncoding == 3){
3246
- return RGBMToLinear(value, 7.0);
3247
- }else if(inputEncoding == 4){
3248
- return RGBMToLinear(value, 16.0);
3249
- }else if(inputEncoding == 5){
3250
- return RGBDToLinear(value, 256.0);
3251
- }else{
3252
- return GammaToLinear(value, 2.2);
3253
- }
3254
- }
3255
-
3256
- vec4 linearToOutputTexel(vec4 value){
3257
- if(outputEncoding == 0){
3258
- return value;
3259
- }else if(outputEncoding == 1){
3260
- return LinearTosRGB(value);
3261
- }else if(outputEncoding == 2){
3262
- return LinearToRGBE(value);
3263
- }else if(outputEncoding == 3){
3264
- return LinearToRGBM(value, 7.0);
3265
- }else if(outputEncoding == 4){
3266
- return LinearToRGBM(value, 16.0);
3267
- }else if(outputEncoding == 5){
3268
- return LinearToRGBD(value, 256.0);
3269
- }else{
3270
- return LinearToGamma(value, 2.2);
3271
- }
3272
- }
3273
-
3274
- vec4 envMapTexelToLinear(vec4 color) {
3275
- return inputTexelToLinear(color);
3276
- }
3277
- `}Le.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Le.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e};Object.assign(or.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new Fe,n=0,r=e.length;n<r;n++){var i=e[n];t.vertices.push(new E(i.x,i.y,i.z||0))}return t}});Object.assign(wn.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}});Object.create(Jt.prototype);Object.create(Jt.prototype);function gf(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Jt.call(this,e),this.type="catmullrom"}gf.prototype=Object.create(Jt.prototype);Object.assign(gf.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}});pc.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Oi.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Object.assign(nt.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),tf.extractUrlBase(e)}});nt.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Object.assign(cc.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}});Object.assign(ff.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}});Object.assign(Pn.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}});Object.assign(jn.prototype,{empty:function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()}});Xa.prototype.setFromMatrix=function(e){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(e)};df.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)};Object.assign(ke,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),ke.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),ke.ceilPowerOfTwo(e)}});Object.assign(zt.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}});Object.assign(We.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new E().setFromMatrixColumn(this,3)},setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBufferAttribute:function(e){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,r,i,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,r,n,i,a)}});bn.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)};wt.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)};Object.assign(Ni.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}});Object.assign(Ot.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}});Object.assign(Ot,{barycoordFromPoint:function(e,t,n,r,i){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Ot.getBarycoord(e,t,n,r,i)},normal:function(e,t,n,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Ot.getNormal(e,t,n,r)}});Object.assign(Lr.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new xi(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new bi(this,e)}});Object.assign(X.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(E.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(tt.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(Fe.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")},applyMatrix:function(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}});Object.assign(se.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},applyMatrix:function(e){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}});Object.defineProperties(se.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Object.assign(ft.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(ft.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),lp},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});Object.defineProperties(Zo.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}});Object.defineProperty(Nl.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}});Il.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Object.defineProperty(Le.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}});St.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),t!==void 0&&(this.filmGauge=t),this.setFocalLength(e)};Object.defineProperties(ct.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(De.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===la},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(la)}}});Object.assign(De.prototype,{setDynamic:function(e){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(e===!0?la:Ps),this},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},setArray:function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}});Object.assign(ge.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addAttribute:function(e,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(t&&t.isBufferAttribute)&&!(t&&t.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(e,new De(arguments[1],arguments[2]))):e==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(e,t)},addDrawCall:function(e,t,n){n!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},removeAttribute:function(e){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(e)},applyMatrix:function(e){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}});Object.defineProperties(ge.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});Object.defineProperties(ys.prototype,{maxInstancedCount:{get:function(){return console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount},set:function(e){console.warn("THREE.InstancedBufferGeometry: .maxInstancedCount has been renamed to .instanceCount."),this.instanceCount=e}}});Object.defineProperties(hf.prototype,{linePrecision:{get:function(){return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold},set:function(e){console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),this.params.Line.threshold=e}}});Object.defineProperties(fr.prototype,{dynamic:{get:function(){return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.usage===la},set:function(e){console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),this.setUsage(e)}}});Object.assign(fr.prototype,{setDynamic:function(e){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(e===!0?la:Ps),this},setArray:function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")}});Object.assign(Gn.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}});Object.defineProperties(hc.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}});Object.defineProperties(Ie.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 pe}},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===wh}},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(Ir.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}});Object.defineProperties(Wt.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}});Object.assign(qh.prototype,{clearTarget:function(e,t,n,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,r)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}});Object.defineProperties(qh.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=e===!0?Ls:kt}}});Object.defineProperties(Xh.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(Kt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}});Object.defineProperties(Fa.prototype,{load:{value:function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this,n=new uc;return n.load(e,function(r){t.setBuffer(r)}),this}},startTime:{set:function(){console.warn("THREE.Audio: .startTime is now .play( delay ).")}}});sf.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};fa.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)};Pr.crossOrigin=void 0;Pr.loadTexture=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var i=new Zl;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a};Pr.loadTextureCube=function(e,t,n,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var i=new Yl;i.setCrossOrigin(this.crossOrigin);var a=i.load(e,n,void 0,r);return t&&(a.mapping=t),a};Pr.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};Pr.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Uf}}));var Ha=function(e,t){t===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),t===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=e,this.domElement=t,this.enabled=!0,this.target=new E,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:rr.ROTATE,MIDDLE:rr.DOLLY,RIGHT:rr.PAN},this.touches={ONE:ir.ROTATE,TWO:ir.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return l.phi},this.getAzimuthalAngle=function(){return l.theta},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(r),n.update(),s=o.NONE},this.update=function(){var R=new E,he=new wt().setFromUnitVectors(e.up,new E(0,1,0)),fe=he.clone().inverse(),ve=new E,ie=new wt;return function(){var de=n.object.position;return R.copy(de).sub(n.target),R.applyQuaternion(he),l.setFromVector3(R),n.autoRotate&&s===o.NONE&&O(C()),n.enableDamping?(l.theta+=u.theta*n.dampingFactor,l.phi+=u.phi*n.dampingFactor):(l.theta+=u.theta,l.phi+=u.phi),l.theta=Math.max(n.minAzimuthAngle,Math.min(n.maxAzimuthAngle,l.theta)),l.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,l.phi)),l.makeSafe(),l.radius*=h,l.radius=Math.max(n.minDistance,Math.min(n.maxDistance,l.radius)),n.enableDamping===!0?n.target.addScaledVector(f,n.dampingFactor):n.target.add(f),R.setFromSpherical(l),R.applyQuaternion(fe),de.copy(n.target).add(R),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,f.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),f.set(0,0,0)),h=1,d||ve.distanceToSquared(n.object.position)>c||8*(1-ie.dot(n.object.quaternion))>c?(n.dispatchEvent(r),ve.copy(n.object.position),ie.copy(n.object.quaternion),d=!1,!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",ye,!1),n.domElement.removeEventListener("mousedown",Qe,!1),n.domElement.removeEventListener("wheel",A,!1),n.domElement.removeEventListener("touchstart",ne,!1),n.domElement.removeEventListener("touchend",Ne,!1),n.domElement.removeEventListener("touchmove",$,!1),document.removeEventListener("mousemove",et,!1),document.removeEventListener("mouseup",Ke,!1),n.domElement.removeEventListener("keydown",L,!1)};var n=this,r={type:"change"},i={type:"start"},a={type:"end"},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},s=o.NONE,c=1e-6,l=new dc,u=new dc,h=1,f=new E,d=!1,m=new X,g=new X,y=new X,p=new X,v=new X,_=new X,x=new X,b=new X,T=new X;function C(){return 2*Math.PI/60/60*n.autoRotateSpeed}function N(){return Math.pow(.95,n.zoomSpeed)}function O(R){u.theta-=R}function J(R){u.phi-=R}var F=function(){var R=new E;return function(fe,ve){R.setFromMatrixColumn(ve,0),R.multiplyScalar(-fe),f.add(R)}}(),B=function(){var R=new E;return function(fe,ve){n.screenSpacePanning===!0?R.setFromMatrixColumn(ve,1):(R.setFromMatrixColumn(ve,0),R.crossVectors(n.object.up,R)),R.multiplyScalar(fe),f.add(R)}}(),V=function(){var R=new E;return function(fe,ve){var ie=n.domElement;if(n.object.isPerspectiveCamera){var Se=n.object.position;R.copy(Se).sub(n.target);var de=R.length();de*=Math.tan(n.object.fov/2*Math.PI/180),F(2*fe*de/ie.clientHeight,n.object.matrix),B(2*ve*de/ie.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(F(fe*(n.object.right-n.object.left)/n.object.zoom/ie.clientWidth,n.object.matrix),B(ve*(n.object.top-n.object.bottom)/n.object.zoom/ie.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Y(R){n.object.isPerspectiveCamera?h/=R:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*R)),n.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function D(R){n.object.isPerspectiveCamera?h*=R:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/R)),n.object.updateProjectionMatrix(),d=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function z(R){m.set(R.clientX,R.clientY)}function k(R){x.set(R.clientX,R.clientY)}function q(R){p.set(R.clientX,R.clientY)}function Z(R){g.set(R.clientX,R.clientY),y.subVectors(g,m).multiplyScalar(n.rotateSpeed);var he=n.domElement;O(2*Math.PI*y.x/he.clientHeight),J(2*Math.PI*y.y/he.clientHeight),m.copy(g),n.update()}function ee(R){b.set(R.clientX,R.clientY),T.subVectors(b,x),T.y>0?Y(N()):T.y<0&&D(N()),x.copy(b),n.update()}function te(R){v.set(R.clientX,R.clientY),_.subVectors(v,p).multiplyScalar(n.panSpeed),V(_.x,_.y),p.copy(v),n.update()}function ae(R){R.deltaY<0?D(N()):R.deltaY>0&&Y(N()),n.update()}function Pe(R){var he=!1;switch(R.keyCode){case n.keys.UP:V(0,n.keyPanSpeed),he=!0;break;case n.keys.BOTTOM:V(0,-n.keyPanSpeed),he=!0;break;case n.keys.LEFT:V(n.keyPanSpeed,0),he=!0;break;case n.keys.RIGHT:V(-n.keyPanSpeed,0),he=!0;break}he&&(R.preventDefault(),n.update())}function _e(R){if(R.touches.length==1)m.set(R.touches[0].pageX,R.touches[0].pageY);else{var he=.5*(R.touches[0].pageX+R.touches[1].pageX),fe=.5*(R.touches[0].pageY+R.touches[1].pageY);m.set(he,fe)}}function re(R){if(R.touches.length==1)p.set(R.touches[0].pageX,R.touches[0].pageY);else{var he=.5*(R.touches[0].pageX+R.touches[1].pageX),fe=.5*(R.touches[0].pageY+R.touches[1].pageY);p.set(he,fe)}}function G(R){var he=R.touches[0].pageX-R.touches[1].pageX,fe=R.touches[0].pageY-R.touches[1].pageY,ve=Math.sqrt(he*he+fe*fe);x.set(0,ve)}function Be(R){n.enableZoom&&G(R),n.enablePan&&re(R)}function xe(R){n.enableZoom&&G(R),n.enableRotate&&_e(R)}function Te(R){if(R.touches.length==1)g.set(R.touches[0].pageX,R.touches[0].pageY);else{var he=.5*(R.touches[0].pageX+R.touches[1].pageX),fe=.5*(R.touches[0].pageY+R.touches[1].pageY);g.set(he,fe)}y.subVectors(g,m).multiplyScalar(n.rotateSpeed);var ve=n.domElement;O(2*Math.PI*y.x/ve.clientHeight),J(2*Math.PI*y.y/ve.clientHeight),m.copy(g)}function ue(R){if(R.touches.length==1)v.set(R.touches[0].pageX,R.touches[0].pageY);else{var he=.5*(R.touches[0].pageX+R.touches[1].pageX),fe=.5*(R.touches[0].pageY+R.touches[1].pageY);v.set(he,fe)}_.subVectors(v,p).multiplyScalar(n.panSpeed),V(_.x,_.y),p.copy(v)}function K(R){var he=R.touches[0].pageX-R.touches[1].pageX,fe=R.touches[0].pageY-R.touches[1].pageY,ve=Math.sqrt(he*he+fe*fe);b.set(0,ve),T.set(0,Math.pow(b.y/x.y,n.zoomSpeed)),Y(T.y),x.copy(b)}function Ce(R){n.enableZoom&&K(R),n.enablePan&&ue(R)}function Ye(R){n.enableZoom&&K(R),n.enableRotate&&Te(R)}function Qe(R){if(n.enabled!==!1){R.preventDefault(),n.domElement.focus?n.domElement.focus():window.focus();var he;switch(R.button){case 0:he=n.mouseButtons.LEFT;break;case 1:he=n.mouseButtons.MIDDLE;break;case 2:he=n.mouseButtons.RIGHT;break;default:he=-1}switch(he){case rr.DOLLY:if(n.enableZoom===!1)return;k(R),s=o.DOLLY;break;case rr.ROTATE:if(R.ctrlKey||R.metaKey||R.shiftKey){if(n.enablePan===!1)return;q(R),s=o.PAN}else{if(n.enableRotate===!1)return;z(R),s=o.ROTATE}break;case rr.PAN:if(R.ctrlKey||R.metaKey||R.shiftKey){if(n.enableRotate===!1)return;z(R),s=o.ROTATE}else{if(n.enablePan===!1)return;q(R),s=o.PAN}break;default:s=o.NONE}s!==o.NONE&&(document.addEventListener("mousemove",et,!1),document.addEventListener("mouseup",Ke,!1),n.dispatchEvent(i))}}function et(R){if(n.enabled!==!1)switch(R.preventDefault(),s){case o.ROTATE:if(n.enableRotate===!1)return;Z(R);break;case o.DOLLY:if(n.enableZoom===!1)return;ee(R);break;case o.PAN:if(n.enablePan===!1)return;te(R);break}}function Ke(R){n.enabled!==!1&&(document.removeEventListener("mousemove",et,!1),document.removeEventListener("mouseup",Ke,!1),n.dispatchEvent(a),s=o.NONE)}function A(R){n.enabled===!1||n.enableZoom===!1||s!==o.NONE&&s!==o.ROTATE||(R.preventDefault(),R.stopPropagation(),n.dispatchEvent(i),ae(R),n.dispatchEvent(a))}function L(R){n.enabled===!1||n.enableKeys===!1||n.enablePan===!1||Pe(R)}function ne(R){if(n.enabled!==!1){switch(R.preventDefault(),R.touches.length){case 1:switch(n.touches.ONE){case ir.ROTATE:if(n.enableRotate===!1)return;_e(R),s=o.TOUCH_ROTATE;break;case ir.PAN:if(n.enablePan===!1)return;re(R),s=o.TOUCH_PAN;break;default:s=o.NONE}break;case 2:switch(n.touches.TWO){case ir.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Be(R),s=o.TOUCH_DOLLY_PAN;break;case ir.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;xe(R),s=o.TOUCH_DOLLY_ROTATE;break;default:s=o.NONE}break;default:s=o.NONE}s!==o.NONE&&n.dispatchEvent(i)}}function $(R){if(n.enabled!==!1)switch(R.preventDefault(),R.stopPropagation(),s){case o.TOUCH_ROTATE:if(n.enableRotate===!1)return;Te(R),n.update();break;case o.TOUCH_PAN:if(n.enablePan===!1)return;ue(R),n.update();break;case o.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Ce(R),n.update();break;case o.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;Ye(R),n.update();break;default:s=o.NONE}}function Ne(R){n.enabled!==!1&&(n.dispatchEvent(a),s=o.NONE)}function ye(R){n.enabled!==!1&&R.preventDefault()}n.domElement.addEventListener("contextmenu",ye,!1),n.domElement.addEventListener("mousedown",Qe,!1),n.domElement.addEventListener("wheel",A,!1),n.domElement.addEventListener("touchstart",ne,!1),n.domElement.addEventListener("touchend",Ne,!1),n.domElement.addEventListener("touchmove",$,!1),n.domElement.addEventListener("keydown",L,!1),n.domElement.tabIndex===-1&&(n.domElement.tabIndex=0),this.update()};Ha.prototype=Object.create(vn.prototype);Ha.prototype.constructor=Ha;var gc=function(e,t){Ha.call(this,e,t),this.mouseButtons.LEFT=rr.PAN,this.mouseButtons.RIGHT=rr.ROTATE,this.touches.ONE=ir.PAN,this.touches.TWO=ir.DOLLY_ROTATE};gc.prototype=Object.create(vn.prototype);gc.prototype.constructor=gc;var Xn=function(e){se.call(this),this.element=e,this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof Element&&t.element.parentNode!==null&&t.element.parentNode.removeChild(t.element)})})};Xn.prototype=Object.create(se.prototype);Xn.prototype.constructor=Xn;var Ms=function(e){Xn.call(this,e)};Ms.prototype=Object.create(Xn.prototype);Ms.prototype.constructor=Ms;var _0=function(){var e=this,t,n,r,i,a=new We,o={camera:{fov:0,style:""},objects:new WeakMap},s=document.createElement("div");s.style.overflow="hidden",this.domElement=s;var c=document.createElement("div");c.style.WebkitTransformStyle="preserve-3d",c.style.transformStyle="preserve-3d",c.style.pointerEvents="none",s.appendChild(c);var l=/Trident/i.test(navigator.userAgent);this.getSize=function(){return{width:t,height:n}},this.setSize=function(p,v){t=p,n=v,r=t/2,i=n/2,s.style.width=p+"px",s.style.height=v+"px",c.style.width=p+"px",c.style.height=v+"px"};function u(p){return Math.abs(p)<1e-10?0:p}function h(p){var v=p.elements;return"matrix3d("+u(v[0])+","+u(-v[1])+","+u(v[2])+","+u(v[3])+","+u(v[4])+","+u(-v[5])+","+u(v[6])+","+u(v[7])+","+u(v[8])+","+u(-v[9])+","+u(v[10])+","+u(v[11])+","+u(v[12])+","+u(-v[13])+","+u(v[14])+","+u(v[15])+")"}function f(p,v){var _=p.elements,x="matrix3d("+u(_[0])+","+u(_[1])+","+u(_[2])+","+u(_[3])+","+u(-_[4])+","+u(-_[5])+","+u(-_[6])+","+u(-_[7])+","+u(_[8])+","+u(_[9])+","+u(_[10])+","+u(_[11])+","+u(_[12])+","+u(_[13])+","+u(_[14])+","+u(_[15])+")";return l?"translate(-50%,-50%)translate("+r+"px,"+i+"px)"+v+x:"translate(-50%,-50%)"+x}function d(p,v,_,x){if(p instanceof Xn){p.onBeforeRender(e,v,_);var b;p instanceof Ms?(a.copy(_.matrixWorldInverse),a.transpose(),a.copyPosition(p.matrixWorld),a.scale(p.scale),a.elements[3]=0,a.elements[7]=0,a.elements[11]=0,a.elements[15]=1,b=f(a,x)):b=f(p.matrixWorld,x);var T=p.element,C=o.objects.get(p);if(C===void 0||C.style!==b){T.style.WebkitTransform=b,T.style.transform=b;var N={style:b};l&&(N.distanceToCameraSquared=m(_,p)),o.objects.set(p,N)}T.style.display=p.visible?"":"none",T.parentNode!==c&&c.appendChild(T),p.onAfterRender(e,v,_)}for(var O=0,J=p.children.length;O<J;O++)d(p.children[O],v,_,x)}var m=function(){var p=new E,v=new E;return function(_,x){return p.setFromMatrixPosition(_.matrixWorld),v.setFromMatrixPosition(x.matrixWorld),p.distanceToSquared(v)}}();function g(p){var v=[];return p.traverse(function(_){_ instanceof Xn&&v.push(_)}),v}function y(p){for(var v=g(p).sort(function(T,C){var N=o.objects.get(T).distanceToCameraSquared,O=o.objects.get(C).distanceToCameraSquared;return N-O}),_=v.length,x=0,b=v.length;x<b;x++)v[x].element.style.zIndex=_-x}this.render=function(p,v){var _=v.projectionMatrix.elements[5]*i;if(o.camera.fov!==_&&(v.isPerspectiveCamera?(s.style.WebkitPerspective=_+"px",s.style.perspective=_+"px"):(s.style.WebkitPerspective="",s.style.perspective=""),o.camera.fov=_),p.autoUpdate===!0&&p.updateMatrixWorld(),v.parent===null&&v.updateMatrixWorld(),v.isOrthographicCamera)var x=-(v.right+v.left)/2,b=(v.top+v.bottom)/2;var T=v.isOrthographicCamera?"scale("+_+")translate("+u(x)+"px,"+u(b)+"px)"+h(v.matrixWorldInverse):"translateZ("+_+"px)"+h(v.matrixWorldInverse),C=T+"translate("+r+"px,"+i+"px)";o.camera.style!==C&&!l&&(c.style.WebkitTransform=C,c.style.transform=C,o.camera.style=C),d(p,p,v,T),l&&y(p)}};function _h(e,t,n){var r=t.getBoundingClientRect(),i=r.top,a=r.left,o=r.width,s=r.height;return new we.Vector2((e.x-a)/o*2-1,-(e.y-i)/s*2+1)}var yf=function(e){Es(t,e);function t(n,r,i,a,o){var s=e.call(this)||this;s.type="RoundedBoxGeometry",o=isNaN(o)?1:Math.max(1,Math.floor(o)),n=isNaN(n)?1:n,r=isNaN(r)?1:r,i=isNaN(i)?1:i,a=isNaN(a)?.15:a,a=Math.min(a,Math.min(n,Math.min(r,Math.min(i)))/2);var c=n/2-a,l=r/2-a,u=i/2-a;s.parameters={width:n,height:r,depth:i,radius:a,radiusSegments:o};var h=o+1,f=h*o+1<<3,d=new we.BufferAttribute(new Float32Array(f*3),3),m=new we.BufferAttribute(new Float32Array(f*3),3),g=[],y=[];new we.Vector3;var p=new we.Vector3,v=[],_=[],x=[],b=h*o,T=h*o+1;C(),O(),N(),J(),B(),F();function C(){for(var D=[new we.Vector3(1,1,1),new we.Vector3(1,1,-1),new we.Vector3(-1,1,-1),new we.Vector3(-1,1,1),new we.Vector3(1,-1,1),new we.Vector3(1,-1,-1),new we.Vector3(-1,-1,-1),new we.Vector3(-1,-1,1)],z=0;z<8;z++)g.push([]),y.push([]);for(var k=Math.PI/2,q=new we.Vector3(c,l,u),Z=0;Z<=o;Z++){var ee=Z/o,te=ee*k,ae=Math.cos(te),Pe=Math.sin(te);if(Z==o){p.set(0,1,0);var _e=p.clone().multiplyScalar(a).add(q);g[0].push(_e),v.push(_e);var re=p.clone();y[0].push(re),_.push(re);continue}for(var G=0;G<=o;G++){var Be=G/o,xe=Be*k;p.x=ae*Math.cos(xe),p.y=Pe,p.z=ae*Math.sin(xe);var _e=p.clone().multiplyScalar(a).add(q);g[0].push(_e),v.push(_e);var re=p.clone().normalize();y[0].push(re),_.push(re)}}for(var Te=1;Te<8;Te++)for(var z=0;z<g[0].length;z++){var _e=g[0][z].clone().multiply(D[Te]);g[Te].push(_e),v.push(_e);var re=y[0][z].clone().multiply(D[Te]);y[Te].push(re),_.push(re)}}function N(){for(var D=[!0,!1,!0,!1,!1,!0,!1,!0],z=h*(o-1),k=0;k<8;k++){for(var q=T*k,Z=0;Z<o-1;Z++)for(var ee=Z*h,te=(Z+1)*h,ae=0;ae<o;ae++){var Pe=ae+1,_e=q+ee+ae,re=q+ee+Pe,G=q+te+ae,Be=q+te+Pe;D[k]?(x.push(_e),x.push(G),x.push(re),x.push(re),x.push(G),x.push(Be)):(x.push(_e),x.push(re),x.push(G),x.push(re),x.push(Be),x.push(G))}for(var ae=0;ae<o;ae++){var _e=q+z+ae,re=q+z+ae+1,G=q+b;D[k]?(x.push(_e),x.push(G),x.push(re)):(x.push(_e),x.push(re),x.push(G))}}}function O(){var D=b,z=b+T,k=b+T*2,q=b+T*3;x.push(D),x.push(z),x.push(k),x.push(D),x.push(k),x.push(q),D=b+T*4,z=b+T*5,k=b+T*6,q=b+T*7,x.push(D),x.push(k),x.push(z),x.push(D),x.push(q),x.push(k),D=0,z=T,k=T*4,q=T*5,x.push(D),x.push(k),x.push(z),x.push(z),x.push(k),x.push(q),D=T*2,z=T*3,k=T*6,q=T*7,x.push(D),x.push(k),x.push(z),x.push(z),x.push(k),x.push(q),D=o,z=o+T*3,k=o+T*4,q=o+T*7,x.push(D),x.push(z),x.push(k),x.push(z),x.push(q),x.push(k),D=o+T,z=o+T*2,k=o+T*5,q=o+T*6,x.push(D),x.push(k),x.push(z),x.push(z),x.push(k),x.push(q)}function J(){for(var D=0;D<4;D++)for(var z=D*T,k=4*T+z,q=(D&1)===1,Z=0;Z<o;Z++){var ee=Z+1,te=z+Z,ae=z+ee,Pe=k+Z,_e=k+ee;q?(x.push(te),x.push(Pe),x.push(ae),x.push(ae),x.push(Pe),x.push(_e)):(x.push(te),x.push(ae),x.push(Pe),x.push(ae),x.push(_e),x.push(Pe))}}function F(){for(var D=[0,2,4,6],z=[1,3,5,7],k=0;k<4;k++)for(var q=T*D[k],Z=T*z[k],ee=1>=k,te=0;te<o;te++){var ae=te*h,Pe=(te+1)*h,_e=q+ae,re=q+Pe,G=Z+ae,Be=Z+Pe;ee?(x.push(_e),x.push(G),x.push(re),x.push(re),x.push(G),x.push(Be)):(x.push(_e),x.push(re),x.push(G),x.push(re),x.push(Be),x.push(G))}}function B(){for(var D=o-1,z=[0,1,4,5],k=[3,2,7,6],q=[0,1,1,0],Z=0;Z<4;Z++)for(var ee=z[Z]*T,te=k[Z]*T,ae=0;ae<=D;ae++){var Pe=ee+o+ae*h,_e=ee+(ae!=D?o+(ae+1)*h:T-1),re=te+o+ae*h,G=te+(ae!=D?o+(ae+1)*h:T-1);q[Z]?(x.push(Pe),x.push(re),x.push(_e),x.push(_e),x.push(re),x.push(G)):(x.push(Pe),x.push(_e),x.push(re),x.push(_e),x.push(G),x.push(re))}}for(var V=0,Y=0;Y<v.length;Y++)d.setXYZ(V,v[Y].x,v[Y].y,v[Y].z),m.setXYZ(V,_[Y].x,_[Y].y,_[Y].z),V++;return s.setIndex(new we.BufferAttribute(new Uint16Array(x),1)),s.setAttribute("position",d),s.setAttribute("normal",m),s}return t}(we.BufferGeometry);function Ji(e,t){return typeof e!="number"||typeof t!="number"?!1:Math.abs(e-t)<.001}function Qi(e,t,n,r){r===void 0&&(r=function(a){return a});var i=r(n);return e*(1-i)+t*i}var Lt=Number((Math.PI/2).toFixed(5));function b0(e,t,n){var r=new we.Shape;return r.moveTo(n,0),r.lineTo(e-n,0),r.absarc(e-n,n,n,-Lt,0,!1),r.lineTo(e,t-n),r.absarc(e-n,t-n,n,0,Lt,!1),r.lineTo(n,t),r.absarc(n,t-n,n,Lt,Math.PI,!1),r.lineTo(0,n),r.absarc(n,n,n,Math.PI,Math.PI*1.5,!1),r}var $i=function(e){var t=document.createElement("div");t.innerText=e;var n=new Xn(t);return n.name=e,n.scale.set(.3,.3,.3),t.style.pointerEvents="none",t.style.backfaceVisibility="hidden",n},Oo=function(e){var t=new we.PlaneGeometry(5,5),n=new we.MeshBasicMaterial({transparent:!0,opacity:0}),r=new we.Mesh(t,n),i=document.createElement("div");i.innerText=e;var a=new Xn(i);return a.name=e,a.scale.set(.3,.3,.3),i.style.color="#ffffff",i.style.opacity="0.5",i.style.pointerEvents="none",i.style.backfaceVisibility="hidden",r.rotateX(-Lt),r.add(a),r},w0=function(e){Es(t,e);function t(n,r){var i=e.call(this,n)||this;i.camera=new yc.Camera(90),i.scene=new we.Scene,i.renderer=new we.WebGLRenderer({antialias:!0,alpha:!0}),i.css3drenderer=new _0,i.ambientLight=new we.AmbientLight(16777215,.7),i.wrapper=document.createElement("div"),i.arrows=document.createElement("div"),i.arrowLeft=document.createElement("div"),i.arrowRight=document.createElement("div"),i.arrowFront=document.createElement("div"),i.arrowBack=document.createElement("div"),i.arrowTop=document.createElement("div"),i.arrowBottom=document.createElement("div"),i.spherical=null,i.dragging=!1,i.style=document.createElement("style"),i.directionalLight=new we.DirectionalLight(16777215,.2),i.box=new we.Mesh(new yf(8,8,8,.5,20),new we.MeshPhongMaterial({color:16777215})),i.faces=new we.Group,i.orient=function(s){var c=s.longitude,l=s.latitude;i.dragging=!1,i.spherical=null,i.controls.enableDamping=!1,i.five.setState(Object.assign({latitude:l},c!==void 0?{longitude:c+i.config.fixedLongitude}:{})),i.five.ready().then(function(){i.controls.enableDamping=!0,i.setState({arrowsVisible:!0})})},i.onRenderFrame=function(){var s,c,l,u,h;if(i.renderer.render(i.scene,i.camera),i.css3drenderer.render(i.scene,i.camera),i.directionalLight.position.copy(i.camera.position),(s=i.controls)===null||s===void 0||s.update(),i.dragging){i.camera.computePose(),i.updateByCamera();var f=i.camera.pose,d=f.longitude,m=f.latitude;i.five.setState({longitude:d,latitude:m},!0),i.updateArrows({longitude:d,latitude:m})}else if(i.spherical&&(!Ji(i.spherical.pi,(c=i.controls)===null||c===void 0?void 0:c.getPolarAngle())||!Ji(i.spherical.theta,(l=i.controls)===null||l===void 0?void 0:l.getAzimuthalAngle()))){i.spherical={pi:(u=i.controls)===null||u===void 0?void 0:u.getPolarAngle(),theta:(h=i.controls)===null||h===void 0?void 0:h.getAzimuthalAngle()},i.camera.computePose(),i.updateByCamera();var g=i.camera.pose,d=g.longitude,m=g.latitude;i.five.setState({longitude:d,latitude:m},!0),i.updateArrows({longitude:d,latitude:m})}else i.spherical=null},i.onTapGesture=function(s){var c=s.pointers[0].clientX,l=s.pointers[0].clientY,u=_h({x:c,y:l},i.wrapper),h=new we.Raycaster;h.setFromCamera(u,i.camera);var f=h.intersectObjects(i.faces.children,!1)[0];if(f){var d=f.object.userData,m=d.longitude,g=d.latitude;i.orient({longitude:m,latitude:g})}},i.onFiveWantsGesture=function(){if(i.spherical)return!1},i.onFiveModeChange=function(s){i.controls&&(i.controls.maxPolarAngle=s==="Topview"?0:Lt)},i.onCameraUpdate=function(s){var c=s.state;if(!i.dragging&&!i.spherical){var l=c.longitude,u=c.latitude;i.camera.pose.longitude===l&&i.camera.pose.latitude===u||(i.camera.setFromPose({longitude:l,latitude:u,distance:20,offset:new we.Vector3(0,0,0)}),i.updateByCamera(),i.updateArrows({longitude:l,latitude:u}))}},i.onPanStart=function(s){i.dragging=!0,i.spherical={}},i.onMouseMove=function(s){if(!i.dragging){var c=_h({x:s.clientX,y:s.clientY},i.wrapper),l=new we.Raycaster;l.setFromCamera(c,i.camera);var u=l.intersectObjects(i.faces.children,!1)[0];i.faces.children.forEach(function(h){h.material.opacity=0,h.children[0].element.style.color=""}),u&&(u.object.material.opacity=.3,u.object.children[0].element.style.color="#336dff")}},i.onPanEnd=function(s){i.dragging=!1,i.spherical={pi:i.controls.getPolarAngle(),theta:i.controls.getAzimuthalAngle()}},i.dispose=function(){i.disable()},i.five=n;var a={enabled:!1,visible:!0,arrowsVisible:!1};i.state=Object.assign(a,r==null?void 0:r.initialState);var o=Ut({fixedLongitude:0,orthoView:!0},r==null?void 0:r.config);return i._config=o,i.state.enabled&&i._enable({userAction:!1}),i.mc=new Us.Manager(i.wrapper),i.mc.add(new Us.Tap({interval:410})),i.mc.add(new Us.Pan({threshold:10,pointers:0})),i.camera.setFromPose({distance:20,offset:new we.Vector3(0,0,0),longitude:n.camera.pose.latitude,latitude:n.camera.pose.latitude}),i.cylinder=new we.Mesh(new we.CylinderGeometry(13.2,14,.01,50,1,!0),new we.ShaderMaterial({uniforms:{radiusTop:{value:13.2},radiusBottom:{value:14},opacity:{value:1}},vertexShader:`
354
+ * Licensed under the MIT license */var tt=function(c,o,n,a){var t=["","webkit","Moz","MS","ms","o"],l=o.createElement?o.createElement("div"):a,h="function",u=Math.round,m=Math.abs,p=Date.now;function y(e,r,i){return setTimeout(j(e,i),r)}function T(e,r,i){return Array.isArray(e)?(M(e,i[r],i),!0):!1}function M(e,r,i){var s;if(e)if(e.forEach)e.forEach(r,i);else if(e.length!==a)for(s=0;s<e.length;)r.call(i,e[s],s,e),s++;else for(s in e)e.hasOwnProperty(s)&&r.call(i,e[s],s,e)}function N(e,r,i){var s="DEPRECATED METHOD: "+r+`
355
+ `+i+` AT
356
+ `;return function(){var v=new Error("get-stack-trace"),d=v&&v.stack?v.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",b=c.console&&(c.console.warn||c.console.log);return b&&b.call(c.console,s,d),e.apply(this,arguments)}}var C;typeof Object.assign!="function"?C=function(r){if(r===a||r===null)throw new TypeError("Cannot convert undefined or null to object");for(var i=Object(r),s=1;s<arguments.length;s++){var v=arguments[s];if(v!==a&&v!==null)for(var d in v)v.hasOwnProperty(d)&&(i[d]=v[d])}return i}:C=Object.assign;var F=N(function(r,i,s){for(var v=Object.keys(i),d=0;d<v.length;)(!s||s&&r[v[d]]===a)&&(r[v[d]]=i[v[d]]),d++;return r},"extend","Use `assign`."),G=N(function(r,i){return F(r,i,!0)},"merge","Use `assign`.");function O(e,r,i){var s=r.prototype,v;v=e.prototype=Object.create(s),v.constructor=e,v._super=s,i&&C(v,i)}function j(e,r){return function(){return e.apply(r,arguments)}}function q(e,r){return typeof e==h?e.apply(r&&r[0]||a,r):e}function f(e,r){return e===a?r:e}function V(e,r,i){M(fe(r),function(s){e.addEventListener(s,i,!1)})}function P(e,r,i){M(fe(r),function(s){e.removeEventListener(s,i,!1)})}function Ce(e,r){for(;e;){if(e==r)return!0;e=e.parentNode}return!1}function ie(e,r){return e.indexOf(r)>-1}function fe(e){return e.trim().split(/\s+/g)}function se(e,r,i){if(e.indexOf&&!i)return e.indexOf(r);for(var s=0;s<e.length;){if(i&&e[s][i]==r||!i&&e[s]===r)return s;s++}return-1}function ve(e){return Array.prototype.slice.call(e,0)}function Ae(e,r,i){for(var s=[],v=[],d=0;d<e.length;){var b=e[d][r];se(v,b)<0&&s.push(e[d]),v[d]=b,d++}return s=s.sort(function(K,L){return K[r]>L[r]}),s}function le(e,r){for(var i,s,v=r[0].toUpperCase()+r.slice(1),d=0;d<t.length;){if(i=t[d],s=i?i+v:r,s in e)return s;d++}return a}var ee=1;function A(){return ee++}function E(e){var r=e.ownerDocument||e;return r.defaultView||r.parentWindow||c}var w=/mobile|tablet|ip(ad|hone|od)|android/i,x="ontouchstart"in c,D=le(c,"PointerEvent")!==a,Z=x&&w.test(navigator.userAgent),B="touch",I="pen",Y="mouse",k="kinect",S=25,_=1,z=2,U=4,R=8,xe=1,me=2,ge=4,ye=8,Te=16,te=me|ge,ue=ye|Te,at=te|ue,ot=["x","y"],Ie=["clientX","clientY"];function J(e,r){var i=this;this.manager=e,this.callback=r,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(s){q(e.options.enable,[e])&&i.handler(s)},this.init()}J.prototype={handler:function(){},init:function(){this.evEl&&V(this.element,this.evEl,this.domHandler),this.evTarget&&V(this.target,this.evTarget,this.domHandler),this.evWin&&V(E(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&P(this.element,this.evEl,this.domHandler),this.evTarget&&P(this.target,this.evTarget,this.domHandler),this.evWin&&P(E(this.element),this.evWin,this.domHandler)}};function It(e){var r,i=e.options.inputClass;return i?r=i:D?r=je:Z?r=Se:x?r=ze:r=Ne,new r(e,Ot)}function Ot(e,r,i){var s=i.pointers.length,v=i.changedPointers.length,d=r&_&&s-v===0,b=r&(U|R)&&s-v===0;i.isFirst=!!d,i.isFinal=!!b,d&&(e.session={}),i.eventType=r,Nt(e,i),e.emit("hammer.input",i),e.recognize(i),e.session.prevInput=i}function Nt(e,r){var i=e.session,s=r.pointers,v=s.length;i.firstInput||(i.firstInput=st(r)),v>1&&!i.firstMultiple?i.firstMultiple=st(r):v===1&&(i.firstMultiple=!1);var d=i.firstInput,b=i.firstMultiple,H=b?b.center:d.center,K=r.center=lt(s);r.timeStamp=p(),r.deltaTime=r.timeStamp-d.timeStamp,r.angle=Xe(H,K),r.distance=Oe(H,K),St(i,r),r.offsetDirection=ut(r.deltaX,r.deltaY);var L=ct(r.deltaTime,r.deltaX,r.deltaY);r.overallVelocityX=L.x,r.overallVelocityY=L.y,r.overallVelocity=m(L.x)>m(L.y)?L.x:L.y,r.scale=b?Dt(b.pointers,s):1,r.rotation=b?Ft(b.pointers,s):0,r.maxPointers=i.prevInput?r.pointers.length>i.prevInput.maxPointers?r.pointers.length:i.prevInput.maxPointers:r.pointers.length,kt(i,r);var ne=e.element;Ce(r.srcEvent.target,ne)&&(ne=r.srcEvent.target),r.target=ne}function St(e,r){var i=r.center,s=e.offsetDelta||{},v=e.prevDelta||{},d=e.prevInput||{};(r.eventType===_||d.eventType===U)&&(v=e.prevDelta={x:d.deltaX||0,y:d.deltaY||0},s=e.offsetDelta={x:i.x,y:i.y}),r.deltaX=v.x+(i.x-s.x),r.deltaY=v.y+(i.y-s.y)}function kt(e,r){var i=e.lastInterval||r,s=r.timeStamp-i.timeStamp,v,d,b,H;if(r.eventType!=R&&(s>S||i.velocity===a)){var K=r.deltaX-i.deltaX,L=r.deltaY-i.deltaY,ne=ct(s,K,L);d=ne.x,b=ne.y,v=m(ne.x)>m(ne.y)?ne.x:ne.y,H=ut(K,L),e.lastInterval=r}else v=i.velocity,d=i.velocityX,b=i.velocityY,H=i.direction;r.velocity=v,r.velocityX=d,r.velocityY=b,r.direction=H}function st(e){for(var r=[],i=0;i<e.pointers.length;)r[i]={clientX:u(e.pointers[i].clientX),clientY:u(e.pointers[i].clientY)},i++;return{timeStamp:p(),pointers:r,center:lt(r),deltaX:e.deltaX,deltaY:e.deltaY}}function lt(e){var r=e.length;if(r===1)return{x:u(e[0].clientX),y:u(e[0].clientY)};for(var i=0,s=0,v=0;v<r;)i+=e[v].clientX,s+=e[v].clientY,v++;return{x:u(i/r),y:u(s/r)}}function ct(e,r,i){return{x:r/e||0,y:i/e||0}}function ut(e,r){return e===r?xe:m(e)>=m(r)?e<0?me:ge:r<0?ye:Te}function Oe(e,r,i){i||(i=ot);var s=r[i[0]]-e[i[0]],v=r[i[1]]-e[i[1]];return Math.sqrt(s*s+v*v)}function Xe(e,r,i){i||(i=ot);var s=r[i[0]]-e[i[0]],v=r[i[1]]-e[i[1]];return Math.atan2(v,s)*180/Math.PI}function Ft(e,r){return Xe(r[1],r[0],Ie)+Xe(e[1],e[0],Ie)}function Dt(e,r){return Oe(r[0],r[1],Ie)/Oe(e[0],e[1],Ie)}var Ut={mousedown:_,mousemove:z,mouseup:U},Bt="mousedown",Lt="mousemove mouseup";function Ne(){this.evEl=Bt,this.evWin=Lt,this.pressed=!1,J.apply(this,arguments)}O(Ne,J,{handler:function(r){var i=Ut[r.type];i&_&&(r.button===0||r.button===2)&&(this.pressed=!0),i&z&&r.which!==1&&(i=U),this.pressed&&(i&U&&(this.pressed=!1),this.callback(this.manager,i,{pointers:[r],changedPointers:[r],pointerType:Y,srcEvent:r}))}});var ht={pointerdown:_,pointermove:z,pointerup:U,pointercancel:R,pointerout:R},Rt={2:B,3:I,4:Y,5:k},ft="pointerdown",vt="pointermove pointerup pointercancel";c.MSPointerEvent&&!c.PointerEvent&&(ft="MSPointerDown",vt="MSPointerMove MSPointerUp MSPointerCancel");function je(){this.evEl=ft,this.evWin=vt,J.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}O(je,J,{handler:function(r){var i=this.store,s=!1,v=!1,d=r.type.toLowerCase().replace("ms",""),b=ht[d],H=Rt[r.pointerType]||r.pointerType,K=H==B,L=se(i,r.pointerId,"pointerId");b&_&&(r.button===0||r.button===2||K)?L<0&&(i.push(r),L=i.length-1):b&(U|R)?s=!0:!K&&r.buttons===0&&(s=!0,v=!0,b=ht.pointerup),!(L<0)&&(v||(i[L]=r),this.callback(this.manager,b,{pointers:i,changedPointers:[r],pointerType:H,srcEvent:i[L]}),s&&i.splice(L,1))}});var Vt={touchstart:_,touchmove:z,touchend:U,touchcancel:R},Gt="touchstart",Yt="touchstart touchmove touchend touchcancel";function pt(){this.evTarget=Gt,this.evWin=Yt,this.started=!1,J.apply(this,arguments)}O(pt,J,{handler:function(r){var i=Vt[r.type];if(i===_&&(this.started=!0),!!this.started){var s=Ht.call(this,r,i);i&(U|R)&&s[0].length-s[1].length===0&&(this.started=!1),this.callback(this.manager,i,{pointers:s[0],changedPointers:s[1],pointerType:B,srcEvent:r})}}});function Ht(e,r){var i=ve(e.touches),s=ve(e.changedTouches);return r&(U|R)&&(i=Ae(i.concat(s),"identifier")),[i,s]}var Xt={touchstart:_,touchmove:z,touchend:U,touchcancel:R},jt="touchstart touchmove touchend touchcancel";function Se(){this.evTarget=jt,this.targetIds={},J.apply(this,arguments)}O(Se,J,{handler:function(r){var i=Xt[r.type],s=zt.call(this,r,i);s&&this.callback(this.manager,i,{pointers:s[0],changedPointers:s[1],pointerType:B,srcEvent:r})}});function zt(e,r){var i=ve(e.touches),s=this.targetIds;if(r&(_|z)&&i.length===1)return s[i[0].identifier]=!0,[i,i];var v,d,b=ve(e.changedTouches),H=[],K=this.target;if(d=i.filter(function(L){return Ce(L.target,K)}),r===_)for(v=0;v<d.length;)s[d[v].identifier]=!0,v++;for(v=0;v<b.length;)s[b[v].identifier]&&H.push(b[v]),r&(U|R)&&delete s[b[v].identifier],v++;if(H.length)return[Ae(d.concat(H),"identifier"),H]}var Wt=2500,dt=25;function ze(){J.apply(this,arguments);var e=j(this.handler,this);this.touch=new Se(this.manager,e),this.mouse=new Ne(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}O(ze,J,{handler:function(r,i,s){var v=s.pointerType==B,d=s.pointerType==Y;if(!(d&&s.sourceCapabilities&&s.sourceCapabilities.firesTouchEvents)){if(v)qt.call(this,i,s);else if(d&&Zt.call(this,s))return;this.callback(r,i,s)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});function qt(e,r){e&_?(this.primaryTouch=r.changedPointers[0].identifier,mt.call(this,r)):e&(U|R)&&mt.call(this,r)}function mt(e){var r=e.changedPointers[0];if(r.identifier===this.primaryTouch){var i={x:r.clientX,y:r.clientY};this.lastTouches.push(i);var s=this.lastTouches,v=function(){var d=s.indexOf(i);d>-1&&s.splice(d,1)};setTimeout(v,Wt)}}function Zt(e){for(var r=e.srcEvent.clientX,i=e.srcEvent.clientY,s=0;s<this.lastTouches.length;s++){var v=this.lastTouches[s],d=Math.abs(r-v.x),b=Math.abs(i-v.y);if(d<=dt&&b<=dt)return!0}return!1}var gt=l?le(l.style,"touchAction"):a,yt=gt!==a,Tt="compute",wt="auto",We="manipulation",he="none",we="pan-x",be="pan-y",ke=Jt();function qe(e,r){this.manager=e,this.set(r)}qe.prototype={set:function(e){e==Tt&&(e=this.compute()),yt&&this.manager.element.style&&ke[e]&&(this.manager.element.style[gt]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return M(this.manager.recognizers,function(r){q(r.options.enable,[r])&&(e=e.concat(r.getTouchAction()))}),Kt(e.join(" "))},preventDefaults:function(e){var r=e.srcEvent,i=e.offsetDirection;if(this.manager.session.prevented){r.preventDefault();return}var s=this.actions,v=ie(s,he)&&!ke[he],d=ie(s,be)&&!ke[be],b=ie(s,we)&&!ke[we];if(v){var H=e.pointers.length===1,K=e.distance<2,L=e.deltaTime<250;if(H&&K&&L)return}if(!(b&&d)&&(v||d&&i&te||b&&i&ue))return this.preventSrc(r)},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};function Kt(e){if(ie(e,he))return he;var r=ie(e,we),i=ie(e,be);return r&&i?he:r||i?r?we:be:ie(e,We)?We:wt}function Jt(){if(!yt)return!1;var e={},r=c.CSS&&c.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(i){e[i]=r?c.CSS.supports("touch-action",i):!0}),e}var Fe=1,Q=2,pe=4,ce=8,ae=ce,Ee=16,re=32;function oe(e){this.options=C({},this.defaults,e||{}),this.id=A(),this.manager=null,this.options.enable=f(this.options.enable,!0),this.state=Fe,this.simultaneous={},this.requireFail=[]}oe.prototype={defaults:{},set:function(e){return C(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(T(e,"recognizeWith",this))return this;var r=this.simultaneous;return e=De(e,this),r[e.id]||(r[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return T(e,"dropRecognizeWith",this)?this:(e=De(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(T(e,"requireFailure",this))return this;var r=this.requireFail;return e=De(e,this),se(r,e)===-1&&(r.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(T(e,"dropRequireFailure",this))return this;e=De(e,this);var r=se(this.requireFail,e);return r>-1&&this.requireFail.splice(r,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var r=this,i=this.state;function s(v){r.manager.emit(v,e)}i<ce&&s(r.options.event+bt(i)),s(r.options.event),e.additionalEvent&&s(e.additionalEvent),i>=ce&&s(r.options.event+bt(i))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=re},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(re|Fe)))return!1;e++}return!0},recognize:function(e){var r=C({},e);if(!q(this.options.enable,[this,r])){this.reset(),this.state=re;return}this.state&(ae|Ee|re)&&(this.state=Fe),this.state=this.process(r),this.state&(Q|pe|ce|Ee)&&this.tryEmit(r)},process:function(e){},getTouchAction:function(){},reset:function(){}};function bt(e){return e&Ee?"cancel":e&ce?"end":e&pe?"move":e&Q?"start":""}function Et(e){return e==Te?"down":e==ye?"up":e==me?"left":e==ge?"right":""}function De(e,r){var i=r.manager;return i?i.get(e):e}function $(){oe.apply(this,arguments)}O($,oe,{defaults:{pointers:1},attrTest:function(e){var r=this.options.pointers;return r===0||e.pointers.length===r},process:function(e){var r=this.state,i=e.eventType,s=r&(Q|pe),v=this.attrTest(e);return s&&(i&R||!v)?r|Ee:s||v?i&U?r|ce:r&Q?r|pe:Q:re}});function Ue(){$.apply(this,arguments),this.pX=null,this.pY=null}O(Ue,$,{defaults:{event:"pan",threshold:10,pointers:1,direction:at},getTouchAction:function(){var e=this.options.direction,r=[];return e&te&&r.push(be),e&ue&&r.push(we),r},directionTest:function(e){var r=this.options,i=!0,s=e.distance,v=e.direction,d=e.deltaX,b=e.deltaY;return v&r.direction||(r.direction&te?(v=d===0?xe:d<0?me:ge,i=d!=this.pX,s=Math.abs(e.deltaX)):(v=b===0?xe:b<0?ye:Te,i=b!=this.pY,s=Math.abs(e.deltaY))),e.direction=v,i&&s>r.threshold&&v&r.direction},attrTest:function(e){return $.prototype.attrTest.call(this,e)&&(this.state&Q||!(this.state&Q)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var r=Et(e.direction);r&&(e.additionalEvent=this.options.event+r),this._super.emit.call(this,e)}});function Ze(){$.apply(this,arguments)}O(Ze,$,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[he]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&Q)},emit:function(e){if(e.scale!==1){var r=e.scale<1?"in":"out";e.additionalEvent=this.options.event+r}this._super.emit.call(this,e)}});function Ke(){oe.apply(this,arguments),this._timer=null,this._input=null}O(Ke,oe,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[wt]},process:function(e){var r=this.options,i=e.pointers.length===r.pointers,s=e.distance<r.threshold,v=e.deltaTime>r.time;if(this._input=e,!s||!i||e.eventType&(U|R)&&!v)this.reset();else if(e.eventType&_)this.reset(),this._timer=y(function(){this.state=ae,this.tryEmit()},r.time,this);else if(e.eventType&U)return ae;return re},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===ae&&(e&&e.eventType&U?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=p(),this.manager.emit(this.options.event,this._input)))}});function Je(){$.apply(this,arguments)}O(Je,$,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[he]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&Q)}});function Qe(){$.apply(this,arguments)}O(Qe,$,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:te|ue,pointers:1},getTouchAction:function(){return Ue.prototype.getTouchAction.call(this)},attrTest:function(e){var r=this.options.direction,i;return r&(te|ue)?i=e.overallVelocity:r&te?i=e.overallVelocityX:r&ue&&(i=e.overallVelocityY),this._super.attrTest.call(this,e)&&r&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&m(i)>this.options.velocity&&e.eventType&U},emit:function(e){var r=Et(e.offsetDirection);r&&this.manager.emit(this.options.event+r,e),this.manager.emit(this.options.event,e)}});function Be(){oe.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}O(Be,oe,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[We]},process:function(e){var r=this.options,i=e.pointers.length===r.pointers,s=e.distance<r.threshold,v=e.deltaTime<r.time;if(this.reset(),e.eventType&_&&this.count===0)return this.failTimeout();if(s&&v&&i){if(e.eventType!=U)return this.failTimeout();var d=this.pTime?e.timeStamp-this.pTime<r.interval:!0,b=!this.pCenter||Oe(this.pCenter,e.center)<r.posThreshold;this.pTime=e.timeStamp,this.pCenter=e.center,!b||!d?this.count=1:this.count+=1,this._input=e;var H=this.count%r.taps;if(H===0)return this.hasRequireFailures()?(this._timer=y(function(){this.state=ae,this.tryEmit()},r.interval,this),Q):ae}return re},failTimeout:function(){return this._timer=y(function(){this.state=re},this.options.interval,this),re},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ae&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}});function de(e,r){return r=r||{},r.recognizers=f(r.recognizers,de.defaults.preset),new $e(e,r)}de.VERSION="2.0.7",de.defaults={domEvents:!1,touchAction:Tt,enable:!0,inputTarget:null,inputClass:null,preset:[[Je,{enable:!1}],[Ze,{enable:!1},["rotate"]],[Qe,{direction:te}],[Ue,{direction:te},["swipe"]],[Be],[Be,{event:"doubletap",taps:2},["tap"]],[Ke]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var Qt=1,Pt=2;function $e(e,r){this.options=C({},de.defaults,r||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=It(this),this.touchAction=new qe(this,this.options.touchAction),_t(this,!0),M(this.options.recognizers,function(i){var s=this.add(new i[0](i[1]));i[2]&&s.recognizeWith(i[2]),i[3]&&s.requireFailure(i[3])},this)}$e.prototype={set:function(e){return C(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?Pt:Qt},recognize:function(e){var r=this.session;if(!r.stopped){this.touchAction.preventDefaults(e);var i,s=this.recognizers,v=r.curRecognizer;(!v||v&&v.state&ae)&&(v=r.curRecognizer=null);for(var d=0;d<s.length;)i=s[d],r.stopped!==Pt&&(!v||i==v||i.canRecognizeWith(v))?i.recognize(e):i.reset(),!v&&i.state&(Q|pe|ce)&&(v=r.curRecognizer=i),d++}},get:function(e){if(e instanceof oe)return e;for(var r=this.recognizers,i=0;i<r.length;i++)if(r[i].options.event==e)return r[i];return null},add:function(e){if(T(e,"add",this))return this;var r=this.get(e.options.event);return r&&this.remove(r),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(T(e,"remove",this))return this;if(e=this.get(e),e){var r=this.recognizers,i=se(r,e);i!==-1&&(r.splice(i,1),this.touchAction.update())}return this},on:function(e,r){if(e!==a&&r!==a){var i=this.handlers;return M(fe(e),function(s){i[s]=i[s]||[],i[s].push(r)}),this}},off:function(e,r){if(e!==a){var i=this.handlers;return M(fe(e),function(s){r?i[s]&&i[s].splice(se(i[s],r),1):delete i[s]}),this}},emit:function(e,r){this.options.domEvents&&$t(e,r);var i=this.handlers[e]&&this.handlers[e].slice();if(!(!i||!i.length)){r.type=e,r.preventDefault=function(){r.srcEvent.preventDefault()};for(var s=0;s<i.length;)i[s](r),s++}},destroy:function(){this.element&&_t(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}};function _t(e,r){var i=e.element;if(i.style){var s;M(e.options.cssProps,function(v,d){s=le(i.style,d),r?(e.oldCssProps[s]=i.style[s],i.style[s]=v):i.style[s]=e.oldCssProps[s]||""}),r||(e.oldCssProps={})}}function $t(e,r){var i=o.createEvent("Event");i.initEvent(e,!0,!0),i.gesture=r,r.target.dispatchEvent(i)}return C(de,{INPUT_START:_,INPUT_MOVE:z,INPUT_END:U,INPUT_CANCEL:R,STATE_POSSIBLE:Fe,STATE_BEGAN:Q,STATE_CHANGED:pe,STATE_ENDED:ce,STATE_RECOGNIZED:ae,STATE_CANCELLED:Ee,STATE_FAILED:re,DIRECTION_NONE:xe,DIRECTION_LEFT:me,DIRECTION_RIGHT:ge,DIRECTION_UP:ye,DIRECTION_DOWN:Te,DIRECTION_HORIZONTAL:te,DIRECTION_VERTICAL:ue,DIRECTION_ALL:at,Manager:$e,Input:J,TouchAction:qe,TouchInput:Se,MouseInput:Ne,PointerEventInput:je,TouchMouseInput:ze,SingleTouchInput:pt,Recognizer:oe,AttrRecognizer:$,Tap:Be,Pan:Ue,Swipe:Qe,Pinch:Ze,Rotate:Je,Press:Ke,on:V,off:P,each:M,merge:G,extend:F,assign:C,inherit:O,bindFn:j,prefixed:le}),de}(typeof window!="undefined"?window:{},typeof document!="undefined"?document:{});function At(c,o,n){var a=o.getBoundingClientRect(),t=a.top,l=a.left,h=a.width,u=a.height;return new g.Vector2((c.x-l)/h*2-1,-(c.y-t)/u*2+1)}var xt=function(c){He(o,c);function o(n,a,t,l,h){var u=c.call(this)||this;u.type="RoundedBoxGeometry",h=isNaN(h)?1:Math.max(1,Math.floor(h)),n=isNaN(n)?1:n,a=isNaN(a)?1:a,t=isNaN(t)?1:t,l=isNaN(l)?.15:l,l=Math.min(l,Math.min(n,Math.min(a,Math.min(t)))/2);var m=n/2-l,p=a/2-l,y=t/2-l;u.parameters={width:n,height:a,depth:t,radius:l,radiusSegments:h};var T=h+1,M=T*h+1<<3,N=new g.BufferAttribute(new Float32Array(M*3),3),C=new g.BufferAttribute(new Float32Array(M*3),3),F=[],G=[];new g.Vector3;var O=new g.Vector3,j=[],q=[],f=[],V=T*h,P=T*h+1;Ce(),fe(),ie(),se(),Ae(),ve();function Ce(){for(var A=[new g.Vector3(1,1,1),new g.Vector3(1,1,-1),new g.Vector3(-1,1,-1),new g.Vector3(-1,1,1),new g.Vector3(1,-1,1),new g.Vector3(1,-1,-1),new g.Vector3(-1,-1,-1),new g.Vector3(-1,-1,1)],E=0;E<8;E++)F.push([]),G.push([]);for(var w=Math.PI/2,x=new g.Vector3(m,p,y),D=0;D<=h;D++){var Z=D/h,B=Z*w,I=Math.cos(B),Y=Math.sin(B);if(D==h){O.set(0,1,0);var k=O.clone().multiplyScalar(l).add(x);F[0].push(k),j.push(k);var S=O.clone();G[0].push(S),q.push(S);continue}for(var _=0;_<=h;_++){var z=_/h,U=z*w;O.x=I*Math.cos(U),O.y=Y,O.z=I*Math.sin(U);var k=O.clone().multiplyScalar(l).add(x);F[0].push(k),j.push(k);var S=O.clone().normalize();G[0].push(S),q.push(S)}}for(var R=1;R<8;R++)for(var E=0;E<F[0].length;E++){var k=F[0][E].clone().multiply(A[R]);F[R].push(k),j.push(k);var S=G[0][E].clone().multiply(A[R]);G[R].push(S),q.push(S)}}function ie(){for(var A=[!0,!1,!0,!1,!1,!0,!1,!0],E=T*(h-1),w=0;w<8;w++){for(var x=P*w,D=0;D<h-1;D++)for(var Z=D*T,B=(D+1)*T,I=0;I<h;I++){var Y=I+1,k=x+Z+I,S=x+Z+Y,_=x+B+I,z=x+B+Y;A[w]?(f.push(k),f.push(_),f.push(S),f.push(S),f.push(_),f.push(z)):(f.push(k),f.push(S),f.push(_),f.push(S),f.push(z),f.push(_))}for(var I=0;I<h;I++){var k=x+E+I,S=x+E+I+1,_=x+V;A[w]?(f.push(k),f.push(_),f.push(S)):(f.push(k),f.push(S),f.push(_))}}}function fe(){var A=V,E=V+P,w=V+P*2,x=V+P*3;f.push(A),f.push(E),f.push(w),f.push(A),f.push(w),f.push(x),A=V+P*4,E=V+P*5,w=V+P*6,x=V+P*7,f.push(A),f.push(w),f.push(E),f.push(A),f.push(x),f.push(w),A=0,E=P,w=P*4,x=P*5,f.push(A),f.push(w),f.push(E),f.push(E),f.push(w),f.push(x),A=P*2,E=P*3,w=P*6,x=P*7,f.push(A),f.push(w),f.push(E),f.push(E),f.push(w),f.push(x),A=h,E=h+P*3,w=h+P*4,x=h+P*7,f.push(A),f.push(E),f.push(w),f.push(E),f.push(x),f.push(w),A=h+P,E=h+P*2,w=h+P*5,x=h+P*6,f.push(A),f.push(w),f.push(E),f.push(E),f.push(w),f.push(x)}function se(){for(var A=0;A<4;A++)for(var E=A*P,w=4*P+E,x=(A&1)===1,D=0;D<h;D++){var Z=D+1,B=E+D,I=E+Z,Y=w+D,k=w+Z;x?(f.push(B),f.push(Y),f.push(I),f.push(I),f.push(Y),f.push(k)):(f.push(B),f.push(I),f.push(Y),f.push(I),f.push(k),f.push(Y))}}function ve(){for(var A=[0,2,4,6],E=[1,3,5,7],w=0;w<4;w++)for(var x=P*A[w],D=P*E[w],Z=1>=w,B=0;B<h;B++){var I=B*T,Y=(B+1)*T,k=x+I,S=x+Y,_=D+I,z=D+Y;Z?(f.push(k),f.push(_),f.push(S),f.push(S),f.push(_),f.push(z)):(f.push(k),f.push(S),f.push(_),f.push(S),f.push(z),f.push(_))}}function Ae(){for(var A=h-1,E=[0,1,4,5],w=[3,2,7,6],x=[0,1,1,0],D=0;D<4;D++)for(var Z=E[D]*P,B=w[D]*P,I=0;I<=A;I++){var Y=Z+h+I*T,k=Z+(I!=A?h+(I+1)*T:P-1),S=B+h+I*T,_=B+(I!=A?h+(I+1)*T:P-1);x[D]?(f.push(Y),f.push(S),f.push(k),f.push(k),f.push(S),f.push(_)):(f.push(Y),f.push(k),f.push(S),f.push(k),f.push(_),f.push(S))}}for(var le=0,ee=0;ee<j.length;ee++)N.setXYZ(le,j[ee].x,j[ee].y,j[ee].z),C.setXYZ(le,q[ee].x,q[ee].y,q[ee].z),le++;return u.setIndex(new g.BufferAttribute(new Uint16Array(f),1)),u.setAttribute("position",N),u.setAttribute("normal",C),u}return o}(g.BufferGeometry);function Pe(c,o){return typeof c!="number"||typeof o!="number"?!1:Math.abs(c-o)<.001}function _e(c,o,n,a){a===void 0&&(a=function(l){return l});var t=a(n);return c*(1-t)+o*t}var X=Number((Math.PI/2).toFixed(5));function yr(c,o,n){var a=new g.Shape;return a.moveTo(n,0),a.lineTo(c-n,0),a.absarc(c-n,n,n,-X,0,!1),a.lineTo(c,o-n),a.absarc(c-n,o-n,n,0,X,!1),a.lineTo(n,o),a.absarc(n,o-n,n,X,Math.PI,!1),a.lineTo(0,n),a.absarc(n,n,n,Math.PI,Math.PI*1.5,!1),a}var Me=function(c){var o=document.createElement("div");o.innerText=c;var n=new it.CSS3DObject(o);return n.name=c,n.scale.set(.3,.3,.3),o.style.pointerEvents="none",o.style.backfaceVisibility="hidden",n},Le=function(c){var o=new g.PlaneGeometry(5,5),n=new g.MeshBasicMaterial({transparent:!0,opacity:0}),a=new g.Mesh(o,n),t=document.createElement("div");t.innerText=c;var l=new it.CSS3DObject(t);return l.name=c,l.scale.set(.3,.3,.3),t.style.color="#ffffff",t.style.opacity="0.5",t.style.pointerEvents="none",t.style.backfaceVisibility="hidden",a.rotateX(-X),a.add(l),a},Tr=function(c){He(o,c);function o(n,a){var t=c.call(this,n)||this;t.camera=new nt.Camera(90),t.scene=new g.Scene,t.renderer=new g.WebGLRenderer({antialias:!0,alpha:!0}),t.css3drenderer=new it.CSS3DRenderer,t.ambientLight=new g.AmbientLight(16777215,.7),t.wrapper=document.createElement("div"),t.arrows=document.createElement("div"),t.arrowLeft=document.createElement("div"),t.arrowRight=document.createElement("div"),t.arrowFront=document.createElement("div"),t.arrowBack=document.createElement("div"),t.arrowTop=document.createElement("div"),t.arrowBottom=document.createElement("div"),t.spherical=null,t.dragging=!1,t.style=document.createElement("style"),t.directionalLight=new g.DirectionalLight(16777215,.2),t.box=new g.Mesh(new xt(8,8,8,.5,20),new g.MeshPhongMaterial({color:16777215})),t.faces=new g.Group,t.orient=function(u){var m=u.longitude,p=u.latitude;t.dragging=!1,t.spherical=null,t.controls.enableDamping=!1,t.five.setState(Object.assign({latitude:p},m!==void 0?{longitude:m+t.config.fixedLongitude}:{})),t.five.ready().then(function(){t.controls.enableDamping=!0,t.setState({arrowsVisible:!0})})},t.onRenderFrame=function(){var u,m,p,y,T;if(t.renderer.render(t.scene,t.camera),t.css3drenderer.render(t.scene,t.camera),t.directionalLight.position.copy(t.camera.position),(u=t.controls)===null||u===void 0||u.update(),t.dragging){t.camera.computePose(),t.updateByCamera();var M=t.camera.pose,N=M.longitude,C=M.latitude;t.five.setState({longitude:N,latitude:C},!0),t.updateArrows({longitude:N,latitude:C})}else if(t.spherical&&(!Pe(t.spherical.pi,(m=t.controls)===null||m===void 0?void 0:m.getPolarAngle())||!Pe(t.spherical.theta,(p=t.controls)===null||p===void 0?void 0:p.getAzimuthalAngle()))){t.spherical={pi:(y=t.controls)===null||y===void 0?void 0:y.getPolarAngle(),theta:(T=t.controls)===null||T===void 0?void 0:T.getAzimuthalAngle()},t.camera.computePose(),t.updateByCamera();var F=t.camera.pose,N=F.longitude,C=F.latitude;t.five.setState({longitude:N,latitude:C},!0),t.updateArrows({longitude:N,latitude:C})}else t.spherical=null},t.onTapGesture=function(u){var m=u.pointers[0].clientX,p=u.pointers[0].clientY,y=At({x:m,y:p},t.wrapper),T=new g.Raycaster;T.setFromCamera(y,t.camera);var M=T.intersectObjects(t.faces.children,!1)[0];if(M){var N=M.object.userData,C=N.longitude,F=N.latitude;t.orient({longitude:C,latitude:F})}},t.onFiveWantsGesture=function(){if(t.spherical)return!1},t.onFiveModeChange=function(u){t.controls&&(t.controls.maxPolarAngle=u==="Topview"?0:X)},t.onCameraUpdate=function(u){var m=u.state;if(!t.dragging&&!t.spherical){var p=m.longitude,y=m.latitude;t.camera.pose.longitude===p&&t.camera.pose.latitude===y||(t.camera.setFromPose({longitude:p,latitude:y,distance:20,offset:new g.Vector3(0,0,0)}),t.updateByCamera(),t.updateArrows({longitude:p,latitude:y}))}},t.onPanStart=function(u){t.dragging=!0,t.spherical={}},t.onMouseMove=function(u){if(!t.dragging){var m=At({x:u.clientX,y:u.clientY},t.wrapper),p=new g.Raycaster;p.setFromCamera(m,t.camera);var y=p.intersectObjects(t.faces.children,!1)[0];t.faces.children.forEach(function(T){T.material.opacity=0,T.children[0].element.style.color=""}),y&&(y.object.material.opacity=.3,y.object.children[0].element.style.color="#336dff")}},t.onPanEnd=function(u){t.dragging=!1,t.spherical={pi:t.controls.getPolarAngle(),theta:t.controls.getAzimuthalAngle()}},t.dispose=function(){t.disable()},t.five=n;var l={enabled:!1,visible:!0,arrowsVisible:!1};t.state=Object.assign(l,a==null?void 0:a.initialState);var h=W({fixedLongitude:0,orthoView:!0},a==null?void 0:a.config);return t._config=h,t.state.enabled&&t._enable({userAction:!1}),t.mc=new tt.Manager(t.wrapper),t.mc.add(new tt.Tap({interval:410})),t.mc.add(new tt.Pan({threshold:10,pointers:0})),t.camera.setFromPose({distance:20,offset:new g.Vector3(0,0,0),longitude:n.camera.pose.latitude,latitude:n.camera.pose.latitude}),t.cylinder=new g.Mesh(new g.CylinderGeometry(13.2,14,.01,50,1,!0),new g.ShaderMaterial({uniforms:{radiusTop:{value:13.2},radiusBottom:{value:14},opacity:{value:1}},vertexShader:`
3278
357
  varying vec3 pos;
3279
358
  varying mat4 vViewMatrix;
3280
359
  void main() {
@@ -3304,7 +383,7 @@ vec4 envMapTexelToLinear(vec4 color) {
3304
383
  vec4 color = mix(color1, color2, z);
3305
384
  gl_FragColor = color;
3306
385
  }
3307
- `,transparent:!0})),i.init(),i}return Object.defineProperty(t.prototype,"config",{get:function(){return Ut({},this._config)},enumerable:!1,configurable:!0}),t.prototype.updateState=function(n,r){var i=this.state;this.state=Ut(Ut({},this.state),n),typeof n.arrowsVisible=="boolean"&&this.handleArrowsVisible(n.arrowsVisible),this.hooks.emit("stateChange",{state:this.state,prevState:i,userAction:r})},t.prototype.appendTo=function(n){if(n){n.appendChild(this.wrapper);var r=this.wrapper.getBoundingClientRect(),i=r.width,a=r.height;this.renderer.setSize(i,a),this.css3drenderer.setSize(i,a)}},t.prototype.init=function(){this.renderer.setClearAlpha(0),this.renderer.domElement.style.outline="none",this.initDom(),this.initFaces(),this.initControls(),this.initLights();var n=this.cylinder;n.position.y=-3;var r=Oo("西");r.position.set(-19,0,0),n.add(r);var i=Oo("东");i.position.set(19,0,0),n.add(i);var a=Oo("北");a.position.set(0,0,-19),n.add(a);var o=Oo("南");o.position.set(0,0,19),n.add(o),this.updateByCamera(),this.scene.add(n,this.box,this.faces),this.scene.rotation.y=this.config.fixedLongitude},t.prototype.initDom=function(){this.style.innerHTML=`
386
+ `,transparent:!0})),t.init(),t}return Object.defineProperty(o.prototype,"config",{get:function(){return W({},this._config)},enumerable:!1,configurable:!0}),o.prototype.updateState=function(n,a){var t=this.state;this.state=W(W({},this.state),n),typeof n.arrowsVisible=="boolean"&&this.handleArrowsVisible(n.arrowsVisible),this.hooks.emit("stateChange",{state:this.state,prevState:t,userAction:a})},o.prototype.appendTo=function(n){if(n){n.appendChild(this.wrapper);var a=this.wrapper.getBoundingClientRect(),t=a.width,l=a.height;this.renderer.setSize(t,l),this.css3drenderer.setSize(t,l)}},o.prototype.init=function(){this.renderer.setClearAlpha(0),this.renderer.domElement.style.outline="none",this.initDom(),this.initFaces(),this.initControls(),this.initLights();var n=this.cylinder;n.position.y=-3;var a=Le("西");a.position.set(-19,0,0),n.add(a);var t=Le("东");t.position.set(19,0,0),n.add(t);var l=Le("北");l.position.set(0,0,-19),n.add(l);var h=Le("南");h.position.set(0,0,19),n.add(h),this.updateByCamera(),this.scene.add(n,this.box,this.faces),this.scene.rotation.y=this.config.fixedLongitude},o.prototype.initDom=function(){this.style.innerHTML=`
3308
387
  .OrientationPlugin .OrientationArrows {
3309
388
  position: absolute;
3310
389
  top: 0;
@@ -3404,7 +483,7 @@ vec4 envMapTexelToLinear(vec4 color) {
3404
483
  border-color: transparent transparent var(--color) transparent;
3405
484
  transform: translate(0, -15px);
3406
485
  }
3407
- `,this.wrapper.className="OrientationPlugin",this.arrows.className="OrientationArrows",this.wrapper.style.cssText="position: relative; width: 100%; height: 100%",this.wrapper.appendChild(this.arrows),this.arrowLeft.className=this.arrowRight.className=this.arrowTop.className=this.arrowBack.className=this.arrowFront.className="OrientationArrow",this.arrowBottom.className="OrientationArrow disabled",this.arrowBack.innerText="后",this.arrowFront.innerText="前",this.arrowLeft.innerText="左",this.arrowRight.innerText="右",this.arrowTop.innerText="上",this.arrowBottom.innerText="下",this.css3drenderer.domElement.style.cssText="position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;"},t.prototype.bindEvents=function(){var n=this;this.five.on("renderFrame",this.onRenderFrame),this.five.on("camera.update",this.onCameraUpdate),this.five.on("wantsGesture",this.onFiveWantsGesture),this.five.on("modeChange",this.onFiveModeChange),this.mc.on("tap",this.onTapGesture),this.mc.on("panstart",this.onPanStart),this.mc.on("panend",this.onPanEnd),this.wrapper.addEventListener("mousemove",this.onMouseMove),this.arrowTop.onclick=function(){return n.orient({longitude:0,latitude:Lt})},this.arrowLeft.onclick=function(){return n.orient({longitude:-Lt,latitude:0})},this.arrowRight.onclick=function(){return n.orient({longitude:Lt,latitude:0})},this.arrowFront.onclick=function(){return n.orient({longitude:0,latitude:0})},this.arrowBack.onclick=function(){return n.orient({longitude:Math.PI,latitude:0})}},t.prototype.unbindEvents=function(){this.five.off("renderFrame",this.onRenderFrame),this.five.off("camera.update",this.onCameraUpdate),this.five.off("wantsGesture",this.onFiveWantsGesture),this.five.off("modeChange",this.onFiveModeChange),this.mc.off("tap",this.onTapGesture),this.mc.off("panstart",this.onPanStart),this.mc.off("panend",this.onPanEnd),this.wrapper.removeEventListener("mousemove",this.onMouseMove),this.arrowTop.onclick=null,this.arrowLeft.onclick=null,this.arrowRight.onclick=null,this.arrowFront.onclick=null,this.arrowBack.onclick=null},t.prototype.updateByCamera=function(){var n=Qi(.2,1,this.camera.pose.latitude/Math.PI*2,function(s){return s*s}),r=Qi(11,13,this.camera.pose.latitude/Math.PI*2,function(s){return s*s}),i=Qi(12,15,this.camera.pose.latitude/Math.PI*2,function(s){return s*s}),a=Qi(13,19,this.camera.pose.latitude/Math.PI*2,function(s){return s*s}),o=Qi(-.2,.5,this.camera.pose.latitude/Math.PI*2,function(s){return s*s});this.cylinder.geometry=new we.CylinderGeometry(r,i,.01,50,1,!0),this.cylinder.material.uniforms.radiusTop.value=r,this.cylinder.material.uniforms.radiusBottom.value=i,this.cylinder.material.needsUpdate=!0,this.cylinder.children.forEach(function(s){s.position.normalize().multiplyScalar(a),s.scale.set(n,n,n);var c=s.children[0];c&&(c.element.style.opacity=o.toString())})},t.prototype.updateArrows=function(n){n.longitude;var r=n.latitude,i=Lt-r<.02;this.setState({arrowsVisible:i})},t.prototype.handleArrowsVisible=function(n){var r=this;if(this.state.enabled)if(this.cylinder.material.uniforms.opacity.value=n?.4:1,this.cylinder.material.needsUpdate=!0,n){var i=this.five.getCurrentState(),a=i.longitude,o=i.latitude;if(Lt-o<.03)this.five.state.mode==="Topview"||this.five.state.mode==="Mapview"?(this.faces.getObjectByName("上").element.className="active",this.arrows.innerHTML="",this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowFront),this.arrows.style.transform="rotate(".concat((a-this.config.fixedLongitude)/Math.PI*180,"deg)")):(this.arrows.innerHTML="",this.faces.getObjectByName("上").element.className="");else{switch(this.arrows.innerHTML="",this.arrows.appendChild(this.arrowTop),this.config.orthoView&&this.five.ready().then(function(){r.five.controller.cameraType="orthographic",r.five.ready().then(function(){return r.five.controller.cameraMotion.ended=!1})}),!0){case Ji(0,a-this.config.fixedLongitude):this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("前").element.className="active";break;case Ji(Lt,a-this.config.fixedLongitude):this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("右").element.className="active";break;case Ji(Math.PI,a-this.config.fixedLongitude):this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("后").element.className="active";break;default:this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("左").element.className="active";break}this.arrows.style.transform=""}this.arrows.style.display="block"}else this.config.orthoView&&(this.five.controller.cameraType="auto",this.five.ready().then(function(){return r.five.controller.cameraMotion.ended=!1})),this.arrows.style.display="none",this.faces.children.forEach(function(s){s.children[0].element.className=""})},t.prototype.setState=function(n,r){r===void 0&&(r={});var i=this.state,a=r.userAction!==void 0?r.userAction:!0;if(this.updateState(n,a),n.enabled!==void 0&&i.enabled!==n.enabled){var o={userAction:a};n.enabled?this._enable(o):this._disable(o)}},t.prototype.initLights=function(){this.directionalLight.target=this.box,this.scene.add(this.ambientLight,this.directionalLight)},t.prototype.initFaces=function(){var n=b0(7,7,.5),r=new we.ShapeGeometry(n);r.translate(-3.5,-3.5,0);var i=new we.Mesh(r,new we.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));i.userData={longitude:0,latitude:0},i.position.z=4.1,i.add($i("前"));var a=new we.Mesh(r,new we.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));a.rotateY(Math.PI),a.position.z=-4.1,a.add($i("后")),a.userData={longitude:Math.PI,latitude:0};var o=new we.Mesh(r,new we.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));o.rotateY(Lt),o.position.x=4.1,o.add($i("右")),o.userData={longitude:Lt,latitude:0};var s=new we.Mesh(r,new we.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));s.rotateY(-Lt),s.position.x=-4.1,s.add($i("左")),s.userData={longitude:-Lt,latitude:0};var c=new we.Mesh(r,new we.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));c.rotateX(-Lt),c.position.y=4.1,c.add($i("上")),c.userData={longitude:0,latitude:Lt},this.faces.add(i,a,s,o,c)},t.prototype.initControls=function(){var n=this.controls=new Ha(this.camera,this.renderer.domElement);n.enableZoom=!1,n.enableDamping=!0,n.enablePan=!1,n.maxPolarAngle=Lt,n.dampingFactor=.15,n.rotateSpeed=.25},t.prototype.load=function(n){return Fo(this,void 0,void 0,function(){return Bo(this,function(r){return[2]})})},t.prototype._enable=function(n){var r=this.five.getCurrentState(),i=r.longitude,a=r.latitude;this.camera.setFromPose({longitude:i,latitude:a,distance:20,offset:new we.Vector3(0,0,0)}),this.updateByCamera(),this.wrapper.appendChild(this.renderer.domElement),this.wrapper.appendChild(this.css3drenderer.domElement),this.bindEvents()},t.prototype._disable=function(n){this.wrapper.removeChild(this.renderer.domElement),this.wrapper.removeChild(this.css3drenderer.domElement),this.unbindEvents()},t.prototype.enable=function(n){var r;if(!this.state.enabled){var i=(r=n==null?void 0:n.userAction)!==null&&r!==void 0?r:!0;this.updateState({enabled:!0},i),this._enable({userAction:i}),document.head.appendChild(this.style)}},t.prototype.disable=function(n){var r;if(this.state.enabled!==!1){var i=(r=n==null?void 0:n.userAction)!==null&&r!==void 0?r:!0;this.updateState({enabled:!1},i),this._disable({userAction:i}),document.head.removeChild(this.style)}},t}(exports.BasePlugin.Controller),M0=function(e,t){return new w0(e,t)},E0=function(e){Es(t,e);function t(n,r){var i=e.call(this,n)||this;return i.data={},i.pluginName="BackgroundPlugin",i._onFiveCameraUpdate=function(a){var o=(Math.PI/2-Math.max(a.latitude,0))/(Math.PI/2),s=Math.max(.2-o,0)*10;i.gradientBg&&(i.gradientBg.style.transform="translateY(-".concat((1-o)*50,"%)")),i.groundBg&&(i.groundBg.style.backgroundImage="radial-gradient(circle, #2E303350 ".concat(s*100,"%, transparent ").concat(s*120,"%)"))},i._addEventListener=function(){i.five.on("cameraUpdate",i._onFiveCameraUpdate)},i._removeEventListener=function(){i.five.off("cameraUpdate",i._onFiveCameraUpdate)},i.load=function(){return Fo(i,void 0,void 0,function(){return Bo(this,function(a){return[2]})})},i.setState=function(a,o){},i.enable=function(){var a,o=(a=i.five.getElement())===null||a===void 0?void 0:a.parentNode;if(!o){i.five.ready().then(function(){return i.enable()});return}i.state.enabled||(i._onFiveCameraUpdate(i.five.getPose(),!1),i.gradientBg&&o.appendChild(i.gradientBg),i.groundBg&&o.appendChild(i.groundBg),i.style&&document.head.appendChild(i.style),i._addEventListener(),i.hooks.emit("enable",{userAction:!0}),i.state.enabled=!0)},i.disable=function(a){var o,s,c,l;i.state.enabled&&((s=(o=i.gradientBg)===null||o===void 0?void 0:o.parentNode)===null||s===void 0||s.removeChild(i.gradientBg),(l=(c=i.groundBg)===null||c===void 0?void 0:c.parentNode)===null||l===void 0||l.removeChild(i.groundBg),i.style&&document.head.removeChild(i.style),i._removeEventListener(),i.hooks.emit("disable",{userAction:!0}),i.state.enabled=!1)},i.dispose=function(){i._removeEventListener(),i.hooks.emit("disable",{userAction:!0}),i.state.enabled=!1},i.state={enabled:!1},typeof document=="undefined"||(i.gradientBg=document.createElement("div"),i.groundBg=document.createElement("div"),i.style=document.createElement("style"),i.gradientBg.className="BackgroundPluginBg",i.groundBg.className="BackgroundPluginGroundBg",i.style.innerHTML=`
486
+ `,this.wrapper.className="OrientationPlugin",this.arrows.className="OrientationArrows",this.wrapper.style.cssText="position: relative; width: 100%; height: 100%",this.wrapper.appendChild(this.arrows),this.arrowLeft.className=this.arrowRight.className=this.arrowTop.className=this.arrowBack.className=this.arrowFront.className="OrientationArrow",this.arrowBottom.className="OrientationArrow disabled",this.arrowBack.innerText="后",this.arrowFront.innerText="前",this.arrowLeft.innerText="左",this.arrowRight.innerText="右",this.arrowTop.innerText="上",this.arrowBottom.innerText="下",this.css3drenderer.domElement.style.cssText="position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; color: #00000090;"},o.prototype.bindEvents=function(){var n=this;this.five.on("renderFrame",this.onRenderFrame),this.five.on("camera.update",this.onCameraUpdate),this.five.on("wantsGesture",this.onFiveWantsGesture),this.five.on("modeChange",this.onFiveModeChange),this.mc.on("tap",this.onTapGesture),this.mc.on("panstart",this.onPanStart),this.mc.on("panend",this.onPanEnd),this.wrapper.addEventListener("mousemove",this.onMouseMove),this.arrowTop.onclick=function(){return n.orient({longitude:0,latitude:X})},this.arrowLeft.onclick=function(){return n.orient({longitude:-X,latitude:0})},this.arrowRight.onclick=function(){return n.orient({longitude:X,latitude:0})},this.arrowFront.onclick=function(){return n.orient({longitude:0,latitude:0})},this.arrowBack.onclick=function(){return n.orient({longitude:Math.PI,latitude:0})}},o.prototype.unbindEvents=function(){this.five.off("renderFrame",this.onRenderFrame),this.five.off("camera.update",this.onCameraUpdate),this.five.off("wantsGesture",this.onFiveWantsGesture),this.five.off("modeChange",this.onFiveModeChange),this.mc.off("tap",this.onTapGesture),this.mc.off("panstart",this.onPanStart),this.mc.off("panend",this.onPanEnd),this.wrapper.removeEventListener("mousemove",this.onMouseMove),this.arrowTop.onclick=null,this.arrowLeft.onclick=null,this.arrowRight.onclick=null,this.arrowFront.onclick=null,this.arrowBack.onclick=null},o.prototype.updateByCamera=function(){var n=_e(.2,1,this.camera.pose.latitude/Math.PI*2,function(u){return u*u}),a=_e(11,13,this.camera.pose.latitude/Math.PI*2,function(u){return u*u}),t=_e(12,15,this.camera.pose.latitude/Math.PI*2,function(u){return u*u}),l=_e(13,19,this.camera.pose.latitude/Math.PI*2,function(u){return u*u}),h=_e(-.2,.5,this.camera.pose.latitude/Math.PI*2,function(u){return u*u});this.cylinder.geometry=new g.CylinderGeometry(a,t,.01,50,1,!0),this.cylinder.material.uniforms.radiusTop.value=a,this.cylinder.material.uniforms.radiusBottom.value=t,this.cylinder.material.needsUpdate=!0,this.cylinder.children.forEach(function(u){u.position.normalize().multiplyScalar(l),u.scale.set(n,n,n);var m=u.children[0];m&&(m.element.style.opacity=h.toString())})},o.prototype.updateArrows=function(n){n.longitude;var a=n.latitude,t=X-a<.02;this.setState({arrowsVisible:t})},o.prototype.handleArrowsVisible=function(n){var a=this;if(this.state.enabled)if(this.cylinder.material.uniforms.opacity.value=n?.4:1,this.cylinder.material.needsUpdate=!0,n){var t=this.five.getCurrentState(),l=t.longitude,h=t.latitude;if(X-h<.03)this.five.state.mode==="Topview"||this.five.state.mode==="Mapview"?(this.faces.getObjectByName("上").element.className="active",this.arrows.innerHTML="",this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowFront),this.arrows.style.transform="rotate(".concat((l-this.config.fixedLongitude)/Math.PI*180,"deg)")):(this.arrows.innerHTML="",this.faces.getObjectByName("上").element.className="");else{switch(this.arrows.innerHTML="",this.arrows.appendChild(this.arrowTop),this.config.orthoView&&this.five.ready().then(function(){a.five.controller.cameraType="orthographic",a.five.ready().then(function(){return a.five.controller.cameraMotion.ended=!1})}),!0){case Pe(0,l-this.config.fixedLongitude):this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("前").element.className="active";break;case Pe(X,l-this.config.fixedLongitude):this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("右").element.className="active";break;case Pe(Math.PI,l-this.config.fixedLongitude):this.arrows.appendChild(this.arrowRight),this.arrows.appendChild(this.arrowLeft),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("后").element.className="active";break;default:this.arrows.appendChild(this.arrowBack),this.arrows.appendChild(this.arrowFront),this.arrows.appendChild(this.arrowBottom),this.faces.getObjectByName("左").element.className="active";break}this.arrows.style.transform=""}this.arrows.style.display="block"}else this.config.orthoView&&(this.five.controller.cameraType="auto",this.five.ready().then(function(){return a.five.controller.cameraMotion.ended=!1})),this.arrows.style.display="none",this.faces.children.forEach(function(u){u.children[0].element.className=""})},o.prototype.setState=function(n,a){a===void 0&&(a={});var t=this.state,l=a.userAction!==void 0?a.userAction:!0;if(this.updateState(n,l),n.enabled!==void 0&&t.enabled!==n.enabled){var h={userAction:l};n.enabled?this._enable(h):this._disable(h)}},o.prototype.initLights=function(){this.directionalLight.target=this.box,this.scene.add(this.ambientLight,this.directionalLight)},o.prototype.initFaces=function(){var n=yr(7,7,.5),a=new g.ShapeGeometry(n);a.translate(-3.5,-3.5,0);var t=new g.Mesh(a,new g.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));t.userData={longitude:0,latitude:0},t.position.z=4.1,t.add(Me("前"));var l=new g.Mesh(a,new g.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));l.rotateY(Math.PI),l.position.z=-4.1,l.add(Me("后")),l.userData={longitude:Math.PI,latitude:0};var h=new g.Mesh(a,new g.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));h.rotateY(X),h.position.x=4.1,h.add(Me("右")),h.userData={longitude:X,latitude:0};var u=new g.Mesh(a,new g.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));u.rotateY(-X),u.position.x=-4.1,u.add(Me("左")),u.userData={longitude:-X,latitude:0};var m=new g.Mesh(a,new g.MeshBasicMaterial({transparent:!0,color:3370495,opacity:0}));m.rotateX(-X),m.position.y=4.1,m.add(Me("上")),m.userData={longitude:0,latitude:X},this.faces.add(t,l,u,h,m)},o.prototype.initControls=function(){var n=this.controls=new tr.OrbitControls(this.camera,this.renderer.domElement);n.enableZoom=!1,n.enableDamping=!0,n.enablePan=!1,n.maxPolarAngle=X,n.dampingFactor=.15,n.rotateSpeed=.25},o.prototype.load=function(n){return Ve(this,void 0,void 0,function(){return Ge(this,function(a){return[2]})})},o.prototype._enable=function(n){var a=this.five.getCurrentState(),t=a.longitude,l=a.latitude;this.camera.setFromPose({longitude:t,latitude:l,distance:20,offset:new g.Vector3(0,0,0)}),this.updateByCamera(),this.wrapper.appendChild(this.renderer.domElement),this.wrapper.appendChild(this.css3drenderer.domElement),this.bindEvents()},o.prototype._disable=function(n){this.wrapper.removeChild(this.renderer.domElement),this.wrapper.removeChild(this.css3drenderer.domElement),this.unbindEvents()},o.prototype.enable=function(n){var a;if(!this.state.enabled){var t=(a=n==null?void 0:n.userAction)!==null&&a!==void 0?a:!0;this.updateState({enabled:!0},t),this._enable({userAction:t}),document.head.appendChild(this.style)}},o.prototype.disable=function(n){var a;if(this.state.enabled!==!1){var t=(a=n==null?void 0:n.userAction)!==null&&a!==void 0?a:!0;this.updateState({enabled:!1},t),this._disable({userAction:t}),document.head.removeChild(this.style)}},o}(exports.BasePlugin.Controller),wr=function(c,o){return new Tr(c,o)},br=function(c){He(o,c);function o(n,a){var t=c.call(this,n)||this;return t.data={},t.pluginName="BackgroundPlugin",t._onFiveCameraUpdate=function(l){var h=(Math.PI/2-Math.max(l.latitude,0))/(Math.PI/2),u=Math.max(.2-h,0)*10;t.gradientBg&&(t.gradientBg.style.transform="translateY(-".concat((1-h)*50,"%)")),t.groundBg&&(t.groundBg.style.backgroundImage="radial-gradient(circle, #2E303350 ".concat(u*100,"%, transparent ").concat(u*120,"%)"))},t._addEventListener=function(){t.five.on("cameraUpdate",t._onFiveCameraUpdate)},t._removeEventListener=function(){t.five.off("cameraUpdate",t._onFiveCameraUpdate)},t.load=function(){return Ve(t,void 0,void 0,function(){return Ge(this,function(l){return[2]})})},t.setState=function(l,h){},t.enable=function(){var l,h=(l=t.five.getElement())===null||l===void 0?void 0:l.parentNode;if(!h){t.five.ready().then(function(){return t.enable()});return}t.state.enabled||(t._onFiveCameraUpdate(t.five.getPose(),!1),t.gradientBg&&h.appendChild(t.gradientBg),t.groundBg&&h.appendChild(t.groundBg),t.style&&document.head.appendChild(t.style),t._addEventListener(),t.hooks.emit("enable",{userAction:!0}),t.state.enabled=!0)},t.disable=function(l){var h,u,m,p;t.state.enabled&&((u=(h=t.gradientBg)===null||h===void 0?void 0:h.parentNode)===null||u===void 0||u.removeChild(t.gradientBg),(p=(m=t.groundBg)===null||m===void 0?void 0:m.parentNode)===null||p===void 0||p.removeChild(t.groundBg),t.style&&document.head.removeChild(t.style),t._removeEventListener(),t.hooks.emit("disable",{userAction:!0}),t.state.enabled=!1)},t.dispose=function(){t._removeEventListener(),t.hooks.emit("disable",{userAction:!0}),t.state.enabled=!1},t.state={enabled:!1},typeof document=="undefined"||(t.gradientBg=document.createElement("div"),t.groundBg=document.createElement("div"),t.style=document.createElement("style"),t.gradientBg.className="BackgroundPluginBg",t.groundBg.className="BackgroundPluginGroundBg",t.style.innerHTML=`
3408
487
  .BackgroundPluginBg {
3409
488
  position: absolute;
3410
489
  top: 0;
@@ -3425,4 +504,4 @@ vec4 envMapTexelToLinear(vec4 color) {
3425
504
  z-index: -1;
3426
505
  pointerEvents: none;
3427
506
  }
3428
- `,i.enable()),i}return t}(wf.BasePlugin.Controller),T0=function(e,t){return new E0(e,t)};exports.BackgroundPlugin=T0;exports.ItemMaskPlugin=Bf;exports.OrientationPlugin=M0;exports.RoundedBoxGeometry=yf;
507
+ `,t.enable()),t}return o}(rr.BasePlugin.Controller),Er=function(c,o){return new br(c,o)};exports.BackgroundPlugin=Er;exports.ItemMaskPlugin=gr;exports.OrientationPlugin=wr;exports.RoundedBoxGeometry=xt;