fl-web-component 0.1.0 → 0.1.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/README.md +35 -24
- package/dist/fl-web-component.common.js +67035 -54
- package/dist/fl-web-component.common.js.map +1 -1
- package/dist/fl-web-component.css +1 -1
- package/dist/fl-web-component.umd.js +67035 -54
- package/dist/fl-web-component.umd.js.map +1 -1
- package/dist/fl-web-component.umd.min.js +13 -1
- package/dist/fl-web-component.umd.min.js.map +1 -1
- package/package.json +59 -47
- package/packages/components/button/index.vue +6 -3
- package/packages/components/com-card/card-page.vue +100 -0
- package/packages/components/com-card/index.vue +54 -0
- package/packages/components/com-dialogWrapper/Readme.md +53 -0
- package/packages/components/com-dialogWrapper/index.vue +101 -0
- package/packages/components/com-formDialog/Readme.md +409 -0
- package/packages/components/com-formDialog/index.vue +470 -0
- package/packages/components/com-graphics/index.vue +240 -0
- package/packages/components/com-page/index.vue +101 -0
- package/packages/components/com-selectTree/Readme.md +17 -0
- package/packages/components/com-selectTree/index.vue +238 -0
- package/packages/components/com-table/column-default.vue +76 -0
- package/packages/components/com-table/column-dynamic.vue +40 -0
- package/packages/components/com-table/column-menu.vue +71 -0
- package/packages/components/com-table/column-slot.vue +53 -0
- package/packages/components/com-table/column.vue +49 -0
- package/packages/components/com-table/config.js +21 -0
- package/packages/components/com-table/index.vue +281 -0
- package/packages/components/com-table/table-page.vue +106 -0
- package/packages/components/com-tabs/index.vue +50 -0
- package/packages/components/com-treeDynamic/Readme.md +271 -0
- package/packages/components/com-treeDynamic/index.vue +207 -0
- package/patches/camera-controls+2.9.0.patch +63 -0
- package/{packages/index.js → src/main.js} +5 -5
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
(function(e
|
|
1
|
+
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["fl-web-component"]=e():t["fl-web-component"]=e()})("undefined"!==typeof self?self:this,(function(){return function(t){var e={};function s(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,s),r.l=!0,r.exports}return s.m=t,s.c=e,s.d=function(t,e,i){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},s.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"===typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)s.d(i,r,function(e){return t[e]}.bind(null,r));return i},s.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s="fb15")}({"013f":function(t,e,s){},"0162":function(t,e,s){"use strict";s("013f")},4540:function(t,e,s){},"9e3c":function(t,e,s){"use strict";s("4540")},fb15:function(t,e,s){"use strict";if(s.r(e),"undefined"!==typeof window){var i=window.document.currentScript,r=i&&i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);r&&(s.p=r[1])}var n=function(){var t=this,e=t._self._c;return e("div",{attrs:{id:"instructions"}})},o=[];
|
|
2
|
+
/*!
|
|
3
|
+
* camera-controls
|
|
4
|
+
* https://github.com/yomotsu/camera-controls
|
|
5
|
+
* (c) 2017 @yomotsu
|
|
6
|
+
* Released under the MIT License.
|
|
7
|
+
*/
|
|
8
|
+
const a={LEFT:1,RIGHT:2,MIDDLE:4},h=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,SCREEN_PAN:4,OFFSET:8,DOLLY:16,ZOOM:32,TOUCH_ROTATE:64,TOUCH_TRUCK:128,TOUCH_SCREEN_PAN:256,TOUCH_OFFSET:512,TOUCH_DOLLY:1024,TOUCH_ZOOM:2048,TOUCH_DOLLY_TRUCK:4096,TOUCH_DOLLY_SCREEN_PAN:8192,TOUCH_DOLLY_OFFSET:16384,TOUCH_DOLLY_ROTATE:32768,TOUCH_ZOOM_TRUCK:65536,TOUCH_ZOOM_OFFSET:131072,TOUCH_ZOOM_SCREEN_PAN:262144,TOUCH_ZOOM_ROTATE:524288}),l={NONE:0,IN:1,OUT:-1};function c(t){return t.isPerspectiveCamera}function u(t){return t.isOrthographicCamera}const d=2*Math.PI,p=Math.PI/2,m=1e-5,y=Math.PI/180;function f(t,e,s){return Math.max(e,Math.min(s,t))}function g(t,e=m){return Math.abs(t)<e}function _(t,e,s=m){return g(t-e,s)}function x(t,e){return Math.round(t/e)*e}function b(t){return isFinite(t)?t:t<0?-Number.MAX_VALUE:Number.MAX_VALUE}function w(t){return Math.abs(t)<Number.MAX_VALUE?t:t*(1/0)}function T(t,e,s,i,r=1/0,n){i=Math.max(1e-4,i);const o=2/i,a=o*n,h=1/(1+a+.48*a*a+.235*a*a*a);let l=t-e;const c=e,u=r*i;l=f(l,-u,u),e=t-l;const d=(s.value+o*l)*n;s.value=(s.value-o*d)*h;let p=e+(l+d)*h;return c-t>0===p>c&&(p=c,s.value=(p-c)/n),p}function M(t,e,s,i,r=1/0,n,o){i=Math.max(1e-4,i);const a=2/i,h=a*n,l=1/(1+h+.48*h*h+.235*h*h*h);let c=e.x,u=e.y,d=e.z,p=t.x-c,m=t.y-u,y=t.z-d;const f=c,g=u,_=d,x=r*i,b=x*x,w=p*p+m*m+y*y;if(w>b){const t=Math.sqrt(w);p=p/t*x,m=m/t*x,y=y/t*x}c=t.x-p,u=t.y-m,d=t.z-y;const T=(s.x+a*p)*n,M=(s.y+a*m)*n,v=(s.z+a*y)*n;s.x=(s.x-a*T)*l,s.y=(s.y-a*M)*l,s.z=(s.z-a*v)*l,o.x=c+(p+T)*l,o.y=u+(m+M)*l,o.z=d+(y+v)*l;const A=f-t.x,E=g-t.y,S=_-t.z,O=o.x-f,C=o.y-g,R=o.z-_;return A*O+E*C+S*R>0&&(o.x=f,o.y=g,o.z=_,s.x=(o.x-f)/n,s.y=(o.y-g)/n,s.z=(o.z-_)/n),o}function v(t,e){e.set(0,0),t.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=t.length,e.y/=t.length}function A(t,e){return!!u(t)&&(console.warn(e+" is not supported in OrthographicCamera"),!0)}class E{constructor(){this._listeners={}}addEventListener(t,e){const s=this._listeners;void 0===s[t]&&(s[t]=[]),-1===s[t].indexOf(e)&&s[t].push(e)}hasEventListener(t,e){const s=this._listeners;return void 0!==s[t]&&-1!==s[t].indexOf(e)}removeEventListener(t,e){const s=this._listeners,i=s[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}removeAllEventListeners(t){t?Array.isArray(this._listeners[t])&&(this._listeners[t].length=0):this._listeners={}}dispatchEvent(t){const e=this._listeners,s=e[t.type];if(void 0!==s){t.target=this;const e=s.slice(0);for(let s=0,i=e.length;s<i;s++)e[s].call(this,t)}}}var S;const O="2.10.1",C=1/8,R=/Mac/.test(null===(S=null===globalThis||void 0===globalThis?void 0:globalThis.navigator)||void 0===S?void 0:S.platform);let z,L,k,I,P,N,U,B,F,D,H,V,j,W,Y,X,q,Z,G,K,J,Q,$;class tt extends E{static install(t){z=t.THREE,L=Object.freeze(new z.Vector3(0,0,0)),k=Object.freeze(new z.Vector3(0,1,0)),I=Object.freeze(new z.Vector3(0,0,1)),P=new z.Vector2,N=new z.Vector3,U=new z.Vector3,B=new z.Vector3,F=new z.Vector3,D=new z.Vector3,H=new z.Vector3,V=new z.Vector3,j=new z.Vector3,W=new z.Vector3,Y=new z.Spherical,X=new z.Spherical,q=new z.Box3,Z=new z.Box3,G=new z.Sphere,K=new z.Quaternion,J=new z.Quaternion,Q=new z.Matrix4,$=new z.Raycaster}static get ACTION(){return h}set verticalDragToForward(t){console.warn("camera-controls: `verticalDragToForward` was removed. Use `mouseButtons.left = CameraControls.ACTION.SCREEN_PAN` instead.")}constructor(t,e){super(),this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.minDistance=Number.EPSILON,this.maxDistance=1/0,this.infinityDolly=!1,this.minZoom=.01,this.maxZoom=1/0,this.smoothTime=.25,this.draggingSmoothTime=.125,this.maxSpeed=1/0,this.azimuthRotateSpeed=1,this.polarRotateSpeed=1,this.dollySpeed=1,this.dollyDragInverted=!1,this.truckSpeed=2,this.dollyToCursor=!1,this.dragToOffset=!1,this.boundaryFriction=0,this.restThreshold=.01,this.colliderMeshes=[],this.cancel=()=>{},this._enabled=!0,this._state=h.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=l.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new z.Vector3,this._focalOffsetVelocity=new z.Vector3,this._zoomVelocity={value:0},this._truckInternal=(t,e,s,i)=>{let r,n;if(c(this._camera)){const s=N.copy(this._camera.position).sub(this._target),i=this._camera.getEffectiveFOV()*y,o=s.length()*Math.tan(.5*i);r=this.truckSpeed*t*o/this._elementRect.height,n=this.truckSpeed*e*o/this._elementRect.height}else{if(!u(this._camera))return;{const s=this._camera;r=this.truckSpeed*t*(s.right-s.left)/s.zoom/this._elementRect.width,n=this.truckSpeed*e*(s.top-s.bottom)/s.zoom/this._elementRect.height}}i?(s?this.setFocalOffset(this._focalOffsetEnd.x+r,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(r,0,!0),this.forward(-n,!0)):s?this.setFocalOffset(this._focalOffsetEnd.x+r,this._focalOffsetEnd.y+n,this._focalOffsetEnd.z,!0):this.truck(r,n,!0)},this._rotateInternal=(t,e)=>{const s=d*this.azimuthRotateSpeed*t/this._elementRect.height,i=d*this.polarRotateSpeed*e/this._elementRect.height;this.rotate(s,i,!0)},this._dollyInternal=(t,e,s)=>{const i=Math.pow(.95,-t*this.dollySpeed),r=this._sphericalEnd.radius,n=this._sphericalEnd.radius*i,o=f(n,this.minDistance,this.maxDistance),a=o-n;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(n,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(a,!0),this._dollyToNoClamp(o,!0)):this._dollyToNoClamp(o,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?n:o)-r,this._dollyControlCoord.set(e,s)),this._lastDollyDirection=Math.sign(-t)},this._zoomInternal=(t,e,s)=>{const i=Math.pow(.95,t*this.dollySpeed),r=this._zoom,n=this._zoom*i;this.zoomTo(n,!0),this.dollyToCursor&&(this._changedZoom+=n-r,this._dollyControlCoord.set(e,s))},"undefined"===typeof z&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=t,this._yAxisUpSpace=(new z.Quaternion).setFromUnitVectors(this._camera.up,k),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=h.NONE,this._target=new z.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new z.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=(new z.Spherical).setFromVector3(N.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new z.Vector3,new z.Vector3,new z.Vector3,new z.Vector3],this._updateNearPlaneCorners(),this._boundary=new z.Box3(new z.Vector3(-1/0,-1/0,-1/0),new z.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new z.Vector2,this.mouseButtons={left:h.ROTATE,middle:h.DOLLY,right:h.TRUCK,wheel:c(this._camera)?h.DOLLY:u(this._camera)?h.ZOOM:h.NONE},this.touches={one:h.TOUCH_ROTATE,two:c(this._camera)?h.TOUCH_DOLLY_TRUCK:u(this._camera)?h.TOUCH_ZOOM_TRUCK:h.NONE,three:h.TOUCH_TRUCK};const s=new z.Vector2,i=new z.Vector2,r=new z.Vector2,n=t=>{if(!this._enabled||!this._domElement)return;if(0!==this._interactiveArea.left||0!==this._interactiveArea.top||1!==this._interactiveArea.width||1!==this._interactiveArea.height){const e=this._domElement.getBoundingClientRect(),s=t.clientX/e.width,i=t.clientY/e.height;if(s<this._interactiveArea.left||s>this._interactiveArea.right||i<this._interactiveArea.top||i>this._interactiveArea.bottom)return}const e="mouse"!==t.pointerType?null:(t.buttons&a.LEFT)===a.LEFT?a.LEFT:(t.buttons&a.MIDDLE)===a.MIDDLE?a.MIDDLE:(t.buttons&a.RIGHT)===a.RIGHT?a.RIGHT:null;if(null!==e){const t=this._findPointerByMouseButton(e);t&&this._disposePointer(t)}if((t.buttons&a.LEFT)===a.LEFT&&this._lockedPointer)return;const s={pointerId:t.pointerId,clientX:t.clientX,clientY:t.clientY,deltaX:0,deltaY:0,mouseButton:e};this._activePointers.push(s),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",p),this._isDragging=!0,x(t)},o=t=>{t.cancelable&&t.preventDefault();const e=t.pointerId,s=this._lockedPointer||this._findPointerById(e);if(s){if(s.clientX=t.clientX,s.clientY=t.clientY,s.deltaX=t.movementX,s.deltaY=t.movementY,this._state=0,"touch"===t.pointerType)switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(t.buttons&a.LEFT)===a.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(t.buttons&a.MIDDLE)===a.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(t.buttons&a.RIGHT)===a.RIGHT&&(this._state=this._state|this.mouseButtons.right);b()}},p=t=>{const e=this._findPointerById(t.pointerId);if(!e||e!==this._lockedPointer){if(e&&this._disposePointer(e),"touch"===t.pointerType)switch(this._activePointers.length){case 0:this._state=h.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=h.NONE;w()}};let m=-1;const g=t=>{if(!this._domElement)return;if(!this._enabled||this.mouseButtons.wheel===h.NONE)return;if(0!==this._interactiveArea.left||0!==this._interactiveArea.top||1!==this._interactiveArea.width||1!==this._interactiveArea.height){const e=this._domElement.getBoundingClientRect(),s=t.clientX/e.width,i=t.clientY/e.height;if(s<this._interactiveArea.left||s>this._interactiveArea.right||i<this._interactiveArea.top||i>this._interactiveArea.bottom)return}if(t.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===h.ROTATE||this.mouseButtons.wheel===h.TRUCK){const t=performance.now();m-t<1e3&&this._getClientRect(this._elementRect),m=t}const e=R?-1:-3,s=1===t.deltaMode||t.ctrlKey?t.deltaY/e:t.deltaY/(10*e),i=this.dollyToCursor?(t.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,r=this.dollyToCursor?(t.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case h.ROTATE:this._rotateInternal(t.deltaX,t.deltaY),this._isUserControllingRotate=!0;break;case h.TRUCK:this._truckInternal(t.deltaX,t.deltaY,!1,!1),this._isUserControllingTruck=!0;break;case h.SCREEN_PAN:this._truckInternal(t.deltaX,t.deltaY,!1,!0),this._isUserControllingTruck=!0;break;case h.OFFSET:this._truckInternal(t.deltaX,t.deltaY,!0,!1),this._isUserControllingOffset=!0;break;case h.DOLLY:this._dollyInternal(-s,i,r),this._isUserControllingDolly=!0;break;case h.ZOOM:this._zoomInternal(-s,i,r),this._isUserControllingZoom=!0;break}this.dispatchEvent({type:"control"})},_=t=>{if(this._domElement&&this._enabled){if(this.mouseButtons.right===tt.ACTION.NONE){const e=t instanceof PointerEvent?t.pointerId:0,s=this._findPointerById(e);return s&&this._disposePointer(s),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),void this._domElement.ownerDocument.removeEventListener("pointerup",p)}t.preventDefault()}},x=t=>{if(!this._enabled)return;v(this._activePointers,P),this._getClientRect(this._elementRect),s.copy(P),i.copy(P);const e=this._activePointers.length>=2;if(e){const t=P.x-this._activePointers[1].clientX,e=P.y-this._activePointers[1].clientY,s=Math.sqrt(t*t+e*e);r.set(0,s);const n=.5*(this._activePointers[0].clientX+this._activePointers[1].clientX),o=.5*(this._activePointers[0].clientY+this._activePointers[1].clientY);i.set(n,o)}if(this._state=0,t)if("pointerType"in t&&"touch"===t.pointerType)switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._lockedPointer||(t.buttons&a.LEFT)!==a.LEFT||(this._state=this._state|this.mouseButtons.left),(t.buttons&a.MIDDLE)===a.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(t.buttons&a.RIGHT)===a.RIGHT&&(this._state=this._state|this.mouseButtons.right);else this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);(this._state&h.ROTATE)!==h.ROTATE&&(this._state&h.TOUCH_ROTATE)!==h.TOUCH_ROTATE&&(this._state&h.TOUCH_DOLLY_ROTATE)!==h.TOUCH_DOLLY_ROTATE&&(this._state&h.TOUCH_ZOOM_ROTATE)!==h.TOUCH_ZOOM_ROTATE||(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),(this._state&h.TRUCK)!==h.TRUCK&&(this._state&h.SCREEN_PAN)!==h.SCREEN_PAN&&(this._state&h.TOUCH_TRUCK)!==h.TOUCH_TRUCK&&(this._state&h.TOUCH_SCREEN_PAN)!==h.TOUCH_SCREEN_PAN&&(this._state&h.TOUCH_DOLLY_TRUCK)!==h.TOUCH_DOLLY_TRUCK&&(this._state&h.TOUCH_DOLLY_SCREEN_PAN)!==h.TOUCH_DOLLY_SCREEN_PAN&&(this._state&h.TOUCH_ZOOM_TRUCK)!==h.TOUCH_ZOOM_TRUCK&&(this._state&h.TOUCH_ZOOM_SCREEN_PAN)!==h.TOUCH_DOLLY_SCREEN_PAN||(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),(this._state&h.DOLLY)!==h.DOLLY&&(this._state&h.TOUCH_DOLLY)!==h.TOUCH_DOLLY&&(this._state&h.TOUCH_DOLLY_TRUCK)!==h.TOUCH_DOLLY_TRUCK&&(this._state&h.TOUCH_DOLLY_SCREEN_PAN)!==h.TOUCH_DOLLY_SCREEN_PAN&&(this._state&h.TOUCH_DOLLY_OFFSET)!==h.TOUCH_DOLLY_OFFSET&&(this._state&h.TOUCH_DOLLY_ROTATE)!==h.TOUCH_DOLLY_ROTATE||(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),(this._state&h.ZOOM)!==h.ZOOM&&(this._state&h.TOUCH_ZOOM)!==h.TOUCH_ZOOM&&(this._state&h.TOUCH_ZOOM_TRUCK)!==h.TOUCH_ZOOM_TRUCK&&(this._state&h.TOUCH_ZOOM_SCREEN_PAN)!==h.TOUCH_ZOOM_SCREEN_PAN&&(this._state&h.TOUCH_ZOOM_OFFSET)!==h.TOUCH_ZOOM_OFFSET&&(this._state&h.TOUCH_ZOOM_ROTATE)!==h.TOUCH_ZOOM_ROTATE||(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),(this._state&h.OFFSET)!==h.OFFSET&&(this._state&h.TOUCH_OFFSET)!==h.TOUCH_OFFSET&&(this._state&h.TOUCH_DOLLY_OFFSET)!==h.TOUCH_DOLLY_OFFSET&&(this._state&h.TOUCH_ZOOM_OFFSET)!==h.TOUCH_ZOOM_OFFSET||(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},b=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,v(this._activePointers,P);const t=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement,e=t?this._lockedPointer||this._activePointers[0]:null,n=e?-e.deltaX:i.x-P.x,o=e?-e.deltaY:i.y-P.y;if(i.copy(P),(this._state&h.ROTATE)!==h.ROTATE&&(this._state&h.TOUCH_ROTATE)!==h.TOUCH_ROTATE&&(this._state&h.TOUCH_DOLLY_ROTATE)!==h.TOUCH_DOLLY_ROTATE&&(this._state&h.TOUCH_ZOOM_ROTATE)!==h.TOUCH_ZOOM_ROTATE||(this._rotateInternal(n,o),this._isUserControllingRotate=!0),(this._state&h.DOLLY)===h.DOLLY||(this._state&h.ZOOM)===h.ZOOM){const t=this.dollyToCursor?(s.x-this._elementRect.x)/this._elementRect.width*2-1:0,e=this.dollyToCursor?(s.y-this._elementRect.y)/this._elementRect.height*-2+1:0,i=this.dollyDragInverted?-1:1;(this._state&h.DOLLY)===h.DOLLY?(this._dollyInternal(i*o*C,t,e),this._isUserControllingDolly=!0):(this._zoomInternal(i*o*C,t,e),this._isUserControllingZoom=!0)}if((this._state&h.TOUCH_DOLLY)===h.TOUCH_DOLLY||(this._state&h.TOUCH_ZOOM)===h.TOUCH_ZOOM||(this._state&h.TOUCH_DOLLY_TRUCK)===h.TOUCH_DOLLY_TRUCK||(this._state&h.TOUCH_ZOOM_TRUCK)===h.TOUCH_ZOOM_TRUCK||(this._state&h.TOUCH_DOLLY_SCREEN_PAN)===h.TOUCH_DOLLY_SCREEN_PAN||(this._state&h.TOUCH_ZOOM_SCREEN_PAN)===h.TOUCH_ZOOM_SCREEN_PAN||(this._state&h.TOUCH_DOLLY_OFFSET)===h.TOUCH_DOLLY_OFFSET||(this._state&h.TOUCH_ZOOM_OFFSET)===h.TOUCH_ZOOM_OFFSET||(this._state&h.TOUCH_DOLLY_ROTATE)===h.TOUCH_DOLLY_ROTATE||(this._state&h.TOUCH_ZOOM_ROTATE)===h.TOUCH_ZOOM_ROTATE){const t=P.x-this._activePointers[1].clientX,e=P.y-this._activePointers[1].clientY,s=Math.sqrt(t*t+e*e),n=r.y-s;r.set(0,s);const o=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,a=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&h.TOUCH_DOLLY)===h.TOUCH_DOLLY||(this._state&h.TOUCH_DOLLY_ROTATE)===h.TOUCH_DOLLY_ROTATE||(this._state&h.TOUCH_DOLLY_TRUCK)===h.TOUCH_DOLLY_TRUCK||(this._state&h.TOUCH_DOLLY_SCREEN_PAN)===h.TOUCH_DOLLY_SCREEN_PAN||(this._state&h.TOUCH_DOLLY_OFFSET)===h.TOUCH_DOLLY_OFFSET?(this._dollyInternal(n*C,o,a),this._isUserControllingDolly=!0):(this._zoomInternal(n*C,o,a),this._isUserControllingZoom=!0)}(this._state&h.TRUCK)!==h.TRUCK&&(this._state&h.TOUCH_TRUCK)!==h.TOUCH_TRUCK&&(this._state&h.TOUCH_DOLLY_TRUCK)!==h.TOUCH_DOLLY_TRUCK&&(this._state&h.TOUCH_ZOOM_TRUCK)!==h.TOUCH_ZOOM_TRUCK||(this._truckInternal(n,o,!1,!1),this._isUserControllingTruck=!0),(this._state&h.SCREEN_PAN)!==h.SCREEN_PAN&&(this._state&h.TOUCH_SCREEN_PAN)!==h.TOUCH_SCREEN_PAN&&(this._state&h.TOUCH_DOLLY_SCREEN_PAN)!==h.TOUCH_DOLLY_SCREEN_PAN&&(this._state&h.TOUCH_ZOOM_SCREEN_PAN)!==h.TOUCH_ZOOM_SCREEN_PAN||(this._truckInternal(n,o,!1,!0),this._isUserControllingTruck=!0),(this._state&h.OFFSET)!==h.OFFSET&&(this._state&h.TOUCH_OFFSET)!==h.TOUCH_OFFSET&&(this._state&h.TOUCH_DOLLY_OFFSET)!==h.TOUCH_DOLLY_OFFSET&&(this._state&h.TOUCH_ZOOM_OFFSET)!==h.TOUCH_ZOOM_OFFSET||(this._truckInternal(n,o,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},w=()=>{v(this._activePointers,P),i.copy(P),this._dragNeedsUpdate=!1,(0===this._activePointers.length||1===this._activePointers.length&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),0===this._activePointers.length&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{this._enabled&&this._domElement&&(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",T),this._domElement.ownerDocument.addEventListener("pointerlockerror",M),this._domElement.ownerDocument.addEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",p),x())},this.unlockPointer=()=>{var t,e,s;null!==this._lockedPointer&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),null===(t=this._domElement)||void 0===t||t.ownerDocument.exitPointerLock(),null===(e=this._domElement)||void 0===e||e.ownerDocument.removeEventListener("pointerlockchange",T),null===(s=this._domElement)||void 0===s||s.ownerDocument.removeEventListener("pointerlockerror",M),this.cancel()};const T=()=>{const t=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement;t||this.unlockPointer()},M=()=>{this.unlockPointer()};this._addAllEventListeners=t=>{this._domElement=t,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",n),this._domElement.addEventListener("pointercancel",p),this._domElement.addEventListener("wheel",g,{passive:!1}),this._domElement.addEventListener("contextmenu",_)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",n),this._domElement.removeEventListener("pointercancel",p),this._domElement.removeEventListener("wheel",g,{passive:!1}),this._domElement.removeEventListener("contextmenu",_),this._domElement.ownerDocument.removeEventListener("pointermove",o,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",p),this._domElement.ownerDocument.removeEventListener("pointerlockchange",T),this._domElement.ownerDocument.removeEventListener("pointerlockerror",M))},this.cancel=()=>{this._state!==h.NONE&&(this._state=h.NONE,this._activePointers.length=0,w())},e&&this.connect(e),this.update(0)}get camera(){return this._camera}set camera(t){this._camera=t,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(t){this._enabled=t,this._domElement&&(t?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(t){this._spherical.radius===t&&this._sphericalEnd.radius===t||(this._spherical.radius=t,this._sphericalEnd.radius=t,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(t){this._spherical.theta===t&&this._sphericalEnd.theta===t||(this._spherical.theta=t,this._sphericalEnd.theta=t,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(t){this._spherical.phi===t&&this._sphericalEnd.phi===t||(this._spherical.phi=t,this._sphericalEnd.phi=t,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(t){this._boundaryEnclosesCamera=t,this._needsUpdate=!0}set interactiveArea(t){this._interactiveArea.width=f(t.width,0,1),this._interactiveArea.height=f(t.height,0,1),this._interactiveArea.x=f(t.x,0,1-this._interactiveArea.width),this._interactiveArea.y=f(t.y,0,1-this._interactiveArea.height)}addEventListener(t,e){super.addEventListener(t,e)}removeEventListener(t,e){super.removeEventListener(t,e)}rotate(t,e,s=!1){return this.rotateTo(this._sphericalEnd.theta+t,this._sphericalEnd.phi+e,s)}rotateAzimuthTo(t,e=!1){return this.rotateTo(t,this._sphericalEnd.phi,e)}rotatePolarTo(t,e=!1){return this.rotateTo(this._sphericalEnd.theta,t,e)}rotateTo(t,e,s=!1){this._isUserControllingRotate=!1;const i=f(t,this.minAzimuthAngle,this.maxAzimuthAngle),r=f(e,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=r,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,s||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const n=!s||_(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&_(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(n)}dolly(t,e=!1){return this.dollyTo(this._sphericalEnd.radius-t,e)}dollyTo(t,e=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=l.NONE,this._changedDolly=0,this._dollyToNoClamp(f(t,this.minDistance,this.maxDistance),e)}_dollyToNoClamp(t,e=!1){const s=this._sphericalEnd.radius,i=this.colliderMeshes.length>=1;if(i){const e=this._collisionTest(),i=_(e,this._spherical.radius),r=s>t;if(!r&&i)return Promise.resolve();this._sphericalEnd.radius=Math.min(t,e)}else this._sphericalEnd.radius=t;this._needsUpdate=!0,e||(this._spherical.radius=this._sphericalEnd.radius);const r=!e||_(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(r)}dollyInFixed(t,e=!1){this._targetEnd.add(this._getCameraDirection(F).multiplyScalar(t)),e||this._target.copy(this._targetEnd);const s=!e||_(this._target.x,this._targetEnd.x,this.restThreshold)&&_(this._target.y,this._targetEnd.y,this.restThreshold)&&_(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}zoom(t,e=!1){return this.zoomTo(this._zoomEnd+t,e)}zoomTo(t,e=!1){this._isUserControllingZoom=!1,this._zoomEnd=f(t,this.minZoom,this.maxZoom),this._needsUpdate=!0,e||(this._zoom=this._zoomEnd);const s=!e||_(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(s)}pan(t,e,s=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(t,e,s)}truck(t,e,s=!1){this._camera.updateMatrix(),D.setFromMatrixColumn(this._camera.matrix,0),H.setFromMatrixColumn(this._camera.matrix,1),D.multiplyScalar(t),H.multiplyScalar(-e);const i=N.copy(D).add(H),r=U.copy(this._targetEnd).add(i);return this.moveTo(r.x,r.y,r.z,s)}forward(t,e=!1){N.setFromMatrixColumn(this._camera.matrix,0),N.crossVectors(this._camera.up,N),N.multiplyScalar(t);const s=U.copy(this._targetEnd).add(N);return this.moveTo(s.x,s.y,s.z,e)}elevate(t,e=!1){return N.copy(this._camera.up).multiplyScalar(t),this.moveTo(this._targetEnd.x+N.x,this._targetEnd.y+N.y,this._targetEnd.z+N.z,e)}moveTo(t,e,s,i=!1){this._isUserControllingTruck=!1;const r=N.set(t,e,s).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,r,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const n=!i||_(this._target.x,this._targetEnd.x,this.restThreshold)&&_(this._target.y,this._targetEnd.y,this.restThreshold)&&_(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}lookInDirectionOf(t,e,s,i=!1){const r=N.set(t,e,s),n=r.sub(this._targetEnd).normalize(),o=n.multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(o.x,o.y,o.z,i)}fitToBox(t,e,{cover:s=!1,paddingLeft:i=0,paddingRight:r=0,paddingBottom:n=0,paddingTop:o=0}={}){const a=[],h=t.isBox3?q.copy(t):q.setFromObject(t);h.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const l=x(this._sphericalEnd.theta,p),d=x(this._sphericalEnd.phi,p);a.push(this.rotateTo(l,d,e));const m=N.setFromSpherical(this._sphericalEnd).normalize(),y=K.setFromUnitVectors(m,I),f=_(Math.abs(m.y),1);f&&y.multiply(J.setFromAxisAngle(k,l)),y.multiply(this._yAxisUpSpaceInverse);const g=Z.makeEmpty();U.copy(h.min).applyQuaternion(y),g.expandByPoint(U),U.copy(h.min).setX(h.max.x).applyQuaternion(y),g.expandByPoint(U),U.copy(h.min).setY(h.max.y).applyQuaternion(y),g.expandByPoint(U),U.copy(h.max).setZ(h.min.z).applyQuaternion(y),g.expandByPoint(U),U.copy(h.min).setZ(h.max.z).applyQuaternion(y),g.expandByPoint(U),U.copy(h.max).setY(h.min.y).applyQuaternion(y),g.expandByPoint(U),U.copy(h.max).setX(h.min.x).applyQuaternion(y),g.expandByPoint(U),U.copy(h.max).applyQuaternion(y),g.expandByPoint(U),g.min.x-=i,g.min.y-=n,g.max.x+=r,g.max.y+=o,y.setFromUnitVectors(I,m),f&&y.premultiply(J.invert()),y.premultiply(this._yAxisUpSpace);const b=g.getSize(N),w=g.getCenter(U).applyQuaternion(y);if(c(this._camera)){const t=this.getDistanceToFitBox(b.x,b.y,b.z,s);a.push(this.moveTo(w.x,w.y,w.z,e)),a.push(this.dollyTo(t,e)),a.push(this.setFocalOffset(0,0,0,e))}else if(u(this._camera)){const t=this._camera,i=t.right-t.left,r=t.top-t.bottom,n=s?Math.max(i/b.x,r/b.y):Math.min(i/b.x,r/b.y);a.push(this.moveTo(w.x,w.y,w.z,e)),a.push(this.zoomTo(n,e)),a.push(this.setFocalOffset(0,0,0,e))}return Promise.all(a)}fitToSphere(t,e){const s=[],i="isObject3D"in t,r=i?tt.createBoundingSphere(t,G):G.copy(t);if(s.push(this.moveTo(r.center.x,r.center.y,r.center.z,e)),c(this._camera)){const t=this.getDistanceToFitSphere(r.radius);s.push(this.dollyTo(t,e))}else if(u(this._camera)){const t=this._camera.right-this._camera.left,i=this._camera.top-this._camera.bottom,n=2*r.radius,o=Math.min(t/n,i/n);s.push(this.zoomTo(o,e))}return s.push(this.setFocalOffset(0,0,0,e)),Promise.all(s)}setLookAt(t,e,s,i,r,n,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=l.NONE,this._changedDolly=0;const a=U.set(i,r,n),h=N.set(t,e,s);this._targetEnd.copy(a),this._sphericalEnd.setFromVector3(h.sub(a).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const c=!o||_(this._target.x,this._targetEnd.x,this.restThreshold)&&_(this._target.y,this._targetEnd.y,this.restThreshold)&&_(this._target.z,this._targetEnd.z,this.restThreshold)&&_(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&_(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&_(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(c)}lerpLookAt(t,e,s,i,r,n,o,a,h,c,u,d,p,m=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=l.NONE,this._changedDolly=0;const y=N.set(i,r,n),f=U.set(t,e,s);Y.setFromVector3(f.sub(y).applyQuaternion(this._yAxisUpSpace));const g=B.set(c,u,d),x=U.set(o,a,h);X.setFromVector3(x.sub(g).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(y.lerp(g,p));const b=X.theta-Y.theta,w=X.phi-Y.phi,T=X.radius-Y.radius;this._sphericalEnd.set(Y.radius+T*p,Y.phi+w*p,Y.theta+b*p),this.normalizeRotations(),this._needsUpdate=!0,m||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const M=!m||_(this._target.x,this._targetEnd.x,this.restThreshold)&&_(this._target.y,this._targetEnd.y,this.restThreshold)&&_(this._target.z,this._targetEnd.z,this.restThreshold)&&_(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&_(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&_(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(M)}setPosition(t,e,s,i=!1){return this.setLookAt(t,e,s,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(t,e,s,i=!1){const r=this.getPosition(N),n=this.setLookAt(r.x,r.y,r.z,t,e,s,i);return this._sphericalEnd.phi=f(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),n}setFocalOffset(t,e,s,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(t,e,s),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const r=!i||_(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&_(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&_(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(r)}setOrbitPoint(t,e,s){this._camera.updateMatrixWorld(),D.setFromMatrixColumn(this._camera.matrixWorldInverse,0),H.setFromMatrixColumn(this._camera.matrixWorldInverse,1),V.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=N.set(t,e,s),r=i.distanceTo(this._camera.position),n=i.sub(this._camera.position);D.multiplyScalar(n.x),H.multiplyScalar(n.y),V.multiplyScalar(n.z),N.copy(D).add(H).add(V),N.z=N.z+r,this.dollyTo(r,!1),this.setFocalOffset(-N.x,N.y,-N.z,!1),this.moveTo(t,e,s,!1)}setBoundary(t){if(!t)return this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),void(this._needsUpdate=!0);this._boundary.copy(t),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(t,e,s,i){null!==t?(this._viewport=this._viewport||new z.Vector4,"number"===typeof t?this._viewport.set(t,e,s,i):this._viewport.copy(t)):this._viewport=null}getDistanceToFitBox(t,e,s,i=!1){if(A(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const r=t/e,n=this._camera.getEffectiveFOV()*y,o=this._camera.aspect,a=(i?r>o:r<o)?e:t/o;return.5*a/Math.tan(.5*n)+.5*s}getDistanceToFitSphere(t){if(A(this._camera,"getDistanceToFitSphere"))return this._spherical.radius;const e=this._camera.getEffectiveFOV()*y,s=2*Math.atan(Math.tan(.5*e)*this._camera.aspect),i=1<this._camera.aspect?e:s;return t/Math.sin(.5*i)}getTarget(t,e=!0){const s=t&&t.isVector3?t:new z.Vector3;return s.copy(e?this._targetEnd:this._target)}getPosition(t,e=!0){const s=t&&t.isVector3?t:new z.Vector3;return s.setFromSpherical(e?this._sphericalEnd:this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(e?this._targetEnd:this._target)}getSpherical(t,e=!0){const s=t||new z.Spherical;return s.copy(e?this._sphericalEnd:this._spherical)}getFocalOffset(t,e=!0){const s=t&&t.isVector3?t:new z.Vector3;return s.copy(e?this._focalOffsetEnd:this._focalOffset)}normalizeRotations(){this._sphericalEnd.theta=this._sphericalEnd.theta%d,this._sphericalEnd.theta<0&&(this._sphericalEnd.theta+=d),this._spherical.theta+=d*Math.round((this._sphericalEnd.theta-this._spherical.theta)/d)}stop(){this._focalOffset.copy(this._focalOffsetEnd),this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd),this._zoom=this._zoomEnd}reset(t=!1){if(!_(this._camera.up.x,this._cameraUp0.x)||!_(this._camera.up.y,this._cameraUp0.y)||!_(this._camera.up.z,this._cameraUp0.z)){this._camera.up.copy(this._cameraUp0);const t=this.getPosition(N);this.updateCameraUp(),this.setPosition(t.x,t.y,t.z)}const e=[this.setLookAt(this._position0.x,this._position0.y,this._position0.z,this._target0.x,this._target0.y,this._target0.z,t),this.setFocalOffset(this._focalOffset0.x,this._focalOffset0.y,this._focalOffset0.z,t),this.zoomTo(this._zoom0,t)];return Promise.all(e)}saveState(){this._cameraUp0.copy(this._camera.up),this.getTarget(this._target0),this.getPosition(this._position0),this._zoom0=this._zoom,this._focalOffset0.copy(this._focalOffset)}updateCameraUp(){this._yAxisUpSpace.setFromUnitVectors(this._camera.up,k),this._yAxisUpSpaceInverse.copy(this._yAxisUpSpace).invert()}applyCameraUp(){const t=N.subVectors(this._target,this._camera.position).normalize(),e=U.crossVectors(t,this._camera.up);this._camera.up.crossVectors(e,t).normalize(),this._camera.updateMatrixWorld();const s=this.getPosition(N);this.updateCameraUp(),this.setPosition(s.x,s.y,s.z)}update(t){const e=this._sphericalEnd.theta-this._spherical.theta,s=this._sphericalEnd.phi-this._spherical.phi,i=this._sphericalEnd.radius-this._spherical.radius,r=j.subVectors(this._targetEnd,this._target),n=W.subVectors(this._focalOffsetEnd,this._focalOffset),o=this._zoomEnd-this._zoom;if(g(e))this._thetaVelocity.value=0,this._spherical.theta=this._sphericalEnd.theta;else{const e=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.theta=T(this._spherical.theta,this._sphericalEnd.theta,this._thetaVelocity,e,1/0,t),this._needsUpdate=!0}if(g(s))this._phiVelocity.value=0,this._spherical.phi=this._sphericalEnd.phi;else{const e=this._isUserControllingRotate?this.draggingSmoothTime:this.smoothTime;this._spherical.phi=T(this._spherical.phi,this._sphericalEnd.phi,this._phiVelocity,e,1/0,t),this._needsUpdate=!0}if(g(i))this._radiusVelocity.value=0,this._spherical.radius=this._sphericalEnd.radius;else{const e=this._isUserControllingDolly?this.draggingSmoothTime:this.smoothTime;this._spherical.radius=T(this._spherical.radius,this._sphericalEnd.radius,this._radiusVelocity,e,this.maxSpeed,t),this._needsUpdate=!0}if(g(r.x)&&g(r.y)&&g(r.z))this._targetVelocity.set(0,0,0),this._target.copy(this._targetEnd);else{const e=this._isUserControllingTruck?this.draggingSmoothTime:this.smoothTime;M(this._target,this._targetEnd,this._targetVelocity,e,this.maxSpeed,t,this._target),this._needsUpdate=!0}if(g(n.x)&&g(n.y)&&g(n.z))this._focalOffsetVelocity.set(0,0,0),this._focalOffset.copy(this._focalOffsetEnd);else{const e=this._isUserControllingOffset?this.draggingSmoothTime:this.smoothTime;M(this._focalOffset,this._focalOffsetEnd,this._focalOffsetVelocity,e,this.maxSpeed,t,this._focalOffset),this._needsUpdate=!0}if(g(o))this._zoomVelocity.value=0,this._zoom=this._zoomEnd;else{const e=this._isUserControllingZoom?this.draggingSmoothTime:this.smoothTime;this._zoom=T(this._zoom,this._zoomEnd,this._zoomVelocity,e,1/0,t)}if(this.dollyToCursor)if(c(this._camera)&&0!==this._changedDolly){const t=this._spherical.radius-this._lastDistance,e=this._camera,s=this._getCameraDirection(F),i=N.copy(s).cross(e.up).normalize();0===i.lengthSq()&&(i.x=1);const r=U.crossVectors(i,s),n=this._sphericalEnd.radius*Math.tan(e.getEffectiveFOV()*y*.5),o=this._sphericalEnd.radius-t,a=(o-this._sphericalEnd.radius)/this._sphericalEnd.radius,h=B.copy(this._targetEnd).add(i.multiplyScalar(this._dollyControlCoord.x*n*e.aspect)).add(r.multiplyScalar(this._dollyControlCoord.y*n)),c=N.copy(this._targetEnd).lerp(h,a),u=this._lastDollyDirection===l.IN&&this._spherical.radius<=this.minDistance,d=this._lastDollyDirection===l.OUT&&this.maxDistance<=this._spherical.radius;if(this.infinityDolly&&(u||d)){this._sphericalEnd.radius-=t,this._spherical.radius-=t;const e=U.copy(s).multiplyScalar(-t);c.add(e)}this._boundary.clampPoint(c,c);const p=U.subVectors(c,this._targetEnd);this._targetEnd.copy(c),this._target.add(p),this._changedDolly-=t,g(this._changedDolly)&&(this._changedDolly=0)}else if(u(this._camera)&&0!==this._changedZoom){const t=this._zoom-this._lastZoom,e=this._camera,s=N.set(this._dollyControlCoord.x,this._dollyControlCoord.y,(e.near+e.far)/(e.near-e.far)).unproject(e),i=U.set(0,0,-1).applyQuaternion(e.quaternion),r=B.copy(s).add(i.multiplyScalar(-s.dot(e.up))),n=this._zoom-t,o=-(n-this._zoom)/this._zoom,a=this._getCameraDirection(F),h=this._targetEnd.dot(a),l=N.copy(this._targetEnd).lerp(r,o),c=l.dot(a),u=a.multiplyScalar(c-h);l.sub(u),this._boundary.clampPoint(l,l);const d=U.subVectors(l,this._targetEnd);this._targetEnd.copy(l),this._target.add(d),this._changedZoom-=t,g(this._changedZoom)&&(this._changedZoom=0)}this._camera.zoom!==this._zoom&&(this._camera.zoom=this._zoom,this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0),this._dragNeedsUpdate=!0;const a=this._collisionTest();this._spherical.radius=Math.min(this._spherical.radius,a),this._spherical.makeSafe(),this._camera.position.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse).add(this._target),this._camera.lookAt(this._target);const h=!g(this._focalOffset.x)||!g(this._focalOffset.y)||!g(this._focalOffset.z);h&&(D.setFromMatrixColumn(this._camera.matrix,0),H.setFromMatrixColumn(this._camera.matrix,1),V.setFromMatrixColumn(this._camera.matrix,2),D.multiplyScalar(this._focalOffset.x),H.multiplyScalar(-this._focalOffset.y),V.multiplyScalar(this._focalOffset.z),N.copy(D).add(H).add(V),this._camera.position.add(N),this._camera.updateMatrixWorld()),this._boundaryEnclosesCamera&&this._encloseToBoundary(this._camera.position.copy(this._target),N.setFromSpherical(this._spherical).applyQuaternion(this._yAxisUpSpaceInverse),1);const d=this._needsUpdate;return d&&!this._updatedLastTime?(this._hasRested=!1,this.dispatchEvent({type:"wake"}),this.dispatchEvent({type:"update"})):d?(this.dispatchEvent({type:"update"}),g(e,this.restThreshold)&&g(s,this.restThreshold)&&g(i,this.restThreshold)&&g(r.x,this.restThreshold)&&g(r.y,this.restThreshold)&&g(r.z,this.restThreshold)&&g(n.x,this.restThreshold)&&g(n.y,this.restThreshold)&&g(n.z,this.restThreshold)&&g(o,this.restThreshold)&&!this._hasRested&&(this._hasRested=!0,this.dispatchEvent({type:"rest"}))):!d&&this._updatedLastTime&&this.dispatchEvent({type:"sleep"}),this._lastDistance=this._spherical.radius,this._lastZoom=this._zoom,this._updatedLastTime=d,this._needsUpdate=!1,d}toJSON(){return JSON.stringify({enabled:this._enabled,minDistance:this.minDistance,maxDistance:b(this.maxDistance),minZoom:this.minZoom,maxZoom:b(this.maxZoom),minPolarAngle:this.minPolarAngle,maxPolarAngle:b(this.maxPolarAngle),minAzimuthAngle:b(this.minAzimuthAngle),maxAzimuthAngle:b(this.maxAzimuthAngle),smoothTime:this.smoothTime,draggingSmoothTime:this.draggingSmoothTime,dollySpeed:this.dollySpeed,truckSpeed:this.truckSpeed,dollyToCursor:this.dollyToCursor,target:this._targetEnd.toArray(),position:N.setFromSpherical(this._sphericalEnd).add(this._targetEnd).toArray(),zoom:this._zoomEnd,focalOffset:this._focalOffsetEnd.toArray(),target0:this._target0.toArray(),position0:this._position0.toArray(),zoom0:this._zoom0,focalOffset0:this._focalOffset0.toArray()})}fromJSON(t,e=!1){const s=JSON.parse(t);this.enabled=s.enabled,this.minDistance=s.minDistance,this.maxDistance=w(s.maxDistance),this.minZoom=s.minZoom,this.maxZoom=w(s.maxZoom),this.minPolarAngle=s.minPolarAngle,this.maxPolarAngle=w(s.maxPolarAngle),this.minAzimuthAngle=w(s.minAzimuthAngle),this.maxAzimuthAngle=w(s.maxAzimuthAngle),this.smoothTime=s.smoothTime,this.draggingSmoothTime=s.draggingSmoothTime,this.dollySpeed=s.dollySpeed,this.truckSpeed=s.truckSpeed,this.dollyToCursor=s.dollyToCursor,this._target0.fromArray(s.target0),this._position0.fromArray(s.position0),this._zoom0=s.zoom0,this._focalOffset0.fromArray(s.focalOffset0),this.moveTo(s.target[0],s.target[1],s.target[2],e),Y.setFromVector3(N.fromArray(s.position).sub(this._targetEnd).applyQuaternion(this._yAxisUpSpace)),this.rotateTo(Y.theta,Y.phi,e),this.dollyTo(Y.radius,e),this.zoomTo(s.zoom,e),this.setFocalOffset(s.focalOffset[0],s.focalOffset[1],s.focalOffset[2],e),this._needsUpdate=!0}connect(t){this._domElement?console.warn("camera-controls is already connected."):(t.setAttribute("data-camera-controls-version",O),this._addAllEventListeners(t),this._getClientRect(this._elementRect))}disconnect(){this.cancel(),this._removeAllEventListeners(),this._domElement&&(this._domElement.removeAttribute("data-camera-controls-version"),this._domElement=void 0)}dispose(){this.removeAllEventListeners(),this.disconnect()}_getTargetDirection(t){return t.setFromSpherical(this._spherical).divideScalar(this._spherical.radius).applyQuaternion(this._yAxisUpSpaceInverse)}_getCameraDirection(t){return this._getTargetDirection(t).negate()}_findPointerById(t){return this._activePointers.find(e=>e.pointerId===t)}_findPointerByMouseButton(t){return this._activePointers.find(e=>e.mouseButton===t)}_disposePointer(t){this._activePointers.splice(this._activePointers.indexOf(t),1)}_encloseToBoundary(t,e,s){const i=e.lengthSq();if(0===i)return t;const r=U.copy(e).add(t),n=this._boundary.clampPoint(r,B),o=n.sub(r),a=o.lengthSq();if(0===a)return t.add(e);if(a===i)return t;if(0===s)return t.add(e).add(o);{const i=1+s*a/e.dot(o);return t.add(U.copy(e).multiplyScalar(i)).add(o.multiplyScalar(1-s))}}_updateNearPlaneCorners(){if(c(this._camera)){const t=this._camera,e=t.near,s=t.getEffectiveFOV()*y,i=Math.tan(.5*s)*e,r=i*t.aspect;this._nearPlaneCorners[0].set(-r,-i,0),this._nearPlaneCorners[1].set(r,-i,0),this._nearPlaneCorners[2].set(r,i,0),this._nearPlaneCorners[3].set(-r,i,0)}else if(u(this._camera)){const t=this._camera,e=1/t.zoom,s=t.left*e,i=t.right*e,r=t.top*e,n=t.bottom*e;this._nearPlaneCorners[0].set(s,r,0),this._nearPlaneCorners[1].set(i,r,0),this._nearPlaneCorners[2].set(i,n,0),this._nearPlaneCorners[3].set(s,n,0)}}_collisionTest(){let t=1/0;const e=this.colliderMeshes.length>=1;if(!e)return t;if(A(this._camera,"_collisionTest"))return t;const s=this._getTargetDirection(F);Q.lookAt(L,s,this._camera.up);for(let i=0;i<4;i++){const e=U.copy(this._nearPlaneCorners[i]);e.applyMatrix4(Q);const r=B.addVectors(this._target,e);$.set(r,s),$.far=this._spherical.radius+1;const n=$.intersectObjects(this.colliderMeshes);0!==n.length&&n[0].distance<t&&(t=n[0].distance)}return t}_getClientRect(t){if(!this._domElement)return;const e=this._domElement.getBoundingClientRect();return t.x=e.left,t.y=e.top,this._viewport?(t.x+=this._viewport.x,t.y+=e.height-this._viewport.w-this._viewport.y,t.width=this._viewport.z,t.height=this._viewport.w):(t.width=e.width,t.height=e.height),t}_createOnRestPromise(t){return t?Promise.resolve():(this._hasRested=!1,this.dispatchEvent({type:"transitionstart"}),new Promise(t=>{const e=()=>{this.removeEventListener("rest",e),t()};this.addEventListener("rest",e)}))}_addAllEventListeners(t){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(t){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(t){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(t,e=new z.Sphere){const s=e,i=s.center;q.makeEmpty(),t.traverseVisible(t=>{t.isMesh&&q.expandByObject(t)}),q.getCenter(i);let r=0;return t.traverseVisible(t=>{if(!t.isMesh)return;const e=t;if(!e.geometry)return;const s=e.geometry.clone();s.applyMatrix4(e.matrixWorld);const n=s,o=n.attributes.position;for(let a=0,h=o.count;a<h;a++)N.fromBufferAttribute(o,a),r=Math.max(r,i.distanceToSquared(N))}),s.radius=Math.sqrt(r),s}}
|
|
9
|
+
/**
|
|
10
|
+
* @license
|
|
11
|
+
* Copyright 2010-2025 Three.js Authors
|
|
12
|
+
* SPDX-License-Identifier: MIT
|
|
13
|
+
*/const et="175",st=0,it=1,rt=2,nt=1,ot=100,at=204,ht=205,lt=3,ct=0,ut="attached",dt="detached",pt=300,mt=1e3,yt=1001,ft=1002,gt=1003,_t=1004,xt=1005,bt=1006,wt=1007,Tt=1008,Mt=1009,vt=1015,At=1023,Et=1028,St=2300,Ot=2301,Ct=2302,Rt=2400,zt=2401,Lt=2402,kt=2500,It=0,Pt=1,Nt=2,Ut=0,Bt="",Ft="srgb",Dt="srgb-linear",Ht="linear",Vt="srgb",jt=7680,Wt=519,Yt=35044,Xt=2e3,qt=2001;class Zt{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const s=this._listeners;void 0===s[t]&&(s[t]=[]),-1===s[t].indexOf(e)&&s[t].push(e)}hasEventListener(t,e){const s=this._listeners;return void 0!==s&&(void 0!==s[t]&&-1!==s[t].indexOf(e))}removeEventListener(t,e){const s=this._listeners;if(void 0===s)return;const i=s[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const s=e[t.type];if(void 0!==s){t.target=this;const e=s.slice(0);for(let s=0,i=e.length;s<i;s++)e[s].call(this,t);t.target=null}}}const Gt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Kt=1234567;const Jt=Math.PI/180,Qt=180/Math.PI;function $t(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,s=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=Gt[255&t]+Gt[t>>8&255]+Gt[t>>16&255]+Gt[t>>24&255]+"-"+Gt[255&e]+Gt[e>>8&255]+"-"+Gt[e>>16&15|64]+Gt[e>>24&255]+"-"+Gt[63&s|128]+Gt[s>>8&255]+"-"+Gt[s>>16&255]+Gt[s>>24&255]+Gt[255&i]+Gt[i>>8&255]+Gt[i>>16&255]+Gt[i>>24&255];return r.toLowerCase()}function te(t,e,s){return Math.max(e,Math.min(s,t))}function ee(t,e){return(t%e+e)%e}function se(t,e,s,i,r){return i+(t-e)*(r-i)/(s-e)}function ie(t,e,s){return t!==e?(s-t)/(e-t):0}function re(t,e,s){return(1-s)*t+s*e}function ne(t,e,s,i){return re(t,e,1-Math.exp(-s*i))}function oe(t,e=1){return e-Math.abs(ee(t,2*e)-e)}function ae(t,e,s){return t<=e?0:t>=s?1:(t=(t-e)/(s-e),t*t*(3-2*t))}function he(t,e,s){return t<=e?0:t>=s?1:(t=(t-e)/(s-e),t*t*t*(t*(6*t-15)+10))}function le(t,e){return t+Math.floor(Math.random()*(e-t+1))}function ce(t,e){return t+Math.random()*(e-t)}function ue(t){return t*(.5-Math.random())}function de(t){void 0!==t&&(Kt=t);let e=Kt+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}function pe(t){return t*Jt}function me(t){return t*Qt}function ye(t){return 0===(t&t-1)&&0!==t}function fe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function ge(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function _e(t,e,s,i,r){const n=Math.cos,o=Math.sin,a=n(s/2),h=o(s/2),l=n((e+i)/2),c=o((e+i)/2),u=n((e-i)/2),d=o((e-i)/2),p=n((i-e)/2),m=o((i-e)/2);switch(r){case"XYX":t.set(a*c,h*u,h*d,a*l);break;case"YZY":t.set(h*d,a*c,h*u,a*l);break;case"ZXZ":t.set(h*u,h*d,a*c,a*l);break;case"XZX":t.set(a*c,h*m,h*p,a*l);break;case"YXY":t.set(h*p,a*c,h*m,a*l);break;case"ZYZ":t.set(h*m,h*p,a*c,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function xe(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function be(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const we={DEG2RAD:Jt,RAD2DEG:Qt,generateUUID:$t,clamp:te,euclideanModulo:ee,mapLinear:se,inverseLerp:ie,lerp:re,damp:ne,pingpong:oe,smoothstep:ae,smootherstep:he,randInt:le,randFloat:ce,randFloatSpread:ue,seededRandom:de,degToRad:pe,radToDeg:me,isPowerOfTwo:ye,ceilPowerOfTwo:fe,floorPowerOfTwo:ge,setQuaternionFromProperEuler:_e,normalize:be,denormalize:xe};class Te{constructor(t=0,e=0){Te.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,s=this.y,i=t.elements;return this.x=i[0]*e+i[3]*s+i[6],this.y=i[1]*e+i[4]*s+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=te(this.x,t.x,e.x),this.y=te(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=te(this.x,t,e),this.y=te(this.y,t,e),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(te(s,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){const t=Math.atan2(-this.y,-this.x)+Math.PI;return t}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(te(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y;return e*e+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const s=Math.cos(e),i=Math.sin(e),r=this.x-t.x,n=this.y-t.y;return this.x=r*s-n*i+t.x,this.y=r*i+n*s+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Me{constructor(t,e,s,i,r,n,o,a,h){Me.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,s,i,r,n,o,a,h)}set(t,e,s,i,r,n,o,a,h){const l=this.elements;return l[0]=t,l[1]=i,l[2]=o,l[3]=e,l[4]=r,l[5]=a,l[6]=s,l[7]=n,l[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],this}extractBasis(t,e,s){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),s.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,i=e.elements,r=this.elements,n=s[0],o=s[3],a=s[6],h=s[1],l=s[4],c=s[7],u=s[2],d=s[5],p=s[8],m=i[0],y=i[3],f=i[6],g=i[1],_=i[4],x=i[7],b=i[2],w=i[5],T=i[8];return r[0]=n*m+o*g+a*b,r[3]=n*y+o*_+a*w,r[6]=n*f+o*x+a*T,r[1]=h*m+l*g+c*b,r[4]=h*y+l*_+c*w,r[7]=h*f+l*x+c*T,r[2]=u*m+d*g+p*b,r[5]=u*y+d*_+p*w,r[8]=u*f+d*x+p*T,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],s=t[1],i=t[2],r=t[3],n=t[4],o=t[5],a=t[6],h=t[7],l=t[8];return e*n*l-e*o*h-s*r*l+s*o*a+i*r*h-i*n*a}invert(){const t=this.elements,e=t[0],s=t[1],i=t[2],r=t[3],n=t[4],o=t[5],a=t[6],h=t[7],l=t[8],c=l*n-o*h,u=o*a-l*r,d=h*r-n*a,p=e*c+s*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=c*m,t[1]=(i*h-l*s)*m,t[2]=(o*s-i*n)*m,t[3]=u*m,t[4]=(l*e-i*a)*m,t[5]=(i*r-o*e)*m,t[6]=d*m,t[7]=(s*a-h*e)*m,t[8]=(n*e-s*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,s,i,r,n,o){const a=Math.cos(r),h=Math.sin(r);return this.set(s*a,s*h,-s*(a*n+h*o)+n+t,-i*h,i*a,-i*(-h*n+a*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(ve.makeScale(t,e)),this}rotate(t){return this.premultiply(ve.makeRotation(-t)),this}translate(t,e){return this.premultiply(ve.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,s,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,s=t.elements;for(let i=0;i<9;i++)if(e[i]!==s[i])return!1;return!0}fromArray(t,e=0){for(let s=0;s<9;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const ve=new Me;function Ae(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function Ee(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}const Se=(new Me).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Oe=(new Me).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Ce(){const t={enabled:!0,workingColorSpace:Dt,spaces:{},convert:function(t,e,s){return!1!==this.enabled&&e!==s&&e&&s?(this.spaces[e].transfer===Vt&&(t.r=ze(t.r),t.g=ze(t.g),t.b=ze(t.b)),this.spaces[e].primaries!==this.spaces[s].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[s].fromXYZ)),this.spaces[s].transfer===Vt&&(t.r=Le(t.r),t.g=Le(t.g),t.b=Le(t.b)),t):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return t===Bt?Ht:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,s){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[s].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],s=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[Dt]:{primaries:e,whitePoint:i,transfer:Ht,toXYZ:Se,fromXYZ:Oe,luminanceCoefficients:s,workingColorSpaceConfig:{unpackColorSpace:Ft},outputColorSpaceConfig:{drawingBufferColorSpace:Ft}},[Ft]:{primaries:e,whitePoint:i,transfer:Vt,toXYZ:Se,fromXYZ:Oe,luminanceCoefficients:s,outputColorSpaceConfig:{drawingBufferColorSpace:Ft}}}),t}const Re=Ce();function ze(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Le(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let ke;class Ie{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"===typeof HTMLCanvasElement)return t.src;let s;if(t instanceof HTMLCanvasElement)s=t;else{void 0===ke&&(ke=Ee("canvas")),ke.width=t.width,ke.height=t.height;const e=ke.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),s=ke}return s.toDataURL(e)}static sRGBToLinear(t){if("undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap){const e=Ee("canvas");e.width=t.width,e.height=t.height;const s=e.getContext("2d");s.drawImage(t,0,0,t.width,t.height);const i=s.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t<r.length;t++)r[t]=255*ze(r[t]/255);return s.putImageData(i,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*ze(e[t]/255)):e[t]=ze(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let Pe=0;class Ne{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Pe++}),this.uuid=$t(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"===typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const s={uuid:this.uuid,url:""},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,s=i.length;e<s;e++)i[e].isDataTexture?t.push(Ue(i[e].image)):t.push(Ue(i[e]))}else t=Ue(i);s.url=t}return e||(t.images[this.uuid]=s),s}}function Ue(t){return"undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap?Ie.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Be=0;class Fe extends Zt{constructor(t=Fe.DEFAULT_IMAGE,e=Fe.DEFAULT_MAPPING,s=yt,i=yt,r=bt,n=Tt,o=At,a=Mt,h=Fe.DEFAULT_ANISOTROPY,l=Bt){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Be++}),this.uuid=$t(),this.name="",this.source=new Ne(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=s,this.wrapT=i,this.magFilter=r,this.minFilter=n,this.anisotropy=h,this.format=o,this.internalFormat=null,this.type=a,this.offset=new Te(0,0),this.repeat=new Te(1,1),this.center=new Te(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Me,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=l,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"===typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const s={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,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,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(s.userData=this.userData),e||(t.textures[this.uuid]=s),s}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==pt)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case mt:t.x=t.x-Math.floor(t.x);break;case yt:t.x=t.x<0?0:1;break;case ft:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case mt:t.y=t.y-Math.floor(t.y);break;case yt:t.y=t.y<0?0:1;break;case ft:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}Fe.DEFAULT_IMAGE=null,Fe.DEFAULT_MAPPING=pt,Fe.DEFAULT_ANISOTROPY=1;class De{constructor(t=0,e=0,s=0,i=1){De.prototype.isVector4=!0,this.x=t,this.y=e,this.z=s,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,s,i){return this.x=t,this.y=e,this.z=s,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,s=this.y,i=this.z,r=this.w,n=t.elements;return this.x=n[0]*e+n[4]*s+n[8]*i+n[12]*r,this.y=n[1]*e+n[5]*s+n[9]*i+n[13]*r,this.z=n[2]*e+n[6]*s+n[10]*i+n[14]*r,this.w=n[3]*e+n[7]*s+n[11]*i+n[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,s,i,r;const n=.01,o=.1,a=t.elements,h=a[0],l=a[4],c=a[8],u=a[1],d=a[5],p=a[9],m=a[2],y=a[6],f=a[10];if(Math.abs(l-u)<n&&Math.abs(c-m)<n&&Math.abs(p-y)<n){if(Math.abs(l+u)<o&&Math.abs(c+m)<o&&Math.abs(p+y)<o&&Math.abs(h+d+f-3)<o)return this.set(1,0,0,0),this;e=Math.PI;const t=(h+1)/2,a=(d+1)/2,g=(f+1)/2,_=(l+u)/4,x=(c+m)/4,b=(p+y)/4;return t>a&&t>g?t<n?(s=0,i=.707106781,r=.707106781):(s=Math.sqrt(t),i=_/s,r=x/s):a>g?a<n?(s=.707106781,i=0,r=.707106781):(i=Math.sqrt(a),s=_/i,r=b/i):g<n?(s=.707106781,i=.707106781,r=0):(r=Math.sqrt(g),s=x/r,i=b/r),this.set(s,i,r,e),this}let g=Math.sqrt((y-p)*(y-p)+(c-m)*(c-m)+(u-l)*(u-l));return Math.abs(g)<.001&&(g=1),this.x=(y-p)/g,this.y=(c-m)/g,this.z=(u-l)/g,this.w=Math.acos((h+d+f-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=te(this.x,t.x,e.x),this.y=te(this.y,t.y,e.y),this.z=te(this.z,t.z,e.z),this.w=te(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=te(this.x,t,e),this.y=te(this.y,t,e),this.z=te(this.z,t,e),this.w=te(this.w,t,e),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(te(s,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this.w=t.w+(e.w-t.w)*s,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class He{constructor(t=0,e=0,s=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=s,this._w=i}static slerpFlat(t,e,s,i,r,n,o){let a=s[i+0],h=s[i+1],l=s[i+2],c=s[i+3];const u=r[n+0],d=r[n+1],p=r[n+2],m=r[n+3];if(0===o)return t[e+0]=a,t[e+1]=h,t[e+2]=l,void(t[e+3]=c);if(1===o)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=m);if(c!==m||a!==u||h!==d||l!==p){let t=1-o;const e=a*u+h*d+l*p+c*m,s=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),n=Math.atan2(r,e*s);t=Math.sin(t*n)/r,o=Math.sin(o*n)/r}const r=o*s;if(a=a*t+u*r,h=h*t+d*r,l=l*t+p*r,c=c*t+m*r,t===1-o){const t=1/Math.sqrt(a*a+h*h+l*l+c*c);a*=t,h*=t,l*=t,c*=t}}t[e]=a,t[e+1]=h,t[e+2]=l,t[e+3]=c}static multiplyQuaternionsFlat(t,e,s,i,r,n){const o=s[i],a=s[i+1],h=s[i+2],l=s[i+3],c=r[n],u=r[n+1],d=r[n+2],p=r[n+3];return t[e]=o*p+l*c+a*d-h*u,t[e+1]=a*p+l*u+h*c-o*d,t[e+2]=h*p+l*d+o*u-a*c,t[e+3]=l*p-o*c-a*u-h*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,s,i){return this._x=t,this._y=e,this._z=s,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const s=t._x,i=t._y,r=t._z,n=t._order,o=Math.cos,a=Math.sin,h=o(s/2),l=o(i/2),c=o(r/2),u=a(s/2),d=a(i/2),p=a(r/2);switch(n){case"XYZ":this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p;break;case"YXZ":this._x=u*l*c+h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p;break;case"ZXY":this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c-u*d*p;break;case"ZYX":this._x=u*l*c-h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c+u*d*p;break;case"YZX":this._x=u*l*c+h*d*p,this._y=h*d*c+u*l*p,this._z=h*l*p-u*d*c,this._w=h*l*c-u*d*p;break;case"XZY":this._x=u*l*c-h*d*p,this._y=h*d*c-u*l*p,this._z=h*l*p+u*d*c,this._w=h*l*c+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const s=e/2,i=Math.sin(s);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(s),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,s=e[0],i=e[4],r=e[8],n=e[1],o=e[5],a=e[9],h=e[2],l=e[6],c=e[10],u=s+o+c;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(l-a)*t,this._y=(r-h)*t,this._z=(n-i)*t}else if(s>o&&s>c){const t=2*Math.sqrt(1+s-o-c);this._w=(l-a)/t,this._x=.25*t,this._y=(i+n)/t,this._z=(r+h)/t}else if(o>c){const t=2*Math.sqrt(1+o-s-c);this._w=(r-h)/t,this._x=(i+n)/t,this._y=.25*t,this._z=(a+l)/t}else{const t=2*Math.sqrt(1+c-s-o);this._w=(n-i)/t,this._x=(r+h)/t,this._y=(a+l)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let s=t.dot(e)+1;return s<Number.EPSILON?(s=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=s):(this._x=0,this._y=-t.z,this._z=t.y,this._w=s)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=s),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(te(this.dot(t),-1,1)))}rotateTowards(t,e){const s=this.angleTo(t);if(0===s)return this;const i=Math.min(1,e/s);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const s=t._x,i=t._y,r=t._z,n=t._w,o=e._x,a=e._y,h=e._z,l=e._w;return this._x=s*l+n*o+i*h-r*a,this._y=i*l+n*a+r*o-s*h,this._z=r*l+n*h+s*a-i*o,this._w=n*l-s*o-i*a-r*h,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const s=this._x,i=this._y,r=this._z,n=this._w;let o=n*t._w+s*t._x+i*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=n,this._x=s,this._y=i,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*n+e*this._w,this._x=t*s+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this}const h=Math.sqrt(a),l=Math.atan2(h,o),c=Math.sin((1-e)*l)/h,u=Math.sin(e*l)/h;return this._w=n*c+this._w*u,this._x=s*c+this._x*u,this._y=i*c+this._y*u,this._z=r*c+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,s){return this.copy(t).slerp(e,s)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),s=Math.random(),i=Math.sqrt(1-s),r=Math.sqrt(s);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Ve{constructor(t=0,e=0,s=0){Ve.prototype.isVector3=!0,this.x=t,this.y=e,this.z=s}set(t,e,s){return void 0===s&&(s=this.z),this.x=t,this.y=e,this.z=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(We.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(We.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,s=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*s+r[6]*i,this.y=r[1]*e+r[4]*s+r[7]*i,this.z=r[2]*e+r[5]*s+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,s=this.y,i=this.z,r=t.elements,n=1/(r[3]*e+r[7]*s+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*s+r[8]*i+r[12])*n,this.y=(r[1]*e+r[5]*s+r[9]*i+r[13])*n,this.z=(r[2]*e+r[6]*s+r[10]*i+r[14])*n,this}applyQuaternion(t){const e=this.x,s=this.y,i=this.z,r=t.x,n=t.y,o=t.z,a=t.w,h=2*(n*i-o*s),l=2*(o*e-r*i),c=2*(r*s-n*e);return this.x=e+a*h+n*c-o*l,this.y=s+a*l+o*h-r*c,this.z=i+a*c+r*l-n*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,s=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*s+r[8]*i,this.y=r[1]*e+r[5]*s+r[9]*i,this.z=r[2]*e+r[6]*s+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=te(this.x,t.x,e.x),this.y=te(this.y,t.y,e.y),this.z=te(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=te(this.x,t,e),this.y=te(this.y,t,e),this.z=te(this.z,t,e),this}clampLength(t,e){const s=this.length();return this.divideScalar(s||1).multiplyScalar(te(s,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,s){return this.x=t.x+(e.x-t.x)*s,this.y=t.y+(e.y-t.y)*s,this.z=t.z+(e.z-t.z)*s,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const s=t.x,i=t.y,r=t.z,n=e.x,o=e.y,a=e.z;return this.x=i*a-r*o,this.y=r*n-s*a,this.z=s*o-i*n,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const s=t.dot(this)/e;return this.copy(t).multiplyScalar(s)}projectOnPlane(t){return je.copy(this).projectOnVector(t),this.sub(je)}reflect(t){return this.sub(je.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const s=this.dot(t)/e;return Math.acos(te(s,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,s=this.y-t.y,i=this.z-t.z;return e*e+s*s+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,s){const i=Math.sin(e)*t;return this.x=i*Math.sin(s),this.y=Math.cos(e)*t,this.z=i*Math.cos(s),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,s){return this.x=t*Math.sin(e),this.y=s,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),s=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=s,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,s=Math.sqrt(1-e*e);return this.x=s*Math.cos(t),this.y=e,this.z=s*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const je=new Ve,We=new He;class Ye{constructor(t=new Ve(1/0,1/0,1/0),e=new Ve(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e+=3)this.expandByPoint(qe.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,s=t.count;e<s;e++)this.expandByPoint(qe.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,s=t.length;e<s;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const s=qe.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(s),this.max.copy(t).add(s),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const s=t.geometry;if(void 0!==s){const i=s.getAttribute("position");if(!0===e&&void 0!==i&&!0!==t.isInstancedMesh)for(let e=0,s=i.count;e<s;e++)!0===t.isMesh?t.getVertexPosition(e,qe):qe.fromBufferAttribute(i,e),qe.applyMatrix4(t.matrixWorld),this.expandByPoint(qe);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),Ze.copy(t.boundingBox)):(null===s.boundingBox&&s.computeBoundingBox(),Ze.copy(s.boundingBox)),Ze.applyMatrix4(t.matrixWorld),this.union(Ze)}const i=t.children;for(let r=0,n=i.length;r<n;r++)this.expandByObject(i[r],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,qe),qe.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,s;return t.normal.x>0?(e=t.normal.x*this.min.x,s=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,s=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,s+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,s+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,s+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,s+=t.normal.z*this.min.z),e<=-t.constant&&s>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(es),ss.subVectors(this.max,es),Ge.subVectors(t.a,es),Ke.subVectors(t.b,es),Je.subVectors(t.c,es),Qe.subVectors(Ke,Ge),$e.subVectors(Je,Ke),ts.subVectors(Ge,Je);let e=[0,-Qe.z,Qe.y,0,-$e.z,$e.y,0,-ts.z,ts.y,Qe.z,0,-Qe.x,$e.z,0,-$e.x,ts.z,0,-ts.x,-Qe.y,Qe.x,0,-$e.y,$e.x,0,-ts.y,ts.x,0];return!!ns(e,Ge,Ke,Je,ss)&&(e=[1,0,0,0,1,0,0,0,1],!!ns(e,Ge,Ke,Je,ss)&&(is.crossVectors(Qe,$e),e=[is.x,is.y,is.z],ns(e,Ge,Ke,Je,ss)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,qe).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(qe).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Xe[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Xe[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Xe[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Xe[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Xe[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Xe[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Xe[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Xe[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Xe)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Xe=[new Ve,new Ve,new Ve,new Ve,new Ve,new Ve,new Ve,new Ve],qe=new Ve,Ze=new Ye,Ge=new Ve,Ke=new Ve,Je=new Ve,Qe=new Ve,$e=new Ve,ts=new Ve,es=new Ve,ss=new Ve,is=new Ve,rs=new Ve;function ns(t,e,s,i,r){for(let n=0,o=t.length-3;n<=o;n+=3){rs.fromArray(t,n);const o=r.x*Math.abs(rs.x)+r.y*Math.abs(rs.y)+r.z*Math.abs(rs.z),a=e.dot(rs),h=s.dot(rs),l=i.dot(rs);if(Math.max(-Math.max(a,h,l),Math.min(a,h,l))>o)return!1}return!0}const os=new Ye,as=new Ve,hs=new Ve;class ls{constructor(t=new Ve,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const s=this.center;void 0!==e?s.copy(e):os.setFromPoints(t).getCenter(s);let i=0;for(let r=0,n=t.length;r<n;r++)i=Math.max(i,s.distanceToSquared(t[r]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const s=this.center.distanceToSquared(t);return e.copy(t),s>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;as.subVectors(t,this.center);const e=as.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),s=.5*(t-this.radius);this.center.addScaledVector(as,s/t),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(hs.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(as.copy(t.center).add(hs)),this.expandByPoint(as.copy(t.center).sub(hs))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const cs=new Ve,us=new Ve,ds=new Ve,ps=new Ve,ms=new Ve,ys=new Ve,fs=new Ve;class gs{constructor(t=new Ve,e=new Ve(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,cs)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const s=e.dot(this.direction);return s<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,s)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=cs.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(cs.copy(this.origin).addScaledVector(this.direction,e),cs.distanceToSquared(t))}distanceSqToSegment(t,e,s,i){us.copy(t).add(e).multiplyScalar(.5),ds.copy(e).sub(t).normalize(),ps.copy(this.origin).sub(us);const r=.5*t.distanceTo(e),n=-this.direction.dot(ds),o=ps.dot(this.direction),a=-ps.dot(ds),h=ps.lengthSq(),l=Math.abs(1-n*n);let c,u,d,p;if(l>0)if(c=n*a-o,u=n*o-a,p=r*l,c>=0)if(u>=-p)if(u<=p){const t=1/l;c*=t,u*=t,d=c*(c+n*u+2*o)+u*(n*c+u+2*a)+h}else u=r,c=Math.max(0,-(n*u+o)),d=-c*c+u*(u+2*a)+h;else u=-r,c=Math.max(0,-(n*u+o)),d=-c*c+u*(u+2*a)+h;else u<=-p?(c=Math.max(0,-(-n*r+o)),u=c>0?-r:Math.min(Math.max(-r,-a),r),d=-c*c+u*(u+2*a)+h):u<=p?(c=0,u=Math.min(Math.max(-r,-a),r),d=u*(u+2*a)+h):(c=Math.max(0,-(n*r+o)),u=c>0?r:Math.min(Math.max(-r,-a),r),d=-c*c+u*(u+2*a)+h);else u=n>0?-r:r,c=Math.max(0,-(n*u+o)),d=-c*c+u*(u+2*a)+h;return s&&s.copy(this.origin).addScaledVector(this.direction,c),i&&i.copy(us).addScaledVector(ds,u),d}intersectSphere(t,e){cs.subVectors(t.center,this.origin);const s=cs.dot(this.direction),i=cs.dot(cs)-s*s,r=t.radius*t.radius;if(i>r)return null;const n=Math.sqrt(r-i),o=s-n,a=s+n;return a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const s=-(this.origin.dot(t.normal)+t.constant)/e;return s>=0?s:null}intersectPlane(t,e){const s=this.distanceToPlane(t);return null===s?null:this.at(s,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;const s=t.normal.dot(this.direction);return s*e<0}intersectBox(t,e){let s,i,r,n,o,a;const h=1/this.direction.x,l=1/this.direction.y,c=1/this.direction.z,u=this.origin;return h>=0?(s=(t.min.x-u.x)*h,i=(t.max.x-u.x)*h):(s=(t.max.x-u.x)*h,i=(t.min.x-u.x)*h),l>=0?(r=(t.min.y-u.y)*l,n=(t.max.y-u.y)*l):(r=(t.max.y-u.y)*l,n=(t.min.y-u.y)*l),s>n||r>i?null:((r>s||isNaN(s))&&(s=r),(n<i||isNaN(i))&&(i=n),c>=0?(o=(t.min.z-u.z)*c,a=(t.max.z-u.z)*c):(o=(t.max.z-u.z)*c,a=(t.min.z-u.z)*c),s>a||o>i?null:((o>s||s!==s)&&(s=o),(a<i||i!==i)&&(i=a),i<0?null:this.at(s>=0?s:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,cs)}intersectTriangle(t,e,s,i,r){ms.subVectors(e,t),ys.subVectors(s,t),fs.crossVectors(ms,ys);let n,o=this.direction.dot(fs);if(o>0){if(i)return null;n=1}else{if(!(o<0))return null;n=-1,o=-o}ps.subVectors(this.origin,t);const a=n*this.direction.dot(ys.crossVectors(ps,ys));if(a<0)return null;const h=n*this.direction.dot(ms.cross(ps));if(h<0)return null;if(a+h>o)return null;const l=-n*ps.dot(fs);return l<0?null:this.at(l/o,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class _s{constructor(t,e,s,i,r,n,o,a,h,l,c,u,d,p,m,y){_s.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,s,i,r,n,o,a,h,l,c,u,d,p,m,y)}set(t,e,s,i,r,n,o,a,h,l,c,u,d,p,m,y){const f=this.elements;return f[0]=t,f[4]=e,f[8]=s,f[12]=i,f[1]=r,f[5]=n,f[9]=o,f[13]=a,f[2]=h,f[6]=l,f[10]=c,f[14]=u,f[3]=d,f[7]=p,f[11]=m,f[15]=y,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new _s).fromArray(this.elements)}copy(t){const e=this.elements,s=t.elements;return e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=s[3],e[4]=s[4],e[5]=s[5],e[6]=s[6],e[7]=s[7],e[8]=s[8],e[9]=s[9],e[10]=s[10],e[11]=s[11],e[12]=s[12],e[13]=s[13],e[14]=s[14],e[15]=s[15],this}copyPosition(t){const e=this.elements,s=t.elements;return e[12]=s[12],e[13]=s[13],e[14]=s[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,s){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),s.setFromMatrixColumn(this,2),this}makeBasis(t,e,s){return this.set(t.x,e.x,s.x,0,t.y,e.y,s.y,0,t.z,e.z,s.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,s=t.elements,i=1/xs.setFromMatrixColumn(t,0).length(),r=1/xs.setFromMatrixColumn(t,1).length(),n=1/xs.setFromMatrixColumn(t,2).length();return e[0]=s[0]*i,e[1]=s[1]*i,e[2]=s[2]*i,e[3]=0,e[4]=s[4]*r,e[5]=s[5]*r,e[6]=s[6]*r,e[7]=0,e[8]=s[8]*n,e[9]=s[9]*n,e[10]=s[10]*n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,s=t.x,i=t.y,r=t.z,n=Math.cos(s),o=Math.sin(s),a=Math.cos(i),h=Math.sin(i),l=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){const t=n*l,s=n*c,i=o*l,r=o*c;e[0]=a*l,e[4]=-a*c,e[8]=h,e[1]=s+i*h,e[5]=t-r*h,e[9]=-o*a,e[2]=r-t*h,e[6]=i+s*h,e[10]=n*a}else if("YXZ"===t.order){const t=a*l,s=a*c,i=h*l,r=h*c;e[0]=t+r*o,e[4]=i*o-s,e[8]=n*h,e[1]=n*c,e[5]=n*l,e[9]=-o,e[2]=s*o-i,e[6]=r+t*o,e[10]=n*a}else if("ZXY"===t.order){const t=a*l,s=a*c,i=h*l,r=h*c;e[0]=t-r*o,e[4]=-n*c,e[8]=i+s*o,e[1]=s+i*o,e[5]=n*l,e[9]=r-t*o,e[2]=-n*h,e[6]=o,e[10]=n*a}else if("ZYX"===t.order){const t=n*l,s=n*c,i=o*l,r=o*c;e[0]=a*l,e[4]=i*h-s,e[8]=t*h+r,e[1]=a*c,e[5]=r*h+t,e[9]=s*h-i,e[2]=-h,e[6]=o*a,e[10]=n*a}else if("YZX"===t.order){const t=n*a,s=n*h,i=o*a,r=o*h;e[0]=a*l,e[4]=r-t*c,e[8]=i*c+s,e[1]=c,e[5]=n*l,e[9]=-o*l,e[2]=-h*l,e[6]=s*c+i,e[10]=t-r*c}else if("XZY"===t.order){const t=n*a,s=n*h,i=o*a,r=o*h;e[0]=a*l,e[4]=-c,e[8]=h*l,e[1]=t*c+r,e[5]=n*l,e[9]=s*c-i,e[2]=i*c-s,e[6]=o*l,e[10]=r*c+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(ws,t,Ts)}lookAt(t,e,s){const i=this.elements;return As.subVectors(t,e),0===As.lengthSq()&&(As.z=1),As.normalize(),Ms.crossVectors(s,As),0===Ms.lengthSq()&&(1===Math.abs(s.z)?As.x+=1e-4:As.z+=1e-4,As.normalize(),Ms.crossVectors(s,As)),Ms.normalize(),vs.crossVectors(As,Ms),i[0]=Ms.x,i[4]=vs.x,i[8]=As.x,i[1]=Ms.y,i[5]=vs.y,i[9]=As.y,i[2]=Ms.z,i[6]=vs.z,i[10]=As.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const s=t.elements,i=e.elements,r=this.elements,n=s[0],o=s[4],a=s[8],h=s[12],l=s[1],c=s[5],u=s[9],d=s[13],p=s[2],m=s[6],y=s[10],f=s[14],g=s[3],_=s[7],x=s[11],b=s[15],w=i[0],T=i[4],M=i[8],v=i[12],A=i[1],E=i[5],S=i[9],O=i[13],C=i[2],R=i[6],z=i[10],L=i[14],k=i[3],I=i[7],P=i[11],N=i[15];return r[0]=n*w+o*A+a*C+h*k,r[4]=n*T+o*E+a*R+h*I,r[8]=n*M+o*S+a*z+h*P,r[12]=n*v+o*O+a*L+h*N,r[1]=l*w+c*A+u*C+d*k,r[5]=l*T+c*E+u*R+d*I,r[9]=l*M+c*S+u*z+d*P,r[13]=l*v+c*O+u*L+d*N,r[2]=p*w+m*A+y*C+f*k,r[6]=p*T+m*E+y*R+f*I,r[10]=p*M+m*S+y*z+f*P,r[14]=p*v+m*O+y*L+f*N,r[3]=g*w+_*A+x*C+b*k,r[7]=g*T+_*E+x*R+b*I,r[11]=g*M+_*S+x*z+b*P,r[15]=g*v+_*O+x*L+b*N,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],s=t[4],i=t[8],r=t[12],n=t[1],o=t[5],a=t[9],h=t[13],l=t[2],c=t[6],u=t[10],d=t[14],p=t[3],m=t[7],y=t[11],f=t[15];return p*(+r*a*c-i*h*c-r*o*u+s*h*u+i*o*d-s*a*d)+m*(+e*a*d-e*h*u+r*n*u-i*n*d+i*h*l-r*a*l)+y*(+e*h*c-e*o*d-r*n*c+s*n*d+r*o*l-s*h*l)+f*(-i*o*l-e*a*c+e*o*u+i*n*c-s*n*u+s*a*l)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,s){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=s),this}invert(){const t=this.elements,e=t[0],s=t[1],i=t[2],r=t[3],n=t[4],o=t[5],a=t[6],h=t[7],l=t[8],c=t[9],u=t[10],d=t[11],p=t[12],m=t[13],y=t[14],f=t[15],g=c*y*h-m*u*h+m*a*d-o*y*d-c*a*f+o*u*f,_=p*u*h-l*y*h-p*a*d+n*y*d+l*a*f-n*u*f,x=l*m*h-p*c*h+p*o*d-n*m*d-l*o*f+n*c*f,b=p*c*a-l*m*a-p*o*u+n*m*u+l*o*y-n*c*y,w=e*g+s*_+i*x+r*b;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/w;return t[0]=g*T,t[1]=(m*u*r-c*y*r-m*i*d+s*y*d+c*i*f-s*u*f)*T,t[2]=(o*y*r-m*a*r+m*i*h-s*y*h-o*i*f+s*a*f)*T,t[3]=(c*a*r-o*u*r-c*i*h+s*u*h+o*i*d-s*a*d)*T,t[4]=_*T,t[5]=(l*y*r-p*u*r+p*i*d-e*y*d-l*i*f+e*u*f)*T,t[6]=(p*a*r-n*y*r-p*i*h+e*y*h+n*i*f-e*a*f)*T,t[7]=(n*u*r-l*a*r+l*i*h-e*u*h-n*i*d+e*a*d)*T,t[8]=x*T,t[9]=(p*c*r-l*m*r-p*s*d+e*m*d+l*s*f-e*c*f)*T,t[10]=(n*m*r-p*o*r+p*s*h-e*m*h-n*s*f+e*o*f)*T,t[11]=(l*o*r-n*c*r-l*s*h+e*c*h+n*s*d-e*o*d)*T,t[12]=b*T,t[13]=(l*m*i-p*c*i+p*s*u-e*m*u-l*s*y+e*c*y)*T,t[14]=(p*o*i-n*m*i-p*s*a+e*m*a+n*s*y-e*o*y)*T,t[15]=(n*c*i-l*o*i+l*s*a-e*c*a-n*s*u+e*o*u)*T,this}scale(t){const e=this.elements,s=t.x,i=t.y,r=t.z;return e[0]*=s,e[4]*=i,e[8]*=r,e[1]*=s,e[5]*=i,e[9]*=r,e[2]*=s,e[6]*=i,e[10]*=r,e[3]*=s,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],s=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,s,i))}makeTranslation(t,e,s){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,s,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),s=Math.sin(t);return this.set(1,0,0,0,0,e,-s,0,0,s,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,0,s,0,0,1,0,0,-s,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),s=Math.sin(t);return this.set(e,-s,0,0,s,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const s=Math.cos(e),i=Math.sin(e),r=1-s,n=t.x,o=t.y,a=t.z,h=r*n,l=r*o;return this.set(h*n+s,h*o-i*a,h*a+i*o,0,h*o+i*a,l*o+s,l*a-i*n,0,h*a-i*o,l*a+i*n,r*a*a+s,0,0,0,0,1),this}makeScale(t,e,s){return this.set(t,0,0,0,0,e,0,0,0,0,s,0,0,0,0,1),this}makeShear(t,e,s,i,r,n){return this.set(1,s,r,0,t,1,n,0,e,i,1,0,0,0,0,1),this}compose(t,e,s){const i=this.elements,r=e._x,n=e._y,o=e._z,a=e._w,h=r+r,l=n+n,c=o+o,u=r*h,d=r*l,p=r*c,m=n*l,y=n*c,f=o*c,g=a*h,_=a*l,x=a*c,b=s.x,w=s.y,T=s.z;return i[0]=(1-(m+f))*b,i[1]=(d+x)*b,i[2]=(p-_)*b,i[3]=0,i[4]=(d-x)*w,i[5]=(1-(u+f))*w,i[6]=(y+g)*w,i[7]=0,i[8]=(p+_)*T,i[9]=(y-g)*T,i[10]=(1-(u+m))*T,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,s){const i=this.elements;let r=xs.set(i[0],i[1],i[2]).length();const n=xs.set(i[4],i[5],i[6]).length(),o=xs.set(i[8],i[9],i[10]).length(),a=this.determinant();a<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],bs.copy(this);const h=1/r,l=1/n,c=1/o;return bs.elements[0]*=h,bs.elements[1]*=h,bs.elements[2]*=h,bs.elements[4]*=l,bs.elements[5]*=l,bs.elements[6]*=l,bs.elements[8]*=c,bs.elements[9]*=c,bs.elements[10]*=c,e.setFromRotationMatrix(bs),s.x=r,s.y=n,s.z=o,this}makePerspective(t,e,s,i,r,n,o=Xt){const a=this.elements,h=2*r/(e-t),l=2*r/(s-i),c=(e+t)/(e-t),u=(s+i)/(s-i);let d,p;if(o===Xt)d=-(n+r)/(n-r),p=-2*n*r/(n-r);else{if(o!==qt)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);d=-n/(n-r),p=-n*r/(n-r)}return a[0]=h,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,s,i,r,n,o=Xt){const a=this.elements,h=1/(e-t),l=1/(s-i),c=1/(n-r),u=(e+t)*h,d=(s+i)*l;let p,m;if(o===Xt)p=(n+r)*c,m=-2*c;else{if(o!==qt)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);p=r*c,m=-1*c}return a[0]=2*h,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=m,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,s=t.elements;for(let i=0;i<16;i++)if(e[i]!==s[i])return!1;return!0}fromArray(t,e=0){for(let s=0;s<16;s++)this.elements[s]=t[s+e];return this}toArray(t=[],e=0){const s=this.elements;return t[e]=s[0],t[e+1]=s[1],t[e+2]=s[2],t[e+3]=s[3],t[e+4]=s[4],t[e+5]=s[5],t[e+6]=s[6],t[e+7]=s[7],t[e+8]=s[8],t[e+9]=s[9],t[e+10]=s[10],t[e+11]=s[11],t[e+12]=s[12],t[e+13]=s[13],t[e+14]=s[14],t[e+15]=s[15],t}}const xs=new Ve,bs=new _s,ws=new Ve(0,0,0),Ts=new Ve(1,1,1),Ms=new Ve,vs=new Ve,As=new Ve,Es=new _s,Ss=new He;class Os{constructor(t=0,e=0,s=0,i=Os.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=s,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,s,i=this._order){return this._x=t,this._y=e,this._z=s,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,s=!0){const i=t.elements,r=i[0],n=i[4],o=i[8],a=i[1],h=i[5],l=i[9],c=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(te(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,d),this._z=Math.atan2(-n,r)):(this._x=Math.atan2(u,h),this._z=0);break;case"YXZ":this._x=Math.asin(-te(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,h)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(te(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-n,h)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-te(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-n,h));break;case"YZX":this._z=Math.asin(te(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-l,h),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-te(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(u,h),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-l,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===s&&this._onChangeCallback(),this}setFromQuaternion(t,e,s){return Es.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Es,e,s)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Ss.setFromEuler(this),this.setFromQuaternion(Ss,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Os.DEFAULT_ORDER="XYZ";class Cs{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!==(this.mask&t.mask)}isEnabled(t){return 0!==(this.mask&(1<<t|0))}}let Rs=0;const zs=new Ve,Ls=new He,ks=new _s,Is=new Ve,Ps=new Ve,Ns=new Ve,Us=new He,Bs=new Ve(1,0,0),Fs=new Ve(0,1,0),Ds=new Ve(0,0,1),Hs={type:"added"},Vs={type:"removed"},js={type:"childadded",child:null},Ws={type:"childremoved",child:null};class Ys extends Zt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Rs++}),this.uuid=$t(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ys.DEFAULT_UP.clone();const t=new Ve,e=new Os,s=new He,i=new Ve(1,1,1);function r(){s.setFromEuler(e,!1)}function n(){e.setFromQuaternion(s,void 0,!1)}e._onChange(r),s._onChange(n),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:s},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new _s},normalMatrix:{value:new Me}}),this.matrix=new _s,this.matrixWorld=new _s,this.matrixAutoUpdate=Ys.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ys.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Cs,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Ls.setFromAxisAngle(t,e),this.quaternion.multiply(Ls),this}rotateOnWorldAxis(t,e){return Ls.setFromAxisAngle(t,e),this.quaternion.premultiply(Ls),this}rotateX(t){return this.rotateOnAxis(Bs,t)}rotateY(t){return this.rotateOnAxis(Fs,t)}rotateZ(t){return this.rotateOnAxis(Ds,t)}translateOnAxis(t,e){return zs.copy(t).applyQuaternion(this.quaternion),this.position.add(zs.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Bs,t)}translateY(t){return this.translateOnAxis(Fs,t)}translateZ(t){return this.translateOnAxis(Ds,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(ks.copy(this.matrixWorld).invert())}lookAt(t,e,s){t.isVector3?Is.copy(t):Is.set(t,e,s);const i=this.parent;this.updateWorldMatrix(!0,!1),Ps.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ks.lookAt(Ps,Is,this.up):ks.lookAt(Is,Ps,this.up),this.quaternion.setFromRotationMatrix(ks),i&&(ks.extractRotation(i.matrixWorld),Ls.setFromRotationMatrix(ks),this.quaternion.premultiply(Ls.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Hs),js.child=t,this.dispatchEvent(js),js.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Vs),Ws.child=t,this.dispatchEvent(Ws),Ws.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),ks.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),ks.multiply(t.parent.matrixWorld)),t.applyMatrix4(ks),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Hs),js.child=t,this.dispatchEvent(js),js.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let s=0,i=this.children.length;s<i;s++){const i=this.children[s],r=i.getObjectByProperty(t,e);if(void 0!==r)return r}}getObjectsByProperty(t,e,s=[]){this[t]===e&&s.push(this);const i=this.children;for(let r=0,n=i.length;r<n;r++)i[r].getObjectsByProperty(t,e,s);return s}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ps,t,Ns),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ps,Us,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let s=0,i=e.length;s<i;s++)e[s].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let s=0,i=e.length;s<i;s++)e[s].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let s=0,i=e.length;s<i;s++){const i=e[s];i.updateMatrixWorld(t)}}updateWorldMatrix(t,e){const s=this.parent;if(!0===t&&null!==s&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,s=t.length;e<s;e++){const s=t[e];s.updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"===typeof t,s={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},s.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,s){return void 0===e[s.uuid]&&(e[s.uuid]=s.toJSON(t)),s.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(t),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const s=e.shapes;if(Array.isArray(s))for(let e=0,i=s.length;e<i;e++){const i=s[e];r(t.shapes,i)}else r(t.shapes,s)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let s=0,i=this.material.length;s<i;s++)e.push(r(t.materials,this.material[s]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const s=this.animations[e];i.animations.push(r(t.animations,s))}}if(e){const e=n(t.geometries),i=n(t.materials),r=n(t.textures),o=n(t.images),a=n(t.shapes),h=n(t.skeletons),l=n(t.animations),c=n(t.nodes);e.length>0&&(s.geometries=e),i.length>0&&(s.materials=i),r.length>0&&(s.textures=r),o.length>0&&(s.images=o),a.length>0&&(s.shapes=a),h.length>0&&(s.skeletons=h),l.length>0&&(s.animations=l),c.length>0&&(s.nodes=c)}return s.object=i,s;function n(t){const e=[];for(const s in t){const i=t[s];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let s=0;s<t.children.length;s++){const e=t.children[s];this.add(e.clone())}return this}}Ys.DEFAULT_UP=new Ve(0,1,0),Ys.DEFAULT_MATRIX_AUTO_UPDATE=!0,Ys.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Xs=new Ve,qs=new Ve,Zs=new Ve,Gs=new Ve,Ks=new Ve,Js=new Ve,Qs=new Ve,$s=new Ve,ti=new Ve,ei=new Ve,si=new De,ii=new De,ri=new De;class ni{constructor(t=new Ve,e=new Ve,s=new Ve){this.a=t,this.b=e,this.c=s}static getNormal(t,e,s,i){i.subVectors(s,e),Xs.subVectors(t,e),i.cross(Xs);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,s,i,r){Xs.subVectors(i,e),qs.subVectors(s,e),Zs.subVectors(t,e);const n=Xs.dot(Xs),o=Xs.dot(qs),a=Xs.dot(Zs),h=qs.dot(qs),l=qs.dot(Zs),c=n*h-o*o;if(0===c)return r.set(0,0,0),null;const u=1/c,d=(h*a-o*l)*u,p=(n*l-o*a)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,s,i){return null!==this.getBarycoord(t,e,s,i,Gs)&&(Gs.x>=0&&Gs.y>=0&&Gs.x+Gs.y<=1)}static getInterpolation(t,e,s,i,r,n,o,a){return null===this.getBarycoord(t,e,s,i,Gs)?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(r,Gs.x),a.addScaledVector(n,Gs.y),a.addScaledVector(o,Gs.z),a)}static getInterpolatedAttribute(t,e,s,i,r,n){return si.setScalar(0),ii.setScalar(0),ri.setScalar(0),si.fromBufferAttribute(t,e),ii.fromBufferAttribute(t,s),ri.fromBufferAttribute(t,i),n.setScalar(0),n.addScaledVector(si,r.x),n.addScaledVector(ii,r.y),n.addScaledVector(ri,r.z),n}static isFrontFacing(t,e,s,i){return Xs.subVectors(s,e),qs.subVectors(t,e),Xs.cross(qs).dot(i)<0}set(t,e,s){return this.a.copy(t),this.b.copy(e),this.c.copy(s),this}setFromPointsAndIndices(t,e,s,i){return this.a.copy(t[e]),this.b.copy(t[s]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,s,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,s),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Xs.subVectors(this.c,this.b),qs.subVectors(this.a,this.b),.5*Xs.cross(qs).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return ni.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return ni.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,s,i,r){return ni.getInterpolation(t,this.a,this.b,this.c,e,s,i,r)}containsPoint(t){return ni.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return ni.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const s=this.a,i=this.b,r=this.c;let n,o;Ks.subVectors(i,s),Js.subVectors(r,s),$s.subVectors(t,s);const a=Ks.dot($s),h=Js.dot($s);if(a<=0&&h<=0)return e.copy(s);ti.subVectors(t,i);const l=Ks.dot(ti),c=Js.dot(ti);if(l>=0&&c<=l)return e.copy(i);const u=a*c-l*h;if(u<=0&&a>=0&&l<=0)return n=a/(a-l),e.copy(s).addScaledVector(Ks,n);ei.subVectors(t,r);const d=Ks.dot(ei),p=Js.dot(ei);if(p>=0&&d<=p)return e.copy(r);const m=d*h-a*p;if(m<=0&&h>=0&&p<=0)return o=h/(h-p),e.copy(s).addScaledVector(Js,o);const y=l*p-d*c;if(y<=0&&c-l>=0&&d-p>=0)return Qs.subVectors(r,i),o=(c-l)/(c-l+(d-p)),e.copy(i).addScaledVector(Qs,o);const f=1/(y+m+u);return n=m*f,o=u*f,e.copy(s).addScaledVector(Ks,n).addScaledVector(Js,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const oi={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},ai={h:0,s:0,l:0},hi={h:0,s:0,l:0};function li(t,e,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+6*(e-t)*(2/3-s):t}class ci{constructor(t,e,s){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,s)}set(t,e,s){if(void 0===e&&void 0===s){const e=t;e&&e.isColor?this.copy(e):"number"===typeof e?this.setHex(e):"string"===typeof e&&this.setStyle(e)}else this.setRGB(t,e,s);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Ft){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Re.toWorkingColorSpace(this,e),this}setRGB(t,e,s,i=Re.workingColorSpace){return this.r=t,this.g=e,this.b=s,Re.toWorkingColorSpace(this,i),this}setHSL(t,e,s,i=Re.workingColorSpace){if(t=ee(t,1),e=te(e,0,1),s=te(s,0,1),0===e)this.r=this.g=this.b=s;else{const i=s<=.5?s*(1+e):s+e-s*e,r=2*s-i;this.r=li(r,i,t+1/3),this.g=li(r,i,t),this.b=li(r,i,t-1/3)}return Re.toWorkingColorSpace(this,i),this}setStyle(t,e=Ft){function s(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const n=i[1],o=i[2];switch(n){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return s(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return s(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return s(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const s=i[1],r=s.length;if(3===r)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(s,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Ft){const s=oi[t.toLowerCase()];return void 0!==s?this.setHex(s,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=ze(t.r),this.g=ze(t.g),this.b=ze(t.b),this}copyLinearToSRGB(t){return this.r=Le(t.r),this.g=Le(t.g),this.b=Le(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Ft){return Re.fromWorkingColorSpace(ui.copy(this),t),65536*Math.round(te(255*ui.r,0,255))+256*Math.round(te(255*ui.g,0,255))+Math.round(te(255*ui.b,0,255))}getHexString(t=Ft){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Re.workingColorSpace){Re.fromWorkingColorSpace(ui.copy(this),e);const s=ui.r,i=ui.g,r=ui.b,n=Math.max(s,i,r),o=Math.min(s,i,r);let a,h;const l=(o+n)/2;if(o===n)a=0,h=0;else{const t=n-o;switch(h=l<=.5?t/(n+o):t/(2-n-o),n){case s:a=(i-r)/t+(i<r?6:0);break;case i:a=(r-s)/t+2;break;case r:a=(s-i)/t+4;break}a/=6}return t.h=a,t.s=h,t.l=l,t}getRGB(t,e=Re.workingColorSpace){return Re.fromWorkingColorSpace(ui.copy(this),e),t.r=ui.r,t.g=ui.g,t.b=ui.b,t}getStyle(t=Ft){Re.fromWorkingColorSpace(ui.copy(this),t);const e=ui.r,s=ui.g,i=ui.b;return t!==Ft?`color(${t} ${e.toFixed(3)} ${s.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*s)},${Math.round(255*i)})`}offsetHSL(t,e,s){return this.getHSL(ai),this.setHSL(ai.h+t,ai.s+e,ai.l+s)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,s){return this.r=t.r+(e.r-t.r)*s,this.g=t.g+(e.g-t.g)*s,this.b=t.b+(e.b-t.b)*s,this}lerpHSL(t,e){this.getHSL(ai),t.getHSL(hi);const s=re(ai.h,hi.h,e),i=re(ai.s,hi.s,e),r=re(ai.l,hi.l,e);return this.setHSL(s,i,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,s=this.g,i=this.b,r=t.elements;return this.r=r[0]*e+r[3]*s+r[6]*i,this.g=r[1]*e+r[4]*s+r[7]*i,this.b=r[2]*e+r[5]*s+r[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const ui=new ci;ci.NAMES=oi;let di=0;class pi extends Zt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:di++}),this.uuid=$t(),this.name="",this.type="Material",this.blending=nt,this.side=st,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=at,this.blendDst=ht,this.blendEquation=ot,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ci(0,0,0),this.blendAlpha=0,this.depthFunc=lt,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Wt,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=jt,this.stencilZFail=jt,this.stencilZPass=jt,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.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!==t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const s=t[e];if(void 0===s){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(s):i&&i.isVector3&&s&&s.isVector3?i.copy(s):this[e]=s:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"===typeof t;e&&(t={textures:{},images:{}});const s={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const s in t){const i=t[s];delete i.metadata,e.push(i)}return e}if(s.uuid=this.uuid,s.type=this.type,""!==this.name&&(s.name=this.name),this.color&&this.color.isColor&&(s.color=this.color.getHex()),void 0!==this.roughness&&(s.roughness=this.roughness),void 0!==this.metalness&&(s.metalness=this.metalness),void 0!==this.sheen&&(s.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(s.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(s.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(s.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(s.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(s.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(s.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(s.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(s.shininess=this.shininess),void 0!==this.clearcoat&&(s.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(s.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(s.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(s.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(s.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,s.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(s.dispersion=this.dispersion),void 0!==this.iridescence&&(s.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(s.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(s.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(s.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(s.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(s.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(s.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(s.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(s.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(s.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(s.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(s.lightMap=this.lightMap.toJSON(t).uuid,s.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(s.aoMap=this.aoMap.toJSON(t).uuid,s.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(s.bumpMap=this.bumpMap.toJSON(t).uuid,s.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(s.normalMap=this.normalMap.toJSON(t).uuid,s.normalMapType=this.normalMapType,s.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(s.displacementMap=this.displacementMap.toJSON(t).uuid,s.displacementScale=this.displacementScale,s.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(s.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(s.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(s.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(s.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(s.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(s.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(s.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(s.combine=this.combine)),void 0!==this.envMapRotation&&(s.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(s.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(s.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(s.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(s.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(s.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(s.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(s.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(s.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(s.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(s.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(s.size=this.size),null!==this.shadowSide&&(s.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(s.sizeAttenuation=this.sizeAttenuation),this.blending!==nt&&(s.blending=this.blending),this.side!==st&&(s.side=this.side),!0===this.vertexColors&&(s.vertexColors=!0),this.opacity<1&&(s.opacity=this.opacity),!0===this.transparent&&(s.transparent=!0),this.blendSrc!==at&&(s.blendSrc=this.blendSrc),this.blendDst!==ht&&(s.blendDst=this.blendDst),this.blendEquation!==ot&&(s.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(s.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(s.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(s.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(s.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(s.blendAlpha=this.blendAlpha),this.depthFunc!==lt&&(s.depthFunc=this.depthFunc),!1===this.depthTest&&(s.depthTest=this.depthTest),!1===this.depthWrite&&(s.depthWrite=this.depthWrite),!1===this.colorWrite&&(s.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(s.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Wt&&(s.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(s.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(s.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==jt&&(s.stencilFail=this.stencilFail),this.stencilZFail!==jt&&(s.stencilZFail=this.stencilZFail),this.stencilZPass!==jt&&(s.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(s.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(s.rotation=this.rotation),!0===this.polygonOffset&&(s.polygonOffset=!0),0!==this.polygonOffsetFactor&&(s.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(s.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(s.linewidth=this.linewidth),void 0!==this.dashSize&&(s.dashSize=this.dashSize),void 0!==this.gapSize&&(s.gapSize=this.gapSize),void 0!==this.scale&&(s.scale=this.scale),!0===this.dithering&&(s.dithering=!0),this.alphaTest>0&&(s.alphaTest=this.alphaTest),!0===this.alphaHash&&(s.alphaHash=!0),!0===this.alphaToCoverage&&(s.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(s.premultipliedAlpha=!0),!0===this.forceSinglePass&&(s.forceSinglePass=!0),!0===this.wireframe&&(s.wireframe=!0),this.wireframeLinewidth>1&&(s.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(s.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(s.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(s.flatShading=!0),!1===this.visible&&(s.visible=!1),!1===this.toneMapped&&(s.toneMapped=!1),!1===this.fog&&(s.fog=!1),Object.keys(this.userData).length>0&&(s.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(s.textures=e),r.length>0&&(s.images=r)}return s}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let s=null;if(null!==e){const t=e.length;s=new Array(t);for(let i=0;i!==t;++i)s[i]=e[i].clone()}return this.clippingPlanes=s,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class mi extends pi{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ci(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.envMapRotation=new Os,this.combine=ct,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const yi=new Ve,fi=new Te;let gi=0;class _i{constructor(t,e,s=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:gi++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=s,this.usage=Yt,this.updateRanges=[],this.gpuType=vt,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,s){t*=this.itemSize,s*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[s+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,s=this.count;e<s;e++)fi.fromBufferAttribute(this,e),fi.applyMatrix3(t),this.setXY(e,fi.x,fi.y);else if(3===this.itemSize)for(let e=0,s=this.count;e<s;e++)yi.fromBufferAttribute(this,e),yi.applyMatrix3(t),this.setXYZ(e,yi.x,yi.y,yi.z);return this}applyMatrix4(t){for(let e=0,s=this.count;e<s;e++)yi.fromBufferAttribute(this,e),yi.applyMatrix4(t),this.setXYZ(e,yi.x,yi.y,yi.z);return this}applyNormalMatrix(t){for(let e=0,s=this.count;e<s;e++)yi.fromBufferAttribute(this,e),yi.applyNormalMatrix(t),this.setXYZ(e,yi.x,yi.y,yi.z);return this}transformDirection(t){for(let e=0,s=this.count;e<s;e++)yi.fromBufferAttribute(this,e),yi.transformDirection(t),this.setXYZ(e,yi.x,yi.y,yi.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let s=this.array[t*this.itemSize+e];return this.normalized&&(s=xe(s,this.array)),s}setComponent(t,e,s){return this.normalized&&(s=be(s,this.array)),this.array[t*this.itemSize+e]=s,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=xe(e,this.array)),e}setX(t,e){return this.normalized&&(e=be(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=xe(e,this.array)),e}setY(t,e){return this.normalized&&(e=be(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=xe(e,this.array)),e}setZ(t,e){return this.normalized&&(e=be(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=xe(e,this.array)),e}setW(t,e){return this.normalized&&(e=be(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,s){return t*=this.itemSize,this.normalized&&(e=be(e,this.array),s=be(s,this.array)),this.array[t+0]=e,this.array[t+1]=s,this}setXYZ(t,e,s,i){return t*=this.itemSize,this.normalized&&(e=be(e,this.array),s=be(s,this.array),i=be(i,this.array)),this.array[t+0]=e,this.array[t+1]=s,this.array[t+2]=i,this}setXYZW(t,e,s,i,r){return t*=this.itemSize,this.normalized&&(e=be(e,this.array),s=be(s,this.array),i=be(i,this.array),r=be(r,this.array)),this.array[t+0]=e,this.array[t+1]=s,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==Yt&&(t.usage=this.usage),t}}class xi extends _i{constructor(t,e,s){super(new Uint16Array(t),e,s)}}class bi extends _i{constructor(t,e,s){super(new Uint32Array(t),e,s)}}class wi extends _i{constructor(t,e,s){super(new Float32Array(t),e,s)}}let Ti=0;const Mi=new _s,vi=new Ys,Ai=new Ve,Ei=new Ye,Si=new Ye,Oi=new Ve;class Ci extends Zt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ti++}),this.uuid=$t(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Ae(t)?bi:xi)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,s=0){this.groups.push({start:t,count:e,materialIndex:s})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const s=this.attributes.normal;if(void 0!==s){const e=(new Me).getNormalMatrix(t);s.applyNormalMatrix(e),s.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Mi.makeRotationFromQuaternion(t),this.applyMatrix4(Mi),this}rotateX(t){return Mi.makeRotationX(t),this.applyMatrix4(Mi),this}rotateY(t){return Mi.makeRotationY(t),this.applyMatrix4(Mi),this}rotateZ(t){return Mi.makeRotationZ(t),this.applyMatrix4(Mi),this}translate(t,e,s){return Mi.makeTranslation(t,e,s),this.applyMatrix4(Mi),this}scale(t,e,s){return Mi.makeScale(t,e,s),this.applyMatrix4(Mi),this}lookAt(t){return vi.lookAt(t),vi.updateMatrix(),this.applyMatrix4(vi.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ai).negate(),this.translate(Ai.x,Ai.y,Ai.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let s=0,i=t.length;s<i;s++){const i=t[s];e.push(i.x,i.y,i.z||0)}this.setAttribute("position",new wi(e,3))}else{const s=Math.min(t.length,e.count);for(let i=0;i<s;i++){const s=t[i];e.setXYZ(i,s.x,s.y,s.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Ye);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Ve(-1/0,-1/0,-1/0),new Ve(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let s=0,i=e.length;s<i;s++){const t=e[s];Ei.setFromBufferAttribute(t),this.morphTargetsRelative?(Oi.addVectors(this.boundingBox.min,Ei.min),this.boundingBox.expandByPoint(Oi),Oi.addVectors(this.boundingBox.max,Ei.max),this.boundingBox.expandByPoint(Oi)):(this.boundingBox.expandByPoint(Ei.min),this.boundingBox.expandByPoint(Ei.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(){null===this.boundingSphere&&(this.boundingSphere=new ls);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Ve,1/0);if(t){const s=this.boundingSphere.center;if(Ei.setFromBufferAttribute(t),e)for(let t=0,r=e.length;t<r;t++){const s=e[t];Si.setFromBufferAttribute(s),this.morphTargetsRelative?(Oi.addVectors(Ei.min,Si.min),Ei.expandByPoint(Oi),Oi.addVectors(Ei.max,Si.max),Ei.expandByPoint(Oi)):(Ei.expandByPoint(Si.min),Ei.expandByPoint(Si.max))}Ei.getCenter(s);let i=0;for(let e=0,r=t.count;e<r;e++)Oi.fromBufferAttribute(t,e),i=Math.max(i,s.distanceToSquared(Oi));if(e)for(let r=0,n=e.length;r<n;r++){const n=e[r],o=this.morphTargetsRelative;for(let e=0,r=n.count;e<r;e++)Oi.fromBufferAttribute(n,e),o&&(Ai.fromBufferAttribute(t,e),Oi.add(Ai)),i=Math.max(i,s.distanceToSquared(Oi))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const s=e.position,i=e.normal,r=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new _i(new Float32Array(4*s.count),4));const n=this.getAttribute("tangent"),o=[],a=[];for(let M=0;M<s.count;M++)o[M]=new Ve,a[M]=new Ve;const h=new Ve,l=new Ve,c=new Ve,u=new Te,d=new Te,p=new Te,m=new Ve,y=new Ve;function f(t,e,i){h.fromBufferAttribute(s,t),l.fromBufferAttribute(s,e),c.fromBufferAttribute(s,i),u.fromBufferAttribute(r,t),d.fromBufferAttribute(r,e),p.fromBufferAttribute(r,i),l.sub(h),c.sub(h),d.sub(u),p.sub(u);const n=1/(d.x*p.y-p.x*d.y);isFinite(n)&&(m.copy(l).multiplyScalar(p.y).addScaledVector(c,-d.y).multiplyScalar(n),y.copy(c).multiplyScalar(d.x).addScaledVector(l,-p.x).multiplyScalar(n),o[t].add(m),o[e].add(m),o[i].add(m),a[t].add(y),a[e].add(y),a[i].add(y))}let g=this.groups;0===g.length&&(g=[{start:0,count:t.count}]);for(let M=0,v=g.length;M<v;++M){const e=g[M],s=e.start,i=e.count;for(let r=s,n=s+i;r<n;r+=3)f(t.getX(r+0),t.getX(r+1),t.getX(r+2))}const _=new Ve,x=new Ve,b=new Ve,w=new Ve;function T(t){b.fromBufferAttribute(i,t),w.copy(b);const e=o[t];_.copy(e),_.sub(b.multiplyScalar(b.dot(e))).normalize(),x.crossVectors(w,e);const s=x.dot(a[t]),r=s<0?-1:1;n.setXYZW(t,_.x,_.y,_.z,r)}for(let M=0,v=g.length;M<v;++M){const e=g[M],s=e.start,i=e.count;for(let r=s,n=s+i;r<n;r+=3)T(t.getX(r+0)),T(t.getX(r+1)),T(t.getX(r+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let s=this.getAttribute("normal");if(void 0===s)s=new _i(new Float32Array(3*e.count),3),this.setAttribute("normal",s);else for(let t=0,e=s.count;t<e;t++)s.setXYZ(t,0,0,0);const i=new Ve,r=new Ve,n=new Ve,o=new Ve,a=new Ve,h=new Ve,l=new Ve,c=new Ve;if(t)for(let u=0,d=t.count;u<d;u+=3){const d=t.getX(u+0),p=t.getX(u+1),m=t.getX(u+2);i.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),n.fromBufferAttribute(e,m),l.subVectors(n,r),c.subVectors(i,r),l.cross(c),o.fromBufferAttribute(s,d),a.fromBufferAttribute(s,p),h.fromBufferAttribute(s,m),o.add(l),a.add(l),h.add(l),s.setXYZ(d,o.x,o.y,o.z),s.setXYZ(p,a.x,a.y,a.z),s.setXYZ(m,h.x,h.y,h.z)}else for(let t=0,u=e.count;t<u;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),n.fromBufferAttribute(e,t+2),l.subVectors(n,r),c.subVectors(i,r),l.cross(c),s.setXYZ(t+0,l.x,l.y,l.z),s.setXYZ(t+1,l.x,l.y,l.z),s.setXYZ(t+2,l.x,l.y,l.z);this.normalizeNormals(),s.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,s=t.count;e<s;e++)Oi.fromBufferAttribute(t,e),Oi.normalize(),t.setXYZ(e,Oi.x,Oi.y,Oi.z)}toNonIndexed(){function t(t,e){const s=t.array,i=t.itemSize,r=t.normalized,n=new s.constructor(e.length*i);let o=0,a=0;for(let h=0,l=e.length;h<l;h++){o=t.isInterleavedBufferAttribute?e[h]*t.data.stride+t.offset:e[h]*i;for(let t=0;t<i;t++)n[a++]=s[o++]}return new _i(n,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Ci,s=this.index.array,i=this.attributes;for(const o in i){const r=i[o],n=t(r,s);e.setAttribute(o,n)}const r=this.morphAttributes;for(const o in r){const i=[],n=r[o];for(let e=0,r=n.length;e<r;e++){const r=n[e],o=t(r,s);i.push(o)}e.morphAttributes[o]=i}e.morphTargetsRelative=this.morphTargetsRelative;const n=this.groups;for(let o=0,a=n.length;o<a;o++){const t=n[o];e.addGroup(t.start,t.count,t.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const s in e)void 0!==e[s]&&(t[s]=e[s]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const s=this.attributes;for(const a in s){const e=s[a];t.data.attributes[a]=e.toJSON(t.data)}const i={};let r=!1;for(const a in this.morphAttributes){const e=this.morphAttributes[a],s=[];for(let i=0,r=e.length;i<r;i++){const r=e[i];s.push(r.toJSON(t.data))}s.length>0&&(i[a]=s,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const s=t.index;null!==s&&this.setIndex(s.clone());const i=t.attributes;for(const h in i){const t=i[h];this.setAttribute(h,t.clone(e))}const r=t.morphAttributes;for(const h in r){const t=[],s=r[h];for(let i=0,r=s.length;i<r;i++)t.push(s[i].clone(e));this.morphAttributes[h]=t}this.morphTargetsRelative=t.morphTargetsRelative;const n=t.groups;for(let h=0,l=n.length;h<l;h++){const t=n[h];this.addGroup(t.start,t.count,t.materialIndex)}const o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Ri=new _s,zi=new gs,Li=new ls,ki=new Ve,Ii=new Ve,Pi=new Ve,Ni=new Ve,Ui=new Ve,Bi=new Ve,Fi=new Ve,Di=new Ve;class Hi extends Ys{constructor(t=new Ci,e=new mi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry,e=t.morphAttributes,s=Object.keys(e);if(s.length>0){const t=e[s[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,s=t.length;e<s;e++){const s=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=e}}}}getVertexPosition(t,e){const s=this.geometry,i=s.attributes.position,r=s.morphAttributes.position,n=s.morphTargetsRelative;e.fromBufferAttribute(i,t);const o=this.morphTargetInfluences;if(r&&o){Bi.set(0,0,0);for(let s=0,i=r.length;s<i;s++){const i=o[s],a=r[s];0!==i&&(Ui.fromBufferAttribute(a,t),n?Bi.addScaledVector(Ui,i):Bi.addScaledVector(Ui.sub(e),i))}e.add(Bi)}return e}raycast(t,e){const s=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===s.boundingSphere&&s.computeBoundingSphere(),Li.copy(s.boundingSphere),Li.applyMatrix4(r),zi.copy(t.ray).recast(t.near),!1===Li.containsPoint(zi.origin)){if(null===zi.intersectSphere(Li,ki))return;if(zi.origin.distanceToSquared(ki)>(t.far-t.near)**2)return}Ri.copy(r).invert(),zi.copy(t.ray).applyMatrix4(Ri),null!==s.boundingBox&&!1===zi.intersectsBox(s.boundingBox)||this._computeIntersections(t,e,zi)}}_computeIntersections(t,e,s){let i;const r=this.geometry,n=this.material,o=r.index,a=r.attributes.position,h=r.attributes.uv,l=r.attributes.uv1,c=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==o)if(Array.isArray(n))for(let p=0,m=u.length;p<m;p++){const r=u[p],a=n[r.materialIndex],m=Math.max(r.start,d.start),y=Math.min(o.count,Math.min(r.start+r.count,d.start+d.count));for(let n=m,u=y;n<u;n+=3){const u=o.getX(n),d=o.getX(n+1),p=o.getX(n+2);i=ji(this,a,t,s,h,l,c,u,d,p),i&&(i.faceIndex=Math.floor(n/3),i.face.materialIndex=r.materialIndex,e.push(i))}}else{const r=Math.max(0,d.start),a=Math.min(o.count,d.start+d.count);for(let u=r,d=a;u<d;u+=3){const r=o.getX(u),a=o.getX(u+1),d=o.getX(u+2);i=ji(this,n,t,s,h,l,c,r,a,d),i&&(i.faceIndex=Math.floor(u/3),e.push(i))}}else if(void 0!==a)if(Array.isArray(n))for(let p=0,m=u.length;p<m;p++){const r=u[p],o=n[r.materialIndex],m=Math.max(r.start,d.start),y=Math.min(a.count,Math.min(r.start+r.count,d.start+d.count));for(let n=m,a=y;n<a;n+=3){const a=n,u=n+1,d=n+2;i=ji(this,o,t,s,h,l,c,a,u,d),i&&(i.faceIndex=Math.floor(n/3),i.face.materialIndex=r.materialIndex,e.push(i))}}else{const r=Math.max(0,d.start),o=Math.min(a.count,d.start+d.count);for(let a=r,u=o;a<u;a+=3){const r=a,o=a+1,u=a+2;i=ji(this,n,t,s,h,l,c,r,o,u),i&&(i.faceIndex=Math.floor(a/3),e.push(i))}}}}function Vi(t,e,s,i,r,n,o,a){let h;if(h=e.side===it?i.intersectTriangle(o,n,r,!0,a):i.intersectTriangle(r,n,o,e.side===st,a),null===h)return null;Di.copy(a),Di.applyMatrix4(t.matrixWorld);const l=s.ray.origin.distanceTo(Di);return l<s.near||l>s.far?null:{distance:l,point:Di.clone(),object:t}}function ji(t,e,s,i,r,n,o,a,h,l){t.getVertexPosition(a,Ii),t.getVertexPosition(h,Pi),t.getVertexPosition(l,Ni);const c=Vi(t,e,s,i,Ii,Pi,Ni,Fi);if(c){const t=new Ve;ni.getBarycoord(Fi,Ii,Pi,Ni,t),r&&(c.uv=ni.getInterpolatedAttribute(r,a,h,l,t,new Te)),n&&(c.uv1=ni.getInterpolatedAttribute(n,a,h,l,t,new Te)),o&&(c.normal=ni.getInterpolatedAttribute(o,a,h,l,t,new Ve),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));const e={a:a,b:h,c:l,normal:new Ve,materialIndex:0};ni.getNormal(Ii,Pi,Ni,e.normal),c.face=e,c.barycoord=t}return c}class Wi extends Ci{constructor(t=1,e=1,s=1,i=1,r=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:s,widthSegments:i,heightSegments:r,depthSegments:n};const o=this;i=Math.floor(i),r=Math.floor(r),n=Math.floor(n);const a=[],h=[],l=[],c=[];let u=0,d=0;function p(t,e,s,i,r,n,p,m,y,f,g){const _=n/y,x=p/f,b=n/2,w=p/2,T=m/2,M=y+1,v=f+1;let A=0,E=0;const S=new Ve;for(let o=0;o<v;o++){const n=o*x-w;for(let a=0;a<M;a++){const u=a*_-b;S[t]=u*i,S[e]=n*r,S[s]=T,h.push(S.x,S.y,S.z),S[t]=0,S[e]=0,S[s]=m>0?1:-1,l.push(S.x,S.y,S.z),c.push(a/y),c.push(1-o/f),A+=1}}for(let o=0;o<f;o++)for(let t=0;t<y;t++){const e=u+t+M*o,s=u+t+M*(o+1),i=u+(t+1)+M*(o+1),r=u+(t+1)+M*o;a.push(e,s,r),a.push(s,i,r),E+=6}o.addGroup(d,E,g),d+=E,u+=A}p("z","y","x",-1,-1,s,e,t,n,r,0),p("z","y","x",1,-1,s,e,-t,n,r,1),p("x","z","y",1,1,t,s,e,i,n,2),p("x","z","y",1,-1,t,s,-e,i,n,3),p("x","y","z",1,-1,t,e,s,i,r,4),p("x","y","z",-1,-1,t,e,-s,i,r,5),this.setIndex(a),this.setAttribute("position",new wi(h,3)),this.setAttribute("normal",new wi(l,3)),this.setAttribute("uv",new wi(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Wi(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}class Yi extends Ys{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new _s,this.projectionMatrix=new _s,this.projectionMatrixInverse=new _s,this.coordinateSystem=Xt}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Xi=new Ve,qi=new Te,Zi=new Te;class Gi extends Yi{constructor(t=50,e=1,s=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=s,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*Qt*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*Jt*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*Qt*Math.atan(Math.tan(.5*Jt*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,s){Xi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Xi.x,Xi.y).multiplyScalar(-t/Xi.z),Xi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),s.set(Xi.x,Xi.y).multiplyScalar(-t/Xi.z)}getViewSize(t,e){return this.getViewBounds(t,qi,Zi),e.subVectors(Zi,qi)}setViewOffset(t,e,s,i,r,n){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=s,this.view.offsetY=i,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Jt*this.fov)/this.zoom,s=2*e,i=this.aspect*s,r=-.5*i;const n=this.view;if(null!==this.view&&this.view.enabled){const t=n.fullWidth,o=n.fullHeight;r+=n.offsetX*i/t,e-=n.offsetY*s/o,i*=n.width/t,s*=n.height/o}const o=this.filmOffset;0!==o&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-s,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}class Ki extends Ys{constructor(){super(),this.isGroup=!0,this.type="Group"}}class Ji extends Ys{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Os,this.environmentIntensity=1,this.environmentRotation=new Os,this.overrideMaterial=null,"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class Qi{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=Yt,this.updateRanges=[],this.version=0,this.uuid=$t()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,s){t*=this.stride,s*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[s+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=$t()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),s=new this.constructor(e,this.stride);return s.setUsage(this.usage),s}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=$t()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const $i=new Ve;class tr{constructor(t,e,s,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=s,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,s=this.data.count;e<s;e++)$i.fromBufferAttribute(this,e),$i.applyMatrix4(t),this.setXYZ(e,$i.x,$i.y,$i.z);return this}applyNormalMatrix(t){for(let e=0,s=this.count;e<s;e++)$i.fromBufferAttribute(this,e),$i.applyNormalMatrix(t),this.setXYZ(e,$i.x,$i.y,$i.z);return this}transformDirection(t){for(let e=0,s=this.count;e<s;e++)$i.fromBufferAttribute(this,e),$i.transformDirection(t),this.setXYZ(e,$i.x,$i.y,$i.z);return this}getComponent(t,e){let s=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(s=xe(s,this.array)),s}setComponent(t,e,s){return this.normalized&&(s=be(s,this.array)),this.data.array[t*this.data.stride+this.offset+e]=s,this}setX(t,e){return this.normalized&&(e=be(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=be(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=be(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=be(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=xe(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=xe(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=xe(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=xe(e,this.array)),e}setXY(t,e,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=be(e,this.array),s=be(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=s,this}setXYZ(t,e,s,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=be(e,this.array),s=be(s,this.array),i=be(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=s,this.data.array[t+2]=i,this}setXYZW(t,e,s,i,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=be(e,this.array),s=be(s,this.array),i=be(i,this.array),r=be(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=s,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const s=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[s+e])}return new _i(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new tr(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const s=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[s+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}const er=new Ve,sr=new De,ir=new De,rr=new Ve,nr=new _s,or=new Ve,ar=new ls,hr=new _s,lr=new gs;class cr extends Hi{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=ut,this.bindMatrix=new _s,this.bindMatrixInverse=new _s,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new Ye),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let s=0;s<e.count;s++)this.getVertexPosition(s,or),this.boundingBox.expandByPoint(or)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new ls),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let s=0;s<e.count;s++)this.getVertexPosition(s,or),this.boundingSphere.expandByPoint(or)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const s=this.material,i=this.matrixWorld;void 0!==s&&(null===this.boundingSphere&&this.computeBoundingSphere(),ar.copy(this.boundingSphere),ar.applyMatrix4(i),!1!==t.ray.intersectsSphere(ar)&&(hr.copy(i).invert(),lr.copy(t.ray).applyMatrix4(hr),null!==this.boundingBox&&!1===lr.intersectsBox(this.boundingBox)||this._computeIntersections(t,e,lr)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new De,e=this.geometry.attributes.skinWeight;for(let s=0,i=e.count;s<i;s++){t.fromBufferAttribute(e,s);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(s,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===ut?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===dt?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const s=this.skeleton,i=this.geometry;sr.fromBufferAttribute(i.attributes.skinIndex,t),ir.fromBufferAttribute(i.attributes.skinWeight,t),er.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let r=0;r<4;r++){const t=ir.getComponent(r);if(0!==t){const i=sr.getComponent(r);nr.multiplyMatrices(s.bones[i].matrixWorld,s.boneInverses[i]),e.addScaledVector(rr.copy(er).applyMatrix4(nr),t)}}return e.applyMatrix4(this.bindMatrixInverse)}}class ur extends Ys{constructor(){super(),this.isBone=!0,this.type="Bone"}}class dr extends Fe{constructor(t=null,e=1,s=1,i,r,n,o,a,h=gt,l=gt,c,u){super(null,n,o,a,h,l,i,r,c,u),this.isDataTexture=!0,this.image={data:t,width:e,height:s},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const pr=new _s,mr=new _s;class yr{constructor(t=[],e=[]){this.uuid=$t(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new _s)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new _s;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,s=this.boneMatrices,i=this.boneTexture;for(let r=0,n=t.length;r<n;r++){const i=t[r]?t[r].matrixWorld:mr;pr.multiplyMatrices(i,e[r]),pr.toArray(s,16*r)}null!==i&&(i.needsUpdate=!0)}clone(){return new yr(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const s=new dr(e,t,t,At,vt);return s.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=s,this}getBoneByName(t){for(let e=0,s=this.bones.length;e<s;e++){const s=this.bones[e];if(s.name===t)return s}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let s=0,i=t.bones.length;s<i;s++){const i=t.bones[s];let r=e[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new ur),this.bones.push(r),this.boneInverses.push((new _s).fromArray(t.boneInverses[s]))}return this.init(),this}toJSON(){const t={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,s=this.boneInverses;for(let i=0,r=e.length;i<r;i++){const r=e[i];t.bones.push(r.uuid);const n=s[i];t.boneInverses.push(n.toArray())}return t}}class fr extends _i{constructor(t,e,s,i=1){super(t,e,s),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const gr=new _s,_r=new _s,xr=[],br=new Ye,wr=new _s,Tr=new Hi,Mr=new ls;class vr extends Hi{constructor(t,e,s){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new fr(new Float32Array(16*s),16),this.instanceColor=null,this.morphTexture=null,this.count=s,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<s;i++)this.setMatrixAt(i,wr)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new Ye),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let s=0;s<e;s++)this.getMatrixAt(s,gr),br.copy(t.boundingBox).applyMatrix4(gr),this.boundingBox.union(br)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new ls),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let s=0;s<e;s++)this.getMatrixAt(s,gr),Mr.copy(t.boundingSphere).applyMatrix4(gr),this.boundingSphere.union(Mr)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.morphTexture&&(this.morphTexture=t.morphTexture.clone()),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){const s=e.morphTargetInfluences,i=this.morphTexture.source.data.data,r=s.length+1,n=t*r+1;for(let o=0;o<s.length;o++)s[o]=i[n+o]}raycast(t,e){const s=this.matrixWorld,i=this.count;if(Tr.geometry=this.geometry,Tr.material=this.material,void 0!==Tr.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Mr.copy(this.boundingSphere),Mr.applyMatrix4(s),!1!==t.ray.intersectsSphere(Mr)))for(let r=0;r<i;r++){this.getMatrixAt(r,gr),_r.multiplyMatrices(s,gr),Tr.matrixWorld=_r,Tr.raycast(t,xr);for(let t=0,s=xr.length;t<s;t++){const s=xr[t];s.instanceId=r,s.object=this,e.push(s)}xr.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new fr(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){const s=e.morphTargetInfluences,i=s.length+1;null===this.morphTexture&&(this.morphTexture=new dr(new Float32Array(i*this.count),i,this.count,Et,vt));const r=this.morphTexture.source.data.data;let n=0;for(let h=0;h<s.length;h++)n+=s[h];const o=this.geometry.morphTargetsRelative?1:1-n,a=i*t;r[a]=o,r.set(s,a+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Ar=new Ve,Er=new Ve,Sr=new Me;class Or{constructor(t=new Ve(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,s,i){return this.normal.set(t,e,s),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,s){const i=Ar.subVectors(s,e).cross(Er.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const s=t.delta(Ar),i=this.normal.dot(s);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(s,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),s=this.distanceToPoint(t.end);return e<0&&s>0||s<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const s=e||Sr.getNormalMatrix(t),i=this.coplanarPoint(Ar).applyMatrix4(t),r=this.normal.applyMatrix3(s).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Cr=new ls,Rr=new Ve;class zr{constructor(t=new Or,e=new Or,s=new Or,i=new Or,r=new Or,n=new Or){this.planes=[t,e,s,i,r,n]}set(t,e,s,i,r,n){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(s),o[3].copy(i),o[4].copy(r),o[5].copy(n),this}copy(t){const e=this.planes;for(let s=0;s<6;s++)e[s].copy(t.planes[s]);return this}setFromProjectionMatrix(t,e=Xt){const s=this.planes,i=t.elements,r=i[0],n=i[1],o=i[2],a=i[3],h=i[4],l=i[5],c=i[6],u=i[7],d=i[8],p=i[9],m=i[10],y=i[11],f=i[12],g=i[13],_=i[14],x=i[15];if(s[0].setComponents(a-r,u-h,y-d,x-f).normalize(),s[1].setComponents(a+r,u+h,y+d,x+f).normalize(),s[2].setComponents(a+n,u+l,y+p,x+g).normalize(),s[3].setComponents(a-n,u-l,y-p,x-g).normalize(),s[4].setComponents(a-o,u-c,y-m,x-_).normalize(),e===Xt)s[5].setComponents(a+o,u+c,y+m,x+_).normalize();else{if(e!==qt)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);s[5].setComponents(o,c,m,_).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Cr.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Cr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Cr)}intersectsSprite(t){return Cr.center.set(0,0,0),Cr.radius=.7071067811865476,Cr.applyMatrix4(t.matrixWorld),this.intersectsSphere(Cr)}intersectsSphere(t){const e=this.planes,s=t.center,i=-t.radius;for(let r=0;r<6;r++){const t=e[r].distanceToPoint(s);if(t<i)return!1}return!0}intersectsBox(t){const e=this.planes;for(let s=0;s<6;s++){const i=e[s];if(Rr.x=i.normal.x>0?t.max.x:t.min.x,Rr.y=i.normal.y>0?t.max.y:t.min.y,Rr.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Rr)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let s=0;s<6;s++)if(e[s].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}class Lr extends pi{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new ci(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const kr=new Ve,Ir=new Ve,Pr=new _s,Nr=new gs,Ur=new ls,Br=new Ve,Fr=new Ve;class Dr extends Ys{constructor(t=new Ci,e=new Lr){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,s=[0];for(let t=1,i=e.count;t<i;t++)kr.fromBufferAttribute(e,t-1),Ir.fromBufferAttribute(e,t),s[t]=s[t-1],s[t]+=kr.distanceTo(Ir);t.setAttribute("lineDistance",new wi(s,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const s=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,n=s.drawRange;if(null===s.boundingSphere&&s.computeBoundingSphere(),Ur.copy(s.boundingSphere),Ur.applyMatrix4(i),Ur.radius+=r,!1===t.ray.intersectsSphere(Ur))return;Pr.copy(i).invert(),Nr.copy(t.ray).applyMatrix4(Pr);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,h=this.isLineSegments?2:1,l=s.index,c=s.attributes,u=c.position;if(null!==l){const s=Math.max(0,n.start),i=Math.min(l.count,n.start+n.count);for(let r=s,n=i-1;r<n;r+=h){const s=l.getX(r),i=l.getX(r+1),n=Hr(this,t,Nr,a,s,i,r);n&&e.push(n)}if(this.isLineLoop){const r=l.getX(i-1),n=l.getX(s),o=Hr(this,t,Nr,a,r,n,i-1);o&&e.push(o)}}else{const s=Math.max(0,n.start),i=Math.min(u.count,n.start+n.count);for(let r=s,n=i-1;r<n;r+=h){const s=Hr(this,t,Nr,a,r,r+1,r);s&&e.push(s)}if(this.isLineLoop){const r=Hr(this,t,Nr,a,i-1,s,i-1);r&&e.push(r)}}}updateMorphTargets(){const t=this.geometry,e=t.morphAttributes,s=Object.keys(e);if(s.length>0){const t=e[s[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,s=t.length;e<s;e++){const s=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=e}}}}}function Hr(t,e,s,i,r,n,o){const a=t.geometry.attributes.position;kr.fromBufferAttribute(a,r),Ir.fromBufferAttribute(a,n);const h=s.distanceSqToSegment(kr,Ir,Br,Fr);if(h>i)return;Br.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(Br);return l<e.near||l>e.far?void 0:{distance:l,point:Fr.clone().applyMatrix4(t.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:t}}const Vr=new Ve,jr=new Ve;class Wr extends Dr{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,s=[];for(let t=0,i=e.count;t<i;t+=2)Vr.fromBufferAttribute(e,t),jr.fromBufferAttribute(e,t+1),s[t]=0===t?0:s[t-1],s[t+1]=s[t]+Vr.distanceTo(jr);t.setAttribute("lineDistance",new wi(s,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Yr extends Dr{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class Xr extends pi{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new ci(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const qr=new _s,Zr=new gs,Gr=new ls,Kr=new Ve;class Jr extends Ys{constructor(t=new Ci,e=new Xr){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const s=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,n=s.drawRange;if(null===s.boundingSphere&&s.computeBoundingSphere(),Gr.copy(s.boundingSphere),Gr.applyMatrix4(i),Gr.radius+=r,!1===t.ray.intersectsSphere(Gr))return;qr.copy(i).invert(),Zr.copy(t.ray).applyMatrix4(qr);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,h=s.index,l=s.attributes,c=l.position;if(null!==h){const s=Math.max(0,n.start),r=Math.min(h.count,n.start+n.count);for(let n=s,o=r;n<o;n++){const s=h.getX(n);Kr.fromBufferAttribute(c,s),Qr(Kr,s,a,i,t,e,this)}}else{const s=Math.max(0,n.start),r=Math.min(c.count,n.start+n.count);for(let n=s,o=r;n<o;n++)Kr.fromBufferAttribute(c,n),Qr(Kr,n,a,i,t,e,this)}}updateMorphTargets(){const t=this.geometry,e=t.morphAttributes,s=Object.keys(e);if(s.length>0){const t=e[s[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,s=t.length;e<s;e++){const s=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[s]=e}}}}}function Qr(t,e,s,i,r,n,o){const a=Zr.distanceSqToPoint(t);if(a<s){const s=new Ve;Zr.closestPointToPoint(t,s),s.applyMatrix4(i);const h=r.ray.origin.distanceTo(s);if(h<r.near||h>r.far)return;n.push({distance:h,distanceToRay:Math.sqrt(a),point:s,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class $r extends pi{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new ci(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 ci(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ut,this.normalScale=new Te(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Os,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class tn extends $r{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Te(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return te(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ci(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new ci(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ci(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!==t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!==t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!==t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!==t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!==t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!==t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}function en(t,e){return t&&t.constructor!==e?"number"===typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function sn(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function rn(t){function e(e,s){return t[e]-t[s]}const s=t.length,i=new Array(s);for(let r=0;r!==s;++r)i[r]=r;return i.sort(e),i}function nn(t,e,s){const i=t.length,r=new t.constructor(i);for(let n=0,o=0;o!==i;++n){const i=s[n]*e;for(let s=0;s!==e;++s)r[o++]=t[i+s]}return r}function on(t,e,s,i){let r=1,n=t[0];while(void 0!==n&&void 0===n[i])n=t[r++];if(void 0===n)return;let o=n[i];if(void 0!==o)if(Array.isArray(o))do{o=n[i],void 0!==o&&(e.push(n.time),s.push(...o)),n=t[r++]}while(void 0!==n);else if(void 0!==o.toArray)do{o=n[i],void 0!==o&&(e.push(n.time),o.toArray(s,s.length)),n=t[r++]}while(void 0!==n);else do{o=n[i],void 0!==o&&(e.push(n.time),s.push(o)),n=t[r++]}while(void 0!==n)}class an{constructor(t,e,s,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(s),this.sampleValues=e,this.valueSize=s,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let s=this._cachedIndex,i=e[s],r=e[s-1];t:{e:{let n;s:{i:if(!(t<i)){for(let n=s+2;;){if(void 0===i){if(t<r)break i;return s=e.length,this._cachedIndex=s,this.copySampleValue_(s-1)}if(s===n)break;if(r=i,i=e[++s],t<i)break e}n=e.length;break s}if(t>=r)break t;{const o=e[1];t<o&&(s=2,r=o);for(let n=s-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(s===n)break;if(i=r,r=e[--s-1],t>=r)break e}n=s,s=0}}while(s<n){const i=s+n>>>1;t<e[i]?n=i:s=i+1}if(i=e[s],r=e[s-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return s=e.length,this._cachedIndex=s,this.copySampleValue_(s-1)}this._cachedIndex=s,this.intervalChanged_(s,r,i)}return this.interpolate_(s,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,s=this.sampleValues,i=this.valueSize,r=t*i;for(let n=0;n!==i;++n)e[n]=s[r+n];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class hn extends an{constructor(t,e,s,i){super(t,e,s,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Rt,endingEnd:Rt}}intervalChanged_(t,e,s){const i=this.parameterPositions;let r=t-2,n=t+1,o=i[r],a=i[n];if(void 0===o)switch(this.getSettings_().endingStart){case zt:r=t,o=2*e-s;break;case Lt:r=i.length-2,o=e+i[r]-i[r+1];break;default:r=t,o=s}if(void 0===a)switch(this.getSettings_().endingEnd){case zt:n=t,a=2*s-e;break;case Lt:n=1,a=s+i[1]-i[0];break;default:n=t-1,a=e}const h=.5*(s-e),l=this.valueSize;this._weightPrev=h/(e-o),this._weightNext=h/(a-s),this._offsetPrev=r*l,this._offsetNext=n*l}interpolate_(t,e,s,i){const r=this.resultBuffer,n=this.sampleValues,o=this.valueSize,a=t*o,h=a-o,l=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(s-e)/(i-e),m=p*p,y=m*p,f=-u*y+2*u*m-u*p,g=(1+u)*y+(-1.5-2*u)*m+(-.5+u)*p+1,_=(-1-d)*y+(1.5+d)*m+.5*p,x=d*y-d*m;for(let b=0;b!==o;++b)r[b]=f*n[l+b]+g*n[h+b]+_*n[a+b]+x*n[c+b];return r}}class ln extends an{constructor(t,e,s,i){super(t,e,s,i)}interpolate_(t,e,s,i){const r=this.resultBuffer,n=this.sampleValues,o=this.valueSize,a=t*o,h=a-o,l=(s-e)/(i-e),c=1-l;for(let u=0;u!==o;++u)r[u]=n[h+u]*c+n[a+u]*l;return r}}class cn extends an{constructor(t,e,s,i){super(t,e,s,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class un{constructor(t,e,s,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=en(e,this.TimeBufferType),this.values=en(s,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let s;if(e.toJSON!==this.toJSON)s=e.toJSON(t);else{s={name:t.name,times:en(t.times,Array),values:en(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(s.interpolation=e)}return s.type=t.ValueTypeName,s}InterpolantFactoryMethodDiscrete(t){return new cn(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new ln(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new hn(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case St:e=this.InterpolantFactoryMethodDiscrete;break;case Ot:e=this.InterpolantFactoryMethodLinear;break;case Ct:e=this.InterpolantFactoryMethodSmooth;break}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return St;case this.InterpolantFactoryMethodLinear:return Ot;case this.InterpolantFactoryMethodSmooth:return Ct}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let s=0,i=e.length;s!==i;++s)e[s]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let s=0,i=e.length;s!==i;++s)e[s]*=t}return this}trim(t,e){const s=this.times,i=s.length;let r=0,n=i-1;while(r!==i&&s[r]<t)++r;while(-1!==n&&s[n]>e)--n;if(++n,0!==r||n!==i){r>=n&&(n=Math.max(n,1),r=n-1);const t=this.getValueSize();this.times=s.slice(r,n),this.values=this.values.slice(r*t,n*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const s=this.times,i=this.values,r=s.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let o=0;o!==r;o++){const e=s[o];if("number"===typeof e&&isNaN(e)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,e),t=!1;break}if(null!==n&&n>e){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,e,n),t=!1;break}n=e}if(void 0!==i&&sn(i))for(let o=0,a=i.length;o!==a;++o){const e=i[o];if(isNaN(e)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,e),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),s=this.getValueSize(),i=this.getInterpolation()===Ct,r=t.length-1;let n=1;for(let o=1;o<r;++o){let r=!1;const a=t[o],h=t[o+1];if(a!==h&&(1!==o||a!==t[0]))if(i)r=!0;else{const t=o*s,i=t-s,n=t+s;for(let o=0;o!==s;++o){const s=e[t+o];if(s!==e[i+o]||s!==e[n+o]){r=!0;break}}}if(r){if(o!==n){t[n]=t[o];const i=o*s,r=n*s;for(let t=0;t!==s;++t)e[r+t]=e[i+t]}++n}}if(r>0){t[n]=t[r];for(let t=r*s,i=n*s,o=0;o!==s;++o)e[i+o]=e[t+o];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*s)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),s=this.constructor,i=new s(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}un.prototype.ValueTypeName="",un.prototype.TimeBufferType=Float32Array,un.prototype.ValueBufferType=Float32Array,un.prototype.DefaultInterpolation=Ot;class dn extends un{constructor(t,e,s){super(t,e,s)}}dn.prototype.ValueTypeName="bool",dn.prototype.ValueBufferType=Array,dn.prototype.DefaultInterpolation=St,dn.prototype.InterpolantFactoryMethodLinear=void 0,dn.prototype.InterpolantFactoryMethodSmooth=void 0;class pn extends un{constructor(t,e,s,i){super(t,e,s,i)}}pn.prototype.ValueTypeName="color";class mn extends un{constructor(t,e,s,i){super(t,e,s,i)}}mn.prototype.ValueTypeName="number";class yn extends an{constructor(t,e,s,i){super(t,e,s,i)}interpolate_(t,e,s,i){const r=this.resultBuffer,n=this.sampleValues,o=this.valueSize,a=(s-e)/(i-e);let h=t*o;for(let l=h+o;h!==l;h+=4)He.slerpFlat(r,0,n,h-o,n,h,a);return r}}class fn extends un{constructor(t,e,s,i){super(t,e,s,i)}InterpolantFactoryMethodLinear(t){return new yn(this.times,this.values,this.getValueSize(),t)}}fn.prototype.ValueTypeName="quaternion",fn.prototype.InterpolantFactoryMethodSmooth=void 0;class gn extends un{constructor(t,e,s){super(t,e,s)}}gn.prototype.ValueTypeName="string",gn.prototype.ValueBufferType=Array,gn.prototype.DefaultInterpolation=St,gn.prototype.InterpolantFactoryMethodLinear=void 0,gn.prototype.InterpolantFactoryMethodSmooth=void 0;class _n extends un{constructor(t,e,s,i){super(t,e,s,i)}}_n.prototype.ValueTypeName="vector";class xn{constructor(t="",e=-1,s=[],i=kt){this.name=t,this.tracks=s,this.duration=e,this.blendMode=i,this.uuid=$t(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],s=t.tracks,i=1/(t.fps||1);for(let n=0,o=s.length;n!==o;++n)e.push(wn(s[n]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],s=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let r=0,n=s.length;r!==n;++r)e.push(un.toJSON(s[r]));return i}static CreateFromMorphTargetSequence(t,e,s,i){const r=e.length,n=[];for(let o=0;o<r;o++){let t=[],a=[];t.push((o+r-1)%r,o,(o+1)%r),a.push(0,1,0);const h=rn(t);t=nn(t,1,h),a=nn(a,1,h),i||0!==t[0]||(t.push(r),a.push(a[0])),n.push(new mn(".morphTargetInfluences["+e[o].name+"]",t,a).scale(1/s))}return new this(t,-1,n)}static findByName(t,e){let s=t;if(!Array.isArray(t)){const e=t;s=e.geometry&&e.geometry.animations||e.animations}for(let i=0;i<s.length;i++)if(s[i].name===e)return s[i];return null}static CreateClipsFromMorphTargetSequences(t,e,s){const i={},r=/^([\w-]*?)([\d]+)$/;for(let o=0,a=t.length;o<a;o++){const e=t[o],s=e.name.match(r);if(s&&s.length>1){const t=s[1];let r=i[t];r||(i[t]=r=[]),r.push(e)}}const n=[];for(const o in i)n.push(this.CreateFromMorphTargetSequence(o,i[o],e,s));return n}static parseAnimation(t,e){if(console.warn("THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const s=function(t,e,s,i,r){if(0!==s.length){const n=[],o=[];on(s,n,o,i),0!==n.length&&r.push(new t(e,n,o))}},i=[],r=t.name||"default",n=t.fps||30,o=t.blendMode;let a=t.length||-1;const h=t.hierarchy||[];for(let c=0;c<h.length;c++){const t=h[c].keys;if(t&&0!==t.length)if(t[0].morphTargets){const e={};let s;for(s=0;s<t.length;s++)if(t[s].morphTargets)for(let i=0;i<t[s].morphTargets.length;i++)e[t[s].morphTargets[i]]=-1;for(const r in e){const e=[],n=[];for(let i=0;i!==t[s].morphTargets.length;++i){const i=t[s];e.push(i.time),n.push(i.morphTarget===r?1:0)}i.push(new mn(".morphTargetInfluence["+r+"]",e,n))}a=e.length*n}else{const r=".bones["+e[c].name+"]";s(_n,r+".position",t,"pos",i),s(fn,r+".quaternion",t,"rot",i),s(_n,r+".scale",t,"scl",i)}}if(0===i.length)return null;const l=new this(r,a,i,o);return l}resetDuration(){const t=this.tracks;let e=0;for(let s=0,i=t.length;s!==i;++s){const t=this.tracks[s];e=Math.max(e,t.times[t.times.length-1])}return this.duration=e,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function bn(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return mn;case"vector":case"vector2":case"vector3":case"vector4":return _n;case"color":return pn;case"quaternion":return fn;case"bool":case"boolean":return dn;case"string":return gn}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function wn(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=bn(t.type);if(void 0===t.times){const e=[],s=[];on(t.keys,e,s,"value"),t.times=e,t.values=s}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Tn={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Mn{constructor(t,e,s){const i=this;let r=!1,n=0,o=0,a=void 0;const h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=s,this.itemStart=function(t){o++,!1===r&&void 0!==i.onStart&&i.onStart(t,n,o),r=!0},this.itemEnd=function(t){n++,void 0!==i.onProgress&&i.onProgress(t,n,o),n===o&&(r=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return a?a(t):t},this.setURLModifier=function(t){return a=t,this},this.addHandler=function(t,e){return h.push(t,e),this},this.removeHandler=function(t){const e=h.indexOf(t);return-1!==e&&h.splice(e,2),this},this.getHandler=function(t){for(let e=0,s=h.length;e<s;e+=2){const s=h[e],i=h[e+1];if(s.global&&(s.lastIndex=0),s.test(t))return i}return null}}}const vn=new Mn;class An{constructor(t){this.manager=void 0!==t?t:vn,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const s=this;return new Promise((function(i,r){s.load(t,i,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}An.DEFAULT_MATERIAL_NAME="__DEFAULT";const En={};class Sn extends Error{constructor(t,e){super(t),this.response=e}}class On extends An{constructor(t){super(t),this.mimeType="",this.responseType=""}load(t,e,s,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=Tn.get(t);if(void 0!==r)return this.manager.itemStart(t),setTimeout(()=>{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==En[t])return void En[t].push({onLoad:e,onProgress:s,onError:i});En[t]=[],En[t].push({onLoad:e,onProgress:s,onError:i});const n=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(n).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"===typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const s=En[t],i=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),n=r?parseInt(r):0,o=0!==n;let a=0;const h=new ReadableStream({start(t){function e(){i.read().then(({done:i,value:r})=>{if(i)t.close();else{a+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:n});for(let t=0,e=s.length;t<e;t++){const e=s[t];e.onProgress&&e.onProgress(i)}t.enqueue(r),e()}},e=>{t.error(e)})}e()}});return new Response(h)}throw new Sn(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(a){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>{const e=new DOMParser;return e.parseFromString(t,o)});case"json":return t.json();default:if(""===o)return t.text();{const e=/charset="?([^;"\s]*)"?/i,s=e.exec(o),i=s&&s[1]?s[1].toLowerCase():void 0,r=new TextDecoder(i);return t.arrayBuffer().then(t=>r.decode(t))}}}).then(e=>{Tn.add(t,e);const s=En[t];delete En[t];for(let t=0,i=s.length;t<i;t++){const i=s[t];i.onLoad&&i.onLoad(e)}}).catch(e=>{const s=En[t];if(void 0===s)throw this.manager.itemError(t),e;delete En[t];for(let t=0,i=s.length;t<i;t++){const i=s[t];i.onError&&i.onError(e)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Cn extends An{constructor(t){super(t)}load(t,e,s,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,n=Tn.get(t);if(void 0!==n)return r.manager.itemStart(t),setTimeout((function(){e&&e(n),r.manager.itemEnd(t)}),0),n;const o=Ee("img");function a(){l(),Tn.add(t,this),e&&e(this),r.manager.itemEnd(t)}function h(e){l(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function l(){o.removeEventListener("load",a,!1),o.removeEventListener("error",h,!1)}return o.addEventListener("load",a,!1),o.addEventListener("error",h,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o}}class Rn extends An{constructor(t){super(t)}load(t,e,s,i){const r=new Fe,n=new Cn(this.manager);return n.setCrossOrigin(this.crossOrigin),n.setPath(this.path),n.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),s,i),r}}class zn extends Ys{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new ci(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(e.object.target=this.target.uuid),e}}const Ln=new _s,kn=new Ve,In=new Ve;class Pn{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Te(512,512),this.map=null,this.mapPass=null,this.matrix=new _s,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new zr,this._frameExtents=new Te(1,1),this._viewportCount=1,this._viewports=[new De(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,s=this.matrix;kn.setFromMatrixPosition(t.matrixWorld),e.position.copy(kn),In.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(In),e.updateMatrixWorld(),Ln.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ln),s.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),s.multiply(Ln)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 1!==this.intensity&&(t.intensity=this.intensity),0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Nn extends Pn{constructor(){super(new Gi(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,s=2*Qt*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;s===e.fov&&i===e.aspect&&r===e.far||(e.fov=s,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class Un extends zn{constructor(t,e,s=0,i=Math.PI/3,r=0,n=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ys.DEFAULT_UP),this.updateMatrix(),this.target=new Ys,this.distance=s,this.angle=i,this.penumbra=r,this.decay=n,this.map=null,this.shadow=new Nn}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const Bn=new _s,Fn=new Ve,Dn=new Ve;class Hn extends Pn{constructor(){super(new Gi(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Te(4,2),this._viewportCount=6,this._viewports=[new De(2,1,1,1),new De(0,1,1,1),new De(3,1,1,1),new De(1,1,1,1),new De(3,0,1,1),new De(1,0,1,1)],this._cubeDirections=[new Ve(1,0,0),new Ve(-1,0,0),new Ve(0,0,1),new Ve(0,0,-1),new Ve(0,1,0),new Ve(0,-1,0)],this._cubeUps=[new Ve(0,1,0),new Ve(0,1,0),new Ve(0,1,0),new Ve(0,1,0),new Ve(0,0,1),new Ve(0,0,-1)]}updateMatrices(t,e=0){const s=this.camera,i=this.matrix,r=t.distance||s.far;r!==s.far&&(s.far=r,s.updateProjectionMatrix()),Fn.setFromMatrixPosition(t.matrixWorld),s.position.copy(Fn),Dn.copy(s.position),Dn.add(this._cubeDirections[e]),s.up.copy(this._cubeUps[e]),s.lookAt(Dn),s.updateMatrixWorld(),i.makeTranslation(-Fn.x,-Fn.y,-Fn.z),Bn.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Bn)}}class Vn extends zn{constructor(t,e,s=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=s,this.decay=i,this.shadow=new Hn}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class jn extends Yi{constructor(t=-1,e=1,s=1,i=-1,r=.1,n=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=s,this.bottom=i,this.near=r,this.far=n,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,s,i,r,n){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=s,this.view.offsetY=i,this.view.width=r,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),s=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=s-t,n=s+t,o=i+e,a=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,n=r+t*this.view.width,o-=e*this.view.offsetY,a=o-e*this.view.height}this.projectionMatrix.makeOrthographic(r,n,o,a,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}class Wn extends Pn{constructor(){super(new jn(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Yn extends zn{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ys.DEFAULT_UP),this.updateMatrix(),this.target=new Ys,this.shadow=new Wn}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class Xn{static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!==typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class qn extends An{constructor(t){super(t),this.isImageBitmapLoader=!0,"undefined"===typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"===typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,s,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,n=Tn.get(t);if(void 0!==n)return r.manager.itemStart(t),n.then?void n.then(s=>{e&&e(s),r.manager.itemEnd(t)}).catch(t=>{i&&i(t)}):(setTimeout((function(){e&&e(n),r.manager.itemEnd(t)}),0),n);const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader;const a=fetch(t,o).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(s){return Tn.add(t,s),e&&e(s),r.manager.itemEnd(t),s})).catch((function(e){i&&i(e),Tn.remove(t),r.manager.itemError(t),r.manager.itemEnd(t)}));Tn.add(t,a),r.manager.itemStart(t)}}const Zn="\\[\\]\\.:\\/",Gn=new RegExp("["+Zn+"]","g"),Kn="[^"+Zn+"]",Jn="[^"+Zn.replace("\\.","")+"]",Qn=/((?:WC+[\/:])*)/.source.replace("WC",Kn),$n=/(WCOD+)?/.source.replace("WCOD",Jn),to=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Kn),eo=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Kn),so=new RegExp("^"+Qn+$n+to+eo+"$"),io=["material","materials","bones","map"];class ro{constructor(t,e,s){const i=s||no.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const s=this._targetGroup.nCachedObjects_,i=this._bindings[s];void 0!==i&&i.getValue(t,e)}setValue(t,e){const s=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=s.length;i!==r;++i)s[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,s=t.length;e!==s;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,s=t.length;e!==s;++e)t[e].unbind()}}class no{constructor(t,e,s){this.path=e,this.parsedPath=s||no.parseTrackName(e),this.node=no.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,s){return t&&t.isAnimationObjectGroup?new no.Composite(t,e,s):new no(t,e,s)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Gn,"")}static parseTrackName(t){const e=so.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const s={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=s.nodeName&&s.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=s.nodeName.substring(i+1);-1!==io.indexOf(t)&&(s.nodeName=s.nodeName.substring(0,i),s.objectName=t)}if(null===s.propertyName||0===s.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return s}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const s=t.skeleton.getBoneByName(e);if(void 0!==s)return s}if(t.children){const s=function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const n=s(r.children);if(n)return n}return null},i=s(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const s=this.resolvedProperty;for(let i=0,r=s.length;i!==r;++i)t[e++]=s[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const s=this.resolvedProperty;for(let i=0,r=s.length;i!==r;++i)s[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const s=this.resolvedProperty;for(let i=0,r=s.length;i!==r;++i)s[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const s=this.resolvedProperty;for(let i=0,r=s.length;i!==r;++i)s[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,s=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=no.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(s){let i=e.objectIndex;switch(s){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[s])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[s]}if(void 0!==i){if(void 0===t[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[i]}}const n=t[i];if(void 0===n){const s=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+s+"."+i+" but it wasn't found.",t)}let o=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?o=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=n,this.propertyIndex=r}else void 0!==n.fromArray&&void 0!==n.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=n):Array.isArray(n)?(a=this.BindingType.EntireArray,this.resolvedProperty=n):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}no.Composite=ro,no.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},no.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},no.prototype.GetterByBindingType=[no.prototype._getValue_direct,no.prototype._getValue_array,no.prototype._getValue_arrayElement,no.prototype._getValue_toArray],no.prototype.SetterByBindingTypeAndVersioning=[[no.prototype._setValue_direct,no.prototype._setValue_direct_setNeedsUpdate,no.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[no.prototype._setValue_array,no.prototype._setValue_array_setNeedsUpdate,no.prototype._setValue_array_setMatrixWorldNeedsUpdate],[no.prototype._setValue_arrayElement,no.prototype._setValue_arrayElement_setNeedsUpdate,no.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[no.prototype._setValue_fromArray,no.prototype._setValue_fromArray_setNeedsUpdate,no.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];new Float32Array(1);function oo(t,e){if(e===It)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===Nt||e===Pt){let s=t.getIndex();if(null===s){const e=[],i=t.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(let t=0;t<i.count;t++)e.push(t);t.setIndex(e),s=t.getIndex()}const i=s.count-2,r=[];if(e===Nt)for(let t=1;t<=i;t++)r.push(s.getX(0)),r.push(s.getX(t)),r.push(s.getX(t+1));else for(let t=0;t<i;t++)t%2===0?(r.push(s.getX(t)),r.push(s.getX(t+1)),r.push(s.getX(t+2))):(r.push(s.getX(t+2)),r.push(s.getX(t+1)),r.push(s.getX(t)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const n=t.clone();return n.setIndex(r),n.clearGroups(),n}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:et}})),"undefined"!==typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=et);class ao extends An{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(t){return new mo(t)})),this.register((function(t){return new yo(t)})),this.register((function(t){return new vo(t)})),this.register((function(t){return new Ao(t)})),this.register((function(t){return new Eo(t)})),this.register((function(t){return new go(t)})),this.register((function(t){return new _o(t)})),this.register((function(t){return new xo(t)})),this.register((function(t){return new bo(t)})),this.register((function(t){return new po(t)})),this.register((function(t){return new wo(t)})),this.register((function(t){return new fo(t)})),this.register((function(t){return new Mo(t)})),this.register((function(t){return new To(t)})),this.register((function(t){return new co(t)})),this.register((function(t){return new So(t)})),this.register((function(t){return new Oo(t)}))}load(t,e,s,i){const r=this;let n;if(""!==this.resourcePath)n=this.resourcePath;else if(""!==this.path){const e=Xn.extractUrlBase(t);n=Xn.resolveURL(e,this.path)}else n=Xn.extractUrlBase(t);this.manager.itemStart(t);const o=function(e){i?i(e):console.error(e),r.manager.itemError(t),r.manager.itemEnd(t)},a=new On(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(s){try{r.parse(s,n,(function(s){e(s),r.manager.itemEnd(t)}),o)}catch(i){o(i)}}),s,o)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,s,i){let r;const n={},o={},a=new TextDecoder;if("string"===typeof t)r=JSON.parse(t);else if(t instanceof ArrayBuffer){const e=a.decode(new Uint8Array(t,0,4));if(e===Co){try{n[lo.KHR_BINARY_GLTF]=new Lo(t)}catch(l){return void(i&&i(l))}r=JSON.parse(n[lo.KHR_BINARY_GLTF].content)}else r=JSON.parse(a.decode(t))}else r=t;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const h=new ra(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});h.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c<this.pluginCallbacks.length;c++){const t=this.pluginCallbacks[c](h);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[t.name]=t,n[t.name]=!0}if(r.extensionsUsed)for(let c=0;c<r.extensionsUsed.length;++c){const t=r.extensionsUsed[c],e=r.extensionsRequired||[];switch(t){case lo.KHR_MATERIALS_UNLIT:n[t]=new uo;break;case lo.KHR_DRACO_MESH_COMPRESSION:n[t]=new ko(r,this.dracoLoader);break;case lo.KHR_TEXTURE_TRANSFORM:n[t]=new Io;break;case lo.KHR_MESH_QUANTIZATION:n[t]=new Po;break;default:e.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}h.setExtensions(n),h.setPlugins(o),h.parse(s,i)}parseAsync(t,e){const s=this;return new Promise((function(i,r){s.parse(t,e,i,r)}))}}function ho(){let t={};return{get:function(e){return t[e]},add:function(e,s){t[e]=s},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const lo={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class co{constructor(t){this.parser=t,this.name=lo.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let s=0,i=e.length;s<i;s++){const i=e[s];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(t){const e=this.parser,s="light:"+t;let i=e.cache.get(s);if(i)return i;const r=e.json,n=r.extensions&&r.extensions[this.name]||{},o=n.lights||[],a=o[t];let h;const l=new ci(16777215);void 0!==a.color&&l.setRGB(a.color[0],a.color[1],a.color[2],Dt);const c=void 0!==a.range?a.range:0;switch(a.type){case"directional":h=new Yn(l),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new Vn(l),h.distance=c;break;case"spot":h=new Un(l),h.distance=c,a.spot=a.spot||{},a.spot.innerConeAngle=void 0!==a.spot.innerConeAngle?a.spot.innerConeAngle:0,a.spot.outerConeAngle=void 0!==a.spot.outerConeAngle?a.spot.outerConeAngle:Math.PI/4,h.angle=a.spot.outerConeAngle,h.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return h.position.set(0,0,0),Ko(h,a),void 0!==a.intensity&&(h.intensity=a.intensity),h.name=e.createUniqueName(a.name||"light_"+t),i=Promise.resolve(h),e.cache.add(s,i),i}getDependency(t,e){if("light"===t)return this._loadLight(e)}createNodeAttachment(t){const e=this,s=this.parser,i=s.json,r=i.nodes[t],n=r.extensions&&r.extensions[this.name]||{},o=n.light;return void 0===o?null:this._loadLight(o).then((function(t){return s._getNodeRef(e.cache,o,t)}))}}class uo{constructor(){this.name=lo.KHR_MATERIALS_UNLIT}getMaterialType(){return mi}extendParams(t,e,s){const i=[];t.color=new ci(1,1,1),t.opacity=1;const r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;t.color.setRGB(e[0],e[1],e[2],Dt),t.opacity=e[3]}void 0!==r.baseColorTexture&&i.push(s.assignTexture(t,"map",r.baseColorTexture,Ft))}return Promise.all(i)}}class po{constructor(t){this.parser=t,this.name=lo.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name].emissiveStrength;return void 0!==r&&(e.emissiveIntensity=r),Promise.resolve()}}class mo{constructor(t){this.parser=t,this.name=lo.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const e=this.parser,s=e.json.materials[t];return s.extensions&&s.extensions[this.name]?tn:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],n=i.extensions[this.name];if(void 0!==n.clearcoatFactor&&(e.clearcoat=n.clearcoatFactor),void 0!==n.clearcoatTexture&&r.push(s.assignTexture(e,"clearcoatMap",n.clearcoatTexture)),void 0!==n.clearcoatRoughnessFactor&&(e.clearcoatRoughness=n.clearcoatRoughnessFactor),void 0!==n.clearcoatRoughnessTexture&&r.push(s.assignTexture(e,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture)),void 0!==n.clearcoatNormalTexture&&(r.push(s.assignTexture(e,"clearcoatNormalMap",n.clearcoatNormalTexture)),void 0!==n.clearcoatNormalTexture.scale)){const t=n.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new Te(t,t)}return Promise.all(r)}}class yo{constructor(t){this.parser=t,this.name=lo.KHR_MATERIALS_DISPERSION}getMaterialType(t){const e=this.parser,s=e.json.materials[t];return s.extensions&&s.extensions[this.name]?tn:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name];return e.dispersion=void 0!==r.dispersion?r.dispersion:0,Promise.resolve()}}class fo{constructor(t){this.parser=t,this.name=lo.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const e=this.parser,s=e.json.materials[t];return s.extensions&&s.extensions[this.name]?tn:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],n=i.extensions[this.name];return void 0!==n.iridescenceFactor&&(e.iridescence=n.iridescenceFactor),void 0!==n.iridescenceTexture&&r.push(s.assignTexture(e,"iridescenceMap",n.iridescenceTexture)),void 0!==n.iridescenceIor&&(e.iridescenceIOR=n.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==n.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),void 0!==n.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),void 0!==n.iridescenceThicknessTexture&&r.push(s.assignTexture(e,"iridescenceThicknessMap",n.iridescenceThicknessTexture)),Promise.all(r)}}class go{constructor(t){this.parser=t,this.name=lo.KHR_MATERIALS_SHEEN}getMaterialType(t){const e=this.parser,s=e.json.materials[t];return s.extensions&&s.extensions[this.name]?tn:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];e.sheenColor=new ci(0,0,0),e.sheenRoughness=0,e.sheen=1;const n=i.extensions[this.name];if(void 0!==n.sheenColorFactor){const t=n.sheenColorFactor;e.sheenColor.setRGB(t[0],t[1],t[2],Dt)}return void 0!==n.sheenRoughnessFactor&&(e.sheenRoughness=n.sheenRoughnessFactor),void 0!==n.sheenColorTexture&&r.push(s.assignTexture(e,"sheenColorMap",n.sheenColorTexture,Ft)),void 0!==n.sheenRoughnessTexture&&r.push(s.assignTexture(e,"sheenRoughnessMap",n.sheenRoughnessTexture)),Promise.all(r)}}class _o{constructor(t){this.parser=t,this.name=lo.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const e=this.parser,s=e.json.materials[t];return s.extensions&&s.extensions[this.name]?tn:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],n=i.extensions[this.name];return void 0!==n.transmissionFactor&&(e.transmission=n.transmissionFactor),void 0!==n.transmissionTexture&&r.push(s.assignTexture(e,"transmissionMap",n.transmissionTexture)),Promise.all(r)}}class xo{constructor(t){this.parser=t,this.name=lo.KHR_MATERIALS_VOLUME}getMaterialType(t){const e=this.parser,s=e.json.materials[t];return s.extensions&&s.extensions[this.name]?tn:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],n=i.extensions[this.name];e.thickness=void 0!==n.thicknessFactor?n.thicknessFactor:0,void 0!==n.thicknessTexture&&r.push(s.assignTexture(e,"thicknessMap",n.thicknessTexture)),e.attenuationDistance=n.attenuationDistance||1/0;const o=n.attenuationColor||[1,1,1];return e.attenuationColor=(new ci).setRGB(o[0],o[1],o[2],Dt),Promise.all(r)}}class bo{constructor(t){this.parser=t,this.name=lo.KHR_MATERIALS_IOR}getMaterialType(t){const e=this.parser,s=e.json.materials[t];return s.extensions&&s.extensions[this.name]?tn:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=i.extensions[this.name];return e.ior=void 0!==r.ior?r.ior:1.5,Promise.resolve()}}class wo{constructor(t){this.parser=t,this.name=lo.KHR_MATERIALS_SPECULAR}getMaterialType(t){const e=this.parser,s=e.json.materials[t];return s.extensions&&s.extensions[this.name]?tn:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],n=i.extensions[this.name];e.specularIntensity=void 0!==n.specularFactor?n.specularFactor:1,void 0!==n.specularTexture&&r.push(s.assignTexture(e,"specularIntensityMap",n.specularTexture));const o=n.specularColorFactor||[1,1,1];return e.specularColor=(new ci).setRGB(o[0],o[1],o[2],Dt),void 0!==n.specularColorTexture&&r.push(s.assignTexture(e,"specularColorMap",n.specularColorTexture,Ft)),Promise.all(r)}}class To{constructor(t){this.parser=t,this.name=lo.EXT_MATERIALS_BUMP}getMaterialType(t){const e=this.parser,s=e.json.materials[t];return s.extensions&&s.extensions[this.name]?tn:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],n=i.extensions[this.name];return e.bumpScale=void 0!==n.bumpFactor?n.bumpFactor:1,void 0!==n.bumpTexture&&r.push(s.assignTexture(e,"bumpMap",n.bumpTexture)),Promise.all(r)}}class Mo{constructor(t){this.parser=t,this.name=lo.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const e=this.parser,s=e.json.materials[t];return s.extensions&&s.extensions[this.name]?tn:null}extendMaterialParams(t,e){const s=this.parser,i=s.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],n=i.extensions[this.name];return void 0!==n.anisotropyStrength&&(e.anisotropy=n.anisotropyStrength),void 0!==n.anisotropyRotation&&(e.anisotropyRotation=n.anisotropyRotation),void 0!==n.anisotropyTexture&&r.push(s.assignTexture(e,"anisotropyMap",n.anisotropyTexture)),Promise.all(r)}}class vo{constructor(t){this.parser=t,this.name=lo.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,s=e.json,i=s.textures[t];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],n=e.options.ktx2Loader;if(!n){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,n)}}class Ao{constructor(t){this.parser=t,this.name=lo.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,s=this.parser,i=s.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const n=r.extensions[e],o=i.images[n.source];let a=s.textureLoader;if(o.uri){const t=s.options.manager.getHandler(o.uri);null!==t&&(a=t)}return this.detectSupport().then((function(r){if(r)return s.loadTextureImage(t,n.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class Eo{constructor(t){this.parser=t,this.name=lo.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,s=this.parser,i=s.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const n=r.extensions[e],o=i.images[n.source];let a=s.textureLoader;if(o.uri){const t=s.options.manager.getHandler(o.uri);null!==t&&(a=t)}return this.detectSupport().then((function(r){if(r)return s.loadTextureImage(t,n.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class So{constructor(t){this.name=lo.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,s=e.bufferViews[t];if(s.extensions&&s.extensions[this.name]){const t=s.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(e){const s=t.byteOffset||0,i=t.byteLength||0,n=t.count,o=t.byteStride,a=new Uint8Array(e,s,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(n,o,a,t.mode,t.filter).then((function(t){return t.buffer})):r.ready.then((function(){const e=new ArrayBuffer(n*o);return r.decodeGltfBuffer(new Uint8Array(e),n,o,a,t.mode,t.filter),e}))}))}return null}}class Oo{constructor(t){this.name=lo.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,s=e.nodes[t];if(!s.extensions||!s.extensions[this.name]||void 0===s.mesh)return null;const i=e.meshes[s.mesh];for(const h of i.primitives)if(h.mode!==Fo.TRIANGLES&&h.mode!==Fo.TRIANGLE_STRIP&&h.mode!==Fo.TRIANGLE_FAN&&void 0!==h.mode)return null;const r=s.extensions[this.name],n=r.attributes,o=[],a={};for(const h in n)o.push(this.parser.getDependency("accessor",n[h]).then(t=>(a[h]=t,a[h])));return o.length<1?null:(o.push(this.parser.createNodeMesh(t)),Promise.all(o).then(t=>{const e=t.pop(),s=e.isGroup?e.children:[e],i=t[0].count,r=[];for(const n of s){const t=new _s,e=new Ve,s=new He,o=new Ve(1,1,1),h=new vr(n.geometry,n.material,i);for(let r=0;r<i;r++)a.TRANSLATION&&e.fromBufferAttribute(a.TRANSLATION,r),a.ROTATION&&s.fromBufferAttribute(a.ROTATION,r),a.SCALE&&o.fromBufferAttribute(a.SCALE,r),h.setMatrixAt(r,t.compose(e,s,o));for(const i in a)if("_COLOR_0"===i){const t=a[i];h.instanceColor=new fr(t.array,t.itemSize,t.normalized)}else"TRANSLATION"!==i&&"ROTATION"!==i&&"SCALE"!==i&&n.geometry.setAttribute(i,a[i]);Ys.prototype.copy.call(h,n),this.parser.assignFinalMaterial(h),r.push(h)}return e.isGroup?(e.clear(),e.add(...r),e):r[0]}))}}const Co="glTF",Ro=12,zo={JSON:1313821514,BIN:5130562};class Lo{constructor(t){this.name=lo.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,Ro),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Co)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Ro,r=new DataView(t,Ro);let n=0;while(n<i){const e=r.getUint32(n,!0);n+=4;const i=r.getUint32(n,!0);if(n+=4,i===zo.JSON){const i=new Uint8Array(t,Ro+n,e);this.content=s.decode(i)}else if(i===zo.BIN){const s=Ro+n;this.body=t.slice(s,s+e)}n+=e}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class ko{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=lo.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const s=this.json,i=this.dracoLoader,r=t.extensions[this.name].bufferView,n=t.extensions[this.name].attributes,o={},a={},h={};for(const l in n){const t=Wo[l]||l.toLowerCase();o[t]=n[l]}for(const l in t.attributes){const e=Wo[l]||l.toLowerCase();if(void 0!==n[l]){const i=s.accessors[t.attributes[l]],r=Do[i.componentType];h[e]=r.name,a[e]=!0===i.normalized}}return e.getDependency("bufferView",r).then((function(t){return new Promise((function(e,s){i.decodeDracoFile(t,(function(t){for(const e in t.attributes){const s=t.attributes[e],i=a[e];void 0!==i&&(s.normalized=i)}e(t)}),o,h,Dt,s)}))}))}}class Io{constructor(){this.name=lo.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return void 0!==e.texCoord&&e.texCoord!==t.channel||void 0!==e.offset||void 0!==e.rotation||void 0!==e.scale?(t=t.clone(),void 0!==e.texCoord&&(t.channel=e.texCoord),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0,t):t}}class Po{constructor(){this.name=lo.KHR_MESH_QUANTIZATION}}class No extends an{constructor(t,e,s,i){super(t,e,s,i)}copySampleValue_(t){const e=this.resultBuffer,s=this.sampleValues,i=this.valueSize,r=t*i*3+i;for(let n=0;n!==i;n++)e[n]=s[r+n];return e}interpolate_(t,e,s,i){const r=this.resultBuffer,n=this.sampleValues,o=this.valueSize,a=2*o,h=3*o,l=i-e,c=(s-e)/l,u=c*c,d=u*c,p=t*h,m=p-h,y=-2*d+3*u,f=d-u,g=1-y,_=f-u+c;for(let x=0;x!==o;x++){const t=n[m+x+o],e=n[m+x+a]*l,s=n[p+x+o],i=n[p+x]*l;r[x]=g*t+_*e+y*s+f*i}return r}}const Uo=new He;class Bo extends No{interpolate_(t,e,s,i){const r=super.interpolate_(t,e,s,i);return Uo.fromArray(r).normalize().toArray(r),r}}const Fo={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Do={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Ho={9728:gt,9729:bt,9984:_t,9985:wt,9986:xt,9987:Tt},Vo={33071:yt,33648:ft,10497:mt},jo={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Wo={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Yo={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Xo={CUBICSPLINE:void 0,LINEAR:Ot,STEP:St},qo={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Zo(t){return void 0===t["DefaultMaterial"]&&(t["DefaultMaterial"]=new $r({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:st})),t["DefaultMaterial"]}function Go(t,e,s){for(const i in s.extensions)void 0===t[i]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=s.extensions[i])}function Ko(t,e){void 0!==e.extras&&("object"===typeof e.extras?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function Jo(t,e,s){let i=!1,r=!1,n=!1;for(let l=0,c=e.length;l<c;l++){const t=e[l];if(void 0!==t.POSITION&&(i=!0),void 0!==t.NORMAL&&(r=!0),void 0!==t.COLOR_0&&(n=!0),i&&r&&n)break}if(!i&&!r&&!n)return Promise.resolve(t);const o=[],a=[],h=[];for(let l=0,c=e.length;l<c;l++){const c=e[l];if(i){const e=void 0!==c.POSITION?s.getDependency("accessor",c.POSITION):t.attributes.position;o.push(e)}if(r){const e=void 0!==c.NORMAL?s.getDependency("accessor",c.NORMAL):t.attributes.normal;a.push(e)}if(n){const e=void 0!==c.COLOR_0?s.getDependency("accessor",c.COLOR_0):t.attributes.color;h.push(e)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(h)]).then((function(e){const s=e[0],o=e[1],a=e[2];return i&&(t.morphAttributes.position=s),r&&(t.morphAttributes.normal=o),n&&(t.morphAttributes.color=a),t.morphTargetsRelative=!0,t}))}function Qo(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(let s=0,i=e.weights.length;s<i;s++)t.morphTargetInfluences[s]=e.weights[s];if(e.extras&&Array.isArray(e.extras.targetNames)){const s=e.extras.targetNames;if(t.morphTargetInfluences.length===s.length){t.morphTargetDictionary={};for(let e=0,i=s.length;e<i;e++)t.morphTargetDictionary[s[e]]=e}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function $o(t){let e;const s=t.extensions&&t.extensions[lo.KHR_DRACO_MESH_COMPRESSION];if(e=s?"draco:"+s.bufferView+":"+s.indices+":"+ta(s.attributes):t.indices+":"+ta(t.attributes)+":"+t.mode,void 0!==t.targets)for(let i=0,r=t.targets.length;i<r;i++)e+=":"+ta(t.targets[i]);return e}function ta(t){let e="";const s=Object.keys(t).sort();for(let i=0,r=s.length;i<r;i++)e+=s[i]+":"+t[s[i]]+";";return e}function ea(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function sa(t){return t.search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"}const ia=new _s;class ra{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new ho,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,i=-1,r=!1,n=-1;if("undefined"!==typeof navigator){const t=navigator.userAgent;s=!0===/^((?!chrome|android).)*safari/i.test(t);const e=t.match(/Version\/(\d+)/);i=s&&e?parseInt(e[1],10):-1,r=t.indexOf("Firefox")>-1,n=r?t.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"===typeof createImageBitmap||s&&i<17||r&&n<98?this.textureLoader=new Rn(this.options.manager):this.textureLoader=new qn(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new On(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const s=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])})).then((function(e){const n={scene:e[0][i.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:i.asset,parser:s,userData:{}};return Go(r,n,i),Ko(n,i),Promise.all(s._invokeAll((function(t){return t.afterRoot&&t.afterRoot(n)}))).then((function(){for(const t of n.scenes)t.updateMatrixWorld();t(n)}))})).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],s=this.json.meshes||[];for(let i=0,r=e.length;i<r;i++){const s=e[i].joints;for(let e=0,i=s.length;e<i;e++)t[s[e]].isBone=!0}for(let i=0,r=t.length;i<r;i++){const e=t[i];void 0!==e.mesh&&(this._addNodeRef(this.meshCache,e.mesh),void 0!==e.skin&&(s[e.mesh].isSkinnedMesh=!0)),void 0!==e.camera&&this._addNodeRef(this.cameraCache,e.camera)}}_addNodeRef(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,s){if(t.refs[e]<=1)return s;const i=s.clone(),r=(t,e)=>{const s=this.associations.get(t);null!=s&&this.associations.set(e,s);for(const[i,n]of t.children.entries())r(n,e.children[i])};return r(s,i),i.name+="_instance_"+t.uses[e]++,i}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let s=0;s<e.length;s++){const i=t(e[s]);if(i)return i}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const s=[];for(let i=0;i<e.length;i++){const r=t(e[i]);r&&s.push(r)}return s}getDependency(t,e){const s=t+":"+e;let i=this.cache.get(s);if(!i){switch(t){case"scene":i=this.loadScene(e);break;case"node":i=this._invokeOne((function(t){return t.loadNode&&t.loadNode(e)}));break;case"mesh":i=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":i=this.loadAccessor(e);break;case"bufferView":i=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":i=this.loadBuffer(e);break;case"material":i=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":i=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":i=this.loadSkin(e);break;case"animation":i=this._invokeOne((function(t){return t.loadAnimation&&t.loadAnimation(e)}));break;case"camera":i=this.loadCamera(e);break;default:if(i=this._invokeOne((function(s){return s!=this&&s.getDependency&&s.getDependency(t,e)})),!i)throw new Error("Unknown type: "+t);break}this.cache.add(s,i)}return i}getDependencies(t){let e=this.cache.get(t);if(!e){const s=this,i=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(i.map((function(e,i){return s.getDependency(t,i)}))),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],s=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[lo.KHR_BINARY_GLTF].body);const i=this.options;return new Promise((function(t,r){s.load(Xn.resolveURL(e.uri,i.path),t,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){const s=e.byteLength||0,i=e.byteOffset||0;return t.slice(i,i+s)}))}loadAccessor(t){const e=this,s=this.json,i=this.json.accessors[t];if(void 0===i.bufferView&&void 0===i.sparse){const t=jo[i.type],e=Do[i.componentType],s=!0===i.normalized,r=new e(i.count*t);return Promise.resolve(new _i(r,t,s))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then((function(t){const r=t[0],n=jo[i.type],o=Do[i.componentType],a=o.BYTES_PER_ELEMENT,h=a*n,l=i.byteOffset||0,c=void 0!==i.bufferView?s.bufferViews[i.bufferView].byteStride:void 0,u=!0===i.normalized;let d,p;if(c&&c!==h){const t=Math.floor(l/c),s="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+t+":"+i.count;let h=e.cache.get(s);h||(d=new o(r,t*c,i.count*c/a),h=new Qi(d,c/a),e.cache.add(s,h)),p=new tr(h,n,l%c/a,u)}else d=null===r?new o(i.count*n):new o(r,l,i.count*n),p=new _i(d,n,u);if(void 0!==i.sparse){const e=jo.SCALAR,s=Do[i.sparse.indices.componentType],a=i.sparse.indices.byteOffset||0,h=i.sparse.values.byteOffset||0,l=new s(t[1],a,i.sparse.count*e),c=new o(t[2],h,i.sparse.count*n);null!==r&&(p=new _i(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let t=0,i=l.length;t<i;t++){const e=l[t];if(p.setX(e,c[t*n]),n>=2&&p.setY(e,c[t*n+1]),n>=3&&p.setZ(e,c[t*n+2]),n>=4&&p.setW(e,c[t*n+3]),n>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}p.normalized=u}return p}))}loadTexture(t){const e=this.json,s=this.options,i=e.textures[t],r=i.source,n=e.images[r];let o=this.textureLoader;if(n.uri){const t=s.manager.getHandler(n.uri);null!==t&&(o=t)}return this.loadTextureImage(t,r,o)}loadTextureImage(t,e,s){const i=this,r=this.json,n=r.textures[t],o=r.images[e],a=(o.uri||o.bufferView)+":"+n.sampler;if(this.textureCache[a])return this.textureCache[a];const h=this.loadImageSource(e,s).then((function(e){e.flipY=!1,e.name=n.name||o.name||"",""===e.name&&"string"===typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(e.name=o.uri);const s=r.samplers||{},a=s[n.sampler]||{};return e.magFilter=Ho[a.magFilter]||bt,e.minFilter=Ho[a.minFilter]||Tt,e.wrapS=Vo[a.wrapS]||mt,e.wrapT=Vo[a.wrapT]||mt,e.generateMipmaps=!e.isCompressedTexture&&e.minFilter!==gt&&e.minFilter!==bt,i.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[a]=h,h}loadImageSource(t,e){const s=this,i=this.json,r=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then(t=>t.clone());const n=i.images[t],o=self.URL||self.webkitURL;let a=n.uri||"",h=!1;if(void 0!==n.bufferView)a=s.getDependency("bufferView",n.bufferView).then((function(t){h=!0;const e=new Blob([t],{type:n.mimeType});return a=o.createObjectURL(e),a}));else if(void 0===n.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const l=Promise.resolve(a).then((function(t){return new Promise((function(s,i){let n=s;!0===e.isImageBitmapLoader&&(n=function(t){const e=new Fe(t);e.needsUpdate=!0,s(e)}),e.load(Xn.resolveURL(t,r.path),n,void 0,i)}))})).then((function(t){return!0===h&&o.revokeObjectURL(a),Ko(t,n),t.userData.mimeType=n.mimeType||sa(n.uri),t})).catch((function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",a),t}));return this.sourceCache[t]=l,l}assignTexture(t,e,s,i){const r=this;return this.getDependency("texture",s.index).then((function(n){if(!n)return null;if(void 0!==s.texCoord&&s.texCoord>0&&(n=n.clone(),n.channel=s.texCoord),r.extensions[lo.KHR_TEXTURE_TRANSFORM]){const t=void 0!==s.extensions?s.extensions[lo.KHR_TEXTURE_TRANSFORM]:void 0;if(t){const e=r.associations.get(n);n=r.extensions[lo.KHR_TEXTURE_TRANSFORM].extendTexture(n,t),r.associations.set(n,e)}}return void 0!==i&&(n.colorSpace=i),t[e]=n,n}))}assignFinalMaterial(t){const e=t.geometry;let s=t.material;const i=void 0===e.attributes.tangent,r=void 0!==e.attributes.color,n=void 0===e.attributes.normal;if(t.isPoints){const t="PointsMaterial:"+s.uuid;let e=this.cache.get(t);e||(e=new Xr,pi.prototype.copy.call(e,s),e.color.copy(s.color),e.map=s.map,e.sizeAttenuation=!1,this.cache.add(t,e)),s=e}else if(t.isLine){const t="LineBasicMaterial:"+s.uuid;let e=this.cache.get(t);e||(e=new Lr,pi.prototype.copy.call(e,s),e.color.copy(s.color),e.map=s.map,this.cache.add(t,e)),s=e}if(i||r||n){let t="ClonedMaterial:"+s.uuid+":";i&&(t+="derivative-tangents:"),r&&(t+="vertex-colors:"),n&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=s.clone(),r&&(e.vertexColors=!0),n&&(e.flatShading=!0),i&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(s))),s=e}t.material=s}getMaterialType(){return $r}loadMaterial(t){const e=this,s=this.json,i=this.extensions,r=s.materials[t];let n;const o={},a=r.extensions||{},h=[];if(a[lo.KHR_MATERIALS_UNLIT]){const t=i[lo.KHR_MATERIALS_UNLIT];n=t.getMaterialType(),h.push(t.extendParams(o,r,e))}else{const s=r.pbrMetallicRoughness||{};if(o.color=new ci(1,1,1),o.opacity=1,Array.isArray(s.baseColorFactor)){const t=s.baseColorFactor;o.color.setRGB(t[0],t[1],t[2],Dt),o.opacity=t[3]}void 0!==s.baseColorTexture&&h.push(e.assignTexture(o,"map",s.baseColorTexture,Ft)),o.metalness=void 0!==s.metallicFactor?s.metallicFactor:1,o.roughness=void 0!==s.roughnessFactor?s.roughnessFactor:1,void 0!==s.metallicRoughnessTexture&&(h.push(e.assignTexture(o,"metalnessMap",s.metallicRoughnessTexture)),h.push(e.assignTexture(o,"roughnessMap",s.metallicRoughnessTexture))),n=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),h.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,o)}))))}!0===r.doubleSided&&(o.side=rt);const l=r.alphaMode||qo.OPAQUE;if(l===qo.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===qo.MASK&&(o.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&n!==mi&&(h.push(e.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new Te(1,1),void 0!==r.normalTexture.scale)){const t=r.normalTexture.scale;o.normalScale.set(t,t)}if(void 0!==r.occlusionTexture&&n!==mi&&(h.push(e.assignTexture(o,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(o.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&n!==mi){const t=r.emissiveFactor;o.emissive=(new ci).setRGB(t[0],t[1],t[2],Dt)}return void 0!==r.emissiveTexture&&n!==mi&&h.push(e.assignTexture(o,"emissiveMap",r.emissiveTexture,Ft)),Promise.all(h).then((function(){const s=new n(o);return r.name&&(s.name=r.name),Ko(s,r),e.associations.set(s,{materials:t}),r.extensions&&Go(i,s,r),s}))}createUniqueName(t){const e=no.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,s=this.extensions,i=this.primitiveCache;function r(t){return s[lo.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then((function(s){return oa(s,t,e)}))}const n=[];for(let o=0,a=t.length;o<a;o++){const s=t[o],a=$o(s),h=i[a];if(h)n.push(h.promise);else{let t;t=s.extensions&&s.extensions[lo.KHR_DRACO_MESH_COMPRESSION]?r(s):oa(new Ci,s,e),i[a]={primitive:s,promise:t},n.push(t)}}return Promise.all(n)}loadMesh(t){const e=this,s=this.json,i=this.extensions,r=s.meshes[t],n=r.primitives,o=[];for(let a=0,h=n.length;a<h;a++){const t=void 0===n[a].material?Zo(this.cache):this.getDependency("material",n[a].material);o.push(t)}return o.push(e.loadGeometries(n)),Promise.all(o).then((function(s){const o=s.slice(0,s.length-1),a=s[s.length-1],h=[];for(let c=0,u=a.length;c<u;c++){const s=a[c],l=n[c];let u;const d=o[c];if(l.mode===Fo.TRIANGLES||l.mode===Fo.TRIANGLE_STRIP||l.mode===Fo.TRIANGLE_FAN||void 0===l.mode)u=!0===r.isSkinnedMesh?new cr(s,d):new Hi(s,d),!0===u.isSkinnedMesh&&u.normalizeSkinWeights(),l.mode===Fo.TRIANGLE_STRIP?u.geometry=oo(u.geometry,Pt):l.mode===Fo.TRIANGLE_FAN&&(u.geometry=oo(u.geometry,Nt));else if(l.mode===Fo.LINES)u=new Wr(s,d);else if(l.mode===Fo.LINE_STRIP)u=new Dr(s,d);else if(l.mode===Fo.LINE_LOOP)u=new Yr(s,d);else{if(l.mode!==Fo.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+l.mode);u=new Jr(s,d)}Object.keys(u.geometry.morphAttributes).length>0&&Qo(u,r),u.name=e.createUniqueName(r.name||"mesh_"+t),Ko(u,r),l.extensions&&Go(i,u,l),e.assignFinalMaterial(u),h.push(u)}for(let i=0,r=h.length;i<r;i++)e.associations.set(h[i],{meshes:t,primitives:i});if(1===h.length)return r.extensions&&Go(i,h[0],r),h[0];const l=new Ki;r.extensions&&Go(i,l,r),e.associations.set(l,{meshes:t});for(let t=0,e=h.length;t<e;t++)l.add(h[t]);return l}))}loadCamera(t){let e;const s=this.json.cameras[t],i=s[s.type];if(i)return"perspective"===s.type?e=new Gi(we.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===s.type&&(e=new jn(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),s.name&&(e.name=this.createUniqueName(s.name)),Ko(e,s),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(t){const e=this.json.skins[t],s=[];for(let i=0,r=e.joints.length;i<r;i++)s.push(this._loadNodeShallow(e.joints[i]));return void 0!==e.inverseBindMatrices?s.push(this.getDependency("accessor",e.inverseBindMatrices)):s.push(null),Promise.all(s).then((function(t){const s=t.pop(),i=t,r=[],n=[];for(let o=0,a=i.length;o<a;o++){const t=i[o];if(t){r.push(t);const e=new _s;null!==s&&e.fromArray(s.array,16*o),n.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[o])}return new yr(r,n)}))}loadAnimation(t){const e=this.json,s=this,i=e.animations[t],r=i.name?i.name:"animation_"+t,n=[],o=[],a=[],h=[],l=[];for(let c=0,u=i.channels.length;c<u;c++){const t=i.channels[c],e=i.samplers[t.sampler],s=t.target,r=s.node,u=void 0!==i.parameters?i.parameters[e.input]:e.input,d=void 0!==i.parameters?i.parameters[e.output]:e.output;void 0!==s.node&&(n.push(this.getDependency("node",r)),o.push(this.getDependency("accessor",u)),a.push(this.getDependency("accessor",d)),h.push(e),l.push(s))}return Promise.all([Promise.all(n),Promise.all(o),Promise.all(a),Promise.all(h),Promise.all(l)]).then((function(t){const e=t[0],i=t[1],n=t[2],o=t[3],a=t[4],h=[];for(let r=0,l=e.length;r<l;r++){const t=e[r],l=i[r],c=n[r],u=o[r],d=a[r];if(void 0===t)continue;t.updateMatrix&&t.updateMatrix();const p=s._createAnimationTracks(t,l,c,u,d);if(p)for(let e=0;e<p.length;e++)h.push(p[e])}return new xn(r,void 0,h)}))}createNodeMesh(t){const e=this.json,s=this,i=e.nodes[t];return void 0===i.mesh?null:s.getDependency("mesh",i.mesh).then((function(t){const e=s._getNodeRef(s.meshCache,i.mesh,t);return void 0!==i.weights&&e.traverse((function(t){if(t.isMesh)for(let e=0,s=i.weights.length;e<s;e++)t.morphTargetInfluences[e]=i.weights[e]})),e}))}loadNode(t){const e=this.json,s=this,i=e.nodes[t],r=s._loadNodeShallow(t),n=[],o=i.children||[];for(let h=0,l=o.length;h<l;h++)n.push(s.getDependency("node",o[h]));const a=void 0===i.skin?Promise.resolve(null):s.getDependency("skin",i.skin);return Promise.all([r,Promise.all(n),a]).then((function(t){const e=t[0],s=t[1],i=t[2];null!==i&&e.traverse((function(t){t.isSkinnedMesh&&t.bind(i,ia)}));for(let r=0,n=s.length;r<n;r++)e.add(s[r]);return e}))}_loadNodeShallow(t){const e=this.json,s=this.extensions,i=this;if(void 0!==this.nodeCache[t])return this.nodeCache[t];const r=e.nodes[t],n=r.name?i.createUniqueName(r.name):"",o=[],a=i._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));return a&&o.push(a),void 0!==r.camera&&o.push(i.getDependency("camera",r.camera).then((function(t){return i._getNodeRef(i.cameraCache,r.camera,t)}))),i._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){o.push(t)})),this.nodeCache[t]=Promise.all(o).then((function(e){let o;if(o=!0===r.isBone?new ur:e.length>1?new Ki:1===e.length?e[0]:new Ys,o!==e[0])for(let t=0,s=e.length;t<s;t++)o.add(e[t]);if(r.name&&(o.userData.name=r.name,o.name=n),Ko(o,r),r.extensions&&Go(s,o,r),void 0!==r.matrix){const t=new _s;t.fromArray(r.matrix),o.applyMatrix4(t)}else void 0!==r.translation&&o.position.fromArray(r.translation),void 0!==r.rotation&&o.quaternion.fromArray(r.rotation),void 0!==r.scale&&o.scale.fromArray(r.scale);return i.associations.has(o)||i.associations.set(o,{}),i.associations.get(o).nodes=t,o})),this.nodeCache[t]}loadScene(t){const e=this.extensions,s=this.json.scenes[t],i=this,r=new Ki;s.name&&(r.name=i.createUniqueName(s.name)),Ko(r,s),s.extensions&&Go(e,r,s);const n=s.nodes||[],o=[];for(let a=0,h=n.length;a<h;a++)o.push(i.getDependency("node",n[a]));return Promise.all(o).then((function(t){for(let s=0,i=t.length;s<i;s++)r.add(t[s]);const e=t=>{const e=new Map;for(const[s,r]of i.associations)(s instanceof pi||s instanceof Fe)&&e.set(s,r);return t.traverse(t=>{const s=i.associations.get(t);null!=s&&e.set(t,s)}),e};return i.associations=e(r),r}))}_createAnimationTracks(t,e,s,i,r){const n=[],o=t.name?t.name:t.uuid,a=[];let h;switch(Yo[r.path]===Yo.weights?t.traverse((function(t){t.morphTargetInfluences&&a.push(t.name?t.name:t.uuid)})):a.push(o),Yo[r.path]){case Yo.weights:h=mn;break;case Yo.rotation:h=fn;break;case Yo.translation:case Yo.scale:h=_n;break;default:switch(s.itemSize){case 1:h=mn;break;case 2:case 3:default:h=_n;break}break}const l=void 0!==i.interpolation?Xo[i.interpolation]:Ot,c=this._getArrayFromAccessor(s);for(let u=0,d=a.length;u<d;u++){const t=new h(a[u]+"."+Yo[r.path],e.array,c,l);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(t),n.push(t)}return n}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const t=ea(e.constructor),s=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)s[i]=e[i]*t;e=s}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(t){const e=this instanceof fn?Bo:No;return new e(this.times,this.values,this.getValueSize()/3,t)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function na(t,e,s){const i=e.attributes,r=new Ye;if(void 0===i.POSITION)return;{const t=s.json.accessors[i.POSITION],e=t.min,n=t.max;if(void 0===e||void 0===n)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new Ve(e[0],e[1],e[2]),new Ve(n[0],n[1],n[2])),t.normalized){const e=ea(Do[t.componentType]);r.min.multiplyScalar(e),r.max.multiplyScalar(e)}}const n=e.targets;if(void 0!==n){const t=new Ve,e=new Ve;for(let i=0,r=n.length;i<r;i++){const r=n[i];if(void 0!==r.POSITION){const i=s.json.accessors[r.POSITION],n=i.min,o=i.max;if(void 0!==n&&void 0!==o){if(e.setX(Math.max(Math.abs(n[0]),Math.abs(o[0]))),e.setY(Math.max(Math.abs(n[1]),Math.abs(o[1]))),e.setZ(Math.max(Math.abs(n[2]),Math.abs(o[2]))),i.normalized){const t=ea(Do[i.componentType]);e.multiplyScalar(t)}t.max(e)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(t)}t.boundingBox=r;const o=new ls;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,t.boundingSphere=o}function oa(t,e,s){const i=e.attributes,r=[];function n(e,i){return s.getDependency("accessor",e).then((function(e){t.setAttribute(i,e)}))}for(const o in i){const e=Wo[o]||o.toLowerCase();e in t.attributes||r.push(n(i[o],e))}if(void 0!==e.indices&&!t.index){const i=s.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));r.push(i)}return Re.workingColorSpace!==Dt&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Re.workingColorSpace}" not supported.`),Ko(t,e),na(t,e,s),Promise.all(r).then((function(){return void 0!==e.targets?Jo(t,e.targets,s):t}))}class aa extends Ji{constructor(){super();const t=new Wi;t.deleteAttribute("uv");const e=new $r({side:it}),s=new $r,i=new Vn(16777215,900,28,2);i.position.set(.418,16.199,.3),this.add(i);const r=new Hi(t,e);r.position.set(-.757,13.219,.717),r.scale.set(31.713,28.305,28.591),this.add(r);const n=new Hi(t,s);n.position.set(-10.906,2.009,1.846),n.rotation.set(0,-.195,0),n.scale.set(2.328,7.905,4.651),this.add(n);const o=new Hi(t,s);o.position.set(-5.607,-.754,-.758),o.rotation.set(0,.994,0),o.scale.set(1.97,1.534,3.955),this.add(o);const a=new Hi(t,s);a.position.set(6.167,.857,7.803),a.rotation.set(0,.561,0),a.scale.set(3.927,6.285,3.687),this.add(a);const h=new Hi(t,s);h.position.set(-2.017,.018,6.124),h.rotation.set(0,.333,0),h.scale.set(2.002,4.566,2.064),this.add(h);const l=new Hi(t,s);l.position.set(2.291,-.756,-2.621),l.rotation.set(0,-.286,0),l.scale.set(1.546,1.552,1.496),this.add(l);const c=new Hi(t,s);c.position.set(-2.193,-.369,-5.547),c.rotation.set(0,.516,0),c.scale.set(3.875,3.487,2.986),this.add(c);const u=new Hi(t,ha(50));u.position.set(-16.116,14.37,8.208),u.scale.set(.1,2.428,2.739),this.add(u);const d=new Hi(t,ha(50));d.position.set(-16.109,18.021,-8.207),d.scale.set(.1,2.425,2.751),this.add(d);const p=new Hi(t,ha(17));p.position.set(14.904,12.198,-1.832),p.scale.set(.15,4.265,6.331),this.add(p);const m=new Hi(t,ha(43));m.position.set(-.462,8.89,14.52),m.scale.set(4.38,5.441,.088),this.add(m);const y=new Hi(t,ha(20));y.position.set(3.235,11.486,-12.541),y.scale.set(2.5,2,.1),this.add(y);const f=new Hi(t,ha(100));f.position.set(0,20,0),f.scale.set(1,.1,1),this.add(f)}dispose(){const t=new Set;this.traverse(e=>{e.isMesh&&(t.add(e.geometry),t.add(e.material))});for(const e of t)e.dispose()}}function ha(t){const e=new mi;return e.color.setScalar(t),e}class la extends Ys{constructor(t=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=t,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new Te(.5,.5),this.addEventListener("removed",(function(){this.traverse((function(t){t.element instanceof t.element.ownerDocument.defaultView.Element&&null!==t.element.parentNode&&t.element.remove()}))}))}copy(t,e){return super.copy(t,e),this.element=t.element.cloneNode(!0),this.center=t.center,this}}const ca=new Ve,ua=new _s,da=new _s,pa=new Ve,ma=new Ve;class ya{constructor(t={}){const e=this;let s,i,r,n;const o={objects:new WeakMap},a=void 0!==t.element?t.element:document.createElement("div");function h(t){t.isCSS2DObject&&(t.element.style.display="none");for(let e=0,s=t.children.length;e<s;e++)h(t.children[e])}function l(t,s,i){if(!1!==t.visible){if(t.isCSS2DObject){ca.setFromMatrixPosition(t.matrixWorld),ca.applyMatrix4(da);const h=ca.z>=-1&&ca.z<=1&&!0===t.layers.test(i.layers),l=t.element;l.style.display=!0===h?"":"none",!0===h&&(t.onBeforeRender(e,s,i),l.style.transform="translate("+-100*t.center.x+"%,"+-100*t.center.y+"%)translate("+(ca.x*r+r)+"px,"+(-ca.y*n+n)+"px)",l.parentNode!==a&&a.appendChild(l),t.onAfterRender(e,s,i));const u={distanceToCameraSquared:c(i,t)};o.objects.set(t,u)}for(let e=0,r=t.children.length;e<r;e++)l(t.children[e],s,i)}else h(t)}function c(t,e){return pa.setFromMatrixPosition(t.matrixWorld),ma.setFromMatrixPosition(e.matrixWorld),pa.distanceToSquared(ma)}function u(t){const e=[];return t.traverseVisible((function(t){t.isCSS2DObject&&e.push(t)})),e}function d(t){const e=u(t).sort((function(t,e){if(t.renderOrder!==e.renderOrder)return e.renderOrder-t.renderOrder;const s=o.objects.get(t).distanceToCameraSquared,i=o.objects.get(e).distanceToCameraSquared;return s-i})),s=e.length;for(let i=0,r=e.length;i<r;i++)e[i].element.style.zIndex=s-i}a.style.overflow="hidden",this.domElement=a,this.getSize=function(){return{width:s,height:i}},this.render=function(t,e){!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),ua.copy(e.matrixWorldInverse),da.multiplyMatrices(e.projectionMatrix,ua),l(t,t,e),d(t)},this.setSize=function(t,e){s=t,i=e,r=s/2,n=i/2,a.style.width=t+"px",a.style.height=e+"px"}}}var[fa,ga,_a,xa,ba,wa,Ta,Ma,va]=function*(t){while(1)yield t}(null),[Aa,Ea,Sa,Oa]=function*(t){while(1)yield t}(0),Ca={name:"Model",props:{data:{type:Array,default(){return[]}},glbUrl:{type:String,default(){return""}}},data(){return{}},created(){tt.install({THREE:this.THREE}),Sa=new this.THREE.Clock,Ta=new this.THREE.Raycaster,Ma=new this.THREE.Vector2},mounted(){wa=document.getElementById("instructions"),this.initRender(),this.initScene(),this.initCamera(),this.initControl(),this.initLight(),this.initLabelRender(),ba=new ao,ba.load("/example/worker.glb",t=>{const e=t.scene;ga.add(e),e.scale.set(.1,.1,.1)}),fa.domElement.addEventListener("mouseup",this.mouseClick,!1),fa.domElement.addEventListener("mousedown",this.mouseDown,!1),this.animate()},methods:{initRender(){fa=new this.THREE.WebGLRenderer({antialias:!0,alpha:!0,logarithmicDepthBuffer:!0}),fa.setPixelRatio(2*window.devicePixelRatio),fa.setSize(window.innerWidth,window.innerHeight),fa.domElement.id="three-model",fa.shadowMap.enabled=!0,fa.outputEncoding=this.THREE.sRGBEncoding,wa.appendChild(fa.domElement),fa.autoClear=!1,fa.autoClearColor=!1,fa.autoClearDepth=!1,fa.autoClearStencil=!1},initScene(){ga=new this.THREE.Scene},initCamera(){_a=new this.THREE.PerspectiveCamera(45,window.innerWidth/window.innerHeight,.1,1e3),_a.position.set(0,100,150)},initControl(){xa=new tt(_a,fa.domElement),xa.dollyToCursor=!0,xa.smoothTime=.1,xa.draggingSmoothTime=.05,xa.truckSpeed=2,xa.infinityDolly=!0,xa.minDistance=4},initLight(){const t=new this.THREE.PMREMGenerator(fa);ga.environment=t.fromScene(new aa,.04).texture},initLabelRender(){va=new ya,va.setSize(wa.offsetWidth,wa.offsetHeight),va.domElement.style.position="absolute",va.domElement.style.top="0px",va.domElement.style.pointerEvents="none",wa.appendChild(va.domElement)},mouseDown(){Ea=(new Date).getTime()},mouseClick(t){if(Aa=(new Date).getTime(),Aa-Ea<300){Ma.x=t.clientX/wa.offsetWidth*2-1,Ma.y=-t.clientY/wa.offsetHeight*2+1,Ta.setFromCamera(Ma,_a);const e=Ta.intersectObjects(ga.children,!0);console.log(e),0===t.button?this.$emit("leftClick",{objects:e.length>0?[e[0]]:[]}):2===t.button&&this.$emit("rightClick",{objects:e.length>0?[e[0]]:[],position:{x:t.clientX,y:t.clientY}})}},updateProperty(t){for(let e=0;e<t.length;e++){let s=t[e],i=ga.getObjectByName(s.name);if(i){switch(s.attr){case"color":i.material.color=new this.THREE.Color(s.value);break;case"visible":i.material.visible=s.value;break;case"opacity":i.material.opacity=s.value,i.material.transparent=!0;break}i.material.needsUpdate=!0}}},recoverColor(t){for(let e=0;e<t.length;e++){let s=t[e],i=ga.getObjectByName(s);i&&(i.material.color=i.material.userData.nColor,i.material.needsUpdate=!0)}},cameraLocation(t){xa.setLookAt(t.x,t.y,t.z,t.heading,t.pitch,t.roll,!0),xa.update(0)},billboard(t){const e=new la(t.billboard);e.name=t.labelClass,e.position.set(t.x,t.y,t.z),ga.add(e)},clearBillboard(t){if(ga&&ga.getObjectByName(t)){let e=ga.getObjectByName(t);ga.remove(e),this.clearBillboard()}},animate(){const t=Sa.getDelta();Oa+=t,requestAnimationFrame(this.animate),xa.enabled&&xa.update(Oa),va.render(ga,_a),fa.render(ga,_a)}}},Ra=Ca;s("9e3c");function za(t,e,s,i,r,n,o,a){var h,l="function"===typeof t?t.options:t;if(e&&(l.render=e,l.staticRenderFns=s,l._compiled=!0),i&&(l.functional=!0),n&&(l._scopeId="data-v-"+n),o?(h=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},l._ssrRegister=h):r&&(h=a?function(){r.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:r),h)if(l.functional){l._injectStyles=h;var c=l.render;l.render=function(t,e){return h.call(e),c(t,e)}}else{var u=l.beforeCreate;l.beforeCreate=u?[].concat(u,h):[h]}return{exports:t,options:l}}var La=za(Ra,n,o,!1,null,"6e91dd85",null),ka=La.exports,Ia=function(){var t=this,e=t._self._c;return e("div",[e("img",{attrs:{src:"/example/test.png",alt:""}}),e("button",{staticClass:"my-button",on:{click:t.handleClick}},[t._v(" "+t._s(t.text)+" ")])])},Pa=[],Na={name:"MyButton",props:{text:{type:String,default:"Click Me"}},methods:{handleClick(){this.$emit("click")}}},Ua=Na,Ba=(s("0162"),za(Ua,Ia,Pa,!1,null,"0b3e02cd",null)),Fa=Ba.exports;const Da=[ka,Fa],Ha=t=>{Da.forEach(e=>{t.component(e.name,e)})};"undefined"!==typeof window&&window.Vue&&Ha(window.Vue);var Va={install:Ha,Model:ka,MyButton:Fa};e["default"]=Va}})}));
|
|
2
14
|
//# sourceMappingURL=fl-web-component.umd.min.js.map
|