ifc-reader-2 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 PU="162",CU=300,gM=1e3,cH=1001,bM=1002,HM=1003,Dx=1006,Nx=1008,Ax=1009,Ox=1014,Sx=1020,Lx=1023,oB=1026,BM=1027,px="",mx=515,oH=2e3,MM=2001;class gU{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 W=this._listeners[r];if(W!==void 0){const J=W.indexOf(l);J!==-1&&W.splice(J,1)}}dispatchEvent(r){if(this._listeners===void 0)return;const t=this._listeners[r.type];if(t!==void 0){r.target=this;const W=t.slice(0);for(let J=0,ue=W.length;J<ue;J++)W[J].call(this,r);r.target=null}}}const Qo=["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 cM(){const e=Math.random()*4294967295|0,r=Math.random()*4294967295|0,l=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return(Qo[e&255]+Qo[e>>8&255]+Qo[e>>16&255]+Qo[e>>24&255]+"-"+Qo[r&255]+Qo[r>>8&255]+"-"+Qo[r>>16&15|64]+Qo[r>>24&255]+"-"+Qo[l&63|128]+Qo[l>>8&255]+"-"+Qo[l>>16&255]+Qo[l>>24&255]+Qo[t&255]+Qo[t>>8&255]+Qo[t>>16&255]+Qo[t>>24&255]).toLowerCase()}function S7(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,W=r.elements;return this.x=W[0]*l+W[3]*t+W[6],this.y=W[1]*l+W[4]*t+W[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(S7(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),W=Math.sin(l),J=this.x-r.x,ue=this.y-r.y;return this.x=J*t-ue*W+r.x,this.y=J*W+ue*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,W,J,ue,Ee,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,W,J,ue,Ee,Le,Se)}set(r,l,t,W,J,ue,Ee,Le,Se){const He=this.elements;return He[0]=r,He[1]=W,He[2]=Ee,He[3]=l,He[4]=J,He[5]=Le,He[6]=t,He[7]=ue,He[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,W=l.elements,J=this.elements,ue=t[0],Ee=t[3],Le=t[6],Se=t[1],He=t[4],xe=t[7],Ye=t[2],pe=t[5],$e=t[8],lt=W[0],wt=W[3],Dt=W[6],hl=W[1],Kt=W[4],Yt=W[7],Al=W[2],pt=W[5],Pt=W[8];return J[0]=ue*lt+Ee*hl+Le*Al,J[3]=ue*wt+Ee*Kt+Le*pt,J[6]=ue*Dt+Ee*Yt+Le*Pt,J[1]=Se*lt+He*hl+xe*Al,J[4]=Se*wt+He*Kt+xe*pt,J[7]=Se*Dt+He*Yt+xe*Pt,J[2]=Ye*lt+pe*hl+$e*Al,J[5]=Ye*wt+pe*Kt+$e*pt,J[8]=Ye*Dt+pe*Yt+$e*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],W=r[2],J=r[3],ue=r[4],Ee=r[5],Le=r[6],Se=r[7],He=r[8];return l*ue*He-l*Ee*Se-t*J*He+t*Ee*Le+W*J*Se-W*ue*Le}invert(){const r=this.elements,l=r[0],t=r[1],W=r[2],J=r[3],ue=r[4],Ee=r[5],Le=r[6],Se=r[7],He=r[8],xe=He*ue-Ee*Se,Ye=Ee*Le-He*J,pe=Se*J-ue*Le,$e=l*xe+t*Ye+W*pe;if($e===0)return this.set(0,0,0,0,0,0,0,0,0);const lt=1/$e;return r[0]=xe*lt,r[1]=(W*Se-He*t)*lt,r[2]=(Ee*t-W*ue)*lt,r[3]=Ye*lt,r[4]=(He*l-W*Le)*lt,r[5]=(W*J-Ee*l)*lt,r[6]=pe*lt,r[7]=(t*Le-Se*l)*lt,r[8]=(ue*l-t*J)*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,W,J,ue,Ee){const Le=Math.cos(J),Se=Math.sin(J);return this.set(t*Le,t*Se,-t*(Le*ue+Se*Ee)+ue+r,-W*Se,W*Le,-W*(-Se*ue+Le*Ee)+Ee+l,0,0,1),this}scale(r,l){return this.premultiply(IB.makeScale(r,l)),this}rotate(r){return this.premultiply(IB.makeRotation(-r)),this}translate(r,l){return this.premultiply(IB.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 W=0;W<9;W++)if(l[W]!==t[W])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 IB=new Db;function UM(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function hB(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}let i9;class Px{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=UM("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=UM("canvas");l.width=r.width,l.height=r.height;const t=l.getContext("2d");t.drawImage(r,0,0,r.width,r.height);const W=t.getImageData(0,0,r.width,r.height),J=W.data;for(let ue=0;ue<J.length;ue++)J[ue]=hB(J[ue]/255)*255;return t.putImageData(W,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(hB(l[t]/255)*255):l[t]=hB(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 Cx=0;class gx{constructor(r=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Cx++}),this.uuid=cM(),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:""},W=this.data;if(W!==null){let J;if(Array.isArray(W)){J=[];for(let ue=0,Ee=W.length;ue<Ee;ue++)W[ue].isDataTexture?J.push(fB(W[ue].image)):J.push(fB(W[ue]))}else J=fB(W);t.url=J}return l||(r.images[this.uuid]=t),t}}function fB(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap?Px.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 bx=0;class p8 extends gU{constructor(r=p8.DEFAULT_IMAGE,l=p8.DEFAULT_MAPPING,t=cH,W=cH,J=Dx,ue=Nx,Ee=Lx,Le=Ax,Se=p8.DEFAULT_ANISOTROPY,He=px){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:bx++}),this.uuid=cM(),this.name="",this.source=new gx(r),this.mipmaps=[],this.mapping=l,this.channel=0,this.wrapS=t,this.wrapT=W,this.magFilter=J,this.minFilter=ue,this.anisotropy=Se,this.format=Ee,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=He,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!==CU)return r;if(r.applyMatrix3(this.matrix),r.x<0||r.x>1)switch(this.wrapS){case gM: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 gM: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=CU;p8.DEFAULT_ANISOTROPY=1;class Nb{constructor(r=0,l=0,t=0,W=1){this.isQuaternion=!0,this._x=r,this._y=l,this._z=t,this._w=W}static slerpFlat(r,l,t,W,J,ue,Ee){let Le=t[W+0],Se=t[W+1],He=t[W+2],xe=t[W+3];const Ye=J[ue+0],pe=J[ue+1],$e=J[ue+2],lt=J[ue+3];if(Ee===0){r[l+0]=Le,r[l+1]=Se,r[l+2]=He,r[l+3]=xe;return}if(Ee===1){r[l+0]=Ye,r[l+1]=pe,r[l+2]=$e,r[l+3]=lt;return}if(xe!==lt||Le!==Ye||Se!==pe||He!==$e){let wt=1-Ee;const Dt=Le*Ye+Se*pe+He*$e+xe*lt,hl=Dt>=0?1:-1,Kt=1-Dt*Dt;if(Kt>Number.EPSILON){const Al=Math.sqrt(Kt),pt=Math.atan2(Al,Dt*hl);wt=Math.sin(wt*pt)/Al,Ee=Math.sin(Ee*pt)/Al}const Yt=Ee*hl;if(Le=Le*wt+Ye*Yt,Se=Se*wt+pe*Yt,He=He*wt+$e*Yt,xe=xe*wt+lt*Yt,wt===1-Ee){const Al=1/Math.sqrt(Le*Le+Se*Se+He*He+xe*xe);Le*=Al,Se*=Al,He*=Al,xe*=Al}}r[l]=Le,r[l+1]=Se,r[l+2]=He,r[l+3]=xe}static multiplyQuaternionsFlat(r,l,t,W,J,ue){const Ee=t[W],Le=t[W+1],Se=t[W+2],He=t[W+3],xe=J[ue],Ye=J[ue+1],pe=J[ue+2],$e=J[ue+3];return r[l]=Ee*$e+He*xe+Le*pe-Se*Ye,r[l+1]=Le*$e+He*Ye+Se*xe-Ee*pe,r[l+2]=Se*$e+He*pe+Ee*Ye-Le*xe,r[l+3]=He*$e-Ee*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,W){return this._x=r,this._y=l,this._z=t,this._w=W,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,W=r._y,J=r._z,ue=r._order,Ee=Math.cos,Le=Math.sin,Se=Ee(t/2),He=Ee(W/2),xe=Ee(J/2),Ye=Le(t/2),pe=Le(W/2),$e=Le(J/2);switch(ue){case"XYZ":this._x=Ye*He*xe+Se*pe*$e,this._y=Se*pe*xe-Ye*He*$e,this._z=Se*He*$e+Ye*pe*xe,this._w=Se*He*xe-Ye*pe*$e;break;case"YXZ":this._x=Ye*He*xe+Se*pe*$e,this._y=Se*pe*xe-Ye*He*$e,this._z=Se*He*$e-Ye*pe*xe,this._w=Se*He*xe+Ye*pe*$e;break;case"ZXY":this._x=Ye*He*xe-Se*pe*$e,this._y=Se*pe*xe+Ye*He*$e,this._z=Se*He*$e+Ye*pe*xe,this._w=Se*He*xe-Ye*pe*$e;break;case"ZYX":this._x=Ye*He*xe-Se*pe*$e,this._y=Se*pe*xe+Ye*He*$e,this._z=Se*He*$e-Ye*pe*xe,this._w=Se*He*xe+Ye*pe*$e;break;case"YZX":this._x=Ye*He*xe+Se*pe*$e,this._y=Se*pe*xe+Ye*He*$e,this._z=Se*He*$e-Ye*pe*xe,this._w=Se*He*xe-Ye*pe*$e;break;case"XZY":this._x=Ye*He*xe-Se*pe*$e,this._y=Se*pe*xe-Ye*He*$e,this._z=Se*He*$e+Ye*pe*xe,this._w=Se*He*xe+Ye*pe*$e;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+ue)}return l===!0&&this._onChangeCallback(),this}setFromAxisAngle(r,l){const t=l/2,W=Math.sin(t);return this._x=r.x*W,this._y=r.y*W,this._z=r.z*W,this._w=Math.cos(t),this._onChangeCallback(),this}setFromRotationMatrix(r){const l=r.elements,t=l[0],W=l[4],J=l[8],ue=l[1],Ee=l[5],Le=l[9],Se=l[2],He=l[6],xe=l[10],Ye=t+Ee+xe;if(Ye>0){const pe=.5/Math.sqrt(Ye+1);this._w=.25/pe,this._x=(He-Le)*pe,this._y=(J-Se)*pe,this._z=(ue-W)*pe}else if(t>Ee&&t>xe){const pe=2*Math.sqrt(1+t-Ee-xe);this._w=(He-Le)/pe,this._x=.25*pe,this._y=(W+ue)/pe,this._z=(J+Se)/pe}else if(Ee>xe){const pe=2*Math.sqrt(1+Ee-t-xe);this._w=(J-Se)/pe,this._x=(W+ue)/pe,this._y=.25*pe,this._z=(Le+He)/pe}else{const pe=2*Math.sqrt(1+xe-t-Ee);this._w=(ue-W)/pe,this._x=(J+Se)/pe,this._y=(Le+He)/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(S7(this.dot(r),-1,1)))}rotateTowards(r,l){const t=this.angleTo(r);if(t===0)return this;const W=Math.min(1,l/t);return this.slerp(r,W),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,W=r._y,J=r._z,ue=r._w,Ee=l._x,Le=l._y,Se=l._z,He=l._w;return this._x=t*He+ue*Ee+W*Se-J*Le,this._y=W*He+ue*Le+J*Ee-t*Se,this._z=J*He+ue*Se+t*Le-W*Ee,this._w=ue*He-t*Ee-W*Le-J*Se,this._onChangeCallback(),this}slerp(r,l){if(l===0)return this;if(l===1)return this.copy(r);const t=this._x,W=this._y,J=this._z,ue=this._w;let Ee=ue*r._w+t*r._x+W*r._y+J*r._z;if(Ee<0?(this._w=-r._w,this._x=-r._x,this._y=-r._y,this._z=-r._z,Ee=-Ee):this.copy(r),Ee>=1)return this._w=ue,this._x=t,this._y=W,this._z=J,this;const Le=1-Ee*Ee;if(Le<=Number.EPSILON){const pe=1-l;return this._w=pe*ue+l*this._w,this._x=pe*t+l*this._x,this._y=pe*W+l*this._y,this._z=pe*J+l*this._z,this.normalize(),this}const Se=Math.sqrt(Le),He=Math.atan2(Se,Ee),xe=Math.sin((1-l)*He)/Se,Ye=Math.sin(l*He)/Se;return this._w=ue*xe+this._w*Ye,this._x=t*xe+this._x*Ye,this._y=W*xe+this._y*Ye,this._z=J*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(),W=Math.sqrt(1-t),J=Math.sqrt(t);return this.set(W*Math.sin(r),W*Math.cos(r),J*Math.sin(l),J*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(xM.setFromEuler(r))}applyAxisAngle(r,l){return this.applyQuaternion(xM.setFromAxisAngle(r,l))}applyMatrix3(r){const l=this.x,t=this.y,W=this.z,J=r.elements;return this.x=J[0]*l+J[3]*t+J[6]*W,this.y=J[1]*l+J[4]*t+J[7]*W,this.z=J[2]*l+J[5]*t+J[8]*W,this}applyNormalMatrix(r){return this.applyMatrix3(r).normalize()}applyMatrix4(r){const l=this.x,t=this.y,W=this.z,J=r.elements,ue=1/(J[3]*l+J[7]*t+J[11]*W+J[15]);return this.x=(J[0]*l+J[4]*t+J[8]*W+J[12])*ue,this.y=(J[1]*l+J[5]*t+J[9]*W+J[13])*ue,this.z=(J[2]*l+J[6]*t+J[10]*W+J[14])*ue,this}applyQuaternion(r){const l=this.x,t=this.y,W=this.z,J=r.x,ue=r.y,Ee=r.z,Le=r.w,Se=2*(ue*W-Ee*t),He=2*(Ee*l-J*W),xe=2*(J*t-ue*l);return this.x=l+Le*Se+ue*xe-Ee*He,this.y=t+Le*He+Ee*Se-J*xe,this.z=W+Le*xe+J*He-ue*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,W=this.z,J=r.elements;return this.x=J[0]*l+J[4]*t+J[8]*W,this.y=J[1]*l+J[5]*t+J[9]*W,this.z=J[2]*l+J[6]*t+J[10]*W,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,W=r.y,J=r.z,ue=l.x,Ee=l.y,Le=l.z;return this.x=W*Le-J*Ee,this.y=J*ue-t*Le,this.z=t*Ee-W*ue,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 dB.copy(this).projectOnVector(r),this.sub(dB)}reflect(r){return this.sub(dB.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(S7(t,-1,1))}distanceTo(r){return Math.sqrt(this.distanceToSquared(r))}distanceToSquared(r){const l=this.x-r.x,t=this.y-r.y,W=this.z-r.z;return l*l+t*t+W*W}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 W=Math.sin(l)*r;return this.x=W*Math.sin(t),this.y=Math.cos(l)*r,this.z=W*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(),W=this.setFromMatrixColumn(r,2).length();return this.x=l,this.y=t,this.z=W,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 dB=new kr,xM=new Nb;class Wy{constructor(r,l,t,W,J,ue,Ee,Le,Se,He,xe,Ye,pe,$e,lt,wt){Wy.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,W,J,ue,Ee,Le,Se,He,xe,Ye,pe,$e,lt,wt)}set(r,l,t,W,J,ue,Ee,Le,Se,He,xe,Ye,pe,$e,lt,wt){const Dt=this.elements;return Dt[0]=r,Dt[4]=l,Dt[8]=t,Dt[12]=W,Dt[1]=J,Dt[5]=ue,Dt[9]=Ee,Dt[13]=Le,Dt[2]=Se,Dt[6]=He,Dt[10]=xe,Dt[14]=Ye,Dt[3]=pe,Dt[7]=$e,Dt[11]=lt,Dt[15]=wt,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 Wy().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,W=1/c9.setFromMatrixColumn(r,0).length(),J=1/c9.setFromMatrixColumn(r,1).length(),ue=1/c9.setFromMatrixColumn(r,2).length();return l[0]=t[0]*W,l[1]=t[1]*W,l[2]=t[2]*W,l[3]=0,l[4]=t[4]*J,l[5]=t[5]*J,l[6]=t[6]*J,l[7]=0,l[8]=t[8]*ue,l[9]=t[9]*ue,l[10]=t[10]*ue,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,W=r.y,J=r.z,ue=Math.cos(t),Ee=Math.sin(t),Le=Math.cos(W),Se=Math.sin(W),He=Math.cos(J),xe=Math.sin(J);if(r.order==="XYZ"){const Ye=ue*He,pe=ue*xe,$e=Ee*He,lt=Ee*xe;l[0]=Le*He,l[4]=-Le*xe,l[8]=Se,l[1]=pe+$e*Se,l[5]=Ye-lt*Se,l[9]=-Ee*Le,l[2]=lt-Ye*Se,l[6]=$e+pe*Se,l[10]=ue*Le}else if(r.order==="YXZ"){const Ye=Le*He,pe=Le*xe,$e=Se*He,lt=Se*xe;l[0]=Ye+lt*Ee,l[4]=$e*Ee-pe,l[8]=ue*Se,l[1]=ue*xe,l[5]=ue*He,l[9]=-Ee,l[2]=pe*Ee-$e,l[6]=lt+Ye*Ee,l[10]=ue*Le}else if(r.order==="ZXY"){const Ye=Le*He,pe=Le*xe,$e=Se*He,lt=Se*xe;l[0]=Ye-lt*Ee,l[4]=-ue*xe,l[8]=$e+pe*Ee,l[1]=pe+$e*Ee,l[5]=ue*He,l[9]=lt-Ye*Ee,l[2]=-ue*Se,l[6]=Ee,l[10]=ue*Le}else if(r.order==="ZYX"){const Ye=ue*He,pe=ue*xe,$e=Ee*He,lt=Ee*xe;l[0]=Le*He,l[4]=$e*Se-pe,l[8]=Ye*Se+lt,l[1]=Le*xe,l[5]=lt*Se+Ye,l[9]=pe*Se-$e,l[2]=-Se,l[6]=Ee*Le,l[10]=ue*Le}else if(r.order==="YZX"){const Ye=ue*Le,pe=ue*Se,$e=Ee*Le,lt=Ee*Se;l[0]=Le*He,l[4]=lt-Ye*xe,l[8]=$e*xe+pe,l[1]=xe,l[5]=ue*He,l[9]=-Ee*He,l[2]=-Se*He,l[6]=pe*xe+$e,l[10]=Ye-lt*xe}else if(r.order==="XZY"){const Ye=ue*Le,pe=ue*Se,$e=Ee*Le,lt=Ee*Se;l[0]=Le*He,l[4]=-xe,l[8]=Se*He,l[1]=Ye*xe+lt,l[5]=ue*He,l[9]=pe*xe-$e,l[2]=$e*xe-pe,l[6]=Ee*He,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(Hx,r,Bx)}lookAt(r,l,t){const W=this.elements;return Jf.subVectors(r,l),Jf.lengthSq()===0&&(Jf.z=1),Jf.normalize(),FD.crossVectors(t,Jf),FD.lengthSq()===0&&(Math.abs(t.z)===1?Jf.x+=1e-4:Jf.z+=1e-4,Jf.normalize(),FD.crossVectors(t,Jf)),FD.normalize(),IH.crossVectors(Jf,FD),W[0]=FD.x,W[4]=IH.x,W[8]=Jf.x,W[1]=FD.y,W[5]=IH.y,W[9]=Jf.y,W[2]=FD.z,W[6]=IH.z,W[10]=Jf.z,this}multiply(r){return this.multiplyMatrices(this,r)}premultiply(r){return this.multiplyMatrices(r,this)}multiplyMatrices(r,l){const t=r.elements,W=l.elements,J=this.elements,ue=t[0],Ee=t[4],Le=t[8],Se=t[12],He=t[1],xe=t[5],Ye=t[9],pe=t[13],$e=t[2],lt=t[6],wt=t[10],Dt=t[14],hl=t[3],Kt=t[7],Yt=t[11],Al=t[15],pt=W[0],Pt=W[4],bs=W[8],_n=W[12],Et=W[1],xt=W[5],Pr=W[9],ls=W[13],fs=W[2],La=W[6],Bl=W[10],ul=W[14],Zc=W[3],ec=W[7],Cr=W[11],Jc=W[15];return J[0]=ue*pt+Ee*Et+Le*fs+Se*Zc,J[4]=ue*Pt+Ee*xt+Le*La+Se*ec,J[8]=ue*bs+Ee*Pr+Le*Bl+Se*Cr,J[12]=ue*_n+Ee*ls+Le*ul+Se*Jc,J[1]=He*pt+xe*Et+Ye*fs+pe*Zc,J[5]=He*Pt+xe*xt+Ye*La+pe*ec,J[9]=He*bs+xe*Pr+Ye*Bl+pe*Cr,J[13]=He*_n+xe*ls+Ye*ul+pe*Jc,J[2]=$e*pt+lt*Et+wt*fs+Dt*Zc,J[6]=$e*Pt+lt*xt+wt*La+Dt*ec,J[10]=$e*bs+lt*Pr+wt*Bl+Dt*Cr,J[14]=$e*_n+lt*ls+wt*ul+Dt*Jc,J[3]=hl*pt+Kt*Et+Yt*fs+Al*Zc,J[7]=hl*Pt+Kt*xt+Yt*La+Al*ec,J[11]=hl*bs+Kt*Pr+Yt*Bl+Al*Cr,J[15]=hl*_n+Kt*ls+Yt*ul+Al*Jc,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],W=r[8],J=r[12],ue=r[1],Ee=r[5],Le=r[9],Se=r[13],He=r[2],xe=r[6],Ye=r[10],pe=r[14],$e=r[3],lt=r[7],wt=r[11],Dt=r[15];return $e*(+J*Le*xe-W*Se*xe-J*Ee*Ye+t*Se*Ye+W*Ee*pe-t*Le*pe)+lt*(+l*Le*pe-l*Se*Ye+J*ue*Ye-W*ue*pe+W*Se*He-J*Le*He)+wt*(+l*Se*xe-l*Ee*pe-J*ue*xe+t*ue*pe+J*Ee*He-t*Se*He)+Dt*(-W*Ee*He-l*Le*xe+l*Ee*Ye+W*ue*xe-t*ue*Ye+t*Le*He)}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 W=this.elements;return r.isVector3?(W[12]=r.x,W[13]=r.y,W[14]=r.z):(W[12]=r,W[13]=l,W[14]=t),this}invert(){const r=this.elements,l=r[0],t=r[1],W=r[2],J=r[3],ue=r[4],Ee=r[5],Le=r[6],Se=r[7],He=r[8],xe=r[9],Ye=r[10],pe=r[11],$e=r[12],lt=r[13],wt=r[14],Dt=r[15],hl=xe*wt*Se-lt*Ye*Se+lt*Le*pe-Ee*wt*pe-xe*Le*Dt+Ee*Ye*Dt,Kt=$e*Ye*Se-He*wt*Se-$e*Le*pe+ue*wt*pe+He*Le*Dt-ue*Ye*Dt,Yt=He*lt*Se-$e*xe*Se+$e*Ee*pe-ue*lt*pe-He*Ee*Dt+ue*xe*Dt,Al=$e*xe*Le-He*lt*Le-$e*Ee*Ye+ue*lt*Ye+He*Ee*wt-ue*xe*wt,pt=l*hl+t*Kt+W*Yt+J*Al;if(pt===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const Pt=1/pt;return r[0]=hl*Pt,r[1]=(lt*Ye*J-xe*wt*J-lt*W*pe+t*wt*pe+xe*W*Dt-t*Ye*Dt)*Pt,r[2]=(Ee*wt*J-lt*Le*J+lt*W*Se-t*wt*Se-Ee*W*Dt+t*Le*Dt)*Pt,r[3]=(xe*Le*J-Ee*Ye*J-xe*W*Se+t*Ye*Se+Ee*W*pe-t*Le*pe)*Pt,r[4]=Kt*Pt,r[5]=(He*wt*J-$e*Ye*J+$e*W*pe-l*wt*pe-He*W*Dt+l*Ye*Dt)*Pt,r[6]=($e*Le*J-ue*wt*J-$e*W*Se+l*wt*Se+ue*W*Dt-l*Le*Dt)*Pt,r[7]=(ue*Ye*J-He*Le*J+He*W*Se-l*Ye*Se-ue*W*pe+l*Le*pe)*Pt,r[8]=Yt*Pt,r[9]=($e*xe*J-He*lt*J-$e*t*pe+l*lt*pe+He*t*Dt-l*xe*Dt)*Pt,r[10]=(ue*lt*J-$e*Ee*J+$e*t*Se-l*lt*Se-ue*t*Dt+l*Ee*Dt)*Pt,r[11]=(He*Ee*J-ue*xe*J-He*t*Se+l*xe*Se+ue*t*pe-l*Ee*pe)*Pt,r[12]=Al*Pt,r[13]=(He*lt*W-$e*xe*W+$e*t*Ye-l*lt*Ye-He*t*wt+l*xe*wt)*Pt,r[14]=($e*Ee*W-ue*lt*W-$e*t*Le+l*lt*Le+ue*t*wt-l*Ee*wt)*Pt,r[15]=(ue*xe*W-He*Ee*W+He*t*Le-l*xe*Le-ue*t*Ye+l*Ee*Ye)*Pt,this}scale(r){const l=this.elements,t=r.x,W=r.y,J=r.z;return l[0]*=t,l[4]*=W,l[8]*=J,l[1]*=t,l[5]*=W,l[9]*=J,l[2]*=t,l[6]*=W,l[10]*=J,l[3]*=t,l[7]*=W,l[11]*=J,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],W=r[8]*r[8]+r[9]*r[9]+r[10]*r[10];return Math.sqrt(Math.max(l,t,W))}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),W=Math.sin(l),J=1-t,ue=r.x,Ee=r.y,Le=r.z,Se=J*ue,He=J*Ee;return this.set(Se*ue+t,Se*Ee-W*Le,Se*Le+W*Ee,0,Se*Ee+W*Le,He*Ee+t,He*Le-W*ue,0,Se*Le-W*Ee,He*Le+W*ue,J*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,W,J,ue){return this.set(1,t,J,0,r,1,ue,0,l,W,1,0,0,0,0,1),this}compose(r,l,t){const W=this.elements,J=l._x,ue=l._y,Ee=l._z,Le=l._w,Se=J+J,He=ue+ue,xe=Ee+Ee,Ye=J*Se,pe=J*He,$e=J*xe,lt=ue*He,wt=ue*xe,Dt=Ee*xe,hl=Le*Se,Kt=Le*He,Yt=Le*xe,Al=t.x,pt=t.y,Pt=t.z;return W[0]=(1-(lt+Dt))*Al,W[1]=(pe+Yt)*Al,W[2]=($e-Kt)*Al,W[3]=0,W[4]=(pe-Yt)*pt,W[5]=(1-(Ye+Dt))*pt,W[6]=(wt+hl)*pt,W[7]=0,W[8]=($e+Kt)*Pt,W[9]=(wt-hl)*Pt,W[10]=(1-(Ye+lt))*Pt,W[11]=0,W[12]=r.x,W[13]=r.y,W[14]=r.z,W[15]=1,this}decompose(r,l,t){const W=this.elements;let J=c9.set(W[0],W[1],W[2]).length();const ue=c9.set(W[4],W[5],W[6]).length(),Ee=c9.set(W[8],W[9],W[10]).length();this.determinant()<0&&(J=-J),r.x=W[12],r.y=W[13],r.z=W[14],py.copy(this);const Se=1/J,He=1/ue,xe=1/Ee;return py.elements[0]*=Se,py.elements[1]*=Se,py.elements[2]*=Se,py.elements[4]*=He,py.elements[5]*=He,py.elements[6]*=He,py.elements[8]*=xe,py.elements[9]*=xe,py.elements[10]*=xe,l.setFromRotationMatrix(py),t.x=J,t.y=ue,t.z=Ee,this}makePerspective(r,l,t,W,J,ue,Ee=oH){const Le=this.elements,Se=2*J/(l-r),He=2*J/(t-W),xe=(l+r)/(l-r),Ye=(t+W)/(t-W);let pe,$e;if(Ee===oH)pe=-(ue+J)/(ue-J),$e=-2*ue*J/(ue-J);else if(Ee===MM)pe=-ue/(ue-J),$e=-ue*J/(ue-J);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+Ee);return Le[0]=Se,Le[4]=0,Le[8]=xe,Le[12]=0,Le[1]=0,Le[5]=He,Le[9]=Ye,Le[13]=0,Le[2]=0,Le[6]=0,Le[10]=pe,Le[14]=$e,Le[3]=0,Le[7]=0,Le[11]=-1,Le[15]=0,this}makeOrthographic(r,l,t,W,J,ue,Ee=oH){const Le=this.elements,Se=1/(l-r),He=1/(t-W),xe=1/(ue-J),Ye=(l+r)*Se,pe=(t+W)*He;let $e,lt;if(Ee===oH)$e=(ue+J)*xe,lt=-2*xe;else if(Ee===MM)$e=J*xe,lt=-1*xe;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+Ee);return Le[0]=2*Se,Le[4]=0,Le[8]=0,Le[12]=-Ye,Le[1]=0,Le[5]=2*He,Le[9]=0,Le[13]=-pe,Le[2]=0,Le[6]=0,Le[10]=lt,Le[14]=-$e,Le[3]=0,Le[7]=0,Le[11]=0,Le[15]=1,this}equals(r){const l=this.elements,t=r.elements;for(let W=0;W<16;W++)if(l[W]!==t[W])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 Wy,Hx=new kr(0,0,0),Bx=new kr(1,1,1),FD=new kr,IH=new kr,Jf=new kr,GM=new Wy,FM=new Nb;class HH{constructor(r=0,l=0,t=0,W=HH.DEFAULT_ORDER){this.isEuler=!0,this._x=r,this._y=l,this._z=t,this._order=W}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,W=this._order){return this._x=r,this._y=l,this._z=t,this._order=W,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 W=r.elements,J=W[0],ue=W[4],Ee=W[8],Le=W[1],Se=W[5],He=W[9],xe=W[2],Ye=W[6],pe=W[10];switch(l){case"XYZ":this._y=Math.asin(S7(Ee,-1,1)),Math.abs(Ee)<.9999999?(this._x=Math.atan2(-He,pe),this._z=Math.atan2(-ue,J)):(this._x=Math.atan2(Ye,Se),this._z=0);break;case"YXZ":this._x=Math.asin(-S7(He,-1,1)),Math.abs(He)<.9999999?(this._y=Math.atan2(Ee,pe),this._z=Math.atan2(Le,Se)):(this._y=Math.atan2(-xe,J),this._z=0);break;case"ZXY":this._x=Math.asin(S7(Ye,-1,1)),Math.abs(Ye)<.9999999?(this._y=Math.atan2(-xe,pe),this._z=Math.atan2(-ue,Se)):(this._y=0,this._z=Math.atan2(Le,J));break;case"ZYX":this._y=Math.asin(-S7(xe,-1,1)),Math.abs(xe)<.9999999?(this._x=Math.atan2(Ye,pe),this._z=Math.atan2(Le,J)):(this._x=0,this._z=Math.atan2(-ue,Se));break;case"YZX":this._z=Math.asin(S7(Le,-1,1)),Math.abs(Le)<.9999999?(this._x=Math.atan2(-He,Se),this._y=Math.atan2(-xe,J)):(this._x=0,this._y=Math.atan2(Ee,pe));break;case"XZY":this._z=Math.asin(-S7(ue,-1,1)),Math.abs(ue)<.9999999?(this._x=Math.atan2(Ye,Se),this._y=Math.atan2(Ee,J)):(this._x=Math.atan2(-He,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 GM.makeRotationFromQuaternion(r),this.setFromRotationMatrix(GM,l,t)}setFromVector3(r,l=this._order){return this.set(r.x,r.y,r.z,l)}reorder(r){return FM.setFromEuler(this),this.setFromQuaternion(FM,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 Mx{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 Ux=0;const VM=new kr,o9=new Nb,O7=new Wy,hH=new kr,_g=new kr,xx=new kr,Gx=new Nb,WM=new kr(1,0,0),jM=new kr(0,1,0),YM=new kr(0,0,1),Fx={type:"added"},Vx={type:"removed"},yB={type:"childadded",child:null},wB={type:"childremoved",child:null};class AO extends gU{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ux++}),this.uuid=cM(),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,W=new kr(1,1,1);function J(){t.setFromEuler(l,!1)}function ue(){l.setFromQuaternion(t,void 0,!1)}l._onChange(J),t._onChange(ue),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:W},modelViewMatrix:{value:new Wy},normalMatrix:{value:new Db}}),this.matrix=new Wy,this.matrixWorld=new Wy,this.matrixAutoUpdate=AO.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=AO.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Mx,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(WM,r)}rotateY(r){return this.rotateOnAxis(jM,r)}rotateZ(r){return this.rotateOnAxis(YM,r)}translateOnAxis(r,l){return VM.copy(r).applyQuaternion(this.quaternion),this.position.add(VM.multiplyScalar(l)),this}translateX(r){return this.translateOnAxis(WM,r)}translateY(r){return this.translateOnAxis(jM,r)}translateZ(r){return this.translateOnAxis(YM,r)}localToWorld(r){return this.updateWorldMatrix(!0,!1),r.applyMatrix4(this.matrixWorld)}worldToLocal(r){return this.updateWorldMatrix(!0,!1),r.applyMatrix4(O7.copy(this.matrixWorld).invert())}lookAt(r,l,t){r.isVector3?hH.copy(r):hH.set(r,l,t);const W=this.parent;this.updateWorldMatrix(!0,!1),_g.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?O7.lookAt(_g,hH,this.up):O7.lookAt(hH,_g,this.up),this.quaternion.setFromRotationMatrix(O7),W&&(O7.extractRotation(W.matrixWorld),o9.setFromRotationMatrix(O7),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(Fx),yB.child=r,this.dispatchEvent(yB),yB.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(Vx),wB.child=r,this.dispatchEvent(wB),wB.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),O7.copy(this.matrixWorld).invert(),r.parent!==null&&(r.parent.updateWorldMatrix(!0,!1),O7.multiply(r.parent.matrixWorld)),r.applyMatrix4(O7),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,W=this.children.length;t<W;t++){const ue=this.children[t].getObjectByProperty(r,l);if(ue!==void 0)return ue}}getObjectsByProperty(r,l,t=[]){this[r]===l&&t.push(this);const W=this.children;for(let J=0,ue=W.length;J<ue;J++)W[J].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,xx),r}getWorldScale(r){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_g,Gx,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,W=l.length;t<W;t++)l[t].traverse(r)}traverseVisible(r){if(this.visible===!1)return;r(this);const l=this.children;for(let t=0,W=l.length;t<W;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,W=l.length;t<W;t++){const J=l[t];(J.matrixWorldAutoUpdate===!0||r===!0)&&J.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 W=this.children;for(let J=0,ue=W.length;J<ue;J++){const Ee=W[J];Ee.matrixWorldAutoUpdate===!0&&Ee.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 W={};W.uuid=this.uuid,W.type=this.type,this.name!==""&&(W.name=this.name),this.castShadow===!0&&(W.castShadow=!0),this.receiveShadow===!0&&(W.receiveShadow=!0),this.visible===!1&&(W.visible=!1),this.frustumCulled===!1&&(W.frustumCulled=!1),this.renderOrder!==0&&(W.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(W.userData=this.userData),W.layers=this.layers.mask,W.matrix=this.matrix.toArray(),W.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(W.matrixAutoUpdate=!1),this.isInstancedMesh&&(W.type="InstancedMesh",W.count=this.count,W.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(W.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(W.type="BatchedMesh",W.perObjectFrustumCulled=this.perObjectFrustumCulled,W.sortObjects=this.sortObjects,W.drawRanges=this._drawRanges,W.reservedRanges=this._reservedRanges,W.visibility=this._visibility,W.active=this._active,W.bounds=this._bounds.map(Ee=>({boxInitialized:Ee.boxInitialized,boxMin:Ee.box.min.toArray(),boxMax:Ee.box.max.toArray(),sphereInitialized:Ee.sphereInitialized,sphereRadius:Ee.sphere.radius,sphereCenter:Ee.sphere.center.toArray()})),W.maxGeometryCount=this._maxGeometryCount,W.maxVertexCount=this._maxVertexCount,W.maxIndexCount=this._maxIndexCount,W.geometryInitialized=this._geometryInitialized,W.geometryCount=this._geometryCount,W.matricesTexture=this._matricesTexture.toJSON(r),this.boundingSphere!==null&&(W.boundingSphere={center:W.boundingSphere.center.toArray(),radius:W.boundingSphere.radius}),this.boundingBox!==null&&(W.boundingBox={min:W.boundingBox.min.toArray(),max:W.boundingBox.max.toArray()}));function J(Ee,Le){return Ee[Le.uuid]===void 0&&(Ee[Le.uuid]=Le.toJSON(r)),Le.uuid}if(this.isScene)this.background&&(this.background.isColor?W.background=this.background.toJSON():this.background.isTexture&&(W.background=this.background.toJSON(r).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(W.environment=this.environment.toJSON(r).uuid);else if(this.isMesh||this.isLine||this.isPoints){W.geometry=J(r.geometries,this.geometry);const Ee=this.geometry.parameters;if(Ee!==void 0&&Ee.shapes!==void 0){const Le=Ee.shapes;if(Array.isArray(Le))for(let Se=0,He=Le.length;Se<He;Se++){const xe=Le[Se];J(r.shapes,xe)}else J(r.shapes,Le)}}if(this.isSkinnedMesh&&(W.bindMode=this.bindMode,W.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(J(r.skeletons,this.skeleton),W.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const Ee=[];for(let Le=0,Se=this.material.length;Le<Se;Le++)Ee.push(J(r.materials,this.material[Le]));W.material=Ee}else W.material=J(r.materials,this.material);if(this.children.length>0){W.children=[];for(let Ee=0;Ee<this.children.length;Ee++)W.children.push(this.children[Ee].toJSON(r).object)}if(this.animations.length>0){W.animations=[];for(let Ee=0;Ee<this.animations.length;Ee++){const Le=this.animations[Ee];W.animations.push(J(r.animations,Le))}}if(l){const Ee=ue(r.geometries),Le=ue(r.materials),Se=ue(r.textures),He=ue(r.images),xe=ue(r.shapes),Ye=ue(r.skeletons),pe=ue(r.animations),$e=ue(r.nodes);Ee.length>0&&(t.geometries=Ee),Le.length>0&&(t.materials=Le),Se.length>0&&(t.textures=Se),He.length>0&&(t.images=He),xe.length>0&&(t.shapes=xe),Ye.length>0&&(t.skeletons=Ye),pe.length>0&&(t.animations=pe),$e.length>0&&(t.nodes=$e)}return t.object=W,t;function ue(Ee){const Le=[];for(const Se in Ee){const He=Ee[Se];delete He.metadata,Le.push(He)}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 W=r.children[t];this.add(W.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 Wx extends p8{constructor(r,l,t,W,J,ue,Ee,Le,Se,He){if(He=He!==void 0?He:oB,He!==oB&&He!==BM)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");t===void 0&&He===oB&&(t=Ox),t===void 0&&He===BM&&(t=Sx),super(null,W,J,ue,Ee,Le,He,t,Se),this.isDepthTexture=!0,this.image={width:r,height:l},this.magFilter=Ee!==void 0?Ee:HM,this.minFilter=Le!==void 0?Le:HM,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 jx=new Wx(1,1);jx.compareFunction=mx;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:PU}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=PU);class Yx{constructor(){this.factor=1,this.complement=1}apply(r){const t=this.getScaleMatrix().multiply(r);r.copy(t)}setUp(r){var J;this.factor=1;const l=this.getLengthUnits(r);if(!l)return;const t=l==null,W=l.Name===void 0||l.Name===null;t||W||(l.Name.value==="FOOT"?this.factor=.3048:((J=l.Prefix)==null?void 0:J.value)==="MILLI"&&(this.complement=.001))}getLengthUnits(r){try{const t=r.GetLineIDsWithType(0,ex).get(0),W=r.GetLine(0,t);for(const J of W.Units){if(!J||J.value===null||J.value===void 0)continue;const ue=r.GetLine(0,J.value);if(ue.UnitType&&ue.UnitType.value==="LENGTHUNIT")return ue}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const r=this.factor;return new Wy().fromArray([r,0,0,0,0,r,0,0,0,0,r,0,0,0,0,1])}}class qx{constructor(){this.itemsByFloor={},this._units=new Yx}setUp(r){this._units.setUp(r),this.cleanUp();try{const l=r.GetLineIDsWithType(0,fe),t=new Set,W=r.GetLineIDsWithType(0,pr);for(let Se=0;Se<W.size();Se++)t.add(W.get(Se));const J=r.GetLineIDsWithType(0,R),ue=J.size();for(let Se=0;Se<ue;Se++){const He=J.get(Se),xe=r.GetLine(0,He);if(!xe||!xe.RelatingObject||!xe.RelatedObjects)continue;const Ye=xe.RelatingObject.value,pe=xe.RelatedObjects;for(const $e of pe){const lt=$e.value;t.has(lt)&&(this.itemsByFloor[lt]=Ye)}}const Ee={},Le=l.size();for(let Se=0;Se<Le;Se++){const He=l.get(Se),xe=r.GetLine(0,He);if(!xe||!xe.RelatingStructure||!xe.RelatedElements)continue;const Ye=xe.RelatingStructure.value,pe=xe.RelatedElements;if(t.has(Ye))for(const $e of pe){Ee[Ye]||(Ee[Ye]=[]);const lt=$e.value;Ee[Ye].push(lt)}else for(const $e of pe){const lt=$e.value;this.itemsByFloor[lt]=Ye}}for(const Se in Ee){const He=this.itemsByFloor[Se];if(He!==void 0){const xe=Ee[Se];for(const Ye of xe)this.itemsByFloor[Ye]=He}}for(let Se=0;Se<ue;Se++){const He=J.get(Se),xe=r.GetLine(0,He);if(!xe||!xe.RelatingObject||!xe.RelatedObjects)continue;const Ye=xe.RelatingObject.value,pe=xe.RelatedObjects;for(const $e of pe){const lt=$e.value,wt=this.itemsByFloor[Ye];wt!==void 0&&(this.itemsByFloor[lt]=wt)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}const kx=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 zx{async export(r,l,t=!1,W=!0){const J={},ue=new Set(r.GetIfcEntityList(l)),Ee=new Set([Fy,Ui,Oa,$i,pr]);for(const Le of Ee)ue.add(Le);for(const Le of ue){if(kx.has(Le))continue;const Se=Ee.has(Le)&&W,He=r.GetLineIDsWithType(l,Le);for(const xe of He){const Ye=r.GetLine(0,xe,Se,t);J[Ye.expressID]=Ye}}return J}}class Kx{constructor(){this.normal=[],this.position=[],this.instances=[],this.id=""}}class Qx{constructor(){this.id="",this.transform=[],this.material=new oM}}class oM{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 HU}}class HU{constructor(){this.Data={}}}class $x{constructor(){this.Data={},this.CameraData=new UU}}class BU{constructor(){this.Solids=[],this.Id="",this.Instances=[]}}class MU{constructor(){this.MaterialIndex=0,this.Vertices=[],this.Indices=[],this.Buffer=[]}}class p7{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 UU{constructor(){this.scale=0,this.origin=new p7,this.eyePosition=new p7,this.upDirection=new p7,this.forwardDirection=new p7,this.target=new p7,this.box=new xU}}class xU{constructor(){this.min=new p7,this.max=new p7}}const mH=class mH{constructor(){this._webIfc=new Ex,this.settings=new Rx,this._fragments=new Map,this._spatialTree=new qx,this._propertyExporter=new zx,this._materials=[],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(),W=new Uint8Array(t);return await this.load2(W)}async load2(r,l=!0){await this.readIfcFile(r);const t=await this.getAllGeometries2(),W=await this.getAllProperties();let J=new bU;return J.Elements=t.elements,t.material.forEach((ue,Ee)=>{let Le=new oM;Le.red=ue.x,Le.green=ue.y,Le.blue=ue.z,Le.opacity=ue.w,Le.name=Ee.toString(),J.Materials.push(Le)}),J.Data.Data=W,J}async readIfcFile(r){const{path:l,absolute:t,logLevel:W}=this.settings.wasm;return this._webIfc.SetWasmPath(l,t),await this._webIfc.Init(),W&&this._webIfc.SetLogLevel(W),this._webIfc.OpenModel(r,this.settings.webIfc)}async getAllGeometries2(){this._spatialTree.setUp(this._webIfc);const r=this._webIfc.GetIfcEntityList(0),l=[];for(const W of r){if(!this._webIfc.IsIfcElement(W)&&W!==pr)continue;const J=this.settings.includedCategories;if(J.size>0&&!J.has(W))continue;if(this.settings.excludedCategories.has(W))continue;const ue=this._webIfc.GetLineIDsWithType(0,W),Ee=ue.size();for(let Le=0;Le<Ee;Le++){const Se=ue.get(Le);l.push(Se),this._spatialTree.itemsByFloor[Se]}}this._spatialTree.cleanUp();let t=[];return this._webIfc.StreamMeshes(0,l,(W,J,ue)=>{let Ee=this.getMesh2(W);t.push(Ee)}),{elements:t,material:this._materials}}getMesh2(r){let l=new BU;const t=r.geometries.size(),W=r.expressID;l.Id=W.toString();for(let J=0;J<t;J++){let ue=new MU;const Ee=r.geometries.get(J),{x:Le,y:Se,z:He,w:xe}=Ee.color;let Ye=this._materials.findIndex(wt=>wt.x==Le&&wt.y==Se&&wt.z==He&&wt.w==xe);Ye<0&&(this._materials.push({x:Le,y:Se,z:He,w:xe}),Ye=this._materials.length-1),ue.MaterialIndex=Ye;const{geometryExpressID:pe}=Ee,$e=this.getGeometry(this._webIfc,pe);let lt=new Wy;lt.fromArray(Ee.flatTransformation);for(let wt=0;wt<$e.position.length;wt+=3){const Dt=$e.position[wt],hl=$e.position[wt+1],Kt=$e.position[wt+2],Yt=new kr(Dt,hl,Kt);Yt.applyMatrix4(lt);//!switch back to revit xyz, get revit axis is a standard for every format so we dont have to recode again.
39
+ */const PU="162",CU=300,gM=1e3,cH=1001,bM=1002,HM=1003,Dx=1006,Nx=1008,Ax=1009,Ox=1014,Sx=1020,Lx=1023,oB=1026,BM=1027,px="",mx=515,oH=2e3,MM=2001;class gU{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 W=this._listeners[r];if(W!==void 0){const J=W.indexOf(l);J!==-1&&W.splice(J,1)}}dispatchEvent(r){if(this._listeners===void 0)return;const t=this._listeners[r.type];if(t!==void 0){r.target=this;const W=t.slice(0);for(let J=0,ue=W.length;J<ue;J++)W[J].call(this,r);r.target=null}}}const Qo=["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 cM(){const e=Math.random()*4294967295|0,r=Math.random()*4294967295|0,l=Math.random()*4294967295|0,t=Math.random()*4294967295|0;return(Qo[e&255]+Qo[e>>8&255]+Qo[e>>16&255]+Qo[e>>24&255]+"-"+Qo[r&255]+Qo[r>>8&255]+"-"+Qo[r>>16&15|64]+Qo[r>>24&255]+"-"+Qo[l&63|128]+Qo[l>>8&255]+"-"+Qo[l>>16&255]+Qo[l>>24&255]+Qo[t&255]+Qo[t>>8&255]+Qo[t>>16&255]+Qo[t>>24&255]).toLowerCase()}function S7(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,W=r.elements;return this.x=W[0]*l+W[3]*t+W[6],this.y=W[1]*l+W[4]*t+W[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(S7(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),W=Math.sin(l),J=this.x-r.x,ue=this.y-r.y;return this.x=J*t-ue*W+r.x,this.y=J*W+ue*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,W,J,ue,Ee,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,W,J,ue,Ee,Le,Se)}set(r,l,t,W,J,ue,Ee,Le,Se){const He=this.elements;return He[0]=r,He[1]=W,He[2]=Ee,He[3]=l,He[4]=J,He[5]=Le,He[6]=t,He[7]=ue,He[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,W=l.elements,J=this.elements,ue=t[0],Ee=t[3],Le=t[6],Se=t[1],He=t[4],xe=t[7],Ye=t[2],pe=t[5],$e=t[8],lt=W[0],wt=W[3],Dt=W[6],hl=W[1],Kt=W[4],Yt=W[7],Al=W[2],pt=W[5],Pt=W[8];return J[0]=ue*lt+Ee*hl+Le*Al,J[3]=ue*wt+Ee*Kt+Le*pt,J[6]=ue*Dt+Ee*Yt+Le*Pt,J[1]=Se*lt+He*hl+xe*Al,J[4]=Se*wt+He*Kt+xe*pt,J[7]=Se*Dt+He*Yt+xe*Pt,J[2]=Ye*lt+pe*hl+$e*Al,J[5]=Ye*wt+pe*Kt+$e*pt,J[8]=Ye*Dt+pe*Yt+$e*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],W=r[2],J=r[3],ue=r[4],Ee=r[5],Le=r[6],Se=r[7],He=r[8];return l*ue*He-l*Ee*Se-t*J*He+t*Ee*Le+W*J*Se-W*ue*Le}invert(){const r=this.elements,l=r[0],t=r[1],W=r[2],J=r[3],ue=r[4],Ee=r[5],Le=r[6],Se=r[7],He=r[8],xe=He*ue-Ee*Se,Ye=Ee*Le-He*J,pe=Se*J-ue*Le,$e=l*xe+t*Ye+W*pe;if($e===0)return this.set(0,0,0,0,0,0,0,0,0);const lt=1/$e;return r[0]=xe*lt,r[1]=(W*Se-He*t)*lt,r[2]=(Ee*t-W*ue)*lt,r[3]=Ye*lt,r[4]=(He*l-W*Le)*lt,r[5]=(W*J-Ee*l)*lt,r[6]=pe*lt,r[7]=(t*Le-Se*l)*lt,r[8]=(ue*l-t*J)*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,W,J,ue,Ee){const Le=Math.cos(J),Se=Math.sin(J);return this.set(t*Le,t*Se,-t*(Le*ue+Se*Ee)+ue+r,-W*Se,W*Le,-W*(-Se*ue+Le*Ee)+Ee+l,0,0,1),this}scale(r,l){return this.premultiply(IB.makeScale(r,l)),this}rotate(r){return this.premultiply(IB.makeRotation(-r)),this}translate(r,l){return this.premultiply(IB.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 W=0;W<9;W++)if(l[W]!==t[W])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 IB=new Db;function UM(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function hB(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}let i9;class Px{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=UM("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=UM("canvas");l.width=r.width,l.height=r.height;const t=l.getContext("2d");t.drawImage(r,0,0,r.width,r.height);const W=t.getImageData(0,0,r.width,r.height),J=W.data;for(let ue=0;ue<J.length;ue++)J[ue]=hB(J[ue]/255)*255;return t.putImageData(W,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(hB(l[t]/255)*255):l[t]=hB(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 Cx=0;class gx{constructor(r=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Cx++}),this.uuid=cM(),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:""},W=this.data;if(W!==null){let J;if(Array.isArray(W)){J=[];for(let ue=0,Ee=W.length;ue<Ee;ue++)W[ue].isDataTexture?J.push(fB(W[ue].image)):J.push(fB(W[ue]))}else J=fB(W);t.url=J}return l||(r.images[this.uuid]=t),t}}function fB(e){return typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap?Px.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 bx=0;class p8 extends gU{constructor(r=p8.DEFAULT_IMAGE,l=p8.DEFAULT_MAPPING,t=cH,W=cH,J=Dx,ue=Nx,Ee=Lx,Le=Ax,Se=p8.DEFAULT_ANISOTROPY,He=px){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:bx++}),this.uuid=cM(),this.name="",this.source=new gx(r),this.mipmaps=[],this.mapping=l,this.channel=0,this.wrapS=t,this.wrapT=W,this.magFilter=J,this.minFilter=ue,this.anisotropy=Se,this.format=Ee,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=He,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!==CU)return r;if(r.applyMatrix3(this.matrix),r.x<0||r.x>1)switch(this.wrapS){case gM: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 gM: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=CU;p8.DEFAULT_ANISOTROPY=1;class Nb{constructor(r=0,l=0,t=0,W=1){this.isQuaternion=!0,this._x=r,this._y=l,this._z=t,this._w=W}static slerpFlat(r,l,t,W,J,ue,Ee){let Le=t[W+0],Se=t[W+1],He=t[W+2],xe=t[W+3];const Ye=J[ue+0],pe=J[ue+1],$e=J[ue+2],lt=J[ue+3];if(Ee===0){r[l+0]=Le,r[l+1]=Se,r[l+2]=He,r[l+3]=xe;return}if(Ee===1){r[l+0]=Ye,r[l+1]=pe,r[l+2]=$e,r[l+3]=lt;return}if(xe!==lt||Le!==Ye||Se!==pe||He!==$e){let wt=1-Ee;const Dt=Le*Ye+Se*pe+He*$e+xe*lt,hl=Dt>=0?1:-1,Kt=1-Dt*Dt;if(Kt>Number.EPSILON){const Al=Math.sqrt(Kt),pt=Math.atan2(Al,Dt*hl);wt=Math.sin(wt*pt)/Al,Ee=Math.sin(Ee*pt)/Al}const Yt=Ee*hl;if(Le=Le*wt+Ye*Yt,Se=Se*wt+pe*Yt,He=He*wt+$e*Yt,xe=xe*wt+lt*Yt,wt===1-Ee){const Al=1/Math.sqrt(Le*Le+Se*Se+He*He+xe*xe);Le*=Al,Se*=Al,He*=Al,xe*=Al}}r[l]=Le,r[l+1]=Se,r[l+2]=He,r[l+3]=xe}static multiplyQuaternionsFlat(r,l,t,W,J,ue){const Ee=t[W],Le=t[W+1],Se=t[W+2],He=t[W+3],xe=J[ue],Ye=J[ue+1],pe=J[ue+2],$e=J[ue+3];return r[l]=Ee*$e+He*xe+Le*pe-Se*Ye,r[l+1]=Le*$e+He*Ye+Se*xe-Ee*pe,r[l+2]=Se*$e+He*pe+Ee*Ye-Le*xe,r[l+3]=He*$e-Ee*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,W){return this._x=r,this._y=l,this._z=t,this._w=W,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,W=r._y,J=r._z,ue=r._order,Ee=Math.cos,Le=Math.sin,Se=Ee(t/2),He=Ee(W/2),xe=Ee(J/2),Ye=Le(t/2),pe=Le(W/2),$e=Le(J/2);switch(ue){case"XYZ":this._x=Ye*He*xe+Se*pe*$e,this._y=Se*pe*xe-Ye*He*$e,this._z=Se*He*$e+Ye*pe*xe,this._w=Se*He*xe-Ye*pe*$e;break;case"YXZ":this._x=Ye*He*xe+Se*pe*$e,this._y=Se*pe*xe-Ye*He*$e,this._z=Se*He*$e-Ye*pe*xe,this._w=Se*He*xe+Ye*pe*$e;break;case"ZXY":this._x=Ye*He*xe-Se*pe*$e,this._y=Se*pe*xe+Ye*He*$e,this._z=Se*He*$e+Ye*pe*xe,this._w=Se*He*xe-Ye*pe*$e;break;case"ZYX":this._x=Ye*He*xe-Se*pe*$e,this._y=Se*pe*xe+Ye*He*$e,this._z=Se*He*$e-Ye*pe*xe,this._w=Se*He*xe+Ye*pe*$e;break;case"YZX":this._x=Ye*He*xe+Se*pe*$e,this._y=Se*pe*xe+Ye*He*$e,this._z=Se*He*$e-Ye*pe*xe,this._w=Se*He*xe-Ye*pe*$e;break;case"XZY":this._x=Ye*He*xe-Se*pe*$e,this._y=Se*pe*xe-Ye*He*$e,this._z=Se*He*$e+Ye*pe*xe,this._w=Se*He*xe+Ye*pe*$e;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+ue)}return l===!0&&this._onChangeCallback(),this}setFromAxisAngle(r,l){const t=l/2,W=Math.sin(t);return this._x=r.x*W,this._y=r.y*W,this._z=r.z*W,this._w=Math.cos(t),this._onChangeCallback(),this}setFromRotationMatrix(r){const l=r.elements,t=l[0],W=l[4],J=l[8],ue=l[1],Ee=l[5],Le=l[9],Se=l[2],He=l[6],xe=l[10],Ye=t+Ee+xe;if(Ye>0){const pe=.5/Math.sqrt(Ye+1);this._w=.25/pe,this._x=(He-Le)*pe,this._y=(J-Se)*pe,this._z=(ue-W)*pe}else if(t>Ee&&t>xe){const pe=2*Math.sqrt(1+t-Ee-xe);this._w=(He-Le)/pe,this._x=.25*pe,this._y=(W+ue)/pe,this._z=(J+Se)/pe}else if(Ee>xe){const pe=2*Math.sqrt(1+Ee-t-xe);this._w=(J-Se)/pe,this._x=(W+ue)/pe,this._y=.25*pe,this._z=(Le+He)/pe}else{const pe=2*Math.sqrt(1+xe-t-Ee);this._w=(ue-W)/pe,this._x=(J+Se)/pe,this._y=(Le+He)/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(S7(this.dot(r),-1,1)))}rotateTowards(r,l){const t=this.angleTo(r);if(t===0)return this;const W=Math.min(1,l/t);return this.slerp(r,W),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,W=r._y,J=r._z,ue=r._w,Ee=l._x,Le=l._y,Se=l._z,He=l._w;return this._x=t*He+ue*Ee+W*Se-J*Le,this._y=W*He+ue*Le+J*Ee-t*Se,this._z=J*He+ue*Se+t*Le-W*Ee,this._w=ue*He-t*Ee-W*Le-J*Se,this._onChangeCallback(),this}slerp(r,l){if(l===0)return this;if(l===1)return this.copy(r);const t=this._x,W=this._y,J=this._z,ue=this._w;let Ee=ue*r._w+t*r._x+W*r._y+J*r._z;if(Ee<0?(this._w=-r._w,this._x=-r._x,this._y=-r._y,this._z=-r._z,Ee=-Ee):this.copy(r),Ee>=1)return this._w=ue,this._x=t,this._y=W,this._z=J,this;const Le=1-Ee*Ee;if(Le<=Number.EPSILON){const pe=1-l;return this._w=pe*ue+l*this._w,this._x=pe*t+l*this._x,this._y=pe*W+l*this._y,this._z=pe*J+l*this._z,this.normalize(),this}const Se=Math.sqrt(Le),He=Math.atan2(Se,Ee),xe=Math.sin((1-l)*He)/Se,Ye=Math.sin(l*He)/Se;return this._w=ue*xe+this._w*Ye,this._x=t*xe+this._x*Ye,this._y=W*xe+this._y*Ye,this._z=J*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(),W=Math.sqrt(1-t),J=Math.sqrt(t);return this.set(W*Math.sin(r),W*Math.cos(r),J*Math.sin(l),J*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(xM.setFromEuler(r))}applyAxisAngle(r,l){return this.applyQuaternion(xM.setFromAxisAngle(r,l))}applyMatrix3(r){const l=this.x,t=this.y,W=this.z,J=r.elements;return this.x=J[0]*l+J[3]*t+J[6]*W,this.y=J[1]*l+J[4]*t+J[7]*W,this.z=J[2]*l+J[5]*t+J[8]*W,this}applyNormalMatrix(r){return this.applyMatrix3(r).normalize()}applyMatrix4(r){const l=this.x,t=this.y,W=this.z,J=r.elements,ue=1/(J[3]*l+J[7]*t+J[11]*W+J[15]);return this.x=(J[0]*l+J[4]*t+J[8]*W+J[12])*ue,this.y=(J[1]*l+J[5]*t+J[9]*W+J[13])*ue,this.z=(J[2]*l+J[6]*t+J[10]*W+J[14])*ue,this}applyQuaternion(r){const l=this.x,t=this.y,W=this.z,J=r.x,ue=r.y,Ee=r.z,Le=r.w,Se=2*(ue*W-Ee*t),He=2*(Ee*l-J*W),xe=2*(J*t-ue*l);return this.x=l+Le*Se+ue*xe-Ee*He,this.y=t+Le*He+Ee*Se-J*xe,this.z=W+Le*xe+J*He-ue*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,W=this.z,J=r.elements;return this.x=J[0]*l+J[4]*t+J[8]*W,this.y=J[1]*l+J[5]*t+J[9]*W,this.z=J[2]*l+J[6]*t+J[10]*W,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,W=r.y,J=r.z,ue=l.x,Ee=l.y,Le=l.z;return this.x=W*Le-J*Ee,this.y=J*ue-t*Le,this.z=t*Ee-W*ue,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 dB.copy(this).projectOnVector(r),this.sub(dB)}reflect(r){return this.sub(dB.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(S7(t,-1,1))}distanceTo(r){return Math.sqrt(this.distanceToSquared(r))}distanceToSquared(r){const l=this.x-r.x,t=this.y-r.y,W=this.z-r.z;return l*l+t*t+W*W}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 W=Math.sin(l)*r;return this.x=W*Math.sin(t),this.y=Math.cos(l)*r,this.z=W*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(),W=this.setFromMatrixColumn(r,2).length();return this.x=l,this.y=t,this.z=W,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 dB=new kr,xM=new Nb;class Wy{constructor(r,l,t,W,J,ue,Ee,Le,Se,He,xe,Ye,pe,$e,lt,wt){Wy.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,W,J,ue,Ee,Le,Se,He,xe,Ye,pe,$e,lt,wt)}set(r,l,t,W,J,ue,Ee,Le,Se,He,xe,Ye,pe,$e,lt,wt){const Dt=this.elements;return Dt[0]=r,Dt[4]=l,Dt[8]=t,Dt[12]=W,Dt[1]=J,Dt[5]=ue,Dt[9]=Ee,Dt[13]=Le,Dt[2]=Se,Dt[6]=He,Dt[10]=xe,Dt[14]=Ye,Dt[3]=pe,Dt[7]=$e,Dt[11]=lt,Dt[15]=wt,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 Wy().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,W=1/c9.setFromMatrixColumn(r,0).length(),J=1/c9.setFromMatrixColumn(r,1).length(),ue=1/c9.setFromMatrixColumn(r,2).length();return l[0]=t[0]*W,l[1]=t[1]*W,l[2]=t[2]*W,l[3]=0,l[4]=t[4]*J,l[5]=t[5]*J,l[6]=t[6]*J,l[7]=0,l[8]=t[8]*ue,l[9]=t[9]*ue,l[10]=t[10]*ue,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,W=r.y,J=r.z,ue=Math.cos(t),Ee=Math.sin(t),Le=Math.cos(W),Se=Math.sin(W),He=Math.cos(J),xe=Math.sin(J);if(r.order==="XYZ"){const Ye=ue*He,pe=ue*xe,$e=Ee*He,lt=Ee*xe;l[0]=Le*He,l[4]=-Le*xe,l[8]=Se,l[1]=pe+$e*Se,l[5]=Ye-lt*Se,l[9]=-Ee*Le,l[2]=lt-Ye*Se,l[6]=$e+pe*Se,l[10]=ue*Le}else if(r.order==="YXZ"){const Ye=Le*He,pe=Le*xe,$e=Se*He,lt=Se*xe;l[0]=Ye+lt*Ee,l[4]=$e*Ee-pe,l[8]=ue*Se,l[1]=ue*xe,l[5]=ue*He,l[9]=-Ee,l[2]=pe*Ee-$e,l[6]=lt+Ye*Ee,l[10]=ue*Le}else if(r.order==="ZXY"){const Ye=Le*He,pe=Le*xe,$e=Se*He,lt=Se*xe;l[0]=Ye-lt*Ee,l[4]=-ue*xe,l[8]=$e+pe*Ee,l[1]=pe+$e*Ee,l[5]=ue*He,l[9]=lt-Ye*Ee,l[2]=-ue*Se,l[6]=Ee,l[10]=ue*Le}else if(r.order==="ZYX"){const Ye=ue*He,pe=ue*xe,$e=Ee*He,lt=Ee*xe;l[0]=Le*He,l[4]=$e*Se-pe,l[8]=Ye*Se+lt,l[1]=Le*xe,l[5]=lt*Se+Ye,l[9]=pe*Se-$e,l[2]=-Se,l[6]=Ee*Le,l[10]=ue*Le}else if(r.order==="YZX"){const Ye=ue*Le,pe=ue*Se,$e=Ee*Le,lt=Ee*Se;l[0]=Le*He,l[4]=lt-Ye*xe,l[8]=$e*xe+pe,l[1]=xe,l[5]=ue*He,l[9]=-Ee*He,l[2]=-Se*He,l[6]=pe*xe+$e,l[10]=Ye-lt*xe}else if(r.order==="XZY"){const Ye=ue*Le,pe=ue*Se,$e=Ee*Le,lt=Ee*Se;l[0]=Le*He,l[4]=-xe,l[8]=Se*He,l[1]=Ye*xe+lt,l[5]=ue*He,l[9]=pe*xe-$e,l[2]=$e*xe-pe,l[6]=Ee*He,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(Hx,r,Bx)}lookAt(r,l,t){const W=this.elements;return Jf.subVectors(r,l),Jf.lengthSq()===0&&(Jf.z=1),Jf.normalize(),FD.crossVectors(t,Jf),FD.lengthSq()===0&&(Math.abs(t.z)===1?Jf.x+=1e-4:Jf.z+=1e-4,Jf.normalize(),FD.crossVectors(t,Jf)),FD.normalize(),IH.crossVectors(Jf,FD),W[0]=FD.x,W[4]=IH.x,W[8]=Jf.x,W[1]=FD.y,W[5]=IH.y,W[9]=Jf.y,W[2]=FD.z,W[6]=IH.z,W[10]=Jf.z,this}multiply(r){return this.multiplyMatrices(this,r)}premultiply(r){return this.multiplyMatrices(r,this)}multiplyMatrices(r,l){const t=r.elements,W=l.elements,J=this.elements,ue=t[0],Ee=t[4],Le=t[8],Se=t[12],He=t[1],xe=t[5],Ye=t[9],pe=t[13],$e=t[2],lt=t[6],wt=t[10],Dt=t[14],hl=t[3],Kt=t[7],Yt=t[11],Al=t[15],pt=W[0],Pt=W[4],bs=W[8],_n=W[12],Et=W[1],xt=W[5],Pr=W[9],ls=W[13],fs=W[2],La=W[6],Bl=W[10],ul=W[14],Zc=W[3],ec=W[7],Cr=W[11],Jc=W[15];return J[0]=ue*pt+Ee*Et+Le*fs+Se*Zc,J[4]=ue*Pt+Ee*xt+Le*La+Se*ec,J[8]=ue*bs+Ee*Pr+Le*Bl+Se*Cr,J[12]=ue*_n+Ee*ls+Le*ul+Se*Jc,J[1]=He*pt+xe*Et+Ye*fs+pe*Zc,J[5]=He*Pt+xe*xt+Ye*La+pe*ec,J[9]=He*bs+xe*Pr+Ye*Bl+pe*Cr,J[13]=He*_n+xe*ls+Ye*ul+pe*Jc,J[2]=$e*pt+lt*Et+wt*fs+Dt*Zc,J[6]=$e*Pt+lt*xt+wt*La+Dt*ec,J[10]=$e*bs+lt*Pr+wt*Bl+Dt*Cr,J[14]=$e*_n+lt*ls+wt*ul+Dt*Jc,J[3]=hl*pt+Kt*Et+Yt*fs+Al*Zc,J[7]=hl*Pt+Kt*xt+Yt*La+Al*ec,J[11]=hl*bs+Kt*Pr+Yt*Bl+Al*Cr,J[15]=hl*_n+Kt*ls+Yt*ul+Al*Jc,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],W=r[8],J=r[12],ue=r[1],Ee=r[5],Le=r[9],Se=r[13],He=r[2],xe=r[6],Ye=r[10],pe=r[14],$e=r[3],lt=r[7],wt=r[11],Dt=r[15];return $e*(+J*Le*xe-W*Se*xe-J*Ee*Ye+t*Se*Ye+W*Ee*pe-t*Le*pe)+lt*(+l*Le*pe-l*Se*Ye+J*ue*Ye-W*ue*pe+W*Se*He-J*Le*He)+wt*(+l*Se*xe-l*Ee*pe-J*ue*xe+t*ue*pe+J*Ee*He-t*Se*He)+Dt*(-W*Ee*He-l*Le*xe+l*Ee*Ye+W*ue*xe-t*ue*Ye+t*Le*He)}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 W=this.elements;return r.isVector3?(W[12]=r.x,W[13]=r.y,W[14]=r.z):(W[12]=r,W[13]=l,W[14]=t),this}invert(){const r=this.elements,l=r[0],t=r[1],W=r[2],J=r[3],ue=r[4],Ee=r[5],Le=r[6],Se=r[7],He=r[8],xe=r[9],Ye=r[10],pe=r[11],$e=r[12],lt=r[13],wt=r[14],Dt=r[15],hl=xe*wt*Se-lt*Ye*Se+lt*Le*pe-Ee*wt*pe-xe*Le*Dt+Ee*Ye*Dt,Kt=$e*Ye*Se-He*wt*Se-$e*Le*pe+ue*wt*pe+He*Le*Dt-ue*Ye*Dt,Yt=He*lt*Se-$e*xe*Se+$e*Ee*pe-ue*lt*pe-He*Ee*Dt+ue*xe*Dt,Al=$e*xe*Le-He*lt*Le-$e*Ee*Ye+ue*lt*Ye+He*Ee*wt-ue*xe*wt,pt=l*hl+t*Kt+W*Yt+J*Al;if(pt===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const Pt=1/pt;return r[0]=hl*Pt,r[1]=(lt*Ye*J-xe*wt*J-lt*W*pe+t*wt*pe+xe*W*Dt-t*Ye*Dt)*Pt,r[2]=(Ee*wt*J-lt*Le*J+lt*W*Se-t*wt*Se-Ee*W*Dt+t*Le*Dt)*Pt,r[3]=(xe*Le*J-Ee*Ye*J-xe*W*Se+t*Ye*Se+Ee*W*pe-t*Le*pe)*Pt,r[4]=Kt*Pt,r[5]=(He*wt*J-$e*Ye*J+$e*W*pe-l*wt*pe-He*W*Dt+l*Ye*Dt)*Pt,r[6]=($e*Le*J-ue*wt*J-$e*W*Se+l*wt*Se+ue*W*Dt-l*Le*Dt)*Pt,r[7]=(ue*Ye*J-He*Le*J+He*W*Se-l*Ye*Se-ue*W*pe+l*Le*pe)*Pt,r[8]=Yt*Pt,r[9]=($e*xe*J-He*lt*J-$e*t*pe+l*lt*pe+He*t*Dt-l*xe*Dt)*Pt,r[10]=(ue*lt*J-$e*Ee*J+$e*t*Se-l*lt*Se-ue*t*Dt+l*Ee*Dt)*Pt,r[11]=(He*Ee*J-ue*xe*J-He*t*Se+l*xe*Se+ue*t*pe-l*Ee*pe)*Pt,r[12]=Al*Pt,r[13]=(He*lt*W-$e*xe*W+$e*t*Ye-l*lt*Ye-He*t*wt+l*xe*wt)*Pt,r[14]=($e*Ee*W-ue*lt*W-$e*t*Le+l*lt*Le+ue*t*wt-l*Ee*wt)*Pt,r[15]=(ue*xe*W-He*Ee*W+He*t*Le-l*xe*Le-ue*t*Ye+l*Ee*Ye)*Pt,this}scale(r){const l=this.elements,t=r.x,W=r.y,J=r.z;return l[0]*=t,l[4]*=W,l[8]*=J,l[1]*=t,l[5]*=W,l[9]*=J,l[2]*=t,l[6]*=W,l[10]*=J,l[3]*=t,l[7]*=W,l[11]*=J,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],W=r[8]*r[8]+r[9]*r[9]+r[10]*r[10];return Math.sqrt(Math.max(l,t,W))}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),W=Math.sin(l),J=1-t,ue=r.x,Ee=r.y,Le=r.z,Se=J*ue,He=J*Ee;return this.set(Se*ue+t,Se*Ee-W*Le,Se*Le+W*Ee,0,Se*Ee+W*Le,He*Ee+t,He*Le-W*ue,0,Se*Le-W*Ee,He*Le+W*ue,J*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,W,J,ue){return this.set(1,t,J,0,r,1,ue,0,l,W,1,0,0,0,0,1),this}compose(r,l,t){const W=this.elements,J=l._x,ue=l._y,Ee=l._z,Le=l._w,Se=J+J,He=ue+ue,xe=Ee+Ee,Ye=J*Se,pe=J*He,$e=J*xe,lt=ue*He,wt=ue*xe,Dt=Ee*xe,hl=Le*Se,Kt=Le*He,Yt=Le*xe,Al=t.x,pt=t.y,Pt=t.z;return W[0]=(1-(lt+Dt))*Al,W[1]=(pe+Yt)*Al,W[2]=($e-Kt)*Al,W[3]=0,W[4]=(pe-Yt)*pt,W[5]=(1-(Ye+Dt))*pt,W[6]=(wt+hl)*pt,W[7]=0,W[8]=($e+Kt)*Pt,W[9]=(wt-hl)*Pt,W[10]=(1-(Ye+lt))*Pt,W[11]=0,W[12]=r.x,W[13]=r.y,W[14]=r.z,W[15]=1,this}decompose(r,l,t){const W=this.elements;let J=c9.set(W[0],W[1],W[2]).length();const ue=c9.set(W[4],W[5],W[6]).length(),Ee=c9.set(W[8],W[9],W[10]).length();this.determinant()<0&&(J=-J),r.x=W[12],r.y=W[13],r.z=W[14],py.copy(this);const Se=1/J,He=1/ue,xe=1/Ee;return py.elements[0]*=Se,py.elements[1]*=Se,py.elements[2]*=Se,py.elements[4]*=He,py.elements[5]*=He,py.elements[6]*=He,py.elements[8]*=xe,py.elements[9]*=xe,py.elements[10]*=xe,l.setFromRotationMatrix(py),t.x=J,t.y=ue,t.z=Ee,this}makePerspective(r,l,t,W,J,ue,Ee=oH){const Le=this.elements,Se=2*J/(l-r),He=2*J/(t-W),xe=(l+r)/(l-r),Ye=(t+W)/(t-W);let pe,$e;if(Ee===oH)pe=-(ue+J)/(ue-J),$e=-2*ue*J/(ue-J);else if(Ee===MM)pe=-ue/(ue-J),$e=-ue*J/(ue-J);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+Ee);return Le[0]=Se,Le[4]=0,Le[8]=xe,Le[12]=0,Le[1]=0,Le[5]=He,Le[9]=Ye,Le[13]=0,Le[2]=0,Le[6]=0,Le[10]=pe,Le[14]=$e,Le[3]=0,Le[7]=0,Le[11]=-1,Le[15]=0,this}makeOrthographic(r,l,t,W,J,ue,Ee=oH){const Le=this.elements,Se=1/(l-r),He=1/(t-W),xe=1/(ue-J),Ye=(l+r)*Se,pe=(t+W)*He;let $e,lt;if(Ee===oH)$e=(ue+J)*xe,lt=-2*xe;else if(Ee===MM)$e=J*xe,lt=-1*xe;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+Ee);return Le[0]=2*Se,Le[4]=0,Le[8]=0,Le[12]=-Ye,Le[1]=0,Le[5]=2*He,Le[9]=0,Le[13]=-pe,Le[2]=0,Le[6]=0,Le[10]=lt,Le[14]=-$e,Le[3]=0,Le[7]=0,Le[11]=0,Le[15]=1,this}equals(r){const l=this.elements,t=r.elements;for(let W=0;W<16;W++)if(l[W]!==t[W])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 Wy,Hx=new kr(0,0,0),Bx=new kr(1,1,1),FD=new kr,IH=new kr,Jf=new kr,GM=new Wy,FM=new Nb;class HH{constructor(r=0,l=0,t=0,W=HH.DEFAULT_ORDER){this.isEuler=!0,this._x=r,this._y=l,this._z=t,this._order=W}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,W=this._order){return this._x=r,this._y=l,this._z=t,this._order=W,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 W=r.elements,J=W[0],ue=W[4],Ee=W[8],Le=W[1],Se=W[5],He=W[9],xe=W[2],Ye=W[6],pe=W[10];switch(l){case"XYZ":this._y=Math.asin(S7(Ee,-1,1)),Math.abs(Ee)<.9999999?(this._x=Math.atan2(-He,pe),this._z=Math.atan2(-ue,J)):(this._x=Math.atan2(Ye,Se),this._z=0);break;case"YXZ":this._x=Math.asin(-S7(He,-1,1)),Math.abs(He)<.9999999?(this._y=Math.atan2(Ee,pe),this._z=Math.atan2(Le,Se)):(this._y=Math.atan2(-xe,J),this._z=0);break;case"ZXY":this._x=Math.asin(S7(Ye,-1,1)),Math.abs(Ye)<.9999999?(this._y=Math.atan2(-xe,pe),this._z=Math.atan2(-ue,Se)):(this._y=0,this._z=Math.atan2(Le,J));break;case"ZYX":this._y=Math.asin(-S7(xe,-1,1)),Math.abs(xe)<.9999999?(this._x=Math.atan2(Ye,pe),this._z=Math.atan2(Le,J)):(this._x=0,this._z=Math.atan2(-ue,Se));break;case"YZX":this._z=Math.asin(S7(Le,-1,1)),Math.abs(Le)<.9999999?(this._x=Math.atan2(-He,Se),this._y=Math.atan2(-xe,J)):(this._x=0,this._y=Math.atan2(Ee,pe));break;case"XZY":this._z=Math.asin(-S7(ue,-1,1)),Math.abs(ue)<.9999999?(this._x=Math.atan2(Ye,Se),this._y=Math.atan2(Ee,J)):(this._x=Math.atan2(-He,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 GM.makeRotationFromQuaternion(r),this.setFromRotationMatrix(GM,l,t)}setFromVector3(r,l=this._order){return this.set(r.x,r.y,r.z,l)}reorder(r){return FM.setFromEuler(this),this.setFromQuaternion(FM,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 Mx{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 Ux=0;const VM=new kr,o9=new Nb,O7=new Wy,hH=new kr,_g=new kr,xx=new kr,Gx=new Nb,WM=new kr(1,0,0),jM=new kr(0,1,0),YM=new kr(0,0,1),Fx={type:"added"},Vx={type:"removed"},yB={type:"childadded",child:null},wB={type:"childremoved",child:null};class AO extends gU{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Ux++}),this.uuid=cM(),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,W=new kr(1,1,1);function J(){t.setFromEuler(l,!1)}function ue(){l.setFromQuaternion(t,void 0,!1)}l._onChange(J),t._onChange(ue),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:W},modelViewMatrix:{value:new Wy},normalMatrix:{value:new Db}}),this.matrix=new Wy,this.matrixWorld=new Wy,this.matrixAutoUpdate=AO.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=AO.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Mx,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(WM,r)}rotateY(r){return this.rotateOnAxis(jM,r)}rotateZ(r){return this.rotateOnAxis(YM,r)}translateOnAxis(r,l){return VM.copy(r).applyQuaternion(this.quaternion),this.position.add(VM.multiplyScalar(l)),this}translateX(r){return this.translateOnAxis(WM,r)}translateY(r){return this.translateOnAxis(jM,r)}translateZ(r){return this.translateOnAxis(YM,r)}localToWorld(r){return this.updateWorldMatrix(!0,!1),r.applyMatrix4(this.matrixWorld)}worldToLocal(r){return this.updateWorldMatrix(!0,!1),r.applyMatrix4(O7.copy(this.matrixWorld).invert())}lookAt(r,l,t){r.isVector3?hH.copy(r):hH.set(r,l,t);const W=this.parent;this.updateWorldMatrix(!0,!1),_g.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?O7.lookAt(_g,hH,this.up):O7.lookAt(hH,_g,this.up),this.quaternion.setFromRotationMatrix(O7),W&&(O7.extractRotation(W.matrixWorld),o9.setFromRotationMatrix(O7),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(Fx),yB.child=r,this.dispatchEvent(yB),yB.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(Vx),wB.child=r,this.dispatchEvent(wB),wB.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),O7.copy(this.matrixWorld).invert(),r.parent!==null&&(r.parent.updateWorldMatrix(!0,!1),O7.multiply(r.parent.matrixWorld)),r.applyMatrix4(O7),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,W=this.children.length;t<W;t++){const ue=this.children[t].getObjectByProperty(r,l);if(ue!==void 0)return ue}}getObjectsByProperty(r,l,t=[]){this[r]===l&&t.push(this);const W=this.children;for(let J=0,ue=W.length;J<ue;J++)W[J].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,xx),r}getWorldScale(r){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_g,Gx,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,W=l.length;t<W;t++)l[t].traverse(r)}traverseVisible(r){if(this.visible===!1)return;r(this);const l=this.children;for(let t=0,W=l.length;t<W;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,W=l.length;t<W;t++){const J=l[t];(J.matrixWorldAutoUpdate===!0||r===!0)&&J.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 W=this.children;for(let J=0,ue=W.length;J<ue;J++){const Ee=W[J];Ee.matrixWorldAutoUpdate===!0&&Ee.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 W={};W.uuid=this.uuid,W.type=this.type,this.name!==""&&(W.name=this.name),this.castShadow===!0&&(W.castShadow=!0),this.receiveShadow===!0&&(W.receiveShadow=!0),this.visible===!1&&(W.visible=!1),this.frustumCulled===!1&&(W.frustumCulled=!1),this.renderOrder!==0&&(W.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(W.userData=this.userData),W.layers=this.layers.mask,W.matrix=this.matrix.toArray(),W.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(W.matrixAutoUpdate=!1),this.isInstancedMesh&&(W.type="InstancedMesh",W.count=this.count,W.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(W.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(W.type="BatchedMesh",W.perObjectFrustumCulled=this.perObjectFrustumCulled,W.sortObjects=this.sortObjects,W.drawRanges=this._drawRanges,W.reservedRanges=this._reservedRanges,W.visibility=this._visibility,W.active=this._active,W.bounds=this._bounds.map(Ee=>({boxInitialized:Ee.boxInitialized,boxMin:Ee.box.min.toArray(),boxMax:Ee.box.max.toArray(),sphereInitialized:Ee.sphereInitialized,sphereRadius:Ee.sphere.radius,sphereCenter:Ee.sphere.center.toArray()})),W.maxGeometryCount=this._maxGeometryCount,W.maxVertexCount=this._maxVertexCount,W.maxIndexCount=this._maxIndexCount,W.geometryInitialized=this._geometryInitialized,W.geometryCount=this._geometryCount,W.matricesTexture=this._matricesTexture.toJSON(r),this.boundingSphere!==null&&(W.boundingSphere={center:W.boundingSphere.center.toArray(),radius:W.boundingSphere.radius}),this.boundingBox!==null&&(W.boundingBox={min:W.boundingBox.min.toArray(),max:W.boundingBox.max.toArray()}));function J(Ee,Le){return Ee[Le.uuid]===void 0&&(Ee[Le.uuid]=Le.toJSON(r)),Le.uuid}if(this.isScene)this.background&&(this.background.isColor?W.background=this.background.toJSON():this.background.isTexture&&(W.background=this.background.toJSON(r).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(W.environment=this.environment.toJSON(r).uuid);else if(this.isMesh||this.isLine||this.isPoints){W.geometry=J(r.geometries,this.geometry);const Ee=this.geometry.parameters;if(Ee!==void 0&&Ee.shapes!==void 0){const Le=Ee.shapes;if(Array.isArray(Le))for(let Se=0,He=Le.length;Se<He;Se++){const xe=Le[Se];J(r.shapes,xe)}else J(r.shapes,Le)}}if(this.isSkinnedMesh&&(W.bindMode=this.bindMode,W.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(J(r.skeletons,this.skeleton),W.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const Ee=[];for(let Le=0,Se=this.material.length;Le<Se;Le++)Ee.push(J(r.materials,this.material[Le]));W.material=Ee}else W.material=J(r.materials,this.material);if(this.children.length>0){W.children=[];for(let Ee=0;Ee<this.children.length;Ee++)W.children.push(this.children[Ee].toJSON(r).object)}if(this.animations.length>0){W.animations=[];for(let Ee=0;Ee<this.animations.length;Ee++){const Le=this.animations[Ee];W.animations.push(J(r.animations,Le))}}if(l){const Ee=ue(r.geometries),Le=ue(r.materials),Se=ue(r.textures),He=ue(r.images),xe=ue(r.shapes),Ye=ue(r.skeletons),pe=ue(r.animations),$e=ue(r.nodes);Ee.length>0&&(t.geometries=Ee),Le.length>0&&(t.materials=Le),Se.length>0&&(t.textures=Se),He.length>0&&(t.images=He),xe.length>0&&(t.shapes=xe),Ye.length>0&&(t.skeletons=Ye),pe.length>0&&(t.animations=pe),$e.length>0&&(t.nodes=$e)}return t.object=W,t;function ue(Ee){const Le=[];for(const Se in Ee){const He=Ee[Se];delete He.metadata,Le.push(He)}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 W=r.children[t];this.add(W.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 Wx extends p8{constructor(r,l,t,W,J,ue,Ee,Le,Se,He){if(He=He!==void 0?He:oB,He!==oB&&He!==BM)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");t===void 0&&He===oB&&(t=Ox),t===void 0&&He===BM&&(t=Sx),super(null,W,J,ue,Ee,Le,He,t,Se),this.isDepthTexture=!0,this.image={width:r,height:l},this.magFilter=Ee!==void 0?Ee:HM,this.minFilter=Le!==void 0?Le:HM,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 jx=new Wx(1,1);jx.compareFunction=mx;typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:PU}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=PU);class Yx{constructor(){this.factor=1,this.complement=1}apply(r){const t=this.getScaleMatrix().multiply(r);r.copy(t)}setUp(r){var J;this.factor=1;const l=this.getLengthUnits(r);if(!l)return;const t=l==null,W=l.Name===void 0||l.Name===null;t||W||(l.Name.value==="FOOT"?this.factor=.3048:((J=l.Prefix)==null?void 0:J.value)==="MILLI"&&(this.complement=.001))}getLengthUnits(r){try{const t=r.GetLineIDsWithType(0,ex).get(0),W=r.GetLine(0,t);for(const J of W.Units){if(!J||J.value===null||J.value===void 0)continue;const ue=r.GetLine(0,J.value);if(ue.UnitType&&ue.UnitType.value==="LENGTHUNIT")return ue}return null}catch{return console.log("Could not get units"),null}}getScaleMatrix(){const r=this.factor;return new Wy().fromArray([r,0,0,0,0,r,0,0,0,0,r,0,0,0,0,1])}}class qx{constructor(){this.itemsByFloor={},this._units=new Yx}setUp(r){this._units.setUp(r),this.cleanUp();try{const l=r.GetLineIDsWithType(0,fe),t=new Set,W=r.GetLineIDsWithType(0,pr);for(let Se=0;Se<W.size();Se++)t.add(W.get(Se));const J=r.GetLineIDsWithType(0,R),ue=J.size();for(let Se=0;Se<ue;Se++){const He=J.get(Se),xe=r.GetLine(0,He);if(!xe||!xe.RelatingObject||!xe.RelatedObjects)continue;const Ye=xe.RelatingObject.value,pe=xe.RelatedObjects;for(const $e of pe){const lt=$e.value;t.has(lt)&&(this.itemsByFloor[lt]=Ye)}}const Ee={},Le=l.size();for(let Se=0;Se<Le;Se++){const He=l.get(Se),xe=r.GetLine(0,He);if(!xe||!xe.RelatingStructure||!xe.RelatedElements)continue;const Ye=xe.RelatingStructure.value,pe=xe.RelatedElements;if(t.has(Ye))for(const $e of pe){Ee[Ye]||(Ee[Ye]=[]);const lt=$e.value;Ee[Ye].push(lt)}else for(const $e of pe){const lt=$e.value;this.itemsByFloor[lt]=Ye}}for(const Se in Ee){const He=this.itemsByFloor[Se];if(He!==void 0){const xe=Ee[Se];for(const Ye of xe)this.itemsByFloor[Ye]=He}}for(let Se=0;Se<ue;Se++){const He=J.get(Se),xe=r.GetLine(0,He);if(!xe||!xe.RelatingObject||!xe.RelatedObjects)continue;const Ye=xe.RelatingObject.value,pe=xe.RelatedObjects;for(const $e of pe){const lt=$e.value,wt=this.itemsByFloor[Ye];wt!==void 0&&(this.itemsByFloor[lt]=wt)}}}catch{console.log("Could not get floors.")}}cleanUp(){this.itemsByFloor={}}}const kx=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 zx{async export(r,l,t=!1,W=!0){const J={},ue=new Set(r.GetIfcEntityList(l)),Ee=new Set([Fy,Ui,Oa,$i,pr]);for(const Le of Ee)ue.add(Le);for(const Le of ue){if(kx.has(Le))continue;const Se=Ee.has(Le)&&W,He=r.GetLineIDsWithType(l,Le);for(const xe of He){const Ye=r.GetLine(0,xe,Se,t);J[Ye.expressID]=Ye}}return J}}class Kx{constructor(){this.normal=[],this.position=[],this.instances=[],this.id=""}}class Qx{constructor(){this.id="",this.transform=[],this.material=new oM}}class oM{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 HU}}class HU{constructor(){this.Data={}}}class $x{constructor(){this.Data={},this.CameraData=new UU}}class BU{constructor(){this.Solids=[],this.Id="",this.Instances=[]}}class MU{constructor(){this.MaterialIndex=0,this.Vertices=[],this.Indices=[],this.Buffer=[]}}class p7{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 UU{constructor(){this.scale=0,this.origin=new p7,this.eyePosition=new p7,this.upDirection=new p7,this.forwardDirection=new p7,this.target=new p7,this.box=new xU}}class xU{constructor(){this.min=new p7,this.max=new p7}}const mH=class mH{constructor(){this._webIfc=new Ex,this.settings=new Rx,this._fragments=new Map,this._spatialTree=new qx,this._propertyExporter=new zx,this._materials=[],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(),W=new Uint8Array(t);return await this.load2(W)}async load2(r,l=!0){await this.readIfcFile(r);const t=await this.getAllGeometries2(),W=await this.getAllProperties();let J=new bU;return J.Elements=t.elements,t.material.forEach((ue,Ee)=>{let Le=new oM;Le.red=Math.round(ue.x*255),Le.green=Math.round(ue.y*255),Le.blue=Math.round(ue.z*255),Le.opacity=ue.w,Le.name=Ee.toString(),J.Materials.push(Le)}),J.Data.Data=W,J}async readIfcFile(r){const{path:l,absolute:t,logLevel:W}=this.settings.wasm;return this._webIfc.SetWasmPath(l,t),await this._webIfc.Init(),W&&this._webIfc.SetLogLevel(W),this._webIfc.OpenModel(r,this.settings.webIfc)}async getAllGeometries2(){this._spatialTree.setUp(this._webIfc);const r=this._webIfc.GetIfcEntityList(0),l=[];for(const W of r){if(!this._webIfc.IsIfcElement(W)&&W!==pr)continue;const J=this.settings.includedCategories;if(J.size>0&&!J.has(W))continue;if(this.settings.excludedCategories.has(W))continue;const ue=this._webIfc.GetLineIDsWithType(0,W),Ee=ue.size();for(let Le=0;Le<Ee;Le++){const Se=ue.get(Le);l.push(Se),this._spatialTree.itemsByFloor[Se]}}this._spatialTree.cleanUp();let t=[];return this._webIfc.StreamMeshes(0,l,(W,J,ue)=>{let Ee=this.getMesh2(W);t.push(Ee)}),{elements:t,material:this._materials}}getMesh2(r){let l=new BU;const t=r.geometries.size(),W=r.expressID;l.Id=W.toString();for(let J=0;J<t;J++){let ue=new MU;const Ee=r.geometries.get(J),{x:Le,y:Se,z:He,w:xe}=Ee.color;let Ye=this._materials.findIndex(wt=>wt.x==Le&&wt.y==Se&&wt.z==He&&wt.w==xe);Ye<0&&(this._materials.push({x:Le,y:Se,z:He,w:xe}),Ye=this._materials.length-1),ue.MaterialIndex=Ye;const{geometryExpressID:pe}=Ee,$e=this.getGeometry(this._webIfc,pe);let lt=new Wy;lt.fromArray(Ee.flatTransformation);for(let wt=0;wt<$e.position.length;wt+=3){const Dt=$e.position[wt],hl=$e.position[wt+1],Kt=$e.position[wt+2],Yt=new kr(Dt,hl,Kt);Yt.applyMatrix4(lt);//!switch back to revit xyz, get revit axis is a standard for every format so we dont have to recode again.
40
40
  ue.Vertices.push(new p7(-Yt.x,Yt.z,Yt.y))}ue.Indices=$e.index,l.Solids.push(ue)}return l}getGeometry(r,l){const t=r.GetGeometry(0,l),W=r.GetIndexArray(t.GetIndexData(),t.GetIndexDataSize()),J=r.GetVertexArray(t.GetVertexData(),t.GetVertexDataSize()),ue=new Float32Array(J.length/2),Ee=new Float32Array(J.length/2);for(let Le=0;Le<J.length;Le+=6)ue[Le/2]=J[Le],ue[Le/2+1]=J[Le+1],ue[Le/2+2]=J[Le+2],Ee[Le/2]=J[Le+3],Ee[Le/2+1]=J[Le+4],Ee[Le/2+2]=J[Le+5];return t.delete(),{position:ue,normal:Ee,index:Array.from(W)}}async getAllProperties(){return await this._propertyExporter.export(this._webIfc,0)}async getWorldCoordinationMatrix(){return this._webIfc.GetCoordinationMatrix(0)}async _dispose(){this._fragments.clear(),this._materials=[]}};mH.release="2.3.8";let TB=mH;exports.Fragment=Kx;exports.FragmentInstance=Qx;exports.IFCReader=TB;exports.RenderMaterial=oM;exports.ViralPoint=p7;exports.ViralutionBox=xU;exports.ViralutionCamera=UU;exports.ViralutionElement=BU;exports.ViralutionIFCModel=bU;exports.ViralutionInformation=HU;exports.ViralutionSolid=MU;exports.ViralutionTrackingModel=$x;
package/dist/index.js CHANGED
@@ -40162,7 +40162,7 @@ const mH = class mH {
40162
40162
  let J = new Wx();
40163
40163
  return J.Elements = t.elements, t.material.forEach((ue, Ee) => {
40164
40164
  let Le = new gU();
40165
- Le.red = ue.x, Le.green = ue.y, Le.blue = ue.z, Le.opacity = ue.w, Le.name = Ee.toString(), J.Materials.push(Le);
40165
+ Le.red = Math.round(ue.x * 255), Le.green = Math.round(ue.y * 255), Le.blue = Math.round(ue.z * 255), Le.opacity = ue.w, Le.name = Ee.toString(), J.Materials.push(Le);
40166
40166
  }), J.Data.Data = W, J;
40167
40167
  }
40168
40168
  async readIfcFile(r) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ifc-reader-2",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",