ifc-reader-2 1.1.9 → 1.2.0
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/dist/index.cjs +2 -2
- package/dist/index.js +3 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -36,5 +36,5 @@ return ret;
|
|
|
36
36
|
* @license
|
|
37
37
|
* Copyright 2010-2023 Three.js Authors
|
|
38
38
|
* SPDX-License-Identifier: MIT
|
|
39
|
-
*/const gU="162",bU=300,HM=1e3,cH=1001,BM=1002,MM=1003,Nx=1006,Ax=1008,Ox=1009,Sx=1014,Lx=1020,px=1023,IB=1026,UM=1027,mx="",Px=515,oH=2e3,xM=2001;class HU{addEventListener(r,l){this._listeners===void 0&&(this._listeners={});const t=this._listeners;t[r]===void 0&&(t[r]=[]),t[r].indexOf(l)===-1&&t[r].push(l)}hasEventListener(r,l){if(this._listeners===void 0)return!1;const t=this._listeners;return t[r]!==void 0&&t[r].indexOf(l)!==-1}removeEventListener(r,l){if(this._listeners===void 0)return;const F=this._listeners[r];if(F!==void 0){const $=F.indexOf(l);$!==-1&&F.splice($,1)}}dispatchEvent(r){if(this._listeners===void 0)return;const t=this._listeners[r.type];if(t!==void 0){r.target=this;const F=t.slice(0);for(let $=0,le=F.length;$<le;$++)F[$].call(this,r);r.target=null}}}const $o=["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"];function IM(){const e=Math.random()*4294967295|0,r=Math.random()*4294967295|0,l=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return($o[e&255]+$o[e>>8&255]+$o[e>>16&255]+$o[e>>24&255]+"-"+$o[r&255]+$o[r>>8&255]+"-"+$o[r>>16&15|64]+$o[r>>24&255]+"-"+$o[l&63|128]+$o[l>>8&255]+"-"+$o[l>>16&255]+$o[l>>24&255]+$o[t&255]+$o[t>>8&255]+$o[t>>16&255]+$o[t>>24&255]).toLowerCase()}function L7(e,r,l){return Math.max(r,Math.min(l,e))}class nb{constructor(r=0,l=0){nb.prototype.isVector2=!0,this.x=r,this.y=l}get width(){return this.x}set width(r){this.x=r}get height(){return this.y}set height(r){this.y=r}set(r,l){return this.x=r,this.y=l,this}setScalar(r){return this.x=r,this.y=r,this}setX(r){return this.x=r,this}setY(r){return this.y=r,this}setComponent(r,l){switch(r){case 0:this.x=l;break;case 1:this.y=l;break;default:throw new Error("index is out of range: "+r)}return this}getComponent(r){switch(r){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+r)}}clone(){return new this.constructor(this.x,this.y)}copy(r){return this.x=r.x,this.y=r.y,this}add(r){return this.x+=r.x,this.y+=r.y,this}addScalar(r){return this.x+=r,this.y+=r,this}addVectors(r,l){return this.x=r.x+l.x,this.y=r.y+l.y,this}addScaledVector(r,l){return this.x+=r.x*l,this.y+=r.y*l,this}sub(r){return this.x-=r.x,this.y-=r.y,this}subScalar(r){return this.x-=r,this.y-=r,this}subVectors(r,l){return this.x=r.x-l.x,this.y=r.y-l.y,this}multiply(r){return this.x*=r.x,this.y*=r.y,this}multiplyScalar(r){return this.x*=r,this.y*=r,this}divide(r){return this.x/=r.x,this.y/=r.y,this}divideScalar(r){return this.multiplyScalar(1/r)}applyMatrix3(r){const l=this.x,t=this.y,F=r.elements;return this.x=F[0]*l+F[3]*t+F[6],this.y=F[1]*l+F[4]*t+F[7],this}min(r){return this.x=Math.min(this.x,r.x),this.y=Math.min(this.y,r.y),this}max(r){return this.x=Math.max(this.x,r.x),this.y=Math.max(this.y,r.y),this}clamp(r,l){return this.x=Math.max(r.x,Math.min(l.x,this.x)),this.y=Math.max(r.y,Math.min(l.y,this.y)),this}clampScalar(r,l){return this.x=Math.max(r,Math.min(l,this.x)),this.y=Math.max(r,Math.min(l,this.y)),this}clampLength(r,l){const t=this.length();return this.divideScalar(t||1).multiplyScalar(Math.max(r,Math.min(l,t)))}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(r){return this.x*r.x+this.y*r.y}cross(r){return this.x*r.y-this.y*r.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(r){const l=Math.sqrt(this.lengthSq()*r.lengthSq());if(l===0)return Math.PI/2;const t=this.dot(r)/l;return Math.acos(L7(t,-1,1))}distanceTo(r){return Math.sqrt(this.distanceToSquared(r))}distanceToSquared(r){const l=this.x-r.x,t=this.y-r.y;return l*l+t*t}manhattanDistanceTo(r){return Math.abs(this.x-r.x)+Math.abs(this.y-r.y)}setLength(r){return this.normalize().multiplyScalar(r)}lerp(r,l){return this.x+=(r.x-this.x)*l,this.y+=(r.y-this.y)*l,this}lerpVectors(r,l,t){return this.x=r.x+(l.x-r.x)*t,this.y=r.y+(l.y-r.y)*t,this}equals(r){return r.x===this.x&&r.y===this.y}fromArray(r,l=0){return this.x=r[l],this.y=r[l+1],this}toArray(r=[],l=0){return r[l]=this.x,r[l+1]=this.y,r}fromBufferAttribute(r,l){return this.x=r.getX(l),this.y=r.getY(l),this}rotateAround(r,l){const t=Math.cos(l),F=Math.sin(l),$=this.x-r.x,le=this.y-r.y;return this.x=$*t-le*F+r.x,this.y=$*F+le*t+r.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Db{constructor(r,l,t,F,$,le,Te,Le,Se){Db.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],r!==void 0&&this.set(r,l,t,F,$,le,Te,Le,Se)}set(r,l,t,F,$,le,Te,Le,Se){const be=this.elements;return be[0]=r,be[1]=F,be[2]=Te,be[3]=l,be[4]=$,be[5]=Le,be[6]=t,be[7]=le,be[8]=Se,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(r){const l=this.elements,t=r.elements;return l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3],l[4]=t[4],l[5]=t[5],l[6]=t[6],l[7]=t[7],l[8]=t[8],this}extractBasis(r,l,t){return r.setFromMatrix3Column(this,0),l.setFromMatrix3Column(this,1),t.setFromMatrix3Column(this,2),this}setFromMatrix4(r){const l=r.elements;return this.set(l[0],l[4],l[8],l[1],l[5],l[9],l[2],l[6],l[10]),this}multiply(r){return this.multiplyMatrices(this,r)}premultiply(r){return this.multiplyMatrices(r,this)}multiplyMatrices(r,l){const t=r.elements,F=l.elements,$=this.elements,le=t[0],Te=t[3],Le=t[6],Se=t[1],be=t[4],xe=t[7],Ye=t[2],pe=t[5],Ze=t[8],lt=F[0],Tt=F[3],Dt=F[6],zt=F[1],Kt=F[4],Zt=F[7],fl=F[2],At=F[5],Pt=F[8];return $[0]=le*lt+Te*zt+Le*fl,$[3]=le*Tt+Te*Kt+Le*At,$[6]=le*Dt+Te*Zt+Le*Pt,$[1]=Se*lt+be*zt+xe*fl,$[4]=Se*Tt+be*Kt+xe*At,$[7]=Se*Dt+be*Zt+xe*Pt,$[2]=Ye*lt+pe*zt+Ze*fl,$[5]=Ye*Tt+pe*Kt+Ze*At,$[8]=Ye*Dt+pe*Zt+Ze*Pt,this}multiplyScalar(r){const l=this.elements;return l[0]*=r,l[3]*=r,l[6]*=r,l[1]*=r,l[4]*=r,l[7]*=r,l[2]*=r,l[5]*=r,l[8]*=r,this}determinant(){const r=this.elements,l=r[0],t=r[1],F=r[2],$=r[3],le=r[4],Te=r[5],Le=r[6],Se=r[7],be=r[8];return l*le*be-l*Te*Se-t*$*be+t*Te*Le+F*$*Se-F*le*Le}invert(){const r=this.elements,l=r[0],t=r[1],F=r[2],$=r[3],le=r[4],Te=r[5],Le=r[6],Se=r[7],be=r[8],xe=be*le-Te*Se,Ye=Te*Le-be*$,pe=Se*$-le*Le,Ze=l*xe+t*Ye+F*pe;if(Ze===0)return this.set(0,0,0,0,0,0,0,0,0);const lt=1/Ze;return r[0]=xe*lt,r[1]=(F*Se-be*t)*lt,r[2]=(Te*t-F*le)*lt,r[3]=Ye*lt,r[4]=(be*l-F*Le)*lt,r[5]=(F*$-Te*l)*lt,r[6]=pe*lt,r[7]=(t*Le-Se*l)*lt,r[8]=(le*l-t*$)*lt,this}transpose(){let r;const l=this.elements;return r=l[1],l[1]=l[3],l[3]=r,r=l[2],l[2]=l[6],l[6]=r,r=l[5],l[5]=l[7],l[7]=r,this}getNormalMatrix(r){return this.setFromMatrix4(r).invert().transpose()}transposeIntoArray(r){const l=this.elements;return r[0]=l[0],r[1]=l[3],r[2]=l[6],r[3]=l[1],r[4]=l[4],r[5]=l[7],r[6]=l[2],r[7]=l[5],r[8]=l[8],this}setUvTransform(r,l,t,F,$,le,Te){const Le=Math.cos($),Se=Math.sin($);return this.set(t*Le,t*Se,-t*(Le*le+Se*Te)+le+r,-F*Se,F*Le,-F*(-Se*le+Le*Te)+Te+l,0,0,1),this}scale(r,l){return this.premultiply(hB.makeScale(r,l)),this}rotate(r){return this.premultiply(hB.makeRotation(-r)),this}translate(r,l){return this.premultiply(hB.makeTranslation(r,l)),this}makeTranslation(r,l){return r.isVector2?this.set(1,0,r.x,0,1,r.y,0,0,1):this.set(1,0,r,0,1,l,0,0,1),this}makeRotation(r){const l=Math.cos(r),t=Math.sin(r);return this.set(l,-t,0,t,l,0,0,0,1),this}makeScale(r,l){return this.set(r,0,0,0,l,0,0,0,1),this}equals(r){const l=this.elements,t=r.elements;for(let F=0;F<9;F++)if(l[F]!==t[F])return!1;return!0}fromArray(r,l=0){for(let t=0;t<9;t++)this.elements[t]=r[t+l];return this}toArray(r=[],l=0){const t=this.elements;return r[l]=t[0],r[l+1]=t[1],r[l+2]=t[2],r[l+3]=t[3],r[l+4]=t[4],r[l+5]=t[5],r[l+6]=t[6],r[l+7]=t[7],r[l+8]=t[8],r}clone(){return new this.constructor().fromArray(this.elements)}}const hB=new Db;function GM(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function fB(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}let i9;class Cx{static getDataURL(r){if(/^data:/i.test(r.src)||typeof HTMLCanvasElement>"u")return r.src;let l;if(r instanceof HTMLCanvasElement)l=r;else{i9===void 0&&(i9=GM("canvas")),i9.width=r.width,i9.height=r.height;const t=i9.getContext("2d");r instanceof ImageData?t.putImageData(r,0,0):t.drawImage(r,0,0,r.width,r.height),l=i9}return l.width>2048||l.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",r),l.toDataURL("image/jpeg",.6)):l.toDataURL("image/png")}static sRGBToLinear(r){if(typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap){const l=GM("canvas");l.width=r.width,l.height=r.height;const t=l.getContext("2d");t.drawImage(r,0,0,r.width,r.height);const F=t.getImageData(0,0,r.width,r.height),$=F.data;for(let le=0;le<$.length;le++)$[le]=fB($[le]/255)*255;return t.putImageData(F,0,0),l}else if(r.data){const l=r.data.slice(0);for(let t=0;t<l.length;t++)l instanceof Uint8Array||l instanceof Uint8ClampedArray?l[t]=Math.floor(fB(l[t]/255)*255):l[t]=fB(l[t]);return{data:l,width:r.width,height:r.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),r}}let gx=0;class bx{constructor(r=null){this.isSource=!0,Object.defineProperty(this,"id",{value:gx++}),this.uuid=IM(),this.data=r,this.dataReady=!0,this.version=0}set needsUpdate(r){r===!0&&this.version++}toJSON(r){const l=r===void 0||typeof r=="string";if(!l&&r.images[this.uuid]!==void 0)return r.images[this.uuid];const t={uuid:this.uuid,url:""},F=this.data;if(F!==null){let $;if(Array.isArray(F)){$=[];for(let le=0,Te=F.length;le<Te;le++)F[le].isDataTexture?$.push(dB(F[le].image)):$.push(dB(F[le]))}else $=dB(F);t.url=$}return l||(r.images[this.uuid]=t),t}}function dB(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap?Cx.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Hx=0;class p8 extends HU{constructor(r=p8.DEFAULT_IMAGE,l=p8.DEFAULT_MAPPING,t=cH,F=cH,$=Nx,le=Ax,Te=px,Le=Ox,Se=p8.DEFAULT_ANISOTROPY,be=mx){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Hx++}),this.uuid=IM(),this.name="",this.source=new bx(r),this.mipmaps=[],this.mapping=l,this.channel=0,this.wrapS=t,this.wrapT=F,this.magFilter=$,this.minFilter=le,this.anisotropy=Se,this.format=Te,this.internalFormat=null,this.type=Le,this.offset=new nb(0,0),this.repeat=new nb(1,1),this.center=new nb(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Db,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=be,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(r=null){this.source.data=r}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(r){return this.name=r.name,this.source=r.source,this.mipmaps=r.mipmaps.slice(0),this.mapping=r.mapping,this.channel=r.channel,this.wrapS=r.wrapS,this.wrapT=r.wrapT,this.magFilter=r.magFilter,this.minFilter=r.minFilter,this.anisotropy=r.anisotropy,this.format=r.format,this.internalFormat=r.internalFormat,this.type=r.type,this.offset.copy(r.offset),this.repeat.copy(r.repeat),this.center.copy(r.center),this.rotation=r.rotation,this.matrixAutoUpdate=r.matrixAutoUpdate,this.matrix.copy(r.matrix),this.generateMipmaps=r.generateMipmaps,this.premultiplyAlpha=r.premultiplyAlpha,this.flipY=r.flipY,this.unpackAlignment=r.unpackAlignment,this.colorSpace=r.colorSpace,this.userData=JSON.parse(JSON.stringify(r.userData)),this.needsUpdate=!0,this}toJSON(r){const l=r===void 0||typeof r=="string";if(!l&&r.textures[this.uuid]!==void 0)return r.textures[this.uuid];const t={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(r).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&&(t.userData=this.userData),l||(r.textures[this.uuid]=t),t}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(r){if(this.mapping!==bU)return r;if(r.applyMatrix3(this.matrix),r.x<0||r.x>1)switch(this.wrapS){case HM:r.x=r.x-Math.floor(r.x);break;case cH:r.x=r.x<0?0:1;break;case BM:Math.abs(Math.floor(r.x)%2)===1?r.x=Math.ceil(r.x)-r.x:r.x=r.x-Math.floor(r.x);break}if(r.y<0||r.y>1)switch(this.wrapT){case HM:r.y=r.y-Math.floor(r.y);break;case cH:r.y=r.y<0?0:1;break;case BM:Math.abs(Math.floor(r.y)%2)===1?r.y=Math.ceil(r.y)-r.y:r.y=r.y-Math.floor(r.y);break}return this.flipY&&(r.y=1-r.y),r}set needsUpdate(r){r===!0&&(this.version++,this.source.needsUpdate=!0)}}p8.DEFAULT_IMAGE=null;p8.DEFAULT_MAPPING=bU;p8.DEFAULT_ANISOTROPY=1;class Nb{constructor(r=0,l=0,t=0,F=1){this.isQuaternion=!0,this._x=r,this._y=l,this._z=t,this._w=F}static slerpFlat(r,l,t,F,$,le,Te){let Le=t[F+0],Se=t[F+1],be=t[F+2],xe=t[F+3];const Ye=$[le+0],pe=$[le+1],Ze=$[le+2],lt=$[le+3];if(Te===0){r[l+0]=Le,r[l+1]=Se,r[l+2]=be,r[l+3]=xe;return}if(Te===1){r[l+0]=Ye,r[l+1]=pe,r[l+2]=Ze,r[l+3]=lt;return}if(xe!==lt||Le!==Ye||Se!==pe||be!==Ze){let Tt=1-Te;const Dt=Le*Ye+Se*pe+be*Ze+xe*lt,zt=Dt>=0?1:-1,Kt=1-Dt*Dt;if(Kt>Number.EPSILON){const fl=Math.sqrt(Kt),At=Math.atan2(fl,Dt*zt);Tt=Math.sin(Tt*At)/fl,Te=Math.sin(Te*At)/fl}const Zt=Te*zt;if(Le=Le*Tt+Ye*Zt,Se=Se*Tt+pe*Zt,be=be*Tt+Ze*Zt,xe=xe*Tt+lt*Zt,Tt===1-Te){const fl=1/Math.sqrt(Le*Le+Se*Se+be*be+xe*xe);Le*=fl,Se*=fl,be*=fl,xe*=fl}}r[l]=Le,r[l+1]=Se,r[l+2]=be,r[l+3]=xe}static multiplyQuaternionsFlat(r,l,t,F,$,le){const Te=t[F],Le=t[F+1],Se=t[F+2],be=t[F+3],xe=$[le],Ye=$[le+1],pe=$[le+2],Ze=$[le+3];return r[l]=Te*Ze+be*xe+Le*pe-Se*Ye,r[l+1]=Le*Ze+be*Ye+Se*xe-Te*pe,r[l+2]=Se*Ze+be*pe+Te*Ye-Le*xe,r[l+3]=be*Ze-Te*xe-Le*Ye-Se*pe,r}get x(){return this._x}set x(r){this._x=r,this._onChangeCallback()}get y(){return this._y}set y(r){this._y=r,this._onChangeCallback()}get z(){return this._z}set z(r){this._z=r,this._onChangeCallback()}get w(){return this._w}set w(r){this._w=r,this._onChangeCallback()}set(r,l,t,F){return this._x=r,this._y=l,this._z=t,this._w=F,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(r){return this._x=r.x,this._y=r.y,this._z=r.z,this._w=r.w,this._onChangeCallback(),this}setFromEuler(r,l=!0){const t=r._x,F=r._y,$=r._z,le=r._order,Te=Math.cos,Le=Math.sin,Se=Te(t/2),be=Te(F/2),xe=Te($/2),Ye=Le(t/2),pe=Le(F/2),Ze=Le($/2);switch(le){case"XYZ":this._x=Ye*be*xe+Se*pe*Ze,this._y=Se*pe*xe-Ye*be*Ze,this._z=Se*be*Ze+Ye*pe*xe,this._w=Se*be*xe-Ye*pe*Ze;break;case"YXZ":this._x=Ye*be*xe+Se*pe*Ze,this._y=Se*pe*xe-Ye*be*Ze,this._z=Se*be*Ze-Ye*pe*xe,this._w=Se*be*xe+Ye*pe*Ze;break;case"ZXY":this._x=Ye*be*xe-Se*pe*Ze,this._y=Se*pe*xe+Ye*be*Ze,this._z=Se*be*Ze+Ye*pe*xe,this._w=Se*be*xe-Ye*pe*Ze;break;case"ZYX":this._x=Ye*be*xe-Se*pe*Ze,this._y=Se*pe*xe+Ye*be*Ze,this._z=Se*be*Ze-Ye*pe*xe,this._w=Se*be*xe+Ye*pe*Ze;break;case"YZX":this._x=Ye*be*xe+Se*pe*Ze,this._y=Se*pe*xe+Ye*be*Ze,this._z=Se*be*Ze-Ye*pe*xe,this._w=Se*be*xe-Ye*pe*Ze;break;case"XZY":this._x=Ye*be*xe-Se*pe*Ze,this._y=Se*pe*xe-Ye*be*Ze,this._z=Se*be*Ze+Ye*pe*xe,this._w=Se*be*xe+Ye*pe*Ze;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+le)}return l===!0&&this._onChangeCallback(),this}setFromAxisAngle(r,l){const t=l/2,F=Math.sin(t);return this._x=r.x*F,this._y=r.y*F,this._z=r.z*F,this._w=Math.cos(t),this._onChangeCallback(),this}setFromRotationMatrix(r){const l=r.elements,t=l[0],F=l[4],$=l[8],le=l[1],Te=l[5],Le=l[9],Se=l[2],be=l[6],xe=l[10],Ye=t+Te+xe;if(Ye>0){const pe=.5/Math.sqrt(Ye+1);this._w=.25/pe,this._x=(be-Le)*pe,this._y=($-Se)*pe,this._z=(le-F)*pe}else if(t>Te&&t>xe){const pe=2*Math.sqrt(1+t-Te-xe);this._w=(be-Le)/pe,this._x=.25*pe,this._y=(F+le)/pe,this._z=($+Se)/pe}else if(Te>xe){const pe=2*Math.sqrt(1+Te-t-xe);this._w=($-Se)/pe,this._x=(F+le)/pe,this._y=.25*pe,this._z=(Le+be)/pe}else{const pe=2*Math.sqrt(1+xe-t-Te);this._w=(le-F)/pe,this._x=($+Se)/pe,this._y=(Le+be)/pe,this._z=.25*pe}return this._onChangeCallback(),this}setFromUnitVectors(r,l){let t=r.dot(l)+1;return t<Number.EPSILON?(t=0,Math.abs(r.x)>Math.abs(r.z)?(this._x=-r.y,this._y=r.x,this._z=0,this._w=t):(this._x=0,this._y=-r.z,this._z=r.y,this._w=t)):(this._x=r.y*l.z-r.z*l.y,this._y=r.z*l.x-r.x*l.z,this._z=r.x*l.y-r.y*l.x,this._w=t),this.normalize()}angleTo(r){return 2*Math.acos(Math.abs(L7(this.dot(r),-1,1)))}rotateTowards(r,l){const t=this.angleTo(r);if(t===0)return this;const F=Math.min(1,l/t);return this.slerp(r,F),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(r){return this._x*r._x+this._y*r._y+this._z*r._z+this._w*r._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 r=this.length();return r===0?(this._x=0,this._y=0,this._z=0,this._w=1):(r=1/r,this._x=this._x*r,this._y=this._y*r,this._z=this._z*r,this._w=this._w*r),this._onChangeCallback(),this}multiply(r){return this.multiplyQuaternions(this,r)}premultiply(r){return this.multiplyQuaternions(r,this)}multiplyQuaternions(r,l){const t=r._x,F=r._y,$=r._z,le=r._w,Te=l._x,Le=l._y,Se=l._z,be=l._w;return this._x=t*be+le*Te+F*Se-$*Le,this._y=F*be+le*Le+$*Te-t*Se,this._z=$*be+le*Se+t*Le-F*Te,this._w=le*be-t*Te-F*Le-$*Se,this._onChangeCallback(),this}slerp(r,l){if(l===0)return this;if(l===1)return this.copy(r);const t=this._x,F=this._y,$=this._z,le=this._w;let Te=le*r._w+t*r._x+F*r._y+$*r._z;if(Te<0?(this._w=-r._w,this._x=-r._x,this._y=-r._y,this._z=-r._z,Te=-Te):this.copy(r),Te>=1)return this._w=le,this._x=t,this._y=F,this._z=$,this;const Le=1-Te*Te;if(Le<=Number.EPSILON){const pe=1-l;return this._w=pe*le+l*this._w,this._x=pe*t+l*this._x,this._y=pe*F+l*this._y,this._z=pe*$+l*this._z,this.normalize(),this}const Se=Math.sqrt(Le),be=Math.atan2(Se,Te),xe=Math.sin((1-l)*be)/Se,Ye=Math.sin(l*be)/Se;return this._w=le*xe+this._w*Ye,this._x=t*xe+this._x*Ye,this._y=F*xe+this._y*Ye,this._z=$*xe+this._z*Ye,this._onChangeCallback(),this}slerpQuaternions(r,l,t){return this.copy(r).slerp(l,t)}random(){const r=2*Math.PI*Math.random(),l=2*Math.PI*Math.random(),t=Math.random(),F=Math.sqrt(1-t),$=Math.sqrt(t);return this.set(F*Math.sin(r),F*Math.cos(r),$*Math.sin(l),$*Math.cos(l))}equals(r){return r._x===this._x&&r._y===this._y&&r._z===this._z&&r._w===this._w}fromArray(r,l=0){return this._x=r[l],this._y=r[l+1],this._z=r[l+2],this._w=r[l+3],this._onChangeCallback(),this}toArray(r=[],l=0){return r[l]=this._x,r[l+1]=this._y,r[l+2]=this._z,r[l+3]=this._w,r}fromBufferAttribute(r,l){return this._x=r.getX(l),this._y=r.getY(l),this._z=r.getZ(l),this._w=r.getW(l),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(r){return this._onChangeCallback=r,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class kr{constructor(r=0,l=0,t=0){kr.prototype.isVector3=!0,this.x=r,this.y=l,this.z=t}set(r,l,t){return t===void 0&&(t=this.z),this.x=r,this.y=l,this.z=t,this}setScalar(r){return this.x=r,this.y=r,this.z=r,this}setX(r){return this.x=r,this}setY(r){return this.y=r,this}setZ(r){return this.z=r,this}setComponent(r,l){switch(r){case 0:this.x=l;break;case 1:this.y=l;break;case 2:this.z=l;break;default:throw new Error("index is out of range: "+r)}return this}getComponent(r){switch(r){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+r)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(r){return this.x=r.x,this.y=r.y,this.z=r.z,this}add(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this}addScalar(r){return this.x+=r,this.y+=r,this.z+=r,this}addVectors(r,l){return this.x=r.x+l.x,this.y=r.y+l.y,this.z=r.z+l.z,this}addScaledVector(r,l){return this.x+=r.x*l,this.y+=r.y*l,this.z+=r.z*l,this}sub(r){return this.x-=r.x,this.y-=r.y,this.z-=r.z,this}subScalar(r){return this.x-=r,this.y-=r,this.z-=r,this}subVectors(r,l){return this.x=r.x-l.x,this.y=r.y-l.y,this.z=r.z-l.z,this}multiply(r){return this.x*=r.x,this.y*=r.y,this.z*=r.z,this}multiplyScalar(r){return this.x*=r,this.y*=r,this.z*=r,this}multiplyVectors(r,l){return this.x=r.x*l.x,this.y=r.y*l.y,this.z=r.z*l.z,this}applyEuler(r){return this.applyQuaternion(FM.setFromEuler(r))}applyAxisAngle(r,l){return this.applyQuaternion(FM.setFromAxisAngle(r,l))}applyMatrix3(r){const l=this.x,t=this.y,F=this.z,$=r.elements;return this.x=$[0]*l+$[3]*t+$[6]*F,this.y=$[1]*l+$[4]*t+$[7]*F,this.z=$[2]*l+$[5]*t+$[8]*F,this}applyNormalMatrix(r){return this.applyMatrix3(r).normalize()}applyMatrix4(r){const l=this.x,t=this.y,F=this.z,$=r.elements,le=1/($[3]*l+$[7]*t+$[11]*F+$[15]);return this.x=($[0]*l+$[4]*t+$[8]*F+$[12])*le,this.y=($[1]*l+$[5]*t+$[9]*F+$[13])*le,this.z=($[2]*l+$[6]*t+$[10]*F+$[14])*le,this}applyQuaternion(r){const l=this.x,t=this.y,F=this.z,$=r.x,le=r.y,Te=r.z,Le=r.w,Se=2*(le*F-Te*t),be=2*(Te*l-$*F),xe=2*($*t-le*l);return this.x=l+Le*Se+le*xe-Te*be,this.y=t+Le*be+Te*Se-$*xe,this.z=F+Le*xe+$*be-le*Se,this}project(r){return this.applyMatrix4(r.matrixWorldInverse).applyMatrix4(r.projectionMatrix)}unproject(r){return this.applyMatrix4(r.projectionMatrixInverse).applyMatrix4(r.matrixWorld)}transformDirection(r){const l=this.x,t=this.y,F=this.z,$=r.elements;return this.x=$[0]*l+$[4]*t+$[8]*F,this.y=$[1]*l+$[5]*t+$[9]*F,this.z=$[2]*l+$[6]*t+$[10]*F,this.normalize()}divide(r){return this.x/=r.x,this.y/=r.y,this.z/=r.z,this}divideScalar(r){return this.multiplyScalar(1/r)}min(r){return this.x=Math.min(this.x,r.x),this.y=Math.min(this.y,r.y),this.z=Math.min(this.z,r.z),this}max(r){return this.x=Math.max(this.x,r.x),this.y=Math.max(this.y,r.y),this.z=Math.max(this.z,r.z),this}clamp(r,l){return this.x=Math.max(r.x,Math.min(l.x,this.x)),this.y=Math.max(r.y,Math.min(l.y,this.y)),this.z=Math.max(r.z,Math.min(l.z,this.z)),this}clampScalar(r,l){return this.x=Math.max(r,Math.min(l,this.x)),this.y=Math.max(r,Math.min(l,this.y)),this.z=Math.max(r,Math.min(l,this.z)),this}clampLength(r,l){const t=this.length();return this.divideScalar(t||1).multiplyScalar(Math.max(r,Math.min(l,t)))}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(r){return this.x*r.x+this.y*r.y+this.z*r.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(r){return this.normalize().multiplyScalar(r)}lerp(r,l){return this.x+=(r.x-this.x)*l,this.y+=(r.y-this.y)*l,this.z+=(r.z-this.z)*l,this}lerpVectors(r,l,t){return this.x=r.x+(l.x-r.x)*t,this.y=r.y+(l.y-r.y)*t,this.z=r.z+(l.z-r.z)*t,this}cross(r){return this.crossVectors(this,r)}crossVectors(r,l){const t=r.x,F=r.y,$=r.z,le=l.x,Te=l.y,Le=l.z;return this.x=F*Le-$*Te,this.y=$*le-t*Le,this.z=t*Te-F*le,this}projectOnVector(r){const l=r.lengthSq();if(l===0)return this.set(0,0,0);const t=r.dot(this)/l;return this.copy(r).multiplyScalar(t)}projectOnPlane(r){return yB.copy(this).projectOnVector(r),this.sub(yB)}reflect(r){return this.sub(yB.copy(r).multiplyScalar(2*this.dot(r)))}angleTo(r){const l=Math.sqrt(this.lengthSq()*r.lengthSq());if(l===0)return Math.PI/2;const t=this.dot(r)/l;return Math.acos(L7(t,-1,1))}distanceTo(r){return Math.sqrt(this.distanceToSquared(r))}distanceToSquared(r){const l=this.x-r.x,t=this.y-r.y,F=this.z-r.z;return l*l+t*t+F*F}manhattanDistanceTo(r){return Math.abs(this.x-r.x)+Math.abs(this.y-r.y)+Math.abs(this.z-r.z)}setFromSpherical(r){return this.setFromSphericalCoords(r.radius,r.phi,r.theta)}setFromSphericalCoords(r,l,t){const F=Math.sin(l)*r;return this.x=F*Math.sin(t),this.y=Math.cos(l)*r,this.z=F*Math.cos(t),this}setFromCylindrical(r){return this.setFromCylindricalCoords(r.radius,r.theta,r.y)}setFromCylindricalCoords(r,l,t){return this.x=r*Math.sin(l),this.y=t,this.z=r*Math.cos(l),this}setFromMatrixPosition(r){const l=r.elements;return this.x=l[12],this.y=l[13],this.z=l[14],this}setFromMatrixScale(r){const l=this.setFromMatrixColumn(r,0).length(),t=this.setFromMatrixColumn(r,1).length(),F=this.setFromMatrixColumn(r,2).length();return this.x=l,this.y=t,this.z=F,this}setFromMatrixColumn(r,l){return this.fromArray(r.elements,l*4)}setFromMatrix3Column(r,l){return this.fromArray(r.elements,l*3)}setFromEuler(r){return this.x=r._x,this.y=r._y,this.z=r._z,this}setFromColor(r){return this.x=r.r,this.y=r.g,this.z=r.b,this}equals(r){return r.x===this.x&&r.y===this.y&&r.z===this.z}fromArray(r,l=0){return this.x=r[l],this.y=r[l+1],this.z=r[l+2],this}toArray(r=[],l=0){return r[l]=this.x,r[l+1]=this.y,r[l+2]=this.z,r}fromBufferAttribute(r,l){return this.x=r.getX(l),this.y=r.getY(l),this.z=r.getZ(l),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const r=Math.random()*Math.PI*2,l=Math.random()*2-1,t=Math.sqrt(1-l*l);return this.x=t*Math.cos(r),this.y=l,this.z=t*Math.sin(r),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const yB=new kr,FM=new Nb;class s0{constructor(r,l,t,F,$,le,Te,Le,Se,be,xe,Ye,pe,Ze,lt,Tt){s0.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r!==void 0&&this.set(r,l,t,F,$,le,Te,Le,Se,be,xe,Ye,pe,Ze,lt,Tt)}set(r,l,t,F,$,le,Te,Le,Se,be,xe,Ye,pe,Ze,lt,Tt){const Dt=this.elements;return Dt[0]=r,Dt[4]=l,Dt[8]=t,Dt[12]=F,Dt[1]=$,Dt[5]=le,Dt[9]=Te,Dt[13]=Le,Dt[2]=Se,Dt[6]=be,Dt[10]=xe,Dt[14]=Ye,Dt[3]=pe,Dt[7]=Ze,Dt[11]=lt,Dt[15]=Tt,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 s0().fromArray(this.elements)}copy(r){const l=this.elements,t=r.elements;return l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3],l[4]=t[4],l[5]=t[5],l[6]=t[6],l[7]=t[7],l[8]=t[8],l[9]=t[9],l[10]=t[10],l[11]=t[11],l[12]=t[12],l[13]=t[13],l[14]=t[14],l[15]=t[15],this}copyPosition(r){const l=this.elements,t=r.elements;return l[12]=t[12],l[13]=t[13],l[14]=t[14],this}setFromMatrix3(r){const l=r.elements;return this.set(l[0],l[3],l[6],0,l[1],l[4],l[7],0,l[2],l[5],l[8],0,0,0,0,1),this}extractBasis(r,l,t){return r.setFromMatrixColumn(this,0),l.setFromMatrixColumn(this,1),t.setFromMatrixColumn(this,2),this}makeBasis(r,l,t){return this.set(r.x,l.x,t.x,0,r.y,l.y,t.y,0,r.z,l.z,t.z,0,0,0,0,1),this}extractRotation(r){const l=this.elements,t=r.elements,F=1/c9.setFromMatrixColumn(r,0).length(),$=1/c9.setFromMatrixColumn(r,1).length(),le=1/c9.setFromMatrixColumn(r,2).length();return l[0]=t[0]*F,l[1]=t[1]*F,l[2]=t[2]*F,l[3]=0,l[4]=t[4]*$,l[5]=t[5]*$,l[6]=t[6]*$,l[7]=0,l[8]=t[8]*le,l[9]=t[9]*le,l[10]=t[10]*le,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,this}makeRotationFromEuler(r){const l=this.elements,t=r.x,F=r.y,$=r.z,le=Math.cos(t),Te=Math.sin(t),Le=Math.cos(F),Se=Math.sin(F),be=Math.cos($),xe=Math.sin($);if(r.order==="XYZ"){const Ye=le*be,pe=le*xe,Ze=Te*be,lt=Te*xe;l[0]=Le*be,l[4]=-Le*xe,l[8]=Se,l[1]=pe+Ze*Se,l[5]=Ye-lt*Se,l[9]=-Te*Le,l[2]=lt-Ye*Se,l[6]=Ze+pe*Se,l[10]=le*Le}else if(r.order==="YXZ"){const Ye=Le*be,pe=Le*xe,Ze=Se*be,lt=Se*xe;l[0]=Ye+lt*Te,l[4]=Ze*Te-pe,l[8]=le*Se,l[1]=le*xe,l[5]=le*be,l[9]=-Te,l[2]=pe*Te-Ze,l[6]=lt+Ye*Te,l[10]=le*Le}else if(r.order==="ZXY"){const Ye=Le*be,pe=Le*xe,Ze=Se*be,lt=Se*xe;l[0]=Ye-lt*Te,l[4]=-le*xe,l[8]=Ze+pe*Te,l[1]=pe+Ze*Te,l[5]=le*be,l[9]=lt-Ye*Te,l[2]=-le*Se,l[6]=Te,l[10]=le*Le}else if(r.order==="ZYX"){const Ye=le*be,pe=le*xe,Ze=Te*be,lt=Te*xe;l[0]=Le*be,l[4]=Ze*Se-pe,l[8]=Ye*Se+lt,l[1]=Le*xe,l[5]=lt*Se+Ye,l[9]=pe*Se-Ze,l[2]=-Se,l[6]=Te*Le,l[10]=le*Le}else if(r.order==="YZX"){const Ye=le*Le,pe=le*Se,Ze=Te*Le,lt=Te*Se;l[0]=Le*be,l[4]=lt-Ye*xe,l[8]=Ze*xe+pe,l[1]=xe,l[5]=le*be,l[9]=-Te*be,l[2]=-Se*be,l[6]=pe*xe+Ze,l[10]=Ye-lt*xe}else if(r.order==="XZY"){const Ye=le*Le,pe=le*Se,Ze=Te*Le,lt=Te*Se;l[0]=Le*be,l[4]=-xe,l[8]=Se*be,l[1]=Ye*xe+lt,l[5]=le*be,l[9]=pe*xe-Ze,l[2]=Ze*xe-pe,l[6]=Te*be,l[10]=lt*xe+Ye}return l[3]=0,l[7]=0,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,this}makeRotationFromQuaternion(r){return this.compose(Bx,r,Mx)}lookAt(r,l,t){const F=this.elements;return _4.subVectors(r,l),_4.lengthSq()===0&&(_4.z=1),_4.normalize(),FD.crossVectors(t,_4),FD.lengthSq()===0&&(Math.abs(t.z)===1?_4.x+=1e-4:_4.z+=1e-4,_4.normalize(),FD.crossVectors(t,_4)),FD.normalize(),IH.crossVectors(_4,FD),F[0]=FD.x,F[4]=IH.x,F[8]=_4.x,F[1]=FD.y,F[5]=IH.y,F[9]=_4.y,F[2]=FD.z,F[6]=IH.z,F[10]=_4.z,this}multiply(r){return this.multiplyMatrices(this,r)}premultiply(r){return this.multiplyMatrices(r,this)}multiplyMatrices(r,l){const t=r.elements,F=l.elements,$=this.elements,le=t[0],Te=t[4],Le=t[8],Se=t[12],be=t[1],xe=t[5],Ye=t[9],pe=t[13],Ze=t[2],lt=t[6],Tt=t[10],Dt=t[14],zt=t[3],Kt=t[7],Zt=t[11],fl=t[15],At=F[0],Pt=F[4],bs=F[8],_n=F[12],Et=F[1],xt=F[5],Pr=F[9],ls=F[13],fs=F[2],pa=F[6],Bl=F[10],rl=F[14],Jc=F[3],tc=F[7],Cr=F[11],_c=F[15];return $[0]=le*At+Te*Et+Le*fs+Se*Jc,$[4]=le*Pt+Te*xt+Le*pa+Se*tc,$[8]=le*bs+Te*Pr+Le*Bl+Se*Cr,$[12]=le*_n+Te*ls+Le*rl+Se*_c,$[1]=be*At+xe*Et+Ye*fs+pe*Jc,$[5]=be*Pt+xe*xt+Ye*pa+pe*tc,$[9]=be*bs+xe*Pr+Ye*Bl+pe*Cr,$[13]=be*_n+xe*ls+Ye*rl+pe*_c,$[2]=Ze*At+lt*Et+Tt*fs+Dt*Jc,$[6]=Ze*Pt+lt*xt+Tt*pa+Dt*tc,$[10]=Ze*bs+lt*Pr+Tt*Bl+Dt*Cr,$[14]=Ze*_n+lt*ls+Tt*rl+Dt*_c,$[3]=zt*At+Kt*Et+Zt*fs+fl*Jc,$[7]=zt*Pt+Kt*xt+Zt*pa+fl*tc,$[11]=zt*bs+Kt*Pr+Zt*Bl+fl*Cr,$[15]=zt*_n+Kt*ls+Zt*rl+fl*_c,this}multiplyScalar(r){const l=this.elements;return l[0]*=r,l[4]*=r,l[8]*=r,l[12]*=r,l[1]*=r,l[5]*=r,l[9]*=r,l[13]*=r,l[2]*=r,l[6]*=r,l[10]*=r,l[14]*=r,l[3]*=r,l[7]*=r,l[11]*=r,l[15]*=r,this}determinant(){const r=this.elements,l=r[0],t=r[4],F=r[8],$=r[12],le=r[1],Te=r[5],Le=r[9],Se=r[13],be=r[2],xe=r[6],Ye=r[10],pe=r[14],Ze=r[3],lt=r[7],Tt=r[11],Dt=r[15];return Ze*(+$*Le*xe-F*Se*xe-$*Te*Ye+t*Se*Ye+F*Te*pe-t*Le*pe)+lt*(+l*Le*pe-l*Se*Ye+$*le*Ye-F*le*pe+F*Se*be-$*Le*be)+Tt*(+l*Se*xe-l*Te*pe-$*le*xe+t*le*pe+$*Te*be-t*Se*be)+Dt*(-F*Te*be-l*Le*xe+l*Te*Ye+F*le*xe-t*le*Ye+t*Le*be)}transpose(){const r=this.elements;let l;return l=r[1],r[1]=r[4],r[4]=l,l=r[2],r[2]=r[8],r[8]=l,l=r[6],r[6]=r[9],r[9]=l,l=r[3],r[3]=r[12],r[12]=l,l=r[7],r[7]=r[13],r[13]=l,l=r[11],r[11]=r[14],r[14]=l,this}setPosition(r,l,t){const F=this.elements;return r.isVector3?(F[12]=r.x,F[13]=r.y,F[14]=r.z):(F[12]=r,F[13]=l,F[14]=t),this}invert(){const r=this.elements,l=r[0],t=r[1],F=r[2],$=r[3],le=r[4],Te=r[5],Le=r[6],Se=r[7],be=r[8],xe=r[9],Ye=r[10],pe=r[11],Ze=r[12],lt=r[13],Tt=r[14],Dt=r[15],zt=xe*Tt*Se-lt*Ye*Se+lt*Le*pe-Te*Tt*pe-xe*Le*Dt+Te*Ye*Dt,Kt=Ze*Ye*Se-be*Tt*Se-Ze*Le*pe+le*Tt*pe+be*Le*Dt-le*Ye*Dt,Zt=be*lt*Se-Ze*xe*Se+Ze*Te*pe-le*lt*pe-be*Te*Dt+le*xe*Dt,fl=Ze*xe*Le-be*lt*Le-Ze*Te*Ye+le*lt*Ye+be*Te*Tt-le*xe*Tt,At=l*zt+t*Kt+F*Zt+$*fl;if(At===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const Pt=1/At;return r[0]=zt*Pt,r[1]=(lt*Ye*$-xe*Tt*$-lt*F*pe+t*Tt*pe+xe*F*Dt-t*Ye*Dt)*Pt,r[2]=(Te*Tt*$-lt*Le*$+lt*F*Se-t*Tt*Se-Te*F*Dt+t*Le*Dt)*Pt,r[3]=(xe*Le*$-Te*Ye*$-xe*F*Se+t*Ye*Se+Te*F*pe-t*Le*pe)*Pt,r[4]=Kt*Pt,r[5]=(be*Tt*$-Ze*Ye*$+Ze*F*pe-l*Tt*pe-be*F*Dt+l*Ye*Dt)*Pt,r[6]=(Ze*Le*$-le*Tt*$-Ze*F*Se+l*Tt*Se+le*F*Dt-l*Le*Dt)*Pt,r[7]=(le*Ye*$-be*Le*$+be*F*Se-l*Ye*Se-le*F*pe+l*Le*pe)*Pt,r[8]=Zt*Pt,r[9]=(Ze*xe*$-be*lt*$-Ze*t*pe+l*lt*pe+be*t*Dt-l*xe*Dt)*Pt,r[10]=(le*lt*$-Ze*Te*$+Ze*t*Se-l*lt*Se-le*t*Dt+l*Te*Dt)*Pt,r[11]=(be*Te*$-le*xe*$-be*t*Se+l*xe*Se+le*t*pe-l*Te*pe)*Pt,r[12]=fl*Pt,r[13]=(be*lt*F-Ze*xe*F+Ze*t*Ye-l*lt*Ye-be*t*Tt+l*xe*Tt)*Pt,r[14]=(Ze*Te*F-le*lt*F-Ze*t*Le+l*lt*Le+le*t*Tt-l*Te*Tt)*Pt,r[15]=(le*xe*F-be*Te*F+be*t*Le-l*xe*Le-le*t*Ye+l*Te*Ye)*Pt,this}scale(r){const l=this.elements,t=r.x,F=r.y,$=r.z;return l[0]*=t,l[4]*=F,l[8]*=$,l[1]*=t,l[5]*=F,l[9]*=$,l[2]*=t,l[6]*=F,l[10]*=$,l[3]*=t,l[7]*=F,l[11]*=$,this}getMaxScaleOnAxis(){const r=this.elements,l=r[0]*r[0]+r[1]*r[1]+r[2]*r[2],t=r[4]*r[4]+r[5]*r[5]+r[6]*r[6],F=r[8]*r[8]+r[9]*r[9]+r[10]*r[10];return Math.sqrt(Math.max(l,t,F))}makeTranslation(r,l,t){return r.isVector3?this.set(1,0,0,r.x,0,1,0,r.y,0,0,1,r.z,0,0,0,1):this.set(1,0,0,r,0,1,0,l,0,0,1,t,0,0,0,1),this}makeRotationX(r){const l=Math.cos(r),t=Math.sin(r);return this.set(1,0,0,0,0,l,-t,0,0,t,l,0,0,0,0,1),this}makeRotationY(r){const l=Math.cos(r),t=Math.sin(r);return this.set(l,0,t,0,0,1,0,0,-t,0,l,0,0,0,0,1),this}makeRotationZ(r){const l=Math.cos(r),t=Math.sin(r);return this.set(l,-t,0,0,t,l,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(r,l){const t=Math.cos(l),F=Math.sin(l),$=1-t,le=r.x,Te=r.y,Le=r.z,Se=$*le,be=$*Te;return this.set(Se*le+t,Se*Te-F*Le,Se*Le+F*Te,0,Se*Te+F*Le,be*Te+t,be*Le-F*le,0,Se*Le-F*Te,be*Le+F*le,$*Le*Le+t,0,0,0,0,1),this}makeScale(r,l,t){return this.set(r,0,0,0,0,l,0,0,0,0,t,0,0,0,0,1),this}makeShear(r,l,t,F,$,le){return this.set(1,t,$,0,r,1,le,0,l,F,1,0,0,0,0,1),this}compose(r,l,t){const F=this.elements,$=l._x,le=l._y,Te=l._z,Le=l._w,Se=$+$,be=le+le,xe=Te+Te,Ye=$*Se,pe=$*be,Ze=$*xe,lt=le*be,Tt=le*xe,Dt=Te*xe,zt=Le*Se,Kt=Le*be,Zt=Le*xe,fl=t.x,At=t.y,Pt=t.z;return F[0]=(1-(lt+Dt))*fl,F[1]=(pe+Zt)*fl,F[2]=(Ze-Kt)*fl,F[3]=0,F[4]=(pe-Zt)*At,F[5]=(1-(Ye+Dt))*At,F[6]=(Tt+zt)*At,F[7]=0,F[8]=(Ze+Kt)*Pt,F[9]=(Tt-zt)*Pt,F[10]=(1-(Ye+lt))*Pt,F[11]=0,F[12]=r.x,F[13]=r.y,F[14]=r.z,F[15]=1,this}decompose(r,l,t){const F=this.elements;let $=c9.set(F[0],F[1],F[2]).length();const le=c9.set(F[4],F[5],F[6]).length(),Te=c9.set(F[8],F[9],F[10]).length();this.determinant()<0&&($=-$),r.x=F[12],r.y=F[13],r.z=F[14],Py.copy(this);const Se=1/$,be=1/le,xe=1/Te;return Py.elements[0]*=Se,Py.elements[1]*=Se,Py.elements[2]*=Se,Py.elements[4]*=be,Py.elements[5]*=be,Py.elements[6]*=be,Py.elements[8]*=xe,Py.elements[9]*=xe,Py.elements[10]*=xe,l.setFromRotationMatrix(Py),t.x=$,t.y=le,t.z=Te,this}makePerspective(r,l,t,F,$,le,Te=oH){const Le=this.elements,Se=2*$/(l-r),be=2*$/(t-F),xe=(l+r)/(l-r),Ye=(t+F)/(t-F);let pe,Ze;if(Te===oH)pe=-(le+$)/(le-$),Ze=-2*le*$/(le-$);else if(Te===xM)pe=-le/(le-$),Ze=-le*$/(le-$);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+Te);return Le[0]=Se,Le[4]=0,Le[8]=xe,Le[12]=0,Le[1]=0,Le[5]=be,Le[9]=Ye,Le[13]=0,Le[2]=0,Le[6]=0,Le[10]=pe,Le[14]=Ze,Le[3]=0,Le[7]=0,Le[11]=-1,Le[15]=0,this}makeOrthographic(r,l,t,F,$,le,Te=oH){const Le=this.elements,Se=1/(l-r),be=1/(t-F),xe=1/(le-$),Ye=(l+r)*Se,pe=(t+F)*be;let Ze,lt;if(Te===oH)Ze=(le+$)*xe,lt=-2*xe;else if(Te===xM)Ze=$*xe,lt=-1*xe;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+Te);return Le[0]=2*Se,Le[4]=0,Le[8]=0,Le[12]=-Ye,Le[1]=0,Le[5]=2*be,Le[9]=0,Le[13]=-pe,Le[2]=0,Le[6]=0,Le[10]=lt,Le[14]=-Ze,Le[3]=0,Le[7]=0,Le[11]=0,Le[15]=1,this}equals(r){const l=this.elements,t=r.elements;for(let F=0;F<16;F++)if(l[F]!==t[F])return!1;return!0}fromArray(r,l=0){for(let t=0;t<16;t++)this.elements[t]=r[t+l];return this}toArray(r=[],l=0){const t=this.elements;return r[l]=t[0],r[l+1]=t[1],r[l+2]=t[2],r[l+3]=t[3],r[l+4]=t[4],r[l+5]=t[5],r[l+6]=t[6],r[l+7]=t[7],r[l+8]=t[8],r[l+9]=t[9],r[l+10]=t[10],r[l+11]=t[11],r[l+12]=t[12],r[l+13]=t[13],r[l+14]=t[14],r[l+15]=t[15],r}}const c9=new kr,Py=new s0,Bx=new kr(0,0,0),Mx=new kr(1,1,1),FD=new kr,IH=new kr,_4=new kr,VM=new s0,WM=new Nb;class HH{constructor(r=0,l=0,t=0,F=HH.DEFAULT_ORDER){this.isEuler=!0,this._x=r,this._y=l,this._z=t,this._order=F}get x(){return this._x}set x(r){this._x=r,this._onChangeCallback()}get y(){return this._y}set y(r){this._y=r,this._onChangeCallback()}get z(){return this._z}set z(r){this._z=r,this._onChangeCallback()}get order(){return this._order}set order(r){this._order=r,this._onChangeCallback()}set(r,l,t,F=this._order){return this._x=r,this._y=l,this._z=t,this._order=F,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(r){return this._x=r._x,this._y=r._y,this._z=r._z,this._order=r._order,this._onChangeCallback(),this}setFromRotationMatrix(r,l=this._order,t=!0){const F=r.elements,$=F[0],le=F[4],Te=F[8],Le=F[1],Se=F[5],be=F[9],xe=F[2],Ye=F[6],pe=F[10];switch(l){case"XYZ":this._y=Math.asin(L7(Te,-1,1)),Math.abs(Te)<.9999999?(this._x=Math.atan2(-be,pe),this._z=Math.atan2(-le,$)):(this._x=Math.atan2(Ye,Se),this._z=0);break;case"YXZ":this._x=Math.asin(-L7(be,-1,1)),Math.abs(be)<.9999999?(this._y=Math.atan2(Te,pe),this._z=Math.atan2(Le,Se)):(this._y=Math.atan2(-xe,$),this._z=0);break;case"ZXY":this._x=Math.asin(L7(Ye,-1,1)),Math.abs(Ye)<.9999999?(this._y=Math.atan2(-xe,pe),this._z=Math.atan2(-le,Se)):(this._y=0,this._z=Math.atan2(Le,$));break;case"ZYX":this._y=Math.asin(-L7(xe,-1,1)),Math.abs(xe)<.9999999?(this._x=Math.atan2(Ye,pe),this._z=Math.atan2(Le,$)):(this._x=0,this._z=Math.atan2(-le,Se));break;case"YZX":this._z=Math.asin(L7(Le,-1,1)),Math.abs(Le)<.9999999?(this._x=Math.atan2(-be,Se),this._y=Math.atan2(-xe,$)):(this._x=0,this._y=Math.atan2(Te,pe));break;case"XZY":this._z=Math.asin(-L7(le,-1,1)),Math.abs(le)<.9999999?(this._x=Math.atan2(Ye,Se),this._y=Math.atan2(Te,$)):(this._x=Math.atan2(-be,pe),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+l)}return this._order=l,t===!0&&this._onChangeCallback(),this}setFromQuaternion(r,l,t){return VM.makeRotationFromQuaternion(r),this.setFromRotationMatrix(VM,l,t)}setFromVector3(r,l=this._order){return this.set(r.x,r.y,r.z,l)}reorder(r){return WM.setFromEuler(this),this.setFromQuaternion(WM,r)}equals(r){return r._x===this._x&&r._y===this._y&&r._z===this._z&&r._order===this._order}fromArray(r){return this._x=r[0],this._y=r[1],this._z=r[2],r[3]!==void 0&&(this._order=r[3]),this._onChangeCallback(),this}toArray(r=[],l=0){return r[l]=this._x,r[l+1]=this._y,r[l+2]=this._z,r[l+3]=this._order,r}_onChange(r){return this._onChangeCallback=r,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}HH.DEFAULT_ORDER="XYZ";class Ux{constructor(){this.mask=1}set(r){this.mask=(1<<r|0)>>>0}enable(r){this.mask|=1<<r|0}enableAll(){this.mask=-1}toggle(r){this.mask^=1<<r|0}disable(r){this.mask&=~(1<<r|0)}disableAll(){this.mask=0}test(r){return(this.mask&r.mask)!==0}isEnabled(r){return(this.mask&(1<<r|0))!==0}}let xx=0;const jM=new kr,o9=new Nb,S7=new s0,hH=new kr,_g=new kr,Gx=new kr,Fx=new Nb,YM=new kr(1,0,0),qM=new kr(0,1,0),kM=new kr(0,0,1),Vx={type:"added"},Wx={type:"removed"},wB={type:"childadded",child:null},TB={type:"childremoved",child:null};class AO extends HU{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:xx++}),this.uuid=IM(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=AO.DEFAULT_UP.clone();const r=new kr,l=new HH,t=new Nb,F=new kr(1,1,1);function $(){t.setFromEuler(l,!1)}function le(){l.setFromQuaternion(t,void 0,!1)}l._onChange($),t._onChange(le),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:r},rotation:{configurable:!0,enumerable:!0,value:l},quaternion:{configurable:!0,enumerable:!0,value:t},scale:{configurable:!0,enumerable:!0,value:F},modelViewMatrix:{value:new s0},normalMatrix:{value:new Db}}),this.matrix=new s0,this.matrixWorld=new s0,this.matrixAutoUpdate=AO.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=AO.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ux,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(r){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(r),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(r){return this.quaternion.premultiply(r),this}setRotationFromAxisAngle(r,l){this.quaternion.setFromAxisAngle(r,l)}setRotationFromEuler(r){this.quaternion.setFromEuler(r,!0)}setRotationFromMatrix(r){this.quaternion.setFromRotationMatrix(r)}setRotationFromQuaternion(r){this.quaternion.copy(r)}rotateOnAxis(r,l){return o9.setFromAxisAngle(r,l),this.quaternion.multiply(o9),this}rotateOnWorldAxis(r,l){return o9.setFromAxisAngle(r,l),this.quaternion.premultiply(o9),this}rotateX(r){return this.rotateOnAxis(YM,r)}rotateY(r){return this.rotateOnAxis(qM,r)}rotateZ(r){return this.rotateOnAxis(kM,r)}translateOnAxis(r,l){return jM.copy(r).applyQuaternion(this.quaternion),this.position.add(jM.multiplyScalar(l)),this}translateX(r){return this.translateOnAxis(YM,r)}translateY(r){return this.translateOnAxis(qM,r)}translateZ(r){return this.translateOnAxis(kM,r)}localToWorld(r){return this.updateWorldMatrix(!0,!1),r.applyMatrix4(this.matrixWorld)}worldToLocal(r){return this.updateWorldMatrix(!0,!1),r.applyMatrix4(S7.copy(this.matrixWorld).invert())}lookAt(r,l,t){r.isVector3?hH.copy(r):hH.set(r,l,t);const F=this.parent;this.updateWorldMatrix(!0,!1),_g.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?S7.lookAt(_g,hH,this.up):S7.lookAt(hH,_g,this.up),this.quaternion.setFromRotationMatrix(S7),F&&(S7.extractRotation(F.matrixWorld),o9.setFromRotationMatrix(S7),this.quaternion.premultiply(o9.invert()))}add(r){if(arguments.length>1){for(let l=0;l<arguments.length;l++)this.add(arguments[l]);return this}return r===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",r),this):(r&&r.isObject3D?(r.parent!==null&&r.parent.remove(r),r.parent=this,this.children.push(r),r.dispatchEvent(Vx),wB.child=r,this.dispatchEvent(wB),wB.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",r),this)}remove(r){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const l=this.children.indexOf(r);return l!==-1&&(r.parent=null,this.children.splice(l,1),r.dispatchEvent(Wx),TB.child=r,this.dispatchEvent(TB),TB.child=null),this}removeFromParent(){const r=this.parent;return r!==null&&r.remove(this),this}clear(){return this.remove(...this.children)}attach(r){return this.updateWorldMatrix(!0,!1),S7.copy(this.matrixWorld).invert(),r.parent!==null&&(r.parent.updateWorldMatrix(!0,!1),S7.multiply(r.parent.matrixWorld)),r.applyMatrix4(S7),this.add(r),r.updateWorldMatrix(!1,!0),this}getObjectById(r){return this.getObjectByProperty("id",r)}getObjectByName(r){return this.getObjectByProperty("name",r)}getObjectByProperty(r,l){if(this[r]===l)return this;for(let t=0,F=this.children.length;t<F;t++){const le=this.children[t].getObjectByProperty(r,l);if(le!==void 0)return le}}getObjectsByProperty(r,l,t=[]){this[r]===l&&t.push(this);const F=this.children;for(let $=0,le=F.length;$<le;$++)F[$].getObjectsByProperty(r,l,t);return t}getWorldPosition(r){return this.updateWorldMatrix(!0,!1),r.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(r){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_g,r,Gx),r}getWorldScale(r){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_g,Fx,r),r}getWorldDirection(r){this.updateWorldMatrix(!0,!1);const l=this.matrixWorld.elements;return r.set(l[8],l[9],l[10]).normalize()}raycast(){}traverse(r){r(this);const l=this.children;for(let t=0,F=l.length;t<F;t++)l[t].traverse(r)}traverseVisible(r){if(this.visible===!1)return;r(this);const l=this.children;for(let t=0,F=l.length;t<F;t++)l[t].traverseVisible(r)}traverseAncestors(r){const l=this.parent;l!==null&&(r(l),l.traverseAncestors(r))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(r){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,r=!0);const l=this.children;for(let t=0,F=l.length;t<F;t++){const $=l[t];($.matrixWorldAutoUpdate===!0||r===!0)&&$.updateMatrixWorld(r)}}updateWorldMatrix(r,l){const t=this.parent;if(r===!0&&t!==null&&t.matrixWorldAutoUpdate===!0&&t.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),l===!0){const F=this.children;for(let $=0,le=F.length;$<le;$++){const Te=F[$];Te.matrixWorldAutoUpdate===!0&&Te.updateWorldMatrix(!1,!0)}}}toJSON(r){const l=r===void 0||typeof r=="string",t={};l&&(r={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},t.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const F={};F.uuid=this.uuid,F.type=this.type,this.name!==""&&(F.name=this.name),this.castShadow===!0&&(F.castShadow=!0),this.receiveShadow===!0&&(F.receiveShadow=!0),this.visible===!1&&(F.visible=!1),this.frustumCulled===!1&&(F.frustumCulled=!1),this.renderOrder!==0&&(F.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(F.userData=this.userData),F.layers=this.layers.mask,F.matrix=this.matrix.toArray(),F.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(F.matrixAutoUpdate=!1),this.isInstancedMesh&&(F.type="InstancedMesh",F.count=this.count,F.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(F.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(F.type="BatchedMesh",F.perObjectFrustumCulled=this.perObjectFrustumCulled,F.sortObjects=this.sortObjects,F.drawRanges=this._drawRanges,F.reservedRanges=this._reservedRanges,F.visibility=this._visibility,F.active=this._active,F.bounds=this._bounds.map(Te=>({boxInitialized:Te.boxInitialized,boxMin:Te.box.min.toArray(),boxMax:Te.box.max.toArray(),sphereInitialized:Te.sphereInitialized,sphereRadius:Te.sphere.radius,sphereCenter:Te.sphere.center.toArray()})),F.maxGeometryCount=this._maxGeometryCount,F.maxVertexCount=this._maxVertexCount,F.maxIndexCount=this._maxIndexCount,F.geometryInitialized=this._geometryInitialized,F.geometryCount=this._geometryCount,F.matricesTexture=this._matricesTexture.toJSON(r),this.boundingSphere!==null&&(F.boundingSphere={center:F.boundingSphere.center.toArray(),radius:F.boundingSphere.radius}),this.boundingBox!==null&&(F.boundingBox={min:F.boundingBox.min.toArray(),max:F.boundingBox.max.toArray()}));function $(Te,Le){return Te[Le.uuid]===void 0&&(Te[Le.uuid]=Le.toJSON(r)),Le.uuid}if(this.isScene)this.background&&(this.background.isColor?F.background=this.background.toJSON():this.background.isTexture&&(F.background=this.background.toJSON(r).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(F.environment=this.environment.toJSON(r).uuid);else if(this.isMesh||this.isLine||this.isPoints){F.geometry=$(r.geometries,this.geometry);const Te=this.geometry.parameters;if(Te!==void 0&&Te.shapes!==void 0){const Le=Te.shapes;if(Array.isArray(Le))for(let Se=0,be=Le.length;Se<be;Se++){const xe=Le[Se];$(r.shapes,xe)}else $(r.shapes,Le)}}if(this.isSkinnedMesh&&(F.bindMode=this.bindMode,F.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&($(r.skeletons,this.skeleton),F.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const Te=[];for(let Le=0,Se=this.material.length;Le<Se;Le++)Te.push($(r.materials,this.material[Le]));F.material=Te}else F.material=$(r.materials,this.material);if(this.children.length>0){F.children=[];for(let Te=0;Te<this.children.length;Te++)F.children.push(this.children[Te].toJSON(r).object)}if(this.animations.length>0){F.animations=[];for(let Te=0;Te<this.animations.length;Te++){const Le=this.animations[Te];F.animations.push($(r.animations,Le))}}if(l){const Te=le(r.geometries),Le=le(r.materials),Se=le(r.textures),be=le(r.images),xe=le(r.shapes),Ye=le(r.skeletons),pe=le(r.animations),Ze=le(r.nodes);Te.length>0&&(t.geometries=Te),Le.length>0&&(t.materials=Le),Se.length>0&&(t.textures=Se),be.length>0&&(t.images=be),xe.length>0&&(t.shapes=xe),Ye.length>0&&(t.skeletons=Ye),pe.length>0&&(t.animations=pe),Ze.length>0&&(t.nodes=Ze)}return t.object=F,t;function le(Te){const Le=[];for(const Se in Te){const be=Te[Se];delete be.metadata,Le.push(be)}return Le}}clone(r){return new this.constructor().copy(this,r)}copy(r,l=!0){if(this.name=r.name,this.up.copy(r.up),this.position.copy(r.position),this.rotation.order=r.rotation.order,this.quaternion.copy(r.quaternion),this.scale.copy(r.scale),this.matrix.copy(r.matrix),this.matrixWorld.copy(r.matrixWorld),this.matrixAutoUpdate=r.matrixAutoUpdate,this.matrixWorldAutoUpdate=r.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=r.matrixWorldNeedsUpdate,this.layers.mask=r.layers.mask,this.visible=r.visible,this.castShadow=r.castShadow,this.receiveShadow=r.receiveShadow,this.frustumCulled=r.frustumCulled,this.renderOrder=r.renderOrder,this.animations=r.animations.slice(),this.userData=JSON.parse(JSON.stringify(r.userData)),l===!0)for(let t=0;t<r.children.length;t++){const F=r.children[t];this.add(F.clone())}return this}}AO.DEFAULT_UP=new kr(0,1,0);AO.DEFAULT_MATRIX_AUTO_UPDATE=!0;AO.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class jx extends p8{constructor(r,l,t,F,$,le,Te,Le,Se,be){if(be=be!==void 0?be:IB,be!==IB&&be!==UM)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");t===void 0&&be===IB&&(t=Sx),t===void 0&&be===UM&&(t=Lx),super(null,F,$,le,Te,Le,be,t,Se),this.isDepthTexture=!0,this.image={width:r,height:l},this.magFilter=Te!==void 0?Te:MM,this.minFilter=Le!==void 0?Le:MM,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(r){return super.copy(r),this.compareFunction=r.compareFunction,this}toJSON(r){const l=super.toJSON(r);return this.compareFunction!==null&&(l.compareFunction=this.compareFunction),l}}const Yx=new jx(1,1);Yx.compareFunction=Px;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:gU}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=gU);class qx{constructor(){this.factor=1,this.complement=1}apply(r){const t=this.getScaleMatrix().multiply(r);r.copy(t)}setUp(r){var $;this.factor=1;const l=this.getLengthUnits(r);if(!l)return;const t=l==null,F=l.Name===void 0||l.Name===null;t||F||(l.Name.value==="FOOT"?this.factor=.3048:(($=l.Prefix)==null?void 0:$.value)==="MILLI"&&(this.complement=.001))}getLengthUnits(r){try{const t=r.GetLineIDsWithType(0,tx).get(0),F=r.GetLine(0,t);for(const $ of F.Units){if(!$||$.value===null||$.value===void 0)continue;const le=r.GetLine(0,$.value);if(le.UnitType&&le.UnitType.value==="LENGTHUNIT")return le}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const r=this.factor;return new s0().fromArray([r,0,0,0,0,r,0,0,0,0,r,0,0,0,0,1])}}class kx{constructor(){this.itemsByFloor={},this._units=new qx}setUp(r){this._units.setUp(r),this.cleanUp();try{const l=r.GetLineIDsWithType(0,fe),t=new Set,F=r.GetLineIDsWithType(0,pr);for(let Se=0;Se<F.size();Se++)t.add(F.get(Se));const $=r.GetLineIDsWithType(0,R),le=$.size();for(let Se=0;Se<le;Se++){const be=$.get(Se),xe=r.GetLine(0,be);if(!xe||!xe.RelatingObject||!xe.RelatedObjects)continue;const Ye=xe.RelatingObject.value,pe=xe.RelatedObjects;for(const Ze of pe){const lt=Ze.value;t.has(lt)&&(this.itemsByFloor[lt]=Ye)}}const Te={},Le=l.size();for(let Se=0;Se<Le;Se++){const be=l.get(Se),xe=r.GetLine(0,be);if(!xe||!xe.RelatingStructure||!xe.RelatedElements)continue;const Ye=xe.RelatingStructure.value,pe=xe.RelatedElements;if(t.has(Ye))for(const Ze of pe){Te[Ye]||(Te[Ye]=[]);const lt=Ze.value;Te[Ye].push(lt)}else for(const Ze of pe){const lt=Ze.value;this.itemsByFloor[lt]=Ye}}for(const Se in Te){const be=this.itemsByFloor[Se];if(be!==void 0){const xe=Te[Se];for(const Ye of xe)this.itemsByFloor[Ye]=be}}for(let Se=0;Se<le;Se++){const be=$.get(Se),xe=r.GetLine(0,be);if(!xe||!xe.RelatingObject||!xe.RelatedObjects)continue;const Ye=xe.RelatingObject.value,pe=xe.RelatedObjects;for(const Ze of pe){const lt=Ze.value,Tt=this.itemsByFloor[Ye];Tt!==void 0&&(this.itemsByFloor[lt]=Tt)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}const zx=new Set([1123145078,574549367,1675464909,2059837836,3798115385,32440307,3125803723,3207858831,2740243338,2624227202,4240577450,3615266464,3724593414,220341763,477187591,1878645084,1300840506,3303107099,1607154358,1878645084,846575682,1351298697,2417041796,3049322572,3331915920,1416205885,776857604,3285139300,3958052878,2827736869,2732653382,673634403,3448662350,4142052618,2924175390,803316827,2556980723,1809719519,2205249479,807026263,3737207727,1660063152,2347385850,3940055652,2705031697,3732776249,2485617015,2611217952,1704287377,2937912522,2770003689,1281925730,1484403080,3448662350,4142052618,3800577675,4006246654,3590301190,1383045692,2775532180,2047409740,370225590,3593883385,2665983363,4124623270,812098782,3649129432,987898635,1105321065,3510044353,1635779807,2603310189,3406155212,1310608509,4261334040,2736907675,3649129432,1136057603,1260505505,4182860854,2713105998,2898889636,59481748,3749851601,3486308946,3150382593,1062206242,3264961684,15328376,1485152156,370225590,1981873012,2859738748,45288368,2614616156,2732653382,775493141,2147822146,2601014836,2629017746,1186437898,2367409068,1213902940,3632507154,3900360178,476780140,1472233963,2804161546,3008276851,738692330,374418227,315944413,3905492369,3570813810,2571569899,178912537,2294589976,1437953363,2133299955,572779678,3092502836,388784114,2624227202,1425443689,3057273783,2347385850,1682466193,2519244187,2839578677,3958567839,2513912981,2830218821,427810014]);class Kx{async export(r,l,t=!1,F=!0){const $={},le=new Set(r.GetIfcEntityList(l)),Te=new Set([Wy,xi,Oa,Zi,pr]);for(const Le of Te)le.add(Le);for(const Le of le){if(zx.has(Le))continue;const Se=Te.has(Le)&&F,be=r.GetLineIDsWithType(l,Le);for(const xe of be){const Ye=r.GetLine(0,xe,Se,t);$[Ye.expressID]=Ye}}return $}}class Qx{constructor(){this.normal=[],this.position=[],this.instances=[],this.id=""}}class $x{constructor(){this.id="",this.transform=[],this.material=new hM}}class hM{constructor(){this.Name="",this.Opacity=1,this.Metalness=0,this.Roughness=1,this.Red=225,this.Green=225,this.Blue=225}}class BU{constructor(){this.Materials=[],this.Elements=[],this.Data=new MU,this.CameraData=new BH}}class MU{constructor(){this.Data={}}}class Zx{constructor(){this.Data={},this.CameraData=new BH}}class EB{constructor(){this.Solids=[],this.Id="",this.Instances=[]}}class UU{constructor(){this.MaterialIndex=0,this.Vertices=[],this.Indices=[],this.Buffer=[],this.Id="",this.GeometryId="",this.Transform=[]}}class xU{constructor(){this.BasisX=new Sa,this.BasisY=new Sa,this.BasisZ=new Sa,this.Offset=new Sa,this.Id="",this.Matrix=new s0}}class Sa{constructor(r=0,l=0,t=0){this.X=0,this.Y=0,this.Z=0,this.X=r,this.Y=l,this.Z=t}}class BH{constructor(){this.scale=0,this.origin=new Sa,this.eyePosition=new Sa,this.upDirection=new Sa,this.forwardDirection=new Sa,this.target=new Sa,this.box=new GU}}class GU{constructor(){this.min=new Sa,this.max=new Sa}}const mH=class mH{constructor(){this._webIfc=new Rx,this.settings=new Dx,this._fragments=new Map,this._spatialTree=new kx,this._propertyExporter=new Kx,this._materials=[],this._groupByGeometryId={},this.settings.excludedCategories.add(Gu)}async setup(){this.settings.autoSetWasm&&await this.autoSetWasm()}async autoSetWasm(){const r=await fetch(`https://unpkg.com/@thatopen/components@${mH.release}/package.json`);if(!r.ok){console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");return}const l=await r.json();if(!("web-ifc"in l.peerDependencies))console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.");else{const t=l.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${t}/`,this.settings.wasm.absolute=!0}}async loadByUrl(r){this._dispose();const t=await(await fetch(r)).arrayBuffer(),F=new Uint8Array(t);return await this.load2(F)}async load2(r,l=!0){await this.readIfcFile(r);const t=await this.getAllGeometries2(),F=await this.getAllProperties();let $=new BU;$.Elements=t.elements,t.material.forEach((le,Te)=>{let Le=new hM;Le.Red=Math.round(le.x*255),Le.Green=Math.round(le.y*255),Le.Blue=Math.round(le.z*255),Le.Opacity=le.w,Le.Name=Te.toString(),$.Materials.push(Le)});for(const le of Object.keys(F)){let Te=F,Le=this.flattenObject(Te[le]),Se={};for(const be of Object.keys(Le)){let xe={name:be,value:Le[be]?Le[be].toString():""};Se[be]=xe}$.Data.Data[Le.expressID]=Se}return $.CameraData=this.generateBoundingbox($.Elements),$}async readIfcFile(r){const{path:l,absolute:t,logLevel:F}=this.settings.wasm;return this._webIfc.SetWasmPath(l,t),await this._webIfc.Init(),F&&this._webIfc.SetLogLevel(F),this._webIfc.OpenModel(r,this.settings.webIfc)}async getAllGeometries2(){this._spatialTree.setUp(this._webIfc);const r=this._webIfc.GetIfcEntityList(0),l=[];for(const F of r){if(!this._webIfc.IsIfcElement(F)&&F!==pr)continue;const $=this.settings.includedCategories;if($.size>0&&!$.has(F))continue;if(this.settings.excludedCategories.has(F))continue;const le=this._webIfc.GetLineIDsWithType(0,F),Te=le.size();for(let Le=0;Le<Te;Le++){const Se=le.get(Le);l.push(Se),this._spatialTree.itemsByFloor[Se]}}this._spatialTree.cleanUp();let t=[];return this._webIfc.StreamMeshes(0,l,(F,$,le)=>{this.getMesh2(F)}),t=this.generateInstancedMesh(),{elements:t,material:this._materials}}getMesh2(r){let l=new EB;const t=r.geometries.size(),F=r.expressID;l.Id=F.toString();for(let $=0;$<t;$++){let le=new UU;const Te=r.geometries.get($),{x:Le,y:Se,z:be,w:xe}=Te.color;let Ye=this._materials.findIndex(zt=>zt.x==Le&&zt.y==Se&&zt.z==be&&zt.w==xe);Ye<0&&(this._materials.push({x:Le,y:Se,z:be,w:xe}),Ye=this._materials.length-1),le.MaterialIndex=Ye;const pe=xe!==1,{geometryExpressID:Ze}=Te,lt=`${Ze}-${pe}`,Tt=this.getGeometry(this._webIfc,Ze);new s0().fromArray(Te.flatTransformation);for(let zt=0;zt<Tt.position.length;zt+=3){const Kt=Tt.position[zt],Zt=Tt.position[zt+1],fl=Tt.position[zt+2],At=new kr(Kt,Zt,fl);//!switch back to revit xyz, get revit axis is a standard for every format so we dont have to recode again.
|
|
40
|
-
le.Vertices.push(new Sa(-At.x,At.z,At.y))}le.Indices=Tt.index,le.GeometryId=lt,le.Transform=Te.flatTransformation,le.Id=F.toString(),this._groupByGeometryId[lt]||(this._groupByGeometryId[lt]=[]),this._groupByGeometryId[lt].push(le),l.Solids.push(le)}return l}getGeometry(r,l){const t=r.GetGeometry(0,l),F=r.GetIndexArray(t.GetIndexData(),t.GetIndexDataSize()),$=r.GetVertexArray(t.GetVertexData(),t.GetVertexDataSize()),le=new Float32Array($.length/2),Te=new Float32Array($.length/2);for(let Le=0;Le<$.length;Le+=6)le[Le/2]=$[Le],le[Le/2+1]=$[Le+1],le[Le/2+2]=$[Le+2],Te[Le/2]=$[Le+3],Te[Le/2+1]=$[Le+4],Te[Le/2+2]=$[Le+5];return t.delete(),{position:le,normal:Te,index:Array.from(F)}}async getAllProperties(){return await this._propertyExporter.export(this._webIfc,0)}async getWorldCoordinationMatrix(){return this._webIfc.GetCoordinationMatrix(0)}async _dispose(){this.
|
|
39
|
+
*/const gU="162",bU=300,HM=1e3,cH=1001,BM=1002,MM=1003,Nx=1006,Ax=1008,Ox=1009,Sx=1014,Lx=1020,px=1023,IB=1026,UM=1027,mx="",Px=515,oH=2e3,xM=2001;class HU{addEventListener(r,l){this._listeners===void 0&&(this._listeners={});const t=this._listeners;t[r]===void 0&&(t[r]=[]),t[r].indexOf(l)===-1&&t[r].push(l)}hasEventListener(r,l){if(this._listeners===void 0)return!1;const t=this._listeners;return t[r]!==void 0&&t[r].indexOf(l)!==-1}removeEventListener(r,l){if(this._listeners===void 0)return;const F=this._listeners[r];if(F!==void 0){const $=F.indexOf(l);$!==-1&&F.splice($,1)}}dispatchEvent(r){if(this._listeners===void 0)return;const t=this._listeners[r.type];if(t!==void 0){r.target=this;const F=t.slice(0);for(let $=0,le=F.length;$<le;$++)F[$].call(this,r);r.target=null}}}const $o=["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"];function IM(){const e=Math.random()*4294967295|0,r=Math.random()*4294967295|0,l=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return($o[e&255]+$o[e>>8&255]+$o[e>>16&255]+$o[e>>24&255]+"-"+$o[r&255]+$o[r>>8&255]+"-"+$o[r>>16&15|64]+$o[r>>24&255]+"-"+$o[l&63|128]+$o[l>>8&255]+"-"+$o[l>>16&255]+$o[l>>24&255]+$o[t&255]+$o[t>>8&255]+$o[t>>16&255]+$o[t>>24&255]).toLowerCase()}function L7(e,r,l){return Math.max(r,Math.min(l,e))}class nb{constructor(r=0,l=0){nb.prototype.isVector2=!0,this.x=r,this.y=l}get width(){return this.x}set width(r){this.x=r}get height(){return this.y}set height(r){this.y=r}set(r,l){return this.x=r,this.y=l,this}setScalar(r){return this.x=r,this.y=r,this}setX(r){return this.x=r,this}setY(r){return this.y=r,this}setComponent(r,l){switch(r){case 0:this.x=l;break;case 1:this.y=l;break;default:throw new Error("index is out of range: "+r)}return this}getComponent(r){switch(r){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+r)}}clone(){return new this.constructor(this.x,this.y)}copy(r){return this.x=r.x,this.y=r.y,this}add(r){return this.x+=r.x,this.y+=r.y,this}addScalar(r){return this.x+=r,this.y+=r,this}addVectors(r,l){return this.x=r.x+l.x,this.y=r.y+l.y,this}addScaledVector(r,l){return this.x+=r.x*l,this.y+=r.y*l,this}sub(r){return this.x-=r.x,this.y-=r.y,this}subScalar(r){return this.x-=r,this.y-=r,this}subVectors(r,l){return this.x=r.x-l.x,this.y=r.y-l.y,this}multiply(r){return this.x*=r.x,this.y*=r.y,this}multiplyScalar(r){return this.x*=r,this.y*=r,this}divide(r){return this.x/=r.x,this.y/=r.y,this}divideScalar(r){return this.multiplyScalar(1/r)}applyMatrix3(r){const l=this.x,t=this.y,F=r.elements;return this.x=F[0]*l+F[3]*t+F[6],this.y=F[1]*l+F[4]*t+F[7],this}min(r){return this.x=Math.min(this.x,r.x),this.y=Math.min(this.y,r.y),this}max(r){return this.x=Math.max(this.x,r.x),this.y=Math.max(this.y,r.y),this}clamp(r,l){return this.x=Math.max(r.x,Math.min(l.x,this.x)),this.y=Math.max(r.y,Math.min(l.y,this.y)),this}clampScalar(r,l){return this.x=Math.max(r,Math.min(l,this.x)),this.y=Math.max(r,Math.min(l,this.y)),this}clampLength(r,l){const t=this.length();return this.divideScalar(t||1).multiplyScalar(Math.max(r,Math.min(l,t)))}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(r){return this.x*r.x+this.y*r.y}cross(r){return this.x*r.y-this.y*r.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(r){const l=Math.sqrt(this.lengthSq()*r.lengthSq());if(l===0)return Math.PI/2;const t=this.dot(r)/l;return Math.acos(L7(t,-1,1))}distanceTo(r){return Math.sqrt(this.distanceToSquared(r))}distanceToSquared(r){const l=this.x-r.x,t=this.y-r.y;return l*l+t*t}manhattanDistanceTo(r){return Math.abs(this.x-r.x)+Math.abs(this.y-r.y)}setLength(r){return this.normalize().multiplyScalar(r)}lerp(r,l){return this.x+=(r.x-this.x)*l,this.y+=(r.y-this.y)*l,this}lerpVectors(r,l,t){return this.x=r.x+(l.x-r.x)*t,this.y=r.y+(l.y-r.y)*t,this}equals(r){return r.x===this.x&&r.y===this.y}fromArray(r,l=0){return this.x=r[l],this.y=r[l+1],this}toArray(r=[],l=0){return r[l]=this.x,r[l+1]=this.y,r}fromBufferAttribute(r,l){return this.x=r.getX(l),this.y=r.getY(l),this}rotateAround(r,l){const t=Math.cos(l),F=Math.sin(l),$=this.x-r.x,le=this.y-r.y;return this.x=$*t-le*F+r.x,this.y=$*F+le*t+r.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Db{constructor(r,l,t,F,$,le,Te,Le,Se){Db.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],r!==void 0&&this.set(r,l,t,F,$,le,Te,Le,Se)}set(r,l,t,F,$,le,Te,Le,Se){const be=this.elements;return be[0]=r,be[1]=F,be[2]=Te,be[3]=l,be[4]=$,be[5]=Le,be[6]=t,be[7]=le,be[8]=Se,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(r){const l=this.elements,t=r.elements;return l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3],l[4]=t[4],l[5]=t[5],l[6]=t[6],l[7]=t[7],l[8]=t[8],this}extractBasis(r,l,t){return r.setFromMatrix3Column(this,0),l.setFromMatrix3Column(this,1),t.setFromMatrix3Column(this,2),this}setFromMatrix4(r){const l=r.elements;return this.set(l[0],l[4],l[8],l[1],l[5],l[9],l[2],l[6],l[10]),this}multiply(r){return this.multiplyMatrices(this,r)}premultiply(r){return this.multiplyMatrices(r,this)}multiplyMatrices(r,l){const t=r.elements,F=l.elements,$=this.elements,le=t[0],Te=t[3],Le=t[6],Se=t[1],be=t[4],xe=t[7],Ye=t[2],pe=t[5],Ze=t[8],lt=F[0],Tt=F[3],Dt=F[6],zt=F[1],Kt=F[4],Zt=F[7],fl=F[2],At=F[5],Pt=F[8];return $[0]=le*lt+Te*zt+Le*fl,$[3]=le*Tt+Te*Kt+Le*At,$[6]=le*Dt+Te*Zt+Le*Pt,$[1]=Se*lt+be*zt+xe*fl,$[4]=Se*Tt+be*Kt+xe*At,$[7]=Se*Dt+be*Zt+xe*Pt,$[2]=Ye*lt+pe*zt+Ze*fl,$[5]=Ye*Tt+pe*Kt+Ze*At,$[8]=Ye*Dt+pe*Zt+Ze*Pt,this}multiplyScalar(r){const l=this.elements;return l[0]*=r,l[3]*=r,l[6]*=r,l[1]*=r,l[4]*=r,l[7]*=r,l[2]*=r,l[5]*=r,l[8]*=r,this}determinant(){const r=this.elements,l=r[0],t=r[1],F=r[2],$=r[3],le=r[4],Te=r[5],Le=r[6],Se=r[7],be=r[8];return l*le*be-l*Te*Se-t*$*be+t*Te*Le+F*$*Se-F*le*Le}invert(){const r=this.elements,l=r[0],t=r[1],F=r[2],$=r[3],le=r[4],Te=r[5],Le=r[6],Se=r[7],be=r[8],xe=be*le-Te*Se,Ye=Te*Le-be*$,pe=Se*$-le*Le,Ze=l*xe+t*Ye+F*pe;if(Ze===0)return this.set(0,0,0,0,0,0,0,0,0);const lt=1/Ze;return r[0]=xe*lt,r[1]=(F*Se-be*t)*lt,r[2]=(Te*t-F*le)*lt,r[3]=Ye*lt,r[4]=(be*l-F*Le)*lt,r[5]=(F*$-Te*l)*lt,r[6]=pe*lt,r[7]=(t*Le-Se*l)*lt,r[8]=(le*l-t*$)*lt,this}transpose(){let r;const l=this.elements;return r=l[1],l[1]=l[3],l[3]=r,r=l[2],l[2]=l[6],l[6]=r,r=l[5],l[5]=l[7],l[7]=r,this}getNormalMatrix(r){return this.setFromMatrix4(r).invert().transpose()}transposeIntoArray(r){const l=this.elements;return r[0]=l[0],r[1]=l[3],r[2]=l[6],r[3]=l[1],r[4]=l[4],r[5]=l[7],r[6]=l[2],r[7]=l[5],r[8]=l[8],this}setUvTransform(r,l,t,F,$,le,Te){const Le=Math.cos($),Se=Math.sin($);return this.set(t*Le,t*Se,-t*(Le*le+Se*Te)+le+r,-F*Se,F*Le,-F*(-Se*le+Le*Te)+Te+l,0,0,1),this}scale(r,l){return this.premultiply(hB.makeScale(r,l)),this}rotate(r){return this.premultiply(hB.makeRotation(-r)),this}translate(r,l){return this.premultiply(hB.makeTranslation(r,l)),this}makeTranslation(r,l){return r.isVector2?this.set(1,0,r.x,0,1,r.y,0,0,1):this.set(1,0,r,0,1,l,0,0,1),this}makeRotation(r){const l=Math.cos(r),t=Math.sin(r);return this.set(l,-t,0,t,l,0,0,0,1),this}makeScale(r,l){return this.set(r,0,0,0,l,0,0,0,1),this}equals(r){const l=this.elements,t=r.elements;for(let F=0;F<9;F++)if(l[F]!==t[F])return!1;return!0}fromArray(r,l=0){for(let t=0;t<9;t++)this.elements[t]=r[t+l];return this}toArray(r=[],l=0){const t=this.elements;return r[l]=t[0],r[l+1]=t[1],r[l+2]=t[2],r[l+3]=t[3],r[l+4]=t[4],r[l+5]=t[5],r[l+6]=t[6],r[l+7]=t[7],r[l+8]=t[8],r}clone(){return new this.constructor().fromArray(this.elements)}}const hB=new Db;function GM(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function fB(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}let i9;class Cx{static getDataURL(r){if(/^data:/i.test(r.src)||typeof HTMLCanvasElement>"u")return r.src;let l;if(r instanceof HTMLCanvasElement)l=r;else{i9===void 0&&(i9=GM("canvas")),i9.width=r.width,i9.height=r.height;const t=i9.getContext("2d");r instanceof ImageData?t.putImageData(r,0,0):t.drawImage(r,0,0,r.width,r.height),l=i9}return l.width>2048||l.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",r),l.toDataURL("image/jpeg",.6)):l.toDataURL("image/png")}static sRGBToLinear(r){if(typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap){const l=GM("canvas");l.width=r.width,l.height=r.height;const t=l.getContext("2d");t.drawImage(r,0,0,r.width,r.height);const F=t.getImageData(0,0,r.width,r.height),$=F.data;for(let le=0;le<$.length;le++)$[le]=fB($[le]/255)*255;return t.putImageData(F,0,0),l}else if(r.data){const l=r.data.slice(0);for(let t=0;t<l.length;t++)l instanceof Uint8Array||l instanceof Uint8ClampedArray?l[t]=Math.floor(fB(l[t]/255)*255):l[t]=fB(l[t]);return{data:l,width:r.width,height:r.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),r}}let gx=0;class bx{constructor(r=null){this.isSource=!0,Object.defineProperty(this,"id",{value:gx++}),this.uuid=IM(),this.data=r,this.dataReady=!0,this.version=0}set needsUpdate(r){r===!0&&this.version++}toJSON(r){const l=r===void 0||typeof r=="string";if(!l&&r.images[this.uuid]!==void 0)return r.images[this.uuid];const t={uuid:this.uuid,url:""},F=this.data;if(F!==null){let $;if(Array.isArray(F)){$=[];for(let le=0,Te=F.length;le<Te;le++)F[le].isDataTexture?$.push(dB(F[le].image)):$.push(dB(F[le]))}else $=dB(F);t.url=$}return l||(r.images[this.uuid]=t),t}}function dB(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap?Cx.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Hx=0;class p8 extends HU{constructor(r=p8.DEFAULT_IMAGE,l=p8.DEFAULT_MAPPING,t=cH,F=cH,$=Nx,le=Ax,Te=px,Le=Ox,Se=p8.DEFAULT_ANISOTROPY,be=mx){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Hx++}),this.uuid=IM(),this.name="",this.source=new bx(r),this.mipmaps=[],this.mapping=l,this.channel=0,this.wrapS=t,this.wrapT=F,this.magFilter=$,this.minFilter=le,this.anisotropy=Se,this.format=Te,this.internalFormat=null,this.type=Le,this.offset=new nb(0,0),this.repeat=new nb(1,1),this.center=new nb(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Db,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=be,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(r=null){this.source.data=r}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(r){return this.name=r.name,this.source=r.source,this.mipmaps=r.mipmaps.slice(0),this.mapping=r.mapping,this.channel=r.channel,this.wrapS=r.wrapS,this.wrapT=r.wrapT,this.magFilter=r.magFilter,this.minFilter=r.minFilter,this.anisotropy=r.anisotropy,this.format=r.format,this.internalFormat=r.internalFormat,this.type=r.type,this.offset.copy(r.offset),this.repeat.copy(r.repeat),this.center.copy(r.center),this.rotation=r.rotation,this.matrixAutoUpdate=r.matrixAutoUpdate,this.matrix.copy(r.matrix),this.generateMipmaps=r.generateMipmaps,this.premultiplyAlpha=r.premultiplyAlpha,this.flipY=r.flipY,this.unpackAlignment=r.unpackAlignment,this.colorSpace=r.colorSpace,this.userData=JSON.parse(JSON.stringify(r.userData)),this.needsUpdate=!0,this}toJSON(r){const l=r===void 0||typeof r=="string";if(!l&&r.textures[this.uuid]!==void 0)return r.textures[this.uuid];const t={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(r).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&&(t.userData=this.userData),l||(r.textures[this.uuid]=t),t}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(r){if(this.mapping!==bU)return r;if(r.applyMatrix3(this.matrix),r.x<0||r.x>1)switch(this.wrapS){case HM:r.x=r.x-Math.floor(r.x);break;case cH:r.x=r.x<0?0:1;break;case BM:Math.abs(Math.floor(r.x)%2)===1?r.x=Math.ceil(r.x)-r.x:r.x=r.x-Math.floor(r.x);break}if(r.y<0||r.y>1)switch(this.wrapT){case HM:r.y=r.y-Math.floor(r.y);break;case cH:r.y=r.y<0?0:1;break;case BM:Math.abs(Math.floor(r.y)%2)===1?r.y=Math.ceil(r.y)-r.y:r.y=r.y-Math.floor(r.y);break}return this.flipY&&(r.y=1-r.y),r}set needsUpdate(r){r===!0&&(this.version++,this.source.needsUpdate=!0)}}p8.DEFAULT_IMAGE=null;p8.DEFAULT_MAPPING=bU;p8.DEFAULT_ANISOTROPY=1;class Nb{constructor(r=0,l=0,t=0,F=1){this.isQuaternion=!0,this._x=r,this._y=l,this._z=t,this._w=F}static slerpFlat(r,l,t,F,$,le,Te){let Le=t[F+0],Se=t[F+1],be=t[F+2],xe=t[F+3];const Ye=$[le+0],pe=$[le+1],Ze=$[le+2],lt=$[le+3];if(Te===0){r[l+0]=Le,r[l+1]=Se,r[l+2]=be,r[l+3]=xe;return}if(Te===1){r[l+0]=Ye,r[l+1]=pe,r[l+2]=Ze,r[l+3]=lt;return}if(xe!==lt||Le!==Ye||Se!==pe||be!==Ze){let Tt=1-Te;const Dt=Le*Ye+Se*pe+be*Ze+xe*lt,zt=Dt>=0?1:-1,Kt=1-Dt*Dt;if(Kt>Number.EPSILON){const fl=Math.sqrt(Kt),At=Math.atan2(fl,Dt*zt);Tt=Math.sin(Tt*At)/fl,Te=Math.sin(Te*At)/fl}const Zt=Te*zt;if(Le=Le*Tt+Ye*Zt,Se=Se*Tt+pe*Zt,be=be*Tt+Ze*Zt,xe=xe*Tt+lt*Zt,Tt===1-Te){const fl=1/Math.sqrt(Le*Le+Se*Se+be*be+xe*xe);Le*=fl,Se*=fl,be*=fl,xe*=fl}}r[l]=Le,r[l+1]=Se,r[l+2]=be,r[l+3]=xe}static multiplyQuaternionsFlat(r,l,t,F,$,le){const Te=t[F],Le=t[F+1],Se=t[F+2],be=t[F+3],xe=$[le],Ye=$[le+1],pe=$[le+2],Ze=$[le+3];return r[l]=Te*Ze+be*xe+Le*pe-Se*Ye,r[l+1]=Le*Ze+be*Ye+Se*xe-Te*pe,r[l+2]=Se*Ze+be*pe+Te*Ye-Le*xe,r[l+3]=be*Ze-Te*xe-Le*Ye-Se*pe,r}get x(){return this._x}set x(r){this._x=r,this._onChangeCallback()}get y(){return this._y}set y(r){this._y=r,this._onChangeCallback()}get z(){return this._z}set z(r){this._z=r,this._onChangeCallback()}get w(){return this._w}set w(r){this._w=r,this._onChangeCallback()}set(r,l,t,F){return this._x=r,this._y=l,this._z=t,this._w=F,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(r){return this._x=r.x,this._y=r.y,this._z=r.z,this._w=r.w,this._onChangeCallback(),this}setFromEuler(r,l=!0){const t=r._x,F=r._y,$=r._z,le=r._order,Te=Math.cos,Le=Math.sin,Se=Te(t/2),be=Te(F/2),xe=Te($/2),Ye=Le(t/2),pe=Le(F/2),Ze=Le($/2);switch(le){case"XYZ":this._x=Ye*be*xe+Se*pe*Ze,this._y=Se*pe*xe-Ye*be*Ze,this._z=Se*be*Ze+Ye*pe*xe,this._w=Se*be*xe-Ye*pe*Ze;break;case"YXZ":this._x=Ye*be*xe+Se*pe*Ze,this._y=Se*pe*xe-Ye*be*Ze,this._z=Se*be*Ze-Ye*pe*xe,this._w=Se*be*xe+Ye*pe*Ze;break;case"ZXY":this._x=Ye*be*xe-Se*pe*Ze,this._y=Se*pe*xe+Ye*be*Ze,this._z=Se*be*Ze+Ye*pe*xe,this._w=Se*be*xe-Ye*pe*Ze;break;case"ZYX":this._x=Ye*be*xe-Se*pe*Ze,this._y=Se*pe*xe+Ye*be*Ze,this._z=Se*be*Ze-Ye*pe*xe,this._w=Se*be*xe+Ye*pe*Ze;break;case"YZX":this._x=Ye*be*xe+Se*pe*Ze,this._y=Se*pe*xe+Ye*be*Ze,this._z=Se*be*Ze-Ye*pe*xe,this._w=Se*be*xe-Ye*pe*Ze;break;case"XZY":this._x=Ye*be*xe-Se*pe*Ze,this._y=Se*pe*xe-Ye*be*Ze,this._z=Se*be*Ze+Ye*pe*xe,this._w=Se*be*xe+Ye*pe*Ze;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+le)}return l===!0&&this._onChangeCallback(),this}setFromAxisAngle(r,l){const t=l/2,F=Math.sin(t);return this._x=r.x*F,this._y=r.y*F,this._z=r.z*F,this._w=Math.cos(t),this._onChangeCallback(),this}setFromRotationMatrix(r){const l=r.elements,t=l[0],F=l[4],$=l[8],le=l[1],Te=l[5],Le=l[9],Se=l[2],be=l[6],xe=l[10],Ye=t+Te+xe;if(Ye>0){const pe=.5/Math.sqrt(Ye+1);this._w=.25/pe,this._x=(be-Le)*pe,this._y=($-Se)*pe,this._z=(le-F)*pe}else if(t>Te&&t>xe){const pe=2*Math.sqrt(1+t-Te-xe);this._w=(be-Le)/pe,this._x=.25*pe,this._y=(F+le)/pe,this._z=($+Se)/pe}else if(Te>xe){const pe=2*Math.sqrt(1+Te-t-xe);this._w=($-Se)/pe,this._x=(F+le)/pe,this._y=.25*pe,this._z=(Le+be)/pe}else{const pe=2*Math.sqrt(1+xe-t-Te);this._w=(le-F)/pe,this._x=($+Se)/pe,this._y=(Le+be)/pe,this._z=.25*pe}return this._onChangeCallback(),this}setFromUnitVectors(r,l){let t=r.dot(l)+1;return t<Number.EPSILON?(t=0,Math.abs(r.x)>Math.abs(r.z)?(this._x=-r.y,this._y=r.x,this._z=0,this._w=t):(this._x=0,this._y=-r.z,this._z=r.y,this._w=t)):(this._x=r.y*l.z-r.z*l.y,this._y=r.z*l.x-r.x*l.z,this._z=r.x*l.y-r.y*l.x,this._w=t),this.normalize()}angleTo(r){return 2*Math.acos(Math.abs(L7(this.dot(r),-1,1)))}rotateTowards(r,l){const t=this.angleTo(r);if(t===0)return this;const F=Math.min(1,l/t);return this.slerp(r,F),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(r){return this._x*r._x+this._y*r._y+this._z*r._z+this._w*r._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 r=this.length();return r===0?(this._x=0,this._y=0,this._z=0,this._w=1):(r=1/r,this._x=this._x*r,this._y=this._y*r,this._z=this._z*r,this._w=this._w*r),this._onChangeCallback(),this}multiply(r){return this.multiplyQuaternions(this,r)}premultiply(r){return this.multiplyQuaternions(r,this)}multiplyQuaternions(r,l){const t=r._x,F=r._y,$=r._z,le=r._w,Te=l._x,Le=l._y,Se=l._z,be=l._w;return this._x=t*be+le*Te+F*Se-$*Le,this._y=F*be+le*Le+$*Te-t*Se,this._z=$*be+le*Se+t*Le-F*Te,this._w=le*be-t*Te-F*Le-$*Se,this._onChangeCallback(),this}slerp(r,l){if(l===0)return this;if(l===1)return this.copy(r);const t=this._x,F=this._y,$=this._z,le=this._w;let Te=le*r._w+t*r._x+F*r._y+$*r._z;if(Te<0?(this._w=-r._w,this._x=-r._x,this._y=-r._y,this._z=-r._z,Te=-Te):this.copy(r),Te>=1)return this._w=le,this._x=t,this._y=F,this._z=$,this;const Le=1-Te*Te;if(Le<=Number.EPSILON){const pe=1-l;return this._w=pe*le+l*this._w,this._x=pe*t+l*this._x,this._y=pe*F+l*this._y,this._z=pe*$+l*this._z,this.normalize(),this}const Se=Math.sqrt(Le),be=Math.atan2(Se,Te),xe=Math.sin((1-l)*be)/Se,Ye=Math.sin(l*be)/Se;return this._w=le*xe+this._w*Ye,this._x=t*xe+this._x*Ye,this._y=F*xe+this._y*Ye,this._z=$*xe+this._z*Ye,this._onChangeCallback(),this}slerpQuaternions(r,l,t){return this.copy(r).slerp(l,t)}random(){const r=2*Math.PI*Math.random(),l=2*Math.PI*Math.random(),t=Math.random(),F=Math.sqrt(1-t),$=Math.sqrt(t);return this.set(F*Math.sin(r),F*Math.cos(r),$*Math.sin(l),$*Math.cos(l))}equals(r){return r._x===this._x&&r._y===this._y&&r._z===this._z&&r._w===this._w}fromArray(r,l=0){return this._x=r[l],this._y=r[l+1],this._z=r[l+2],this._w=r[l+3],this._onChangeCallback(),this}toArray(r=[],l=0){return r[l]=this._x,r[l+1]=this._y,r[l+2]=this._z,r[l+3]=this._w,r}fromBufferAttribute(r,l){return this._x=r.getX(l),this._y=r.getY(l),this._z=r.getZ(l),this._w=r.getW(l),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(r){return this._onChangeCallback=r,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class kr{constructor(r=0,l=0,t=0){kr.prototype.isVector3=!0,this.x=r,this.y=l,this.z=t}set(r,l,t){return t===void 0&&(t=this.z),this.x=r,this.y=l,this.z=t,this}setScalar(r){return this.x=r,this.y=r,this.z=r,this}setX(r){return this.x=r,this}setY(r){return this.y=r,this}setZ(r){return this.z=r,this}setComponent(r,l){switch(r){case 0:this.x=l;break;case 1:this.y=l;break;case 2:this.z=l;break;default:throw new Error("index is out of range: "+r)}return this}getComponent(r){switch(r){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+r)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(r){return this.x=r.x,this.y=r.y,this.z=r.z,this}add(r){return this.x+=r.x,this.y+=r.y,this.z+=r.z,this}addScalar(r){return this.x+=r,this.y+=r,this.z+=r,this}addVectors(r,l){return this.x=r.x+l.x,this.y=r.y+l.y,this.z=r.z+l.z,this}addScaledVector(r,l){return this.x+=r.x*l,this.y+=r.y*l,this.z+=r.z*l,this}sub(r){return this.x-=r.x,this.y-=r.y,this.z-=r.z,this}subScalar(r){return this.x-=r,this.y-=r,this.z-=r,this}subVectors(r,l){return this.x=r.x-l.x,this.y=r.y-l.y,this.z=r.z-l.z,this}multiply(r){return this.x*=r.x,this.y*=r.y,this.z*=r.z,this}multiplyScalar(r){return this.x*=r,this.y*=r,this.z*=r,this}multiplyVectors(r,l){return this.x=r.x*l.x,this.y=r.y*l.y,this.z=r.z*l.z,this}applyEuler(r){return this.applyQuaternion(FM.setFromEuler(r))}applyAxisAngle(r,l){return this.applyQuaternion(FM.setFromAxisAngle(r,l))}applyMatrix3(r){const l=this.x,t=this.y,F=this.z,$=r.elements;return this.x=$[0]*l+$[3]*t+$[6]*F,this.y=$[1]*l+$[4]*t+$[7]*F,this.z=$[2]*l+$[5]*t+$[8]*F,this}applyNormalMatrix(r){return this.applyMatrix3(r).normalize()}applyMatrix4(r){const l=this.x,t=this.y,F=this.z,$=r.elements,le=1/($[3]*l+$[7]*t+$[11]*F+$[15]);return this.x=($[0]*l+$[4]*t+$[8]*F+$[12])*le,this.y=($[1]*l+$[5]*t+$[9]*F+$[13])*le,this.z=($[2]*l+$[6]*t+$[10]*F+$[14])*le,this}applyQuaternion(r){const l=this.x,t=this.y,F=this.z,$=r.x,le=r.y,Te=r.z,Le=r.w,Se=2*(le*F-Te*t),be=2*(Te*l-$*F),xe=2*($*t-le*l);return this.x=l+Le*Se+le*xe-Te*be,this.y=t+Le*be+Te*Se-$*xe,this.z=F+Le*xe+$*be-le*Se,this}project(r){return this.applyMatrix4(r.matrixWorldInverse).applyMatrix4(r.projectionMatrix)}unproject(r){return this.applyMatrix4(r.projectionMatrixInverse).applyMatrix4(r.matrixWorld)}transformDirection(r){const l=this.x,t=this.y,F=this.z,$=r.elements;return this.x=$[0]*l+$[4]*t+$[8]*F,this.y=$[1]*l+$[5]*t+$[9]*F,this.z=$[2]*l+$[6]*t+$[10]*F,this.normalize()}divide(r){return this.x/=r.x,this.y/=r.y,this.z/=r.z,this}divideScalar(r){return this.multiplyScalar(1/r)}min(r){return this.x=Math.min(this.x,r.x),this.y=Math.min(this.y,r.y),this.z=Math.min(this.z,r.z),this}max(r){return this.x=Math.max(this.x,r.x),this.y=Math.max(this.y,r.y),this.z=Math.max(this.z,r.z),this}clamp(r,l){return this.x=Math.max(r.x,Math.min(l.x,this.x)),this.y=Math.max(r.y,Math.min(l.y,this.y)),this.z=Math.max(r.z,Math.min(l.z,this.z)),this}clampScalar(r,l){return this.x=Math.max(r,Math.min(l,this.x)),this.y=Math.max(r,Math.min(l,this.y)),this.z=Math.max(r,Math.min(l,this.z)),this}clampLength(r,l){const t=this.length();return this.divideScalar(t||1).multiplyScalar(Math.max(r,Math.min(l,t)))}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(r){return this.x*r.x+this.y*r.y+this.z*r.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(r){return this.normalize().multiplyScalar(r)}lerp(r,l){return this.x+=(r.x-this.x)*l,this.y+=(r.y-this.y)*l,this.z+=(r.z-this.z)*l,this}lerpVectors(r,l,t){return this.x=r.x+(l.x-r.x)*t,this.y=r.y+(l.y-r.y)*t,this.z=r.z+(l.z-r.z)*t,this}cross(r){return this.crossVectors(this,r)}crossVectors(r,l){const t=r.x,F=r.y,$=r.z,le=l.x,Te=l.y,Le=l.z;return this.x=F*Le-$*Te,this.y=$*le-t*Le,this.z=t*Te-F*le,this}projectOnVector(r){const l=r.lengthSq();if(l===0)return this.set(0,0,0);const t=r.dot(this)/l;return this.copy(r).multiplyScalar(t)}projectOnPlane(r){return yB.copy(this).projectOnVector(r),this.sub(yB)}reflect(r){return this.sub(yB.copy(r).multiplyScalar(2*this.dot(r)))}angleTo(r){const l=Math.sqrt(this.lengthSq()*r.lengthSq());if(l===0)return Math.PI/2;const t=this.dot(r)/l;return Math.acos(L7(t,-1,1))}distanceTo(r){return Math.sqrt(this.distanceToSquared(r))}distanceToSquared(r){const l=this.x-r.x,t=this.y-r.y,F=this.z-r.z;return l*l+t*t+F*F}manhattanDistanceTo(r){return Math.abs(this.x-r.x)+Math.abs(this.y-r.y)+Math.abs(this.z-r.z)}setFromSpherical(r){return this.setFromSphericalCoords(r.radius,r.phi,r.theta)}setFromSphericalCoords(r,l,t){const F=Math.sin(l)*r;return this.x=F*Math.sin(t),this.y=Math.cos(l)*r,this.z=F*Math.cos(t),this}setFromCylindrical(r){return this.setFromCylindricalCoords(r.radius,r.theta,r.y)}setFromCylindricalCoords(r,l,t){return this.x=r*Math.sin(l),this.y=t,this.z=r*Math.cos(l),this}setFromMatrixPosition(r){const l=r.elements;return this.x=l[12],this.y=l[13],this.z=l[14],this}setFromMatrixScale(r){const l=this.setFromMatrixColumn(r,0).length(),t=this.setFromMatrixColumn(r,1).length(),F=this.setFromMatrixColumn(r,2).length();return this.x=l,this.y=t,this.z=F,this}setFromMatrixColumn(r,l){return this.fromArray(r.elements,l*4)}setFromMatrix3Column(r,l){return this.fromArray(r.elements,l*3)}setFromEuler(r){return this.x=r._x,this.y=r._y,this.z=r._z,this}setFromColor(r){return this.x=r.r,this.y=r.g,this.z=r.b,this}equals(r){return r.x===this.x&&r.y===this.y&&r.z===this.z}fromArray(r,l=0){return this.x=r[l],this.y=r[l+1],this.z=r[l+2],this}toArray(r=[],l=0){return r[l]=this.x,r[l+1]=this.y,r[l+2]=this.z,r}fromBufferAttribute(r,l){return this.x=r.getX(l),this.y=r.getY(l),this.z=r.getZ(l),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const r=Math.random()*Math.PI*2,l=Math.random()*2-1,t=Math.sqrt(1-l*l);return this.x=t*Math.cos(r),this.y=l,this.z=t*Math.sin(r),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const yB=new kr,FM=new Nb;class s0{constructor(r,l,t,F,$,le,Te,Le,Se,be,xe,Ye,pe,Ze,lt,Tt){s0.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],r!==void 0&&this.set(r,l,t,F,$,le,Te,Le,Se,be,xe,Ye,pe,Ze,lt,Tt)}set(r,l,t,F,$,le,Te,Le,Se,be,xe,Ye,pe,Ze,lt,Tt){const Dt=this.elements;return Dt[0]=r,Dt[4]=l,Dt[8]=t,Dt[12]=F,Dt[1]=$,Dt[5]=le,Dt[9]=Te,Dt[13]=Le,Dt[2]=Se,Dt[6]=be,Dt[10]=xe,Dt[14]=Ye,Dt[3]=pe,Dt[7]=Ze,Dt[11]=lt,Dt[15]=Tt,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 s0().fromArray(this.elements)}copy(r){const l=this.elements,t=r.elements;return l[0]=t[0],l[1]=t[1],l[2]=t[2],l[3]=t[3],l[4]=t[4],l[5]=t[5],l[6]=t[6],l[7]=t[7],l[8]=t[8],l[9]=t[9],l[10]=t[10],l[11]=t[11],l[12]=t[12],l[13]=t[13],l[14]=t[14],l[15]=t[15],this}copyPosition(r){const l=this.elements,t=r.elements;return l[12]=t[12],l[13]=t[13],l[14]=t[14],this}setFromMatrix3(r){const l=r.elements;return this.set(l[0],l[3],l[6],0,l[1],l[4],l[7],0,l[2],l[5],l[8],0,0,0,0,1),this}extractBasis(r,l,t){return r.setFromMatrixColumn(this,0),l.setFromMatrixColumn(this,1),t.setFromMatrixColumn(this,2),this}makeBasis(r,l,t){return this.set(r.x,l.x,t.x,0,r.y,l.y,t.y,0,r.z,l.z,t.z,0,0,0,0,1),this}extractRotation(r){const l=this.elements,t=r.elements,F=1/c9.setFromMatrixColumn(r,0).length(),$=1/c9.setFromMatrixColumn(r,1).length(),le=1/c9.setFromMatrixColumn(r,2).length();return l[0]=t[0]*F,l[1]=t[1]*F,l[2]=t[2]*F,l[3]=0,l[4]=t[4]*$,l[5]=t[5]*$,l[6]=t[6]*$,l[7]=0,l[8]=t[8]*le,l[9]=t[9]*le,l[10]=t[10]*le,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,this}makeRotationFromEuler(r){const l=this.elements,t=r.x,F=r.y,$=r.z,le=Math.cos(t),Te=Math.sin(t),Le=Math.cos(F),Se=Math.sin(F),be=Math.cos($),xe=Math.sin($);if(r.order==="XYZ"){const Ye=le*be,pe=le*xe,Ze=Te*be,lt=Te*xe;l[0]=Le*be,l[4]=-Le*xe,l[8]=Se,l[1]=pe+Ze*Se,l[5]=Ye-lt*Se,l[9]=-Te*Le,l[2]=lt-Ye*Se,l[6]=Ze+pe*Se,l[10]=le*Le}else if(r.order==="YXZ"){const Ye=Le*be,pe=Le*xe,Ze=Se*be,lt=Se*xe;l[0]=Ye+lt*Te,l[4]=Ze*Te-pe,l[8]=le*Se,l[1]=le*xe,l[5]=le*be,l[9]=-Te,l[2]=pe*Te-Ze,l[6]=lt+Ye*Te,l[10]=le*Le}else if(r.order==="ZXY"){const Ye=Le*be,pe=Le*xe,Ze=Se*be,lt=Se*xe;l[0]=Ye-lt*Te,l[4]=-le*xe,l[8]=Ze+pe*Te,l[1]=pe+Ze*Te,l[5]=le*be,l[9]=lt-Ye*Te,l[2]=-le*Se,l[6]=Te,l[10]=le*Le}else if(r.order==="ZYX"){const Ye=le*be,pe=le*xe,Ze=Te*be,lt=Te*xe;l[0]=Le*be,l[4]=Ze*Se-pe,l[8]=Ye*Se+lt,l[1]=Le*xe,l[5]=lt*Se+Ye,l[9]=pe*Se-Ze,l[2]=-Se,l[6]=Te*Le,l[10]=le*Le}else if(r.order==="YZX"){const Ye=le*Le,pe=le*Se,Ze=Te*Le,lt=Te*Se;l[0]=Le*be,l[4]=lt-Ye*xe,l[8]=Ze*xe+pe,l[1]=xe,l[5]=le*be,l[9]=-Te*be,l[2]=-Se*be,l[6]=pe*xe+Ze,l[10]=Ye-lt*xe}else if(r.order==="XZY"){const Ye=le*Le,pe=le*Se,Ze=Te*Le,lt=Te*Se;l[0]=Le*be,l[4]=-xe,l[8]=Se*be,l[1]=Ye*xe+lt,l[5]=le*be,l[9]=pe*xe-Ze,l[2]=Ze*xe-pe,l[6]=Te*be,l[10]=lt*xe+Ye}return l[3]=0,l[7]=0,l[11]=0,l[12]=0,l[13]=0,l[14]=0,l[15]=1,this}makeRotationFromQuaternion(r){return this.compose(Bx,r,Mx)}lookAt(r,l,t){const F=this.elements;return _4.subVectors(r,l),_4.lengthSq()===0&&(_4.z=1),_4.normalize(),FD.crossVectors(t,_4),FD.lengthSq()===0&&(Math.abs(t.z)===1?_4.x+=1e-4:_4.z+=1e-4,_4.normalize(),FD.crossVectors(t,_4)),FD.normalize(),IH.crossVectors(_4,FD),F[0]=FD.x,F[4]=IH.x,F[8]=_4.x,F[1]=FD.y,F[5]=IH.y,F[9]=_4.y,F[2]=FD.z,F[6]=IH.z,F[10]=_4.z,this}multiply(r){return this.multiplyMatrices(this,r)}premultiply(r){return this.multiplyMatrices(r,this)}multiplyMatrices(r,l){const t=r.elements,F=l.elements,$=this.elements,le=t[0],Te=t[4],Le=t[8],Se=t[12],be=t[1],xe=t[5],Ye=t[9],pe=t[13],Ze=t[2],lt=t[6],Tt=t[10],Dt=t[14],zt=t[3],Kt=t[7],Zt=t[11],fl=t[15],At=F[0],Pt=F[4],bs=F[8],_n=F[12],Et=F[1],xt=F[5],Pr=F[9],ls=F[13],fs=F[2],pa=F[6],Bl=F[10],rl=F[14],Jc=F[3],tc=F[7],Cr=F[11],_c=F[15];return $[0]=le*At+Te*Et+Le*fs+Se*Jc,$[4]=le*Pt+Te*xt+Le*pa+Se*tc,$[8]=le*bs+Te*Pr+Le*Bl+Se*Cr,$[12]=le*_n+Te*ls+Le*rl+Se*_c,$[1]=be*At+xe*Et+Ye*fs+pe*Jc,$[5]=be*Pt+xe*xt+Ye*pa+pe*tc,$[9]=be*bs+xe*Pr+Ye*Bl+pe*Cr,$[13]=be*_n+xe*ls+Ye*rl+pe*_c,$[2]=Ze*At+lt*Et+Tt*fs+Dt*Jc,$[6]=Ze*Pt+lt*xt+Tt*pa+Dt*tc,$[10]=Ze*bs+lt*Pr+Tt*Bl+Dt*Cr,$[14]=Ze*_n+lt*ls+Tt*rl+Dt*_c,$[3]=zt*At+Kt*Et+Zt*fs+fl*Jc,$[7]=zt*Pt+Kt*xt+Zt*pa+fl*tc,$[11]=zt*bs+Kt*Pr+Zt*Bl+fl*Cr,$[15]=zt*_n+Kt*ls+Zt*rl+fl*_c,this}multiplyScalar(r){const l=this.elements;return l[0]*=r,l[4]*=r,l[8]*=r,l[12]*=r,l[1]*=r,l[5]*=r,l[9]*=r,l[13]*=r,l[2]*=r,l[6]*=r,l[10]*=r,l[14]*=r,l[3]*=r,l[7]*=r,l[11]*=r,l[15]*=r,this}determinant(){const r=this.elements,l=r[0],t=r[4],F=r[8],$=r[12],le=r[1],Te=r[5],Le=r[9],Se=r[13],be=r[2],xe=r[6],Ye=r[10],pe=r[14],Ze=r[3],lt=r[7],Tt=r[11],Dt=r[15];return Ze*(+$*Le*xe-F*Se*xe-$*Te*Ye+t*Se*Ye+F*Te*pe-t*Le*pe)+lt*(+l*Le*pe-l*Se*Ye+$*le*Ye-F*le*pe+F*Se*be-$*Le*be)+Tt*(+l*Se*xe-l*Te*pe-$*le*xe+t*le*pe+$*Te*be-t*Se*be)+Dt*(-F*Te*be-l*Le*xe+l*Te*Ye+F*le*xe-t*le*Ye+t*Le*be)}transpose(){const r=this.elements;let l;return l=r[1],r[1]=r[4],r[4]=l,l=r[2],r[2]=r[8],r[8]=l,l=r[6],r[6]=r[9],r[9]=l,l=r[3],r[3]=r[12],r[12]=l,l=r[7],r[7]=r[13],r[13]=l,l=r[11],r[11]=r[14],r[14]=l,this}setPosition(r,l,t){const F=this.elements;return r.isVector3?(F[12]=r.x,F[13]=r.y,F[14]=r.z):(F[12]=r,F[13]=l,F[14]=t),this}invert(){const r=this.elements,l=r[0],t=r[1],F=r[2],$=r[3],le=r[4],Te=r[5],Le=r[6],Se=r[7],be=r[8],xe=r[9],Ye=r[10],pe=r[11],Ze=r[12],lt=r[13],Tt=r[14],Dt=r[15],zt=xe*Tt*Se-lt*Ye*Se+lt*Le*pe-Te*Tt*pe-xe*Le*Dt+Te*Ye*Dt,Kt=Ze*Ye*Se-be*Tt*Se-Ze*Le*pe+le*Tt*pe+be*Le*Dt-le*Ye*Dt,Zt=be*lt*Se-Ze*xe*Se+Ze*Te*pe-le*lt*pe-be*Te*Dt+le*xe*Dt,fl=Ze*xe*Le-be*lt*Le-Ze*Te*Ye+le*lt*Ye+be*Te*Tt-le*xe*Tt,At=l*zt+t*Kt+F*Zt+$*fl;if(At===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const Pt=1/At;return r[0]=zt*Pt,r[1]=(lt*Ye*$-xe*Tt*$-lt*F*pe+t*Tt*pe+xe*F*Dt-t*Ye*Dt)*Pt,r[2]=(Te*Tt*$-lt*Le*$+lt*F*Se-t*Tt*Se-Te*F*Dt+t*Le*Dt)*Pt,r[3]=(xe*Le*$-Te*Ye*$-xe*F*Se+t*Ye*Se+Te*F*pe-t*Le*pe)*Pt,r[4]=Kt*Pt,r[5]=(be*Tt*$-Ze*Ye*$+Ze*F*pe-l*Tt*pe-be*F*Dt+l*Ye*Dt)*Pt,r[6]=(Ze*Le*$-le*Tt*$-Ze*F*Se+l*Tt*Se+le*F*Dt-l*Le*Dt)*Pt,r[7]=(le*Ye*$-be*Le*$+be*F*Se-l*Ye*Se-le*F*pe+l*Le*pe)*Pt,r[8]=Zt*Pt,r[9]=(Ze*xe*$-be*lt*$-Ze*t*pe+l*lt*pe+be*t*Dt-l*xe*Dt)*Pt,r[10]=(le*lt*$-Ze*Te*$+Ze*t*Se-l*lt*Se-le*t*Dt+l*Te*Dt)*Pt,r[11]=(be*Te*$-le*xe*$-be*t*Se+l*xe*Se+le*t*pe-l*Te*pe)*Pt,r[12]=fl*Pt,r[13]=(be*lt*F-Ze*xe*F+Ze*t*Ye-l*lt*Ye-be*t*Tt+l*xe*Tt)*Pt,r[14]=(Ze*Te*F-le*lt*F-Ze*t*Le+l*lt*Le+le*t*Tt-l*Te*Tt)*Pt,r[15]=(le*xe*F-be*Te*F+be*t*Le-l*xe*Le-le*t*Ye+l*Te*Ye)*Pt,this}scale(r){const l=this.elements,t=r.x,F=r.y,$=r.z;return l[0]*=t,l[4]*=F,l[8]*=$,l[1]*=t,l[5]*=F,l[9]*=$,l[2]*=t,l[6]*=F,l[10]*=$,l[3]*=t,l[7]*=F,l[11]*=$,this}getMaxScaleOnAxis(){const r=this.elements,l=r[0]*r[0]+r[1]*r[1]+r[2]*r[2],t=r[4]*r[4]+r[5]*r[5]+r[6]*r[6],F=r[8]*r[8]+r[9]*r[9]+r[10]*r[10];return Math.sqrt(Math.max(l,t,F))}makeTranslation(r,l,t){return r.isVector3?this.set(1,0,0,r.x,0,1,0,r.y,0,0,1,r.z,0,0,0,1):this.set(1,0,0,r,0,1,0,l,0,0,1,t,0,0,0,1),this}makeRotationX(r){const l=Math.cos(r),t=Math.sin(r);return this.set(1,0,0,0,0,l,-t,0,0,t,l,0,0,0,0,1),this}makeRotationY(r){const l=Math.cos(r),t=Math.sin(r);return this.set(l,0,t,0,0,1,0,0,-t,0,l,0,0,0,0,1),this}makeRotationZ(r){const l=Math.cos(r),t=Math.sin(r);return this.set(l,-t,0,0,t,l,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(r,l){const t=Math.cos(l),F=Math.sin(l),$=1-t,le=r.x,Te=r.y,Le=r.z,Se=$*le,be=$*Te;return this.set(Se*le+t,Se*Te-F*Le,Se*Le+F*Te,0,Se*Te+F*Le,be*Te+t,be*Le-F*le,0,Se*Le-F*Te,be*Le+F*le,$*Le*Le+t,0,0,0,0,1),this}makeScale(r,l,t){return this.set(r,0,0,0,0,l,0,0,0,0,t,0,0,0,0,1),this}makeShear(r,l,t,F,$,le){return this.set(1,t,$,0,r,1,le,0,l,F,1,0,0,0,0,1),this}compose(r,l,t){const F=this.elements,$=l._x,le=l._y,Te=l._z,Le=l._w,Se=$+$,be=le+le,xe=Te+Te,Ye=$*Se,pe=$*be,Ze=$*xe,lt=le*be,Tt=le*xe,Dt=Te*xe,zt=Le*Se,Kt=Le*be,Zt=Le*xe,fl=t.x,At=t.y,Pt=t.z;return F[0]=(1-(lt+Dt))*fl,F[1]=(pe+Zt)*fl,F[2]=(Ze-Kt)*fl,F[3]=0,F[4]=(pe-Zt)*At,F[5]=(1-(Ye+Dt))*At,F[6]=(Tt+zt)*At,F[7]=0,F[8]=(Ze+Kt)*Pt,F[9]=(Tt-zt)*Pt,F[10]=(1-(Ye+lt))*Pt,F[11]=0,F[12]=r.x,F[13]=r.y,F[14]=r.z,F[15]=1,this}decompose(r,l,t){const F=this.elements;let $=c9.set(F[0],F[1],F[2]).length();const le=c9.set(F[4],F[5],F[6]).length(),Te=c9.set(F[8],F[9],F[10]).length();this.determinant()<0&&($=-$),r.x=F[12],r.y=F[13],r.z=F[14],Py.copy(this);const Se=1/$,be=1/le,xe=1/Te;return Py.elements[0]*=Se,Py.elements[1]*=Se,Py.elements[2]*=Se,Py.elements[4]*=be,Py.elements[5]*=be,Py.elements[6]*=be,Py.elements[8]*=xe,Py.elements[9]*=xe,Py.elements[10]*=xe,l.setFromRotationMatrix(Py),t.x=$,t.y=le,t.z=Te,this}makePerspective(r,l,t,F,$,le,Te=oH){const Le=this.elements,Se=2*$/(l-r),be=2*$/(t-F),xe=(l+r)/(l-r),Ye=(t+F)/(t-F);let pe,Ze;if(Te===oH)pe=-(le+$)/(le-$),Ze=-2*le*$/(le-$);else if(Te===xM)pe=-le/(le-$),Ze=-le*$/(le-$);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+Te);return Le[0]=Se,Le[4]=0,Le[8]=xe,Le[12]=0,Le[1]=0,Le[5]=be,Le[9]=Ye,Le[13]=0,Le[2]=0,Le[6]=0,Le[10]=pe,Le[14]=Ze,Le[3]=0,Le[7]=0,Le[11]=-1,Le[15]=0,this}makeOrthographic(r,l,t,F,$,le,Te=oH){const Le=this.elements,Se=1/(l-r),be=1/(t-F),xe=1/(le-$),Ye=(l+r)*Se,pe=(t+F)*be;let Ze,lt;if(Te===oH)Ze=(le+$)*xe,lt=-2*xe;else if(Te===xM)Ze=$*xe,lt=-1*xe;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+Te);return Le[0]=2*Se,Le[4]=0,Le[8]=0,Le[12]=-Ye,Le[1]=0,Le[5]=2*be,Le[9]=0,Le[13]=-pe,Le[2]=0,Le[6]=0,Le[10]=lt,Le[14]=-Ze,Le[3]=0,Le[7]=0,Le[11]=0,Le[15]=1,this}equals(r){const l=this.elements,t=r.elements;for(let F=0;F<16;F++)if(l[F]!==t[F])return!1;return!0}fromArray(r,l=0){for(let t=0;t<16;t++)this.elements[t]=r[t+l];return this}toArray(r=[],l=0){const t=this.elements;return r[l]=t[0],r[l+1]=t[1],r[l+2]=t[2],r[l+3]=t[3],r[l+4]=t[4],r[l+5]=t[5],r[l+6]=t[6],r[l+7]=t[7],r[l+8]=t[8],r[l+9]=t[9],r[l+10]=t[10],r[l+11]=t[11],r[l+12]=t[12],r[l+13]=t[13],r[l+14]=t[14],r[l+15]=t[15],r}}const c9=new kr,Py=new s0,Bx=new kr(0,0,0),Mx=new kr(1,1,1),FD=new kr,IH=new kr,_4=new kr,VM=new s0,WM=new Nb;class HH{constructor(r=0,l=0,t=0,F=HH.DEFAULT_ORDER){this.isEuler=!0,this._x=r,this._y=l,this._z=t,this._order=F}get x(){return this._x}set x(r){this._x=r,this._onChangeCallback()}get y(){return this._y}set y(r){this._y=r,this._onChangeCallback()}get z(){return this._z}set z(r){this._z=r,this._onChangeCallback()}get order(){return this._order}set order(r){this._order=r,this._onChangeCallback()}set(r,l,t,F=this._order){return this._x=r,this._y=l,this._z=t,this._order=F,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(r){return this._x=r._x,this._y=r._y,this._z=r._z,this._order=r._order,this._onChangeCallback(),this}setFromRotationMatrix(r,l=this._order,t=!0){const F=r.elements,$=F[0],le=F[4],Te=F[8],Le=F[1],Se=F[5],be=F[9],xe=F[2],Ye=F[6],pe=F[10];switch(l){case"XYZ":this._y=Math.asin(L7(Te,-1,1)),Math.abs(Te)<.9999999?(this._x=Math.atan2(-be,pe),this._z=Math.atan2(-le,$)):(this._x=Math.atan2(Ye,Se),this._z=0);break;case"YXZ":this._x=Math.asin(-L7(be,-1,1)),Math.abs(be)<.9999999?(this._y=Math.atan2(Te,pe),this._z=Math.atan2(Le,Se)):(this._y=Math.atan2(-xe,$),this._z=0);break;case"ZXY":this._x=Math.asin(L7(Ye,-1,1)),Math.abs(Ye)<.9999999?(this._y=Math.atan2(-xe,pe),this._z=Math.atan2(-le,Se)):(this._y=0,this._z=Math.atan2(Le,$));break;case"ZYX":this._y=Math.asin(-L7(xe,-1,1)),Math.abs(xe)<.9999999?(this._x=Math.atan2(Ye,pe),this._z=Math.atan2(Le,$)):(this._x=0,this._z=Math.atan2(-le,Se));break;case"YZX":this._z=Math.asin(L7(Le,-1,1)),Math.abs(Le)<.9999999?(this._x=Math.atan2(-be,Se),this._y=Math.atan2(-xe,$)):(this._x=0,this._y=Math.atan2(Te,pe));break;case"XZY":this._z=Math.asin(-L7(le,-1,1)),Math.abs(le)<.9999999?(this._x=Math.atan2(Ye,Se),this._y=Math.atan2(Te,$)):(this._x=Math.atan2(-be,pe),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+l)}return this._order=l,t===!0&&this._onChangeCallback(),this}setFromQuaternion(r,l,t){return VM.makeRotationFromQuaternion(r),this.setFromRotationMatrix(VM,l,t)}setFromVector3(r,l=this._order){return this.set(r.x,r.y,r.z,l)}reorder(r){return WM.setFromEuler(this),this.setFromQuaternion(WM,r)}equals(r){return r._x===this._x&&r._y===this._y&&r._z===this._z&&r._order===this._order}fromArray(r){return this._x=r[0],this._y=r[1],this._z=r[2],r[3]!==void 0&&(this._order=r[3]),this._onChangeCallback(),this}toArray(r=[],l=0){return r[l]=this._x,r[l+1]=this._y,r[l+2]=this._z,r[l+3]=this._order,r}_onChange(r){return this._onChangeCallback=r,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}HH.DEFAULT_ORDER="XYZ";class Ux{constructor(){this.mask=1}set(r){this.mask=(1<<r|0)>>>0}enable(r){this.mask|=1<<r|0}enableAll(){this.mask=-1}toggle(r){this.mask^=1<<r|0}disable(r){this.mask&=~(1<<r|0)}disableAll(){this.mask=0}test(r){return(this.mask&r.mask)!==0}isEnabled(r){return(this.mask&(1<<r|0))!==0}}let xx=0;const jM=new kr,o9=new Nb,S7=new s0,hH=new kr,_g=new kr,Gx=new kr,Fx=new Nb,YM=new kr(1,0,0),qM=new kr(0,1,0),kM=new kr(0,0,1),Vx={type:"added"},Wx={type:"removed"},wB={type:"childadded",child:null},TB={type:"childremoved",child:null};class AO extends HU{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:xx++}),this.uuid=IM(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=AO.DEFAULT_UP.clone();const r=new kr,l=new HH,t=new Nb,F=new kr(1,1,1);function $(){t.setFromEuler(l,!1)}function le(){l.setFromQuaternion(t,void 0,!1)}l._onChange($),t._onChange(le),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:r},rotation:{configurable:!0,enumerable:!0,value:l},quaternion:{configurable:!0,enumerable:!0,value:t},scale:{configurable:!0,enumerable:!0,value:F},modelViewMatrix:{value:new s0},normalMatrix:{value:new Db}}),this.matrix=new s0,this.matrixWorld=new s0,this.matrixAutoUpdate=AO.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=AO.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ux,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(r){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(r),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(r){return this.quaternion.premultiply(r),this}setRotationFromAxisAngle(r,l){this.quaternion.setFromAxisAngle(r,l)}setRotationFromEuler(r){this.quaternion.setFromEuler(r,!0)}setRotationFromMatrix(r){this.quaternion.setFromRotationMatrix(r)}setRotationFromQuaternion(r){this.quaternion.copy(r)}rotateOnAxis(r,l){return o9.setFromAxisAngle(r,l),this.quaternion.multiply(o9),this}rotateOnWorldAxis(r,l){return o9.setFromAxisAngle(r,l),this.quaternion.premultiply(o9),this}rotateX(r){return this.rotateOnAxis(YM,r)}rotateY(r){return this.rotateOnAxis(qM,r)}rotateZ(r){return this.rotateOnAxis(kM,r)}translateOnAxis(r,l){return jM.copy(r).applyQuaternion(this.quaternion),this.position.add(jM.multiplyScalar(l)),this}translateX(r){return this.translateOnAxis(YM,r)}translateY(r){return this.translateOnAxis(qM,r)}translateZ(r){return this.translateOnAxis(kM,r)}localToWorld(r){return this.updateWorldMatrix(!0,!1),r.applyMatrix4(this.matrixWorld)}worldToLocal(r){return this.updateWorldMatrix(!0,!1),r.applyMatrix4(S7.copy(this.matrixWorld).invert())}lookAt(r,l,t){r.isVector3?hH.copy(r):hH.set(r,l,t);const F=this.parent;this.updateWorldMatrix(!0,!1),_g.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?S7.lookAt(_g,hH,this.up):S7.lookAt(hH,_g,this.up),this.quaternion.setFromRotationMatrix(S7),F&&(S7.extractRotation(F.matrixWorld),o9.setFromRotationMatrix(S7),this.quaternion.premultiply(o9.invert()))}add(r){if(arguments.length>1){for(let l=0;l<arguments.length;l++)this.add(arguments[l]);return this}return r===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",r),this):(r&&r.isObject3D?(r.parent!==null&&r.parent.remove(r),r.parent=this,this.children.push(r),r.dispatchEvent(Vx),wB.child=r,this.dispatchEvent(wB),wB.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",r),this)}remove(r){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const l=this.children.indexOf(r);return l!==-1&&(r.parent=null,this.children.splice(l,1),r.dispatchEvent(Wx),TB.child=r,this.dispatchEvent(TB),TB.child=null),this}removeFromParent(){const r=this.parent;return r!==null&&r.remove(this),this}clear(){return this.remove(...this.children)}attach(r){return this.updateWorldMatrix(!0,!1),S7.copy(this.matrixWorld).invert(),r.parent!==null&&(r.parent.updateWorldMatrix(!0,!1),S7.multiply(r.parent.matrixWorld)),r.applyMatrix4(S7),this.add(r),r.updateWorldMatrix(!1,!0),this}getObjectById(r){return this.getObjectByProperty("id",r)}getObjectByName(r){return this.getObjectByProperty("name",r)}getObjectByProperty(r,l){if(this[r]===l)return this;for(let t=0,F=this.children.length;t<F;t++){const le=this.children[t].getObjectByProperty(r,l);if(le!==void 0)return le}}getObjectsByProperty(r,l,t=[]){this[r]===l&&t.push(this);const F=this.children;for(let $=0,le=F.length;$<le;$++)F[$].getObjectsByProperty(r,l,t);return t}getWorldPosition(r){return this.updateWorldMatrix(!0,!1),r.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(r){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_g,r,Gx),r}getWorldScale(r){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_g,Fx,r),r}getWorldDirection(r){this.updateWorldMatrix(!0,!1);const l=this.matrixWorld.elements;return r.set(l[8],l[9],l[10]).normalize()}raycast(){}traverse(r){r(this);const l=this.children;for(let t=0,F=l.length;t<F;t++)l[t].traverse(r)}traverseVisible(r){if(this.visible===!1)return;r(this);const l=this.children;for(let t=0,F=l.length;t<F;t++)l[t].traverseVisible(r)}traverseAncestors(r){const l=this.parent;l!==null&&(r(l),l.traverseAncestors(r))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(r){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,r=!0);const l=this.children;for(let t=0,F=l.length;t<F;t++){const $=l[t];($.matrixWorldAutoUpdate===!0||r===!0)&&$.updateMatrixWorld(r)}}updateWorldMatrix(r,l){const t=this.parent;if(r===!0&&t!==null&&t.matrixWorldAutoUpdate===!0&&t.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),l===!0){const F=this.children;for(let $=0,le=F.length;$<le;$++){const Te=F[$];Te.matrixWorldAutoUpdate===!0&&Te.updateWorldMatrix(!1,!0)}}}toJSON(r){const l=r===void 0||typeof r=="string",t={};l&&(r={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},t.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const F={};F.uuid=this.uuid,F.type=this.type,this.name!==""&&(F.name=this.name),this.castShadow===!0&&(F.castShadow=!0),this.receiveShadow===!0&&(F.receiveShadow=!0),this.visible===!1&&(F.visible=!1),this.frustumCulled===!1&&(F.frustumCulled=!1),this.renderOrder!==0&&(F.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(F.userData=this.userData),F.layers=this.layers.mask,F.matrix=this.matrix.toArray(),F.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(F.matrixAutoUpdate=!1),this.isInstancedMesh&&(F.type="InstancedMesh",F.count=this.count,F.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(F.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(F.type="BatchedMesh",F.perObjectFrustumCulled=this.perObjectFrustumCulled,F.sortObjects=this.sortObjects,F.drawRanges=this._drawRanges,F.reservedRanges=this._reservedRanges,F.visibility=this._visibility,F.active=this._active,F.bounds=this._bounds.map(Te=>({boxInitialized:Te.boxInitialized,boxMin:Te.box.min.toArray(),boxMax:Te.box.max.toArray(),sphereInitialized:Te.sphereInitialized,sphereRadius:Te.sphere.radius,sphereCenter:Te.sphere.center.toArray()})),F.maxGeometryCount=this._maxGeometryCount,F.maxVertexCount=this._maxVertexCount,F.maxIndexCount=this._maxIndexCount,F.geometryInitialized=this._geometryInitialized,F.geometryCount=this._geometryCount,F.matricesTexture=this._matricesTexture.toJSON(r),this.boundingSphere!==null&&(F.boundingSphere={center:F.boundingSphere.center.toArray(),radius:F.boundingSphere.radius}),this.boundingBox!==null&&(F.boundingBox={min:F.boundingBox.min.toArray(),max:F.boundingBox.max.toArray()}));function $(Te,Le){return Te[Le.uuid]===void 0&&(Te[Le.uuid]=Le.toJSON(r)),Le.uuid}if(this.isScene)this.background&&(this.background.isColor?F.background=this.background.toJSON():this.background.isTexture&&(F.background=this.background.toJSON(r).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(F.environment=this.environment.toJSON(r).uuid);else if(this.isMesh||this.isLine||this.isPoints){F.geometry=$(r.geometries,this.geometry);const Te=this.geometry.parameters;if(Te!==void 0&&Te.shapes!==void 0){const Le=Te.shapes;if(Array.isArray(Le))for(let Se=0,be=Le.length;Se<be;Se++){const xe=Le[Se];$(r.shapes,xe)}else $(r.shapes,Le)}}if(this.isSkinnedMesh&&(F.bindMode=this.bindMode,F.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&($(r.skeletons,this.skeleton),F.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const Te=[];for(let Le=0,Se=this.material.length;Le<Se;Le++)Te.push($(r.materials,this.material[Le]));F.material=Te}else F.material=$(r.materials,this.material);if(this.children.length>0){F.children=[];for(let Te=0;Te<this.children.length;Te++)F.children.push(this.children[Te].toJSON(r).object)}if(this.animations.length>0){F.animations=[];for(let Te=0;Te<this.animations.length;Te++){const Le=this.animations[Te];F.animations.push($(r.animations,Le))}}if(l){const Te=le(r.geometries),Le=le(r.materials),Se=le(r.textures),be=le(r.images),xe=le(r.shapes),Ye=le(r.skeletons),pe=le(r.animations),Ze=le(r.nodes);Te.length>0&&(t.geometries=Te),Le.length>0&&(t.materials=Le),Se.length>0&&(t.textures=Se),be.length>0&&(t.images=be),xe.length>0&&(t.shapes=xe),Ye.length>0&&(t.skeletons=Ye),pe.length>0&&(t.animations=pe),Ze.length>0&&(t.nodes=Ze)}return t.object=F,t;function le(Te){const Le=[];for(const Se in Te){const be=Te[Se];delete be.metadata,Le.push(be)}return Le}}clone(r){return new this.constructor().copy(this,r)}copy(r,l=!0){if(this.name=r.name,this.up.copy(r.up),this.position.copy(r.position),this.rotation.order=r.rotation.order,this.quaternion.copy(r.quaternion),this.scale.copy(r.scale),this.matrix.copy(r.matrix),this.matrixWorld.copy(r.matrixWorld),this.matrixAutoUpdate=r.matrixAutoUpdate,this.matrixWorldAutoUpdate=r.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=r.matrixWorldNeedsUpdate,this.layers.mask=r.layers.mask,this.visible=r.visible,this.castShadow=r.castShadow,this.receiveShadow=r.receiveShadow,this.frustumCulled=r.frustumCulled,this.renderOrder=r.renderOrder,this.animations=r.animations.slice(),this.userData=JSON.parse(JSON.stringify(r.userData)),l===!0)for(let t=0;t<r.children.length;t++){const F=r.children[t];this.add(F.clone())}return this}}AO.DEFAULT_UP=new kr(0,1,0);AO.DEFAULT_MATRIX_AUTO_UPDATE=!0;AO.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class jx extends p8{constructor(r,l,t,F,$,le,Te,Le,Se,be){if(be=be!==void 0?be:IB,be!==IB&&be!==UM)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");t===void 0&&be===IB&&(t=Sx),t===void 0&&be===UM&&(t=Lx),super(null,F,$,le,Te,Le,be,t,Se),this.isDepthTexture=!0,this.image={width:r,height:l},this.magFilter=Te!==void 0?Te:MM,this.minFilter=Le!==void 0?Le:MM,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(r){return super.copy(r),this.compareFunction=r.compareFunction,this}toJSON(r){const l=super.toJSON(r);return this.compareFunction!==null&&(l.compareFunction=this.compareFunction),l}}const Yx=new jx(1,1);Yx.compareFunction=Px;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:gU}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=gU);class qx{constructor(){this.factor=1,this.complement=1}apply(r){const t=this.getScaleMatrix().multiply(r);r.copy(t)}setUp(r){var $;this.factor=1;const l=this.getLengthUnits(r);if(!l)return;const t=l==null,F=l.Name===void 0||l.Name===null;t||F||(l.Name.value==="FOOT"?this.factor=.3048:(($=l.Prefix)==null?void 0:$.value)==="MILLI"&&(this.complement=.001))}getLengthUnits(r){try{const t=r.GetLineIDsWithType(0,tx).get(0),F=r.GetLine(0,t);for(const $ of F.Units){if(!$||$.value===null||$.value===void 0)continue;const le=r.GetLine(0,$.value);if(le.UnitType&&le.UnitType.value==="LENGTHUNIT")return le}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const r=this.factor;return new s0().fromArray([r,0,0,0,0,r,0,0,0,0,r,0,0,0,0,1])}}class kx{constructor(){this.itemsByFloor={},this._units=new qx}setUp(r){this._units.setUp(r),this.cleanUp();try{const l=r.GetLineIDsWithType(0,fe),t=new Set,F=r.GetLineIDsWithType(0,pr);for(let Se=0;Se<F.size();Se++)t.add(F.get(Se));const $=r.GetLineIDsWithType(0,R),le=$.size();for(let Se=0;Se<le;Se++){const be=$.get(Se),xe=r.GetLine(0,be);if(!xe||!xe.RelatingObject||!xe.RelatedObjects)continue;const Ye=xe.RelatingObject.value,pe=xe.RelatedObjects;for(const Ze of pe){const lt=Ze.value;t.has(lt)&&(this.itemsByFloor[lt]=Ye)}}const Te={},Le=l.size();for(let Se=0;Se<Le;Se++){const be=l.get(Se),xe=r.GetLine(0,be);if(!xe||!xe.RelatingStructure||!xe.RelatedElements)continue;const Ye=xe.RelatingStructure.value,pe=xe.RelatedElements;if(t.has(Ye))for(const Ze of pe){Te[Ye]||(Te[Ye]=[]);const lt=Ze.value;Te[Ye].push(lt)}else for(const Ze of pe){const lt=Ze.value;this.itemsByFloor[lt]=Ye}}for(const Se in Te){const be=this.itemsByFloor[Se];if(be!==void 0){const xe=Te[Se];for(const Ye of xe)this.itemsByFloor[Ye]=be}}for(let Se=0;Se<le;Se++){const be=$.get(Se),xe=r.GetLine(0,be);if(!xe||!xe.RelatingObject||!xe.RelatedObjects)continue;const Ye=xe.RelatingObject.value,pe=xe.RelatedObjects;for(const Ze of pe){const lt=Ze.value,Tt=this.itemsByFloor[Ye];Tt!==void 0&&(this.itemsByFloor[lt]=Tt)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}const zx=new Set([1123145078,574549367,1675464909,2059837836,3798115385,32440307,3125803723,3207858831,2740243338,2624227202,4240577450,3615266464,3724593414,220341763,477187591,1878645084,1300840506,3303107099,1607154358,1878645084,846575682,1351298697,2417041796,3049322572,3331915920,1416205885,776857604,3285139300,3958052878,2827736869,2732653382,673634403,3448662350,4142052618,2924175390,803316827,2556980723,1809719519,2205249479,807026263,3737207727,1660063152,2347385850,3940055652,2705031697,3732776249,2485617015,2611217952,1704287377,2937912522,2770003689,1281925730,1484403080,3448662350,4142052618,3800577675,4006246654,3590301190,1383045692,2775532180,2047409740,370225590,3593883385,2665983363,4124623270,812098782,3649129432,987898635,1105321065,3510044353,1635779807,2603310189,3406155212,1310608509,4261334040,2736907675,3649129432,1136057603,1260505505,4182860854,2713105998,2898889636,59481748,3749851601,3486308946,3150382593,1062206242,3264961684,15328376,1485152156,370225590,1981873012,2859738748,45288368,2614616156,2732653382,775493141,2147822146,2601014836,2629017746,1186437898,2367409068,1213902940,3632507154,3900360178,476780140,1472233963,2804161546,3008276851,738692330,374418227,315944413,3905492369,3570813810,2571569899,178912537,2294589976,1437953363,2133299955,572779678,3092502836,388784114,2624227202,1425443689,3057273783,2347385850,1682466193,2519244187,2839578677,3958567839,2513912981,2830218821,427810014]);class Kx{async export(r,l,t=!1,F=!0){const $={},le=new Set(r.GetIfcEntityList(l)),Te=new Set([Wy,xi,Oa,Zi,pr]);for(const Le of Te)le.add(Le);for(const Le of le){if(zx.has(Le))continue;const Se=Te.has(Le)&&F,be=r.GetLineIDsWithType(l,Le);for(const xe of be){const Ye=r.GetLine(0,xe,Se,t);$[Ye.expressID]=Ye}}return $}}class Qx{constructor(){this.normal=[],this.position=[],this.instances=[],this.id=""}}class $x{constructor(){this.id="",this.transform=[],this.material=new hM}}class hM{constructor(){this.Name="",this.Opacity=1,this.Metalness=0,this.Roughness=1,this.Red=225,this.Green=225,this.Blue=225}}class BU{constructor(){this.Materials=[],this.Elements=[],this.Data=new MU,this.CameraData=new BH}}class MU{constructor(){this.Data={}}}class Zx{constructor(){this.Data={},this.CameraData=new BH}}class EB{constructor(){this.Solids=[],this.Id="",this.Instances=[]}}class UU{constructor(){this.MaterialIndex=0,this.Vertices=[],this.Indices=[],this.Buffer=[],this.Id="",this.GeometryId="",this.Transform=[]}}class xU{constructor(){this.BasisX=new Sa,this.BasisY=new Sa,this.BasisZ=new Sa,this.Offset=new Sa,this.Id="",this.Matrix=new s0}}class Sa{constructor(r=0,l=0,t=0){this.X=0,this.Y=0,this.Z=0,this.X=r,this.Y=l,this.Z=t}}class BH{constructor(){this.scale=0,this.origin=new Sa,this.eyePosition=new Sa,this.upDirection=new Sa,this.forwardDirection=new Sa,this.target=new Sa,this.box=new GU}}class GU{constructor(){this.min=new Sa,this.max=new Sa}}const mH=class mH{constructor(){this._webIfc=new Rx,this.settings=new Dx,this._fragments=new Map,this._spatialTree=new kx,this._propertyExporter=new Kx,this._materials=[],this._groupByGeometryId={},this.settings.excludedCategories.add(Gu)}async setup(){this.settings.autoSetWasm&&await this.autoSetWasm()}async autoSetWasm(){const r=await fetch(`https://unpkg.com/@thatopen/components@${mH.release}/package.json`);if(!r.ok){console.warn("Couldn't get openbim-components package.json. Set wasm settings manually.");return}const l=await r.json();if(!("web-ifc"in l.peerDependencies))console.warn("Couldn't get web-ifc from peer dependencies in openbim-components. Set wasm settings manually.");else{const t=l.peerDependencies["web-ifc"];this.settings.wasm.path=`https://unpkg.com/web-ifc@${t}/`,this.settings.wasm.absolute=!0}}async loadByUrl(r){this._dispose();const t=await(await fetch(r)).arrayBuffer(),F=new Uint8Array(t);let $=await this.load2(F);return this._webIfc.Dispose(),$}async load2(r,l=!0){await this.readIfcFile(r);const t=await this.getAllGeometries2(),F=await this.getAllProperties();let $=new BU;$.Elements=t.elements,t.material.forEach((le,Te)=>{let Le=new hM;Le.Red=Math.round(le.x*255),Le.Green=Math.round(le.y*255),Le.Blue=Math.round(le.z*255),Le.Opacity=le.w,Le.Name=Te.toString(),$.Materials.push(Le)});for(const le of Object.keys(F)){let Te=F,Le=this.flattenObject(Te[le]),Se={};for(const be of Object.keys(Le)){let xe={name:be,value:Le[be]?Le[be].toString():""};Se[be]=xe}$.Data.Data[Le.expressID]=Se}return $.CameraData=this.generateBoundingbox($.Elements),$}async readIfcFile(r){const{path:l,absolute:t,logLevel:F}=this.settings.wasm;return this._webIfc.SetWasmPath(l,t),await this._webIfc.Init(),F&&this._webIfc.SetLogLevel(F),this._webIfc.OpenModel(r,this.settings.webIfc)}async getAllGeometries2(){this._spatialTree.setUp(this._webIfc);const r=this._webIfc.GetIfcEntityList(0),l=[];for(const F of r){if(!this._webIfc.IsIfcElement(F)&&F!==pr)continue;const $=this.settings.includedCategories;if($.size>0&&!$.has(F))continue;if(this.settings.excludedCategories.has(F))continue;const le=this._webIfc.GetLineIDsWithType(0,F),Te=le.size();for(let Le=0;Le<Te;Le++){const Se=le.get(Le);l.push(Se),this._spatialTree.itemsByFloor[Se]}}this._spatialTree.cleanUp();let t=[];return this._webIfc.StreamMeshes(0,l,(F,$,le)=>{this.getMesh2(F)}),t=this.generateInstancedMesh(),{elements:t,material:this._materials}}getMesh2(r){let l=new EB;const t=r.geometries.size(),F=r.expressID;l.Id=F.toString();for(let $=0;$<t;$++){let le=new UU;const Te=r.geometries.get($),{x:Le,y:Se,z:be,w:xe}=Te.color;let Ye=this._materials.findIndex(zt=>zt.x==Le&&zt.y==Se&&zt.z==be&&zt.w==xe);Ye<0&&(this._materials.push({x:Le,y:Se,z:be,w:xe}),Ye=this._materials.length-1),le.MaterialIndex=Ye;const pe=xe!==1,{geometryExpressID:Ze}=Te,lt=`${Ze}-${pe}`,Tt=this.getGeometry(this._webIfc,Ze);new s0().fromArray(Te.flatTransformation);for(let zt=0;zt<Tt.position.length;zt+=3){const Kt=Tt.position[zt],Zt=Tt.position[zt+1],fl=Tt.position[zt+2],At=new kr(Kt,Zt,fl);//!switch back to revit xyz, get revit axis is a standard for every format so we dont have to recode again.
|
|
40
|
+
le.Vertices.push(new Sa(-At.x,At.z,At.y))}le.Indices=Tt.index,le.GeometryId=lt,le.Transform=Te.flatTransformation,le.Id=F.toString(),this._groupByGeometryId[lt]||(this._groupByGeometryId[lt]=[]),this._groupByGeometryId[lt].push(le),l.Solids.push(le)}return l}getGeometry(r,l){const t=r.GetGeometry(0,l),F=r.GetIndexArray(t.GetIndexData(),t.GetIndexDataSize()),$=r.GetVertexArray(t.GetVertexData(),t.GetVertexDataSize()),le=new Float32Array($.length/2),Te=new Float32Array($.length/2);for(let Le=0;Le<$.length;Le+=6)le[Le/2]=$[Le],le[Le/2+1]=$[Le+1],le[Le/2+2]=$[Le+2],Te[Le/2]=$[Le+3],Te[Le/2+1]=$[Le+4],Te[Le/2+2]=$[Le+5];return t.delete(),{position:le,normal:Te,index:Array.from(F)}}async getAllProperties(){return await this._propertyExporter.export(this._webIfc,0)}async getWorldCoordinationMatrix(){return this._webIfc.GetCoordinationMatrix(0)}async _dispose(){this._fragments.clear(),this._materials=[],this._groupByGeometryId={}}flattenObject(r,l="",t={}){for(const F of Object.keys(r)){const $=l?`${l}.${F}`:F;typeof r[F]=="object"&&r[F]!==null&&!Array.isArray(r[F])?this.flattenObject(r[F],$,t):t[$]=r[F]}return t}generateInstancedMesh(){let r=[];for(const l of Object.keys(this._groupByGeometryId)){let t=this._groupByGeometryId[l],F=new EB;F.Id=l,F.Solids=[t[0]],t.forEach($=>{let le=new xU;le.Id=$.Id,le.Matrix=new s0().fromArray($.Transform),le.BasisX=new Sa($.Transform[0],-$.Transform[2],-$.Transform[1]),le.BasisZ=new Sa(-$.Transform[4],$.Transform[6],$.Transform[5]),le.BasisY=new Sa(-$.Transform[8],$.Transform[10],$.Transform[9]),le.Offset=new Sa(-$.Transform[12],$.Transform[14],$.Transform[13]),F.Instances.push(le)}),r.push(F)}return console.log(r),r}generateBoundingbox(r){let t=r.map(Le=>Le.Instances).flat().map(Le=>Le.Offset),F=t.map(Le=>Le.X),$=t.map(Le=>Le.Y),le=t.map(Le=>Le.Z),Te=new BH;return Te.box.min=new Sa(Math.min(...F),Math.min(...$),Math.min(...le)),Te.box.max=new Sa(Math.max(...F),Math.max(...$),Math.max(...le)),Te}};mH.release="2.3.8";let RB=mH;exports.Fragment=Qx;exports.FragmentInstance=$x;exports.IFCReader=RB;exports.RenderMaterial=hM;exports.RevitTransform=xU;exports.ViralPoint=Sa;exports.ViralutionBox=GU;exports.ViralutionCamera=BH;exports.ViralutionElement=EB;exports.ViralutionIFCModel=BU;exports.ViralutionInformation=MU;exports.ViralutionSolid=UU;exports.ViralutionTrackingModel=Zx;
|
package/dist/index.js
CHANGED
|
@@ -40159,7 +40159,8 @@ const mH = class mH {
|
|
|
40159
40159
|
async loadByUrl(r) {
|
|
40160
40160
|
this._dispose();
|
|
40161
40161
|
const t = await (await fetch(r)).arrayBuffer(), F = new Uint8Array(t);
|
|
40162
|
-
|
|
40162
|
+
let $ = await this.load2(F);
|
|
40163
|
+
return this._webIfc.Dispose(), $;
|
|
40163
40164
|
}
|
|
40164
40165
|
async load2(r, l = !0) {
|
|
40165
40166
|
await this.readIfcFile(r);
|
|
@@ -40251,7 +40252,7 @@ const mH = class mH {
|
|
|
40251
40252
|
}
|
|
40252
40253
|
//#endregion
|
|
40253
40254
|
async _dispose() {
|
|
40254
|
-
this.
|
|
40255
|
+
this._fragments.clear(), this._materials = [], this._groupByGeometryId = {};
|
|
40255
40256
|
}
|
|
40256
40257
|
flattenObject(r, l = "", t = {}) {
|
|
40257
40258
|
for (const F of Object.keys(r)) {
|