@liveroom-tech/react-immersive 6.2.2 → 6.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/dist/{SequencesTab-LTMJTB76.mjs → SequencesTab-JZEE5WAM.mjs} +1 -1
- package/dist/binding-builder.d.mts +3 -3
- package/dist/binding-builder.d.ts +3 -3
- package/dist/binding-builder.js +41 -41
- package/dist/binding-builder.mjs +1 -1
- package/dist/{chunk-NMRTI3NQ.mjs → chunk-3GA7JFNH.mjs} +1 -1
- package/dist/chunk-3I7PPFUV.mjs +1 -0
- package/dist/{chunk-IT2PUTJS.mjs → chunk-CHMFH4D4.mjs} +1 -1
- package/dist/{chunk-RSUXTWM6.mjs → chunk-CUDL77ZY.mjs} +1 -1
- package/dist/{chunk-XKJQC3N5.mjs → chunk-IEKGBS46.mjs} +1 -1
- package/dist/chunk-LU3BQ7WG.mjs +69 -0
- package/dist/chunk-QZNUWZG7.mjs +50 -0
- package/dist/{chunk-WU3SQZGD.mjs → chunk-TI2YXAHW.mjs} +2 -2
- package/dist/hosted.d.mts +3 -3
- package/dist/hosted.d.ts +3 -3
- package/dist/hosted.js +40 -40
- package/dist/hosted.mjs +1 -1
- package/dist/index.d.mts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +36 -36
- package/dist/index.mjs +1 -1
- package/dist/{modelFileResolver-Bq4pW9vc.d.mts → modelFileResolver-An1aQ0D3.d.mts} +3 -0
- package/dist/{modelFileResolver-Bq4pW9vc.d.ts → modelFileResolver-An1aQ0D3.d.ts} +3 -0
- package/dist/{modelViewerProps-BnrJO5DK.d.ts → modelViewerProps-BnVflYRA.d.mts} +21 -3
- package/dist/{modelViewerProps-wjBT4fks.d.mts → modelViewerProps-H_K454u_.d.ts} +21 -3
- package/dist/{publicProps-BZPMIRwj.d.ts → publicProps-AdNUI06n.d.ts} +1 -1
- package/dist/{publicProps-CW5X_HFh.d.mts → publicProps-BOQBJBA_.d.mts} +1 -1
- package/dist/simple-model-viewer.d.mts +6 -2
- package/dist/simple-model-viewer.d.ts +6 -2
- package/dist/simple-model-viewer.js +5 -5
- package/dist/simple-model-viewer.mjs +1 -1
- package/dist/utils.d.mts +4 -4
- package/dist/utils.d.ts +4 -4
- package/dist/utils.js +15 -15
- package/dist/utils.mjs +1 -1
- package/package.json +7 -5
- package/dist/chunk-2LGQKX6Z.mjs +0 -50
- package/dist/chunk-LEOHZ5HM.mjs +0 -69
- package/dist/chunk-UAZ6I25Y.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";"use client";var Ia=Object.create;var Ze=Object.defineProperty;var Na=Object.getOwnPropertyDescriptor;var Ua=Object.getOwnPropertyNames;var Oa=Object.getPrototypeOf,ka=Object.prototype.hasOwnProperty;var Ke=(e,t)=>()=>(e&&(t=e(e=0)),t);var $e=(e,t)=>{for(var n in t)Ze(e,n,{get:t[n],enumerable:!0})},In=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ua(t))!ka.call(e,i)&&i!==n&&Ze(e,i,{get:()=>t[i],enumerable:!(r=Na(t,i))||r.enumerable});return e};var Re=(e,t,n)=>(n=e!=null?Ia(Oa(e)):{},In(t||!e||!e.__esModule?Ze(n,"default",{value:e,enumerable:!0}):n,e)),Ba=e=>In(Ze({},"__esModule",{value:!0}),e);function Qe(e){return e instanceof pe||e instanceof Error&&e.message.includes(Qn)}var Qn,pe,et=Ke(()=>{"use strict";Qn="This PLY file is a point cloud: it has vertices but no faces.",pe=class extends Error{constructor(){super(Qn),this.name="PointCloudError"}}});var Ar={};$e(Ar,{PointCloudError:()=>pe,isPointCloudError:()=>Qe,meshNameFromPath:()=>yo,parsePly:()=>Mo,parseStl:()=>bo,plyHasFaces:()=>Sr});function yo(e,t){let n=e.split(/[?#]/,1)[0],r=n.slice(n.lastIndexOf("/")+1);try{r=decodeURIComponent(r)}catch{}return r.replace(/\.[^.]*$/,"").trim()||t}function Bt(e){return new H.MeshStandardMaterial({color:e?16777215:xo,vertexColors:e,metalness:0,roughness:.6})}function br(e,t,n){let r=e.itemSize;return new H.Float32BufferAttribute(e.array.slice(t*r,(t+n)*r),r)}function bo(e,t){let n=new Mr.STLLoader().parse(e),r=!!n.hasColors,i=new H.Group;if(n.groups.length>1){let l=n.userData.groupNames??[],o=n.getAttribute("position"),d=n.getAttribute("normal");return n.groups.forEach((u,p)=>{let v=new H.BufferGeometry;v.setAttribute("position",br(o,u.start,u.count)),d&&v.setAttribute("normal",br(d,u.start,u.count));let g=new H.Mesh(v,Bt(!1));g.name=l[p]?.trim()||`${t} ${p+1}`,i.add(g)}),n.dispose(),i}n.clearGroups();let a=Bt(r);r&&n.alpha!==void 0&&n.alpha<1&&(a.opacity=n.alpha,a.transparent=!0);let s=new H.Mesh(n,a);return s.name=t,i.add(s),i}function Sr(e){let n=new TextDecoder().decode(new Uint8Array(e,0,Math.min(e.byteLength,65536))).split("end_header",1)[0],r=/^\s*element\s+face\s+(\d+)/m.exec(n);return!!(r&&Number(r[1])>0)}function Mo(e,t){if(!Sr(e))throw new pe;let n=new wr.PLYLoader().parse(e);n.getAttribute("normal")||n.computeVertexNormals();let r=new H.Mesh(n,Bt(!!n.getAttribute("color")));r.name=t;let i=new H.Group;return i.add(r),i}var H,Mr,wr,xo,Er=Ke(()=>{"use strict";H=require("three"),Mr=require("three/examples/jsm/loaders/STLLoader.js"),wr=require("three/examples/jsm/loaders/PLYLoader.js");et();et();xo=12106948});var li={};$e(li,{bvhWorkerCode:()=>Vo});var Vo,ci=Ke(()=>{"use strict";Vo=`(()=>{var Ls=1;var Ds=3,wn=0,Ui=1,Fi=2;var di=0,pi=1,mi=2,gi=3,_i=4,xi=5,yi=6,vi=7,Ns=0,Us=1,Fs=2;var Bi=1,Oi=2,zi=3,Vi=4,ki=5,Gi=6,Hi=7;var Wi=300,Bs=301,Xi=302;var Os=306,Mi=1e3,Ie=1001,Si=1002;var zs=1006;var Vs=1008;var ks=1009;var Gs=1015;var Hs=1023;var De=2300,ln=2301,an=2302,bi=2303,Ti=2400,Ai=2401,Ei=2402;var qi="",_t="srgb",wi="srgb-linear",Ci="linear",cn="srgb";var Ri=35044;var Le=2e3,Pi=2001;function Fr(c){for(let t=c.length-1;t>=0;--t)if(c[t]>=65535)return!0;return!1}function Br(c){return ArrayBuffer.isView(c)&&!(c instanceof DataView)}function Ii(c){return document.createElementNS("http://www.w3.org/1999/xhtml",c)}var xs={},un=null;function Ws(c){let t=c[0];if(typeof t=="string"&&t.startsWith("TSL:")){let e=c[1];e&&e.isStackTrace?c[0]+=" "+e.getLocation():c[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return c}function Q(...c){c=Ws(c);let t="THREE."+c.shift();if(un)un("warn",t,...c);else{let e=c[0];e&&e.isStackTrace?console.warn(e.getError(t)):console.warn(t,...c)}}function G(...c){c=Ws(c);let t="THREE."+c.shift();if(un)un("error",t,...c);else{let e=c[0];e&&e.isStackTrace?console.error(e.getError(t)):console.error(t,...c)}}function Li(...c){let t=c.join(" ");t in xs||(xs[t]=!0,Q(...c))}var Or={[di]:pi,[mi]:yi,[_i]:vi,[gi]:xi,[pi]:di,[yi]:mi,[vi]:_i,[xi]:gi},Yt=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){let n=this._listeners;return n===void 0?!1:n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){let n=this._listeners;if(n===void 0)return;let i=n[t];if(i!==void 0){let s=i.indexOf(e);s!==-1&&i.splice(s,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let n=e[t.type];if(n!==void 0){t.target=this;let i=n.slice(0);for(let s=0,r=i.length;s<r;s++)i[s].call(this,t);t.target=null}}},st=["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"];var yl=Math.PI/180,zr=180/Math.PI;function Cn(){let c=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(st[c&255]+st[c>>8&255]+st[c>>16&255]+st[c>>24&255]+"-"+st[t&255]+st[t>>8&255]+"-"+st[t>>16&15|64]+st[t>>24&255]+"-"+st[e&63|128]+st[e>>8&255]+"-"+st[e>>16&255]+st[e>>24&255]+st[n&255]+st[n>>8&255]+st[n>>16&255]+st[n>>24&255]).toLowerCase()}function U(c,t,e){return Math.max(t,Math.min(e,c))}function Vr(c,t){return(c%t+t)%t}function Zn(c,t,e){return(1-e)*c+e*t}function Ee(c,t){switch(t.constructor){case Float32Array:return c;case Uint32Array:return c/4294967295;case Uint16Array:return c/65535;case Uint8Array:return c/255;case Int32Array:return Math.max(c/2147483647,-1);case Int16Array:return Math.max(c/32767,-1);case Int8Array:return Math.max(c/127,-1);default:throw new Error("Invalid component type.")}}function ut(c,t){switch(t.constructor){case Float32Array:return c;case Uint32Array:return Math.round(c*4294967295);case Uint16Array:return Math.round(c*65535);case Uint8Array:return Math.round(c*255);case Int32Array:return Math.round(c*2147483647);case Int16Array:return Math.round(c*32767);case Int8Array:return Math.round(c*127);default:throw new Error("Invalid component type.")}}var H=class c{static{c.prototype.isVector2=!0}constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=U(this.x,t.x,e.x),this.y=U(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=U(this.x,t,e),this.y=U(this.y,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(U(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(U(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let n=Math.cos(e),i=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*n-r*i+t.x,this.y=s*i+r*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Lt=class{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,s,r,o){let a=n[i+0],l=n[i+1],u=n[i+2],f=n[i+3],h=s[r+0],d=s[r+1],p=s[r+2],m=s[r+3];if(f!==m||a!==h||l!==d||u!==p){let _=a*h+l*d+u*p+f*m;_<0&&(h=-h,d=-d,p=-p,m=-m,_=-_);let g=1-o;if(_<.9995){let x=Math.acos(_),y=Math.sin(x);g=Math.sin(g*x)/y,o=Math.sin(o*x)/y,a=a*g+h*o,l=l*g+d*o,u=u*g+p*o,f=f*g+m*o}else{a=a*g+h*o,l=l*g+d*o,u=u*g+p*o,f=f*g+m*o;let x=1/Math.sqrt(a*a+l*l+u*u+f*f);a*=x,l*=x,u*=x,f*=x}}t[e]=a,t[e+1]=l,t[e+2]=u,t[e+3]=f}static multiplyQuaternionsFlat(t,e,n,i,s,r){let o=n[i],a=n[i+1],l=n[i+2],u=n[i+3],f=s[r],h=s[r+1],d=s[r+2],p=s[r+3];return t[e]=o*p+u*f+a*d-l*h,t[e+1]=a*p+u*h+l*f-o*d,t[e+2]=l*p+u*d+o*h-a*f,t[e+3]=u*p-o*f-a*h-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let n=t._x,i=t._y,s=t._z,r=t._order,o=Math.cos,a=Math.sin,l=o(n/2),u=o(i/2),f=o(s/2),h=a(n/2),d=a(i/2),p=a(s/2);switch(r){case"XYZ":this._x=h*u*f+l*d*p,this._y=l*d*f-h*u*p,this._z=l*u*p+h*d*f,this._w=l*u*f-h*d*p;break;case"YXZ":this._x=h*u*f+l*d*p,this._y=l*d*f-h*u*p,this._z=l*u*p-h*d*f,this._w=l*u*f+h*d*p;break;case"ZXY":this._x=h*u*f-l*d*p,this._y=l*d*f+h*u*p,this._z=l*u*p+h*d*f,this._w=l*u*f-h*d*p;break;case"ZYX":this._x=h*u*f-l*d*p,this._y=l*d*f+h*u*p,this._z=l*u*p-h*d*f,this._w=l*u*f+h*d*p;break;case"YZX":this._x=h*u*f+l*d*p,this._y=l*d*f+h*u*p,this._z=l*u*p-h*d*f,this._w=l*u*f-h*d*p;break;case"XZY":this._x=h*u*f-l*d*p,this._y=l*d*f-h*u*p,this._z=l*u*p+h*d*f,this._w=l*u*f+h*d*p;break;default:Q("Quaternion: .setFromEuler() encountered an unknown order: "+r)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],i=e[4],s=e[8],r=e[1],o=e[5],a=e[9],l=e[2],u=e[6],f=e[10],h=n+o+f;if(h>0){let d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-a)*d,this._y=(s-l)*d,this._z=(r-i)*d}else if(n>o&&n>f){let d=2*Math.sqrt(1+n-o-f);this._w=(u-a)/d,this._x=.25*d,this._y=(i+r)/d,this._z=(s+l)/d}else if(o>f){let d=2*Math.sqrt(1+o-n-f);this._w=(s-l)/d,this._x=(i+r)/d,this._y=.25*d,this._z=(a+u)/d}else{let d=2*Math.sqrt(1+f-n-o);this._w=(r-i)/d,this._x=(s+l)/d,this._y=(a+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-8?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(U(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let n=t._x,i=t._y,s=t._z,r=t._w,o=e._x,a=e._y,l=e._z,u=e._w;return this._x=n*u+r*o+i*l-s*a,this._y=i*u+r*a+s*o-n*l,this._z=s*u+r*l+n*a-i*o,this._w=r*u-n*o-i*a-s*l,this._onChangeCallback(),this}slerp(t,e){let n=t._x,i=t._y,s=t._z,r=t._w,o=this.dot(t);o<0&&(n=-n,i=-i,s=-s,r=-r,o=-o);let a=1-e;if(o<.9995){let l=Math.acos(o),u=Math.sin(l);a=Math.sin(a*l)/u,e=Math.sin(e*l)/u,this._x=this._x*a+n*e,this._y=this._y*a+i*e,this._z=this._z*a+s*e,this._w=this._w*a+r*e,this._onChangeCallback()}else this._x=this._x*a+n*e,this._y=this._y*a+i*e,this._z=this._z*a+s*e,this._w=this._w*a+r*e,this.normalize();return this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},M=class c{static{c.prototype.isVector3=!0}constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(ys.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ys.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*i,this.y=s[1]*e+s[4]*n+s[7]*i,this.z=s[2]*e+s[5]*n+s[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,s=t.elements,r=1/(s[3]*e+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*i+s[12])*r,this.y=(s[1]*e+s[5]*n+s[9]*i+s[13])*r,this.z=(s[2]*e+s[6]*n+s[10]*i+s[14])*r,this}applyQuaternion(t){let e=this.x,n=this.y,i=this.z,s=t.x,r=t.y,o=t.z,a=t.w,l=2*(r*i-o*n),u=2*(o*e-s*i),f=2*(s*n-r*e);return this.x=e+a*l+r*f-o*u,this.y=n+a*u+o*l-s*f,this.z=i+a*f+s*u-r*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i,this.y=s[1]*e+s[5]*n+s[9]*i,this.z=s[2]*e+s[6]*n+s[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=U(this.x,t.x,e.x),this.y=U(this.y,t.y,e.y),this.z=U(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=U(this.x,t,e),this.y=U(this.y,t,e),this.z=U(this.z,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(U(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let n=t.x,i=t.y,s=t.z,r=e.x,o=e.y,a=e.z;return this.x=i*a-s*o,this.y=s*r-n*a,this.z=n*o-i*r,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Jn.copy(this).projectOnVector(t),this.sub(Jn)}reflect(t){return this.sub(Jn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(U(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){let i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Jn=new M,ys=new Lt,N=class c{static{c.prototype.isMatrix3=!0}constructor(t,e,n,i,s,r,o,a,l){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,r,o,a,l)}set(t,e,n,i,s,r,o,a,l){let u=this.elements;return u[0]=t,u[1]=i,u[2]=o,u[3]=e,u[4]=s,u[5]=a,u[6]=n,u[7]=r,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,i=e.elements,s=this.elements,r=n[0],o=n[3],a=n[6],l=n[1],u=n[4],f=n[7],h=n[2],d=n[5],p=n[8],m=i[0],_=i[3],g=i[6],x=i[1],y=i[4],S=i[7],v=i[2],b=i[5],T=i[8];return s[0]=r*m+o*x+a*v,s[3]=r*_+o*y+a*b,s[6]=r*g+o*S+a*T,s[1]=l*m+u*x+f*v,s[4]=l*_+u*y+f*b,s[7]=l*g+u*S+f*T,s[2]=h*m+d*x+p*v,s[5]=h*_+d*y+p*b,s[8]=h*g+d*S+p*T,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],r=t[4],o=t[5],a=t[6],l=t[7],u=t[8];return e*r*u-e*o*l-n*s*u+n*o*a+i*s*l-i*r*a}invert(){let t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],r=t[4],o=t[5],a=t[6],l=t[7],u=t[8],f=u*r-o*l,h=o*a-u*s,d=l*s-r*a,p=e*f+n*h+i*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return t[0]=f*m,t[1]=(i*l-u*n)*m,t[2]=(o*n-i*r)*m,t[3]=h*m,t[4]=(u*e-i*a)*m,t[5]=(i*s-o*e)*m,t[6]=d*m,t[7]=(n*a-l*e)*m,t[8]=(r*e-n*s)*m,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,s,r,o){let a=Math.cos(s),l=Math.sin(s);return this.set(n*a,n*l,-n*(a*r+l*o)+r+t,-i*l,i*a,-i*(-l*r+a*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply($n.makeScale(t,e)),this}rotate(t){return this.premultiply($n.makeRotation(-t)),this}translate(t,e){return this.premultiply($n.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}},$n=new N,vs=new N().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ms=new N().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function kr(){let c={enabled:!0,workingColorSpace:wi,spaces:{},convert:function(i,s,r){return this.enabled===!1||s===r||!s||!r||(this.spaces[s].transfer===cn&&(i.r=It(i.r),i.g=It(i.g),i.b=It(i.b)),this.spaces[s].primaries!==this.spaces[r].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[r].fromXYZ)),this.spaces[r].transfer===cn&&(i.r=he(i.r),i.g=he(i.g),i.b=he(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===qi?Ci:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,r){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[r].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return Li("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),c.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Li("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),c.colorSpaceToWorking(i,s)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return c.define({[wi]:{primaries:t,whitePoint:n,transfer:Ci,toXYZ:vs,fromXYZ:Ms,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:_t},outputColorSpaceConfig:{drawingBufferColorSpace:_t}},[_t]:{primaries:t,whitePoint:n,transfer:cn,toXYZ:vs,fromXYZ:Ms,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:_t}}}),c}var gt=kr();function It(c){return c<.04045?c*.0773993808:Math.pow(c*.9478672986+.0521327014,2.4)}function he(c){return c<.0031308?c*12.92:1.055*Math.pow(c,.41666)-.055}var jt,hn=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{jt===void 0&&(jt=Ii("canvas")),jt.width=t.width,jt.height=t.height;let i=jt.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),n=jt}return n.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=Ii("canvas");e.width=t.width,e.height=t.height;let n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);let i=n.getImageData(0,0,t.width,t.height),s=i.data;for(let r=0;r<s.length;r++)s[r]=It(s[r]/255)*255;return n.putImageData(i,0,0),e}else if(t.data){let e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(It(e[n]/255)*255):e[n]=It(e[n]);return{data:e,width:t.width,height:t.height}}else return Q("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},Gr=0,fn=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Gr++}),this.uuid=Cn(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let r=0,o=i.length;r<o;r++)i[r].isDataTexture?s.push(Kn(i[r].image)):s.push(Kn(i[r]))}else s=Kn(i);n.url=s}return e||(t.images[this.uuid]=n),n}};function Kn(c){return typeof HTMLImageElement<"u"&&c instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&c instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&c instanceof ImageBitmap?hn.getDataURL(c):c.data?{data:Array.from(c.data),width:c.width,height:c.height,type:c.data.constructor.name}:(Q("Texture: Unable to serialize Texture."),{})}var Hr=0,Qn=new M,fe=class c extends Yt{constructor(t=c.DEFAULT_IMAGE,e=c.DEFAULT_MAPPING,n=Ie,i=Ie,s=zs,r=Vs,o=Hs,a=ks,l=c.DEFAULT_ANISOTROPY,u=qi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Hr++}),this.uuid=Cn(),this.name="",this.source=new fn(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=r,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new H(0,0),this.repeat=new H(1,1),this.center=new H(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new N,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Qn).x}get height(){return this.source.getSize(Qn).y}get depth(){return this.source.getSize(Qn).z}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let n=t[e];if(n===void 0){Q(\`Texture.setValues(): parameter '\${e}' has value of undefined.\`);continue}let i=this[e];if(i===void 0){Q(\`Texture.setValues(): property '\${e}' does not exist.\`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,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&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Wi)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Mi:t.x=t.x-Math.floor(t.x);break;case Ie:t.x=t.x<0?0:1;break;case Si:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Mi:t.y=t.y-Math.floor(t.y);break;case Ie:t.y=t.y<0?0:1;break;case Si:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};fe.DEFAULT_IMAGE=null;fe.DEFAULT_MAPPING=Wi;fe.DEFAULT_ANISOTROPY=1;var de=class c{static{c.prototype.isVector4=!0}constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,s=this.w,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i+r[12]*s,this.y=r[1]*e+r[5]*n+r[9]*i+r[13]*s,this.z=r[2]*e+r[6]*n+r[10]*i+r[14]*s,this.w=r[3]*e+r[7]*n+r[11]*i+r[15]*s,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,s,a=t.elements,l=a[0],u=a[4],f=a[8],h=a[1],d=a[5],p=a[9],m=a[2],_=a[6],g=a[10];if(Math.abs(u-h)<.01&&Math.abs(f-m)<.01&&Math.abs(p-_)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+m)<.1&&Math.abs(p+_)<.1&&Math.abs(l+d+g-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let y=(l+1)/2,S=(d+1)/2,v=(g+1)/2,b=(u+h)/4,T=(f+m)/4,A=(p+_)/4;return y>S&&y>v?y<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(y),i=b/n,s=T/n):S>v?S<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(S),n=b/i,s=A/i):v<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(v),n=T/s,i=A/s),this.set(n,i,s,e),this}let x=Math.sqrt((_-p)*(_-p)+(f-m)*(f-m)+(h-u)*(h-u));return Math.abs(x)<.001&&(x=1),this.x=(_-p)/x,this.y=(f-m)/x,this.z=(h-u)/x,this.w=Math.acos((l+d+g-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=U(this.x,t.x,e.x),this.y=U(this.y,t.y,e.y),this.z=U(this.z,t.z,e.z),this.w=U(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=U(this.x,t,e),this.y=U(this.y,t,e),this.z=U(this.z,t,e),this.w=U(this.w,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(U(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};var W=class c{static{c.prototype.isMatrix4=!0}constructor(t,e,n,i,s,r,o,a,l,u,f,h,d,p,m,_){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,r,o,a,l,u,f,h,d,p,m,_)}set(t,e,n,i,s,r,o,a,l,u,f,h,d,p,m,_){let g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=s,g[5]=r,g[9]=o,g[13]=a,g[2]=l,g[6]=u,g[10]=f,g[14]=h,g[3]=d,g[7]=p,g[11]=m,g[15]=_,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 c().fromArray(this.elements)}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){let e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return this.determinant()===0?(t.set(1,0,0),e.set(0,1,0),n.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){if(t.determinant()===0)return this.identity();let e=this.elements,n=t.elements,i=1/te.setFromMatrixColumn(t,0).length(),s=1/te.setFromMatrixColumn(t,1).length(),r=1/te.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*r,e[9]=n[9]*r,e[10]=n[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,n=t.x,i=t.y,s=t.z,r=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),u=Math.cos(s),f=Math.sin(s);if(t.order==="XYZ"){let h=r*u,d=r*f,p=o*u,m=o*f;e[0]=a*u,e[4]=-a*f,e[8]=l,e[1]=d+p*l,e[5]=h-m*l,e[9]=-o*a,e[2]=m-h*l,e[6]=p+d*l,e[10]=r*a}else if(t.order==="YXZ"){let h=a*u,d=a*f,p=l*u,m=l*f;e[0]=h+m*o,e[4]=p*o-d,e[8]=r*l,e[1]=r*f,e[5]=r*u,e[9]=-o,e[2]=d*o-p,e[6]=m+h*o,e[10]=r*a}else if(t.order==="ZXY"){let h=a*u,d=a*f,p=l*u,m=l*f;e[0]=h-m*o,e[4]=-r*f,e[8]=p+d*o,e[1]=d+p*o,e[5]=r*u,e[9]=m-h*o,e[2]=-r*l,e[6]=o,e[10]=r*a}else if(t.order==="ZYX"){let h=r*u,d=r*f,p=o*u,m=o*f;e[0]=a*u,e[4]=p*l-d,e[8]=h*l+m,e[1]=a*f,e[5]=m*l+h,e[9]=d*l-p,e[2]=-l,e[6]=o*a,e[10]=r*a}else if(t.order==="YZX"){let h=r*a,d=r*l,p=o*a,m=o*l;e[0]=a*u,e[4]=m-h*f,e[8]=p*f+d,e[1]=f,e[5]=r*u,e[9]=-o*u,e[2]=-l*u,e[6]=d*f+p,e[10]=h-m*f}else if(t.order==="XZY"){let h=r*a,d=r*l,p=o*a,m=o*l;e[0]=a*u,e[4]=-f,e[8]=l*u,e[1]=h*f+m,e[5]=r*u,e[9]=d*f-p,e[2]=p*f-d,e[6]=o*u,e[10]=m*f+h}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Wr,t,Xr)}lookAt(t,e,n){let i=this.elements;return ft.subVectors(t,e),ft.lengthSq()===0&&(ft.z=1),ft.normalize(),Nt.crossVectors(n,ft),Nt.lengthSq()===0&&(Math.abs(n.z)===1?ft.x+=1e-4:ft.z+=1e-4,ft.normalize(),Nt.crossVectors(n,ft)),Nt.normalize(),Ke.crossVectors(ft,Nt),i[0]=Nt.x,i[4]=Ke.x,i[8]=ft.x,i[1]=Nt.y,i[5]=Ke.y,i[9]=ft.y,i[2]=Nt.z,i[6]=Ke.z,i[10]=ft.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,i=e.elements,s=this.elements,r=n[0],o=n[4],a=n[8],l=n[12],u=n[1],f=n[5],h=n[9],d=n[13],p=n[2],m=n[6],_=n[10],g=n[14],x=n[3],y=n[7],S=n[11],v=n[15],b=i[0],T=i[4],A=i[8],E=i[12],C=i[1],R=i[5],w=i[9],P=i[13],L=i[2],D=i[6],O=i[10],it=i[14],Tt=i[3],At=i[7],Je=i[11],$e=i[15];return s[0]=r*b+o*C+a*L+l*Tt,s[4]=r*T+o*R+a*D+l*At,s[8]=r*A+o*w+a*O+l*Je,s[12]=r*E+o*P+a*it+l*$e,s[1]=u*b+f*C+h*L+d*Tt,s[5]=u*T+f*R+h*D+d*At,s[9]=u*A+f*w+h*O+d*Je,s[13]=u*E+f*P+h*it+d*$e,s[2]=p*b+m*C+_*L+g*Tt,s[6]=p*T+m*R+_*D+g*At,s[10]=p*A+m*w+_*O+g*Je,s[14]=p*E+m*P+_*it+g*$e,s[3]=x*b+y*C+S*L+v*Tt,s[7]=x*T+y*R+S*D+v*At,s[11]=x*A+y*w+S*O+v*Je,s[15]=x*E+y*P+S*it+v*$e,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[4],i=t[8],s=t[12],r=t[1],o=t[5],a=t[9],l=t[13],u=t[2],f=t[6],h=t[10],d=t[14],p=t[3],m=t[7],_=t[11],g=t[15],x=a*d-l*h,y=o*d-l*f,S=o*h-a*f,v=r*d-l*u,b=r*h-a*u,T=r*f-o*u;return e*(m*x-_*y+g*S)-n*(p*x-_*v+g*b)+i*(p*y-m*v+g*T)-s*(p*S-m*b+_*T)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){let i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){let t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],r=t[4],o=t[5],a=t[6],l=t[7],u=t[8],f=t[9],h=t[10],d=t[11],p=t[12],m=t[13],_=t[14],g=t[15],x=e*o-n*r,y=e*a-i*r,S=e*l-s*r,v=n*a-i*o,b=n*l-s*o,T=i*l-s*a,A=u*m-f*p,E=u*_-h*p,C=u*g-d*p,R=f*_-h*m,w=f*g-d*m,P=h*g-d*_,L=x*P-y*w+S*R+v*C-b*E+T*A;if(L===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let D=1/L;return t[0]=(o*P-a*w+l*R)*D,t[1]=(i*w-n*P-s*R)*D,t[2]=(m*T-_*b+g*v)*D,t[3]=(h*b-f*T-d*v)*D,t[4]=(a*C-r*P-l*E)*D,t[5]=(e*P-i*C+s*E)*D,t[6]=(_*S-p*T-g*y)*D,t[7]=(u*T-h*S+d*y)*D,t[8]=(r*w-o*C+l*A)*D,t[9]=(n*C-e*w-s*A)*D,t[10]=(p*b-m*S+g*x)*D,t[11]=(f*S-u*b-d*x)*D,t[12]=(o*E-r*R-a*A)*D,t[13]=(e*R-n*E+i*A)*D,t[14]=(m*y-p*v-_*x)*D,t[15]=(u*v-f*y+h*x)*D,this}scale(t){let e=this.elements,n=t.x,i=t.y,s=t.z;return e[0]*=n,e[4]*=i,e[8]*=s,e[1]*=n,e[5]*=i,e[9]*=s,e[2]*=n,e[6]*=i,e[10]*=s,e[3]*=n,e[7]*=i,e[11]*=s,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let n=Math.cos(e),i=Math.sin(e),s=1-n,r=t.x,o=t.y,a=t.z,l=s*r,u=s*o;return this.set(l*r+n,l*o-i*a,l*a+i*o,0,l*o+i*a,u*o+n,u*a-i*r,0,l*a-i*o,u*a+i*r,s*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,s,r){return this.set(1,n,s,0,t,1,r,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){let i=this.elements,s=e._x,r=e._y,o=e._z,a=e._w,l=s+s,u=r+r,f=o+o,h=s*l,d=s*u,p=s*f,m=r*u,_=r*f,g=o*f,x=a*l,y=a*u,S=a*f,v=n.x,b=n.y,T=n.z;return i[0]=(1-(m+g))*v,i[1]=(d+S)*v,i[2]=(p-y)*v,i[3]=0,i[4]=(d-S)*b,i[5]=(1-(h+g))*b,i[6]=(_+x)*b,i[7]=0,i[8]=(p+y)*T,i[9]=(_-x)*T,i[10]=(1-(h+m))*T,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){let i=this.elements;t.x=i[12],t.y=i[13],t.z=i[14];let s=this.determinant();if(s===0)return n.set(1,1,1),e.identity(),this;let r=te.set(i[0],i[1],i[2]).length(),o=te.set(i[4],i[5],i[6]).length(),a=te.set(i[8],i[9],i[10]).length();s<0&&(r=-r),yt.copy(this);let l=1/r,u=1/o,f=1/a;return yt.elements[0]*=l,yt.elements[1]*=l,yt.elements[2]*=l,yt.elements[4]*=u,yt.elements[5]*=u,yt.elements[6]*=u,yt.elements[8]*=f,yt.elements[9]*=f,yt.elements[10]*=f,e.setFromRotationMatrix(yt),n.x=r,n.y=o,n.z=a,this}makePerspective(t,e,n,i,s,r,o=Le,a=!1){let l=this.elements,u=2*s/(e-t),f=2*s/(n-i),h=(e+t)/(e-t),d=(n+i)/(n-i),p,m;if(a)p=s/(r-s),m=r*s/(r-s);else if(o===Le)p=-(r+s)/(r-s),m=-2*r*s/(r-s);else if(o===Pi)p=-r/(r-s),m=-r*s/(r-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=f,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,n,i,s,r,o=Le,a=!1){let l=this.elements,u=2/(e-t),f=2/(n-i),h=-(e+t)/(e-t),d=-(n+i)/(n-i),p,m;if(a)p=1/(r-s),m=r/(r-s);else if(o===Le)p=-2/(r-s),m=-(r+s)/(r-s);else if(o===Pi)p=-1/(r-s),m=-s/(r-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=0,l[12]=h,l[1]=0,l[5]=f,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){let e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},te=new M,yt=new W,Wr=new M(0,0,0),Xr=new M(1,1,1),Nt=new M,Ke=new M,ft=new M,Ss=new W,bs=new Lt,Ne=class c{constructor(t=0,e=0,n=0,i=c.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){let i=t.elements,s=i[0],r=i[4],o=i[8],a=i[1],l=i[5],u=i[9],f=i[2],h=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(U(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-U(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(U(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-r,l)):(this._y=0,this._z=Math.atan2(a,s));break;case"ZYX":this._y=Math.asin(-U(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(a,s)):(this._x=0,this._z=Math.atan2(-r,l));break;case"YZX":this._z=Math.asin(U(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-U(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:Q("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Ss.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Ss,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return bs.setFromEuler(this),this.setFromQuaternion(bs,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Ne.DEFAULT_ORDER="XYZ";var dn=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},qr=0,Ts=new M,ee=new Lt,wt=new W,Qe=new M,we=new M,Yr=new M,Zr=new Lt,As=new M(1,0,0),Es=new M(0,1,0),ws=new M(0,0,1),Cs={type:"added"},Jr={type:"removed"},ne={type:"childadded",child:null},jn={type:"childremoved",child:null},Zt=class c extends Yt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:qr++}),this.uuid=Cn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=c.DEFAULT_UP.clone();let t=new M,e=new Ne,n=new Lt,i=new M(1,1,1);function s(){n.setFromEuler(e,!1)}function r(){e.setFromQuaternion(n,void 0,!1)}e._onChange(s),n._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new W},normalMatrix:{value:new N}}),this.matrix=new W,this.matrixWorld=new W,this.matrixAutoUpdate=c.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=c.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new dn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return ee.setFromAxisAngle(t,e),this.quaternion.multiply(ee),this}rotateOnWorldAxis(t,e){return ee.setFromAxisAngle(t,e),this.quaternion.premultiply(ee),this}rotateX(t){return this.rotateOnAxis(As,t)}rotateY(t){return this.rotateOnAxis(Es,t)}rotateZ(t){return this.rotateOnAxis(ws,t)}translateOnAxis(t,e){return Ts.copy(t).applyQuaternion(this.quaternion),this.position.add(Ts.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(As,t)}translateY(t){return this.translateOnAxis(Es,t)}translateZ(t){return this.translateOnAxis(ws,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(wt.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Qe.copy(t):Qe.set(t,e,n);let i=this.parent;this.updateWorldMatrix(!0,!1),we.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?wt.lookAt(we,Qe,this.up):wt.lookAt(Qe,we,this.up),this.quaternion.setFromRotationMatrix(wt),i&&(wt.extractRotation(i.matrixWorld),ee.setFromRotationMatrix(wt),this.quaternion.premultiply(ee.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(G("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Cs),ne.child=t,this.dispatchEvent(ne),ne.child=null):G("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Jr),jn.child=t,this.dispatchEvent(jn),jn.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),wt.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),wt.multiply(t.parent.matrixWorld)),t.applyMatrix4(wt),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Cs),ne.child=t,this.dispatchEvent(ne),ne.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){let r=this.children[n].getObjectByProperty(t,e);if(r!==void 0)return r}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(we,t,Yr),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(we,Zr,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let t=this.pivot;if(t!==null){let e=t.x,n=t.y,i=t.z,s=this.matrix.elements;s[12]+=e-s[0]*e-s[4]*n-s[8]*i,s[13]+=n-s[1]*e-s[5]*n-s[9]*i,s[14]+=i-s[2]*e-s[6]*n-s[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){let n=this.parent;if(t===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(t){let e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(t),i.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,a){return o[a.uuid]===void 0&&(o[a.uuid]=a.toJSON(t)),a.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(t.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let a=o.shapes;if(Array.isArray(a))for(let l=0,u=a.length;l<u;l++){let f=a[l];s(t.shapes,f)}else s(t.shapes,a)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let a=0,l=this.material.length;a<l;a++)o.push(s(t.materials,this.material[a]));i.material=o}else i.material=s(t.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){let a=this.animations[o];i.animations.push(s(t.animations,a))}}if(e){let o=r(t.geometries),a=r(t.materials),l=r(t.textures),u=r(t.images),f=r(t.shapes),h=r(t.skeletons),d=r(t.animations),p=r(t.nodes);o.length>0&&(n.geometries=o),a.length>0&&(n.materials=a),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),h.length>0&&(n.skeletons=h),d.length>0&&(n.animations=d),p.length>0&&(n.nodes=p)}return n.object=i,n;function r(o){let a=[];for(let l in o){let u=o[l];delete u.metadata,a.push(u)}return a}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){let i=t.children[n];this.add(i.clone())}return this}};Zt.DEFAULT_UP=new M(0,1,0);Zt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Zt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Xs={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ut={h:0,s:0,l:0},je={h:0,s:0,l:0};function ti(c,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?c+(t-c)*6*e:e<1/2?t:e<2/3?c+(t-c)*6*(2/3-e):c}var j=class{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){let i=t;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=_t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,gt.colorSpaceToWorking(this,e),this}setRGB(t,e,n,i=gt.workingColorSpace){return this.r=t,this.g=e,this.b=n,gt.colorSpaceToWorking(this,i),this}setHSL(t,e,n,i=gt.workingColorSpace){if(t=Vr(t,1),e=U(e,0,1),n=U(n,0,1),e===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+e):n+e-n*e,r=2*n-s;this.r=ti(r,s,t+1/3),this.g=ti(r,s,t),this.b=ti(r,s,t-1/3)}return gt.colorSpaceToWorking(this,i),this}setStyle(t,e=_t){function n(s){s!==void 0&&parseFloat(s)<1&&Q("Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\\w+)\\(([^\\)]*)\\)/.exec(t)){let s,r=i[1],o=i[2];switch(r){case"rgb":case"rgba":if(s=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:Q("Color: Unknown color model "+t)}}else if(i=/^\\#([A-Fa-f\\d]+)$/.exec(t)){let s=i[1],r=s.length;if(r===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(r===6)return this.setHex(parseInt(s,16),e);Q("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=_t){let n=Xs[t.toLowerCase()];return n!==void 0?this.setHex(n,e):Q("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=It(t.r),this.g=It(t.g),this.b=It(t.b),this}copyLinearToSRGB(t){return this.r=he(t.r),this.g=he(t.g),this.b=he(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=_t){return gt.workingToColorSpace(rt.copy(this),t),Math.round(U(rt.r*255,0,255))*65536+Math.round(U(rt.g*255,0,255))*256+Math.round(U(rt.b*255,0,255))}getHexString(t=_t){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=gt.workingColorSpace){gt.workingToColorSpace(rt.copy(this),e);let n=rt.r,i=rt.g,s=rt.b,r=Math.max(n,i,s),o=Math.min(n,i,s),a,l,u=(o+r)/2;if(o===r)a=0,l=0;else{let f=r-o;switch(l=u<=.5?f/(r+o):f/(2-r-o),r){case n:a=(i-s)/f+(i<s?6:0);break;case i:a=(s-n)/f+2;break;case s:a=(n-i)/f+4;break}a/=6}return t.h=a,t.s=l,t.l=u,t}getRGB(t,e=gt.workingColorSpace){return gt.workingToColorSpace(rt.copy(this),e),t.r=rt.r,t.g=rt.g,t.b=rt.b,t}getStyle(t=_t){gt.workingToColorSpace(rt.copy(this),t);let e=rt.r,n=rt.g,i=rt.b;return t!==_t?\`color(\${t} \${e.toFixed(3)} \${n.toFixed(3)} \${i.toFixed(3)})\`:\`rgb(\${Math.round(e*255)},\${Math.round(n*255)},\${Math.round(i*255)})\`}offsetHSL(t,e,n){return this.getHSL(Ut),this.setHSL(Ut.h+t,Ut.s+e,Ut.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Ut),t.getHSL(je);let n=Zn(Ut.h,je.h,e),i=Zn(Ut.s,je.s,e),s=Zn(Ut.l,je.l,e);return this.setHSL(n,i,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,n=this.g,i=this.b,s=t.elements;return this.r=s[0]*e+s[3]*n+s[6]*i,this.g=s[1]*e+s[4]*n+s[7]*i,this.b=s[2]*e+s[5]*n+s[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},rt=new j;j.NAMES=Xs;var vt=new M,Ct=new M,ei=new M,Rt=new M,ie=new M,se=new M,Rs=new M,ni=new M,ii=new M,si=new M,ri=new de,oi=new de,ai=new de,St=class c{constructor(t=new M,e=new M,n=new M){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),vt.subVectors(t,e),i.cross(vt);let s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(t,e,n,i,s){vt.subVectors(i,e),Ct.subVectors(n,e),ei.subVectors(t,e);let r=vt.dot(vt),o=vt.dot(Ct),a=vt.dot(ei),l=Ct.dot(Ct),u=Ct.dot(ei),f=r*l-o*o;if(f===0)return s.set(0,0,0),null;let h=1/f,d=(l*a-o*u)*h,p=(r*u-o*a)*h;return s.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Rt)===null?!1:Rt.x>=0&&Rt.y>=0&&Rt.x+Rt.y<=1}static getInterpolation(t,e,n,i,s,r,o,a){return this.getBarycoord(t,e,n,i,Rt)===null?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(s,Rt.x),a.addScaledVector(r,Rt.y),a.addScaledVector(o,Rt.z),a)}static getInterpolatedAttribute(t,e,n,i,s,r){return ri.setScalar(0),oi.setScalar(0),ai.setScalar(0),ri.fromBufferAttribute(t,e),oi.fromBufferAttribute(t,n),ai.fromBufferAttribute(t,i),r.setScalar(0),r.addScaledVector(ri,s.x),r.addScaledVector(oi,s.y),r.addScaledVector(ai,s.z),r}static isFrontFacing(t,e,n,i){return vt.subVectors(n,e),Ct.subVectors(t,e),vt.cross(Ct).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return vt.subVectors(this.c,this.b),Ct.subVectors(this.a,this.b),vt.cross(Ct).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return c.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return c.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,s){return c.getInterpolation(t,this.a,this.b,this.c,e,n,i,s)}containsPoint(t){return c.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return c.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let n=this.a,i=this.b,s=this.c,r,o;ie.subVectors(i,n),se.subVectors(s,n),ni.subVectors(t,n);let a=ie.dot(ni),l=se.dot(ni);if(a<=0&&l<=0)return e.copy(n);ii.subVectors(t,i);let u=ie.dot(ii),f=se.dot(ii);if(u>=0&&f<=u)return e.copy(i);let h=a*f-u*l;if(h<=0&&a>=0&&u<=0)return r=a/(a-u),e.copy(n).addScaledVector(ie,r);si.subVectors(t,s);let d=ie.dot(si),p=se.dot(si);if(p>=0&&d<=p)return e.copy(s);let m=d*l-a*p;if(m<=0&&l>=0&&p<=0)return o=l/(l-p),e.copy(n).addScaledVector(se,o);let _=u*p-d*f;if(_<=0&&f-u>=0&&d-p>=0)return Rs.subVectors(s,i),o=(f-u)/(f-u+(d-p)),e.copy(i).addScaledVector(Rs,o);let g=1/(_+m+h);return r=m*g,o=h*g,e.copy(n).addScaledVector(ie,r).addScaledVector(se,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},X=class{constructor(t=new M(1/0,1/0,1/0),e=new M(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(Mt.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(Mt.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=Mt.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let n=t.geometry;if(n!==void 0){let s=n.getAttribute("position");if(e===!0&&s!==void 0&&t.isInstancedMesh!==!0)for(let r=0,o=s.count;r<o;r++)t.isMesh===!0?t.getVertexPosition(r,Mt):Mt.fromBufferAttribute(s,r),Mt.applyMatrix4(t.matrixWorld),this.expandByPoint(Mt);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),tn.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),tn.copy(n.boundingBox)),tn.applyMatrix4(t.matrixWorld),this.union(tn)}let i=t.children;for(let s=0,r=i.length;s<r;s++)this.expandByObject(i[s],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Mt),Mt.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Ce),en.subVectors(this.max,Ce),re.subVectors(t.a,Ce),oe.subVectors(t.b,Ce),ae.subVectors(t.c,Ce),Ft.subVectors(oe,re),Bt.subVectors(ae,oe),Xt.subVectors(re,ae);let e=[0,-Ft.z,Ft.y,0,-Bt.z,Bt.y,0,-Xt.z,Xt.y,Ft.z,0,-Ft.x,Bt.z,0,-Bt.x,Xt.z,0,-Xt.x,-Ft.y,Ft.x,0,-Bt.y,Bt.x,0,-Xt.y,Xt.x,0];return!ci(e,re,oe,ae,en)||(e=[1,0,0,0,1,0,0,0,1],!ci(e,re,oe,ae,en))?!1:(nn.crossVectors(Ft,Bt),e=[nn.x,nn.y,nn.z],ci(e,re,oe,ae,en))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Mt).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Mt).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Pt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Pt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Pt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Pt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Pt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Pt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Pt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Pt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Pt),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},Pt=[new M,new M,new M,new M,new M,new M,new M,new M],Mt=new M,tn=new X,re=new M,oe=new M,ae=new M,Ft=new M,Bt=new M,Xt=new M,Ce=new M,en=new M,nn=new M,qt=new M;function ci(c,t,e,n,i){for(let s=0,r=c.length-3;s<=r;s+=3){qt.fromArray(c,s);let o=i.x*Math.abs(qt.x)+i.y*Math.abs(qt.y)+i.z*Math.abs(qt.z),a=t.dot(qt),l=e.dot(qt),u=n.dot(qt);if(Math.max(-Math.max(a,l,u),Math.min(a,l,u))>o)return!1}return!0}var J=new M,sn=new H,$r=0,ot=class extends Yt{constructor(t,e,n=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:$r++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=Ri,this.updateRanges=[],this.gpuType=Gs,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)sn.fromBufferAttribute(this,e),sn.applyMatrix3(t),this.setXY(e,sn.x,sn.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.applyMatrix3(t),this.setXYZ(e,J.x,J.y,J.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.applyMatrix4(t),this.setXYZ(e,J.x,J.y,J.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.applyNormalMatrix(t),this.setXYZ(e,J.x,J.y,J.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.transformDirection(t),this.setXYZ(e,J.x,J.y,J.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=Ee(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=ut(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ee(e,this.array)),e}setX(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ee(e,this.array)),e}setY(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ee(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ee(e,this.array)),e}setW(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=ut(e,this.array),n=ut(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=ut(e,this.array),n=ut(n,this.array),i=ut(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,s){return t*=this.itemSize,this.normalized&&(e=ut(e,this.array),n=ut(n,this.array),i=ut(i,this.array),s=ut(s,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==Ri&&(t.usage=this.usage),t}dispose(){this.dispatchEvent({type:"dispose"})}};var pn=class extends ot{constructor(t,e,n){super(new Uint16Array(t),e,n)}};var mn=class extends ot{constructor(t,e,n){super(new Uint32Array(t),e,n)}};var gn=class extends ot{constructor(t,e,n){super(new Float32Array(t),e,n)}},Kr=new X,Re=new M,li=new M,pe=class{constructor(t=new M,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let n=this.center;e!==void 0?n.copy(e):Kr.setFromPoints(t).getCenter(n);let i=0;for(let s=0,r=t.length;s<r;s++)i=Math.max(i,n.distanceToSquared(t[s]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Re.subVectors(t,this.center);let e=Re.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),i=(n-this.radius)*.5;this.center.addScaledVector(Re,i/n),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(li.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Re.copy(t.center).add(li)),this.expandByPoint(Re.copy(t.center).sub(li))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},Qr=0,mt=new W,ui=new Zt,ce=new M,dt=new X,Pe=new X,K=new M,Ue=class c extends Yt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Qr++}),this.uuid=Cn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Fr(t)?mn:pn)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new N().getNormalMatrix(t);n.applyNormalMatrix(s),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(t),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return mt.makeRotationFromQuaternion(t),this.applyMatrix4(mt),this}rotateX(t){return mt.makeRotationX(t),this.applyMatrix4(mt),this}rotateY(t){return mt.makeRotationY(t),this.applyMatrix4(mt),this}rotateZ(t){return mt.makeRotationZ(t),this.applyMatrix4(mt),this}translate(t,e,n){return mt.makeTranslation(t,e,n),this.applyMatrix4(mt),this}scale(t,e,n){return mt.makeScale(t,e,n),this.applyMatrix4(mt),this}lookAt(t){return ui.lookAt(t),ui.updateMatrix(),this.applyMatrix4(ui.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ce).negate(),this.translate(ce.x,ce.y,ce.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let n=[];for(let i=0,s=t.length;i<s;i++){let r=t[i];n.push(r.x,r.y,r.z||0)}this.setAttribute("position",new gn(n,3))}else{let n=Math.min(t.length,e.count);for(let i=0;i<n;i++){let s=t[i];e.setXYZ(i,s.x,s.y,s.z||0)}t.length>e.count&&Q("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new X);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){G("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new M(-1/0,-1/0,-1/0),new M(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,i=e.length;n<i;n++){let s=e[n];dt.setFromBufferAttribute(s),this.morphTargetsRelative?(K.addVectors(this.boundingBox.min,dt.min),this.boundingBox.expandByPoint(K),K.addVectors(this.boundingBox.max,dt.max),this.boundingBox.expandByPoint(K)):(this.boundingBox.expandByPoint(dt.min),this.boundingBox.expandByPoint(dt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&G('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new pe);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){G("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new M,1/0);return}if(t){let n=this.boundingSphere.center;if(dt.setFromBufferAttribute(t),e)for(let s=0,r=e.length;s<r;s++){let o=e[s];Pe.setFromBufferAttribute(o),this.morphTargetsRelative?(K.addVectors(dt.min,Pe.min),dt.expandByPoint(K),K.addVectors(dt.max,Pe.max),dt.expandByPoint(K)):(dt.expandByPoint(Pe.min),dt.expandByPoint(Pe.max))}dt.getCenter(n);let i=0;for(let s=0,r=t.count;s<r;s++)K.fromBufferAttribute(t,s),i=Math.max(i,n.distanceToSquared(K));if(e)for(let s=0,r=e.length;s<r;s++){let o=e[s],a=this.morphTargetsRelative;for(let l=0,u=o.count;l<u;l++)K.fromBufferAttribute(o,l),a&&(ce.fromBufferAttribute(t,l),K.add(ce)),i=Math.max(i,n.distanceToSquared(K))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&G('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){G("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=e.position,i=e.normal,s=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ot(new Float32Array(4*n.count),4));let r=this.getAttribute("tangent"),o=[],a=[];for(let A=0;A<n.count;A++)o[A]=new M,a[A]=new M;let l=new M,u=new M,f=new M,h=new H,d=new H,p=new H,m=new M,_=new M;function g(A,E,C){l.fromBufferAttribute(n,A),u.fromBufferAttribute(n,E),f.fromBufferAttribute(n,C),h.fromBufferAttribute(s,A),d.fromBufferAttribute(s,E),p.fromBufferAttribute(s,C),u.sub(l),f.sub(l),d.sub(h),p.sub(h);let R=1/(d.x*p.y-p.x*d.y);isFinite(R)&&(m.copy(u).multiplyScalar(p.y).addScaledVector(f,-d.y).multiplyScalar(R),_.copy(f).multiplyScalar(d.x).addScaledVector(u,-p.x).multiplyScalar(R),o[A].add(m),o[E].add(m),o[C].add(m),a[A].add(_),a[E].add(_),a[C].add(_))}let x=this.groups;x.length===0&&(x=[{start:0,count:t.count}]);for(let A=0,E=x.length;A<E;++A){let C=x[A],R=C.start,w=C.count;for(let P=R,L=R+w;P<L;P+=3)g(t.getX(P+0),t.getX(P+1),t.getX(P+2))}let y=new M,S=new M,v=new M,b=new M;function T(A){v.fromBufferAttribute(i,A),b.copy(v);let E=o[A];y.copy(E),y.sub(v.multiplyScalar(v.dot(E))).normalize(),S.crossVectors(b,E);let R=S.dot(a[A])<0?-1:1;r.setXYZW(A,y.x,y.y,y.z,R)}for(let A=0,E=x.length;A<E;++A){let C=x[A],R=C.start,w=C.count;for(let P=R,L=R+w;P<L;P+=3)T(t.getX(P+0)),T(t.getX(P+1)),T(t.getX(P+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new ot(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let h=0,d=n.count;h<d;h++)n.setXYZ(h,0,0,0);let i=new M,s=new M,r=new M,o=new M,a=new M,l=new M,u=new M,f=new M;if(t)for(let h=0,d=t.count;h<d;h+=3){let p=t.getX(h+0),m=t.getX(h+1),_=t.getX(h+2);i.fromBufferAttribute(e,p),s.fromBufferAttribute(e,m),r.fromBufferAttribute(e,_),u.subVectors(r,s),f.subVectors(i,s),u.cross(f),o.fromBufferAttribute(n,p),a.fromBufferAttribute(n,m),l.fromBufferAttribute(n,_),o.add(u),a.add(u),l.add(u),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(m,a.x,a.y,a.z),n.setXYZ(_,l.x,l.y,l.z)}else for(let h=0,d=e.count;h<d;h+=3)i.fromBufferAttribute(e,h+0),s.fromBufferAttribute(e,h+1),r.fromBufferAttribute(e,h+2),u.subVectors(r,s),f.subVectors(i,s),u.cross(f),n.setXYZ(h+0,u.x,u.y,u.z),n.setXYZ(h+1,u.x,u.y,u.z),n.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)K.fromBufferAttribute(t,e),K.normalize(),t.setXYZ(e,K.x,K.y,K.z)}toNonIndexed(){function t(o,a){let l=o.array,u=o.itemSize,f=o.normalized,h=new l.constructor(a.length*u),d=0,p=0;for(let m=0,_=a.length;m<_;m++){o.isInterleavedBufferAttribute?d=a[m]*o.data.stride+o.offset:d=a[m]*u;for(let g=0;g<u;g++)h[p++]=l[d++]}return new ot(h,u,f)}if(this.index===null)return Q("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new c,n=this.index.array,i=this.attributes;for(let o in i){let a=i[o],l=t(a,n);e.setAttribute(o,l)}let s=this.morphAttributes;for(let o in s){let a=[],l=s[o];for(let u=0,f=l.length;u<f;u++){let h=l[u],d=t(h,n);a.push(d)}e.morphAttributes[o]=a}e.morphTargetsRelative=this.morphTargetsRelative;let r=this.groups;for(let o=0,a=r.length;o<a;o++){let l=r[o];e.addGroup(l.start,l.count,l.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let a=this.parameters;for(let l in a)a[l]!==void 0&&(t[l]=a[l]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let n=this.attributes;for(let a in n){let l=n[a];t.data.attributes[a]=l.toJSON(t.data)}let i={},s=!1;for(let a in this.morphAttributes){let l=this.morphAttributes[a],u=[];for(let f=0,h=l.length;f<h;f++){let d=l[f];u.push(d.toJSON(t.data))}u.length>0&&(i[a]=u,s=!0)}s&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);let r=this.groups;r.length>0&&(t.data.groups=JSON.parse(JSON.stringify(r)));let o=this.boundingSphere;return o!==null&&(t.data.boundingSphere=o.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let n=t.index;n!==null&&this.setIndex(n.clone());let i=t.attributes;for(let l in i){let u=i[l];this.setAttribute(l,u.clone(e))}let s=t.morphAttributes;for(let l in s){let u=[],f=s[l];for(let h=0,d=f.length;h<d;h++)u.push(f[h].clone(e));this.morphAttributes[l]=u}this.morphTargetsRelative=t.morphTargetsRelative;let r=t.groups;for(let l=0,u=r.length;l<u;l++){let f=r[l];this.addGroup(f.start,f.count,f.materialIndex)}let o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());let a=t.boundingSphere;return a!==null&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};var hi=new M,jr=new M,to=new N,Jt=class{constructor(t=new M(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){let i=hi.subVectors(n,e).cross(jr.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e,n=!0){let i=t.delta(hi),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let r=-(t.start.dot(this.normal)+this.constant)/s;return n===!0&&(r<0||r>1)?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let n=e||to.getNormalMatrix(t),i=this.coplanarPoint(hi).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}};function qs(c){let t={};for(let e in c){t[e]={};for(let n in c[e]){let i=c[e][n];if(Ps(i))i.isRenderTargetTexture?(Q("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=i.clone();else if(Array.isArray(i))if(Ps(i[0])){let s=[];for(let r=0,o=i.length;r<o;r++)s[r]=i[r].clone();t[e][n]=s}else t[e][n]=i.slice();else t[e][n]=i}}return t}function ct(c){let t={};for(let e=0;e<c.length;e++){let n=qs(c[e]);for(let i in n)t[i]=n[i]}return t}function Ps(c){return c&&(c.isColor||c.isMatrix3||c.isMatrix4||c.isVector2||c.isVector3||c.isVector4||c.isTexture||c.isQuaternion)}function rn(c,t){return!c||c.constructor===t?c:typeof t.BYTES_PER_ELEMENT=="number"?new t(c):Array.prototype.slice.call(c)}var Ot=class{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,n=this._cachedIndex,i=e[n],s=e[n-1];n:{t:{let r;e:{i:if(!(t<i)){for(let o=n+2;;){if(i===void 0){if(t<s)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=e[++n],t<i)break t}r=e.length;break e}if(!(t>=s)){let o=e[1];t<o&&(n=2,s=o);for(let a=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=s,s=e[--n-1],t>=s)break t}r=n,n=0;break e}break n}for(;n<r;){let o=n+r>>>1;t<e[o]?r=o:n=o+1}if(i=e[n],s=e[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=t*i;for(let r=0;r!==i;++r)e[r]=n[s+r];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},_n=class extends Ot{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ti,endingEnd:Ti}}intervalChanged_(t,e,n){let i=this.parameterPositions,s=t-2,r=t+1,o=i[s],a=i[r];if(o===void 0)switch(this.getSettings_().endingStart){case Ai:s=t,o=2*e-n;break;case Ei:s=i.length-2,o=e+i[s]-i[s+1];break;default:s=t,o=n}if(a===void 0)switch(this.getSettings_().endingEnd){case Ai:r=t,a=2*n-e;break;case Ei:r=1,a=n+i[1]-i[0];break;default:r=t-1,a=e}let l=(n-e)*.5,u=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(a-n),this._offsetPrev=s*u,this._offsetNext=r*u}interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,u=this._offsetPrev,f=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),m=p*p,_=m*p,g=-h*_+2*h*m-h*p,x=(1+h)*_+(-1.5-2*h)*m+(-.5+h)*p+1,y=(-1-d)*_+(1.5+d)*m+.5*p,S=d*_-d*m;for(let v=0;v!==o;++v)s[v]=g*r[u+v]+x*r[l+v]+y*r[a+v]+S*r[f+v];return s}},xn=class extends Ot{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,u=(n-e)/(i-e),f=1-u;for(let h=0;h!==o;++h)s[h]=r[l+h]*f+r[a+h]*u;return s}},yn=class extends Ot{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}},vn=class extends Ot{interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,u=this.settings||this.DefaultSettings_,f=u.inTangents,h=u.outTangents;if(!f||!h){let m=(n-e)/(i-e),_=1-m;for(let g=0;g!==o;++g)s[g]=r[l+g]*_+r[a+g]*m;return s}let d=o*2,p=t-1;for(let m=0;m!==o;++m){let _=r[l+m],g=r[a+m],x=p*d+m*2,y=h[x],S=h[x+1],v=t*d+m*2,b=f[v],T=f[v+1],A=(n-e)/(i-e),E,C,R,w,P;for(let L=0;L<8;L++){E=A*A,C=E*A,R=1-A,w=R*R,P=w*R;let O=P*e+3*w*A*y+3*R*E*b+C*i-n;if(Math.abs(O)<1e-10)break;let it=3*w*(y-e)+6*R*A*(b-y)+3*E*(i-b);if(Math.abs(it)<1e-10)break;A=A-O/it,A=Math.max(0,Math.min(1,A))}s[m]=P*_+3*w*A*S+3*R*E*T+C*g}return s}},pt=class{constructor(t,e,n,i){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=rn(e,this.TimeBufferType),this.values=rn(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:rn(t.times,Array),values:rn(t.values,Array)};let i=t.getInterpolation();i!==t.DefaultInterpolation&&(n.interpolation=i)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new yn(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new xn(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new _n(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodBezier(t){let e=new vn(this.times,this.values,this.getValueSize(),t);return this.settings&&(e.settings=this.settings),e}setInterpolation(t){let e;switch(t){case De:e=this.InterpolantFactoryMethodDiscrete;break;case ln:e=this.InterpolantFactoryMethodLinear;break;case an:e=this.InterpolantFactoryMethodSmooth;break;case bi:e=this.InterpolantFactoryMethodBezier;break}if(e===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Q("KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return De;case this.InterpolantFactoryMethodLinear:return ln;case this.InterpolantFactoryMethodSmooth:return an;case this.InterpolantFactoryMethodBezier:return bi}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){let n=this.times,i=n.length,s=0,r=i-1;for(;s!==i&&n[s]<t;)++s;for(;r!==-1&&n[r]>e;)--r;if(++r,s!==0||r!==i){s>=r&&(r=Math.max(r,1),s=r-1);let o=this.getValueSize();this.times=n.slice(s,r),this.values=this.values.slice(s*o,r*o)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(G("KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,i=this.values,s=n.length;s===0&&(G("KeyframeTrack: Track is empty.",this),t=!1);let r=null;for(let o=0;o!==s;o++){let a=n[o];if(typeof a=="number"&&isNaN(a)){G("KeyframeTrack: Time is not a valid number.",this,o,a),t=!1;break}if(r!==null&&r>a){G("KeyframeTrack: Out of order keys.",this,o,a,r),t=!1;break}r=a}if(i!==void 0&&Br(i))for(let o=0,a=i.length;o!==a;++o){let l=i[o];if(isNaN(l)){G("KeyframeTrack: Value is not a valid number.",this,o,l),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===an,s=t.length-1,r=1;for(let o=1;o<s;++o){let a=!1,l=t[o],u=t[o+1];if(l!==u&&(o!==1||l!==t[0]))if(i)a=!0;else{let f=o*n,h=f-n,d=f+n;for(let p=0;p!==n;++p){let m=e[f+p];if(m!==e[h+p]||m!==e[d+p]){a=!0;break}}}if(a){if(o!==r){t[r]=t[o];let f=o*n,h=r*n;for(let d=0;d!==n;++d)e[h+d]=e[f+d]}++r}}if(s>0){t[r]=t[s];for(let o=s*n,a=r*n,l=0;l!==n;++l)e[a+l]=e[o+l];++r}return r!==t.length?(this.times=t.slice(0,r),this.values=e.slice(0,r*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}};pt.prototype.ValueTypeName="";pt.prototype.TimeBufferType=Float32Array;pt.prototype.ValueBufferType=Float32Array;pt.prototype.DefaultInterpolation=ln;var zt=class extends pt{constructor(t,e,n){super(t,e,n)}};zt.prototype.ValueTypeName="bool";zt.prototype.ValueBufferType=Array;zt.prototype.DefaultInterpolation=De;zt.prototype.InterpolantFactoryMethodLinear=void 0;zt.prototype.InterpolantFactoryMethodSmooth=void 0;var Mn=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}};Mn.prototype.ValueTypeName="color";var Sn=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}};Sn.prototype.ValueTypeName="number";var bn=class extends Ot{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=(n-e)/(i-e),l=t*o;for(let u=l+o;l!==u;l+=4)Lt.slerpFlat(s,0,r,l-o,r,l,a);return s}},Fe=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}InterpolantFactoryMethodLinear(t){return new bn(this.times,this.values,this.getValueSize(),t)}};Fe.prototype.ValueTypeName="quaternion";Fe.prototype.InterpolantFactoryMethodSmooth=void 0;var Vt=class extends pt{constructor(t,e,n){super(t,e,n)}};Vt.prototype.ValueTypeName="string";Vt.prototype.ValueBufferType=Array;Vt.prototype.DefaultInterpolation=De;Vt.prototype.InterpolantFactoryMethodLinear=void 0;Vt.prototype.InterpolantFactoryMethodSmooth=void 0;var Tn=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}};Tn.prototype.ValueTypeName="vector";var An=class{constructor(t,e,n){let i=this,s=!1,r=0,o=0,a,l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this._abortController=null,this.itemStart=function(u){o++,s===!1&&i.onStart!==void 0&&i.onStart(u,r,o),s=!0},this.itemEnd=function(u){r++,i.onProgress!==void 0&&i.onProgress(u,r,o),r===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return a?a(u):u},this.setURLModifier=function(u){return a=u,this},this.addHandler=function(u,f){return l.push(u,f),this},this.removeHandler=function(u){let f=l.indexOf(u);return f!==-1&&l.splice(f,2),this},this.getHandler=function(u){for(let f=0,h=l.length;f<h;f+=2){let d=l[f],p=l[f+1];if(d.global&&(d.lastIndex=0),d.test(u))return p}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},Ys=new An,En=class{constructor(t){this.manager=t!==void 0?t:Ys,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(t,e){let n=this;return new Promise(function(i,s){n.load(t,i,e,s)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}};En.DEFAULT_MATERIAL_NAME="__DEFAULT";var Yi="\\\\[\\\\]\\\\.:\\\\/",eo=new RegExp("["+Yi+"]","g"),Zi="[^"+Yi+"]",no="[^"+Yi.replace("\\\\.","")+"]",io=/((?:WC+[\\/:])*)/.source.replace("WC",Zi),so=/(WCOD+)?/.source.replace("WCOD",no),ro=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Zi),oo=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Zi),ao=new RegExp("^"+io+so+ro+oo+"$"),co=["material","materials","bones","map"],Di=class{constructor(t,e,n){let i=n||k.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},k=class c{constructor(t,e,n){this.path=e,this.parsedPath=n||c.parseTrackName(e),this.node=c.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new c.Composite(t,e,n):new c(t,e,n)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(eo,"")}static parseTrackName(t){let e=ao.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let s=n.nodeName.substring(i+1);co.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(s){for(let r=0;r<s.length;r++){let o=s[r];if(o.name===e||o.uuid===e)return o;let a=n(o.children);if(a)return a}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,n=e.objectName,i=e.propertyName,s=e.propertyIndex;if(t||(t=c.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){Q("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=e.objectIndex;switch(n){case"materials":if(!t.material){G("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){G("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){G("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let u=0;u<t.length;u++)if(t[u].name===l){l=u;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){G("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){G("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){G("PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(l!==void 0){if(t[l]===void 0){G("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[l]}}let r=t[i];if(r===void 0){let l=e.nodeName;G("PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",t);return}let o=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?o=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!t.geometry){G("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){G("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[s]!==void 0&&(s=t.morphTargetDictionary[s])}a=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s}else r.fromArray!==void 0&&r.toArray!==void 0?(a=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(a=this.BindingType.EntireArray,this.resolvedProperty=r):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};k.Composite=Di;k.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};k.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};k.prototype.GetterByBindingType=[k.prototype._getValue_direct,k.prototype._getValue_array,k.prototype._getValue_arrayElement,k.prototype._getValue_toArray];k.prototype.SetterByBindingTypeAndVersioning=[[k.prototype._setValue_direct,k.prototype._setValue_direct_setNeedsUpdate,k.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[k.prototype._setValue_array,k.prototype._setValue_array_setNeedsUpdate,k.prototype._setValue_array_setMatrixWorldNeedsUpdate],[k.prototype._setValue_arrayElement,k.prototype._setValue_arrayElement_setNeedsUpdate,k.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[k.prototype._setValue_fromArray,k.prototype._setValue_fromArray_setNeedsUpdate,k.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var vl=new Float32Array(1);var Ni=class c{static{c.prototype.isMatrix2=!0}constructor(t,e,n,i){this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,i){let s=this.elements;return s[0]=t,s[2]=e,s[1]=n,s[3]=i,this}};var Is=new M,on=new M,le=new M,ue=new M,fi=new M,lo=new M,uo=new M,at=class{constructor(t=new M,e=new M){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Is.subVectors(t,this.start),on.subVectors(this.end,this.start);let n=on.dot(on);if(n===0)return 0;let s=on.dot(Is)/n;return e&&(s=U(s,0,1)),s}closestPointToPoint(t,e,n){let i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(t,e=lo,n=uo){let i=10000000000000001e-32,s,r,o=this.start,a=t.start,l=this.end,u=t.end;le.subVectors(l,o),ue.subVectors(u,a),fi.subVectors(o,a);let f=le.dot(le),h=ue.dot(ue),d=ue.dot(fi);if(f<=i&&h<=i)return e.copy(o),n.copy(a),e.sub(n),e.dot(e);if(f<=i)s=0,r=d/h,r=U(r,0,1);else{let p=le.dot(fi);if(h<=i)r=0,s=U(-p/f,0,1);else{let m=le.dot(ue),_=f*h-m*m;_!==0?s=U((m*d-p*h)/_,0,1):s=0,r=(m*s+d)/h,r<0?(r=0,s=U(-p/f,0,1)):r>1&&(r=1,s=U((m-p)/f,0,1))}}return e.copy(o).addScaledVector(le,s),n.copy(a).addScaledVector(ue,r),e.distanceToSquared(n)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));typeof window<"u"&&(window.__THREE__?Q("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="184");var ho=\`#ifdef USE_ALPHAHASH
|
|
1
|
+
"use strict";"use client";var Ua=Object.create;var Ze=Object.defineProperty;var Oa=Object.getOwnPropertyDescriptor;var ka=Object.getOwnPropertyNames;var Ba=Object.getPrototypeOf,za=Object.prototype.hasOwnProperty;var Ke=(e,t)=>()=>(e&&(t=e(e=0)),t);var $e=(e,t)=>{for(var n in t)Ze(e,n,{get:t[n],enumerable:!0})},Un=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ka(t))!za.call(e,i)&&i!==n&&Ze(e,i,{get:()=>t[i],enumerable:!(r=Oa(t,i))||r.enumerable});return e};var Re=(e,t,n)=>(n=e!=null?Ua(Ba(e)):{},Un(t||!e||!e.__esModule?Ze(n,"default",{value:e,enumerable:!0}):n,e)),Va=e=>Un(Ze({},"__esModule",{value:!0}),e);function Qe(e){return e instanceof pe||e instanceof Error&&e.message.includes(tr)}var tr,pe,et=Ke(()=>{"use strict";tr="This PLY file is a point cloud: it has vertices but no faces.",pe=class extends Error{constructor(){super(tr),this.name="PointCloudError"}}});var Tr={};$e(Tr,{PointCloudError:()=>pe,isPointCloudError:()=>Qe,meshNameFromPath:()=>Mo,parsePly:()=>So,parseStl:()=>wo,plyHasFaces:()=>Er});function Mo(e,t){let n=e.split(/[?#]/,1)[0],r=n.slice(n.lastIndexOf("/")+1);try{r=decodeURIComponent(r)}catch{}return r.replace(/\.[^.]*$/,"").trim()||t}function Bt(e){return new H.MeshStandardMaterial({color:e?16777215:bo,vertexColors:e,metalness:0,roughness:.6})}function wr(e,t,n){let r=e.itemSize;return new H.Float32BufferAttribute(e.array.slice(t*r,(t+n)*r),r)}function wo(e,t){let n=new Sr.STLLoader().parse(e),r=!!n.hasColors,i=new H.Group;if(n.groups.length>1){let l=n.userData.groupNames??[],o=n.getAttribute("position"),u=n.getAttribute("normal");return n.groups.forEach((d,m)=>{let _=new H.BufferGeometry;_.setAttribute("position",wr(o,d.start,d.count)),u&&_.setAttribute("normal",wr(u,d.start,d.count));let p=new H.Mesh(_,Bt(!1));p.name=l[m]?.trim()||`${t} ${m+1}`,i.add(p)}),n.dispose(),i}n.clearGroups();let a=Bt(r);r&&n.alpha!==void 0&&n.alpha<1&&(a.opacity=n.alpha,a.transparent=!0);let s=new H.Mesh(n,a);return s.name=t,i.add(s),i}function Er(e){let n=new TextDecoder().decode(new Uint8Array(e,0,Math.min(e.byteLength,65536))).split("end_header",1)[0],r=/^\s*element\s+face\s+(\d+)/m.exec(n);return!!(r&&Number(r[1])>0)}function So(e,t){if(!Er(e))throw new pe;let n=new Ar.PLYLoader().parse(e);n.getAttribute("normal")||n.computeVertexNormals();let r=new H.Mesh(n,Bt(!!n.getAttribute("color")));r.name=t;let i=new H.Group;return i.add(r),i}var H,Sr,Ar,bo,Cr=Ke(()=>{"use strict";H=require("three"),Sr=require("three/examples/jsm/loaders/STLLoader.js"),Ar=require("three/examples/jsm/loaders/PLYLoader.js");et();et();bo=12106948});var di={};$e(di,{bvhWorkerCode:()=>Ho});var Ho,ui=Ke(()=>{"use strict";Ho=`(()=>{var Ls=1;var Ds=3,wn=0,Ui=1,Fi=2;var di=0,pi=1,mi=2,gi=3,_i=4,xi=5,yi=6,vi=7,Ns=0,Us=1,Fs=2;var Bi=1,Oi=2,zi=3,Vi=4,ki=5,Gi=6,Hi=7;var Wi=300,Bs=301,Xi=302;var Os=306,Mi=1e3,Ie=1001,Si=1002;var zs=1006;var Vs=1008;var ks=1009;var Gs=1015;var Hs=1023;var De=2300,ln=2301,an=2302,bi=2303,Ti=2400,Ai=2401,Ei=2402;var qi="",_t="srgb",wi="srgb-linear",Ci="linear",cn="srgb";var Ri=35044;var Le=2e3,Pi=2001;function Fr(c){for(let t=c.length-1;t>=0;--t)if(c[t]>=65535)return!0;return!1}function Br(c){return ArrayBuffer.isView(c)&&!(c instanceof DataView)}function Ii(c){return document.createElementNS("http://www.w3.org/1999/xhtml",c)}var xs={},un=null;function Ws(c){let t=c[0];if(typeof t=="string"&&t.startsWith("TSL:")){let e=c[1];e&&e.isStackTrace?c[0]+=" "+e.getLocation():c[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return c}function Q(...c){c=Ws(c);let t="THREE."+c.shift();if(un)un("warn",t,...c);else{let e=c[0];e&&e.isStackTrace?console.warn(e.getError(t)):console.warn(t,...c)}}function G(...c){c=Ws(c);let t="THREE."+c.shift();if(un)un("error",t,...c);else{let e=c[0];e&&e.isStackTrace?console.error(e.getError(t)):console.error(t,...c)}}function Li(...c){let t=c.join(" ");t in xs||(xs[t]=!0,Q(...c))}var Or={[di]:pi,[mi]:yi,[_i]:vi,[gi]:xi,[pi]:di,[yi]:mi,[vi]:_i,[xi]:gi},Yt=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[t]===void 0&&(n[t]=[]),n[t].indexOf(e)===-1&&n[t].push(e)}hasEventListener(t,e){let n=this._listeners;return n===void 0?!1:n[t]!==void 0&&n[t].indexOf(e)!==-1}removeEventListener(t,e){let n=this._listeners;if(n===void 0)return;let i=n[t];if(i!==void 0){let s=i.indexOf(e);s!==-1&&i.splice(s,1)}}dispatchEvent(t){let e=this._listeners;if(e===void 0)return;let n=e[t.type];if(n!==void 0){t.target=this;let i=n.slice(0);for(let s=0,r=i.length;s<r;s++)i[s].call(this,t);t.target=null}}},st=["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"];var yl=Math.PI/180,zr=180/Math.PI;function Cn(){let c=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(st[c&255]+st[c>>8&255]+st[c>>16&255]+st[c>>24&255]+"-"+st[t&255]+st[t>>8&255]+"-"+st[t>>16&15|64]+st[t>>24&255]+"-"+st[e&63|128]+st[e>>8&255]+"-"+st[e>>16&255]+st[e>>24&255]+st[n&255]+st[n>>8&255]+st[n>>16&255]+st[n>>24&255]).toLowerCase()}function U(c,t,e){return Math.max(t,Math.min(e,c))}function Vr(c,t){return(c%t+t)%t}function Zn(c,t,e){return(1-e)*c+e*t}function Ee(c,t){switch(t.constructor){case Float32Array:return c;case Uint32Array:return c/4294967295;case Uint16Array:return c/65535;case Uint8Array:return c/255;case Int32Array:return Math.max(c/2147483647,-1);case Int16Array:return Math.max(c/32767,-1);case Int8Array:return Math.max(c/127,-1);default:throw new Error("Invalid component type.")}}function ut(c,t){switch(t.constructor){case Float32Array:return c;case Uint32Array:return Math.round(c*4294967295);case Uint16Array:return Math.round(c*65535);case Uint8Array:return Math.round(c*255);case Int32Array:return Math.round(c*2147483647);case Int16Array:return Math.round(c*32767);case Int8Array:return Math.round(c*127);default:throw new Error("Invalid component type.")}}var H=class c{static{c.prototype.isVector2=!0}constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=U(this.x,t.x,e.x),this.y=U(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=U(this.x,t,e),this.y=U(this.y,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(U(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(U(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let n=Math.cos(e),i=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*n-r*i+t.x,this.y=s*i+r*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Lt=class{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,s,r,o){let a=n[i+0],l=n[i+1],u=n[i+2],f=n[i+3],h=s[r+0],d=s[r+1],p=s[r+2],m=s[r+3];if(f!==m||a!==h||l!==d||u!==p){let _=a*h+l*d+u*p+f*m;_<0&&(h=-h,d=-d,p=-p,m=-m,_=-_);let g=1-o;if(_<.9995){let x=Math.acos(_),y=Math.sin(x);g=Math.sin(g*x)/y,o=Math.sin(o*x)/y,a=a*g+h*o,l=l*g+d*o,u=u*g+p*o,f=f*g+m*o}else{a=a*g+h*o,l=l*g+d*o,u=u*g+p*o,f=f*g+m*o;let x=1/Math.sqrt(a*a+l*l+u*u+f*f);a*=x,l*=x,u*=x,f*=x}}t[e]=a,t[e+1]=l,t[e+2]=u,t[e+3]=f}static multiplyQuaternionsFlat(t,e,n,i,s,r){let o=n[i],a=n[i+1],l=n[i+2],u=n[i+3],f=s[r],h=s[r+1],d=s[r+2],p=s[r+3];return t[e]=o*p+u*f+a*d-l*h,t[e+1]=a*p+u*h+l*f-o*d,t[e+2]=l*p+u*d+o*h-a*f,t[e+3]=u*p-o*f-a*h-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let n=t._x,i=t._y,s=t._z,r=t._order,o=Math.cos,a=Math.sin,l=o(n/2),u=o(i/2),f=o(s/2),h=a(n/2),d=a(i/2),p=a(s/2);switch(r){case"XYZ":this._x=h*u*f+l*d*p,this._y=l*d*f-h*u*p,this._z=l*u*p+h*d*f,this._w=l*u*f-h*d*p;break;case"YXZ":this._x=h*u*f+l*d*p,this._y=l*d*f-h*u*p,this._z=l*u*p-h*d*f,this._w=l*u*f+h*d*p;break;case"ZXY":this._x=h*u*f-l*d*p,this._y=l*d*f+h*u*p,this._z=l*u*p+h*d*f,this._w=l*u*f-h*d*p;break;case"ZYX":this._x=h*u*f-l*d*p,this._y=l*d*f+h*u*p,this._z=l*u*p-h*d*f,this._w=l*u*f+h*d*p;break;case"YZX":this._x=h*u*f+l*d*p,this._y=l*d*f+h*u*p,this._z=l*u*p-h*d*f,this._w=l*u*f-h*d*p;break;case"XZY":this._x=h*u*f-l*d*p,this._y=l*d*f-h*u*p,this._z=l*u*p+h*d*f,this._w=l*u*f+h*d*p;break;default:Q("Quaternion: .setFromEuler() encountered an unknown order: "+r)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,n=e[0],i=e[4],s=e[8],r=e[1],o=e[5],a=e[9],l=e[2],u=e[6],f=e[10],h=n+o+f;if(h>0){let d=.5/Math.sqrt(h+1);this._w=.25/d,this._x=(u-a)*d,this._y=(s-l)*d,this._z=(r-i)*d}else if(n>o&&n>f){let d=2*Math.sqrt(1+n-o-f);this._w=(u-a)/d,this._x=.25*d,this._y=(i+r)/d,this._z=(s+l)/d}else if(o>f){let d=2*Math.sqrt(1+o-n-f);this._w=(s-l)/d,this._x=(i+r)/d,this._y=.25*d,this._z=(a+u)/d}else{let d=2*Math.sqrt(1+f-n-o);this._w=(r-i)/d,this._x=(s+l)/d,this._y=(a+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<1e-8?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(U(this.dot(t),-1,1)))}rotateTowards(t,e){let n=this.angleTo(t);if(n===0)return this;let i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let n=t._x,i=t._y,s=t._z,r=t._w,o=e._x,a=e._y,l=e._z,u=e._w;return this._x=n*u+r*o+i*l-s*a,this._y=i*u+r*a+s*o-n*l,this._z=s*u+r*l+n*a-i*o,this._w=r*u-n*o-i*a-s*l,this._onChangeCallback(),this}slerp(t,e){let n=t._x,i=t._y,s=t._z,r=t._w,o=this.dot(t);o<0&&(n=-n,i=-i,s=-s,r=-r,o=-o);let a=1-e;if(o<.9995){let l=Math.acos(o),u=Math.sin(l);a=Math.sin(a*l)/u,e=Math.sin(e*l)/u,this._x=this._x*a+n*e,this._y=this._y*a+i*e,this._z=this._z*a+s*e,this._w=this._w*a+r*e,this._onChangeCallback()}else this._x=this._x*a+n*e,this._y=this._y*a+i*e,this._z=this._z*a+s*e,this._w=this._w*a+r*e,this.normalize();return this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},M=class c{static{c.prototype.isVector3=!0}constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return n===void 0&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(ys.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ys.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[3]*n+s[6]*i,this.y=s[1]*e+s[4]*n+s[7]*i,this.z=s[2]*e+s[5]*n+s[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,s=t.elements,r=1/(s[3]*e+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*e+s[4]*n+s[8]*i+s[12])*r,this.y=(s[1]*e+s[5]*n+s[9]*i+s[13])*r,this.z=(s[2]*e+s[6]*n+s[10]*i+s[14])*r,this}applyQuaternion(t){let e=this.x,n=this.y,i=this.z,s=t.x,r=t.y,o=t.z,a=t.w,l=2*(r*i-o*n),u=2*(o*e-s*i),f=2*(s*n-r*e);return this.x=e+a*l+r*f-o*u,this.y=n+a*u+o*l-s*f,this.z=i+a*f+s*u-r*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,n=this.y,i=this.z,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i,this.y=s[1]*e+s[5]*n+s[9]*i,this.z=s[2]*e+s[6]*n+s[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=U(this.x,t.x,e.x),this.y=U(this.y,t.y,e.y),this.z=U(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=U(this.x,t,e),this.y=U(this.y,t,e),this.z=U(this.z,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(U(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let n=t.x,i=t.y,s=t.z,r=e.x,o=e.y,a=e.z;return this.x=i*a-s*o,this.y=s*r-n*a,this.z=n*o-i*r,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Jn.copy(this).projectOnVector(t),this.sub(Jn)}reflect(t){return this.sub(Jn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let n=this.dot(t)/e;return Math.acos(U(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){let i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Jn=new M,ys=new Lt,N=class c{static{c.prototype.isMatrix3=!0}constructor(t,e,n,i,s,r,o,a,l){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,r,o,a,l)}set(t,e,n,i,s,r,o,a,l){let u=this.elements;return u[0]=t,u[1]=i,u[2]=o,u[3]=e,u[4]=s,u[5]=a,u[6]=n,u[7]=r,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,i=e.elements,s=this.elements,r=n[0],o=n[3],a=n[6],l=n[1],u=n[4],f=n[7],h=n[2],d=n[5],p=n[8],m=i[0],_=i[3],g=i[6],x=i[1],y=i[4],S=i[7],v=i[2],b=i[5],T=i[8];return s[0]=r*m+o*x+a*v,s[3]=r*_+o*y+a*b,s[6]=r*g+o*S+a*T,s[1]=l*m+u*x+f*v,s[4]=l*_+u*y+f*b,s[7]=l*g+u*S+f*T,s[2]=h*m+d*x+p*v,s[5]=h*_+d*y+p*b,s[8]=h*g+d*S+p*T,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],r=t[4],o=t[5],a=t[6],l=t[7],u=t[8];return e*r*u-e*o*l-n*s*u+n*o*a+i*s*l-i*r*a}invert(){let t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],r=t[4],o=t[5],a=t[6],l=t[7],u=t[8],f=u*r-o*l,h=o*a-u*s,d=l*s-r*a,p=e*f+n*h+i*d;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return t[0]=f*m,t[1]=(i*l-u*n)*m,t[2]=(o*n-i*r)*m,t[3]=h*m,t[4]=(u*e-i*a)*m,t[5]=(i*s-o*e)*m,t[6]=d*m,t[7]=(n*a-l*e)*m,t[8]=(r*e-n*s)*m,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,s,r,o){let a=Math.cos(s),l=Math.sin(s);return this.set(n*a,n*l,-n*(a*r+l*o)+r+t,-i*l,i*a,-i*(-l*r+a*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply($n.makeScale(t,e)),this}rotate(t){return this.premultiply($n.makeRotation(-t)),this}translate(t,e){return this.premultiply($n.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,n=t.elements;for(let i=0;i<9;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return new this.constructor().fromArray(this.elements)}},$n=new N,vs=new N().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ms=new N().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function kr(){let c={enabled:!0,workingColorSpace:wi,spaces:{},convert:function(i,s,r){return this.enabled===!1||s===r||!s||!r||(this.spaces[s].transfer===cn&&(i.r=It(i.r),i.g=It(i.g),i.b=It(i.b)),this.spaces[s].primaries!==this.spaces[r].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[r].fromXYZ)),this.spaces[r].transfer===cn&&(i.r=he(i.r),i.g=he(i.g),i.b=he(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===qi?Ci:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,r){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[r].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return Li("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),c.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Li("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),c.colorSpaceToWorking(i,s)}},t=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],n=[.3127,.329];return c.define({[wi]:{primaries:t,whitePoint:n,transfer:Ci,toXYZ:vs,fromXYZ:Ms,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:_t},outputColorSpaceConfig:{drawingBufferColorSpace:_t}},[_t]:{primaries:t,whitePoint:n,transfer:cn,toXYZ:vs,fromXYZ:Ms,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:_t}}}),c}var gt=kr();function It(c){return c<.04045?c*.0773993808:Math.pow(c*.9478672986+.0521327014,2.4)}function he(c){return c<.0031308?c*12.92:1.055*Math.pow(c,.41666)-.055}var jt,hn=class{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{jt===void 0&&(jt=Ii("canvas")),jt.width=t.width,jt.height=t.height;let i=jt.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),n=jt}return n.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){let e=Ii("canvas");e.width=t.width,e.height=t.height;let n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);let i=n.getImageData(0,0,t.width,t.height),s=i.data;for(let r=0;r<s.length;r++)s[r]=It(s[r]/255)*255;return n.putImageData(i,0,0),e}else if(t.data){let e=t.data.slice(0);for(let n=0;n<e.length;n++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[n]=Math.floor(It(e[n]/255)*255):e[n]=It(e[n]);return{data:e,width:t.width,height:t.height}}else return Q("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},Gr=0,fn=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Gr++}),this.uuid=Cn(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){let e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let r=0,o=i.length;r<o;r++)i[r].isDataTexture?s.push(Kn(i[r].image)):s.push(Kn(i[r]))}else s=Kn(i);n.url=s}return e||(t.images[this.uuid]=n),n}};function Kn(c){return typeof HTMLImageElement<"u"&&c instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&c instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&c instanceof ImageBitmap?hn.getDataURL(c):c.data?{data:Array.from(c.data),width:c.width,height:c.height,type:c.data.constructor.name}:(Q("Texture: Unable to serialize Texture."),{})}var Hr=0,Qn=new M,fe=class c extends Yt{constructor(t=c.DEFAULT_IMAGE,e=c.DEFAULT_MAPPING,n=Ie,i=Ie,s=zs,r=Vs,o=Hs,a=ks,l=c.DEFAULT_ANISOTROPY,u=qi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Hr++}),this.uuid=Cn(),this.name="",this.source=new fn(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=r,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new H(0,0),this.repeat=new H(1,1),this.center=new H(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new N,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Qn).x}get height(){return this.source.getSize(Qn).y}get depth(){return this.source.getSize(Qn).z}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(let e in t){let n=t[e];if(n===void 0){Q(\`Texture.setValues(): parameter '\${e}' has value of undefined.\`);continue}let i=this[e];if(i===void 0){Q(\`Texture.setValues(): property '\${e}' does not exist.\`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[e]=n}}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,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&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Wi)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case Mi:t.x=t.x-Math.floor(t.x);break;case Ie:t.x=t.x<0?0:1;break;case Si:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case Mi:t.y=t.y-Math.floor(t.y);break;case Ie:t.y=t.y<0?0:1;break;case Si:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}};fe.DEFAULT_IMAGE=null;fe.DEFAULT_MAPPING=Wi;fe.DEFAULT_ANISOTROPY=1;var de=class c{static{c.prototype.isVector4=!0}constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,n=this.y,i=this.z,s=this.w,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i+r[12]*s,this.y=r[1]*e+r[5]*n+r[9]*i+r[13]*s,this.z=r[2]*e+r[6]*n+r[10]*i+r[14]*s,this.w=r[3]*e+r[7]*n+r[11]*i+r[15]*s,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,s,a=t.elements,l=a[0],u=a[4],f=a[8],h=a[1],d=a[5],p=a[9],m=a[2],_=a[6],g=a[10];if(Math.abs(u-h)<.01&&Math.abs(f-m)<.01&&Math.abs(p-_)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+m)<.1&&Math.abs(p+_)<.1&&Math.abs(l+d+g-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let y=(l+1)/2,S=(d+1)/2,v=(g+1)/2,b=(u+h)/4,T=(f+m)/4,A=(p+_)/4;return y>S&&y>v?y<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(y),i=b/n,s=T/n):S>v?S<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(S),n=b/i,s=A/i):v<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(v),n=T/s,i=A/s),this.set(n,i,s,e),this}let x=Math.sqrt((_-p)*(_-p)+(f-m)*(f-m)+(h-u)*(h-u));return Math.abs(x)<.001&&(x=1),this.x=(_-p)/x,this.y=(f-m)/x,this.z=(h-u)/x,this.w=Math.acos((l+d+g-1)/2),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=U(this.x,t.x,e.x),this.y=U(this.y,t.y,e.y),this.z=U(this.z,t.z,e.z),this.w=U(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=U(this.x,t,e),this.y=U(this.y,t,e),this.z=U(this.z,t,e),this.w=U(this.w,t,e),this}clampLength(t,e){let n=this.length();return this.divideScalar(n||1).multiplyScalar(U(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};var W=class c{static{c.prototype.isMatrix4=!0}constructor(t,e,n,i,s,r,o,a,l,u,f,h,d,p,m,_){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,n,i,s,r,o,a,l,u,f,h,d,p,m,_)}set(t,e,n,i,s,r,o,a,l,u,f,h,d,p,m,_){let g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=s,g[5]=r,g[9]=o,g[13]=a,g[2]=l,g[6]=u,g[10]=f,g[14]=h,g[3]=d,g[7]=p,g[11]=m,g[15]=_,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 c().fromArray(this.elements)}copy(t){let e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){let e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return this.determinant()===0?(t.set(1,0,0),e.set(0,1,0),n.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){if(t.determinant()===0)return this.identity();let e=this.elements,n=t.elements,i=1/te.setFromMatrixColumn(t,0).length(),s=1/te.setFromMatrixColumn(t,1).length(),r=1/te.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*s,e[5]=n[5]*s,e[6]=n[6]*s,e[7]=0,e[8]=n[8]*r,e[9]=n[9]*r,e[10]=n[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,n=t.x,i=t.y,s=t.z,r=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),u=Math.cos(s),f=Math.sin(s);if(t.order==="XYZ"){let h=r*u,d=r*f,p=o*u,m=o*f;e[0]=a*u,e[4]=-a*f,e[8]=l,e[1]=d+p*l,e[5]=h-m*l,e[9]=-o*a,e[2]=m-h*l,e[6]=p+d*l,e[10]=r*a}else if(t.order==="YXZ"){let h=a*u,d=a*f,p=l*u,m=l*f;e[0]=h+m*o,e[4]=p*o-d,e[8]=r*l,e[1]=r*f,e[5]=r*u,e[9]=-o,e[2]=d*o-p,e[6]=m+h*o,e[10]=r*a}else if(t.order==="ZXY"){let h=a*u,d=a*f,p=l*u,m=l*f;e[0]=h-m*o,e[4]=-r*f,e[8]=p+d*o,e[1]=d+p*o,e[5]=r*u,e[9]=m-h*o,e[2]=-r*l,e[6]=o,e[10]=r*a}else if(t.order==="ZYX"){let h=r*u,d=r*f,p=o*u,m=o*f;e[0]=a*u,e[4]=p*l-d,e[8]=h*l+m,e[1]=a*f,e[5]=m*l+h,e[9]=d*l-p,e[2]=-l,e[6]=o*a,e[10]=r*a}else if(t.order==="YZX"){let h=r*a,d=r*l,p=o*a,m=o*l;e[0]=a*u,e[4]=m-h*f,e[8]=p*f+d,e[1]=f,e[5]=r*u,e[9]=-o*u,e[2]=-l*u,e[6]=d*f+p,e[10]=h-m*f}else if(t.order==="XZY"){let h=r*a,d=r*l,p=o*a,m=o*l;e[0]=a*u,e[4]=-f,e[8]=l*u,e[1]=h*f+m,e[5]=r*u,e[9]=d*f-p,e[2]=p*f-d,e[6]=o*u,e[10]=m*f+h}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Wr,t,Xr)}lookAt(t,e,n){let i=this.elements;return ft.subVectors(t,e),ft.lengthSq()===0&&(ft.z=1),ft.normalize(),Nt.crossVectors(n,ft),Nt.lengthSq()===0&&(Math.abs(n.z)===1?ft.x+=1e-4:ft.z+=1e-4,ft.normalize(),Nt.crossVectors(n,ft)),Nt.normalize(),Ke.crossVectors(ft,Nt),i[0]=Nt.x,i[4]=Ke.x,i[8]=ft.x,i[1]=Nt.y,i[5]=Ke.y,i[9]=ft.y,i[2]=Nt.z,i[6]=Ke.z,i[10]=ft.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let n=t.elements,i=e.elements,s=this.elements,r=n[0],o=n[4],a=n[8],l=n[12],u=n[1],f=n[5],h=n[9],d=n[13],p=n[2],m=n[6],_=n[10],g=n[14],x=n[3],y=n[7],S=n[11],v=n[15],b=i[0],T=i[4],A=i[8],E=i[12],C=i[1],R=i[5],w=i[9],P=i[13],L=i[2],D=i[6],O=i[10],it=i[14],Tt=i[3],At=i[7],Je=i[11],$e=i[15];return s[0]=r*b+o*C+a*L+l*Tt,s[4]=r*T+o*R+a*D+l*At,s[8]=r*A+o*w+a*O+l*Je,s[12]=r*E+o*P+a*it+l*$e,s[1]=u*b+f*C+h*L+d*Tt,s[5]=u*T+f*R+h*D+d*At,s[9]=u*A+f*w+h*O+d*Je,s[13]=u*E+f*P+h*it+d*$e,s[2]=p*b+m*C+_*L+g*Tt,s[6]=p*T+m*R+_*D+g*At,s[10]=p*A+m*w+_*O+g*Je,s[14]=p*E+m*P+_*it+g*$e,s[3]=x*b+y*C+S*L+v*Tt,s[7]=x*T+y*R+S*D+v*At,s[11]=x*A+y*w+S*O+v*Je,s[15]=x*E+y*P+S*it+v*$e,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],n=t[4],i=t[8],s=t[12],r=t[1],o=t[5],a=t[9],l=t[13],u=t[2],f=t[6],h=t[10],d=t[14],p=t[3],m=t[7],_=t[11],g=t[15],x=a*d-l*h,y=o*d-l*f,S=o*h-a*f,v=r*d-l*u,b=r*h-a*u,T=r*f-o*u;return e*(m*x-_*y+g*S)-n*(p*x-_*v+g*b)+i*(p*y-m*v+g*T)-s*(p*S-m*b+_*T)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){let i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){let t=this.elements,e=t[0],n=t[1],i=t[2],s=t[3],r=t[4],o=t[5],a=t[6],l=t[7],u=t[8],f=t[9],h=t[10],d=t[11],p=t[12],m=t[13],_=t[14],g=t[15],x=e*o-n*r,y=e*a-i*r,S=e*l-s*r,v=n*a-i*o,b=n*l-s*o,T=i*l-s*a,A=u*m-f*p,E=u*_-h*p,C=u*g-d*p,R=f*_-h*m,w=f*g-d*m,P=h*g-d*_,L=x*P-y*w+S*R+v*C-b*E+T*A;if(L===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let D=1/L;return t[0]=(o*P-a*w+l*R)*D,t[1]=(i*w-n*P-s*R)*D,t[2]=(m*T-_*b+g*v)*D,t[3]=(h*b-f*T-d*v)*D,t[4]=(a*C-r*P-l*E)*D,t[5]=(e*P-i*C+s*E)*D,t[6]=(_*S-p*T-g*y)*D,t[7]=(u*T-h*S+d*y)*D,t[8]=(r*w-o*C+l*A)*D,t[9]=(n*C-e*w-s*A)*D,t[10]=(p*b-m*S+g*x)*D,t[11]=(f*S-u*b-d*x)*D,t[12]=(o*E-r*R-a*A)*D,t[13]=(e*R-n*E+i*A)*D,t[14]=(m*y-p*v-_*x)*D,t[15]=(u*v-f*y+h*x)*D,this}scale(t){let e=this.elements,n=t.x,i=t.y,s=t.z;return e[0]*=n,e[4]*=i,e[8]*=s,e[1]*=n,e[5]*=i,e[9]*=s,e[2]*=n,e[6]*=i,e[10]*=s,e[3]*=n,e[7]*=i,e[11]*=s,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let n=Math.cos(e),i=Math.sin(e),s=1-n,r=t.x,o=t.y,a=t.z,l=s*r,u=s*o;return this.set(l*r+n,l*o-i*a,l*a+i*o,0,l*o+i*a,u*o+n,u*a-i*r,0,l*a-i*o,u*a+i*r,s*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,s,r){return this.set(1,n,s,0,t,1,r,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){let i=this.elements,s=e._x,r=e._y,o=e._z,a=e._w,l=s+s,u=r+r,f=o+o,h=s*l,d=s*u,p=s*f,m=r*u,_=r*f,g=o*f,x=a*l,y=a*u,S=a*f,v=n.x,b=n.y,T=n.z;return i[0]=(1-(m+g))*v,i[1]=(d+S)*v,i[2]=(p-y)*v,i[3]=0,i[4]=(d-S)*b,i[5]=(1-(h+g))*b,i[6]=(_+x)*b,i[7]=0,i[8]=(p+y)*T,i[9]=(_-x)*T,i[10]=(1-(h+m))*T,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){let i=this.elements;t.x=i[12],t.y=i[13],t.z=i[14];let s=this.determinant();if(s===0)return n.set(1,1,1),e.identity(),this;let r=te.set(i[0],i[1],i[2]).length(),o=te.set(i[4],i[5],i[6]).length(),a=te.set(i[8],i[9],i[10]).length();s<0&&(r=-r),yt.copy(this);let l=1/r,u=1/o,f=1/a;return yt.elements[0]*=l,yt.elements[1]*=l,yt.elements[2]*=l,yt.elements[4]*=u,yt.elements[5]*=u,yt.elements[6]*=u,yt.elements[8]*=f,yt.elements[9]*=f,yt.elements[10]*=f,e.setFromRotationMatrix(yt),n.x=r,n.y=o,n.z=a,this}makePerspective(t,e,n,i,s,r,o=Le,a=!1){let l=this.elements,u=2*s/(e-t),f=2*s/(n-i),h=(e+t)/(e-t),d=(n+i)/(n-i),p,m;if(a)p=s/(r-s),m=r*s/(r-s);else if(o===Le)p=-(r+s)/(r-s),m=-2*r*s/(r-s);else if(o===Pi)p=-r/(r-s),m=-r*s/(r-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=f,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,n,i,s,r,o=Le,a=!1){let l=this.elements,u=2/(e-t),f=2/(n-i),h=-(e+t)/(e-t),d=-(n+i)/(n-i),p,m;if(a)p=1/(r-s),m=r/(r-s);else if(o===Le)p=-2/(r-s),m=-(r+s)/(r-s);else if(o===Pi)p=-1/(r-s),m=-s/(r-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=u,l[4]=0,l[8]=0,l[12]=h,l[1]=0,l[5]=f,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){let e=this.elements,n=t.elements;for(let i=0;i<16;i++)if(e[i]!==n[i])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){let n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}},te=new M,yt=new W,Wr=new M(0,0,0),Xr=new M(1,1,1),Nt=new M,Ke=new M,ft=new M,Ss=new W,bs=new Lt,Ne=class c{constructor(t=0,e=0,n=0,i=c.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){let i=t.elements,s=i[0],r=i[4],o=i[8],a=i[1],l=i[5],u=i[9],f=i[2],h=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(U(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-U(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(U(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,d),this._z=Math.atan2(-r,l)):(this._y=0,this._z=Math.atan2(a,s));break;case"ZYX":this._y=Math.asin(-U(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(a,s)):(this._x=0,this._z=Math.atan2(-r,l));break;case"YZX":this._z=Math.asin(U(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-U(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:Q("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,n===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Ss.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Ss,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return bs.setFromEuler(this),this.setFromQuaternion(bs,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Ne.DEFAULT_ORDER="XYZ";var dn=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},qr=0,Ts=new M,ee=new Lt,wt=new W,Qe=new M,we=new M,Yr=new M,Zr=new Lt,As=new M(1,0,0),Es=new M(0,1,0),ws=new M(0,0,1),Cs={type:"added"},Jr={type:"removed"},ne={type:"childadded",child:null},jn={type:"childremoved",child:null},Zt=class c extends Yt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:qr++}),this.uuid=Cn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=c.DEFAULT_UP.clone();let t=new M,e=new Ne,n=new Lt,i=new M(1,1,1);function s(){n.setFromEuler(e,!1)}function r(){e.setFromQuaternion(n,void 0,!1)}e._onChange(s),n._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new W},normalMatrix:{value:new N}}),this.matrix=new W,this.matrixWorld=new W,this.matrixAutoUpdate=c.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=c.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new dn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return ee.setFromAxisAngle(t,e),this.quaternion.multiply(ee),this}rotateOnWorldAxis(t,e){return ee.setFromAxisAngle(t,e),this.quaternion.premultiply(ee),this}rotateX(t){return this.rotateOnAxis(As,t)}rotateY(t){return this.rotateOnAxis(Es,t)}rotateZ(t){return this.rotateOnAxis(ws,t)}translateOnAxis(t,e){return Ts.copy(t).applyQuaternion(this.quaternion),this.position.add(Ts.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(As,t)}translateY(t){return this.translateOnAxis(Es,t)}translateZ(t){return this.translateOnAxis(ws,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(wt.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Qe.copy(t):Qe.set(t,e,n);let i=this.parent;this.updateWorldMatrix(!0,!1),we.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?wt.lookAt(we,Qe,this.up):wt.lookAt(Qe,we,this.up),this.quaternion.setFromRotationMatrix(wt),i&&(wt.extractRotation(i.matrixWorld),ee.setFromRotationMatrix(wt),this.quaternion.premultiply(ee.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(G("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Cs),ne.child=t,this.dispatchEvent(ne),ne.child=null):G("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Jr),jn.child=t,this.dispatchEvent(jn),jn.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),wt.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),wt.multiply(t.parent.matrixWorld)),t.applyMatrix4(wt),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Cs),ne.child=t,this.dispatchEvent(ne),ne.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){let r=this.children[n].getObjectByProperty(t,e);if(r!==void 0)return r}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(we,t,Yr),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(we,Zr,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let t=this.pivot;if(t!==null){let e=t.x,n=t.y,i=t.z,s=this.matrix.elements;s[12]+=e-s[0]*e-s[4]*n-s[8]*i,s[13]+=n-s[1]*e-s[5]*n-s[9]*i,s[14]+=i-s[2]*e-s[6]*n-s[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){let n=this.parent;if(t===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(t){let e=t===void 0||typeof t=="string",n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});let i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(t),i.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,a){return o[a.uuid]===void 0&&(o[a.uuid]=a.toJSON(t)),a.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(t.geometries,this.geometry);let o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){let a=o.shapes;if(Array.isArray(a))for(let l=0,u=a.length;l<u;l++){let f=a[l];s(t.shapes,f)}else s(t.shapes,a)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let o=[];for(let a=0,l=this.material.length;a<l;a++)o.push(s(t.materials,this.material[a]));i.material=o}else i.material=s(t.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){let a=this.animations[o];i.animations.push(s(t.animations,a))}}if(e){let o=r(t.geometries),a=r(t.materials),l=r(t.textures),u=r(t.images),f=r(t.shapes),h=r(t.skeletons),d=r(t.animations),p=r(t.nodes);o.length>0&&(n.geometries=o),a.length>0&&(n.materials=a),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),h.length>0&&(n.skeletons=h),d.length>0&&(n.animations=d),p.length>0&&(n.nodes=p)}return n.object=i,n;function r(o){let a=[];for(let l in o){let u=o[l];delete u.metadata,a.push(u)}return a}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let n=0;n<t.children.length;n++){let i=t.children[n];this.add(i.clone())}return this}};Zt.DEFAULT_UP=new M(0,1,0);Zt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Zt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Xs={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Ut={h:0,s:0,l:0},je={h:0,s:0,l:0};function ti(c,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?c+(t-c)*6*e:e<1/2?t:e<2/3?c+(t-c)*6*(2/3-e):c}var j=class{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(e===void 0&&n===void 0){let i=t;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=_t){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,gt.colorSpaceToWorking(this,e),this}setRGB(t,e,n,i=gt.workingColorSpace){return this.r=t,this.g=e,this.b=n,gt.colorSpaceToWorking(this,i),this}setHSL(t,e,n,i=gt.workingColorSpace){if(t=Vr(t,1),e=U(e,0,1),n=U(n,0,1),e===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+e):n+e-n*e,r=2*n-s;this.r=ti(r,s,t+1/3),this.g=ti(r,s,t),this.b=ti(r,s,t-1/3)}return gt.colorSpaceToWorking(this,i),this}setStyle(t,e=_t){function n(s){s!==void 0&&parseFloat(s)<1&&Q("Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\\w+)\\(([^\\)]*)\\)/.exec(t)){let s,r=i[1],o=i[2];switch(r){case"rgb":case"rgba":if(s=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:Q("Color: Unknown color model "+t)}}else if(i=/^\\#([A-Fa-f\\d]+)$/.exec(t)){let s=i[1],r=s.length;if(r===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,e);if(r===6)return this.setHex(parseInt(s,16),e);Q("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=_t){let n=Xs[t.toLowerCase()];return n!==void 0?this.setHex(n,e):Q("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=It(t.r),this.g=It(t.g),this.b=It(t.b),this}copyLinearToSRGB(t){return this.r=he(t.r),this.g=he(t.g),this.b=he(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=_t){return gt.workingToColorSpace(rt.copy(this),t),Math.round(U(rt.r*255,0,255))*65536+Math.round(U(rt.g*255,0,255))*256+Math.round(U(rt.b*255,0,255))}getHexString(t=_t){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=gt.workingColorSpace){gt.workingToColorSpace(rt.copy(this),e);let n=rt.r,i=rt.g,s=rt.b,r=Math.max(n,i,s),o=Math.min(n,i,s),a,l,u=(o+r)/2;if(o===r)a=0,l=0;else{let f=r-o;switch(l=u<=.5?f/(r+o):f/(2-r-o),r){case n:a=(i-s)/f+(i<s?6:0);break;case i:a=(s-n)/f+2;break;case s:a=(n-i)/f+4;break}a/=6}return t.h=a,t.s=l,t.l=u,t}getRGB(t,e=gt.workingColorSpace){return gt.workingToColorSpace(rt.copy(this),e),t.r=rt.r,t.g=rt.g,t.b=rt.b,t}getStyle(t=_t){gt.workingToColorSpace(rt.copy(this),t);let e=rt.r,n=rt.g,i=rt.b;return t!==_t?\`color(\${t} \${e.toFixed(3)} \${n.toFixed(3)} \${i.toFixed(3)})\`:\`rgb(\${Math.round(e*255)},\${Math.round(n*255)},\${Math.round(i*255)})\`}offsetHSL(t,e,n){return this.getHSL(Ut),this.setHSL(Ut.h+t,Ut.s+e,Ut.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(Ut),t.getHSL(je);let n=Zn(Ut.h,je.h,e),i=Zn(Ut.s,je.s,e),s=Zn(Ut.l,je.l,e);return this.setHSL(n,i,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,n=this.g,i=this.b,s=t.elements;return this.r=s[0]*e+s[3]*n+s[6]*i,this.g=s[1]*e+s[4]*n+s[7]*i,this.b=s[2]*e+s[5]*n+s[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},rt=new j;j.NAMES=Xs;var vt=new M,Ct=new M,ei=new M,Rt=new M,ie=new M,se=new M,Rs=new M,ni=new M,ii=new M,si=new M,ri=new de,oi=new de,ai=new de,St=class c{constructor(t=new M,e=new M,n=new M){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),vt.subVectors(t,e),i.cross(vt);let s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(t,e,n,i,s){vt.subVectors(i,e),Ct.subVectors(n,e),ei.subVectors(t,e);let r=vt.dot(vt),o=vt.dot(Ct),a=vt.dot(ei),l=Ct.dot(Ct),u=Ct.dot(ei),f=r*l-o*o;if(f===0)return s.set(0,0,0),null;let h=1/f,d=(l*a-o*u)*h,p=(r*u-o*a)*h;return s.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Rt)===null?!1:Rt.x>=0&&Rt.y>=0&&Rt.x+Rt.y<=1}static getInterpolation(t,e,n,i,s,r,o,a){return this.getBarycoord(t,e,n,i,Rt)===null?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(s,Rt.x),a.addScaledVector(r,Rt.y),a.addScaledVector(o,Rt.z),a)}static getInterpolatedAttribute(t,e,n,i,s,r){return ri.setScalar(0),oi.setScalar(0),ai.setScalar(0),ri.fromBufferAttribute(t,e),oi.fromBufferAttribute(t,n),ai.fromBufferAttribute(t,i),r.setScalar(0),r.addScaledVector(ri,s.x),r.addScaledVector(oi,s.y),r.addScaledVector(ai,s.z),r}static isFrontFacing(t,e,n,i){return vt.subVectors(n,e),Ct.subVectors(t,e),vt.cross(Ct).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return vt.subVectors(this.c,this.b),Ct.subVectors(this.a,this.b),vt.cross(Ct).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return c.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return c.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,s){return c.getInterpolation(t,this.a,this.b,this.c,e,n,i,s)}containsPoint(t){return c.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return c.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let n=this.a,i=this.b,s=this.c,r,o;ie.subVectors(i,n),se.subVectors(s,n),ni.subVectors(t,n);let a=ie.dot(ni),l=se.dot(ni);if(a<=0&&l<=0)return e.copy(n);ii.subVectors(t,i);let u=ie.dot(ii),f=se.dot(ii);if(u>=0&&f<=u)return e.copy(i);let h=a*f-u*l;if(h<=0&&a>=0&&u<=0)return r=a/(a-u),e.copy(n).addScaledVector(ie,r);si.subVectors(t,s);let d=ie.dot(si),p=se.dot(si);if(p>=0&&d<=p)return e.copy(s);let m=d*l-a*p;if(m<=0&&l>=0&&p<=0)return o=l/(l-p),e.copy(n).addScaledVector(se,o);let _=u*p-d*f;if(_<=0&&f-u>=0&&d-p>=0)return Rs.subVectors(s,i),o=(f-u)/(f-u+(d-p)),e.copy(i).addScaledVector(Rs,o);let g=1/(_+m+h);return r=m*g,o=h*g,e.copy(n).addScaledVector(ie,r).addScaledVector(se,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},X=class{constructor(t=new M(1/0,1/0,1/0),e=new M(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(Mt.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(Mt.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let n=Mt.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let n=t.geometry;if(n!==void 0){let s=n.getAttribute("position");if(e===!0&&s!==void 0&&t.isInstancedMesh!==!0)for(let r=0,o=s.count;r<o;r++)t.isMesh===!0?t.getVertexPosition(r,Mt):Mt.fromBufferAttribute(s,r),Mt.applyMatrix4(t.matrixWorld),this.expandByPoint(Mt);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),tn.copy(t.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),tn.copy(n.boundingBox)),tn.applyMatrix4(t.matrixWorld),this.union(tn)}let i=t.children;for(let s=0,r=i.length;s<r;s++)this.expandByObject(i[s],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Mt),Mt.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Ce),en.subVectors(this.max,Ce),re.subVectors(t.a,Ce),oe.subVectors(t.b,Ce),ae.subVectors(t.c,Ce),Ft.subVectors(oe,re),Bt.subVectors(ae,oe),Xt.subVectors(re,ae);let e=[0,-Ft.z,Ft.y,0,-Bt.z,Bt.y,0,-Xt.z,Xt.y,Ft.z,0,-Ft.x,Bt.z,0,-Bt.x,Xt.z,0,-Xt.x,-Ft.y,Ft.x,0,-Bt.y,Bt.x,0,-Xt.y,Xt.x,0];return!ci(e,re,oe,ae,en)||(e=[1,0,0,0,1,0,0,0,1],!ci(e,re,oe,ae,en))?!1:(nn.crossVectors(Ft,Bt),e=[nn.x,nn.y,nn.z],ci(e,re,oe,ae,en))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Mt).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Mt).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(Pt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Pt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Pt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Pt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Pt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Pt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Pt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Pt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Pt),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}},Pt=[new M,new M,new M,new M,new M,new M,new M,new M],Mt=new M,tn=new X,re=new M,oe=new M,ae=new M,Ft=new M,Bt=new M,Xt=new M,Ce=new M,en=new M,nn=new M,qt=new M;function ci(c,t,e,n,i){for(let s=0,r=c.length-3;s<=r;s+=3){qt.fromArray(c,s);let o=i.x*Math.abs(qt.x)+i.y*Math.abs(qt.y)+i.z*Math.abs(qt.z),a=t.dot(qt),l=e.dot(qt),u=n.dot(qt);if(Math.max(-Math.max(a,l,u),Math.min(a,l,u))>o)return!1}return!0}var J=new M,sn=new H,$r=0,ot=class extends Yt{constructor(t,e,n=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:$r++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=n,this.usage=Ri,this.updateRanges=[],this.gpuType=Gs,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,n=this.count;e<n;e++)sn.fromBufferAttribute(this,e),sn.applyMatrix3(t),this.setXY(e,sn.x,sn.y);else if(this.itemSize===3)for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.applyMatrix3(t),this.setXYZ(e,J.x,J.y,J.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.applyMatrix4(t),this.setXYZ(e,J.x,J.y,J.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.applyNormalMatrix(t),this.setXYZ(e,J.x,J.y,J.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)J.fromBufferAttribute(this,e),J.transformDirection(t),this.setXYZ(e,J.x,J.y,J.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=Ee(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=ut(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ee(e,this.array)),e}setX(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ee(e,this.array)),e}setY(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ee(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ee(e,this.array)),e}setW(t,e){return this.normalized&&(e=ut(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=ut(e,this.array),n=ut(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=ut(e,this.array),n=ut(n,this.array),i=ut(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,s){return t*=this.itemSize,this.normalized&&(e=ut(e,this.array),n=ut(n,this.array),i=ut(i,this.array),s=ut(s,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==Ri&&(t.usage=this.usage),t}dispose(){this.dispatchEvent({type:"dispose"})}};var pn=class extends ot{constructor(t,e,n){super(new Uint16Array(t),e,n)}};var mn=class extends ot{constructor(t,e,n){super(new Uint32Array(t),e,n)}};var gn=class extends ot{constructor(t,e,n){super(new Float32Array(t),e,n)}},Kr=new X,Re=new M,li=new M,pe=class{constructor(t=new M,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let n=this.center;e!==void 0?n.copy(e):Kr.setFromPoints(t).getCenter(n);let i=0;for(let s=0,r=t.length;s<r;s++)i=Math.max(i,n.distanceToSquared(t[s]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Re.subVectors(t,this.center);let e=Re.lengthSq();if(e>this.radius*this.radius){let n=Math.sqrt(e),i=(n-this.radius)*.5;this.center.addScaledVector(Re,i/n),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(li.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Re.copy(t.center).add(li)),this.expandByPoint(Re.copy(t.center).sub(li))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}},Qr=0,mt=new W,ui=new Zt,ce=new M,dt=new X,Pe=new X,K=new M,Ue=class c extends Yt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Qr++}),this.uuid=Cn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Fr(t)?mn:pn)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new N().getNormalMatrix(t);n.applyNormalMatrix(s),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(t),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return mt.makeRotationFromQuaternion(t),this.applyMatrix4(mt),this}rotateX(t){return mt.makeRotationX(t),this.applyMatrix4(mt),this}rotateY(t){return mt.makeRotationY(t),this.applyMatrix4(mt),this}rotateZ(t){return mt.makeRotationZ(t),this.applyMatrix4(mt),this}translate(t,e,n){return mt.makeTranslation(t,e,n),this.applyMatrix4(mt),this}scale(t,e,n){return mt.makeScale(t,e,n),this.applyMatrix4(mt),this}lookAt(t){return ui.lookAt(t),ui.updateMatrix(),this.applyMatrix4(ui.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ce).negate(),this.translate(ce.x,ce.y,ce.z),this}setFromPoints(t){let e=this.getAttribute("position");if(e===void 0){let n=[];for(let i=0,s=t.length;i<s;i++){let r=t[i];n.push(r.x,r.y,r.z||0)}this.setAttribute("position",new gn(n,3))}else{let n=Math.min(t.length,e.count);for(let i=0;i<n;i++){let s=t[i];e.setXYZ(i,s.x,s.y,s.z||0)}t.length>e.count&&Q("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new X);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){G("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new M(-1/0,-1/0,-1/0),new M(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let n=0,i=e.length;n<i;n++){let s=e[n];dt.setFromBufferAttribute(s),this.morphTargetsRelative?(K.addVectors(this.boundingBox.min,dt.min),this.boundingBox.expandByPoint(K),K.addVectors(this.boundingBox.max,dt.max),this.boundingBox.expandByPoint(K)):(this.boundingBox.expandByPoint(dt.min),this.boundingBox.expandByPoint(dt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&G('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new pe);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){G("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new M,1/0);return}if(t){let n=this.boundingSphere.center;if(dt.setFromBufferAttribute(t),e)for(let s=0,r=e.length;s<r;s++){let o=e[s];Pe.setFromBufferAttribute(o),this.morphTargetsRelative?(K.addVectors(dt.min,Pe.min),dt.expandByPoint(K),K.addVectors(dt.max,Pe.max),dt.expandByPoint(K)):(dt.expandByPoint(Pe.min),dt.expandByPoint(Pe.max))}dt.getCenter(n);let i=0;for(let s=0,r=t.count;s<r;s++)K.fromBufferAttribute(t,s),i=Math.max(i,n.distanceToSquared(K));if(e)for(let s=0,r=e.length;s<r;s++){let o=e[s],a=this.morphTargetsRelative;for(let l=0,u=o.count;l<u;l++)K.fromBufferAttribute(o,l),a&&(ce.fromBufferAttribute(t,l),K.add(ce)),i=Math.max(i,n.distanceToSquared(K))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&G('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){G("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=e.position,i=e.normal,s=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ot(new Float32Array(4*n.count),4));let r=this.getAttribute("tangent"),o=[],a=[];for(let A=0;A<n.count;A++)o[A]=new M,a[A]=new M;let l=new M,u=new M,f=new M,h=new H,d=new H,p=new H,m=new M,_=new M;function g(A,E,C){l.fromBufferAttribute(n,A),u.fromBufferAttribute(n,E),f.fromBufferAttribute(n,C),h.fromBufferAttribute(s,A),d.fromBufferAttribute(s,E),p.fromBufferAttribute(s,C),u.sub(l),f.sub(l),d.sub(h),p.sub(h);let R=1/(d.x*p.y-p.x*d.y);isFinite(R)&&(m.copy(u).multiplyScalar(p.y).addScaledVector(f,-d.y).multiplyScalar(R),_.copy(f).multiplyScalar(d.x).addScaledVector(u,-p.x).multiplyScalar(R),o[A].add(m),o[E].add(m),o[C].add(m),a[A].add(_),a[E].add(_),a[C].add(_))}let x=this.groups;x.length===0&&(x=[{start:0,count:t.count}]);for(let A=0,E=x.length;A<E;++A){let C=x[A],R=C.start,w=C.count;for(let P=R,L=R+w;P<L;P+=3)g(t.getX(P+0),t.getX(P+1),t.getX(P+2))}let y=new M,S=new M,v=new M,b=new M;function T(A){v.fromBufferAttribute(i,A),b.copy(v);let E=o[A];y.copy(E),y.sub(v.multiplyScalar(v.dot(E))).normalize(),S.crossVectors(b,E);let R=S.dot(a[A])<0?-1:1;r.setXYZW(A,y.x,y.y,y.z,R)}for(let A=0,E=x.length;A<E;++A){let C=x[A],R=C.start,w=C.count;for(let P=R,L=R+w;P<L;P+=3)T(t.getX(P+0)),T(t.getX(P+1)),T(t.getX(P+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new ot(new Float32Array(e.count*3),3),this.setAttribute("normal",n);else for(let h=0,d=n.count;h<d;h++)n.setXYZ(h,0,0,0);let i=new M,s=new M,r=new M,o=new M,a=new M,l=new M,u=new M,f=new M;if(t)for(let h=0,d=t.count;h<d;h+=3){let p=t.getX(h+0),m=t.getX(h+1),_=t.getX(h+2);i.fromBufferAttribute(e,p),s.fromBufferAttribute(e,m),r.fromBufferAttribute(e,_),u.subVectors(r,s),f.subVectors(i,s),u.cross(f),o.fromBufferAttribute(n,p),a.fromBufferAttribute(n,m),l.fromBufferAttribute(n,_),o.add(u),a.add(u),l.add(u),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(m,a.x,a.y,a.z),n.setXYZ(_,l.x,l.y,l.z)}else for(let h=0,d=e.count;h<d;h+=3)i.fromBufferAttribute(e,h+0),s.fromBufferAttribute(e,h+1),r.fromBufferAttribute(e,h+2),u.subVectors(r,s),f.subVectors(i,s),u.cross(f),n.setXYZ(h+0,u.x,u.y,u.z),n.setXYZ(h+1,u.x,u.y,u.z),n.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)K.fromBufferAttribute(t,e),K.normalize(),t.setXYZ(e,K.x,K.y,K.z)}toNonIndexed(){function t(o,a){let l=o.array,u=o.itemSize,f=o.normalized,h=new l.constructor(a.length*u),d=0,p=0;for(let m=0,_=a.length;m<_;m++){o.isInterleavedBufferAttribute?d=a[m]*o.data.stride+o.offset:d=a[m]*u;for(let g=0;g<u;g++)h[p++]=l[d++]}return new ot(h,u,f)}if(this.index===null)return Q("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new c,n=this.index.array,i=this.attributes;for(let o in i){let a=i[o],l=t(a,n);e.setAttribute(o,l)}let s=this.morphAttributes;for(let o in s){let a=[],l=s[o];for(let u=0,f=l.length;u<f;u++){let h=l[u],d=t(h,n);a.push(d)}e.morphAttributes[o]=a}e.morphTargetsRelative=this.morphTargetsRelative;let r=this.groups;for(let o=0,a=r.length;o<a;o++){let l=r[o];e.addGroup(l.start,l.count,l.materialIndex)}return e}toJSON(){let t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let a=this.parameters;for(let l in a)a[l]!==void 0&&(t[l]=a[l]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let n=this.attributes;for(let a in n){let l=n[a];t.data.attributes[a]=l.toJSON(t.data)}let i={},s=!1;for(let a in this.morphAttributes){let l=this.morphAttributes[a],u=[];for(let f=0,h=l.length;f<h;f++){let d=l[f];u.push(d.toJSON(t.data))}u.length>0&&(i[a]=u,s=!0)}s&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);let r=this.groups;r.length>0&&(t.data.groups=JSON.parse(JSON.stringify(r)));let o=this.boundingSphere;return o!==null&&(t.data.boundingSphere=o.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let n=t.index;n!==null&&this.setIndex(n.clone());let i=t.attributes;for(let l in i){let u=i[l];this.setAttribute(l,u.clone(e))}let s=t.morphAttributes;for(let l in s){let u=[],f=s[l];for(let h=0,d=f.length;h<d;h++)u.push(f[h].clone(e));this.morphAttributes[l]=u}this.morphTargetsRelative=t.morphTargetsRelative;let r=t.groups;for(let l=0,u=r.length;l<u;l++){let f=r[l];this.addGroup(f.start,f.count,f.materialIndex)}let o=t.boundingBox;o!==null&&(this.boundingBox=o.clone());let a=t.boundingSphere;return a!==null&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};var hi=new M,jr=new M,to=new N,Jt=class{constructor(t=new M(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){let i=hi.subVectors(n,e).cross(jr.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e,n=!0){let i=t.delta(hi),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let r=-(t.start.dot(this.normal)+this.constant)/s;return n===!0&&(r<0||r>1)?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){let e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let n=e||to.getNormalMatrix(t),i=this.coplanarPoint(hi).applyMatrix4(t),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}};function qs(c){let t={};for(let e in c){t[e]={};for(let n in c[e]){let i=c[e][n];if(Ps(i))i.isRenderTargetTexture?(Q("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][n]=null):t[e][n]=i.clone();else if(Array.isArray(i))if(Ps(i[0])){let s=[];for(let r=0,o=i.length;r<o;r++)s[r]=i[r].clone();t[e][n]=s}else t[e][n]=i.slice();else t[e][n]=i}}return t}function ct(c){let t={};for(let e=0;e<c.length;e++){let n=qs(c[e]);for(let i in n)t[i]=n[i]}return t}function Ps(c){return c&&(c.isColor||c.isMatrix3||c.isMatrix4||c.isVector2||c.isVector3||c.isVector4||c.isTexture||c.isQuaternion)}function rn(c,t){return!c||c.constructor===t?c:typeof t.BYTES_PER_ELEMENT=="number"?new t(c):Array.prototype.slice.call(c)}var Ot=class{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,n=this._cachedIndex,i=e[n],s=e[n-1];n:{t:{let r;e:{i:if(!(t<i)){for(let o=n+2;;){if(i===void 0){if(t<s)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=e[++n],t<i)break t}r=e.length;break e}if(!(t>=s)){let o=e[1];t<o&&(n=2,s=o);for(let a=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=s,s=e[--n-1],t>=s)break t}r=n,n=0;break e}break n}for(;n<r;){let o=n+r>>>1;t<e[o]?r=o:n=o+1}if(i=e[n],s=e[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=t*i;for(let r=0;r!==i;++r)e[r]=n[s+r];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},_n=class extends Ot{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ti,endingEnd:Ti}}intervalChanged_(t,e,n){let i=this.parameterPositions,s=t-2,r=t+1,o=i[s],a=i[r];if(o===void 0)switch(this.getSettings_().endingStart){case Ai:s=t,o=2*e-n;break;case Ei:s=i.length-2,o=e+i[s]-i[s+1];break;default:s=t,o=n}if(a===void 0)switch(this.getSettings_().endingEnd){case Ai:r=t,a=2*n-e;break;case Ei:r=1,a=n+i[1]-i[0];break;default:r=t-1,a=e}let l=(n-e)*.5,u=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(a-n),this._offsetPrev=s*u,this._offsetNext=r*u}interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,u=this._offsetPrev,f=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),m=p*p,_=m*p,g=-h*_+2*h*m-h*p,x=(1+h)*_+(-1.5-2*h)*m+(-.5+h)*p+1,y=(-1-d)*_+(1.5+d)*m+.5*p,S=d*_-d*m;for(let v=0;v!==o;++v)s[v]=g*r[u+v]+x*r[l+v]+y*r[a+v]+S*r[f+v];return s}},xn=class extends Ot{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,u=(n-e)/(i-e),f=1-u;for(let h=0;h!==o;++h)s[h]=r[l+h]*f+r[a+h]*u;return s}},yn=class extends Ot{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}},vn=class extends Ot{interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,u=this.settings||this.DefaultSettings_,f=u.inTangents,h=u.outTangents;if(!f||!h){let m=(n-e)/(i-e),_=1-m;for(let g=0;g!==o;++g)s[g]=r[l+g]*_+r[a+g]*m;return s}let d=o*2,p=t-1;for(let m=0;m!==o;++m){let _=r[l+m],g=r[a+m],x=p*d+m*2,y=h[x],S=h[x+1],v=t*d+m*2,b=f[v],T=f[v+1],A=(n-e)/(i-e),E,C,R,w,P;for(let L=0;L<8;L++){E=A*A,C=E*A,R=1-A,w=R*R,P=w*R;let O=P*e+3*w*A*y+3*R*E*b+C*i-n;if(Math.abs(O)<1e-10)break;let it=3*w*(y-e)+6*R*A*(b-y)+3*E*(i-b);if(Math.abs(it)<1e-10)break;A=A-O/it,A=Math.max(0,Math.min(1,A))}s[m]=P*_+3*w*A*S+3*R*E*T+C*g}return s}},pt=class{constructor(t,e,n,i){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=rn(e,this.TimeBufferType),this.values=rn(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:rn(t.times,Array),values:rn(t.values,Array)};let i=t.getInterpolation();i!==t.DefaultInterpolation&&(n.interpolation=i)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new yn(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new xn(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new _n(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodBezier(t){let e=new vn(this.times,this.values,this.getValueSize(),t);return this.settings&&(e.settings=this.settings),e}setInterpolation(t){let e;switch(t){case De:e=this.InterpolantFactoryMethodDiscrete;break;case ln:e=this.InterpolantFactoryMethodLinear;break;case an:e=this.InterpolantFactoryMethodSmooth;break;case bi:e=this.InterpolantFactoryMethodBezier;break}if(e===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Q("KeyframeTrack:",n),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return De;case this.InterpolantFactoryMethodLinear:return ln;case this.InterpolantFactoryMethodSmooth:return an;case this.InterpolantFactoryMethodBezier:return bi}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){let n=this.times,i=n.length,s=0,r=i-1;for(;s!==i&&n[s]<t;)++s;for(;r!==-1&&n[r]>e;)--r;if(++r,s!==0||r!==i){s>=r&&(r=Math.max(r,1),s=r-1);let o=this.getValueSize();this.times=n.slice(s,r),this.values=this.values.slice(s*o,r*o)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(G("KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,i=this.values,s=n.length;s===0&&(G("KeyframeTrack: Track is empty.",this),t=!1);let r=null;for(let o=0;o!==s;o++){let a=n[o];if(typeof a=="number"&&isNaN(a)){G("KeyframeTrack: Time is not a valid number.",this,o,a),t=!1;break}if(r!==null&&r>a){G("KeyframeTrack: Out of order keys.",this,o,a,r),t=!1;break}r=a}if(i!==void 0&&Br(i))for(let o=0,a=i.length;o!==a;++o){let l=i[o];if(isNaN(l)){G("KeyframeTrack: Value is not a valid number.",this,o,l),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===an,s=t.length-1,r=1;for(let o=1;o<s;++o){let a=!1,l=t[o],u=t[o+1];if(l!==u&&(o!==1||l!==t[0]))if(i)a=!0;else{let f=o*n,h=f-n,d=f+n;for(let p=0;p!==n;++p){let m=e[f+p];if(m!==e[h+p]||m!==e[d+p]){a=!0;break}}}if(a){if(o!==r){t[r]=t[o];let f=o*n,h=r*n;for(let d=0;d!==n;++d)e[h+d]=e[f+d]}++r}}if(s>0){t[r]=t[s];for(let o=s*n,a=r*n,l=0;l!==n;++l)e[a+l]=e[o+l];++r}return r!==t.length?(this.times=t.slice(0,r),this.values=e.slice(0,r*n)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),n=this.constructor,i=new n(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}};pt.prototype.ValueTypeName="";pt.prototype.TimeBufferType=Float32Array;pt.prototype.ValueBufferType=Float32Array;pt.prototype.DefaultInterpolation=ln;var zt=class extends pt{constructor(t,e,n){super(t,e,n)}};zt.prototype.ValueTypeName="bool";zt.prototype.ValueBufferType=Array;zt.prototype.DefaultInterpolation=De;zt.prototype.InterpolantFactoryMethodLinear=void 0;zt.prototype.InterpolantFactoryMethodSmooth=void 0;var Mn=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}};Mn.prototype.ValueTypeName="color";var Sn=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}};Sn.prototype.ValueTypeName="number";var bn=class extends Ot{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){let s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=(n-e)/(i-e),l=t*o;for(let u=l+o;l!==u;l+=4)Lt.slerpFlat(s,0,r,l-o,r,l,a);return s}},Fe=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}InterpolantFactoryMethodLinear(t){return new bn(this.times,this.values,this.getValueSize(),t)}};Fe.prototype.ValueTypeName="quaternion";Fe.prototype.InterpolantFactoryMethodSmooth=void 0;var Vt=class extends pt{constructor(t,e,n){super(t,e,n)}};Vt.prototype.ValueTypeName="string";Vt.prototype.ValueBufferType=Array;Vt.prototype.DefaultInterpolation=De;Vt.prototype.InterpolantFactoryMethodLinear=void 0;Vt.prototype.InterpolantFactoryMethodSmooth=void 0;var Tn=class extends pt{constructor(t,e,n,i){super(t,e,n,i)}};Tn.prototype.ValueTypeName="vector";var An=class{constructor(t,e,n){let i=this,s=!1,r=0,o=0,a,l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this._abortController=null,this.itemStart=function(u){o++,s===!1&&i.onStart!==void 0&&i.onStart(u,r,o),s=!0},this.itemEnd=function(u){r++,i.onProgress!==void 0&&i.onProgress(u,r,o),r===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(u){i.onError!==void 0&&i.onError(u)},this.resolveURL=function(u){return a?a(u):u},this.setURLModifier=function(u){return a=u,this},this.addHandler=function(u,f){return l.push(u,f),this},this.removeHandler=function(u){let f=l.indexOf(u);return f!==-1&&l.splice(f,2),this},this.getHandler=function(u){for(let f=0,h=l.length;f<h;f+=2){let d=l[f],p=l[f+1];if(d.global&&(d.lastIndex=0),d.test(u))return p}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},Ys=new An,En=class{constructor(t){this.manager=t!==void 0?t:Ys,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(t,e){let n=this;return new Promise(function(i,s){n.load(t,i,e,s)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}};En.DEFAULT_MATERIAL_NAME="__DEFAULT";var Yi="\\\\[\\\\]\\\\.:\\\\/",eo=new RegExp("["+Yi+"]","g"),Zi="[^"+Yi+"]",no="[^"+Yi.replace("\\\\.","")+"]",io=/((?:WC+[\\/:])*)/.source.replace("WC",Zi),so=/(WCOD+)?/.source.replace("WCOD",no),ro=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Zi),oo=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Zi),ao=new RegExp("^"+io+so+ro+oo+"$"),co=["material","materials","bones","map"],Di=class{constructor(t,e,n){let i=n||k.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(t,e)}setValue(t,e){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},k=class c{constructor(t,e,n){this.path=e,this.parsedPath=n||c.parseTrackName(e),this.node=c.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new c.Composite(t,e,n):new c(t,e,n)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(eo,"")}static parseTrackName(t){let e=ao.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let s=n.nodeName.substring(i+1);co.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let n=t.skeleton.getBoneByName(e);if(n!==void 0)return n}if(t.children){let n=function(s){for(let r=0;r<s.length;r++){let o=s[r];if(o.name===e||o.uuid===e)return o;let a=n(o.children);if(a)return a}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,n=e.objectName,i=e.propertyName,s=e.propertyIndex;if(t||(t=c.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){Q("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=e.objectIndex;switch(n){case"materials":if(!t.material){G("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){G("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){G("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let u=0;u<t.length;u++)if(t[u].name===l){l=u;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){G("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){G("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[n]===void 0){G("PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[n]}if(l!==void 0){if(t[l]===void 0){G("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[l]}}let r=t[i];if(r===void 0){let l=e.nodeName;G("PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",t);return}let o=this.Versioning.None;this.targetObject=t,t.isMaterial===!0?o=this.Versioning.NeedsUpdate:t.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!t.geometry){G("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){G("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[s]!==void 0&&(s=t.morphTargetDictionary[s])}a=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s}else r.fromArray!==void 0&&r.toArray!==void 0?(a=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(a=this.BindingType.EntireArray,this.resolvedProperty=r):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};k.Composite=Di;k.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};k.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};k.prototype.GetterByBindingType=[k.prototype._getValue_direct,k.prototype._getValue_array,k.prototype._getValue_arrayElement,k.prototype._getValue_toArray];k.prototype.SetterByBindingTypeAndVersioning=[[k.prototype._setValue_direct,k.prototype._setValue_direct_setNeedsUpdate,k.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[k.prototype._setValue_array,k.prototype._setValue_array_setNeedsUpdate,k.prototype._setValue_array_setMatrixWorldNeedsUpdate],[k.prototype._setValue_arrayElement,k.prototype._setValue_arrayElement_setNeedsUpdate,k.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[k.prototype._setValue_fromArray,k.prototype._setValue_fromArray_setNeedsUpdate,k.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var vl=new Float32Array(1);var Ni=class c{static{c.prototype.isMatrix2=!0}constructor(t,e,n,i){this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,i){let s=this.elements;return s[0]=t,s[2]=e,s[1]=n,s[3]=i,this}};var Is=new M,on=new M,le=new M,ue=new M,fi=new M,lo=new M,uo=new M,at=class{constructor(t=new M,e=new M){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Is.subVectors(t,this.start),on.subVectors(this.end,this.start);let n=on.dot(on);if(n===0)return 0;let s=on.dot(Is)/n;return e&&(s=U(s,0,1)),s}closestPointToPoint(t,e,n){let i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(t,e=lo,n=uo){let i=10000000000000001e-32,s,r,o=this.start,a=t.start,l=this.end,u=t.end;le.subVectors(l,o),ue.subVectors(u,a),fi.subVectors(o,a);let f=le.dot(le),h=ue.dot(ue),d=ue.dot(fi);if(f<=i&&h<=i)return e.copy(o),n.copy(a),e.sub(n),e.dot(e);if(f<=i)s=0,r=d/h,r=U(r,0,1);else{let p=le.dot(fi);if(h<=i)r=0,s=U(-p/f,0,1);else{let m=le.dot(ue),_=f*h-m*m;_!==0?s=U((m*d-p*h)/_,0,1):s=0,r=(m*s+d)/h,r<0?(r=0,s=U(-p/f,0,1)):r>1&&(r=1,s=U((m-p)/f,0,1))}}return e.copy(o).addScaledVector(le,s),n.copy(a).addScaledVector(ue,r),e.distanceToSquared(n)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));typeof window<"u"&&(window.__THREE__?Q("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="184");var ho=\`#ifdef USE_ALPHAHASH
|
|
2
2
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
3
3
|
#endif\`,fo=\`#ifdef USE_ALPHAHASH
|
|
4
4
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
@@ -3661,14 +3661,14 @@ void main() {
|
|
|
3661
3661
|
#include <colorspace_fragment>
|
|
3662
3662
|
#include <fog_fragment>
|
|
3663
3663
|
}\`,F={alphahash_fragment:ho,alphahash_pars_fragment:fo,alphamap_fragment:po,alphamap_pars_fragment:mo,alphatest_fragment:go,alphatest_pars_fragment:_o,aomap_fragment:xo,aomap_pars_fragment:yo,batching_pars_vertex:vo,batching_vertex:Mo,begin_vertex:So,beginnormal_vertex:bo,bsdfs:To,iridescence_fragment:Ao,bumpmap_pars_fragment:Eo,clipping_planes_fragment:wo,clipping_planes_pars_fragment:Co,clipping_planes_pars_vertex:Ro,clipping_planes_vertex:Po,color_fragment:Io,color_pars_fragment:Lo,color_pars_vertex:Do,color_vertex:No,common:Uo,cube_uv_reflection_fragment:Fo,defaultnormal_vertex:Bo,displacementmap_pars_vertex:Oo,displacementmap_vertex:zo,emissivemap_fragment:Vo,emissivemap_pars_fragment:ko,colorspace_fragment:Go,colorspace_pars_fragment:Ho,envmap_fragment:Wo,envmap_common_pars_fragment:Xo,envmap_pars_fragment:qo,envmap_pars_vertex:Yo,envmap_physical_pars_fragment:sa,envmap_vertex:Zo,fog_vertex:Jo,fog_pars_vertex:$o,fog_fragment:Ko,fog_pars_fragment:Qo,gradientmap_pars_fragment:jo,lightmap_pars_fragment:ta,lights_lambert_fragment:ea,lights_lambert_pars_fragment:na,lights_pars_begin:ia,lights_toon_fragment:ra,lights_toon_pars_fragment:oa,lights_phong_fragment:aa,lights_phong_pars_fragment:ca,lights_physical_fragment:la,lights_physical_pars_fragment:ua,lights_fragment_begin:ha,lights_fragment_maps:fa,lights_fragment_end:da,lightprobes_pars_fragment:pa,logdepthbuf_fragment:ma,logdepthbuf_pars_fragment:ga,logdepthbuf_pars_vertex:_a,logdepthbuf_vertex:xa,map_fragment:ya,map_pars_fragment:va,map_particle_fragment:Ma,map_particle_pars_fragment:Sa,metalnessmap_fragment:ba,metalnessmap_pars_fragment:Ta,morphinstance_vertex:Aa,morphcolor_vertex:Ea,morphnormal_vertex:wa,morphtarget_pars_vertex:Ca,morphtarget_vertex:Ra,normal_fragment_begin:Pa,normal_fragment_maps:Ia,normal_pars_fragment:La,normal_pars_vertex:Da,normal_vertex:Na,normalmap_pars_fragment:Ua,clearcoat_normal_fragment_begin:Fa,clearcoat_normal_fragment_maps:Ba,clearcoat_pars_fragment:Oa,iridescence_pars_fragment:za,opaque_fragment:Va,packing:ka,premultiplied_alpha_fragment:Ga,project_vertex:Ha,dithering_fragment:Wa,dithering_pars_fragment:Xa,roughnessmap_fragment:qa,roughnessmap_pars_fragment:Ya,shadowmap_pars_fragment:Za,shadowmap_pars_vertex:Ja,shadowmap_vertex:$a,shadowmask_pars_fragment:Ka,skinbase_vertex:Qa,skinning_pars_vertex:ja,skinning_vertex:tc,skinnormal_vertex:ec,specularmap_fragment:nc,specularmap_pars_fragment:ic,tonemapping_fragment:sc,tonemapping_pars_fragment:rc,transmission_fragment:oc,transmission_pars_fragment:ac,uv_pars_fragment:cc,uv_pars_vertex:lc,uv_vertex:uc,worldpos_vertex:hc,background_vert:fc,background_frag:dc,backgroundCube_vert:pc,backgroundCube_frag:mc,cube_vert:gc,cube_frag:_c,depth_vert:xc,depth_frag:yc,distance_vert:vc,distance_frag:Mc,equirect_vert:Sc,equirect_frag:bc,linedashed_vert:Tc,linedashed_frag:Ac,meshbasic_vert:Ec,meshbasic_frag:wc,meshlambert_vert:Cc,meshlambert_frag:Rc,meshmatcap_vert:Pc,meshmatcap_frag:Ic,meshnormal_vert:Lc,meshnormal_frag:Dc,meshphong_vert:Nc,meshphong_frag:Uc,meshphysical_vert:Fc,meshphysical_frag:Bc,meshtoon_vert:Oc,meshtoon_frag:zc,points_vert:Vc,points_frag:kc,shadow_vert:Gc,shadow_frag:Hc,sprite_vert:Wc,sprite_frag:Xc},I={common:{diffuse:{value:new j(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new N},alphaMap:{value:null},alphaMapTransform:{value:new N},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new N}},envmap:{envMap:{value:null},envMapRotation:{value:new N},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new N}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new N}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new N},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new N},normalScale:{value:new H(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new N},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new N}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new N}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new N}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new j(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new M},probesMax:{value:new M},probesResolution:{value:new M}},points:{diffuse:{value:new j(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new N},alphaTest:{value:0},uvTransform:{value:new N}},sprite:{diffuse:{value:new j(16777215)},opacity:{value:1},center:{value:new H(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new N},alphaMap:{value:null},alphaMapTransform:{value:new N},alphaTest:{value:0}}},Zs={basic:{uniforms:ct([I.common,I.specularmap,I.envmap,I.aomap,I.lightmap,I.fog]),vertexShader:F.meshbasic_vert,fragmentShader:F.meshbasic_frag},lambert:{uniforms:ct([I.common,I.specularmap,I.envmap,I.aomap,I.lightmap,I.emissivemap,I.bumpmap,I.normalmap,I.displacementmap,I.fog,I.lights,{emissive:{value:new j(0)},envMapIntensity:{value:1}}]),vertexShader:F.meshlambert_vert,fragmentShader:F.meshlambert_frag},phong:{uniforms:ct([I.common,I.specularmap,I.envmap,I.aomap,I.lightmap,I.emissivemap,I.bumpmap,I.normalmap,I.displacementmap,I.fog,I.lights,{emissive:{value:new j(0)},specular:{value:new j(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:F.meshphong_vert,fragmentShader:F.meshphong_frag},standard:{uniforms:ct([I.common,I.envmap,I.aomap,I.lightmap,I.emissivemap,I.bumpmap,I.normalmap,I.displacementmap,I.roughnessmap,I.metalnessmap,I.fog,I.lights,{emissive:{value:new j(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:F.meshphysical_vert,fragmentShader:F.meshphysical_frag},toon:{uniforms:ct([I.common,I.aomap,I.lightmap,I.emissivemap,I.bumpmap,I.normalmap,I.displacementmap,I.gradientmap,I.fog,I.lights,{emissive:{value:new j(0)}}]),vertexShader:F.meshtoon_vert,fragmentShader:F.meshtoon_frag},matcap:{uniforms:ct([I.common,I.bumpmap,I.normalmap,I.displacementmap,I.fog,{matcap:{value:null}}]),vertexShader:F.meshmatcap_vert,fragmentShader:F.meshmatcap_frag},points:{uniforms:ct([I.points,I.fog]),vertexShader:F.points_vert,fragmentShader:F.points_frag},dashed:{uniforms:ct([I.common,I.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:F.linedashed_vert,fragmentShader:F.linedashed_frag},depth:{uniforms:ct([I.common,I.displacementmap]),vertexShader:F.depth_vert,fragmentShader:F.depth_frag},normal:{uniforms:ct([I.common,I.bumpmap,I.normalmap,I.displacementmap,{opacity:{value:1}}]),vertexShader:F.meshnormal_vert,fragmentShader:F.meshnormal_frag},sprite:{uniforms:ct([I.sprite,I.fog]),vertexShader:F.sprite_vert,fragmentShader:F.sprite_frag},background:{uniforms:{uvTransform:{value:new N},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:F.background_vert,fragmentShader:F.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new N}},vertexShader:F.backgroundCube_vert,fragmentShader:F.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:F.cube_vert,fragmentShader:F.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:F.equirect_vert,fragmentShader:F.equirect_frag},distance:{uniforms:ct([I.common,I.displacementmap,{referencePosition:{value:new M},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:F.distance_vert,fragmentShader:F.distance_frag},shadow:{uniforms:ct([I.lights,I.fog,{color:{value:new j(0)},opacity:{value:1}}]),vertexShader:F.shadow_vert,fragmentShader:F.shadow_frag}};Zs.physical={uniforms:ct([Zs.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new N},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new N},clearcoatNormalScale:{value:new H(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new N},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new N},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new N},sheen:{value:0},sheenColor:{value:new j(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new N},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new N},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new N},transmissionSamplerSize:{value:new H},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new N},attenuationDistance:{value:0},attenuationColor:{value:new j(0)},specularColor:{value:new j(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new N},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new N},anisotropyVector:{value:new H},anisotropyMap:{value:null},anisotropyMapTransform:{value:new N}}]),vertexShader:F.meshphysical_vert,fragmentShader:F.meshphysical_frag};var qc=new N;qc.set(-1,0,0,0,1,0,0,0,1);var Vm={[Bi]:"LINEAR_TONE_MAPPING",[Oi]:"REINHARD_TONE_MAPPING",[zi]:"CINEON_TONE_MAPPING",[Vi]:"ACES_FILMIC_TONE_MAPPING",[Gi]:"AGX_TONE_MAPPING",[Hi]:"NEUTRAL_TONE_MAPPING",[ki]:"CUSTOM_TONE_MAPPING"};var km=new Float32Array(16),Gm=new Float32Array(9),Hm=new Float32Array(4);var Wm={[Bi]:"Linear",[Oi]:"Reinhard",[zi]:"Cineon",[Vi]:"ACESFilmic",[Gi]:"AgX",[Hi]:"Neutral",[ki]:"Custom"};var Xm={[Ls]:"SHADOWMAP_TYPE_PCF",[Ds]:"SHADOWMAP_TYPE_VSM"};var qm={[Bs]:"ENVMAP_TYPE_CUBE",[Xi]:"ENVMAP_TYPE_CUBE",[Os]:"ENVMAP_TYPE_CUBE_UV"};var Ym={[Xi]:"ENVMAP_MODE_REFRACTION"};var Zm={[Ns]:"ENVMAP_BLENDING_MULTIPLY",[Us]:"ENVMAP_BLENDING_MIX",[Fs]:"ENVMAP_BLENDING_ADD"};var Yc=new N;Yc.set(-1,0,0,0,1,0,0,0,1);var Jm=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);var $s=Math.pow(2,-24),Rn=Symbol("SKIP_GENERATION");function Zc(c){return c.index?c.index.count:c.attributes.position.count}function Et(c){return Zc(c)/3}function Jc(c,t=ArrayBuffer){return c>65535?new Uint32Array(new t(4*c)):new Uint16Array(new t(2*c))}function Ks(c,t){if(!c.index){let e=c.attributes.position.count,n=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Jc(e,n);c.setIndex(new ot(i,1));for(let s=0;s<e;s++)i[s]=s}}function Ji(c,t){let e=Et(c),n=t||c.drawRange,i=n.start/3,s=(n.start+n.count)/3,r=Math.max(0,i),o=Math.min(e,s)-r;return[{offset:Math.floor(r),count:Math.floor(o)}]}function $i(c,t){if(!c.groups||!c.groups.length)return Ji(c,t);let e=[],n=new Set,i=t||c.drawRange,s=i.start/3,r=(i.start+i.count)/3;for(let a of c.groups){let l=a.start/3,u=(a.start+a.count)/3;n.add(Math.max(s,l)),n.add(Math.min(r,u))}let o=Array.from(n.values()).sort((a,l)=>a-l);for(let a=0;a<o.length-1;a++){let l=o[a],u=o[a+1];e.push({offset:Math.floor(l),count:Math.floor(u-l)})}return e}function Qs(c,t){let e=Et(c),n=$i(c,t).sort((r,o)=>r.offset-o.offset),i=n[n.length-1];i.count=Math.min(e-i.offset,i.count);let s=0;return n.forEach(({count:r})=>s+=r),e!==s}function Pn(c,t,e,n,i){let s=1/0,r=1/0,o=1/0,a=-1/0,l=-1/0,u=-1/0,f=1/0,h=1/0,d=1/0,p=-1/0,m=-1/0,_=-1/0;for(let g=t*6,x=(t+e)*6;g<x;g+=6){let y=c[g+0],S=c[g+1],v=y-S,b=y+S;v<s&&(s=v),b>a&&(a=b),y<f&&(f=y),y>p&&(p=y);let T=c[g+2],A=c[g+3],E=T-A,C=T+A;E<r&&(r=E),C>l&&(l=C),T<h&&(h=T),T>m&&(m=T);let R=c[g+4],w=c[g+5],P=R-w,L=R+w;P<o&&(o=P),L>u&&(u=L),R<d&&(d=R),R>_&&(_=R)}n[0]=s,n[1]=r,n[2]=o,n[3]=a,n[4]=l,n[5]=u,i[0]=f,i[1]=h,i[2]=d,i[3]=p,i[4]=m,i[5]=_}function js(c,t=null,e=null,n=null){let i=c.attributes.position,s=c.index?c.index.array:null,r=Et(c),o=i.normalized,a;t===null?(a=new Float32Array(r*6),e=0,n=r):(a=t,e=e||0,n=n||r);let l=i.array,u=i.offset||0,f=3;i.isInterleavedBufferAttribute&&(f=i.data.stride);let h=["getX","getY","getZ"];for(let d=e;d<e+n;d++){let p=d*3,m=d*6,_=p+0,g=p+1,x=p+2;s&&(_=s[_],g=s[g],x=s[x]),o||(_=_*f+u,g=g*f+u,x=x*f+u);for(let y=0;y<3;y++){let S,v,b;o?(S=i[h[y]](_),v=i[h[y]](g),b=i[h[y]](x)):(S=l[_+y],v=l[g+y],b=l[x+y]);let T=S;v<T&&(T=v),b<T&&(T=b);let A=S;v>A&&(A=v),b>A&&(A=b);let E=(A-T)/2,C=y*2;a[m+C+0]=T+E,a[m+C+1]=E+(Math.abs(T)+E)*$s}}return a}function z(c,t,e){return e.min.x=t[c],e.min.y=t[c+1],e.min.z=t[c+2],e.max.x=t[c+3],e.max.y=t[c+4],e.max.z=t[c+5],e}function Ki(c){let t=-1,e=-1/0;for(let n=0;n<3;n++){let i=c[n+3]-c[n];i>e&&(e=i,t=n)}return t}function Qi(c,t){t.set(c)}function ji(c,t,e){let n,i;for(let s=0;s<3;s++){let r=s+3;n=c[s],i=t[s],e[s]=n<i?n:i,n=c[r],i=t[r],e[r]=n>i?n:i}}function Be(c,t,e){for(let n=0;n<3;n++){let i=t[c+2*n],s=t[c+2*n+1],r=i-s,o=i+s;r<e[n]&&(e[n]=r),o>e[n+3]&&(e[n+3]=o)}}function me(c){let t=c[3]-c[0],e=c[4]-c[1],n=c[5]-c[2];return 2*(t*e+e*n+n*t)}var Dt=32,Kc=(c,t)=>c.candidate-t.candidate,kt=new Array(Dt).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),In=new Float32Array(6);function nr(c,t,e,n,i,s){let r=-1,o=0;if(s===0)r=Ki(t),r!==-1&&(o=(t[r]+t[r+3])/2);else if(s===1)r=Ki(c),r!==-1&&(o=Qc(e,n,i,r));else if(s===2){let a=me(c),l=1.25*i,u=n*6,f=(n+i)*6;for(let h=0;h<3;h++){let d=t[h],_=(t[h+3]-d)/Dt;if(i<Dt/4){let g=[...kt];g.length=i;let x=0;for(let S=u;S<f;S+=6,x++){let v=g[x];v.candidate=e[S+2*h],v.count=0;let{bounds:b,leftCacheBounds:T,rightCacheBounds:A}=v;for(let E=0;E<3;E++)A[E]=1/0,A[E+3]=-1/0,T[E]=1/0,T[E+3]=-1/0,b[E]=1/0,b[E+3]=-1/0;Be(S,e,b)}g.sort(Kc);let y=i;for(let S=0;S<y;S++){let v=g[S];for(;S+1<y&&g[S+1].candidate===v.candidate;)g.splice(S+1,1),y--}for(let S=u;S<f;S+=6){let v=e[S+2*h];for(let b=0;b<y;b++){let T=g[b];v>=T.candidate?Be(S,e,T.rightCacheBounds):(Be(S,e,T.leftCacheBounds),T.count++)}}for(let S=0;S<y;S++){let v=g[S],b=v.count,T=i-v.count,A=v.leftCacheBounds,E=v.rightCacheBounds,C=0;b!==0&&(C=me(A)/a);let R=0;T!==0&&(R=me(E)/a);let w=1+1.25*(C*b+R*T);w<l&&(r=h,l=w,o=v.candidate)}}else{for(let y=0;y<Dt;y++){let S=kt[y];S.count=0,S.candidate=d+_+y*_;let v=S.bounds;for(let b=0;b<3;b++)v[b]=1/0,v[b+3]=-1/0}for(let y=u;y<f;y+=6){let b=~~((e[y+2*h]-d)/_);b>=Dt&&(b=Dt-1);let T=kt[b];T.count++,Be(y,e,T.bounds)}let g=kt[Dt-1];Qi(g.bounds,g.rightCacheBounds);for(let y=Dt-2;y>=0;y--){let S=kt[y],v=kt[y+1];ji(S.bounds,v.rightCacheBounds,S.rightCacheBounds)}let x=0;for(let y=0;y<Dt-1;y++){let S=kt[y],v=S.count,b=S.bounds,A=kt[y+1].rightCacheBounds;v!==0&&(x===0?Qi(b,In):ji(b,In,In)),x+=v;let E=0,C=0;x!==0&&(E=me(In)/a);let R=i-x;R!==0&&(C=me(A)/a);let w=1+1.25*(E*x+C*R);w<l&&(r=h,l=w,o=S.candidate)}}}}else console.warn(\`MeshBVH: Invalid build strategy value \${s} used.\`);return{axis:r,pos:o}}function Qc(c,t,e,n){let i=0;for(let s=t,r=t+e;s<r;s++)i+=c[s*6+n*2];return i/e}var ge=class{constructor(){this.boundingData=new Float32Array(6)}};function ir(c,t,e,n,i,s){let r=n,o=n+i-1,a=s.pos,l=s.axis*2;for(;;){for(;r<=o&&e[r*6+l]<a;)r++;for(;r<=o&&e[o*6+l]>=a;)o--;if(r<o){for(let u=0;u<3;u++){let f=t[r*3+u];t[r*3+u]=t[o*3+u],t[o*3+u]=f}for(let u=0;u<6;u++){let f=e[r*6+u];e[r*6+u]=e[o*6+u],e[o*6+u]=f}r++,o--}else return r}}function sr(c,t,e,n,i,s){let r=n,o=n+i-1,a=s.pos,l=s.axis*2;for(;;){for(;r<=o&&e[r*6+l]<a;)r++;for(;r<=o&&e[o*6+l]>=a;)o--;if(r<o){let u=c[r];c[r]=c[o],c[o]=u;for(let f=0;f<6;f++){let h=e[r*6+f];e[r*6+f]=e[o*6+f],e[o*6+f]=h}r++,o--}else return r}}function q(c,t){return t[c+15]===65535}function Z(c,t){return t[c+6]}function $(c,t){return t[c+14]}function tt(c){return c+8}function et(c,t){return t[c+6]}function Ln(c,t){return t[c+7]}var rr,Oe,Dn,or,jc=Math.pow(2,32);function Nn(c){return"count"in c?1:1+Nn(c.left)+Nn(c.right)}function ar(c,t,e){return rr=new Float32Array(e),Oe=new Uint32Array(e),Dn=new Uint16Array(e),or=new Uint8Array(e),ts(c,t)}function ts(c,t){let e=c/4,n=c/2,i="count"in t,s=t.boundingData;for(let r=0;r<6;r++)rr[e+r]=s[r];if(i)if(t.buffer){let r=t.buffer;or.set(new Uint8Array(r),c);for(let o=c,a=c+r.byteLength;o<a;o+=32){let l=o/2;q(l,Dn)||(Oe[o/4+6]+=e)}return c+r.byteLength}else{let r=t.offset,o=t.count;return Oe[e+6]=r,Dn[n+14]=o,Dn[n+15]=65535,c+32}else{let r=t.left,o=t.right,a=t.splitAxis,l;if(l=ts(c+32,r),l/4>jc)throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return Oe[e+6]=l/4,l=ts(l,o),Oe[e+7]=a,l}}function tl(c,t){let e=(c.index?c.index.count:c.attributes.position.count)/3,n=e>2**16,i=n?4:2,s=t?new SharedArrayBuffer(e*i):new ArrayBuffer(e*i),r=n?new Uint32Array(s):new Uint16Array(s);for(let o=0,a=r.length;o<a;o++)r[o]=o;return r}function el(c,t,e,n,i){let{maxDepth:s,verbose:r,maxLeafTris:o,strategy:a,onProgress:l,indirect:u}=i,f=c._indirectBuffer,h=c.geometry,d=h.index?h.index.array:null,p=u?sr:ir,m=Et(h),_=new Float32Array(6),g=!1,x=new ge;return Pn(t,e,n,x.boundingData,_),S(x,e,n,_),x;function y(v){l&&l(v/m)}function S(v,b,T,A=null,E=0){if(!g&&E>=s&&(g=!0,r&&(console.warn(\`MeshBVH: Max depth of \${s} reached when generating BVH. Consider increasing maxDepth.\`),console.warn(h))),T<=o||E>=s)return y(b+T),v.offset=b,v.count=T,v;let C=nr(v.boundingData,A,t,b,T,a);if(C.axis===-1)return y(b+T),v.offset=b,v.count=T,v;let R=p(f,d,t,b,T,C);if(R===b||R===b+T)y(b+T),v.offset=b,v.count=T;else{v.splitAxis=C.axis;let w=new ge,P=b,L=R-b;v.left=w,Pn(t,P,L,w.boundingData,_),S(w,P,L,_,E+1);let D=new ge,O=R,it=T-L;v.right=D,Pn(t,O,it,D.boundingData,_),S(D,O,it,_,E+1)}return v}}function cr(c,t){let e=c.geometry;t.indirect&&(c._indirectBuffer=tl(e,t.useSharedArrayBuffer),Qs(e,t.range)&&!t.verbose&&console.warn('MeshBVH: Provided geometry contains groups or a range that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),c._indirectBuffer||Ks(e,t);let n=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=js(e),s=t.indirect?Ji(e,t.range):$i(e,t.range);c._roots=s.map(r=>{let o=el(c,i,r.offset,r.count,t),a=Nn(o),l=new n(32*a);return ar(0,o,l),l})}var ht=class{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(t,e){let n=1/0,i=-1/0;for(let s=0,r=t.length;s<r;s++){let a=t[s][e];n=a<n?a:n,i=a>i?a:i}this.min=n,this.max=i}setFromPoints(t,e){let n=1/0,i=-1/0;for(let s=0,r=e.length;s<r;s++){let o=e[s],a=t.dot(o);n=a<n?a:n,i=a>i?a:i}this.min=n,this.max=i}isSeparated(t){return this.min>t.max||t.min>this.max}};ht.prototype.setFromBox=(function(){let c=new M;return function(e,n){let i=n.min,s=n.max,r=1/0,o=-1/0;for(let a=0;a<=1;a++)for(let l=0;l<=1;l++)for(let u=0;u<=1;u++){c.x=i.x*a+s.x*(1-a),c.y=i.y*l+s.y*(1-l),c.z=i.z*u+s.z*(1-u);let f=e.dot(c);r=Math.min(f,r),o=Math.max(f,o)}this.min=r,this.max=o}})();var Tg=(function(){let c=new ht;return function(e,n){let i=e.points,s=e.satAxes,r=e.satBounds,o=n.points,a=n.satAxes,l=n.satBounds;for(let u=0;u<3;u++){let f=r[u],h=s[u];if(c.setFromPoints(h,o),f.isSeparated(c))return!1}for(let u=0;u<3;u++){let f=l[u],h=a[u];if(c.setFromPoints(h,i),f.isSeparated(c))return!1}}})();var nl=(function(){let c=new M,t=new M,e=new M;return function(i,s,r){let o=i.start,a=c,l=s.start,u=t;e.subVectors(o,l),c.subVectors(i.end,i.start),t.subVectors(s.end,s.start);let f=e.dot(u),h=u.dot(a),d=u.dot(u),p=e.dot(a),_=a.dot(a)*d-h*h,g,x;_!==0?g=(f*h-p*d)/_:g=0,x=(f+g*h)/d,r.x=g,r.y=x}})(),Ve=(function(){let c=new H,t=new M,e=new M;return function(i,s,r,o){nl(i,s,c);let a=c.x,l=c.y;if(a>=0&&a<=1&&l>=0&&l<=1){i.at(a,r),s.at(l,o);return}else if(a>=0&&a<=1){l<0?s.at(0,o):s.at(1,o),i.closestPointToPoint(o,!0,r);return}else if(l>=0&&l<=1){a<0?i.at(0,r):i.at(1,r),s.closestPointToPoint(r,!0,o);return}else{let u;a<0?u=i.start:u=i.end;let f;l<0?f=s.start:f=s.end;let h=t,d=e;if(i.closestPointToPoint(f,!0,t),s.closestPointToPoint(u,!0,e),h.distanceToSquared(f)<=d.distanceToSquared(u)){r.copy(h),o.copy(f);return}else{r.copy(u),o.copy(d);return}}}})(),lr=(function(){let c=new M,t=new M,e=new Jt,n=new at;return function(s,r){let{radius:o,center:a}=s,{a:l,b:u,c:f}=r;if(n.start=l,n.end=u,n.closestPointToPoint(a,!0,c).distanceTo(a)<=o||(n.start=l,n.end=f,n.closestPointToPoint(a,!0,c).distanceTo(a)<=o)||(n.start=u,n.end=f,n.closestPointToPoint(a,!0,c).distanceTo(a)<=o))return!0;let m=r.getPlane(e);if(Math.abs(m.distanceToPoint(a))<=o){let g=m.projectPoint(a,t);if(r.containsPoint(g))return!0}return!1}})();var il=1e-15;function es(c){return Math.abs(c)<il}var nt=class extends St{constructor(...t){super(...t),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new M),this.satBounds=new Array(4).fill().map(()=>new ht),this.points=[this.a,this.b,this.c],this.sphere=new pe,this.plane=new Jt,this.needsUpdate=!0}intersectsSphere(t){return lr(t,this)}update(){let t=this.a,e=this.b,n=this.c,i=this.points,s=this.satAxes,r=this.satBounds,o=s[0],a=r[0];this.getNormal(o),a.setFromPoints(o,i);let l=s[1],u=r[1];l.subVectors(t,e),u.setFromPoints(l,i);let f=s[2],h=r[2];f.subVectors(e,n),h.setFromPoints(f,i);let d=s[3],p=r[3];d.subVectors(n,t),p.setFromPoints(d,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(o,t),this.needsUpdate=!1}};nt.prototype.closestPointToSegment=(function(){let c=new M,t=new M,e=new at;return function(i,s=null,r=null){let{start:o,end:a}=i,l=this.points,u,f=1/0;for(let h=0;h<3;h++){let d=(h+1)%3;e.start.copy(l[h]),e.end.copy(l[d]),Ve(e,i,c,t),u=c.distanceToSquared(t),u<f&&(f=u,s&&s.copy(c),r&&r.copy(t))}return this.closestPointToPoint(o,c),u=o.distanceToSquared(c),u<f&&(f=u,s&&s.copy(c),r&&r.copy(o)),this.closestPointToPoint(a,c),u=a.distanceToSquared(c),u<f&&(f=u,s&&s.copy(c),r&&r.copy(a)),Math.sqrt(f)}})();nt.prototype.intersectsTriangle=(function(){let c=new nt,t=new Array(3),e=new Array(3),n=new ht,i=new ht,s=new M,r=new M,o=new M,a=new M,l=new M,u=new at,f=new at,h=new at,d=new M;function p(m,_,g){let x=m.points,y=0,S=-1;for(let v=0;v<3;v++){let{start:b,end:T}=u;b.copy(x[v]),T.copy(x[(v+1)%3]),u.delta(r);let A=es(_.distanceToPoint(b));if(es(_.normal.dot(r))&&A){g.copy(u),y=2;break}let E=_.intersectLine(u,d);if(!E&&A&&d.copy(b),(E||A)&&!es(d.distanceTo(T))){if(y<=1)(y===1?g.start:g.end).copy(d),A&&(S=y);else if(y>=2){(S===1?g.start:g.end).copy(d),y=2;break}if(y++,y===2&&S===-1)break}}return y}return function(_,g=null,x=!1){this.needsUpdate&&this.update(),_.isExtendedTriangle?_.needsUpdate&&_.update():(c.copy(_),c.update(),_=c);let y=this.plane,S=_.plane;if(Math.abs(y.normal.dot(S.normal))>1-1e-10){let v=this.satBounds,b=this.satAxes;e[0]=_.a,e[1]=_.b,e[2]=_.c;for(let E=0;E<4;E++){let C=v[E],R=b[E];if(n.setFromPoints(R,e),C.isSeparated(n))return!1}let T=_.satBounds,A=_.satAxes;t[0]=this.a,t[1]=this.b,t[2]=this.c;for(let E=0;E<4;E++){let C=T[E],R=A[E];if(n.setFromPoints(R,t),C.isSeparated(n))return!1}for(let E=0;E<4;E++){let C=b[E];for(let R=0;R<4;R++){let w=A[R];if(s.crossVectors(C,w),n.setFromPoints(s,t),i.setFromPoints(s,e),n.isSeparated(i))return!1}}return g&&(x||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),g.start.set(0,0,0),g.end.set(0,0,0)),!0}else{let v=p(this,S,f);if(v===1&&_.containsPoint(f.end))return g&&(g.start.copy(f.end),g.end.copy(f.end)),!0;if(v!==2)return!1;let b=p(_,y,h);if(b===1&&this.containsPoint(h.end))return g&&(g.start.copy(h.end),g.end.copy(h.end)),!0;if(b!==2)return!1;if(f.delta(o),h.delta(a),o.dot(a)<0){let P=h.start;h.start=h.end,h.end=P}let T=f.start.dot(o),A=f.end.dot(o),E=h.start.dot(o),C=h.end.dot(o),R=A<E,w=T<C;return T!==C&&E!==A&&R===w?!1:(g&&(l.subVectors(f.start,h.start),l.dot(o)>0?g.start.copy(f.start):g.start.copy(h.start),l.subVectors(f.end,h.end),l.dot(o)<0?g.end.copy(f.end):g.end.copy(h.end)),!0)}}})();nt.prototype.distanceToPoint=(function(){let c=new M;return function(e){return this.closestPointToPoint(e,c),e.distanceTo(c)}})();nt.prototype.distanceToTriangle=(function(){let c=new M,t=new M,e=["a","b","c"],n=new at,i=new at;return function(r,o=null,a=null){let l=o||a?n:null;if(this.intersectsTriangle(r,l))return(o||a)&&(o&&l.getCenter(o),a&&l.getCenter(a)),0;let u=1/0;for(let f=0;f<3;f++){let h,d=e[f],p=r[d];this.closestPointToPoint(p,c),h=p.distanceToSquared(c),h<u&&(u=h,o&&o.copy(c),a&&a.copy(p));let m=this[d];r.closestPointToPoint(m,c),h=m.distanceToSquared(c),h<u&&(u=h,o&&o.copy(m),a&&a.copy(c))}for(let f=0;f<3;f++){let h=e[f],d=e[(f+1)%3];n.set(this[h],this[d]);for(let p=0;p<3;p++){let m=e[p],_=e[(p+1)%3];i.set(r[m],r[_]),Ve(n,i,c,t);let g=c.distanceToSquared(t);g<u&&(u=g,o&&o.copy(c),a&&a.copy(t))}}return Math.sqrt(u)}})();var Y=class{constructor(t,e,n){this.isOrientedBox=!0,this.min=new M,this.max=new M,this.matrix=new W,this.invMatrix=new W,this.points=new Array(8).fill().map(()=>new M),this.satAxes=new Array(3).fill().map(()=>new M),this.satBounds=new Array(3).fill().map(()=>new ht),this.alignedSatBounds=new Array(3).fill().map(()=>new ht),this.needsUpdate=!1,t&&this.min.copy(t),e&&this.max.copy(e),n&&this.matrix.copy(n)}set(t,e,n){this.min.copy(t),this.max.copy(e),this.matrix.copy(n),this.needsUpdate=!0}copy(t){this.min.copy(t.min),this.max.copy(t.max),this.matrix.copy(t.matrix),this.needsUpdate=!0}};Y.prototype.update=(function(){return function(){let t=this.matrix,e=this.min,n=this.max,i=this.points;for(let l=0;l<=1;l++)for(let u=0;u<=1;u++)for(let f=0;f<=1;f++){let h=1*l|2*u|4*f,d=i[h];d.x=l?n.x:e.x,d.y=u?n.y:e.y,d.z=f?n.z:e.z,d.applyMatrix4(t)}let s=this.satBounds,r=this.satAxes,o=i[0];for(let l=0;l<3;l++){let u=r[l],f=s[l],h=1<<l,d=i[h];u.subVectors(o,d),f.setFromPoints(u,i)}let a=this.alignedSatBounds;a[0].setFromPointsField(i,"x"),a[1].setFromPointsField(i,"y"),a[2].setFromPointsField(i,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}})();Y.prototype.intersectsBox=(function(){let c=new ht;return function(e){this.needsUpdate&&this.update();let n=e.min,i=e.max,s=this.satBounds,r=this.satAxes,o=this.alignedSatBounds;if(c.min=n.x,c.max=i.x,o[0].isSeparated(c)||(c.min=n.y,c.max=i.y,o[1].isSeparated(c))||(c.min=n.z,c.max=i.z,o[2].isSeparated(c)))return!1;for(let a=0;a<3;a++){let l=r[a],u=s[a];if(c.setFromBox(l,e),u.isSeparated(c))return!1}return!0}})();Y.prototype.intersectsTriangle=(function(){let c=new nt,t=new Array(3),e=new ht,n=new ht,i=new M;return function(r){this.needsUpdate&&this.update(),r.isExtendedTriangle?r.needsUpdate&&r.update():(c.copy(r),c.update(),r=c);let o=this.satBounds,a=this.satAxes;t[0]=r.a,t[1]=r.b,t[2]=r.c;for(let h=0;h<3;h++){let d=o[h],p=a[h];if(e.setFromPoints(p,t),d.isSeparated(e))return!1}let l=r.satBounds,u=r.satAxes,f=this.points;for(let h=0;h<3;h++){let d=l[h],p=u[h];if(e.setFromPoints(p,f),d.isSeparated(e))return!1}for(let h=0;h<3;h++){let d=a[h];for(let p=0;p<4;p++){let m=u[p];if(i.crossVectors(d,m),e.setFromPoints(i,t),n.setFromPoints(i,f),e.isSeparated(n))return!1}}return!0}})();Y.prototype.closestPointToPoint=(function(){return function(t,e){return this.needsUpdate&&this.update(),e.copy(t).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),e}})();Y.prototype.distanceToPoint=(function(){let c=new M;return function(e){return this.closestPointToPoint(e,c),e.distanceTo(c)}})();Y.prototype.distanceToBox=(function(){let c=["x","y","z"],t=new Array(12).fill().map(()=>new at),e=new Array(12).fill().map(()=>new at),n=new M,i=new M;return function(r,o=0,a=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(r))return(a||l)&&(r.getCenter(i),this.closestPointToPoint(i,n),r.closestPointToPoint(n,i),a&&a.copy(n),l&&l.copy(i)),0;let u=o*o,f=r.min,h=r.max,d=this.points,p=1/0;for(let _=0;_<8;_++){let g=d[_];i.copy(g).clamp(f,h);let x=g.distanceToSquared(i);if(x<p&&(p=x,a&&a.copy(g),l&&l.copy(i),x<u))return Math.sqrt(x)}let m=0;for(let _=0;_<3;_++)for(let g=0;g<=1;g++)for(let x=0;x<=1;x++){let y=(_+1)%3,S=(_+2)%3,v=g<<y|x<<S,b=1<<_|g<<y|x<<S,T=d[v],A=d[b];t[m].set(T,A);let C=c[_],R=c[y],w=c[S],P=e[m],L=P.start,D=P.end;L[C]=f[C],L[R]=g?f[R]:h[R],L[w]=x?f[w]:h[R],D[C]=h[C],D[R]=g?f[R]:h[R],D[w]=x?f[w]:h[R],m++}for(let _=0;_<=1;_++)for(let g=0;g<=1;g++)for(let x=0;x<=1;x++){i.x=_?h.x:f.x,i.y=g?h.y:f.y,i.z=x?h.z:f.z,this.closestPointToPoint(i,n);let y=i.distanceToSquared(n);if(y<p&&(p=y,a&&a.copy(n),l&&l.copy(i),y<u))return Math.sqrt(y)}for(let _=0;_<12;_++){let g=t[_];for(let x=0;x<12;x++){let y=e[x];Ve(g,y,n,i);let S=n.distanceToSquared(i);if(S<p&&(p=S,a&&a.copy(n),l&&l.copy(i),S<u))return Math.sqrt(S)}}return Math.sqrt(p)}})();var Gt=class{constructor(t){this._getNewPrimitive=t,this._primitives=[]}getPrimitive(){let t=this._primitives;return t.length===0?this._getNewPrimitive():t.pop()}releasePrimitive(t){this._primitives.push(t)}};var ns=class extends Gt{constructor(){super(()=>new nt)}},lt=new ns;var is=class{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;let t=[],e=null;this.setBuffer=n=>{e&&t.push(e),e=n,this.float32Array=new Float32Array(n),this.uint16Array=new Uint16Array(n),this.uint32Array=new Uint32Array(n)},this.clearBuffer=()=>{e=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,t.length!==0&&this.setBuffer(t.pop())}}},B=new is;var Ht,xe,_e=[],Fn=new Gt(()=>new X);function ur(c,t,e,n,i,s){Ht=Fn.getPrimitive(),xe=Fn.getPrimitive(),_e.push(Ht,xe),B.setBuffer(c._roots[t]);let r=ss(0,c.geometry,e,n,i,s);B.clearBuffer(),Fn.releasePrimitive(Ht),Fn.releasePrimitive(xe),_e.pop(),_e.pop();let o=_e.length;return o>0&&(xe=_e[o-1],Ht=_e[o-2]),r}function ss(c,t,e,n,i=null,s=0,r=0){let{float32Array:o,uint16Array:a,uint32Array:l}=B,u=c*2;if(q(u,a)){let h=Z(c,l),d=$(u,a);return z(c,o,Ht),n(h,d,!1,r,s+c,Ht)}else{let C=function(w){let{uint16Array:P,uint32Array:L}=B,D=w*2;for(;!q(D,P);)w=tt(w),D=w*2;return Z(w,L)},R=function(w){let{uint16Array:P,uint32Array:L}=B,D=w*2;for(;!q(D,P);)w=et(w,L),D=w*2;return Z(w,L)+$(D,P)},h=tt(c),d=et(c,l),p=h,m=d,_,g,x,y;if(i&&(x=Ht,y=xe,z(p,o,x),z(m,o,y),_=i(x),g=i(y),g<_)){p=d,m=h;let w=_;_=g,g=w,x=y}x||(x=Ht,z(p,o,x));let S=q(p*2,a),v=e(x,S,_,r+1,s+p),b;if(v===2){let w=C(p),L=R(p)-w;b=n(w,L,!0,r+1,s+p,x)}else b=v&&ss(p,t,e,n,i,s,r+1);if(b)return!0;y=xe,z(m,o,y);let T=q(m*2,a),A=e(y,T,g,r+1,s+m),E;if(A===2){let w=C(m),L=R(m)-w;E=n(w,L,!0,r+1,s+m,y)}else E=A&&ss(m,t,e,n,i,s,r+1);return!!E}}var ke=new M,os=new M;function hr(c,t,e={},n=0,i=1/0){let s=n*n,r=i*i,o=1/0,a=null;if(c.shapecast({boundsTraverseOrder:u=>(ke.copy(t).clamp(u.min,u.max),ke.distanceToSquared(t)),intersectsBounds:(u,f,h)=>h<o&&h<r,intersectsTriangle:(u,f)=>{u.closestPointToPoint(t,ke);let h=t.distanceToSquared(ke);return h<o&&(os.copy(ke),o=h,a=f),h<s}}),o===1/0)return null;let l=Math.sqrt(o);return e.point?e.point.copy(os):e.point=os.clone(),e.distance=l,e.faceIndex=a,e}var rl=parseInt("184")>=169,$t=new M,Kt=new M,Qt=new M,Bn=new H,On=new H,zn=new H,fr=new M,dr=new M,pr=new M,Ge=new M;function ol(c,t,e,n,i,s,r,o){let a;if(s===Ui?a=c.intersectTriangle(n,e,t,!0,i):a=c.intersectTriangle(t,e,n,s!==Fi,i),a===null)return null;let l=c.origin.distanceTo(i);return l<r||l>o?null:{distance:l,point:i.clone()}}function al(c,t,e,n,i,s,r,o,a,l,u){$t.fromBufferAttribute(t,s),Kt.fromBufferAttribute(t,r),Qt.fromBufferAttribute(t,o);let f=ol(c,$t,Kt,Qt,Ge,a,l,u);if(f){let h=new M;St.getBarycoord(Ge,$t,Kt,Qt,h),n&&(Bn.fromBufferAttribute(n,s),On.fromBufferAttribute(n,r),zn.fromBufferAttribute(n,o),f.uv=St.getInterpolation(Ge,$t,Kt,Qt,Bn,On,zn,new H)),i&&(Bn.fromBufferAttribute(i,s),On.fromBufferAttribute(i,r),zn.fromBufferAttribute(i,o),f.uv1=St.getInterpolation(Ge,$t,Kt,Qt,Bn,On,zn,new H)),e&&(fr.fromBufferAttribute(e,s),dr.fromBufferAttribute(e,r),pr.fromBufferAttribute(e,o),f.normal=St.getInterpolation(Ge,$t,Kt,Qt,fr,dr,pr,new M),f.normal.dot(c.direction)>0&&f.normal.multiplyScalar(-1));let d={a:s,b:r,c:o,normal:new M,materialIndex:0};St.getNormal($t,Kt,Qt,d.normal),f.face=d,f.faceIndex=s,rl&&(f.barycoord=h)}return f}function ye(c,t,e,n,i,s,r){let o=n*3,a=o+0,l=o+1,u=o+2,f=c.index;c.index&&(a=f.getX(a),l=f.getX(l),u=f.getX(u));let{position:h,normal:d,uv:p,uv1:m}=c.attributes,_=al(e,h,d,p,m,a,l,u,t,s,r);return _?(_.faceIndex=n,i&&i.push(_),_):null}function V(c,t,e,n){let i=c.a,s=c.b,r=c.c,o=t,a=t+1,l=t+2;e&&(o=e.getX(o),a=e.getX(a),l=e.getX(l)),i.x=n.getX(o),i.y=n.getY(o),i.z=n.getZ(o),s.x=n.getX(a),s.y=n.getY(a),s.z=n.getZ(a),r.x=n.getX(l),r.y=n.getY(l),r.z=n.getZ(l)}function mr(c,t,e,n,i,s,r,o){let{geometry:a,_indirectBuffer:l}=c;for(let u=n,f=n+i;u<f;u++)ye(a,t,e,u,s,r,o)}function gr(c,t,e,n,i,s,r){let{geometry:o,_indirectBuffer:a}=c,l=1/0,u=null;for(let f=n,h=n+i;f<h;f++){let d;d=ye(o,t,e,f,null,s,r),d&&d.distance<l&&(u=d,l=d.distance)}return u}function _r(c,t,e,n,i,s,r){let{geometry:o}=e,{index:a}=o,l=o.attributes.position;for(let u=c,f=t+c;u<f;u++){let h;if(h=u,V(r,h*3,a,l),r.needsUpdate=!0,n(r,h,i,s))return!0}return!1}function xr(c,t=null){t&&Array.isArray(t)&&(t=new Set(t));let e=c.geometry,n=e.index?e.index.array:null,i=e.attributes.position,s,r,o,a,l=0,u=c._roots;for(let h=0,d=u.length;h<d;h++)s=u[h],r=new Uint32Array(s),o=new Uint16Array(s),a=new Float32Array(s),f(0,l),l+=s.byteLength;function f(h,d,p=!1){let m=h*2;if(o[m+15]===65535){let g=r[h+6],x=o[m+14],y=1/0,S=1/0,v=1/0,b=-1/0,T=-1/0,A=-1/0;for(let E=3*g,C=3*(g+x);E<C;E++){let R=n[E],w=i.getX(R),P=i.getY(R),L=i.getZ(R);w<y&&(y=w),w>b&&(b=w),P<S&&(S=P),P>T&&(T=P),L<v&&(v=L),L>A&&(A=L)}return a[h+0]!==y||a[h+1]!==S||a[h+2]!==v||a[h+3]!==b||a[h+4]!==T||a[h+5]!==A?(a[h+0]=y,a[h+1]=S,a[h+2]=v,a[h+3]=b,a[h+4]=T,a[h+5]=A,!0):!1}else{let g=h+8,x=r[h+6],y=g+d,S=x+d,v=p,b=!1,T=!1;t?v||(b=t.has(y),T=t.has(S),v=!b&&!T):(b=!0,T=!0);let A=v||b,E=v||T,C=!1;A&&(C=f(g,d,v));let R=!1;E&&(R=f(x,d,v));let w=C||R;if(w)for(let P=0;P<3;P++){let L=g+P,D=x+P,O=a[L],it=a[L+3],Tt=a[D],At=a[D+3];a[h+P]=O<Tt?O:Tt,a[h+P+3]=it>At?it:At}return w}}}function xt(c,t,e,n,i){let s,r,o,a,l,u,f=1/e.direction.x,h=1/e.direction.y,d=1/e.direction.z,p=e.origin.x,m=e.origin.y,_=e.origin.z,g=t[c],x=t[c+3],y=t[c+1],S=t[c+3+1],v=t[c+2],b=t[c+3+2];return f>=0?(s=(g-p)*f,r=(x-p)*f):(s=(x-p)*f,r=(g-p)*f),h>=0?(o=(y-m)*h,a=(S-m)*h):(o=(S-m)*h,a=(y-m)*h),s>a||o>r||((o>s||isNaN(s))&&(s=o),(a<r||isNaN(r))&&(r=a),d>=0?(l=(v-_)*d,u=(b-_)*d):(l=(b-_)*d,u=(v-_)*d),s>u||l>r)?!1:((l>s||s!==s)&&(s=l),(u<r||r!==r)&&(r=u),s<=i&&r>=n)}function yr(c,t,e,n,i,s,r,o){let{geometry:a,_indirectBuffer:l}=c;for(let u=n,f=n+i;u<f;u++){let h=l?l[u]:u;ye(a,t,e,h,s,r,o)}}function vr(c,t,e,n,i,s,r){let{geometry:o,_indirectBuffer:a}=c,l=1/0,u=null;for(let f=n,h=n+i;f<h;f++){let d;d=ye(o,t,e,a?a[f]:f,null,s,r),d&&d.distance<l&&(u=d,l=d.distance)}return u}function Mr(c,t,e,n,i,s,r){let{geometry:o}=e,{index:a}=o,l=o.attributes.position;for(let u=c,f=t+c;u<f;u++){let h;if(h=e.resolveTriangleIndex(u),V(r,h*3,a,l),r.needsUpdate=!0,n(r,h,i,s))return!0}return!1}function Sr(c,t,e,n,i,s,r){B.setBuffer(c._roots[t]),as(0,c,e,n,i,s,r),B.clearBuffer()}function as(c,t,e,n,i,s,r){let{float32Array:o,uint16Array:a,uint32Array:l}=B,u=c*2;if(q(u,a)){let h=Z(c,l),d=$(u,a);mr(t,e,n,h,d,i,s,r)}else{let h=tt(c);xt(h,o,n,s,r)&&as(h,t,e,n,i,s,r);let d=et(c,l);xt(d,o,n,s,r)&&as(d,t,e,n,i,s,r)}}var cl=["x","y","z"];function br(c,t,e,n,i,s){B.setBuffer(c._roots[t]);let r=cs(0,c,e,n,i,s);return B.clearBuffer(),r}function cs(c,t,e,n,i,s){let{float32Array:r,uint16Array:o,uint32Array:a}=B,l=c*2;if(q(l,o)){let f=Z(c,a),h=$(l,o);return gr(t,e,n,f,h,i,s)}else{let f=Ln(c,a),h=cl[f],p=n.direction[h]>=0,m,_;p?(m=tt(c),_=et(c,a)):(m=et(c,a),_=tt(c));let x=xt(m,r,n,i,s)?cs(m,t,e,n,i,s):null;if(x){let v=x.point[h];if(p?v<=r[_+f]:v>=r[_+f+3])return x}let S=xt(_,r,n,i,s)?cs(_,t,e,n,i,s):null;return x&&S?x.distance<=S.distance?x:S:x||S||null}}var Vn=new X,ve=new nt,Me=new nt,He=new W,Tr=new Y,kn=new Y;function Ar(c,t,e,n){B.setBuffer(c._roots[t]);let i=ls(0,c,e,n);return B.clearBuffer(),i}function ls(c,t,e,n,i=null){let{float32Array:s,uint16Array:r,uint32Array:o}=B,a=c*2;if(i===null&&(e.boundingBox||e.computeBoundingBox(),Tr.set(e.boundingBox.min,e.boundingBox.max,n),i=Tr),q(a,r)){let u=t.geometry,f=u.index,h=u.attributes.position,d=e.index,p=e.attributes.position,m=Z(c,o),_=$(a,r);if(He.copy(n).invert(),e.boundsTree)return z(c,s,kn),kn.matrix.copy(He),kn.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:x=>kn.intersectsBox(x),intersectsTriangle:x=>{x.a.applyMatrix4(n),x.b.applyMatrix4(n),x.c.applyMatrix4(n),x.needsUpdate=!0;for(let y=m*3,S=(_+m)*3;y<S;y+=3)if(V(Me,y,f,h),Me.needsUpdate=!0,x.intersectsTriangle(Me))return!0;return!1}});for(let g=m*3,x=(_+m)*3;g<x;g+=3){V(ve,g,f,h),ve.a.applyMatrix4(He),ve.b.applyMatrix4(He),ve.c.applyMatrix4(He),ve.needsUpdate=!0;for(let y=0,S=d.count;y<S;y+=3)if(V(Me,y,d,p),Me.needsUpdate=!0,ve.intersectsTriangle(Me))return!0}}else{let u=c+8,f=o[c+6];return z(u,s,Vn),!!(i.intersectsBox(Vn)&&ls(u,t,e,n,i)||(z(f,s,Vn),i.intersectsBox(Vn)&&ls(f,t,e,n,i)))}}var Gn=new W,us=new Y,We=new Y,ll=new M,ul=new M,hl=new M,fl=new M;function Er(c,t,e,n={},i={},s=0,r=1/0){t.boundingBox||t.computeBoundingBox(),us.set(t.boundingBox.min,t.boundingBox.max,e),us.needsUpdate=!0;let o=c.geometry,a=o.attributes.position,l=o.index,u=t.attributes.position,f=t.index,h=lt.getPrimitive(),d=lt.getPrimitive(),p=ll,m=ul,_=null,g=null;i&&(_=hl,g=fl);let x=1/0,y=null,S=null;return Gn.copy(e).invert(),We.matrix.copy(Gn),c.shapecast({boundsTraverseOrder:v=>us.distanceToBox(v),intersectsBounds:(v,b,T)=>T<x&&T<r?(b&&(We.min.copy(v.min),We.max.copy(v.max),We.needsUpdate=!0),!0):!1,intersectsRange:(v,b)=>{if(t.boundsTree)return t.boundsTree.shapecast({boundsTraverseOrder:A=>We.distanceToBox(A),intersectsBounds:(A,E,C)=>C<x&&C<r,intersectsRange:(A,E)=>{for(let C=A,R=A+E;C<R;C++){V(d,3*C,f,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let w=v,P=v+b;w<P;w++){V(h,3*w,l,a),h.needsUpdate=!0;let L=h.distanceToTriangle(d,p,_);if(L<x&&(m.copy(p),g&&g.copy(_),x=L,y=w,S=C),L<s)return!0}}}});{let T=Et(t);for(let A=0,E=T;A<E;A++){V(d,3*A,f,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let C=v,R=v+b;C<R;C++){V(h,3*C,l,a),h.needsUpdate=!0;let w=h.distanceToTriangle(d,p,_);if(w<x&&(m.copy(p),g&&g.copy(_),x=w,y=C,S=A),w<s)return!0}}}}}),lt.releasePrimitive(h),lt.releasePrimitive(d),x===1/0?null:(n.point?n.point.copy(m):n.point=m.clone(),n.distance=x,n.faceIndex=y,i&&(i.point?i.point.copy(g):i.point=g.clone(),i.point.applyMatrix4(Gn),m.applyMatrix4(Gn),i.distance=m.sub(i.point).length(),i.faceIndex=S),n)}function wr(c,t=null){t&&Array.isArray(t)&&(t=new Set(t));let e=c.geometry,n=e.index?e.index.array:null,i=e.attributes.position,s,r,o,a,l=0,u=c._roots;for(let h=0,d=u.length;h<d;h++)s=u[h],r=new Uint32Array(s),o=new Uint16Array(s),a=new Float32Array(s),f(0,l),l+=s.byteLength;function f(h,d,p=!1){let m=h*2;if(o[m+15]===65535){let g=r[h+6],x=o[m+14],y=1/0,S=1/0,v=1/0,b=-1/0,T=-1/0,A=-1/0;for(let E=g,C=g+x;E<C;E++){let R=3*c.resolveTriangleIndex(E);for(let w=0;w<3;w++){let P=R+w;P=n?n[P]:P;let L=i.getX(P),D=i.getY(P),O=i.getZ(P);L<y&&(y=L),L>b&&(b=L),D<S&&(S=D),D>T&&(T=D),O<v&&(v=O),O>A&&(A=O)}}return a[h+0]!==y||a[h+1]!==S||a[h+2]!==v||a[h+3]!==b||a[h+4]!==T||a[h+5]!==A?(a[h+0]=y,a[h+1]=S,a[h+2]=v,a[h+3]=b,a[h+4]=T,a[h+5]=A,!0):!1}else{let g=h+8,x=r[h+6],y=g+d,S=x+d,v=p,b=!1,T=!1;t?v||(b=t.has(y),T=t.has(S),v=!b&&!T):(b=!0,T=!0);let A=v||b,E=v||T,C=!1;A&&(C=f(g,d,v));let R=!1;E&&(R=f(x,d,v));let w=C||R;if(w)for(let P=0;P<3;P++){let L=g+P,D=x+P,O=a[L],it=a[L+3],Tt=a[D],At=a[D+3];a[h+P]=O<Tt?O:Tt,a[h+P+3]=it>At?it:At}return w}}}function Cr(c,t,e,n,i,s,r){B.setBuffer(c._roots[t]),hs(0,c,e,n,i,s,r),B.clearBuffer()}function hs(c,t,e,n,i,s,r){let{float32Array:o,uint16Array:a,uint32Array:l}=B,u=c*2;if(q(u,a)){let h=Z(c,l),d=$(u,a);yr(t,e,n,h,d,i,s,r)}else{let h=tt(c);xt(h,o,n,s,r)&&hs(h,t,e,n,i,s,r);let d=et(c,l);xt(d,o,n,s,r)&&hs(d,t,e,n,i,s,r)}}var dl=["x","y","z"];function Rr(c,t,e,n,i,s){B.setBuffer(c._roots[t]);let r=fs(0,c,e,n,i,s);return B.clearBuffer(),r}function fs(c,t,e,n,i,s){let{float32Array:r,uint16Array:o,uint32Array:a}=B,l=c*2;if(q(l,o)){let f=Z(c,a),h=$(l,o);return vr(t,e,n,f,h,i,s)}else{let f=Ln(c,a),h=dl[f],p=n.direction[h]>=0,m,_;p?(m=tt(c),_=et(c,a)):(m=et(c,a),_=tt(c));let x=xt(m,r,n,i,s)?fs(m,t,e,n,i,s):null;if(x){let v=x.point[h];if(p?v<=r[_+f]:v>=r[_+f+3])return x}let S=xt(_,r,n,i,s)?fs(_,t,e,n,i,s):null;return x&&S?x.distance<=S.distance?x:S:x||S||null}}var Hn=new X,Se=new nt,be=new nt,Xe=new W,Pr=new Y,Wn=new Y;function Ir(c,t,e,n){B.setBuffer(c._roots[t]);let i=ds(0,c,e,n);return B.clearBuffer(),i}function ds(c,t,e,n,i=null){let{float32Array:s,uint16Array:r,uint32Array:o}=B,a=c*2;if(i===null&&(e.boundingBox||e.computeBoundingBox(),Pr.set(e.boundingBox.min,e.boundingBox.max,n),i=Pr),q(a,r)){let u=t.geometry,f=u.index,h=u.attributes.position,d=e.index,p=e.attributes.position,m=Z(c,o),_=$(a,r);if(Xe.copy(n).invert(),e.boundsTree)return z(c,s,Wn),Wn.matrix.copy(Xe),Wn.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:x=>Wn.intersectsBox(x),intersectsTriangle:x=>{x.a.applyMatrix4(n),x.b.applyMatrix4(n),x.c.applyMatrix4(n),x.needsUpdate=!0;for(let y=m,S=_+m;y<S;y++)if(V(be,3*t.resolveTriangleIndex(y),f,h),be.needsUpdate=!0,x.intersectsTriangle(be))return!0;return!1}});for(let g=m,x=_+m;g<x;g++){let y=t.resolveTriangleIndex(g);V(Se,3*y,f,h),Se.a.applyMatrix4(Xe),Se.b.applyMatrix4(Xe),Se.c.applyMatrix4(Xe),Se.needsUpdate=!0;for(let S=0,v=d.count;S<v;S+=3)if(V(be,S,d,p),be.needsUpdate=!0,Se.intersectsTriangle(be))return!0}}else{let u=c+8,f=o[c+6];return z(u,s,Hn),!!(i.intersectsBox(Hn)&&ds(u,t,e,n,i)||(z(f,s,Hn),i.intersectsBox(Hn)&&ds(f,t,e,n,i)))}}var Xn=new W,ps=new Y,qe=new Y,pl=new M,ml=new M,gl=new M,_l=new M;function Lr(c,t,e,n={},i={},s=0,r=1/0){t.boundingBox||t.computeBoundingBox(),ps.set(t.boundingBox.min,t.boundingBox.max,e),ps.needsUpdate=!0;let o=c.geometry,a=o.attributes.position,l=o.index,u=t.attributes.position,f=t.index,h=lt.getPrimitive(),d=lt.getPrimitive(),p=pl,m=ml,_=null,g=null;i&&(_=gl,g=_l);let x=1/0,y=null,S=null;return Xn.copy(e).invert(),qe.matrix.copy(Xn),c.shapecast({boundsTraverseOrder:v=>ps.distanceToBox(v),intersectsBounds:(v,b,T)=>T<x&&T<r?(b&&(qe.min.copy(v.min),qe.max.copy(v.max),qe.needsUpdate=!0),!0):!1,intersectsRange:(v,b)=>{if(t.boundsTree){let T=t.boundsTree;return T.shapecast({boundsTraverseOrder:A=>qe.distanceToBox(A),intersectsBounds:(A,E,C)=>C<x&&C<r,intersectsRange:(A,E)=>{for(let C=A,R=A+E;C<R;C++){let w=T.resolveTriangleIndex(C);V(d,3*w,f,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let P=v,L=v+b;P<L;P++){let D=c.resolveTriangleIndex(P);V(h,3*D,l,a),h.needsUpdate=!0;let O=h.distanceToTriangle(d,p,_);if(O<x&&(m.copy(p),g&&g.copy(_),x=O,y=P,S=C),O<s)return!0}}}})}else{let T=Et(t);for(let A=0,E=T;A<E;A++){V(d,3*A,f,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let C=v,R=v+b;C<R;C++){let w=c.resolveTriangleIndex(C);V(h,3*w,l,a),h.needsUpdate=!0;let P=h.distanceToTriangle(d,p,_);if(P<x&&(m.copy(p),g&&g.copy(_),x=P,y=C,S=A),P<s)return!0}}}}}),lt.releasePrimitive(h),lt.releasePrimitive(d),x===1/0?null:(n.point?n.point.copy(m):n.point=m.clone(),n.distance=x,n.faceIndex=y,i&&(i.point?i.point.copy(g):i.point=g.clone(),i.point.applyMatrix4(Xn),m.applyMatrix4(Xn),i.distance=m.sub(i.point).length(),i.faceIndex=S),n)}function Dr(){return typeof SharedArrayBuffer<"u"}var Ye=new B.constructor,qn=new B.constructor,Wt=new Gt(()=>new X),Te=new X,Ae=new X,ms=new X,gs=new X,_s=!1;function Nr(c,t,e,n){if(_s)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");_s=!0;let i=c._roots,s=t._roots,r,o=0,a=0,l=new W().copy(e).invert();for(let u=0,f=i.length;u<f;u++){Ye.setBuffer(i[u]),a=0;let h=Wt.getPrimitive();z(0,Ye.float32Array,h),h.applyMatrix4(l);for(let d=0,p=s.length;d<p&&(qn.setBuffer(s[d]),r=bt(0,0,e,l,n,o,a,0,0,h),qn.clearBuffer(),a+=s[d].length,!r);d++);if(Wt.releasePrimitive(h),Ye.clearBuffer(),o+=i[u].length,r)break}return _s=!1,r}function bt(c,t,e,n,i,s=0,r=0,o=0,a=0,l=null,u=!1){let f,h;u?(f=qn,h=Ye):(f=Ye,h=qn);let d=f.float32Array,p=f.uint32Array,m=f.uint16Array,_=h.float32Array,g=h.uint32Array,x=h.uint16Array,y=c*2,S=t*2,v=q(y,m),b=q(S,x),T=!1;if(b&&v)u?T=i(Z(t,g),$(t*2,x),Z(c,p),$(c*2,m),a,r+t,o,s+c):T=i(Z(c,p),$(c*2,m),Z(t,g),$(t*2,x),o,s+c,a,r+t);else if(b){let A=Wt.getPrimitive();z(t,_,A),A.applyMatrix4(e);let E=tt(c),C=et(c,p);z(E,d,Te),z(C,d,Ae);let R=A.intersectsBox(Te),w=A.intersectsBox(Ae);T=R&&bt(t,E,n,e,i,r,s,a,o+1,A,!u)||w&&bt(t,C,n,e,i,r,s,a,o+1,A,!u),Wt.releasePrimitive(A)}else{let A=tt(t),E=et(t,g);z(A,_,ms),z(E,_,gs);let C=l.intersectsBox(ms),R=l.intersectsBox(gs);if(C&&R)T=bt(c,A,e,n,i,s,r,o,a+1,l,u)||bt(c,E,e,n,i,s,r,o,a+1,l,u);else if(C)if(v)T=bt(c,A,e,n,i,s,r,o,a+1,l,u);else{let w=Wt.getPrimitive();w.copy(ms).applyMatrix4(e);let P=tt(c),L=et(c,p);z(P,d,Te),z(L,d,Ae);let D=w.intersectsBox(Te),O=w.intersectsBox(Ae);T=D&&bt(A,P,n,e,i,r,s,a,o+1,w,!u)||O&&bt(A,L,n,e,i,r,s,a,o+1,w,!u),Wt.releasePrimitive(w)}else if(R)if(v)T=bt(c,E,e,n,i,s,r,o,a+1,l,u);else{let w=Wt.getPrimitive();w.copy(gs).applyMatrix4(e);let P=tt(c),L=et(c,p);z(P,d,Te),z(L,d,Ae);let D=w.intersectsBox(Te),O=w.intersectsBox(Ae);T=D&&bt(E,P,n,e,i,r,s,a,o+1,w,!u)||O&&bt(E,L,n,e,i,r,s,a,o+1,w,!u),Wt.releasePrimitive(w)}}return T}var Yn=new Y,Ur=new X,xl={strategy:0,maxDepth:40,maxLeafTris:10,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,verbose:!0,range:null},Ze=class c{static serialize(t,e={}){e={cloneBuffers:!0,...e};let n=t.geometry,i=t._roots,s=t._indirectBuffer,r=n.getIndex(),o;return e.cloneBuffers?o={roots:i.map(a=>a.slice()),index:r?r.array.slice():null,indirectBuffer:s?s.slice():null}:o={roots:i,index:r?r.array:null,indirectBuffer:s},o}static deserialize(t,e,n={}){n={setIndex:!0,indirect:!!t.indirectBuffer,...n};let{index:i,roots:s,indirectBuffer:r}=t,o=new c(e,{...n,[Rn]:!0});if(o._roots=s,o._indirectBuffer=r||null,n.setIndex){let a=e.getIndex();if(a===null){let l=new ot(t.index,1,!1);e.setIndex(l)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return o}get indirect(){return!!this._indirectBuffer}constructor(t,e={}){if(t.isBufferGeometry){if(t.index&&t.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e=Object.assign({...xl,[Rn]:!1},e),e.useSharedArrayBuffer&&!Dr())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=t,this._roots=null,this._indirectBuffer=null,e[Rn]||(cr(this,e),!t.boundingBox&&e.setBoundingBox&&(t.boundingBox=this.getBoundingBox(new X))),this.resolveTriangleIndex=e.indirect?n=>this._indirectBuffer[n]:n=>n}refit(t=null){return(this.indirect?wr:xr)(this,t)}traverse(t,e=0){let n=this._roots[e],i=new Uint32Array(n),s=new Uint16Array(n);r(0);function r(o,a=0){let l=o*2,u=s[l+15]===65535;if(u){let f=i[o+6],h=s[l+14];t(a,u,new Float32Array(n,o*4,6),f,h)}else{let f=o+32/4,h=i[o+6],d=i[o+7];t(a,u,new Float32Array(n,o*4,6),d)||(r(f,a+1),r(h,a+1))}}}raycast(t,e=wn,n=0,i=1/0){let s=this._roots,r=this.geometry,o=[],a=e.isMaterial,l=Array.isArray(e),u=r.groups,f=a?e.side:e,h=this.indirect?Cr:Sr;for(let d=0,p=s.length;d<p;d++){let m=l?e[u[d].materialIndex].side:f,_=o.length;if(h(this,d,m,t,o,n,i),l){let g=u[d].materialIndex;for(let x=_,y=o.length;x<y;x++)o[x].face.materialIndex=g}}return o}raycastFirst(t,e=wn,n=0,i=1/0){let s=this._roots,r=this.geometry,o=e.isMaterial,a=Array.isArray(e),l=null,u=r.groups,f=o?e.side:e,h=this.indirect?Rr:br;for(let d=0,p=s.length;d<p;d++){let m=a?e[u[d].materialIndex].side:f,_=h(this,d,m,t,n,i);_!=null&&(l==null||_.distance<l.distance)&&(l=_,a&&(_.face.materialIndex=u[d].materialIndex))}return l}intersectsGeometry(t,e){let n=!1,i=this._roots,s=this.indirect?Ir:Ar;for(let r=0,o=i.length;r<o&&(n=s(this,r,t,e),!n);r++);return n}shapecast(t){let e=lt.getPrimitive(),n=this.indirect?Mr:_r,{boundsTraverseOrder:i,intersectsBounds:s,intersectsRange:r,intersectsTriangle:o}=t;if(r&&o){let f=r;r=(h,d,p,m,_)=>f(h,d,p,m,_)?!0:n(h,d,this,o,p,m,e)}else r||(o?r=(f,h,d,p)=>n(f,h,this,o,d,p,e):r=(f,h,d)=>d);let a=!1,l=0,u=this._roots;for(let f=0,h=u.length;f<h;f++){let d=u[f];if(a=ur(this,f,s,r,i,l),a)break;l+=d.byteLength}return lt.releasePrimitive(e),a}bvhcast(t,e,n){let{intersectsRanges:i,intersectsTriangles:s}=n,r=lt.getPrimitive(),o=this.geometry.index,a=this.geometry.attributes.position,l=this.indirect?p=>{let m=this.resolveTriangleIndex(p);V(r,m*3,o,a)}:p=>{V(r,p*3,o,a)},u=lt.getPrimitive(),f=t.geometry.index,h=t.geometry.attributes.position,d=t.indirect?p=>{let m=t.resolveTriangleIndex(p);V(u,m*3,f,h)}:p=>{V(u,p*3,f,h)};if(s){let p=(m,_,g,x,y,S,v,b)=>{for(let T=g,A=g+x;T<A;T++){d(T),u.a.applyMatrix4(e),u.b.applyMatrix4(e),u.c.applyMatrix4(e),u.needsUpdate=!0;for(let E=m,C=m+_;E<C;E++)if(l(E),r.needsUpdate=!0,s(r,u,E,T,y,S,v,b))return!0}return!1};if(i){let m=i;i=function(_,g,x,y,S,v,b,T){return m(_,g,x,y,S,v,b,T)?!0:p(_,g,x,y,S,v,b,T)}}else i=p}return Nr(this,t,e,i)}intersectsBox(t,e){return Yn.set(t.min,t.max,e),Yn.needsUpdate=!0,this.shapecast({intersectsBounds:n=>Yn.intersectsBox(n),intersectsTriangle:n=>Yn.intersectsTriangle(n)})}intersectsSphere(t){return this.shapecast({intersectsBounds:e=>t.intersectsBox(e),intersectsTriangle:e=>e.intersectsSphere(t)})}closestPointToGeometry(t,e,n={},i={},s=0,r=1/0){return(this.indirect?Lr:Er)(this,t,e,n,i,s,r)}closestPointToPoint(t,e={},n=0,i=1/0){return hr(this,t,e,n,i)}getBoundingBox(t){return t.makeEmpty(),this._roots.forEach(n=>{z(0,new Float32Array(n),Ur),t.union(Ur)}),t}};onmessage=({data:c})=>{let t=performance.now();function e(r){r=Math.min(r,1);let o=performance.now();o-t>=10&&r!==1&&(postMessage({error:null,serialized:null,position:null,progress:r}),t=o)}let{index:n,position:i,options:s}=c;try{let r=new Ue;if(r.setAttribute("position",new ot(i,3,!1)),n&&r.setIndex(new ot(n,1,!1)),s.includedProgressCallback&&(s.onProgress=e),s.groups){let u=s.groups;for(let f in u){let h=u[f];r.addGroup(h.start,h.count,h.materialIndex)}}let o=new Ze(r,s),a=Ze.serialize(o,{copyIndexBuffer:!1}),l=[i.buffer,...a.roots];a.index&&l.push(a.index.buffer),l=l.filter(u=>typeof SharedArrayBuffer>"u"||!(u instanceof SharedArrayBuffer)),o._indirectBuffer&&l.push(a.indirectBuffer.buffer),postMessage({error:null,serialized:a,position:i,progress:1},l)}catch(r){postMessage({error:r,serialized:null,position:null,progress:1})}};})();
|
|
3664
|
-
`});var ki={};$e(ki,{default:()=>Oi});function Oi(e){return(0,Bi.jsx)(Ui.Environment,{...e})}var Ui,Bi,zi=Ke(()=>{"use strict";Ui=require("@react-three/drei"),Bi=require("react/jsx-runtime")});var Ms={};$e(Ms,{DEFAULT_MODEL_VIEWER_LABELS:()=>Je,SimpleModelViewer:()=>en});module.exports=Ba(Ms);function Nn(e){for(let t=e;t;t=t.parent)if(!t.visible)return!1;return!0}var Un;function On(e){Un=e}function he(e){Un?.(e)}var Je={verifyingLicense:"Verifying License",checkingYourLicenseKey:"Checking your license key...",createDevelopmentKey:"Create a free development key",invalidLicense:"Invalid License",licenseHasBeenRevokedOrHasExpired:"License has been revoked or has expired",failedToLoadPleaseContactTheSiteAdministrator:"Failed to load. Please contact the site administrator.",contextRestoringTitle:"Reloading viewer\u2026",contextLostTitle:"3D view interrupted",contextRestoringMessage:"Rebuilding the 3D view. Please wait\u2026",contextLostMessage:"The graphics connection was interrupted. The viewer will rebuild when it returns, or you can reload it now.",reloadViewer:"Reload viewer",texturePositioningHint:"Drag to move \xB7 Scroll to zoom \xB7 Click elsewhere to finish",texturePositioningStartHint:"Double-click to move or zoom",dismiss:"Dismiss",missingUVsAreShownInMagenta:"Missing UVs are shown in magenta.",viewThisModelInARWithAppleQuickLook:"View this model in AR with Apple Quick Look",sequencePlayer:"Sequence player",sequenceSelect:"Sequence",sequencePlay:"Play sequence",sequencePause:"Pause sequence",sequenceStop:"Stop and restore scene",sequencePlayhead:"Sequence playhead",sequenceTime:"Sequence time",sequenceIssues:"Unavailable sequence targets",arConfiguredButton:"AR handoff",arConfiguredTitle:"Take this configuration to AR",arConfiguredDescription:"Your current materials, visible models and placements are included.",arSnapshotStale:"Updating AR to include your latest changes\u2026",arPreparing:"Preparing your scene\u2026",arStart:"Start AR",arStarting:"Starting AR\u2026",arCheckingSupport:"Checking AR support\u2026",arUnavailable:"AR is unavailable in this browser. Open this link in an AR-capable browser on your phone.",arStartFailed:"Could not start AR. Check camera permissions and try again.",arAnimations:"AR animations",arAnimationSelect:"Animation",arAnimationSaved:"Default",arAnimationNone:"No animation",arAnimationClips:"Model clips",arAnimationSequences:"Sequences",arAnimationPlay:"Play animation",arAnimationPause:"Pause animation",arRefresh:"Refresh AR",arRetry:"Try again",arExportDetails:"Export details",arPrepare:"Prepare AR",arPrepareAgain:"Prepare again",arDownloadUSDZ:"Download USDZ for iPhone/iPad",arScanConfigured:"Scan to open this configuration on your phone.",arOpenConfiguredLink:"Open configuration link",viewInAR:"View in AR",openThisExperienceOnAPhoneForAR:"Open this experience on a phone for AR",openOnPhone:"Open on phone",viewThisModelInYourSpace:"View this model in your space",viewThisModelInVR:"View this model in VR",closePhoneHandoff:"Close phone handoff",arScanCode:"Scan the code and choose AR.",qrCodeToOpenThisModelOnAPhone:"QR code to open this model on a phone",disableUVChecker:"Disable UV checker",enableUVChecker:"Enable UV checker",explodedView:"Exploded view",explodeAmount:"Explode amount",removeSectionCut:"Remove section cut",sectionCut:"Section cut",sectionAxis:"Section axis",sectionPosition:"Section position",keepTheOtherSide:"Keep the other side",pauseCinematic:"Pause cinematic",playCinematic:"Play cinematic",stopCinematicAndResetCamera:"Stop cinematic and reset camera",cancel:"Cancel",annotationCategories:"Annotation categories",annotations:"Annotations",all:"All",uncategorized:"Uncategorized",decalDragHint:"Drag the decal on the object. Release to save; Escape to cancel.",showAll:"Show all",materialVariants:"Material variants",startGuidedTour:"Start guided tour",guidedTour:"Guided Tour",previousAnnotation:"Previous annotation",previous:"Prev",stopGuidedTour:"Stop guided tour",nextAnnotation:"Next annotation",next:"Next",exitFullscreen:"Exit fullscreen",enterFullscreen:"Enter fullscreen",resetCameraView:"Reset camera view",orbitControl:"Orbit Control",pointLock:"Pointer lock",cameraController:"Camera controller",cameraControllerSettings:"Camera controller settings",downloadGLB:"Download GLB",downloadGLBDescription:"All visible models, material edits and animations in one file. No annotations or separate editor model slots. Duplicate mesh names may change on reimport.",downloadCombinedGLB:"Download as one GLB",downloadSeparateGLBs:"Download separate GLBs",downloadSeparateGLBsDescription:"One GLB file per model",downloadPNG:"Download PNG",downloadUVLayout:"Download UV Layout",videoFormat:"Video format",auto:"Auto",recordTurntableVideo:"Record turntable video",recordCinematicVideo:"Record cinematic video",videoUnsupported:"Video recording is not supported in this browser.",downloadOptions:"Download options",exporting:"Exporting\u2026",download:"Download",annotationTitlePlaceholder:"Title *",description:"Description",ok:"OK",arRelocate:"Relocate",tapToPlace:"Tap to place",closeAnnotation:"Close annotation",learnMore:"Learn more",stopMeasuring:"Stop measuring",startMeasuring:"Start measuring",toggleBoundingDimensions:"Toggle bounding dimensions",measurementTool:"Measurement tool",distance:"Distance",angle:"Angle",area:"Area",pointToPlane:"Point to plane",wrap:"Circumference (Edge)",wrapHorizontal:"Circumference (Horizontal)",measurementSnapping:"Measurement snapping",noSnapping:"No snapping",snapAuto:"Snap: auto",snapVertex:"Snap: vertex",snapEdge:"Snap: edge",undoMeasurementPoint:"Undo measurement point",clearMeasurements:"Clear measurements",finishArea:"Finish area",savedMeasurements:"Saved measurements ({count})",noSavedMeasurements:"No saved measurements yet. Pick points in the preview, then save a measurement here.",measurementFiles:"Import / export",measurementSourceUnit:"Model units",measurementDisplayUnit:"Display units",measurementName:"Name",measurementNamePlaceholder:"e.g. Door width",saveMeasurement:"Save",knownMeasurementDistance:"Known length",calibrationUnit:"Calibration unit",calibrateMeasurement:"Calibrate",measurementCalibrationHint:"Pick two distance points, enter their known length, then calibrate.",measurementCalibratedScale:"Calibrated: 1 model unit = {scale} m",resetMeasurementCalibration:"Reset calibration",showSavedMeasurement:"Show {name}",renameSavedMeasurement:"Rename {name}",deleteSavedMeasurement:"Delete {name}",exportMeasurementJson:"Export JSON",exportMeasurementCsv:"Export CSV",importMeasurementJson:"Import JSON",measurementReady:"Ready",measurementApproximate:"Approximate LOD",measurementModelChanged:"Different model",measurementObjectMissing:"Object unavailable",measurementGeometryChanged:"Geometry changed \u2014 measure again",measurementPoseChanged:"Pose changed \u2014 measure again",measurementObjectHidden:"Object hidden",measurementInvalid:"Invalid measurement",measurementWaiting:"Waiting for model",openSceneObjectsPanel:"Open scene objects panel",sceneObjects:"Scene Objects",searchNodesLabels:"Search nodes, labels",closeSceneObjectsPanel:"Close scene objects panel",objectNavigator:"Objects in the 3D view",compareBefore:"Before",compareAfter:"After",compareDivider:"Comparison divider",viewIn3D:"View in 3D",objectNavigatorHint:"Arrow keys browse \xB7 Enter selects \xB7 Esc clears",selectionCleared:"Selection cleared",cameraKeyboardHelp:"3D view. Arrow keys orbit, Shift with Up or Down zooms, and W, A, S, D, Space and C move the camera.",isolate:"Isolate",hide:"Hide",show:"Show",closePanel:"Close panel",actions:"Actions",openPanel:"Open panel",close:"Close",position:"Position",decalNudgeHint:"Click to fine-tune \xB7 Hold to move",decalNudgeControls:"Move decal in small steps",text:"Text",yourText:"Your text",textToAdd:"Text to add",textColour:"Text color",addText:"Add text",image:"Image",chooseImage:"Choose image",imageToAdd:"Image to add",added:"Added",colour:"Color",size:"Size",turn:"Turn",rotation:"Rotation",dragTheDecalAcrossTheObjectsSurface:"Drag the decal across the object's surface",move:"Move",remove:"Remove",noneAddedYet:"None added yet",done:"Done",moveForward:"Move forward",moveLeft:"Move left",moveRight:"Move right",moveBackward:"Move backward",productOptions:"Options",productOptionsFor:"{product} options",productReset:"Reset",productOptional:"optional",productNone:"None",productAlsoChanges:"Also changes: {changes}",productUnavailable:"Currently unavailable.",productQuantity:"Quantity",productCheckingPrice:"Checking price and availability\u2026",productTotal:"Total",productAddToCart:"Add to cart",productAddingToCart:"Adding\u2026",productRequestQuote:"Request quote",productRequestingQuote:"Requesting\u2026",productRefresh:"Refresh",productBuy:"Buy now",productCopyLink:"Copy link",productLinkCopied:"Link copied",productShowOptions:"Show options",productHideOptions:"Hide options",productIssues:"Configuration issues",productRequestDone:"Request completed.",productSaved:"Saved: {id}",sceneSettings:"Scene Settings",background:"Background",backgroundColor:"Background Color",showEnvironmentAsBackground:"Show as background",backgroundBlur:"Background Blur",environmentPreset:"Preset",environmentIntensity:"Intensity",toneMapping:"Tone Mapping",toneMappingAces:"ACES Filmic",toneMappingAgx:"AgX",toneMappingNeutral:"Neutral",toneMappingNone:"None",ground:"Ground",groundShadow:"Ground Shadow",groundShadowOpacity:"Shadow Opacity",floorGrid:"Floor Grid",display:"Display",wireframe:"Wireframe",autoRotateSpeed:"Rotation Speed",fieldOfView:"Field of View",modelInfo:"Model",modelInfoObjects:"Objects",modelInfoTriangles:"Triangles",modelInfoMaterials:"Materials",resetSettings:"Reset Settings",environment:"Environment",autoRotate:"Auto Rotate",lighting:"Lighting",exposure:"Exposure",ambientLightIntensity:"Ambient Light Intensity",ambientLightColor:"Ambient Light Color",directLightIntensity:"Direct Light Intensity",directLightColor:"Direct Light Color",searchObjects:"Search objects",uploadedModel:"Uploaded model",clear:"Clear",chooseModel:"Choose model",loadingModel:"Loading model...",releaseToLoadYourModel:"Release to load your model",arFindSurface:"Move your device over a flat surface",arReleaseToPlace:"Release to place",arGestureHint:"Pinch to resize \xB7 Twist to rotate",angleFirstArmHint:"Pick the first arm",angleVertexHint:"Pick the angle's vertex",angleSecondArmHint:"Pick the second arm",angleNewHint:"Pick a point to start a new angle",areaNewHint:"Pick a point to start a new area",areaCornersHint:"Pick polygon corners in order, then Finish area",pointToPlaneFaceHint:"Pick the reference face",pointToPlanePointHint:"Pick a point to measure its perpendicular distance",pointToPlaneNewHint:"Pick a face to start a new measurement",distanceHint:"Pick points on the model to measure distances",wrapHint:"Click a point on the surface to measure its circumference, following the surface (best for limbs)",wrapHorizontalHint:"Click a point to measure a level circumference around it (best for the torso/waist)",visibleEntries:"{count} visible entries",objectCount:"{count} objects",annotationMarker:"Annotation {id}: {title}",recordingVideo:"Recording video \xB7 {progress}%",isolatedObjects:"Isolated: {count} objects",largeModelWarning:"Very large model ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the objects panel to select parts.",preparingLargeModel:"Preparing large model ({millions}M triangles) \u2014 the first display can take a while on this device...",enterAR:"Enter AR",enterVR:"Enter VR",decalImage:"Image {index}",decalText:"Text {index}",decalAdded:"{count} added",up:"up",down:"down",left:"left",right:"right",moveDecal:"Move decal {direction}",moveDecalOnSurface:"Move {direction} on the visible surface",showAllObject:"Show all {name}",isolateObject:"Isolate {name}",isolatedObject:"Isolated: {name}",hideObject:"Hide {name}",showObject:"Show {name}",objectSelected:"{name} selected",objectNavigatorPosition:"{position} of {count}",compareDividerValue:"{before} {percent}%, {after} {rest}%",bindingMismatchOne:"1 object binding doesn't match this model",bindingMismatchMany:"{count} object bindings don't match this model",simpleLargeModelWarning:"Very large model detected ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the scene objects panel to select parts.",dropModelHint:"Drag and drop {formats} here",retryModelLoad:"Retry loading model",loadErrorTitle:"This model couldn't be loaded",loadErrorNotFound:"Nothing was found at this address ({status}). Check that modelUrl points to the file.",loadErrorDenied:"The server refused access to the file ({status}). Check that the file is public, or that a signed URL hasn't expired.",loadErrorStatus:"The server responded with {status} when the file was requested.",loadErrorNetwork:"The download was blocked or failed. Check that the URL is correct and, if the file is on another domain, that its server allows cross-origin requests (CORS) from this site.",loadErrorHtml:"The server sent back a web page instead of a model. There's probably no file at this path: many servers answer a missing file with their index.html.",loadErrorInvalidFile:"The file couldn't be read as {format}. Check that it's a valid {format} file.",loadErrorInvalidExplicitFormat:"The file couldn't be read as {format}. Check that it's a valid {format} file and that modelFormat matches it.",loadErrorMissingFormat:"The file couldn't be read as {format}. The URL has no file extension, so set modelFormat to the file's format.",loadErrorPointCloud:"This PLY file is a point cloud: it has points but no faces, and the viewer shows meshes. Turn it into a mesh first, for example with MeshLab or Blender.",measurementReferenceFaceRequired:"Pick a triangle face to define the reference plane.",measurementTooManyPoints:"Finish or clear this measurement before adding more points.",measurementAngleDistinct:"Pick a point away from the angle's vertex.",areaMinimumPoints:"Pick at least three points to finish the area.",areaDistinctPoints:"Area points must be distinct.",areaStraightLine:"Area points must not lie on one straight line.",areaNotPlanar:"Area points must lie on one plane.",areaEdgesCross:"Area edges must not cross or touch each other.",areaZero:"The polygon has no measurable area.",decalSurfaceMissing:"Could not find a surface on this object for the decal.",decalDirectionMissing:"No visible surface in that direction. Try another arrow or rotate the view.",fullscreenExitFailed:"Could not exit fullscreen. Press Escape to exit.",fullscreenEnterFailed:"Could not enter fullscreen. Check your browser or iframe fullscreen permissions and try again.",uvCoordinatesMissing:"This model does not contain UV coordinates.",uvExportFailed:"Could not create the UV layout archive.",videoExportFailed:"Could not export the video.",videoNotReady:"Viewer not ready for video export.",videoExitXR:"Exit the XR session before recording a video.",videoAlreadyRecording:"A video export is already in progress.",videoPathRequired:"Enable a cinematic camera path before recording it.",videoDurationInvalid:"Video duration must be greater than 0 and at most 300 seconds.",videoFrameRateInvalid:"Video frame rate must be between 1 and 60.",videoBitrateInvalid:"Video bitrate must be a positive number.",videoContextLost:"Video export stopped because the WebGL context was lost.",videoTimedOut:"Video export timed out. Keep the viewer tab visible while recording.",videoEncodingFailed:"The browser could not encode the video.",videoEmpty:"The browser produced an empty video.",videoDidNotStart:"Video recording did not start.",videoWebMUnsupported:"Video recording as WEBM is not supported in this browser.",videoMP4Unsupported:"Video recording as MP4 is not supported in this browser.",videoGIFUnsupported:"Video recording as GIF is not supported in this browser.",videoGifWidthInvalid:"GIF width must be a whole number of pixels from 16 to 4096.",environmentNeutral:"neutral",environmentApartment:"apartment",environmentCity:"city",environmentDawn:"dawn",environmentForest:"forest",environmentLobby:"lobby",environmentNight:"night",environmentPark:"park",environmentStudio:"studio",environmentSunset:"sunset",environmentWarehouse:"warehouse",color:"Color",material:"Material",texturePreview:"texture preview",noTextureApplied:"No texture applied",noTextureCoordinates:"This part has no texture coordinates, so an image can't be placed on it.",replaceImage:"Replace image",uploadImage:"Upload image",removeTexture:"Remove texture",texturePosition:"Texture position",offsetX:"Offset X",offsetY:"Offset Y",confirmTexturePosition:"Confirm this texture position and exit positioning mode",donePositioning:"Done positioning",textureOffsetHint:"Double-click the object in the preview to drag its texture directly (scroll to zoom), or edit its offset numerically.",actionToggleLight:"Toggle Light",actionChangeLightColor:"Change Light Color",actionSetBrightness:"Set Brightness",actionChangeColor:"Change Color",actionChangeMaterial:"Change Material",actionToggleVisibility:"Toggle Visibility"};function De(e,t,n={}){return(e?.[t]??Je[t]).replace(/\{(\w+)\}/g,(i,a)=>Object.prototype.hasOwnProperty.call(n,a)?String(n[a]):i)}var za=new Map(Object.entries(Je).map(([e,t])=>[t,e]));function kn(e,t){let n=za.get(t);return n?De(e,n):t}var Me=require("fflate");var Va=[".glb",".gltf",".obj",".fbx",".usdz",".stl",".ply",".zip"],Fa=["model/gltf-binary","model/gltf+json","model/vnd.usdz+zip","application/vnd.usdz+zip","application/zip","application/x-zip-compressed"],Ie=1024*1024,Bn=128*Ie,zn=1024,Vn=128*Ie,Fn=256*Ie,Hn=200,Ha=Ie,ne=new Map,qn=".glb,.gltf,.obj,.fbx,.usdz,.stl,.ply,.zip,model/gltf-binary,model/gltf+json,model/vnd.usdz+zip,application/vnd.usdz+zip,application/zip";function Ne(e){let t=e.split(/[?#]/,1)[0].toLowerCase();return t.endsWith(".obj")?"obj":t.endsWith(".fbx")?"fbx":t.endsWith(".usdz")?"usdz":t.endsWith(".stl")?"stl":t.endsWith(".ply")?"ply":t.endsWith(".gltf")?"gltf":"glb"}function Xn(e){return ne.get(e)??{format:Ne(e)}}function Ga(e){let t=e.name.toLowerCase();return Va.some(n=>t.endsWith(n))||Fa.includes(e.type)}async function Yn(e){if(!Ga(e))throw new Error("Unsupported model file. Please upload a .glb, .gltf, .obj, .fbx, .usdz, .stl, .ply, or .zip asset.");let t=e.name.toLowerCase();if(t.endsWith(".usdz")||e.type==="model/vnd.usdz+zip"||e.type==="application/vnd.usdz+zip")return Gn(e,"usdz");if(t.endsWith(".zip")||Wa(e.type))return ja(e);if(t.endsWith(".gltf")||e.type==="model/gltf+json")return Wn(e);let n=Ne(e.name);return n==="gltf"?Wn(e):Gn(e,n)}function Gn(e,t){let n=URL.createObjectURL(e);return ne.set(n,{format:t,entryPath:e.name,sourceBytes:e.size}),{url:n,name:e.name,format:t,cleanup:()=>{he(n),ne.delete(n),URL.revokeObjectURL(n)}}}function Wa(e){return e==="application/zip"||e==="application/x-zip-compressed"}async function Wn(e){let t=await e.text(),n=Zn(t,e.name);for(let i of Kn(n))if(!It(i))throw new Error(`${e.name} references external assets. Upload a .zip containing the .gltf file and its dependencies.`);let r=URL.createObjectURL(e);return ne.set(r,{format:"gltf",entryPath:e.name,sourceBytes:e.size}),{url:r,name:e.name,format:"gltf",cleanup:()=>{he(r),ne.delete(r),URL.revokeObjectURL(r)}}}async function ja(e){if(e.size>Bn)throw new Error(`Model zip is too large. The compressed archive must be ${Dt(Bn)} or smaller.`);let t=await qa(new Uint8Array(await e.arrayBuffer())),n=new Map;for(let[s,l]of Object.entries(t)){let o=Nt(s);!o||$n(o)||n.set(o,l)}let r=[...n.keys()].filter(s=>/\.(gltf|obj|fbx|stl|ply)$/i.test(s));if(r.length===0)throw new Error("Invalid model zip: no .gltf, .obj, .fbx, .stl, or .ply file found.");if(r.length>1)throw new Error("Invalid model zip: multiple model entry files found.");let i=r[0],a=Ne(i);if(a==="gltf")return Ya(e,i,n);if(a==="obj"||a==="fbx"||a==="stl"||a==="ply")return Xa(e,i,a,n);throw new Error(`Unsupported model entry ${i}.`)}function qa(e){return new Promise((t,n)=>{let r=0,i=0,a=null,s=o=>(a??(a=new Error(`Invalid model zip: ${o}`)),!1);(0,Me.unzip)(e,{filter:o=>{if(a)return!1;if(r+=1,r>zn)return s(`archive contains more than ${zn.toLocaleString()} entries.`);if(o.originalSize>Vn)return s(`${o.name} expands beyond the ${Dt(Vn)} per-file limit.`);if(i+=o.originalSize,i>Fn)return s(`expanded contents exceed ${Dt(Fn)}.`);if(o.originalSize>=Ha&&(o.size===0||o.originalSize/o.size>Hn))return s(`${o.name} exceeds the ${Hn}:1 compression-ratio limit.`);let d=Nt(o.name);return!!d&&!$n(d)}},(o,d)=>{a?n(a):o?n(new Error(`Invalid model zip: ${o.message}`)):t(d)})})}function Dt(e){return`${e/Ie} MiB`}function Xa(e,t,n,r){let i=[],a={};for(let[l,o]of r){let d=URL.createObjectURL(new Blob([o],{type:Jn(l)}));i.push(d),a[l]=d}let s=a[t];if(!s)throw i.forEach(l=>URL.revokeObjectURL(l)),new Error(`Invalid model zip: could not read ${t}.`);return ne.set(s,{format:n,entryPath:t,resourceUrls:a}),{url:s,name:e.name,format:n,cleanup:()=>{he(s),ne.delete(s),i.forEach(l=>URL.revokeObjectURL(l))}}}function Ya(e,t,n){let r=n.get(t);if(!r)throw new Error("Invalid GLTF zip: no .gltf found.");let i=Zn((0,Me.strFromU8)(r),t);Za(i,t);let a=Ka(t),s=[];try{jn(i.buffers,a,n,s),jn(i.images,a,n,s);let l=new Blob([(0,Me.strToU8)(JSON.stringify(i))],{type:"model/gltf+json"}),o=URL.createObjectURL(l);return s.push(o),ne.set(o,{format:"gltf",entryPath:t}),{url:o,name:e.name,format:"gltf",cleanup:()=>{he(o),ne.delete(o),s.forEach(d=>URL.revokeObjectURL(d))}}}catch(l){throw s.forEach(o=>URL.revokeObjectURL(o)),l}}function jn(e,t,n,r){for(let i of e??[]){if(typeof i.uri!="string"||It(i.uri))continue;let a=$a(t,i.uri),s=n.get(a);if(!s)throw new Error(`Invalid GLTF zip: missing referenced asset ${i.uri}.`);let l=URL.createObjectURL(new Blob([s],{type:Jn(a)}));r.push(l),i.uri=l}}function Zn(e,t){try{return JSON.parse(e)}catch{throw new Error(`${t} is not a valid .gltf JSON file.`)}}function Kn(e){return[...e.buffers??[],...e.images??[]].map(t=>t.uri).filter(t=>typeof t=="string"&&t.length>0)}function Za(e,t){for(let n of Kn(e)){if(It(n))continue;let r=/^[a-z][a-z0-9+.-]*:/i.test(n),i=n.startsWith("/")||n.startsWith("\\");if(r||i)throw new Error(`${t} references external assets. Include every dependency inside the uploaded .zip.`)}}function It(e){return e.startsWith("data:")}function Nt(e){let t=[];for(let n of e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(r=>r&&r!==".")){if(n===".."){t.pop();continue}t.push(n)}return t.join("/")}function $n(e){let t=e.split("/");return e.endsWith("/")||t.includes("__MACOSX")||t.some(n=>n===".DS_Store"||n.startsWith("._"))}function Ka(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function $a(e,t){let n=t.split(/[?#]/)[0],r=Ja(n);return Nt(e?`${e}/${r}`:r)}function Ja(e){try{return decodeURI(e)}catch{return e}}function Jn(e){let t=e.toLowerCase();return t.endsWith(".obj")||t.endsWith(".mtl")?"text/plain":t.endsWith(".fbx")?"application/octet-stream":t.endsWith(".usdz")?"model/vnd.usdz+zip":t.endsWith(".bin")?"application/octet-stream":t.endsWith(".png")?"image/png":t.endsWith(".jpg")||t.endsWith(".jpeg")?"image/jpeg":t.endsWith(".webp")?"image/webp":t.endsWith(".avif")?"image/avif":t.endsWith(".ktx2")?"image/ktx2":"application/octet-stream"}et();var Qa={glb:"GLB",gltf:"glTF",obj:"OBJ",fbx:"FBX",usdz:"USDZ",stl:"STL",ply:"PLY"},eo=/\.(glb|gltf|obj|fbx|usdz|stl|ply|zip)$/i;function to(e,t){let n=e?.response?.status;if(typeof n=="number")return n;let r=/responded with (\d{3})/.exec(t);return r?Number(r[1]):null}function er(e,t,n,r){let i=e instanceof Error?e.message:e==null?"":String(e),a=(v,g)=>De(r,v,g),s=a("loadErrorTitle"),l=i||null;if(Qe(e))return{title:s,detail:a("loadErrorPointCloud"),technical:l};let o=to(e,i);if(o===404||o===410)return{title:s,detail:a("loadErrorNotFound",{status:o}),technical:l};if(o===401||o===403)return{title:s,detail:a("loadErrorDenied",{status:o}),technical:l};if(o!==null)return{title:s,detail:a("loadErrorStatus",{status:o}),technical:l};if(/failed to fetch|networkerror|load failed|network error/i.test(i))return{title:s,detail:a("loadErrorNetwork"),technical:l};if(/<!doctype|<html/i.test(i))return{title:s,detail:a("loadErrorHtml"),technical:l};let d=t.split(/[?#]/,1)[0],u=Qa[n??Ne(t)],p=eo.test(d);return{title:s,detail:p||n?a(n?"loadErrorInvalidExplicitFormat":"loadErrorInvalidFile",{format:u}):a("loadErrorMissingFormat",{format:u}),technical:l}}var tt=e=>e*Math.PI/180;function tr(e){return{minDistance:e?.minDistance??0,maxDistance:e?.maxDistance??1/0,minPolarAngle:tt(e?.minPolarAngle??0),maxPolarAngle:tt(e?.maxPolarAngle??180),minAzimuthAngle:tt(e?.minAzimuthAngle??-1/0),maxAzimuthAngle:tt(e?.maxAzimuthAngle??1/0),boundaryEnclosesCamera:e?.boundaryEnclosesCamera??!1,boundaryFriction:e?.boundaryFriction??0,panBoundary:e?.panBoundary}}var we=require("react");var ir=require("react/jsx-runtime"),nr=(0,we.createContext)(void 0);function rr({labels:e,children:t}){return(0,ir.jsx)(nr.Provider,{value:e,children:t})}function Se(){let e=(0,we.useContext)(nr);return(0,we.useMemo)(()=>Object.assign((t,n)=>De(e,t,n),{message:t=>kn(e,t)}),[e])}var ar=require("react"),or="(prefers-reduced-motion: reduce)";function no(e){if(typeof window>"u"||!window.matchMedia)return()=>{};let t=window.matchMedia(or);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}var ro=()=>typeof window<"u"&&!!window.matchMedia?.(or).matches;function sr(e="user"){let t=(0,ar.useSyncExternalStore)(no,ro,()=>!1);return e==="always"?!0:e==="never"?!1:t}var h=require("react");var Ue=require("three");var lr="KHR_materials_variants",cr="riMaterialVariants",dr="riMaterialVariantGroups";function F(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function io(e){if(!F(e)||!F(e.extensions))return[];let t=e.extensions[lr];if(!F(t)||!Array.isArray(t.variants))return[];let n=new Set;return t.variants.map((r,i)=>{let a=F(r)&&typeof r.name=="string"&&r.name?r.name:`Variant ${i+1}`,s=a;for(let l=2;n.has(s);l+=1)s=`${a} (${l})`;return n.add(s),s})}var ao=/^\s*(.+?)\s*(?::|\s\/\s)\s*(.+?)\s*$/;function oo(e){let t=Math.min(Math.max(e,0),1),n=t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055;return Math.round(n*255)}function so(e){if(!F(e))return;let t=F(e.pbrMetallicRoughness)?e.pbrMetallicRoughness:{};if(t.baseColorTexture!==void 0)return;let n=Array.isArray(t.baseColorFactor)?t.baseColorFactor:[1,1,1,1];if(n.slice(0,3).every(r=>typeof r=="number"))return`#${n.slice(0,3).map(r=>oo(r).toString(16).padStart(2,"0")).join("")}`}function lo(e,t){if(t.length===0)return[];let n=F(e)?e:{},r=Array.isArray(n.meshes)?n.meshes:[],i=Array.isArray(n.accessors)?n.accessors:[],a=Array.isArray(n.materials)?n.materials:[],s=t.map(()=>new Set),l=t.map(()=>new Map);r.forEach((g,m)=>{(F(g)&&Array.isArray(g.primitives)?g.primitives:[]).forEach((x,y)=>{if(!F(x))return;let S=F(x.extensions)?x.extensions[lr]:void 0;if(!F(S)||!Array.isArray(S.mappings))return;let U=F(x.attributes)?x.attributes.POSITION:void 0,P=typeof U=="number"?i[U]:void 0,N=F(P)&&typeof P.count=="number"?P.count:1;for(let k of S.mappings)if(!(!F(k)||!Number.isInteger(k.material)||!Array.isArray(k.variants)))for(let j of k.variants){if(!Number.isInteger(j)||!s[j])continue;s[j].add(`${m}/${y}`);let q=l[j],X=k.material;q.set(X,(q.get(X)??0)+N)}})});let o=t.map((g,m)=>{let b=null;for(let[y,S]of l[m])(b===null||S>(l[m].get(b)??0))&&(b=y);let x=b===null?void 0:so(a[b]);return{name:g,label:g,...x?{swatch:x}:{}}}),d=t.map(()=>-1),u=[],p=new Map;return t.forEach((g,m)=>{let b=ao.exec(g);if(!b)return;let[,x,y]=b;p.has(x)||(p.set(x,u.length),u.push({name:x,members:[]})),d[m]=p.get(x),u[d[m]].members.push(m),o[m].label=y}),t.map((g,m)=>m).filter(g=>d[g]<0).sort((g,m)=>+(s[g].size===0)-+(s[m].size===0)).forEach(g=>{let m=u.map((y,S)=>({group:y,groupIndex:S})).filter(({group:y})=>y.name===null&&y.members.some(S=>s[g].size===0||s[S].size===0?!1:[...s[g]].some(U=>s[S].has(U)))).map(({groupIndex:y})=>y);if(m.length===0&&s[g].size===0){let y=u.findIndex(S=>S.name===null);y>=0&&m.push(y)}if(m.length===0){d[g]=u.length,u.push({name:null,members:[g]});return}let[b,...x]=m;for(let y of x){for(let S of u[y].members)d[S]=b;u[b].members.push(...u[y].members),u[y].members=[]}d[g]=b,u[b].members.push(g)}),u.filter(g=>g.members.length>0).sort((g,m)=>Math.min(...g.members)-Math.min(...m.members)).map(g=>({name:g.name,variants:[...g.members].sort((m,b)=>m-b).map(m=>o[m])}))}function ur(e){let t=e.parser,n=io(t?.json);if(!(!t||n.length===0))return e.scene.userData[cr]=n,e.scene.userData[dr]=lo(t.json,n),{names:n,resolveMaterial:async(r,i)=>{let a={geometry:i.geometry,material:await t.getDependency("material",r),isPoints:i.isPoints,isLine:i.isLine};return t.assignFinalMaterial(a),a.material}}}function Ut(e){let t=e.userData?.[cr];return Array.isArray(t)&&t.every(n=>typeof n=="string")?t:[]}function hr(e){let t=e.userData?.[dr];if(Array.isArray(t))return t;let n=Ut(e);return n.length>0?[{name:null,variants:n.map(r=>({name:r,label:r}))}]:[]}function nt(e){return[e.x,e.y,e.z]}function pr(e){let t=new Ue.Box3().setFromObject(e),n=0;return e.traverse(r=>{r.isMesh&&(n+=1)}),{bounds:{min:nt(t.min),max:nt(t.max),center:nt(t.getCenter(new Ue.Vector3)),size:nt(t.getSize(new Ue.Vector3))},objectCount:n,materialVariants:Ut(e),materialVariantGroups:hr(e)}}var Ji=require("@react-three/drei"),$=require("@react-three/fiber"),Qi=require("@react-three/fiber");var Oe=require("@react-three/fiber"),fe=require("three"),Cr=require("three-stdlib");var co=require("@react-three/drei"),uo=require("@react-three/fiber"),ho=require("react"),gr=require("three"),rt=require("three-stdlib");function po(e){return{name:"RI_unlit_emissive_texture",async afterRoot(t){let n=e.json.materials??[],r=new Map;if(n.forEach(a=>{let s=!!a?.extensions?.KHR_materials_unlit,l=!!a?.pbrMetallicRoughness?.baseColorTexture;s&&!l&&a?.emissiveTexture&&a.name&&r.set(a.name,a.emissiveTexture.index)}),r.size===0||!t.scene)return;let i=new Map;await Promise.all([...r].map(async([a,s])=>{let l=await e.getDependency("texture",s);l&&(l.colorSpace=gr.SRGBColorSpace,i.set(a,l))})),t.scene.traverse(a=>{let s=Array.isArray(a.material)?a.material:a.material?[a.material]:[];for(let l of s){let o=l.name?i.get(l.name):void 0;o&&!l.map&&(l.map=o,l.needsUpdate=!0)}})}}}var fo="https://assets.react-immersive.liveroom.dev/three-r184/draco/",mo="https://assets.react-immersive.liveroom.dev/three-r184/basis/",fr=new Map,mr=new WeakMap;function go(e){let t=fr.get(e);return t||(t=new rt.DRACOLoader,t.setDecoderPath(e),fr.set(e,t)),t}function vo(e,t){let n=mr.get(t);n||(n=new Map,mr.set(t,n));let r=n.get(e);return r||(r=new Ot(e,t),n.set(e,r)),r}var Ot=class{constructor(t,n){this.transcoderPath=t;this.gl=n;this.real=null}loader(){return this.real??(this.real=import("three/examples/jsm/loaders/KTX2Loader.js").then(({KTX2Loader:t})=>new t().setTranscoderPath(this.transcoderPath).detectSupport(this.gl))),this.real}load(t,n,r,i){this.loader().then(a=>a.load(t,n,r,i),a=>i?.(a))}dispose(){this.real?.then(t=>t.dispose())}};function vr(e,t={},n){let{dracoDecoderPath:r=fo,ktx2TranscoderPath:i=mo,meshopt:a=!0}=t;r&&e.setDRACOLoader(go(r)),a&&e.setMeshoptDecoder(rt.MeshoptDecoder),i&&n&&e.setKTX2Loader(vo(i,n)),e.register((s=>po(s)))}var _r=require("three");var _o=new WeakMap;function kt(e,t){_o.set(e,structuredClone(t))}function xr(e){if(/^(blob|data):/i.test(e))return"Local resource";let t=e.split(/[?#]/,1)[0].replace(/\\/g,"/");return t.slice(t.lastIndexOf("/")+1).slice(0,300)||"Resource"}function yr(e){return/^(blob|data):/i.test(e)?"Local resource":e.split(/[?#]/,1)[0].replace(/\\/g,"/").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,"").replace(/^\/+/,"").slice(0,500)||"Resource"}var at=class extends fe.Loader{constructor(){super(...arguments);this.options={source:{format:"glb"}}}configure(n){return this.options=n,this}load(n,r,i,a){let s=performance.now(),l={format:this.options.source.format,name:this.options.source.entryPath??xr(n),sourceBytes:this.options.source.sourceBytes??null,failedResources:[]},o=d=>{l.sourceBytes===null&&d.lengthComputable&&d.total>0&&(l.sourceBytes=d.total),i?.(d)};this.loadAsset(n,o,l).then(d=>{l.loadDurationMs=Math.max(0,performance.now()-s),kt(d.scene,l),r(d)}).catch(d=>{l.loadDurationMs=Math.max(0,performance.now()-s),d&&typeof d=="object"&&kt(d,l),a?.(d)})}async loadAsset(n,r,i){let a=Ao(this.options.source);a.onError=d=>{let u=Object.entries(this.options.source.resourceUrls??{}).find(([,v])=>v===d)?.[0],p=yr(u??d);i.failedResources.includes(p)||i.failedResources.push(p)};let{format:s}=this.options.source;if(s==="obj")return wo(n,a,this.options.source,r);if(s==="fbx"){let{FBXLoader:d}=await import("three/examples/jsm/loaders/FBXLoader.js"),u=zt(this,new d(a)),p=Co(n,this.options.source);p&&u.setResourcePath(p);let v=await u.loadAsync(n,r);return it(v,"FBXMesh",!1),{scene:v,animations:v.animations??[]}}if(s==="stl"||s==="ply"){let{meshNameFromPath:d,parsePly:u,parseStl:p}=await Promise.resolve().then(()=>(Er(),Ar)),v=await So(n,a,r),g=d(this.options.source.entryPath??n,s==="stl"?"STL model":"PLY model"),m=s==="stl"?p(v,g):u(v,g);return it(m,s==="stl"?"STLMesh":"PLYMesh",!0),{scene:m,animations:[]}}if(s==="usdz"){let{USDLoader:d}=await import("three/examples/jsm/loaders/USDLoader.js"),p=await zt(this,new d(a)).loadAsync(n,r);return it(p,"USDZMesh",!1),{scene:p,animations:p.animations??[]}}let l=zt(this,new Cr.GLTFLoader(a));vr(l,this.options.decoderConfig,this.options.renderer),l.register(d=>{let u=d.json,p=v=>Array.isArray(v)?v.filter(g=>typeof g=="string"):[];return i.extensionsUsed=p(u.extensionsUsed),i.extensionsRequired=p(u.extensionsRequired),{name:"RI_asset_diagnostics",beforeRoot:()=>null}});let o=await l.loadAsync(n,r);return{scene:o.scene,animations:o.animations??[],materialVariants:ur(o)}}};On(e=>{Oe.useLoader.clear(at,e)});function Pr(e,t={},n,r){let i=(0,Oe.useThree)(l=>l.gl),a=Xn(e),s=n?{...a,format:n}:a;return(0,Oe.useLoader)(at,e,l=>{l.configure({source:s,decoderConfig:t,renderer:i})},r)}async function wo(e,t,n,r){let[{OBJLoader:i},a]=await Promise.all([import("three/examples/jsm/loaders/OBJLoader.js"),Tr(e,t,r)]),s=new i(t),l=Eo(a);if(l){let d=To(l,e,n);if(d)try{let u=await Tr(d.url,t),{MTLLoader:p}=await import("three/examples/jsm/loaders/MTLLoader.js"),g=new p(t).parse(u,d.basePath);g.preload(),s.setMaterials(g)}catch(u){console.warn(`[react-immersive] Could not load OBJ material ${l}; rendering geometry with fallback materials.`,u)}}let o=s.parse(a);return it(o,"OBJMesh",!0),{scene:o,animations:[]}}function it(e,t,n){let r=new Set,i=0;e.traverse(a=>{if(!("isMesh"in a&&a.isMesh===!0)){a.name&&r.add(a.name);return}let l=a.name||`${t}_${++i}`;if(!n&&a.name){r.add(a.name);return}let o=l,d=2;for(;r.has(o);)o=`${l}_${d++}`;a.name=o,r.add(o)})}function Tr(e,t,n){let r=new fe.FileLoader(t);return r.setResponseType("text"),r.loadAsync(e,n)}function So(e,t,n){let r=new fe.FileLoader(t);return r.setResponseType("arraybuffer"),r.loadAsync(e,n)}function zt(e,t){return t.setCrossOrigin(e.crossOrigin),t.setWithCredentials(e.withCredentials),t.setRequestHeader(e.requestHeader),t}function Ao(e){let t=new fe.LoadingManager,n=e.resourceUrls;return n&&t.setURLModifier(r=>{if(/^(?:blob:|data:)/i.test(r))return r;let i=st(Rr(r).split(/[?#]/)[0]),a=n[i];if(a)return a;let s=ot(e.entryPath??""),l=st(s?`${s}/${i}`:i);return n[l]??r}),t}function Eo(e){return/^\s*mtllib\s+(.+?)\s*$/im.exec(e)?.[1]?.trim()||null}function To(e,t,n){if(n.resourceUrls&&n.entryPath){let r=st(`${ot(n.entryPath)}/${Rr(e)}`),i=n.resourceUrls[r];if(!i)return null;let a=ot(r);return{url:i,basePath:a?`${a}/`:""}}try{let r=new URL(e,t).href;return{url:r,basePath:Lr(r)}}catch{return null}}function Co(e,t){if(t.resourceUrls&&t.entryPath){let n=ot(t.entryPath);return n?`${n}/`:""}return Lr(e)}function Lr(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t+1)}function ot(e){let t=st(e),n=t.lastIndexOf("/");return n===-1?"":t.slice(0,n)}function st(e){let t=[];for(let n of e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(r=>r&&r!=="."))n===".."?t.pop():t.push(n);return t.join("/")}function Rr(e){try{return decodeURI(e)}catch{return e}}var Dr=require("three");function Ir(e){let t=new Dr.Color(0,0,0);try{t.setStyle(e,"srgb-linear")}catch{return!1}let n=[t.r,t.g,t.b].map(r=>r<=.04045?r/12.92:((r+.055)/1.055)**2.4);return .2126*n[0]+.7152*n[1]+.0722*n[2]>.3}var Q=require("react/jsx-runtime");function Nr({visible:e,title:t,message:n,progress:r,background:i,seeThrough:a=!1}){if(!e)return null;let s=i!==void 0&&Ir(i),l=a?"transparent":i,o=typeof r=="number"&&Number.isFinite(r),d=o?Math.round(Math.min(Math.max(r,0),100)):0;return(0,Q.jsx)("div",{className:`bb-loadingOverlay${s?" bb-loadingOverlay--light":""}`,style:l?{background:l}:void 0,role:"status","aria-live":"polite",children:(0,Q.jsxs)("div",{className:"bb-loadingCard",children:[(0,Q.jsxs)("div",{className:"bb-loadingHeader",children:[(0,Q.jsx)("span",{className:"bb-loadingTitle",title:t??n,children:t??n}),o?(0,Q.jsxs)("span",{className:"bb-loadingPercent",children:[d,"%"]}):null]}),(0,Q.jsx)("div",{className:`bb-loadingProgress ${o?"":"bb-loadingProgress--unknown"}`,role:"progressbar","aria-label":t??n,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o?d:void 0,children:(0,Q.jsx)("div",{className:"bb-loadingProgress__bar",style:o?{width:`${d}%`}:void 0})}),t?(0,Q.jsx)("span",{className:"bb-loadingMessage",children:n}):null]})})}var ct=require("react");var ke=require("react"),Po="200px",Ur=new Map;function Or(e,t,n){let r=Ur.get(t);if(!r){let s=new Map;r={observer:new IntersectionObserver(o=>{for(let d of o)s.get(d.target)?.(d.isIntersecting)},{rootMargin:t}),watchers:s},Ur.set(t,r)}let{observer:i,watchers:a}=r;return a.set(e,n),i.observe(e),()=>{a.delete(e),i.unobserve(e)}}function kr(e){let t=typeof IntersectionObserver<"u",[n,r]=(0,ke.useState)(!t),[i,a]=(0,ke.useState)(!t);return(0,ke.useEffect)(()=>{let s=e.current;if(!s||!t)return;let l=Or(s,Po,r),o=Or(s,"0px",a);return()=>{l(),o()}},[e,t]),{near:n,visible:i}}var se=require("react");function Br(){return typeof navigator>"u"?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function Lo(){if(typeof window>"u"||typeof navigator>"u")return!1;let e=s=>typeof window.matchMedia=="function"&&window.matchMedia(s).matches,t=e("(pointer: coarse)")||e("(any-pointer: coarse)"),n=e("(hover: none)")||e("(any-hover: none)"),r=navigator.maxTouchPoints>0,i=typeof window.screen<"u"&&Math.min(window.screen.width,window.screen.height)<=1024,a=Br();return t||a||r&&n||r&&i}function zr(){if(!Lo())return!1;if(Br())return!0;let e=navigator.deviceMemory;return!(typeof e=="number"&&e>=8)}function Ro(e,t){let n=new Set,r=i=>{for(let a of i){if(n.size>=t)return;n.add(a.id)}};return r(e.filter(i=>i.wanted).sort((i,a)=>Number(a.visible)-Number(i.visible)||Number(a.live)-Number(i.live)||i.since-a.since)),r(e.filter(i=>!i.wanted&&i.live).sort((i,a)=>a.since-i.since)),n}var Do=12,Io=6,lt=new Map,No=1,Vt=!1,Vr;function Fr(){Vt||(Vt=!0,queueMicrotask(()=>{Vt=!1,Vr??(Vr=zr()?Io:Do);let e=Ro([...lt.values()],Vr);for(let t of lt.values()){let n=e.has(t.id);n!==t.live&&(t.live=n,t.onLiveChange(n))}}))}function Hr({managed:e,wanted:t,visible:n,onPark:r}){let[i,a]=(0,se.useState)(!1),s=(0,se.useRef)(r);s.current=r;let l=(0,se.useRef)(null);return(0,se.useEffect)(()=>{if(!e)return;let o={id:No++,wanted:!1,visible:!1,live:!1,since:performance.now(),onLiveChange:d=>{d||s.current?.(),a(d)}};return lt.set(o.id,o),l.current=o,()=>{lt.delete(o.id),l.current=null,a(!1),Fr()}},[e]),(0,se.useEffect)(()=>{let o=l.current;!o||o.wanted===t&&o.visible===n||(o.wanted!==t&&(o.since=performance.now()),o.wanted=t,o.visible=n,Fr())},[e,t,n]),e?i:t}function Gr({loading:e="lazy",reveal:t="auto",rootRef:n,onPark:r}){let{near:i,visible:a}=kr(n),[s,l]=(0,ct.useState)(t==="auto");return(0,ct.useEffect)(()=>{t==="auto"&&l(!0)},[t]),{live:Hr({managed:e==="lazy",wanted:s&&(e==="eager"||i),visible:a,onPark:r}),visible:a,awaitingReveal:!s,reveal:()=>l(!0)}}var Wr=require("lucide-react");var me=require("react/jsx-runtime");function Ft({src:e,hidden:t=!1}){return e?(0,me.jsx)("img",{className:`ri-poster${t?" ri-poster--hidden":""}`,src:e,alt:"","aria-hidden":"true",draggable:!1,decoding:"async"}):null}function jr({className:e,background:t,poster:n,onReveal:r}){let i=Se();return(0,me.jsxs)("div",{className:`${e} ri-viewerPlaceholder`,style:{background:t},children:[(0,me.jsx)(Ft,{src:n}),r?(0,me.jsxs)("button",{type:"button",className:"ri-revealButton",onClick:r,children:[(0,me.jsx)(Wr.Box,{size:16,"aria-hidden":"true"}),i("viewIn3D")]}):null]})}var dt=require("@react-three/fiber"),Ht=require("react");var qr=require("react");function Xr(e){return!!e?.isWebGPURenderer}function Yr({captureRef:e}){let{gl:t,scene:n,camera:r,invalidate:i,get:a}=(0,dt.useThree)();return(0,Ht.useEffect)(()=>{if(!e)return;let s=()=>{let l=a();l.advance(l.frameloop==="never"?l.clock.elapsedTime:performance.now())};return e.current={gl:t,scene:n,camera:r,invalidate:i,drawNow:s},()=>{e.current=null}},[e,t,n,r,i,a]),null}function Zr(){let e=(0,dt.useThree)(n=>n.frameloop),t=(0,dt.useThree)(n=>n.invalidate);return(0,Ht.useEffect)(()=>{e!=="never"&&t()},[e,t]),null}function Kr(e){e.dispose(),"forceContextLoss"in e&&!Xr(e)&&(e.forceContextLoss(),e.forceContextLoss=()=>{})}function $r(e){if(!e)return Promise.resolve(null);try{e.drawNow();let t=e.gl.domElement;return new Promise(n=>{t.toBlob(r=>n(r?URL.createObjectURL(r):null),"image/webp",.85)})}catch{return Promise.resolve(null)}}var K=require("three");var le=require("three");function Jr(e){return!!(e&&typeof e=="object"&&"clone"in e&&"color"in e&&"metalness"in e&&"roughness"in e)}function Qr(e){if(Jr(e))return e;if(!e||typeof e!="object")return null;let t=e,n=new K.MeshStandardMaterial;typeof t.name=="string"&&(n.name=t.name),n.metalness=0,n.roughness=1,t.type==="MeshBasicMaterial"||t.isMeshBasicMaterial===!0?(n.color.set(0),n.emissiveIntensity=1,t.map instanceof K.Texture?(n.emissiveMap=t.map,n.emissive.set(16777215)):t.color instanceof K.Color&&n.emissive.copy(t.color)):(t.color instanceof K.Color&&n.color.copy(t.color),t.map instanceof K.Texture&&(n.map=t.map),t.emissive instanceof K.Color&&n.emissive.copy(t.emissive),t.emissiveMap instanceof K.Texture&&(n.emissiveMap=t.emissiveMap));let i=["aoMap","aoMapIntensity","lightMap","lightMapIntensity","alphaMap","opacity","transparent","alphaTest","side","vertexColors","wireframe","depthTest","depthWrite","visible","toneMapped","fog"];for(let a of i)t[a]!==void 0&&(n[a]=t[a]);return n.needsUpdate=!0,n}var Y=require("three");var ei=require("three");function ti(e){return e.isSkinnedMesh===!0}var Uo="reactImmersiveSkinFreeze";function ni(e){return e.userData[Uo]?.frozenInverse??null}var ri=new WeakMap,ii=new Y.Vector3,Oo=new Y.Vector3,ko=new Y.Vector3,Bo=new Y.Box3,ai=new Y.Matrix4;function Ae(e){return"data"in e?e.data.version:e.version}function zo(e){var o;let{geometry:t,skeleton:n}=e,r=t.getAttribute("position"),i=t.getAttribute("skinIndex"),a=t.getAttribute("skinWeight"),s=ri.get(e);if(s?.geometry===t&&s.position===r&&s.indices===i&&s.weights===a&&s.skeleton===n&&s.bindMatrix.equals(e.bindMatrix)&&s.versions[0]===Ae(r)&&s.versions[1]===Ae(i)&&s.versions[2]===Ae(a)&&s.inverses.length===n.boneInverses.length&&s.inverses.every((d,u)=>d.equals(n.boneInverses[u])))return s;let l={geometry:t,position:r,indices:i,weights:a,skeleton:n,versions:[Ae(r),Ae(i),Ae(a)],bindMatrix:e.bindMatrix.clone(),inverses:n.boneInverses.map(d=>d.clone()),bones:[],weightDeviation:0};e:for(let d=0;d<r.count;d++){ii.fromBufferAttribute(r,d).applyMatrix4(e.bindMatrix);let u=0;for(let v=0;v<4;v++){let g=a.getComponent(d,v);if(g===0)continue;let m=i.getComponent(d,v);if(!Number.isFinite(g)||g<0||!Number.isInteger(m)||!n.bones[m]||!l.inverses[m]){l.bones=null;break e}u+=g,((o=l.bones)[m]??(o[m]=new Y.Box3)).expandByPoint(Oo.copy(ii).applyMatrix4(l.inverses[m]))}let p=Math.abs(u-1);if(p>1e-4){l.bones=null;break}l.weightDeviation=Math.max(l.weightDeviation,p)}return ri.set(e,l),l}function oi(e,{precise:t=!1,updateFallbacks:n=!0}={}){e.updateMatrixWorld(!0),e.traverse(r=>{if(!ti(r))return;let i=r;if(!i.skeleton)return;let a=ni(i);a&&i.bindMatrixInverse.copy(a);let l=!!i.geometry.morphAttributes.position?.length?null:zo(i);if(!t&&!l?.bones&&!n&&i.boundingBox&&i.boundingSphere)return;let o=i.boundingBox??(i.boundingBox=new Y.Box3),d=i.boundingSphere??(i.boundingSphere=new Y.Sphere);if(o.makeEmpty(),t||!l?.bones){let u=i.geometry.getAttribute("position");for(let p=0;p<u.count;p++)o.expandByPoint(i.getVertexPosition(p,ko))}else{for(let u=0;u<l.bones.length;u++){let p=l.bones[u];p&&(ai.multiplyMatrices(i.bindMatrixInverse,i.skeleton.bones[u].matrixWorld),o.union(Bo.copy(p).applyMatrix4(ai)))}if(!o.isEmpty()){let u=o.min,p=o.max,v=i.bindMatrixInverse.elements,g=Math.max(1,Math.abs(u.x),Math.abs(u.y),Math.abs(u.z),Math.abs(p.x),Math.abs(p.y),Math.abs(p.z)),m=Math.max(Math.abs(u.x-v[12]),Math.abs(p.x-v[12]),Math.abs(u.y-v[13]),Math.abs(p.y-v[13]),Math.abs(u.z-v[14]),Math.abs(p.z-v[14]));o.expandByScalar(l.weightDeviation*m+g*1e-10)}}o.getBoundingSphere(d)})}var Te=require("three"),ce=require("three-mesh-bvh");var si=new WeakMap;function Gt(e){let t=si.get(e),n=e.index;return t&&t.attribute===n&&t.array===n?.array&&t.version===n?.version?t.source:n?.array??null}function Wt(e,t){let n=e.index;si.set(e,{source:t,attribute:n,array:n?.array,version:n?.version})}var di=!1,Ee=new WeakMap,Be=new WeakMap,ui=new WeakMap;function Fo(){di||(Te.Mesh.prototype.raycast=ce.acceleratedRaycast,di=!0)}function Ho(e){let t=new Set;return e.traverse(n=>{let r=n.geometry;!r||!r.attributes?.position||t.add(r)}),[...t]}function hi(e){let t=0;for(let n of e){let r=n.index?n.index.count:n.attributes.position.count;t+=r/3}return t}var ut=12e6;function pi(e){return ht(e)>ut}function ht(e){let t=new Set;return e.traverse(n=>{let r=n.geometry;r?.attributes?.position&&t.add(r)}),hi([...t])}function Go(e,t){let n=Gt(t);return new Promise((r,i)=>{let a=u=>{let p=u.data;if(!p||!p.error&&!p.serialized)return;if(e.removeEventListener("message",a),e.removeEventListener("error",s),p.error){i(new Error(String(p.error)));return}let{serialized:v}=p,g=ce.MeshBVH.deserialize(v,t,{setIndex:!1});v.index&&(t.index?t.index.array=v.index:t.setIndex(new Te.BufferAttribute(v.index,1,!1))),Wt(t,n),t.boundingBox=g.getBoundingBox(new Te.Box3),r(g)},s=u=>{e.removeEventListener("message",a),e.removeEventListener("error",s),i(new Error(u.message||"BVH worker error"))};e.addEventListener("message",a),e.addEventListener("error",s);let l=t.index?t.index.array.slice():null,o=t.attributes.position.array.slice(),d=[o,...l?[l]:[]].map(u=>u.buffer);e.postMessage({index:l,position:o,options:{groups:[...t.groups]}},d)})}async function Wo(){if(typeof window>"u"||typeof Worker>"u")return null;try{let{bvhWorkerCode:e}=await Promise.resolve().then(()=>(ci(),li)),t=new Blob([e],{type:"text/javascript"}),n=URL.createObjectURL(t),r=new Worker(n);return{worker:r,dispose:()=>{r.terminate(),URL.revokeObjectURL(n)}}}catch{return null}}async function jo(e,t){if(t)try{return await Go(t,e)}catch{}let n=Gt(e)?.slice()??null,r=ce.computeBoundsTree.call(e);return Wt(e,n),e.boundsTree=void 0,await new Promise(i=>setTimeout(i,0)),r}async function qo(e,t,n){if(e.boundsTree)return;if(t.buildPromise)return t.buildPromise;let r=(async()=>{let i=await n();t.references>0&&!e.boundsTree&&(e.boundsTree=i,t.ownedTree=i)})();return t.buildPromise=r.finally(()=>{t.buildPromise=void 0,t.references===0&&Ee.delete(e)}),t.buildPromise}function fi(e,t){let n=Xo(e,t);return ui.set(e,n),n}async function Xo(e,t){if(t?.aborted)return;let n=Be.get(e);if(!n){if(n=Ho(e),hi(n)>ut){Be.set(e,[]);return}Be.set(e,n);for(let i of n){let a=Ee.get(i)??{references:0};a.references+=1,Ee.set(i,a)}}if(n.length===0)return;Fo();let r=await Wo();if(t?.aborted){r?.dispose();return}try{for(let i of n){if(t?.aborted)return;let a=Ee.get(i);a&&await qo(i,a,()=>jo(i,r?.worker))}}finally{r?.dispose()}}function mi(e){ui.delete(e);let t=Be.get(e);if(t){Be.delete(e);for(let n of t){let r=Ee.get(n);r&&(r.references=Math.max(0,r.references-1),!(r.references>0)&&(r.ownedTree&&n.boundsTree===r.ownedTree&&(ce.disposeBoundsTree.call(n),n.boundsTree=void 0),r.ownedTree=void 0,r.buildPromise||Ee.delete(n)))}}}var A=require("three"),ea=require("three-stdlib");var D=require("lucide-react");var ee=require("react"),G=require("three"),_i=require("@react-three/fiber");var Yo="riEditorGizmo";function gi(e){return e.userData[Yo]=!0,e}function vi(e){return!Number.isFinite(e)||e<=0?1:10**Math.floor(Math.log10(e/10))}var jt=require("react/jsx-runtime"),Zo=`
|
|
3664
|
+
`});var zi={};$e(zi,{default:()=>Bi});function Bi(e){return(0,Vi.jsx)(ki.Environment,{...e})}var ki,Vi,Fi=Ke(()=>{"use strict";ki=require("@react-three/drei"),Vi=require("react/jsx-runtime")});var Ss={};$e(Ss,{DEFAULT_MODEL_VIEWER_LABELS:()=>Je,SimpleModelViewer:()=>en});module.exports=Va(Ss);function On(e){for(let t=e;t;t=t.parent)if(!t.visible)return!1;return!0}var kn;function Bn(e){kn=e}function he(e){kn?.(e)}var Je={modelViewer:"3D model viewer",openSceneSettingsPanel:"Open scene settings panel",closeSceneSettingsPanel:"Close scene settings panel",verifyingLicense:"Verifying License",checkingYourLicenseKey:"Checking your license key...",createDevelopmentKey:"Create a free development key",invalidLicense:"Invalid License",licenseHasBeenRevokedOrHasExpired:"License has been revoked or has expired",failedToLoadPleaseContactTheSiteAdministrator:"Failed to load. Please contact the site administrator.",contextRestoringTitle:"Reloading viewer\u2026",contextLostTitle:"3D view interrupted",contextRestoringMessage:"Rebuilding the 3D view. Please wait\u2026",contextLostMessage:"The graphics connection was interrupted. The viewer will rebuild when it returns, or you can reload it now.",reloadViewer:"Reload viewer",texturePositioningHint:"Drag to move \xB7 Scroll to zoom \xB7 Click elsewhere to finish",texturePositioningStartHint:"Double-click to move or zoom",dismiss:"Dismiss",missingUVsAreShownInMagenta:"Missing UVs are shown in magenta.",viewThisModelInARWithAppleQuickLook:"View this model in AR with Apple Quick Look",sequencePlayer:"Sequence player",sequenceSelect:"Sequence",sequencePlay:"Play sequence",sequencePause:"Pause sequence",sequenceStop:"Stop and restore scene",sequencePlayhead:"Sequence playhead",sequenceTime:"Sequence time",sequenceIssues:"Unavailable sequence targets",arConfiguredButton:"AR handoff",arConfiguredTitle:"Take this configuration to AR",arConfiguredDescription:"Your current materials, visible models and placements are included.",arSnapshotStale:"Updating AR to include your latest changes\u2026",arPreparing:"Preparing your scene\u2026",arStart:"Start AR",arStarting:"Starting AR\u2026",arCheckingSupport:"Checking AR support\u2026",arUnavailable:"AR is unavailable in this browser. Open this link in an AR-capable browser on your phone.",arStartFailed:"Could not start AR. Check camera permissions and try again.",arAnimations:"AR animations",arAnimationSelect:"Animation",arAnimationSaved:"Default",arAnimationNone:"No animation",arAnimationClips:"Model clips",arAnimationSequences:"Sequences",arAnimationPlay:"Play animation",arAnimationPause:"Pause animation",arRefresh:"Refresh AR",arRetry:"Try again",arExportDetails:"Export details",arPrepare:"Prepare AR",arPrepareAgain:"Prepare again",arDownloadUSDZ:"Download USDZ for iPhone/iPad",arScanConfigured:"Scan to open this configuration on your phone.",arOpenConfiguredLink:"Open configuration link",viewInAR:"View in AR",openThisExperienceOnAPhoneForAR:"Open this experience on a phone for AR",openOnPhone:"Open on phone",viewThisModelInYourSpace:"View this model in your space",viewThisModelInVR:"View this model in VR",closePhoneHandoff:"Close phone handoff",arScanCode:"Scan the code and choose AR.",qrCodeToOpenThisModelOnAPhone:"QR code to open this model on a phone",disableUVChecker:"Disable UV checker",enableUVChecker:"Enable UV checker",explodedView:"Exploded view",explodeAmount:"Explode amount",removeSectionCut:"Remove section cut",sectionCut:"Section cut",sectionAxis:"Section axis",sectionPosition:"Section position",keepTheOtherSide:"Keep the other side",pauseCinematic:"Pause cinematic",playCinematic:"Play cinematic",stopCinematicAndResetCamera:"Stop cinematic and reset camera",cancel:"Cancel",annotationCategories:"Annotation categories",annotations:"Annotations",all:"All",uncategorized:"Uncategorized",decalDragHint:"Drag the decal on the object. Release to save; Escape to cancel.",showAll:"Show all",materialVariants:"Material variants",startGuidedTour:"Start guided tour",guidedTour:"Guided Tour",previousAnnotation:"Previous annotation",previous:"Prev",stopGuidedTour:"Stop guided tour",nextAnnotation:"Next annotation",next:"Next",exitFullscreen:"Exit fullscreen",enterFullscreen:"Enter fullscreen",resetCameraView:"Reset camera view",orbitControl:"Orbit Control",pointLock:"Pointer lock",cameraController:"Camera controller",cameraControllerSettings:"Camera controller settings",downloadGLB:"Download GLB",downloadGLBDescription:"All visible models, material edits and animations in one file. No annotations or separate editor model slots. Duplicate mesh names may change on reimport.",downloadCombinedGLB:"Download as one GLB",downloadSeparateGLBs:"Download separate GLBs",downloadSeparateGLBsDescription:"One GLB file per model",downloadPNG:"Download PNG",downloadUVLayout:"Download UV Layout",videoFormat:"Video format",auto:"Auto",recordTurntableVideo:"Record turntable video",recordCinematicVideo:"Record cinematic video",videoUnsupported:"Video recording is not supported in this browser.",downloadOptions:"Download options",exporting:"Exporting\u2026",download:"Download",annotationTitlePlaceholder:"Title *",description:"Description",ok:"OK",arRelocate:"Relocate",tapToPlace:"Tap to place",closeAnnotation:"Close annotation",learnMore:"Learn more",stopMeasuring:"Stop measuring",startMeasuring:"Start measuring",toggleBoundingDimensions:"Toggle bounding dimensions",measurementTool:"Measurement tool",distance:"Distance",angle:"Angle",area:"Area",pointToPlane:"Point to plane",wrap:"Circumference (Edge)",wrapHorizontal:"Circumference (Horizontal)",measurementSnapping:"Measurement snapping",noSnapping:"No snapping",snapAuto:"Snap: auto",snapVertex:"Snap: vertex",snapEdge:"Snap: edge",undoMeasurementPoint:"Undo measurement point",clearMeasurements:"Clear measurements",finishArea:"Finish area",savedMeasurements:"Saved measurements ({count})",noSavedMeasurements:"No saved measurements yet. Pick points in the preview, then save a measurement here.",measurementFiles:"Import / export",measurementSourceUnit:"Model units",measurementDisplayUnit:"Display units",measurementName:"Name",measurementNamePlaceholder:"e.g. Door width",saveMeasurement:"Save",knownMeasurementDistance:"Known length",calibrationUnit:"Calibration unit",calibrateMeasurement:"Calibrate",measurementCalibrationHint:"Pick two distance points, enter their known length, then calibrate.",measurementCalibratedScale:"Calibrated: 1 model unit = {scale} m",resetMeasurementCalibration:"Reset calibration",showSavedMeasurement:"Show {name}",renameSavedMeasurement:"Rename {name}",deleteSavedMeasurement:"Delete {name}",exportMeasurementJson:"Export JSON",exportMeasurementCsv:"Export CSV",importMeasurementJson:"Import JSON",measurementReady:"Ready",measurementApproximate:"Approximate LOD",measurementModelChanged:"Different model",measurementObjectMissing:"Object unavailable",measurementGeometryChanged:"Geometry changed \u2014 measure again",measurementPoseChanged:"Pose changed \u2014 measure again",measurementObjectHidden:"Object hidden",measurementInvalid:"Invalid measurement",measurementWaiting:"Waiting for model",openSceneObjectsPanel:"Open scene objects panel",sceneObjects:"Scene Objects",searchNodesLabels:"Search nodes, labels",closeSceneObjectsPanel:"Close scene objects panel",objectNavigator:"Objects in the 3D view",compareBefore:"Before",compareAfter:"After",compareDivider:"Comparison divider",viewIn3D:"View in 3D",objectNavigatorHint:"Arrow keys browse \xB7 Enter selects \xB7 Esc clears",selectionCleared:"Selection cleared",cameraKeyboardHelp:"3D view. Arrow keys orbit, Shift with Up or Down zooms, and W, A, S, D, Space and C move the camera.",isolate:"Isolate",hide:"Hide",show:"Show",closePanel:"Close panel",actions:"Actions",openPanel:"Open panel",close:"Close",position:"Position",decalNudgeHint:"Click to fine-tune \xB7 Hold to move",decalNudgeControls:"Move decal in small steps",text:"Text",yourText:"Your text",textToAdd:"Text to add",textColour:"Text color",addText:"Add text",image:"Image",chooseImage:"Choose image",imageToAdd:"Image to add",added:"Added",colour:"Color",size:"Size",turn:"Turn",rotation:"Rotation",dragTheDecalAcrossTheObjectsSurface:"Drag the decal across the object's surface",move:"Move",remove:"Remove",noneAddedYet:"None added yet",done:"Done",moveForward:"Move forward",moveLeft:"Move left",moveRight:"Move right",moveBackward:"Move backward",productOptions:"Options",productOptionsFor:"{product} options",productReset:"Reset",productOptional:"optional",productNone:"None",productAlsoChanges:"Also changes: {changes}",productUnavailable:"Currently unavailable.",productQuantity:"Quantity",productCheckingPrice:"Checking price and availability\u2026",productTotal:"Total",productAddToCart:"Add to cart",productAddingToCart:"Adding\u2026",productRequestQuote:"Request quote",productRequestingQuote:"Requesting\u2026",productRefresh:"Refresh",productBuy:"Buy now",productCopyLink:"Copy link",productLinkCopied:"Link copied",productShowOptions:"Show options",productHideOptions:"Hide options",productIssues:"Configuration issues",productRequestDone:"Request completed.",productSaved:"Saved: {id}",sceneSettings:"Scene Settings",background:"Background",backgroundColor:"Background Color",showEnvironmentAsBackground:"Show as background",backgroundBlur:"Background Blur",environmentPreset:"Preset",environmentIntensity:"Intensity",toneMapping:"Tone Mapping",toneMappingAces:"ACES Filmic",toneMappingAgx:"AgX",toneMappingNeutral:"Neutral",toneMappingNone:"None",ground:"Ground",groundShadow:"Ground Shadow",groundShadowOpacity:"Shadow Opacity",floorGrid:"Floor Grid",display:"Display",wireframe:"Wireframe",autoRotateSpeed:"Rotation Speed",fieldOfView:"Field of View",modelInfo:"Model",modelInfoObjects:"Objects",modelInfoTriangles:"Triangles",modelInfoMaterials:"Materials",resetSettings:"Reset Settings",environment:"Environment",autoRotate:"Auto Rotate",lighting:"Lighting",exposure:"Exposure",ambientLightIntensity:"Ambient Light Intensity",ambientLightColor:"Ambient Light Color",directLightIntensity:"Direct Light Intensity",directLightColor:"Direct Light Color",searchObjects:"Search objects",uploadedModel:"Uploaded model",clear:"Clear",chooseModel:"Choose model",loadingModel:"Loading model...",releaseToLoadYourModel:"Release to load your model",arFindSurface:"Move your device over a flat surface",arReleaseToPlace:"Release to place",arGestureHint:"Pinch to resize \xB7 Twist to rotate",angleFirstArmHint:"Pick the first arm",angleVertexHint:"Pick the angle's vertex",angleSecondArmHint:"Pick the second arm",angleNewHint:"Pick a point to start a new angle",areaNewHint:"Pick a point to start a new area",areaCornersHint:"Pick polygon corners in order, then Finish area",pointToPlaneFaceHint:"Pick the reference face",pointToPlanePointHint:"Pick a point to measure its perpendicular distance",pointToPlaneNewHint:"Pick a face to start a new measurement",distanceHint:"Pick points on the model to measure distances",wrapHint:"Click a point on the surface to measure its circumference, following the surface (best for limbs)",wrapHorizontalHint:"Click a point to measure a level circumference around it (best for the torso/waist)",visibleEntries:"{count} visible entries",objectCount:"{count} objects",annotationMarker:"Annotation {id}: {title}",recordingVideo:"Recording video \xB7 {progress}%",isolatedObjects:"Isolated: {count} objects",largeModelWarning:"Very large model ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the objects panel to select parts.",preparingLargeModel:"Preparing large model ({millions}M triangles) \u2014 the first display can take a while on this device...",enterAR:"Enter AR",enterVR:"Enter VR",decalImage:"Image {index}",decalText:"Text {index}",decalAdded:"{count} added",up:"up",down:"down",left:"left",right:"right",moveDecal:"Move decal {direction}",moveDecalOnSurface:"Move {direction} on the visible surface",showAllObject:"Show all {name}",isolateObject:"Isolate {name}",isolatedObject:"Isolated: {name}",hideObject:"Hide {name}",showObject:"Show {name}",objectSelected:"{name} selected",objectNavigatorPosition:"{position} of {count}",compareDividerValue:"{before} {percent}%, {after} {rest}%",bindingMismatchOne:"1 object binding doesn't match this model",bindingMismatchMany:"{count} object bindings don't match this model",simpleLargeModelWarning:"Very large model detected ({millions}M triangles) \u2014 it may render and move slowly on this device, and click/hover selection on the model is disabled. Use the scene objects panel to select parts.",dropModelHint:"Drag and drop {formats} here",retryModelLoad:"Retry loading model",loadErrorTitle:"This model couldn't be loaded",loadErrorNotFound:"Nothing was found at this address ({status}). Check that modelUrl points to the file.",loadErrorDenied:"The server refused access to the file ({status}). Check that the file is public, or that a signed URL hasn't expired.",loadErrorStatus:"The server responded with {status} when the file was requested.",loadErrorNetwork:"The download was blocked or failed. Check that the URL is correct and, if the file is on another domain, that its server allows cross-origin requests (CORS) from this site.",loadErrorHtml:"The server sent back a web page instead of a model. There's probably no file at this path: many servers answer a missing file with their index.html.",loadErrorInvalidFile:"The file couldn't be read as {format}. Check that it's a valid {format} file.",loadErrorInvalidExplicitFormat:"The file couldn't be read as {format}. Check that it's a valid {format} file and that modelFormat matches it.",loadErrorMissingFormat:"The file couldn't be read as {format}. The URL has no file extension, so set modelFormat to the file's format.",loadErrorPointCloud:"This PLY file is a point cloud: it has points but no faces, and the viewer shows meshes. Turn it into a mesh first, for example with MeshLab or Blender.",measurementReferenceFaceRequired:"Pick a triangle face to define the reference plane.",measurementTooManyPoints:"Finish or clear this measurement before adding more points.",measurementAngleDistinct:"Pick a point away from the angle's vertex.",areaMinimumPoints:"Pick at least three points to finish the area.",areaDistinctPoints:"Area points must be distinct.",areaStraightLine:"Area points must not lie on one straight line.",areaNotPlanar:"Area points must lie on one plane.",areaEdgesCross:"Area edges must not cross or touch each other.",areaZero:"The polygon has no measurable area.",decalSurfaceMissing:"Could not find a surface on this object for the decal.",decalDirectionMissing:"No visible surface in that direction. Try another arrow or rotate the view.",fullscreenExitFailed:"Could not exit fullscreen. Press Escape to exit.",fullscreenEnterFailed:"Could not enter fullscreen. Check your browser or iframe fullscreen permissions and try again.",uvCoordinatesMissing:"This model does not contain UV coordinates.",uvExportFailed:"Could not create the UV layout archive.",videoExportFailed:"Could not export the video.",videoNotReady:"Viewer not ready for video export.",videoExitXR:"Exit the XR session before recording a video.",videoAlreadyRecording:"A video export is already in progress.",videoPathRequired:"Enable a cinematic camera path before recording it.",videoDurationInvalid:"Video duration must be greater than 0 and at most 300 seconds.",videoFrameRateInvalid:"Video frame rate must be between 1 and 60.",videoBitrateInvalid:"Video bitrate must be a positive number.",videoContextLost:"Video export stopped because the WebGL context was lost.",videoTimedOut:"Video export timed out. Keep the viewer tab visible while recording.",videoEncodingFailed:"The browser could not encode the video.",videoEmpty:"The browser produced an empty video.",videoDidNotStart:"Video recording did not start.",videoWebMUnsupported:"Video recording as WEBM is not supported in this browser.",videoMP4Unsupported:"Video recording as MP4 is not supported in this browser.",videoGIFUnsupported:"Video recording as GIF is not supported in this browser.",videoGifWidthInvalid:"GIF width must be a whole number of pixels from 16 to 4096.",environmentNeutral:"neutral",environmentApartment:"apartment",environmentCity:"city",environmentDawn:"dawn",environmentForest:"forest",environmentLobby:"lobby",environmentNight:"night",environmentPark:"park",environmentStudio:"studio",environmentSunset:"sunset",environmentWarehouse:"warehouse",color:"Color",material:"Material",texturePreview:"texture preview",noTextureApplied:"No texture applied",noTextureCoordinates:"This part has no texture coordinates, so an image can't be placed on it.",replaceImage:"Replace image",uploadImage:"Upload image",removeTexture:"Remove texture",texturePosition:"Texture position",offsetX:"Offset X",offsetY:"Offset Y",confirmTexturePosition:"Confirm this texture position and exit positioning mode",donePositioning:"Done positioning",textureOffsetHint:"Double-click the object in the preview to drag its texture directly (scroll to zoom), or edit its offset numerically.",actionToggleLight:"Toggle Light",actionChangeLightColor:"Change Light Color",actionSetBrightness:"Set Brightness",actionChangeColor:"Change Color",actionChangeMaterial:"Change Material",actionToggleVisibility:"Toggle Visibility"};function De(e,t,n={}){return(e?.[t]??Je[t]).replace(/\{(\w+)\}/g,(i,a)=>Object.prototype.hasOwnProperty.call(n,a)?String(n[a]):i)}var Fa=new Map(Object.entries(Je).map(([e,t])=>[t,e]));function zn(e,t){let n=Fa.get(t);return n?De(e,n):t}var Me=require("fflate");var Ha=[".glb",".gltf",".obj",".fbx",".usdz",".stl",".ply",".zip"],Ga=["model/gltf-binary","model/gltf+json","model/vnd.usdz+zip","application/vnd.usdz+zip","application/zip","application/x-zip-compressed"],Ie=1024*1024,Vn=128*Ie,Fn=1024,Hn=128*Ie,Gn=256*Ie,Wn=200,Wa=Ie,ne=new Map,Yn=".glb,.gltf,.obj,.fbx,.usdz,.stl,.ply,.zip,model/gltf-binary,model/gltf+json,model/vnd.usdz+zip,application/vnd.usdz+zip,application/zip";function Ne(e){let t=e.split(/[?#]/,1)[0].toLowerCase();return t.endsWith(".obj")?"obj":t.endsWith(".fbx")?"fbx":t.endsWith(".usdz")?"usdz":t.endsWith(".stl")?"stl":t.endsWith(".ply")?"ply":t.endsWith(".gltf")?"gltf":"glb"}function Zn(e){return ne.get(e)??{format:Ne(e)}}function ja(e){let t=e.name.toLowerCase();return Ha.some(n=>t.endsWith(n))||Ga.includes(e.type)}async function Kn(e){if(!ja(e))throw new Error("Unsupported model file. Please upload a .glb, .gltf, .obj, .fbx, .usdz, .stl, .ply, or .zip asset.");let t=e.name.toLowerCase();if(t.endsWith(".usdz")||e.type==="model/vnd.usdz+zip"||e.type==="application/vnd.usdz+zip")return jn(e,"usdz");if(t.endsWith(".zip")||qa(e.type))return Xa(e);if(t.endsWith(".gltf")||e.type==="model/gltf+json")return qn(e);let n=Ne(e.name);return n==="gltf"?qn(e):jn(e,n)}function jn(e,t){let n=URL.createObjectURL(e);return ne.set(n,{format:t,entryPath:e.name,sourceBytes:e.size}),{url:n,name:e.name,format:t,cleanup:()=>{he(n),ne.delete(n),URL.revokeObjectURL(n)}}}function qa(e){return e==="application/zip"||e==="application/x-zip-compressed"}async function qn(e){let t=await e.text(),n=$n(t,e.name);for(let i of Jn(n))if(!It(i))throw new Error(`${e.name} references external assets. Upload a .zip containing the .gltf file and its dependencies.`);let r=URL.createObjectURL(e);return ne.set(r,{format:"gltf",entryPath:e.name,sourceBytes:e.size}),{url:r,name:e.name,format:"gltf",cleanup:()=>{he(r),ne.delete(r),URL.revokeObjectURL(r)}}}async function Xa(e){if(e.size>Vn)throw new Error(`Model zip is too large. The compressed archive must be ${Dt(Vn)} or smaller.`);let t=await Ya(new Uint8Array(await e.arrayBuffer())),n=new Map;for(let[s,l]of Object.entries(t)){let o=Nt(s);!o||Qn(o)||n.set(o,l)}let r=[...n.keys()].filter(s=>/\.(gltf|obj|fbx|stl|ply)$/i.test(s));if(r.length===0)throw new Error("Invalid model zip: no .gltf, .obj, .fbx, .stl, or .ply file found.");if(r.length>1)throw new Error("Invalid model zip: multiple model entry files found.");let i=r[0],a=Ne(i);if(a==="gltf")return Ka(e,i,n);if(a==="obj"||a==="fbx"||a==="stl"||a==="ply")return Za(e,i,a,n);throw new Error(`Unsupported model entry ${i}.`)}function Ya(e){return new Promise((t,n)=>{let r=0,i=0,a=null,s=o=>(a??(a=new Error(`Invalid model zip: ${o}`)),!1);(0,Me.unzip)(e,{filter:o=>{if(a)return!1;if(r+=1,r>Fn)return s(`archive contains more than ${Fn.toLocaleString()} entries.`);if(o.originalSize>Hn)return s(`${o.name} expands beyond the ${Dt(Hn)} per-file limit.`);if(i+=o.originalSize,i>Gn)return s(`expanded contents exceed ${Dt(Gn)}.`);if(o.originalSize>=Wa&&(o.size===0||o.originalSize/o.size>Wn))return s(`${o.name} exceeds the ${Wn}:1 compression-ratio limit.`);let u=Nt(o.name);return!!u&&!Qn(u)}},(o,u)=>{a?n(a):o?n(new Error(`Invalid model zip: ${o.message}`)):t(u)})})}function Dt(e){return`${e/Ie} MiB`}function Za(e,t,n,r){let i=[],a={};for(let[l,o]of r){let u=URL.createObjectURL(new Blob([o],{type:er(l)}));i.push(u),a[l]=u}let s=a[t];if(!s)throw i.forEach(l=>URL.revokeObjectURL(l)),new Error(`Invalid model zip: could not read ${t}.`);return ne.set(s,{format:n,entryPath:t,resourceUrls:a}),{url:s,name:e.name,format:n,cleanup:()=>{he(s),ne.delete(s),i.forEach(l=>URL.revokeObjectURL(l))}}}function Ka(e,t,n){let r=n.get(t);if(!r)throw new Error("Invalid GLTF zip: no .gltf found.");let i=$n((0,Me.strFromU8)(r),t);$a(i,t);let a=Ja(t),s=[];try{Xn(i.buffers,a,n,s),Xn(i.images,a,n,s);let l=new Blob([(0,Me.strToU8)(JSON.stringify(i))],{type:"model/gltf+json"}),o=URL.createObjectURL(l);return s.push(o),ne.set(o,{format:"gltf",entryPath:t}),{url:o,name:e.name,format:"gltf",cleanup:()=>{he(o),ne.delete(o),s.forEach(u=>URL.revokeObjectURL(u))}}}catch(l){throw s.forEach(o=>URL.revokeObjectURL(o)),l}}function Xn(e,t,n,r){for(let i of e??[]){if(typeof i.uri!="string"||It(i.uri))continue;let a=Qa(t,i.uri),s=n.get(a);if(!s)throw new Error(`Invalid GLTF zip: missing referenced asset ${i.uri}.`);let l=URL.createObjectURL(new Blob([s],{type:er(a)}));r.push(l),i.uri=l}}function $n(e,t){try{return JSON.parse(e)}catch{throw new Error(`${t} is not a valid .gltf JSON file.`)}}function Jn(e){return[...e.buffers??[],...e.images??[]].map(t=>t.uri).filter(t=>typeof t=="string"&&t.length>0)}function $a(e,t){for(let n of Jn(e)){if(It(n))continue;let r=/^[a-z][a-z0-9+.-]*:/i.test(n),i=n.startsWith("/")||n.startsWith("\\");if(r||i)throw new Error(`${t} references external assets. Include every dependency inside the uploaded .zip.`)}}function It(e){return e.startsWith("data:")}function Nt(e){let t=[];for(let n of e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(r=>r&&r!==".")){if(n===".."){t.pop();continue}t.push(n)}return t.join("/")}function Qn(e){let t=e.split("/");return e.endsWith("/")||t.includes("__MACOSX")||t.some(n=>n===".DS_Store"||n.startsWith("._"))}function Ja(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function Qa(e,t){let n=t.split(/[?#]/)[0],r=eo(n);return Nt(e?`${e}/${r}`:r)}function eo(e){try{return decodeURI(e)}catch{return e}}function er(e){let t=e.toLowerCase();return t.endsWith(".obj")||t.endsWith(".mtl")?"text/plain":t.endsWith(".fbx")?"application/octet-stream":t.endsWith(".usdz")?"model/vnd.usdz+zip":t.endsWith(".bin")?"application/octet-stream":t.endsWith(".png")?"image/png":t.endsWith(".jpg")||t.endsWith(".jpeg")?"image/jpeg":t.endsWith(".webp")?"image/webp":t.endsWith(".avif")?"image/avif":t.endsWith(".ktx2")?"image/ktx2":"application/octet-stream"}et();var to={glb:"GLB",gltf:"glTF",obj:"OBJ",fbx:"FBX",usdz:"USDZ",stl:"STL",ply:"PLY"},no=/\.(glb|gltf|obj|fbx|usdz|stl|ply|zip)$/i;function ro(e,t){let n=e?.response?.status;if(typeof n=="number")return n;let r=/responded with (\d{3})/.exec(t);return r?Number(r[1]):null}function nr(e,t,n,r){let i=e instanceof Error?e.message:e==null?"":String(e),a=(_,p)=>De(r,_,p),s=a("loadErrorTitle"),l=i||null;if(Qe(e))return{title:s,detail:a("loadErrorPointCloud"),technical:l};let o=ro(e,i);if(o===404||o===410)return{title:s,detail:a("loadErrorNotFound",{status:o}),technical:l};if(o===401||o===403)return{title:s,detail:a("loadErrorDenied",{status:o}),technical:l};if(o!==null)return{title:s,detail:a("loadErrorStatus",{status:o}),technical:l};if(/failed to fetch|networkerror|load failed|network error/i.test(i))return{title:s,detail:a("loadErrorNetwork"),technical:l};if(/<!doctype|<html/i.test(i))return{title:s,detail:a("loadErrorHtml"),technical:l};let u=t.split(/[?#]/,1)[0],d=to[n??Ne(t)],m=no.test(u);return{title:s,detail:m||n?a(n?"loadErrorInvalidExplicitFormat":"loadErrorInvalidFile",{format:d}):a("loadErrorMissingFormat",{format:d}),technical:l}}var tt=e=>e*Math.PI/180;function rr(e){return{minDistance:e?.minDistance??0,maxDistance:e?.maxDistance??1/0,minPolarAngle:tt(e?.minPolarAngle??0),maxPolarAngle:tt(e?.maxPolarAngle??180),minAzimuthAngle:tt(e?.minAzimuthAngle??-1/0),maxAzimuthAngle:tt(e?.maxAzimuthAngle??1/0),boundaryEnclosesCamera:e?.boundaryEnclosesCamera??!1,boundaryFriction:e?.boundaryFriction??0,panBoundary:e?.panBoundary}}var we=require("react");var or=require("react/jsx-runtime"),ir=(0,we.createContext)(void 0);function ar({labels:e,children:t}){return(0,or.jsx)(ir.Provider,{value:e,children:t})}function Se(){let e=(0,we.useContext)(ir);return(0,we.useMemo)(()=>Object.assign((t,n)=>De(e,t,n),{message:t=>zn(e,t)}),[e])}var sr=require("react"),lr="(prefers-reduced-motion: reduce)";function io(e){if(typeof window>"u"||!window.matchMedia)return()=>{};let t=window.matchMedia(lr);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}var ao=()=>typeof window<"u"&&!!window.matchMedia?.(lr).matches;function cr(e="user"){let t=(0,sr.useSyncExternalStore)(io,ao,()=>!1);return e==="always"?!0:e==="never"?!1:t}var h=require("react");var Ue=require("three");var dr="KHR_materials_variants",ur="riMaterialVariants",hr="riMaterialVariantGroups";function F(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function oo(e){if(!F(e)||!F(e.extensions))return[];let t=e.extensions[dr];if(!F(t)||!Array.isArray(t.variants))return[];let n=new Set;return t.variants.map((r,i)=>{let a=F(r)&&typeof r.name=="string"&&r.name?r.name:`Variant ${i+1}`,s=a;for(let l=2;n.has(s);l+=1)s=`${a} (${l})`;return n.add(s),s})}var so=/^\s*(.+?)\s*(?::|\s\/\s)\s*(.+?)\s*$/;function lo(e){let t=Math.min(Math.max(e,0),1),n=t<=.0031308?t*12.92:1.055*t**(1/2.4)-.055;return Math.round(n*255)}function co(e){if(!F(e))return;let t=F(e.pbrMetallicRoughness)?e.pbrMetallicRoughness:{};if(t.baseColorTexture!==void 0)return;let n=Array.isArray(t.baseColorFactor)?t.baseColorFactor:[1,1,1,1];if(n.slice(0,3).every(r=>typeof r=="number"))return`#${n.slice(0,3).map(r=>lo(r).toString(16).padStart(2,"0")).join("")}`}function uo(e,t){if(t.length===0)return[];let n=F(e)?e:{},r=Array.isArray(n.meshes)?n.meshes:[],i=Array.isArray(n.accessors)?n.accessors:[],a=Array.isArray(n.materials)?n.materials:[],s=t.map(()=>new Set),l=t.map(()=>new Map);r.forEach((p,v)=>{(F(p)&&Array.isArray(p.primitives)?p.primitives:[]).forEach((y,b)=>{if(!F(y))return;let S=F(y.extensions)?y.extensions[dr]:void 0;if(!F(S)||!Array.isArray(S.mappings))return;let U=F(y.attributes)?y.attributes.POSITION:void 0,P=typeof U=="number"?i[U]:void 0,N=F(P)&&typeof P.count=="number"?P.count:1;for(let B of S.mappings)if(!(!F(B)||!Number.isInteger(B.material)||!Array.isArray(B.variants)))for(let j of B.variants){if(!Number.isInteger(j)||!s[j])continue;s[j].add(`${v}/${b}`);let q=l[j],ee=B.material;q.set(ee,(q.get(ee)??0)+N)}})});let o=t.map((p,v)=>{let x=null;for(let[b,S]of l[v])(x===null||S>(l[v].get(x)??0))&&(x=b);let y=x===null?void 0:co(a[x]);return{name:p,label:p,...y?{swatch:y}:{}}}),u=t.map(()=>-1),d=[],m=new Map;return t.forEach((p,v)=>{let x=so.exec(p);if(!x)return;let[,y,b]=x;m.has(y)||(m.set(y,d.length),d.push({name:y,members:[]})),u[v]=m.get(y),d[u[v]].members.push(v),o[v].label=b}),t.map((p,v)=>v).filter(p=>u[p]<0).sort((p,v)=>+(s[p].size===0)-+(s[v].size===0)).forEach(p=>{let v=d.map((b,S)=>({group:b,groupIndex:S})).filter(({group:b})=>b.name===null&&b.members.some(S=>s[p].size===0||s[S].size===0?!1:[...s[p]].some(U=>s[S].has(U)))).map(({groupIndex:b})=>b);if(v.length===0&&s[p].size===0){let b=d.findIndex(S=>S.name===null);b>=0&&v.push(b)}if(v.length===0){u[p]=d.length,d.push({name:null,members:[p]});return}let[x,...y]=v;for(let b of y){for(let S of d[b].members)u[S]=x;d[x].members.push(...d[b].members),d[b].members=[]}u[p]=x,d[x].members.push(p)}),d.filter(p=>p.members.length>0).sort((p,v)=>Math.min(...p.members)-Math.min(...v.members)).map(p=>({name:p.name,variants:[...p.members].sort((v,x)=>v-x).map(v=>o[v])}))}function pr(e){let t=e.parser,n=oo(t?.json);if(!(!t||n.length===0))return e.scene.userData[ur]=n,e.scene.userData[hr]=uo(t.json,n),{names:n,resolveMaterial:async(r,i)=>{let a={geometry:i.geometry,material:await t.getDependency("material",r),isPoints:i.isPoints,isLine:i.isLine};return t.assignFinalMaterial(a),a.material}}}function Ut(e){let t=e.userData?.[ur];return Array.isArray(t)&&t.every(n=>typeof n=="string")?t:[]}function fr(e){let t=e.userData?.[hr];if(Array.isArray(t))return t;let n=Ut(e);return n.length>0?[{name:null,variants:n.map(r=>({name:r,label:r}))}]:[]}function nt(e){return[e.x,e.y,e.z]}function mr(e){let t=new Ue.Box3().setFromObject(e),n=0;return e.traverse(r=>{r.isMesh&&(n+=1)}),{bounds:{min:nt(t.min),max:nt(t.max),center:nt(t.getCenter(new Ue.Vector3)),size:nt(t.getSize(new Ue.Vector3))},objectCount:n,materialVariants:Ut(e),materialVariantGroups:fr(e)}}var ea=require("@react-three/drei"),K=require("@react-three/fiber"),ta=require("@react-three/fiber");var Oe=require("@react-three/fiber"),fe=require("three"),Lr=require("three-stdlib");var ho=require("@react-three/drei"),po=require("@react-three/fiber"),fo=require("react"),_r=require("three"),rt=require("three-stdlib");function mo(e){return{name:"RI_unlit_emissive_texture",async afterRoot(t){let n=e.json.materials??[],r=new Map;if(n.forEach(a=>{let s=!!a?.extensions?.KHR_materials_unlit,l=!!a?.pbrMetallicRoughness?.baseColorTexture;s&&!l&&a?.emissiveTexture&&a.name&&r.set(a.name,a.emissiveTexture.index)}),r.size===0||!t.scene)return;let i=new Map;await Promise.all([...r].map(async([a,s])=>{let l=await e.getDependency("texture",s);l&&(l.colorSpace=_r.SRGBColorSpace,i.set(a,l))})),t.scene.traverse(a=>{let s=Array.isArray(a.material)?a.material:a.material?[a.material]:[];for(let l of s){let o=l.name?i.get(l.name):void 0;o&&!l.map&&(l.map=o,l.needsUpdate=!0)}})}}}var go="https://assets.react-immersive.liveroom.dev/three-r184/draco/",vo="https://assets.react-immersive.liveroom.dev/three-r184/basis/",gr=new Map,vr=new WeakMap;function _o(e){let t=gr.get(e);return t||(t=new rt.DRACOLoader,t.setDecoderPath(e),gr.set(e,t)),t}function xo(e,t){let n=vr.get(t);n||(n=new Map,vr.set(t,n));let r=n.get(e);return r||(r=new Ot(e,t),n.set(e,r)),r}var Ot=class{constructor(t,n){this.transcoderPath=t;this.gl=n;this.real=null}loader(){return this.real??(this.real=import("three/examples/jsm/loaders/KTX2Loader.js").then(({KTX2Loader:t})=>new t().setTranscoderPath(this.transcoderPath).detectSupport(this.gl))),this.real}load(t,n,r,i){this.loader().then(a=>a.load(t,n,r,i),a=>i?.(a))}dispose(){this.real?.then(t=>t.dispose())}};function xr(e,t={},n){let{dracoDecoderPath:r=go,ktx2TranscoderPath:i=vo,meshopt:a=!0}=t;r&&e.setDRACOLoader(_o(r)),a&&e.setMeshoptDecoder(rt.MeshoptDecoder),i&&n&&e.setKTX2Loader(xo(i,n)),e.register((s=>mo(s)))}var yr=require("three");var yo=new WeakMap;function kt(e,t){yo.set(e,structuredClone(t))}function br(e){if(/^(blob|data):/i.test(e))return"Local resource";let t=e.split(/[?#]/,1)[0].replace(/\\/g,"/");return t.slice(t.lastIndexOf("/")+1).slice(0,300)||"Resource"}function Mr(e){return/^(blob|data):/i.test(e)?"Local resource":e.split(/[?#]/,1)[0].replace(/\\/g,"/").replace(/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,"").replace(/^\/+/,"").slice(0,500)||"Resource"}var at=class extends fe.Loader{constructor(){super(...arguments);this.options={source:{format:"glb"}}}configure(n){return this.options=n,this}load(n,r,i,a){let s=performance.now(),l={format:this.options.source.format,name:this.options.source.entryPath??br(n),sourceBytes:this.options.source.sourceBytes??null,failedResources:[]},o=u=>{l.sourceBytes===null&&u.lengthComputable&&u.total>0&&(l.sourceBytes=u.total),i?.(u)};this.loadAsset(n,o,l).then(u=>{l.loadDurationMs=Math.max(0,performance.now()-s),kt(u.scene,l),r(u)}).catch(u=>{l.loadDurationMs=Math.max(0,performance.now()-s),u&&typeof u=="object"&&kt(u,l),a?.(u)})}async loadAsset(n,r,i){let a=To(this.options.source);a.onError=u=>{let d=Object.entries(this.options.source.resourceUrls??{}).find(([,_])=>_===u)?.[0],m=Mr(d??u);i.failedResources.includes(m)||i.failedResources.push(m)};let{format:s}=this.options.source;if(s==="obj")return Ao(n,a,this.options.source,r);if(s==="fbx"){let{FBXLoader:u}=await import("three/examples/jsm/loaders/FBXLoader.js"),d=zt(this,new u(a)),m=Lo(n,this.options.source);m&&d.setResourcePath(m);let _=await d.loadAsync(n,r);return it(_,"FBXMesh",!1),{scene:_,animations:_.animations??[]}}if(s==="stl"||s==="ply"){let{meshNameFromPath:u,parsePly:d,parseStl:m}=await Promise.resolve().then(()=>(Cr(),Tr)),_=await Eo(n,a,r),p=u(this.options.source.entryPath??n,s==="stl"?"STL model":"PLY model"),v=s==="stl"?m(_,p):d(_,p);return it(v,s==="stl"?"STLMesh":"PLYMesh",!0),{scene:v,animations:[]}}if(s==="usdz"){let{USDLoader:u}=await import("three/examples/jsm/loaders/USDLoader.js"),m=await zt(this,new u(a)).loadAsync(n,r);return it(m,"USDZMesh",!1),{scene:m,animations:m.animations??[]}}let l=zt(this,new Lr.GLTFLoader(a));xr(l,this.options.decoderConfig,this.options.renderer),l.register(u=>{let d=u.json,m=_=>Array.isArray(_)?_.filter(p=>typeof p=="string"):[];return i.extensionsUsed=m(d.extensionsUsed),i.extensionsRequired=m(d.extensionsRequired),{name:"RI_asset_diagnostics",beforeRoot:()=>null}});let o=await l.loadAsync(n,r);return{scene:o.scene,animations:o.animations??[],materialVariants:pr(o)}}};Bn(e=>{Oe.useLoader.clear(at,e)});function Rr(e,t={},n,r){let i=(0,Oe.useThree)(l=>l.gl),a=Zn(e),s=n?{...a,format:n}:a;return(0,Oe.useLoader)(at,e,l=>{l.configure({source:s,decoderConfig:t,renderer:i})},r)}async function Ao(e,t,n,r){let[{OBJLoader:i},a]=await Promise.all([import("three/examples/jsm/loaders/OBJLoader.js"),Pr(e,t,r)]),s=new i(t),l=Co(a);if(l){let u=Po(l,e,n);if(u)try{let d=await Pr(u.url,t),{MTLLoader:m}=await import("three/examples/jsm/loaders/MTLLoader.js"),p=new m(t).parse(d,u.basePath);p.preload(),s.setMaterials(p)}catch(d){console.warn(`[react-immersive] Could not load OBJ material ${l}; rendering geometry with fallback materials.`,d)}}let o=s.parse(a);return it(o,"OBJMesh",!0),{scene:o,animations:[]}}function it(e,t,n){let r=new Set,i=0;e.traverse(a=>{if(!("isMesh"in a&&a.isMesh===!0)){a.name&&r.add(a.name);return}let l=a.name||`${t}_${++i}`;if(!n&&a.name){r.add(a.name);return}let o=l,u=2;for(;r.has(o);)o=`${l}_${u++}`;a.name=o,r.add(o)})}function Pr(e,t,n){let r=new fe.FileLoader(t);return r.setResponseType("text"),r.loadAsync(e,n)}function Eo(e,t,n){let r=new fe.FileLoader(t);return r.setResponseType("arraybuffer"),r.loadAsync(e,n)}function zt(e,t){return t.setCrossOrigin(e.crossOrigin),t.setWithCredentials(e.withCredentials),t.setRequestHeader(e.requestHeader),t}function To(e){let t=new fe.LoadingManager,n=e.resourceUrls;return n&&t.setURLModifier(r=>{if(/^(?:blob:|data:)/i.test(r))return r;let i=st(Ir(r).split(/[?#]/)[0]),a=n[i];if(a)return a;let s=ot(e.entryPath??""),l=st(s?`${s}/${i}`:i);return n[l]??r}),t}function Co(e){return/^\s*mtllib\s+(.+?)\s*$/im.exec(e)?.[1]?.trim()||null}function Po(e,t,n){if(n.resourceUrls&&n.entryPath){let r=st(`${ot(n.entryPath)}/${Ir(e)}`),i=n.resourceUrls[r];if(!i)return null;let a=ot(r);return{url:i,basePath:a?`${a}/`:""}}try{let r=new URL(e,t).href;return{url:r,basePath:Dr(r)}}catch{return null}}function Lo(e,t){if(t.resourceUrls&&t.entryPath){let n=ot(t.entryPath);return n?`${n}/`:""}return Dr(e)}function Dr(e){let t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t+1)}function ot(e){let t=st(e),n=t.lastIndexOf("/");return n===-1?"":t.slice(0,n)}function st(e){let t=[];for(let n of e.replace(/\\/g,"/").replace(/^\/+/,"").split("/").filter(r=>r&&r!=="."))n===".."?t.pop():t.push(n);return t.join("/")}function Ir(e){try{return decodeURI(e)}catch{return e}}var Nr=require("three");function Ur(e){let t=new Nr.Color(0,0,0);try{t.setStyle(e,"srgb-linear")}catch{return!1}let n=[t.r,t.g,t.b].map(r=>r<=.04045?r/12.92:((r+.055)/1.055)**2.4);return .2126*n[0]+.7152*n[1]+.0722*n[2]>.3}var J=require("react/jsx-runtime");function Or({visible:e,title:t,message:n,progress:r,background:i,seeThrough:a=!1}){if(!e)return null;let s=i!==void 0&&Ur(i),l=a?"transparent":i,o=typeof r=="number"&&Number.isFinite(r),u=o?Math.round(Math.min(Math.max(r,0),100)):0;return(0,J.jsx)("div",{className:`bb-loadingOverlay${s?" bb-loadingOverlay--light":""}`,style:l?{background:l}:void 0,role:"status","aria-live":"polite",children:(0,J.jsxs)("div",{className:"bb-loadingCard",children:[(0,J.jsxs)("div",{className:"bb-loadingHeader",children:[(0,J.jsx)("span",{className:"bb-loadingTitle",title:t??n,children:t??n}),o?(0,J.jsxs)("span",{className:"bb-loadingPercent",children:[u,"%"]}):null]}),(0,J.jsx)("div",{className:`bb-loadingProgress ${o?"":"bb-loadingProgress--unknown"}`,role:"progressbar","aria-label":t??n,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o?u:void 0,children:(0,J.jsx)("div",{className:"bb-loadingProgress__bar",style:o?{width:`${u}%`}:void 0})}),t?(0,J.jsx)("span",{className:"bb-loadingMessage",children:n}):null]})})}var ct=require("react");var ke=require("react"),Ro="200px",kr=new Map;function Br(e,t,n){let r=kr.get(t);if(!r){let s=new Map;r={observer:new IntersectionObserver(o=>{for(let u of o)s.get(u.target)?.(u.isIntersecting)},{rootMargin:t}),watchers:s},kr.set(t,r)}let{observer:i,watchers:a}=r;return a.set(e,n),i.observe(e),()=>{a.delete(e),i.unobserve(e)}}function zr(e){let t=typeof IntersectionObserver<"u",[n,r]=(0,ke.useState)(!t),[i,a]=(0,ke.useState)(!t);return(0,ke.useEffect)(()=>{let s=e.current;if(!s||!t)return;let l=Br(s,Ro,r),o=Br(s,"0px",a);return()=>{l(),o()}},[e,t]),{near:n,visible:i}}var oe=require("react");function Vr(){return typeof navigator>"u"?!1:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}function Do(){if(typeof window>"u"||typeof navigator>"u")return!1;let e=s=>typeof window.matchMedia=="function"&&window.matchMedia(s).matches,t=e("(pointer: coarse)")||e("(any-pointer: coarse)"),n=e("(hover: none)")||e("(any-hover: none)"),r=navigator.maxTouchPoints>0,i=typeof window.screen<"u"&&Math.min(window.screen.width,window.screen.height)<=1024,a=Vr();return t||a||r&&n||r&&i}function Fr(){if(!Do())return!1;if(Vr())return!0;let e=navigator.deviceMemory;return!(typeof e=="number"&&e>=8)}function Io(e,t){let n=new Set,r=i=>{for(let a of i){if(n.size>=t)return;n.add(a.id)}};return r(e.filter(i=>i.wanted).sort((i,a)=>Number(a.visible)-Number(i.visible)||Number(a.live)-Number(i.live)||i.since-a.since)),r(e.filter(i=>!i.wanted&&i.live).sort((i,a)=>a.since-i.since)),n}var No=12,Uo=6,lt=new Map,Oo=1,Vt=!1,Hr;function Gr(){Vt||(Vt=!0,queueMicrotask(()=>{Vt=!1,Hr??(Hr=Fr()?Uo:No);let e=Io([...lt.values()],Hr);for(let t of lt.values()){let n=e.has(t.id);n!==t.live&&(t.live=n,t.onLiveChange(n))}}))}function Wr({managed:e,wanted:t,visible:n,onPark:r}){let[i,a]=(0,oe.useState)(!1),s=(0,oe.useRef)(r);s.current=r;let l=(0,oe.useRef)(null);return(0,oe.useEffect)(()=>{if(!e)return;let o={id:Oo++,wanted:!1,visible:!1,live:!1,since:performance.now(),onLiveChange:u=>{u||s.current?.(),a(u)}};return lt.set(o.id,o),l.current=o,()=>{lt.delete(o.id),l.current=null,a(!1),Gr()}},[e]),(0,oe.useEffect)(()=>{let o=l.current;!o||o.wanted===t&&o.visible===n||(o.wanted!==t&&(o.since=performance.now()),o.wanted=t,o.visible=n,Gr())},[e,t,n]),e?i:t}function jr({loading:e="lazy",reveal:t="auto",rootRef:n,onPark:r}){let{near:i,visible:a}=zr(n),[s,l]=(0,ct.useState)(t==="auto");return(0,ct.useEffect)(()=>{t==="auto"&&l(!0)},[t]),{live:Wr({managed:e==="lazy",wanted:s&&(e==="eager"||i),visible:a,onPark:r}),visible:a,awaitingReveal:!s,reveal:()=>l(!0)}}var qr=require("lucide-react");var me=require("react/jsx-runtime");function Ft({src:e,hidden:t=!1}){return e?(0,me.jsx)("img",{className:`ri-poster${t?" ri-poster--hidden":""}`,src:e,alt:"","aria-hidden":"true",draggable:!1,decoding:"async"}):null}function Xr({className:e,background:t,poster:n,onReveal:r}){let i=Se();return(0,me.jsxs)("div",{className:`${e} ri-viewerPlaceholder`,style:{background:t},children:[(0,me.jsx)(Ft,{src:n}),r?(0,me.jsxs)("button",{type:"button",className:"ri-revealButton",onClick:r,children:[(0,me.jsx)(qr.Box,{size:16,"aria-hidden":"true"}),i("viewIn3D")]}):null]})}var dt=require("@react-three/fiber"),Ht=require("react");var Yr=require("react");function Zr(e){return!!e?.isWebGPURenderer}function Kr({captureRef:e}){let{gl:t,scene:n,camera:r,invalidate:i,get:a}=(0,dt.useThree)();return(0,Ht.useEffect)(()=>{if(!e)return;let s=()=>{let l=a();l.advance(l.frameloop==="never"?l.clock.elapsedTime:performance.now())};return e.current={gl:t,scene:n,camera:r,invalidate:i,drawNow:s},()=>{e.current=null}},[e,t,n,r,i,a]),null}function $r(){let e=(0,dt.useThree)(n=>n.frameloop),t=(0,dt.useThree)(n=>n.invalidate);return(0,Ht.useEffect)(()=>{e!=="never"&&t()},[e,t]),null}function Jr(e){e.dispose(),"forceContextLoss"in e&&!Zr(e)&&(e.forceContextLoss(),e.forceContextLoss=()=>{})}function Qr(e){if(!e)return Promise.resolve(null);try{e.drawNow();let t=e.gl.domElement;return new Promise(n=>{t.toBlob(r=>n(r?URL.createObjectURL(r):null),"image/webp",.85)})}catch{return Promise.resolve(null)}}var Z=require("three");var se=require("three");function ei(e){return!!(e&&typeof e=="object"&&"clone"in e&&"color"in e&&"metalness"in e&&"roughness"in e)}function ti(e){if(ei(e))return e;if(!e||typeof e!="object")return null;let t=e,n=new Z.MeshStandardMaterial;typeof t.name=="string"&&(n.name=t.name),n.metalness=0,n.roughness=1,t.type==="MeshBasicMaterial"||t.isMeshBasicMaterial===!0?(n.color.set(0),n.emissiveIntensity=1,t.map instanceof Z.Texture?(n.emissiveMap=t.map,n.emissive.set(16777215)):t.color instanceof Z.Color&&n.emissive.copy(t.color)):(t.color instanceof Z.Color&&n.color.copy(t.color),t.map instanceof Z.Texture&&(n.map=t.map),t.emissive instanceof Z.Color&&n.emissive.copy(t.emissive),t.emissiveMap instanceof Z.Texture&&(n.emissiveMap=t.emissiveMap));let i=["aoMap","aoMapIntensity","lightMap","lightMapIntensity","alphaMap","opacity","transparent","alphaTest","side","vertexColors","wireframe","depthTest","depthWrite","visible","toneMapped","fog"];for(let a of i)t[a]!==void 0&&(n[a]=t[a]);return n.needsUpdate=!0,n}var Y=require("three");var ni=require("three");function ri(e){return e.isSkinnedMesh===!0}var ko="reactImmersiveSkinFreeze";function ii(e){return e.userData[ko]?.frozenInverse??null}var ai=new WeakMap,oi=new Y.Vector3,Bo=new Y.Vector3,zo=new Y.Vector3,Vo=new Y.Box3,si=new Y.Matrix4;function Ae(e){return"data"in e?e.data.version:e.version}function Fo(e){var o;let{geometry:t,skeleton:n}=e,r=t.getAttribute("position"),i=t.getAttribute("skinIndex"),a=t.getAttribute("skinWeight"),s=ai.get(e);if(s?.geometry===t&&s.position===r&&s.indices===i&&s.weights===a&&s.skeleton===n&&s.bindMatrix.equals(e.bindMatrix)&&s.versions[0]===Ae(r)&&s.versions[1]===Ae(i)&&s.versions[2]===Ae(a)&&s.inverses.length===n.boneInverses.length&&s.inverses.every((u,d)=>u.equals(n.boneInverses[d])))return s;let l={geometry:t,position:r,indices:i,weights:a,skeleton:n,versions:[Ae(r),Ae(i),Ae(a)],bindMatrix:e.bindMatrix.clone(),inverses:n.boneInverses.map(u=>u.clone()),bones:[],weightDeviation:0};e:for(let u=0;u<r.count;u++){oi.fromBufferAttribute(r,u).applyMatrix4(e.bindMatrix);let d=0;for(let _=0;_<4;_++){let p=a.getComponent(u,_);if(p===0)continue;let v=i.getComponent(u,_);if(!Number.isFinite(p)||p<0||!Number.isInteger(v)||!n.bones[v]||!l.inverses[v]){l.bones=null;break e}d+=p,((o=l.bones)[v]??(o[v]=new Y.Box3)).expandByPoint(Bo.copy(oi).applyMatrix4(l.inverses[v]))}let m=Math.abs(d-1);if(m>1e-4){l.bones=null;break}l.weightDeviation=Math.max(l.weightDeviation,m)}return ai.set(e,l),l}function li(e,{precise:t=!1,updateFallbacks:n=!0}={}){e.updateMatrixWorld(!0),e.traverse(r=>{if(!ri(r))return;let i=r;if(!i.skeleton)return;let a=ii(i);a&&i.bindMatrixInverse.copy(a);let l=!!i.geometry.morphAttributes.position?.length?null:Fo(i);if(!t&&!l?.bones&&!n&&i.boundingBox&&i.boundingSphere)return;let o=i.boundingBox??(i.boundingBox=new Y.Box3),u=i.boundingSphere??(i.boundingSphere=new Y.Sphere);if(o.makeEmpty(),t||!l?.bones){let d=i.geometry.getAttribute("position");for(let m=0;m<d.count;m++)o.expandByPoint(i.getVertexPosition(m,zo))}else{for(let d=0;d<l.bones.length;d++){let m=l.bones[d];m&&(si.multiplyMatrices(i.bindMatrixInverse,i.skeleton.bones[d].matrixWorld),o.union(Vo.copy(m).applyMatrix4(si)))}if(!o.isEmpty()){let d=o.min,m=o.max,_=i.bindMatrixInverse.elements,p=Math.max(1,Math.abs(d.x),Math.abs(d.y),Math.abs(d.z),Math.abs(m.x),Math.abs(m.y),Math.abs(m.z)),v=Math.max(Math.abs(d.x-_[12]),Math.abs(m.x-_[12]),Math.abs(d.y-_[13]),Math.abs(m.y-_[13]),Math.abs(d.z-_[14]),Math.abs(m.z-_[14]));o.expandByScalar(l.weightDeviation*v+p*1e-10)}}o.getBoundingSphere(u)})}var Te=require("three"),le=require("three-mesh-bvh");var ci=new WeakMap;function Gt(e){let t=ci.get(e),n=e.index;return t&&t.attribute===n&&t.array===n?.array&&t.version===n?.version?t.source:n?.array??null}function Wt(e,t){let n=e.index;ci.set(e,{source:t,attribute:n,array:n?.array,version:n?.version})}var hi=!1,Ee=new WeakMap,Be=new WeakMap,pi=new WeakMap;function Go(){hi||(Te.Mesh.prototype.raycast=le.acceleratedRaycast,hi=!0)}function Wo(e){let t=new Set;return e.traverse(n=>{let r=n.geometry;!r||!r.attributes?.position||t.add(r)}),[...t]}function fi(e){let t=0;for(let n of e){let r=n.index?n.index.count:n.attributes.position.count;t+=r/3}return t}var ut=12e6;function mi(e){return ht(e)>ut}function ht(e){let t=new Set;return e.traverse(n=>{let r=n.geometry;r?.attributes?.position&&t.add(r)}),fi([...t])}function jo(e,t){let n=Gt(t);return new Promise((r,i)=>{let a=d=>{let m=d.data;if(!m||!m.error&&!m.serialized)return;if(e.removeEventListener("message",a),e.removeEventListener("error",s),m.error){i(new Error(String(m.error)));return}let{serialized:_}=m,p=le.MeshBVH.deserialize(_,t,{setIndex:!1});_.index&&(t.index?t.index.array=_.index:t.setIndex(new Te.BufferAttribute(_.index,1,!1))),Wt(t,n),t.boundingBox=p.getBoundingBox(new Te.Box3),r(p)},s=d=>{e.removeEventListener("message",a),e.removeEventListener("error",s),i(new Error(d.message||"BVH worker error"))};e.addEventListener("message",a),e.addEventListener("error",s);let l=t.index?t.index.array.slice():null,o=t.attributes.position.array.slice(),u=[o,...l?[l]:[]].map(d=>d.buffer);e.postMessage({index:l,position:o,options:{groups:[...t.groups]}},u)})}async function qo(){if(typeof window>"u"||typeof Worker>"u")return null;try{let{bvhWorkerCode:e}=await Promise.resolve().then(()=>(ui(),di)),t=new Blob([e],{type:"text/javascript"}),n=URL.createObjectURL(t),r=new Worker(n);return{worker:r,dispose:()=>{r.terminate(),URL.revokeObjectURL(n)}}}catch{return null}}async function Xo(e,t){if(t)try{return await jo(t,e)}catch{}let n=Gt(e)?.slice()??null,r=le.computeBoundsTree.call(e);return Wt(e,n),e.boundsTree=void 0,await new Promise(i=>setTimeout(i,0)),r}async function Yo(e,t,n){if(e.boundsTree)return;if(t.buildPromise)return t.buildPromise;let r=(async()=>{let i=await n();t.references>0&&!e.boundsTree&&(e.boundsTree=i,t.ownedTree=i)})();return t.buildPromise=r.finally(()=>{t.buildPromise=void 0,t.references===0&&Ee.delete(e)}),t.buildPromise}function gi(e,t){let n=Zo(e,t);return pi.set(e,n),n}async function Zo(e,t){if(t?.aborted)return;let n=Be.get(e);if(!n){if(n=Wo(e),fi(n)>ut){Be.set(e,[]);return}Be.set(e,n);for(let i of n){let a=Ee.get(i)??{references:0};a.references+=1,Ee.set(i,a)}}if(n.length===0)return;Go();let r=await qo();if(t?.aborted){r?.dispose();return}try{for(let i of n){if(t?.aborted)return;let a=Ee.get(i);a&&await Yo(i,a,()=>Xo(i,r?.worker))}}finally{r?.dispose()}}function vi(e){pi.delete(e);let t=Be.get(e);if(t){Be.delete(e);for(let n of t){let r=Ee.get(n);r&&(r.references=Math.max(0,r.references-1),!(r.references>0)&&(r.ownedTree&&n.boundsTree===r.ownedTree&&(le.disposeBoundsTree.call(n),n.boundsTree=void 0),r.ownedTree=void 0,r.buildPromise||Ee.delete(n)))}}}var A=require("three"),na=require("three-stdlib");var D=require("lucide-react");var Q=require("react"),G=require("three"),yi=require("@react-three/fiber");var Ko="riEditorGizmo";function _i(e){return e.userData[Ko]=!0,e}function xi(e){return!Number.isFinite(e)||e<=0?1:10**Math.floor(Math.log10(e/10))}var jt=require("react/jsx-runtime"),$o=`
|
|
3665
3665
|
varying vec3 vWorld;
|
|
3666
3666
|
void main() {
|
|
3667
3667
|
vec4 world = modelMatrix * vec4(position, 1.0);
|
|
3668
3668
|
vWorld = world.xyz;
|
|
3669
3669
|
gl_Position = projectionMatrix * viewMatrix * world;
|
|
3670
3670
|
}
|
|
3671
|
-
`,
|
|
3671
|
+
`,Jo=`
|
|
3672
3672
|
uniform float uCell;
|
|
3673
3673
|
uniform float uMajor;
|
|
3674
3674
|
uniform float uFade;
|
|
@@ -3707,6 +3707,6 @@ void main() {
|
|
|
3707
3707
|
gl_FragColor = vec4(color, uLinearTarget ? pow(alpha, 2.2) : alpha);
|
|
3708
3708
|
#include <colorspace_fragment>
|
|
3709
3709
|
}
|
|
3710
|
-
|
|
3710
|
+
`,Qo=()=>{};function bi({getTarget:e,revision:t,lineColor:n}){let r=(0,yi.useThree)(d=>d.invalidate),[i,a]=(0,Q.useState)({y:0,size:10}),s=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{s.current&&_i(s.current)},[]),(0,Q.useEffect)(()=>{let d=e();if(!d)return;let m=d instanceof G.Box3?d:new G.Box3().setFromObject(d);if(m.isEmpty())return;let _=m.getSize(new G.Vector3);a({y:m.min.y,size:Math.max(_.x,_.y,_.z)}),r()},[e,t,r]);let l=(0,Q.useMemo)(()=>new G.ShaderMaterial({vertexShader:$o,fragmentShader:Jo,transparent:!0,depthWrite:!1,side:G.DoubleSide,uniforms:{uCell:{value:1},uMajor:{value:5},uFade:{value:100},uLinearTarget:{value:!1},uLine:{value:new G.Color},uAxisX:{value:new G.Color("#e5484d")},uAxisZ:{value:new G.Color("#3e8bff")}}}),[]);(0,Q.useEffect)(()=>()=>l.dispose(),[l]);let o=xi(i.size);l.uniforms.uCell.value=o,l.uniforms.uMajor.value=o*5,l.uniforms.uFade.value=i.size*12,l.uniforms.uLine.value.set(n);let u=i.size*40;return(0,jt.jsx)("mesh",{ref:s,rotation:[-Math.PI/2,0,0],position:[0,i.y-i.size*5e-4,0],raycast:Qo,renderOrder:-1,frustumCulled:!1,material:l,onBeforeRender:d=>{let m=d.getRenderTarget()!==null;l.uniforms.uLinearTarget.value!==m&&(l.uniforms.uLinearTarget.value=m,l.uniformsNeedUpdate=!0)},children:(0,jt.jsx)("planeGeometry",{args:[u,u]})})}var ce=require("@react-three/fiber"),Mi=require("@react-three/drei"),wi=require("three"),ve=require("react"),ge=require("react/jsx-runtime");function Si(e){let t=(0,ce.useThree)(r=>r.gl),n=(0,ve.useRef)(t.autoClear);return(0,ce.useFrame)(()=>{n.current=t.autoClear,t.autoClear=!0},-1),(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsx)(Mi.ContactShadows,{...e}),(0,ge.jsx)(es,{saved:n})]})}function es({saved:e}){let t=(0,ce.useThree)(n=>n.gl);return(0,ce.useFrame)(()=>{t.autoClear=e.current}),null}function Ai(){let e=(0,ce.useThree)(t=>t.invalidate);return(0,ve.useEffect)(()=>{e()},[e]),null}function Ei({rotation:e}){let{scene:t,invalidate:n}=(0,ce.useThree)();return(0,ve.useLayoutEffect)(()=>{let r=e*Math.PI/180;t.environmentRotation.set(0,r,0),t.backgroundRotation.set(0,r,0)}),(0,ve.useEffect)(()=>{n()},[e,n]),null}var _e=require("react"),Ti=require("@react-three/fiber");function Ci(){let e=(0,Ti.useThree)(i=>i.gl.domElement),t=(0,_e.useRef)(void 0),n=(0,_e.useCallback)(i=>{t.current===void 0&&(t.current=e.style.cursor),e.style.cursor=i},[e]),r=(0,_e.useCallback)(()=>{let i=t.current;i!==void 0&&(e.style.cursor=i,t.current=void 0)},[e]);return(0,_e.useEffect)(()=>()=>{r()},[r]),{setCanvasCursor:n,restoreCanvasCursor:r}}var Li=require("react"),ts={"model-viewer":"@liveroom-tech/react-immersive/styles.css","simple-model-viewer":"@liveroom-tech/react-immersive/simple-model-viewer.css","binding-builder":"@liveroom-tech/react-immersive/binding-builder.css"},qt=new Set,ns=1e3;function Pi(e){return getComputedStyle(document.documentElement).getPropertyValue(`--ri-styles-${e}`).trim()!==""}function Ri(e,t){(0,Li.useEffect)(()=>{if(process.env.NODE_ENV==="production"||qt.has(e)||Pi(e))return;let n,r=()=>{n=setTimeout(()=>{qt.has(e)||Pi(e)||(qt.add(e),console.warn(`[react-immersive] ${t}'s styles aren't loaded, so it renders unstyled. Import them once, in your app's root:
|
|
3711
3711
|
|
|
3712
|
-
import "${Qo[e]}";`))},es)};return document.readyState==="complete"?(r(),()=>clearTimeout(n)):(window.addEventListener("load",r,{once:!0}),()=>{window.removeEventListener("load",r),clearTimeout(n)})},[e,t])}var pt=require("react"),Xt=80,ts=99,ns=6e3,rs=200;function is(e,t=0){let n=Math.min(Math.max(e,0),100);return n<100?n/100*Xt:Xt+(ts-Xt)*(1-Math.exp(-t/ns))}function Li(e,t=!1){let n=e!==null&&e>=100&&!t,[r,i]=(0,pt.useState)(0);return(0,pt.useEffect)(()=>{if(!n){i(0);return}let a=performance.now(),s=setInterval(()=>i(performance.now()-a),rs);return()=>clearInterval(s)},[n]),e===null?null:t?100:is(e,r)}var Di=require("react"),Yt=require("@react-three/fiber");function Ri(e,t,{zoom:n,pageScroll:r},i){if(!n)return{wheel:t.NONE,middle:t.NONE,two:t.TOUCH_TRUCK};let a=r&&!i?t.NONE:e.wheel;return{...e,wheel:a}}function as({pageScroll:e}){return e?"pan-y":null}function Ii({controlsRef:e,zoom:t=!0,pageScroll:n=!1}){let r=(0,Yt.useThree)(s=>s.gl.domElement),a=(0,Yt.useThree)(s=>s.events.connected)??r;return(0,Di.useEffect)(()=>{let s=e&&typeof e=="object"?e.current:null,l=s?.constructor.ACTION;if(!s||!l||!a||t&&!n)return;let o={zoom:t,pageScroll:n},d={wheel:s.mouseButtons.wheel,middle:s.mouseButtons.middle,two:s.touches.two},u=x=>{s.mouseButtons.wheel=x.wheel,s.mouseButtons.middle=x.middle,s.touches.two=x.two};u(Ri(d,l,o));let p=x=>{u(Ri(d,l,o,x.ctrlKey||x.metaKey))};a.addEventListener("wheel",p,{capture:!0,passive:!0});let v=as(o),g=[...new Set([r,a])],m=g.map(x=>[x,x.style.touchAction]),b=null;if(v){let x=()=>{if(s.enabled)for(let y of g)y.style.touchAction!==v&&(y.style.touchAction=v)};x(),b=new MutationObserver(x);for(let y of g)b.observe(y,{attributes:!0,attributeFilter:["style"]})}return()=>{if(a.removeEventListener("wheel",p,{capture:!0}),b?.disconnect(),v)for(let[x,y]of m)x.style.touchAction=y;u(d)}},[e,r,a,t,n]),null}var R=require("three"),mt="neutral",os=[{direction:[.62,.48,.62],size:[.38,.28],radiance:9},{direction:[-.75,.2,.55],size:[.32,.36],radiance:3.5},{direction:[0,1,0],size:[.55,.55],radiance:4},{direction:[.15,.3,-1],size:[.45,.16],radiance:5}],ft=(e,t,n)=>{let r=Math.min(Math.max((n-e)/(t-e),0),1);return r*r*(3-2*r)},ss=os.map(e=>{let t=new R.Vector3(...e.direction).normalize(),n=Math.abs(t.y)>.9?new R.Vector3(0,0,1):new R.Vector3(0,1,0),r=new R.Vector3().crossVectors(n,t).normalize(),i=new R.Vector3().crossVectors(t,r).normalize();return{center:t,right:r,up:i,box:e}}),ls=.9;function cs(e){let t=e.y,n=.2+.18*ft(-.35,.05,t)+.17*ft(0,.9,t);for(let{center:r,right:i,up:a,box:s}of ss){let l=e.dot(r);if(l<=0)continue;let o=Math.abs(e.dot(i)/l)/s.size[0],d=Math.abs(e.dot(a)/l)/s.size[1],u=(1-ft(.82,1,o))*(1-ft(.82,1,d));n+=s.radiance*u}return n*ls}var Zt=null;function Ni(){if(Zt)return Zt;let e=512,t=256,n=new Uint16Array(e*t*4),r=new R.Vector3;for(let a=0;a<t;a++){let s=((a+.5)/t-.5)*Math.PI;for(let l=0;l<e;l++){let o=((l+.5)/e-.5)*2*Math.PI;r.set(Math.cos(s)*Math.cos(o),Math.sin(s),Math.cos(s)*Math.sin(o));let d=R.DataUtils.toHalfFloat(cs(r)),u=(a*e+l)*4;n[u]=d,n[u+1]=d,n[u+2]=d,n[u+3]=R.DataUtils.toHalfFloat(1)}}let i=new R.DataTexture(n,e,t,R.RGBAFormat,R.HalfFloatType);return i.mapping=R.EquirectangularReflectionMapping,i.colorSpace=R.LinearSRGBColorSpace,i.magFilter=R.LinearFilter,i.minFilter=R.LinearFilter,i.generateMipmaps=!1,i.needsUpdate=!0,Zt=i,i}var vt=require("react"),Kt=require("@react-three/fiber");var gt=require("react/jsx-runtime"),Vi=(0,vt.lazy)(()=>Promise.resolve().then(()=>(zi(),ki)));function Fi({preset:e,files:t,...n}){return!t&&e===mt?(0,gt.jsx)(ds,{...n}):t?(0,gt.jsx)(Vi,{files:t,...n}):(0,gt.jsx)(Vi,{preset:e,...n})}function ds({background:e=!1,environmentIntensity:t=1,backgroundIntensity:n=1,backgroundBlurriness:r=0}){let i=(0,Kt.useThree)(s=>s.scene),a=(0,Kt.useThree)(s=>s.invalidate);return(0,vt.useLayoutEffect)(()=>{let s=Ni(),l={environment:i.environment,environmentIntensity:i.environmentIntensity,background:i.background,backgroundIntensity:i.backgroundIntensity,backgroundBlurriness:i.backgroundBlurriness};return i.environment=s,i.environmentIntensity=t,e&&(i.background=s,i.backgroundIntensity=n,i.backgroundBlurriness=r),a(),()=>{Object.assign(i,l),a()}},[i,a,e,t,n,r]),null}var re=require("three"),Hi=.1;function us(e,t){if(!t||e.isEmpty())return e.clone();let n=e.getCenter(new re.Vector3),r=e.getSize(new re.Vector3),i=Math.hypot(r.x,r.z)/2;return new re.Box3(new re.Vector3(n.x-i,e.min.y,n.z-i),new re.Vector3(n.x+i,e.max.y,n.z+i))}function hs(e,t){let n=e.getSize(new re.Vector3),r=Math.max(n.x,n.y,n.z),i=Number.isFinite(r)?r*Math.max(0,t):0;return{paddingTop:i,paddingBottom:i,paddingLeft:i,paddingRight:i}}function _t(e,t,{fitPadding:n,spinning:r},i){let a=new re.Box3().setFromObject(t);return e.fitToBox(us(a,r),i,hs(a,n))}var C=require("react"),Gi=require("react-dom"),Wi=require("lucide-react"),W=require("react/jsx-runtime"),ps=(0,C.createContext)(null);function ji({value:e,onChange:t,children:n,className:r,id:i,disabled:a=!1,title:s,"aria-label":l}){let o=(0,C.useContext)(ps),d=$t(n),u=d.filter(f=>f.kind==="option"),p=u.find(f=>f.value===e),[v,g]=(0,C.useState)(!1),[m,b]=(0,C.useState)(-1),[x,y]=(0,C.useState)({}),S=(0,C.useRef)(null),U=(0,C.useRef)(null),P=(0,C.useId)(),N=(0,C.useCallback)(f=>{g(!1),f&&S.current?.focus()},[]),k=f=>{f.disabled||(N(!0),f.value!==e&&t?.({target:{value:f.value},currentTarget:{value:f.value}}))},j=()=>{a||(b(Math.max(0,u.findIndex(f=>f.value===e))),g(!0))};(0,C.useLayoutEffect)(()=>{if(!v||!S.current)return;let f=S.current.getBoundingClientRect(),w=window.innerHeight-f.bottom-8,I=f.top-8,O=w<180&&I>w;y({left:f.left,minWidth:f.width,maxHeight:Math.min(320,O?I:w)-4,...O?{bottom:window.innerHeight-f.top+4}:{top:f.bottom+4}})},[v]),(0,C.useEffect)(()=>{if(!v)return;let f=O=>{let L=O.target;U.current?.contains(L)||S.current?.contains(L)||N(!1)},w=O=>O.preventDefault(),I=U.current;return I?.addEventListener("beforexrselect",w),window.addEventListener("pointerdown",f,!0),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{I?.removeEventListener("beforexrselect",w),window.removeEventListener("pointerdown",f,!0),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[v,N]),(0,C.useEffect)(()=>{v&&U.current?.querySelector(`[data-index="${m}"]`)?.scrollIntoView({block:"nearest"})},[v,m]);let q=(f,w)=>{for(let I=f+w;I>=0&&I<u.length;I+=w)if(!u[I].disabled)return I;return f},X=f=>{if(!a){if(!v){["ArrowDown","ArrowUp","Enter"," "].includes(f.key)&&(f.preventDefault(),j());return}if(f.key==="ArrowDown")b(w=>q(w,1));else if(f.key==="ArrowUp")b(w=>q(w,-1));else if(f.key==="Home")b(q(-1,1));else if(f.key==="End")b(q(u.length,-1));else if(f.key==="Enter"||f.key===" ")u[m]&&k(u[m]);else if(f.key==="Escape")N(!0);else if(f.key==="Tab"){N(!1);return}else return;f.preventDefault()}},ae=o??S.current?.closest(".bb-dialogBackdrop, .ri-viewer, .smv-root, .bb-root")??(typeof document<"u"?document.body:null),M=-1;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("button",{ref:S,type:"button",id:i,className:`ri-select ${r??""}`,disabled:a,title:s,"aria-label":l,"aria-haspopup":"listbox","aria-expanded":v,"aria-controls":v?P:void 0,"aria-activedescendant":v&&m>=0?`${P}-${m}`:void 0,onClick:()=>v?N(!1):j(),onKeyDown:X,children:(0,W.jsx)("span",{className:"ri-selectValue",children:p?.label??""})}),v&&ae?(0,Gi.createPortal)((0,W.jsx)("div",{ref:U,id:P,className:"ri-selectMenu",role:"listbox","aria-label":l,style:x,children:d.map((f,w)=>{if(f.kind==="group")return(0,W.jsx)("div",{className:"ri-selectGroup",role:"presentation",children:f.label},`group-${w}`);M+=1;let I=M,O=f.value===e;return(0,W.jsxs)("div",{id:`${P}-${I}`,"data-index":I,role:"option","aria-selected":O,"aria-disabled":f.disabled||void 0,className:`ri-selectOption ${I===m?"ri-selectOption--active":""}`,onPointerEnter:()=>!f.disabled&&b(I),onClick:()=>k(f),children:[(0,W.jsx)("span",{className:"ri-selectCheck",children:O?(0,W.jsx)(Wi.Check,{size:13,"aria-hidden":"true"}):null}),(0,W.jsx)("span",{className:"ri-selectLabel",children:f.label})]},`${f.value}-${w}`)})}),ae):null]})}function $t(e,t=[]){return C.Children.forEach(e,n=>{if(!(0,C.isValidElement)(n))return;let r=n;if(r.type===C.Fragment)$t(r.props.children,t);else if(r.type==="optgroup")t.push({kind:"group",label:String(r.props.label??"")}),$t(r.props.children,t);else if(r.type==="option"){let i=Jt(r.props.children);t.push({kind:"option",value:r.props.value===void 0?i:String(r.props.value),label:i,disabled:!!r.props.disabled})}}),t}function Jt(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(Jt).join(""):(0,C.isValidElement)(e)?Jt(e.props.children):""}var c=require("react/jsx-runtime"),qi={color:"#93c5fd",intensity:.05},Xi=["neutral","apartment","city","dawn","forest","lobby","night","park","studio","sunset","warehouse"],ta={aces:A.ACESFilmicToneMapping,agx:A.AgXToneMapping,neutral:A.NeutralToneMapping,none:A.NoToneMapping};function Qt(e){return!!(e&&"isMesh"in e&&e.isMesh)}function Yi(e,t){Array.isArray(e)?e.forEach(t):t(e)}function Zi(e,t,n){if(!t)return;let r=t.camera;if(!(r instanceof A.PerspectiveCamera))return;let i=new A.Box3().setFromObject(e).getSize(new A.Vector3).length();if(!Number.isFinite(i)||i<=0)return;r.near=i/100,r.far=i*100,r.updateProjectionMatrix();let a=tr(n);t.minDistance=n?.minDistance??i*.05,t.maxDistance=n?.maxDistance??i*10,t.minPolarAngle=a.minPolarAngle,t.maxPolarAngle=a.maxPolarAngle,t.minAzimuthAngle=a.minAzimuthAngle,t.maxAzimuthAngle=a.maxAzimuthAngle,t.boundaryEnclosesCamera=a.boundaryEnclosesCamera,t.boundaryFriction=a.boundaryFriction,t.setBoundary(a.panBoundary?new A.Box3(new A.Vector3(...a.panBoundary[0]),new A.Vector3(...a.panBoundary[1])):void 0)}var Mt=class extends h.Component{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){this.props.onLoadError?.(n)}render(){return this.state.hasError?null:this.props.children}};function fs({url:e,format:t,dracoDecoderPath:n,ktx2TranscoderPath:r,meshopt:i,hiddenKeys:a,selectedKey:s,panelHoveredKey:l,nodeRefsOut:o,onMeshesReady:d,onModelLoaded:u,onLoadProgress:p,onMeshClick:v,highlightOnHover:g}){let{scene:m}=Pr(e,{dracoDecoderPath:n,ktx2TranscoderPath:r,meshopt:i},t,p),b=(0,$.useThree)(M=>M.invalidate),{setCanvasCursor:x,restoreCanvasCursor:y}=Ei(),[S,U]=(0,h.useState)(null),P=(0,h.useMemo)(()=>ea.SkeletonUtils.clone(m),[m]),N=(0,h.useMemo)(()=>{let M={};return P.traverse(f=>{if(!Qt(f))return;let w=f.name||f.uuid;M[w]={key:w,label:f.name||f.type,ref:f}}),M},[P]),k=(0,h.useMemo)(()=>{let M={};for(let[f,{ref:w}]of Object.entries(N)){let O=(Array.isArray(w.material)?w.material:[w.material]).map(L=>{let V=(Qr(L)??new A.MeshStandardMaterial).clone();return V.userData.baseColor=V.color.clone(),V.userData.baseMap=V.map,V.userData.baseEmissive=V.emissive.clone(),V.userData.baseEmissiveMap=V.emissiveMap,V.userData.baseEmissiveIntensity=V.emissiveIntensity,V});M[f]=Array.isArray(w.material)?O:O[0]}return M},[N]);(0,h.useEffect)(()=>()=>{Object.values(k).forEach(M=>Yi(M,f=>f.dispose()))},[k]);let j=(0,h.useRef)(null);(0,h.useEffect)(()=>{j.current!==e&&(j.current=e,P.updateWorldMatrix(!0,!0),oi(P),d(N),u(P))},[e,P,N,d,u]),(0,h.useEffect)(()=>{let M=new AbortController;return fi(P,M.signal),()=>{M.abort(),mi(P)}},[P]);let q=(0,h.useMemo)(()=>!pi(P),[P]);(0,h.useEffect)(()=>{for(let[M,{ref:f}]of Object.entries(N))o.current[M]=f},[N,o]),(0,h.useEffect)(()=>{!g&&S!==null&&(U(null),y())},[g,S,y]),(0,h.useEffect)(()=>{for(let[M,{ref:f}]of Object.entries(N)){f.visible=!a.has(M);let w=k[M];if(!w)continue;f.material=w;let I=g&&S===M,O=g&&l===M;Yi(w,L=>{if(L.color.copy(L.userData.baseColor),L.map=L.userData.baseMap??null,L.emissive.copy(L.userData.baseEmissive),L.emissiveMap=L.userData.baseEmissiveMap??null,L.emissiveIntensity=L.userData.baseEmissiveIntensity,O||I){let Pe=!!L.userData.baseEmissiveMap;L.emissive.set(qi.color),L.emissiveIntensity=Pe?L.userData.baseEmissiveIntensity:qi.intensity}L.needsUpdate=!0})}b()},[N,k,S,s,l,g,a,b]);let X=M=>{if(!Nn(M))return null;let f=M;for(;f;){let w=f.name||f.uuid;if(N[w])return w;f=f.parent}return null},ae=q?{onClick:M=>{let f=X(M.object);f&&(M.stopPropagation(),v(f))},...g?{onPointerOver:M=>{let f=X(M.object);f&&(M.stopPropagation(),x("pointer"),U(f))},onPointerOut:M=>{M.stopPropagation(),y(),U(null)}}:{}}:{};return(0,c.jsx)("primitive",{object:P,...ae})}function ms({scene:e,controlsRef:t,refitOnResize:n,onInitialFitComplete:r,resumeViewRef:i,cameraLimits:a,framing:s}){let l=(0,h.useRef)(s);l.current=s;let o=(0,h.useRef)(a);o.current=a;let d=JSON.stringify(a??null);(0,h.useEffect)(()=>{e&&Zi(e,t.current,o.current)},[e,t,d]);let u=(0,h.useRef)(!1),p=(0,$.useThree)(m=>m.invalidate),v=(0,$.useThree)(m=>m.size),g=(0,h.useRef)(null);return(0,h.useEffect)(()=>{u.current=!1,p()},[p,e]),(0,$.useFrame)(()=>{if(u.current)return;if(!e||!t.current){p();return}u.current=!0,Zi(e,t.current,a);let m=i.current;if(m){i.current=null,t.current.setLookAt(...m.position,...m.target,!1).catch(()=>{}).finally(r),p();return}_t(t.current,e,l.current,!1).catch(()=>{}).finally(r),p()}),(0,h.useEffect)(()=>{if(!(!n||!u.current||!e||!t.current))return g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{let m=t.current;m&&_t(m,e,l.current,!0).catch(()=>{}),p()},150),()=>{g.current&&clearTimeout(g.current)}},[v.width,v.height,n]),null}function gs({scene:e,exposure:t,toneMapping:n,fov:r,wireframe:i}){let a=(0,$.useThree)(o=>o.gl),s=(0,$.useThree)(o=>o.camera),l=(0,$.useThree)(o=>o.invalidate);return(0,h.useEffect)(()=>{a.toneMappingExposure=t,l()},[a,t,l]),(0,h.useEffect)(()=>{s instanceof A.PerspectiveCamera&&(s.fov=r,s.updateProjectionMatrix(),l())},[s,r,l]),(0,h.useEffect)(()=>{a.toneMapping=ta[n],e?.traverse(o=>{if(Qt(o))for(let d of[o.material].flat())d.wireframe=i,d.needsUpdate=!0}),l()},[a,e,n,i,l]),null}function vs({enabled:e,speed:t,controlsRef:n}){let r=(0,$.useThree)(i=>i.invalidate);return(0,$.useFrame)((i,a)=>{!e||!n.current||(n.current.rotate(a*.2*t,0,!1),r())}),null}function xt(e){return Array.from(e.types).includes("Files")}function ze({label:e,checked:t,onChange:n}){return(0,c.jsxs)("div",{className:"ri-env-row",children:[(0,c.jsx)("span",{className:"ri-env-row__label",title:e,children:e}),(0,c.jsx)("div",{className:"ri-env-row__value",children:(0,c.jsx)("button",{type:"button",className:"ri-env-checkbox-btn",role:"checkbox","aria-checked":t,"aria-label":e,onClick:()=>n(!t),children:(0,c.jsx)("span",{className:`ri-env-checkbox${t?" ri-env-checkbox--checked":""}`,children:t&&(0,c.jsx)(D.Check,{size:10,strokeWidth:2.5,"aria-hidden":"true"})})})})]})}function yt({label:e,value:t,onChange:n}){return(0,c.jsxs)("div",{className:"ri-env-row",children:[(0,c.jsx)("span",{className:"ri-env-row__label",title:e,children:e}),(0,c.jsx)("div",{className:"ri-env-row__value",children:(0,c.jsxs)("label",{className:"ri-env-color-swatch",children:[(0,c.jsx)("span",{className:"ri-env-color-swatch__chip",style:{background:t}}),(0,c.jsx)("span",{className:"ri-env-color-swatch__hex",children:t}),(0,c.jsx)("input",{type:"color",className:"ri-env-color-swatch__input","aria-label":e,value:t,onChange:r=>n(r.target.value)})]})})]})}function ie({label:e,value:t,min:n,max:r,step:i,format:a=l=>l.toFixed(2),onChange:s}){return(0,c.jsxs)("div",{className:"ri-env-row",children:[(0,c.jsx)("span",{className:"ri-env-row__label",title:e,children:e}),(0,c.jsxs)("div",{className:"ri-env-row__value ri-env-row__value--slider",children:[(0,c.jsx)("input",{type:"range",className:"ri-env-slider","aria-label":e,min:n,max:r,step:i,value:t,onChange:l=>s(Number(l.target.value))}),(0,c.jsx)("span",{className:"ri-env-slider__value",children:a(t)})]})]})}function Ki({label:e,optionLabels:t,value:n,options:r,onChange:i}){return(0,c.jsxs)("div",{className:"ri-env-row",children:[(0,c.jsx)("span",{className:"ri-env-row__label",title:e,children:e}),(0,c.jsx)("div",{className:"ri-env-row__value",children:(0,c.jsx)(ji,{className:"ri-env-select","aria-label":e,value:n,onChange:a=>i(a.target.value),children:r.map(a=>(0,c.jsx)("option",{value:a,children:t?.[a]??a},a))})})]})}function bt({label:e,value:t}){return(0,c.jsxs)("div",{className:"ri-env-row",children:[(0,c.jsx)("span",{className:"ri-env-row__label",title:e,children:e}),(0,c.jsx)("span",{className:"ri-env-row__info",children:t})]})}var $i=e=>`${Math.round(e)}\xB0`;function Ce({title:e,children:t}){let[n,r]=(0,h.useState)(!1);return(0,c.jsxs)("div",{className:"ri-env-section",children:[(0,c.jsxs)("button",{type:"button",className:"ri-env-section__header","aria-expanded":!n,onClick:()=>r(i=>!i),children:[(0,c.jsx)(D.ChevronDown,{size:12,strokeWidth:2,className:`ri-env-section__chevron${n?" env-section__chevron--collapsed":""}`}),(0,c.jsx)("span",{children:e})]}),!n&&(0,c.jsx)("div",{className:"ri-env-section__body",children:t})]})}function _s({isOpen:e,onToggle:t,settings:n,modelInfo:r,onChange:i,onReset:a,environmentEnabled:s,environmentUrl:l}){let o=Se();return(0,c.jsxs)("div",{className:`ri-left-panel-wrapper ${e?"ri-left-panel-wrapper--open":"ri-left-panel-wrapper--closed"}`,children:[!e&&(0,c.jsx)("button",{className:"ri-side-panel__open-btn ri-side-panel__open-btn--left",onClick:()=>t(!0),children:(0,c.jsx)(D.Settings,{size:20,strokeWidth:1.8})}),(0,c.jsxs)("div",{className:`ri-side-panel ri-side-panel--left ${e?"ri-side-panel--open-left":"ri-side-panel--closed-left"}`,"aria-hidden":!e,children:[(0,c.jsx)("div",{className:"ri-side-panel__header",children:(0,c.jsxs)("div",{className:"ri-side-panel__header-top",children:[(0,c.jsx)("span",{className:"ri-side-panel__eyebrow",children:o("sceneSettings")}),(0,c.jsx)("button",{className:"ri-side-panel__close-btn",onClick:()=>t(!1),title:o("close"),children:(0,c.jsx)(D.X,{size:12,strokeWidth:1.6})})]})}),(0,c.jsxs)("div",{className:"ri-env-controls",children:[s&&(0,c.jsxs)(Ce,{title:o("environment"),children:[!l&&(0,c.jsx)(Ki,{label:o("environmentPreset"),value:n.envPreset,options:Xi,optionLabels:Object.fromEntries(Xi.map(d=>[d,o(`environment${d[0].toUpperCase()}${d.slice(1)}`)])),onChange:d=>i("envPreset",d)}),(0,c.jsx)(ie,{label:o("environmentIntensity"),value:n.envIntensity,min:0,max:3,step:.05,onChange:d=>i("envIntensity",d)}),(0,c.jsx)(ie,{label:o("rotation"),value:n.envRotation,min:0,max:360,step:1,format:$i,onChange:d=>i("envRotation",d)}),(0,c.jsx)(ze,{label:o("showEnvironmentAsBackground"),checked:n.backgroundEnabled,onChange:d=>i("backgroundEnabled",d)}),n.backgroundEnabled?(0,c.jsx)(ie,{label:o("backgroundBlur"),value:n.backgroundBlur,min:0,max:1,step:.01,onChange:d=>i("backgroundBlur",d)}):(0,c.jsx)(yt,{label:o("backgroundColor"),value:n.backgroundColor,onChange:d=>i("backgroundColor",d)})]}),!s&&(0,c.jsx)(Ce,{title:o("background"),children:(0,c.jsx)(yt,{label:o("backgroundColor"),value:n.backgroundColor,onChange:d=>i("backgroundColor",d)})}),(0,c.jsxs)(Ce,{title:o("lighting"),children:[(0,c.jsx)(ie,{label:o("exposure"),value:n.exposure,min:0,max:2,step:.05,onChange:d=>i("exposure",d)}),(0,c.jsx)(Ki,{label:o("toneMapping"),value:n.toneMapping,options:Object.keys(ta),optionLabels:{aces:o("toneMappingAces"),agx:o("toneMappingAgx"),neutral:o("toneMappingNeutral"),none:o("toneMappingNone")},onChange:d=>i("toneMapping",d)}),(0,c.jsx)(ie,{label:o("ambientLightIntensity"),value:n.ambientIntensity,min:0,max:3,step:.05,onChange:d=>i("ambientIntensity",d)}),(0,c.jsx)(yt,{label:o("ambientLightColor"),value:n.ambientColor,onChange:d=>i("ambientColor",d)}),(0,c.jsx)(ie,{label:o("directLightIntensity"),value:n.directionalIntensity,min:0,max:5,step:.05,onChange:d=>i("directionalIntensity",d)}),(0,c.jsx)(yt,{label:o("directLightColor"),value:n.directionalColor,onChange:d=>i("directionalColor",d)})]}),(0,c.jsxs)(Ce,{title:o("ground"),children:[(0,c.jsx)(ze,{label:o("groundShadow"),checked:n.groundShadow,onChange:d=>i("groundShadow",d)}),n.groundShadow&&(0,c.jsx)(ie,{label:o("groundShadowOpacity"),value:n.groundShadowOpacity,min:0,max:1,step:.01,onChange:d=>i("groundShadowOpacity",d)}),(0,c.jsx)(ze,{label:o("floorGrid"),checked:n.showFloorGrid,onChange:d=>i("showFloorGrid",d)})]}),(0,c.jsxs)(Ce,{title:o("display"),children:[(0,c.jsx)(ze,{label:o("wireframe"),checked:n.wireframe,onChange:d=>i("wireframe",d)}),(0,c.jsx)(ze,{label:o("autoRotate"),checked:n.autoRotate,onChange:d=>i("autoRotate",d)}),n.autoRotate&&(0,c.jsx)(ie,{label:o("autoRotateSpeed"),value:n.autoRotateSpeed,min:.1,max:5,step:.1,onChange:d=>i("autoRotateSpeed",d)}),(0,c.jsx)(ie,{label:o("fieldOfView"),value:n.fov,min:15,max:90,step:1,format:$i,onChange:d=>i("fov",d)})]}),r&&(0,c.jsxs)(Ce,{title:o("modelInfo"),children:[(0,c.jsx)(bt,{label:o("modelInfoObjects"),value:r.objects.toLocaleString()}),(0,c.jsx)(bt,{label:o("modelInfoTriangles"),value:r.triangles.toLocaleString()}),(0,c.jsx)(bt,{label:o("modelInfoMaterials"),value:r.materials.toLocaleString()}),(0,c.jsx)(bt,{label:o("size"),value:r.size})]}),(0,c.jsx)("div",{className:"ri-env-footer",children:(0,c.jsxs)("button",{type:"button",className:"ri-env-reset",onClick:a,children:[(0,c.jsx)(D.RotateCcw,{size:12,"aria-hidden":"true"}),o("resetSettings")]})})]})]})]})}function xs(e){let t=0,n=new Set;e.traverse(i=>{if(Qt(i)){t+=1;for(let a of[i.material].flat())n.add(a.name||a.uuid)}});let r=new A.Box3().setFromObject(e).getSize(new A.Vector3);return{objects:t,triangles:ht(e),materials:n.size,size:[r.x,r.y,r.z].map(i=>Number(i.toPrecision(3))).join(" \xD7 ")}}function ys({meshKeys:e,hiddenKeys:t,selectedKey:n,isOpen:r,onToggle:i,onFocus:a,onHover:s,onToggleVisibility:l}){let o=Se(),[d,u]=(0,h.useState)(""),[p,v]=(0,h.useState)(null),g=Object.values(e).filter(m=>m.label.toLowerCase().includes(d.toLowerCase()));return(0,c.jsxs)("div",{className:`ri-right-panel-wrapper ${r?"ri-right-panel-wrapper--open":"ri-right-panel-wrapper--closed"}`,children:[!r&&(0,c.jsx)("button",{className:"ri-side-panel__open-btn",onClick:()=>i(!0),children:(0,c.jsx)(D.Boxes,{size:20,strokeWidth:1.8})}),(0,c.jsxs)("div",{className:`ri-side-panel ${r?"ri-side-panel--open":"ri-side-panel--closed"}`,"aria-hidden":!r,children:[(0,c.jsx)("div",{className:"ri-side-panel__header",children:(0,c.jsxs)("div",{className:"ri-side-panel__header-top",children:[(0,c.jsx)("span",{className:"ri-side-panel__eyebrow",children:o("sceneObjects")}),(0,c.jsx)("span",{className:"ri-side-panel__title","aria-label":o("objectCount",{count:g.length}),children:g.length}),(0,c.jsx)("button",{className:"ri-side-panel__close-btn",onClick:()=>i(!1),title:o("close"),children:(0,c.jsx)(D.X,{size:12,strokeWidth:1.6})})]})}),(0,c.jsx)("div",{className:"ri-side-panel__search-wrap",children:(0,c.jsx)("input",{className:"ri-side-panel__search",type:"text",placeholder:o("searchObjects"),value:d,onChange:m=>u(m.target.value)})}),(0,c.jsx)("div",{className:"ri-side-panel__list",children:g.map(({key:m,label:b})=>{let x=!t.has(m),y=n===m,S=p===m;return(0,c.jsxs)("div",{onClick:()=>a(m),onMouseEnter:()=>{v(m),s(m)},onMouseLeave:()=>{v(null),s(null)},className:["ri-side-panel__row",S?"ri-side-panel__row--hovered":"",y?"ri-side-panel__row--selected":""].filter(Boolean).join(" "),children:[(0,c.jsx)("button",{type:"button",className:`ri-side-panel__label ri-side-panel__labelButton${S||y?" ri-side-panel__label--hovered":""}`,"aria-current":y?"true":void 0,onFocus:()=>{v(m),s(m)},onBlur:()=>{v(null),s(null)},children:b}),(0,c.jsx)("button",{type:"button",className:"ri-side-panel__vis-btn",title:o(x?"hide":"show"),"aria-label":o(x?"hideObject":"showObject",{name:b}),onClick:U=>{U.stopPropagation(),l(m)},children:(0,c.jsx)("span",{className:`ri-side-panel__checkbox${x?" ri-side-panel__checkbox--checked":""}`,children:x&&(0,c.jsx)(D.Check,{size:9,strokeWidth:5,color:"white"})})})]},m)})})]})]})}function en(e){return(0,c.jsx)(rr,{labels:e.labels,children:(0,c.jsx)(bs,{...e})})}function bs({modelUrl:e,poster:t,loading:n,reveal:r,modelFormat:i,dracoDecoderPath:a,ktx2TranscoderPath:s,meshopt:l=!0,backgroundColor:o="#1a1a1a",showSceneObjectsPanel:d=!0,showSceneSettingsPanel:u=!0,enableModelUpload:p=!1,zoomOnSelected:v=!1,highlightOnHover:g=!1,showLoadingOverlay:m=!0,showLoadError:b=!0,refitOnResize:x=!0,cameraLimits:y,showResetButton:S=!0,fitPadding:U=Hi,zoom:P=!0,pageScroll:N=!1,backgroundEnabled:k=!1,autoRotate:j=!1,envPreset:q=mt,environmentUrl:X,environmentEnabled:ae=!0,exposure:M=1,ambientIntensity:f=.6,ambientColor:w="#ffffff",directionalIntensity:I=1.2,directionalColor:O="#ffffff",envIntensity:L=1,envRotation:Pe=0,backgroundBlur:V=0,toneMapping:tn="aces",groundShadow:nn=!1,groundShadowOpacity:rn=.5,showFloorGrid:an=!1,wireframe:on=!1,autoRotateSpeed:sn=1,fov:ln=45,onModelLoaded:cn,onLoadError:Ve,labels:na,reducedMotion:ra="user"}){let Z=Se(),Fe=sr(ra),dn=j&&!Fe;Pi("simple-model-viewer","SimpleModelViewer");let te=(0,h.useRef)(null),He=(0,h.useRef)(null),un=(0,h.useRef)({}),hn=(0,h.useRef)(null),wt=(0,h.useRef)(null),Le=(0,h.useRef)(0),[z,St]=(0,h.useState)(null),[pn,fn]=(0,h.useState)(null),[ia,At]=(0,h.useState)(!1),[aa,mn]=(0,h.useState)({}),[gn,vn]=(0,h.useState)(new Set),[_n,xn]=(0,h.useState)(null),[oa,yn]=(0,h.useState)(null),[bn,Mn]=(0,h.useState)(null),[sa,wn]=(0,h.useState)(null),[Sn,Ge]=(0,h.useState)(!1),[la,Et]=(0,h.useState)(null),[ca,da]=(0,h.useState)(0),[An,En]=(0,h.useState)(!1),[We,Tt]=(0,h.useState)(!1),[ua,je]=(0,h.useState)(null),ha=Li(ua),[pa,qe]=(0,h.useState)(!1),[fa,ma]=(0,h.useState)(()=>typeof window>"u"?!0:window.innerWidth>900),[ga,va]=(0,h.useState)(()=>typeof window>"u"?!0:window.innerWidth>900),Xe=(0,h.useMemo)(()=>({backgroundEnabled:k,backgroundColor:o,autoRotate:dn,envPreset:q,exposure:M,ambientIntensity:f,ambientColor:w,directionalIntensity:I,directionalColor:O,envIntensity:L,envRotation:Pe,backgroundBlur:V,toneMapping:tn,groundShadow:nn,groundShadowOpacity:rn,showFloorGrid:an,wireframe:on,autoRotateSpeed:sn,fov:ln}),[k,o,dn,q,M,f,w,I,O,L,Pe,V,tn,nn,rn,an,on,sn,ln]),[E,Ye]=(0,h.useState)(Xe),Tn=(0,h.useMemo)(()=>({fitPadding:U,spinning:E.autoRotate}),[U,E.autoRotate]),B=p?bn:e,Cn=(0,h.useRef)(null),Ct=(0,h.useRef)(null),Pt=(0,h.useRef)(null),[xe,Pn]=(0,h.useState)(null);(0,h.useEffect)(()=>()=>{xe&&URL.revokeObjectURL(xe)},[xe]);let Ln=(0,h.useRef)(B);Ln.current=B;let Lt=(0,h.useRef)(null),oe=Gr({loading:n,reveal:r,rootRef:Cn,onPark:()=>{Lt.current=Ct.current?.gl??null;let _=te.current;if(_&&We){Pt.current={position:_.getPosition(new A.Vector3).toArray(),target:_.getTarget(new A.Vector3).toArray()};let T=B;$r(Ct.current).then(J=>{J&&(T===Ln.current?Pn(J):URL.revokeObjectURL(J))})}St(null),Tt(!1)}});(0,h.useEffect)(()=>{if(oe.live)return;let _=Lt.current;Lt.current=null,_&&Kr(_)},[oe.live]);let ue=(0,h.useCallback)(()=>{Pt.current=null,He.current=null,Pn(null),St(null),fn(null),At(!1),mn({}),vn(new Set),xn(null),yn(null),Ge(!1),Et(null),Tt(!1),je(null)},[]),ye=(0,h.useCallback)(()=>{wt.current?.cleanup(),wt.current=null},[]),_a=(0,h.useCallback)(()=>{ye(),Mn(null),wn(null),ue(),Ye(Xe)},[Xe,ue,ye]),Rn=(0,h.useCallback)(async _=>{En(!0);try{let T=await Yn(_);ye(),wt.current=T,Mn(T.url),wn(T.name),ue()}catch(T){Ge(!0),Et(T),Ve?.(T)}finally{En(!1)}},[Ve,ue,ye]),Rt=(0,h.useCallback)(_=>{let T=_?.[0];T&&Rn(T)},[Rn]);(0,h.useEffect)(()=>()=>{ye()},[ye]);let xa=(0,h.useCallback)(()=>z,[z]),ya=!(ae&&E.backgroundEnabled)&&new A.Color(E.backgroundColor).getHSL({h:0,s:0,l:0}).l>.5?"#000000":"#ffffff",ba=(0,h.useMemo)(()=>z?xs(z):null,[z]),be=(0,h.useMemo)(()=>{if(!z)return null;let _=new A.Box3().setFromObject(z);if(_.isEmpty())return null;let T=_.getSize(new A.Vector3);return{y:_.min.y,center:_.getCenter(new A.Vector3),size:Math.max(T.x,T.y,T.z)}},[z]),Ma=(0,h.useCallback)((_,T)=>{Ye(J=>({...J,[_]:T}))},[]);(0,h.useEffect)(()=>{Ye(_=>({..._,backgroundColor:o}))},[o]),(0,h.useEffect)(()=>{ue()},[B,ue]);let wa=(0,h.useCallback)(_=>{mn(_)},[]),Sa=(0,h.useCallback)(_=>{St(_),Ge(!1);let T=ht(_);fn(T>ut?T:null),At(!1),je(null),cn?.(pr(_))},[cn]),Aa=(0,h.useCallback)(_=>{Ge(!0),Et(_),je(null),Ve?.(_)},[Ve]),Ea=(0,h.useCallback)(_=>{_.lengthComputable&&_.total>0&&je(_.loaded/_.total*100)},[]),Dn=(0,h.useCallback)(_=>{if(xn(_),!v)return;let T=un.current[_];!T||!te.current||te.current.fitToBox(T,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5}).catch(()=>{})},[v]),Ta=(0,h.useCallback)(_=>{vn(T=>{let J=new Set(T);return J.has(_)?J.delete(_):J.add(_),J})},[]),Ca=(0,h.useCallback)(_=>{!p||!xt(_.dataTransfer)||(_.preventDefault(),_.stopPropagation(),Le.current+=1,qe(!0))},[p]),Pa=(0,h.useCallback)(_=>{!p||!xt(_.dataTransfer)||(_.preventDefault(),_.stopPropagation(),_.dataTransfer.dropEffect="copy",qe(!0))},[p]),La=(0,h.useCallback)(_=>{!p||!xt(_.dataTransfer)||(_.preventDefault(),_.stopPropagation(),Le.current=Math.max(0,Le.current-1),Le.current===0&&qe(!1))},[p]),Ra=(0,h.useCallback)(_=>{!p||!xt(_.dataTransfer)||(_.preventDefault(),_.stopPropagation(),Le.current=0,qe(!1),Rt(_.dataTransfer.files))},[p,Rt]),Da=m&&(An||!!(B&&oe.live&&!Sn&&(!z||!We)));return(0,c.jsxs)("div",{className:"smv-root",ref:Cn,"data-reduced-motion":Fe?"":void 0,style:{background:E.backgroundColor},onDragEnter:Ca,onDragOver:Pa,onDragLeave:La,onDrop:Ra,children:[u&&B&&(0,c.jsx)(_s,{isOpen:ga,onToggle:va,environmentUrl:X,environmentEnabled:ae,settings:E,modelInfo:ba,onReset:()=>Ye(Xe),onChange:Ma}),(0,c.jsxs)("div",{className:"smv-canvasArea",children:[b&&Sn&&B&&(0,c.jsxs)("div",{className:"smv-load-error",role:"alert",children:[(0,c.jsx)("strong",{children:Z("loadErrorTitle")}),(0,c.jsx)("p",{children:er(la,B,i,na).detail}),(0,c.jsx)("button",{type:"button",onClick:()=>{he(B),ue(),da(_=>_+1)},children:Z("retryModelLoad")})]}),S&&z&&We&&(0,c.jsx)("button",{type:"button",className:"smv-reset-camera",onClick:()=>{let _=te.current,T=He.current;!_||!T||_.setLookAt(...T.position,...T.target,!1).then(()=>_t(_,z,Tn,!Fe)).catch(()=>{})},children:Z("resetCameraView")}),pn!==null&&!ia&&(0,c.jsxs)("div",{className:"smv-largeModelBanner",children:[(0,c.jsx)(D.AlertTriangle,{size:14,className:"smv-largeModelBanner__icon"}),(0,c.jsx)("span",{children:Z("simpleLargeModelWarning",{millions:Math.round(pn/1e6)})}),(0,c.jsx)("button",{type:"button",className:"smv-largeModelBanner__dismiss",onClick:()=>At(!0),"aria-label":Z("dismiss"),children:(0,c.jsx)(D.X,{size:12})})]}),p?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("input",{ref:hn,type:"file",accept:qn,className:"smv-upload-input",onChange:_=>{Rt(_.target.files),_.currentTarget.value=""}}),B?(0,c.jsx)("div",{className:"smv-upload-toolbar",children:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"smv-upload-toolbar__name",children:sa??Z("uploadedModel")}),(0,c.jsxs)("button",{type:"button",className:"smv-upload-toolbar__button smv-upload-toolbar__button--ghost",onClick:_a,children:[(0,c.jsx)(D.Trash2,{size:14}),Z("clear")]})]})}):null]}):null,B&&!oe.live?(0,c.jsx)(jr,{className:"ri-viewerPlaceholder--inset",background:E.backgroundColor,poster:xe??t,onReveal:oe.awaitingReveal?oe.reveal:void 0}):B?(0,c.jsxs)(Qi.Canvas,{dpr:[1,2],frameloop:oe.visible?"demand":"never",resize:{debounce:0,scroll:!1},raycaster:{firstHitOnly:!0},style:{background:E.backgroundColor},camera:{position:[0,0,5],fov:45,near:.1,far:1e3},children:[(0,c.jsx)(Yr,{captureRef:Ct}),(0,c.jsx)(Zr,{}),(0,c.jsxs)(h.Suspense,{fallback:null,children:[(0,c.jsx)("ambientLight",{intensity:E.ambientIntensity,color:E.ambientColor}),(0,c.jsx)("directionalLight",{position:[-4,5,7],intensity:E.directionalIntensity,color:E.directionalColor,castShadow:!0}),(0,c.jsx)("directionalLight",{position:[-5,5,5],intensity:.5}),ae&&(0,c.jsx)(Mt,{children:(0,c.jsxs)(h.Suspense,{fallback:null,children:[(0,c.jsx)(Fi,{...X?{files:X}:{preset:E.envPreset},background:E.backgroundEnabled,environmentIntensity:E.envIntensity,backgroundIntensity:E.envIntensity,backgroundBlurriness:E.backgroundBlur}),(0,c.jsx)(wi,{})]})},X??E.envPreset),(0,c.jsx)(Si,{rotation:E.envRotation}),(0,c.jsx)(gs,{scene:z,exposure:E.exposure,toneMapping:E.toneMapping,fov:E.fov,wireframe:E.wireframe}),(0,c.jsx)(vs,{enabled:E.autoRotate,speed:E.autoRotateSpeed,controlsRef:te}),E.groundShadow&&be&&(0,c.jsx)(Mi,{position:[be.center.x,be.y,be.center.z],scale:be.size*2,opacity:E.groundShadowOpacity,blur:2,far:be.size,resolution:1024,color:"#000000"}),E.showFloorGrid&&(0,c.jsx)(xi,{getTarget:xa,revision:z,lineColor:ya}),(0,c.jsx)(Mt,{onLoadError:Aa,children:(0,c.jsx)(h.Suspense,{fallback:null,children:(0,c.jsx)(fs,{url:B,format:bn?void 0:i,dracoDecoderPath:a,ktx2TranscoderPath:s,meshopt:l,hiddenKeys:gn,selectedKey:_n,panelHoveredKey:oa,nodeRefsOut:un,onMeshesReady:wa,onModelLoaded:Sa,onLoadProgress:Ea,onMeshClick:Dn,highlightOnHover:g})})},`${B}:${ca}`),(0,c.jsx)(ms,{scene:z,controlsRef:te,refitOnResize:x,onInitialFitComplete:()=>{let _=te.current;_&&!He.current&&(He.current={position:_.getPosition(new A.Vector3).toArray(),target:_.getTarget(new A.Vector3).toArray()}),Tt(!0)},cameraLimits:y,resumeViewRef:Pt,framing:Tn}),(0,c.jsx)(Ji.CameraControls,{ref:te,makeDefault:!0,smoothTime:Fe?0:.3}),(0,c.jsx)(Ii,{controlsRef:te,zoom:P,pageScroll:N})]})]}):(0,c.jsx)("div",{className:"smv-upload-empty-state",style:{background:E.backgroundColor},children:(0,c.jsxs)("div",{className:"smv-upload-empty-state__card",children:[(0,c.jsx)("div",{className:"smv-upload-empty-state__icon",children:(0,c.jsx)(D.Upload,{size:24})}),(0,c.jsx)("p",{className:"smv-upload-empty-state__body",children:Z("dropModelHint",{formats:".glb, .gltf, .obj, .fbx, .usdz, .stl, .ply, .zip"})}),(0,c.jsxs)("button",{type:"button",className:"smv-upload-empty-state__button",onClick:()=>hn.current?.click(),children:[(0,c.jsx)(D.Upload,{size:15}),Z("chooseModel")]})]})}),B&&oe.live?(0,c.jsx)(Ft,{src:xe??t,hidden:!!(z&&We)}):null,(0,c.jsx)(Nr,{visible:Da,message:Z("loadingModel"),progress:An?void 0:ha??void 0,background:E.backgroundColor,seeThrough:!!(xe??t)}),p&&pa?(0,c.jsx)("div",{className:"smv-upload-drop-overlay",children:(0,c.jsxs)("div",{className:"smv-upload-drop-overlay__card",children:[(0,c.jsx)(D.Upload,{size:20}),(0,c.jsx)("span",{children:Z("releaseToLoadYourModel")})]})}):null]}),d&&B&&(0,c.jsx)(ys,{meshKeys:aa,hiddenKeys:gn,selectedKey:_n,isOpen:fa,onToggle:ma,onFocus:Dn,onHover:yn,onToggleVisibility:Ta})]})}0&&(module.exports={DEFAULT_MODEL_VIEWER_LABELS,SimpleModelViewer});
|
|
3712
|
+
import "${ts[e]}";`))},ns)};return document.readyState==="complete"?(r(),()=>clearTimeout(n)):(window.addEventListener("load",r,{once:!0}),()=>{window.removeEventListener("load",r),clearTimeout(n)})},[e,t])}var pt=require("react"),Xt=80,rs=99,is=6e3,as=200;function os(e,t=0){let n=Math.min(Math.max(e,0),100);return n<100?n/100*Xt:Xt+(rs-Xt)*(1-Math.exp(-t/is))}function Di(e,t=!1){let n=e!==null&&e>=100&&!t,[r,i]=(0,pt.useState)(0);return(0,pt.useEffect)(()=>{if(!n){i(0);return}let a=performance.now(),s=setInterval(()=>i(performance.now()-a),as);return()=>clearInterval(s)},[n]),e===null?null:t?100:os(e,r)}var Ni=require("react"),Yt=require("@react-three/fiber");function Ii(e,t,{zoom:n,pageScroll:r},i){if(!n)return{wheel:t.NONE,middle:t.NONE,two:t.TOUCH_TRUCK};let a=r&&!i?t.NONE:e.wheel;return{...e,wheel:a}}function ss({pageScroll:e}){return e?"pan-y":null}function Ui({controlsRef:e,zoom:t=!0,pageScroll:n=!1}){let r=(0,Yt.useThree)(s=>s.gl.domElement),a=(0,Yt.useThree)(s=>s.events.connected)??r;return(0,Ni.useEffect)(()=>{let s=e&&typeof e=="object"?e.current:null,l=s?.constructor.ACTION;if(!s||!l||!a||t&&!n)return;let o={zoom:t,pageScroll:n},u={wheel:s.mouseButtons.wheel,middle:s.mouseButtons.middle,two:s.touches.two},d=y=>{s.mouseButtons.wheel=y.wheel,s.mouseButtons.middle=y.middle,s.touches.two=y.two};d(Ii(u,l,o));let m=y=>{d(Ii(u,l,o,y.ctrlKey||y.metaKey))};a.addEventListener("wheel",m,{capture:!0,passive:!0});let _=ss(o),p=[...new Set([r,a])],v=p.map(y=>[y,y.style.touchAction]),x=null;if(_){let y=()=>{if(s.enabled)for(let b of p)b.style.touchAction!==_&&(b.style.touchAction=_)};y(),x=new MutationObserver(y);for(let b of p)x.observe(b,{attributes:!0,attributeFilter:["style"]})}return()=>{if(a.removeEventListener("wheel",m,{capture:!0}),x?.disconnect(),_)for(let[y,b]of v)y.style.touchAction=b;d(u)}},[e,r,a,t,n]),null}var R=require("three"),mt="neutral",ls=[{direction:[.62,.48,.62],size:[.38,.28],radiance:9},{direction:[-.75,.2,.55],size:[.32,.36],radiance:3.5},{direction:[0,1,0],size:[.55,.55],radiance:4},{direction:[.15,.3,-1],size:[.45,.16],radiance:5}],ft=(e,t,n)=>{let r=Math.min(Math.max((n-e)/(t-e),0),1);return r*r*(3-2*r)},cs=ls.map(e=>{let t=new R.Vector3(...e.direction).normalize(),n=Math.abs(t.y)>.9?new R.Vector3(0,0,1):new R.Vector3(0,1,0),r=new R.Vector3().crossVectors(n,t).normalize(),i=new R.Vector3().crossVectors(t,r).normalize();return{center:t,right:r,up:i,box:e}}),ds=.9;function us(e){let t=e.y,n=.2+.18*ft(-.35,.05,t)+.17*ft(0,.9,t);for(let{center:r,right:i,up:a,box:s}of cs){let l=e.dot(r);if(l<=0)continue;let o=Math.abs(e.dot(i)/l)/s.size[0],u=Math.abs(e.dot(a)/l)/s.size[1],d=(1-ft(.82,1,o))*(1-ft(.82,1,u));n+=s.radiance*d}return n*ds}var Zt=null;function Oi(){if(Zt)return Zt;let e=512,t=256,n=new Uint16Array(e*t*4),r=new R.Vector3;for(let a=0;a<t;a++){let s=((a+.5)/t-.5)*Math.PI;for(let l=0;l<e;l++){let o=((l+.5)/e-.5)*2*Math.PI;r.set(Math.cos(s)*Math.cos(o),Math.sin(s),Math.cos(s)*Math.sin(o));let u=R.DataUtils.toHalfFloat(us(r)),d=(a*e+l)*4;n[d]=u,n[d+1]=u,n[d+2]=u,n[d+3]=R.DataUtils.toHalfFloat(1)}}let i=new R.DataTexture(n,e,t,R.RGBAFormat,R.HalfFloatType);return i.mapping=R.EquirectangularReflectionMapping,i.colorSpace=R.LinearSRGBColorSpace,i.magFilter=R.LinearFilter,i.minFilter=R.LinearFilter,i.generateMipmaps=!1,i.needsUpdate=!0,Zt=i,i}var vt=require("react"),Kt=require("@react-three/fiber");var gt=require("react/jsx-runtime"),Hi=(0,vt.lazy)(()=>Promise.resolve().then(()=>(Fi(),zi)));function Gi({preset:e,files:t,...n}){return!t&&e===mt?(0,gt.jsx)(hs,{...n}):t?(0,gt.jsx)(Hi,{files:t,...n}):(0,gt.jsx)(Hi,{preset:e,...n})}function hs({background:e=!1,environmentIntensity:t=1,backgroundIntensity:n=1,backgroundBlurriness:r=0}){let i=(0,Kt.useThree)(s=>s.scene),a=(0,Kt.useThree)(s=>s.invalidate);return(0,vt.useLayoutEffect)(()=>{let s=Oi(),l={environment:i.environment,environmentIntensity:i.environmentIntensity,background:i.background,backgroundIntensity:i.backgroundIntensity,backgroundBlurriness:i.backgroundBlurriness};return i.environment=s,i.environmentIntensity=t,e&&(i.background=s,i.backgroundIntensity=n,i.backgroundBlurriness=r),a(),()=>{Object.assign(i,l),a()}},[i,a,e,t,n,r]),null}var re=require("three"),Wi=.1;function ps(e,t){if(!t||e.isEmpty())return e.clone();let n=e.getCenter(new re.Vector3),r=e.getSize(new re.Vector3),i=Math.hypot(r.x,r.z)/2;return new re.Box3(new re.Vector3(n.x-i,e.min.y,n.z-i),new re.Vector3(n.x+i,e.max.y,n.z+i))}function fs(e,t){let n=e.getSize(new re.Vector3),r=Math.max(n.x,n.y,n.z),i=Number.isFinite(r)?r*Math.max(0,t):0;return{paddingTop:i,paddingBottom:i,paddingLeft:i,paddingRight:i}}function _t(e,t,{fitPadding:n,spinning:r},i){let a=new re.Box3().setFromObject(t);return e.fitToBox(ps(a,r),i,fs(a,n))}var C=require("react"),ji=require("react-dom"),qi=require("lucide-react"),W=require("react/jsx-runtime"),ms=(0,C.createContext)(null);function Xi({value:e,onChange:t,children:n,className:r,id:i,disabled:a=!1,title:s,"aria-label":l}){let o=(0,C.useContext)(ms),u=$t(n),d=u.filter(f=>f.kind==="option"),m=d.find(f=>f.value===e),[_,p]=(0,C.useState)(!1),[v,x]=(0,C.useState)(-1),[y,b]=(0,C.useState)({}),S=(0,C.useRef)(null),U=(0,C.useRef)(null),P=(0,C.useId)(),N=(0,C.useCallback)(f=>{p(!1),f&&S.current?.focus()},[]),B=f=>{f.disabled||(N(!0),f.value!==e&&t?.({target:{value:f.value},currentTarget:{value:f.value}}))},j=()=>{a||(x(Math.max(0,d.findIndex(f=>f.value===e))),p(!0))};(0,C.useLayoutEffect)(()=>{if(!_||!S.current)return;let f=S.current.getBoundingClientRect(),w=window.innerHeight-f.bottom-8,I=f.top-8,O=w<180&&I>w;b({left:f.left,minWidth:f.width,maxHeight:Math.min(320,O?I:w)-4,...O?{bottom:window.innerHeight-f.top+4}:{top:f.bottom+4}})},[_]),(0,C.useEffect)(()=>{if(!_)return;let f=O=>{let L=O.target;U.current?.contains(L)||S.current?.contains(L)||N(!1)},w=O=>O.preventDefault(),I=U.current;return I?.addEventListener("beforexrselect",w),window.addEventListener("pointerdown",f,!0),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{I?.removeEventListener("beforexrselect",w),window.removeEventListener("pointerdown",f,!0),window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[_,N]),(0,C.useEffect)(()=>{_&&U.current?.querySelector(`[data-index="${v}"]`)?.scrollIntoView({block:"nearest"})},[_,v]);let q=(f,w)=>{for(let I=f+w;I>=0&&I<d.length;I+=w)if(!d[I].disabled)return I;return f},ee=f=>{if(!a){if(!_){["ArrowDown","ArrowUp","Enter"," "].includes(f.key)&&(f.preventDefault(),j());return}if(f.key==="ArrowDown")x(w=>q(w,1));else if(f.key==="ArrowUp")x(w=>q(w,-1));else if(f.key==="Home")x(q(-1,1));else if(f.key==="End")x(q(d.length,-1));else if(f.key==="Enter"||f.key===" ")d[v]&&B(d[v]);else if(f.key==="Escape")N(!0);else if(f.key==="Tab"){N(!1);return}else return;f.preventDefault()}},de=o??S.current?.closest(".bb-dialogBackdrop, .ri-viewer, .smv-root, .bb-root")??(typeof document<"u"?document.body:null),M=-1;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("button",{ref:S,type:"button",id:i,className:`ri-select ${r??""}`,disabled:a,title:s,"aria-label":l,"aria-haspopup":"listbox","aria-expanded":_,"aria-controls":_?P:void 0,"aria-activedescendant":_&&v>=0?`${P}-${v}`:void 0,onClick:()=>_?N(!1):j(),onKeyDown:ee,children:(0,W.jsx)("span",{className:"ri-selectValue",children:m?.label??""})}),_&&de?(0,ji.createPortal)((0,W.jsx)("div",{ref:U,id:P,className:"ri-selectMenu",role:"listbox","aria-label":l,style:y,children:u.map((f,w)=>{if(f.kind==="group")return(0,W.jsx)("div",{className:"ri-selectGroup",role:"presentation",children:f.label},`group-${w}`);M+=1;let I=M,O=f.value===e;return(0,W.jsxs)("div",{id:`${P}-${I}`,"data-index":I,role:"option","aria-selected":O,"aria-disabled":f.disabled||void 0,className:`ri-selectOption ${I===v?"ri-selectOption--active":""}`,onPointerEnter:()=>!f.disabled&&x(I),onClick:()=>B(f),children:[(0,W.jsx)("span",{className:"ri-selectCheck",children:O?(0,W.jsx)(qi.Check,{size:13,"aria-hidden":"true"}):null}),(0,W.jsx)("span",{className:"ri-selectLabel",children:f.label})]},`${f.value}-${w}`)})}),de):null]})}function $t(e,t=[]){return C.Children.forEach(e,n=>{if(!(0,C.isValidElement)(n))return;let r=n;if(r.type===C.Fragment)$t(r.props.children,t);else if(r.type==="optgroup")t.push({kind:"group",label:String(r.props.label??"")}),$t(r.props.children,t);else if(r.type==="option"){let i=Jt(r.props.children);t.push({kind:"option",value:r.props.value===void 0?i:String(r.props.value),label:i,disabled:!!r.props.disabled})}}),t}function Jt(e){return e==null||typeof e=="boolean"?"":typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(Jt).join(""):(0,C.isValidElement)(e)?Jt(e.props.children):""}var c=require("react/jsx-runtime"),Yi={color:"#93c5fd",intensity:.05},Zi=["neutral","apartment","city","dawn","forest","lobby","night","park","studio","sunset","warehouse"],ra={aces:A.ACESFilmicToneMapping,agx:A.AgXToneMapping,neutral:A.NeutralToneMapping,none:A.NoToneMapping};function Qt(e){return!!(e&&"isMesh"in e&&e.isMesh)}function Ki(e,t){Array.isArray(e)?e.forEach(t):t(e)}function $i(e,t,n){if(!t)return;let r=t.camera;if(!(r instanceof A.PerspectiveCamera))return;let i=new A.Box3().setFromObject(e).getSize(new A.Vector3).length();if(!Number.isFinite(i)||i<=0)return;r.near=i/100,r.far=i*100,r.updateProjectionMatrix();let a=rr(n);t.minDistance=n?.minDistance??i*.05,t.maxDistance=n?.maxDistance??i*10,t.minPolarAngle=a.minPolarAngle,t.maxPolarAngle=a.maxPolarAngle,t.minAzimuthAngle=a.minAzimuthAngle,t.maxAzimuthAngle=a.maxAzimuthAngle,t.boundaryEnclosesCamera=a.boundaryEnclosesCamera,t.boundaryFriction=a.boundaryFriction,t.setBoundary(a.panBoundary?new A.Box3(new A.Vector3(...a.panBoundary[0]),new A.Vector3(...a.panBoundary[1])):void 0)}var Mt=class extends h.Component{constructor(){super(...arguments);this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){this.props.onLoadError?.(n)}render(){return this.state.hasError?null:this.props.children}};function gs({url:e,format:t,dracoDecoderPath:n,ktx2TranscoderPath:r,meshopt:i,hiddenKeys:a,selectedKey:s,panelHoveredKey:l,nodeRefsOut:o,onMeshesReady:u,onModelLoaded:d,onLoadProgress:m,onMeshClick:_,highlightOnHover:p}){let{scene:v}=Rr(e,{dracoDecoderPath:n,ktx2TranscoderPath:r,meshopt:i},t,m),x=(0,K.useThree)(M=>M.invalidate),{setCanvasCursor:y,restoreCanvasCursor:b}=Ci(),[S,U]=(0,h.useState)(null),P=(0,h.useMemo)(()=>na.SkeletonUtils.clone(v),[v]),N=(0,h.useMemo)(()=>{let M={};return P.traverse(f=>{if(!Qt(f))return;let w=f.name||f.uuid;M[w]={key:w,label:f.name||f.type,ref:f}}),M},[P]),B=(0,h.useMemo)(()=>{let M={};for(let[f,{ref:w}]of Object.entries(N)){let O=(Array.isArray(w.material)?w.material:[w.material]).map(L=>{let V=(ti(L)??new A.MeshStandardMaterial).clone();return V.userData.baseColor=V.color.clone(),V.userData.baseMap=V.map,V.userData.baseEmissive=V.emissive.clone(),V.userData.baseEmissiveMap=V.emissiveMap,V.userData.baseEmissiveIntensity=V.emissiveIntensity,V});M[f]=Array.isArray(w.material)?O:O[0]}return M},[N]);(0,h.useEffect)(()=>()=>{Object.values(B).forEach(M=>Ki(M,f=>f.dispose()))},[B]);let j=(0,h.useRef)(null);(0,h.useEffect)(()=>{j.current!==e&&(j.current=e,P.updateWorldMatrix(!0,!0),li(P),u(N),d(P))},[e,P,N,u,d]),(0,h.useEffect)(()=>{let M=new AbortController;return gi(P,M.signal),()=>{M.abort(),vi(P)}},[P]);let q=(0,h.useMemo)(()=>!mi(P),[P]);(0,h.useEffect)(()=>{for(let[M,{ref:f}]of Object.entries(N))o.current[M]=f},[N,o]),(0,h.useEffect)(()=>{!p&&S!==null&&(U(null),b())},[p,S,b]),(0,h.useEffect)(()=>{for(let[M,{ref:f}]of Object.entries(N)){f.visible=!a.has(M);let w=B[M];if(!w)continue;f.material=w;let I=p&&S===M,O=p&&l===M;Ki(w,L=>{if(L.color.copy(L.userData.baseColor),L.map=L.userData.baseMap??null,L.emissive.copy(L.userData.baseEmissive),L.emissiveMap=L.userData.baseEmissiveMap??null,L.emissiveIntensity=L.userData.baseEmissiveIntensity,O||I){let Pe=!!L.userData.baseEmissiveMap;L.emissive.set(Yi.color),L.emissiveIntensity=Pe?L.userData.baseEmissiveIntensity:Yi.intensity}L.needsUpdate=!0})}x()},[N,B,S,s,l,p,a,x]);let ee=M=>{if(!On(M))return null;let f=M;for(;f;){let w=f.name||f.uuid;if(N[w])return w;f=f.parent}return null},de=q?{onClick:M=>{let f=ee(M.object);f&&(M.stopPropagation(),_(f))},...p?{onPointerOver:M=>{let f=ee(M.object);f&&(M.stopPropagation(),y("pointer"),U(f))},onPointerOut:M=>{M.stopPropagation(),b(),U(null)}}:{}}:{};return(0,c.jsx)("primitive",{object:P,...de})}function vs({scene:e,controlsRef:t,refitOnResize:n,onInitialFitComplete:r,resumeViewRef:i,cameraLimits:a,framing:s}){let l=(0,h.useRef)(s);l.current=s;let o=(0,h.useRef)(a);o.current=a;let u=JSON.stringify(a??null);(0,h.useEffect)(()=>{e&&$i(e,t.current,o.current)},[e,t,u]);let d=(0,h.useRef)(!1),m=(0,K.useThree)(v=>v.invalidate),_=(0,K.useThree)(v=>v.size),p=(0,h.useRef)(null);return(0,h.useEffect)(()=>{d.current=!1,m()},[m,e]),(0,K.useFrame)(()=>{if(d.current)return;if(!e||!t.current){m();return}d.current=!0,$i(e,t.current,a);let v=i.current;if(v){i.current=null,t.current.setLookAt(...v.position,...v.target,!1).catch(()=>{}).finally(r),m();return}_t(t.current,e,l.current,!1).catch(()=>{}).finally(r),m()}),(0,h.useEffect)(()=>{if(!(!n||!d.current||!e||!t.current))return p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{let v=t.current;v&&_t(v,e,l.current,!0).catch(()=>{}),m()},150),()=>{p.current&&clearTimeout(p.current)}},[_.width,_.height,n]),null}function _s({scene:e,exposure:t,toneMapping:n,fov:r,wireframe:i}){let a=(0,K.useThree)(o=>o.gl),s=(0,K.useThree)(o=>o.camera),l=(0,K.useThree)(o=>o.invalidate);return(0,h.useEffect)(()=>{a.toneMappingExposure=t,l()},[a,t,l]),(0,h.useEffect)(()=>{s instanceof A.PerspectiveCamera&&(s.fov=r,s.updateProjectionMatrix(),l())},[s,r,l]),(0,h.useEffect)(()=>{a.toneMapping=ra[n],e?.traverse(o=>{if(Qt(o))for(let u of[o.material].flat())u.wireframe=i,u.needsUpdate=!0}),l()},[a,e,n,i,l]),null}function xs({enabled:e,speed:t,controlsRef:n}){let r=(0,K.useThree)(i=>i.invalidate);return(0,K.useFrame)((i,a)=>{!e||!n.current||(n.current.rotate(a*.2*t,0,!1),r())}),null}function xt(e){return Array.from(e.types).includes("Files")}function ze({label:e,checked:t,onChange:n}){return(0,c.jsxs)("div",{className:"ri-env-row",children:[(0,c.jsx)("span",{className:"ri-env-row__label",title:e,children:e}),(0,c.jsx)("div",{className:"ri-env-row__value",children:(0,c.jsx)("button",{type:"button",className:"ri-env-checkbox-btn",role:"checkbox","aria-checked":t,"aria-label":e,onClick:()=>n(!t),children:(0,c.jsx)("span",{className:`ri-env-checkbox${t?" ri-env-checkbox--checked":""}`,children:t&&(0,c.jsx)(D.Check,{size:10,strokeWidth:2.5,"aria-hidden":"true"})})})})]})}function yt({label:e,value:t,onChange:n}){return(0,c.jsxs)("div",{className:"ri-env-row",children:[(0,c.jsx)("span",{className:"ri-env-row__label",title:e,children:e}),(0,c.jsx)("div",{className:"ri-env-row__value",children:(0,c.jsxs)("label",{className:"ri-env-color-swatch",children:[(0,c.jsx)("span",{className:"ri-env-color-swatch__chip",style:{background:t}}),(0,c.jsx)("span",{className:"ri-env-color-swatch__hex",children:t}),(0,c.jsx)("input",{type:"color",className:"ri-env-color-swatch__input","aria-label":e,value:t,onChange:r=>n(r.target.value)})]})})]})}function ie({label:e,value:t,min:n,max:r,step:i,format:a=l=>l.toFixed(2),onChange:s}){return(0,c.jsxs)("div",{className:"ri-env-row",children:[(0,c.jsx)("span",{className:"ri-env-row__label",title:e,children:e}),(0,c.jsxs)("div",{className:"ri-env-row__value ri-env-row__value--slider",children:[(0,c.jsx)("input",{type:"range",className:"ri-env-slider","aria-label":e,min:n,max:r,step:i,value:t,onChange:l=>s(Number(l.target.value))}),(0,c.jsx)("span",{className:"ri-env-slider__value",children:a(t)})]})]})}function Ji({label:e,optionLabels:t,value:n,options:r,onChange:i}){return(0,c.jsxs)("div",{className:"ri-env-row",children:[(0,c.jsx)("span",{className:"ri-env-row__label",title:e,children:e}),(0,c.jsx)("div",{className:"ri-env-row__value",children:(0,c.jsx)(Xi,{className:"ri-env-select","aria-label":e,value:n,onChange:a=>i(a.target.value),children:r.map(a=>(0,c.jsx)("option",{value:a,children:t?.[a]??a},a))})})]})}function bt({label:e,value:t}){return(0,c.jsxs)("div",{className:"ri-env-row",children:[(0,c.jsx)("span",{className:"ri-env-row__label",title:e,children:e}),(0,c.jsx)("span",{className:"ri-env-row__info",children:t})]})}var Qi=e=>`${Math.round(e)}\xB0`;function Ce({title:e,children:t}){let[n,r]=(0,h.useState)(!1);return(0,c.jsxs)("div",{className:"ri-env-section",children:[(0,c.jsxs)("button",{type:"button",className:"ri-env-section__header","aria-expanded":!n,onClick:()=>r(i=>!i),children:[(0,c.jsx)(D.ChevronDown,{size:12,strokeWidth:2,className:`ri-env-section__chevron${n?" env-section__chevron--collapsed":""}`}),(0,c.jsx)("span",{children:e})]}),!n&&(0,c.jsx)("div",{className:"ri-env-section__body",children:t})]})}function ys({isOpen:e,onToggle:t,settings:n,modelInfo:r,onChange:i,onReset:a,environmentEnabled:s,environmentUrl:l}){let o=Se(),u=(0,h.useId)();return(0,c.jsxs)("div",{className:`ri-left-panel-wrapper ${e?"ri-left-panel-wrapper--open":"ri-left-panel-wrapper--closed"}`,children:[!e&&(0,c.jsx)("button",{type:"button","aria-label":o("openSceneSettingsPanel"),"aria-controls":u,"aria-expanded":!1,className:"ri-side-panel__open-btn ri-side-panel__open-btn--left",onClick:()=>t(!0),children:(0,c.jsx)(D.Settings,{size:20,strokeWidth:1.8})}),(0,c.jsxs)("div",{className:`ri-side-panel ri-side-panel--left ${e?"ri-side-panel--open-left":"ri-side-panel--closed-left"}`,id:u,"aria-hidden":!e,children:[(0,c.jsx)("div",{className:"ri-side-panel__header",children:(0,c.jsxs)("div",{className:"ri-side-panel__header-top",children:[(0,c.jsx)("span",{className:"ri-side-panel__eyebrow",children:o("sceneSettings")}),(0,c.jsx)("button",{className:"ri-side-panel__close-btn",onClick:()=>t(!1),type:"button","aria-label":o("closeSceneSettingsPanel"),title:o("close"),children:(0,c.jsx)(D.X,{size:12,strokeWidth:1.6})})]})}),(0,c.jsxs)("div",{className:"ri-env-controls",children:[s&&(0,c.jsxs)(Ce,{title:o("environment"),children:[!l&&(0,c.jsx)(Ji,{label:o("environmentPreset"),value:n.envPreset,options:Zi,optionLabels:Object.fromEntries(Zi.map(d=>[d,o(`environment${d[0].toUpperCase()}${d.slice(1)}`)])),onChange:d=>i("envPreset",d)}),(0,c.jsx)(ie,{label:o("environmentIntensity"),value:n.envIntensity,min:0,max:3,step:.05,onChange:d=>i("envIntensity",d)}),(0,c.jsx)(ie,{label:o("rotation"),value:n.envRotation,min:0,max:360,step:1,format:Qi,onChange:d=>i("envRotation",d)}),(0,c.jsx)(ze,{label:o("showEnvironmentAsBackground"),checked:n.backgroundEnabled,onChange:d=>i("backgroundEnabled",d)}),n.backgroundEnabled?(0,c.jsx)(ie,{label:o("backgroundBlur"),value:n.backgroundBlur,min:0,max:1,step:.01,onChange:d=>i("backgroundBlur",d)}):(0,c.jsx)(yt,{label:o("backgroundColor"),value:n.backgroundColor,onChange:d=>i("backgroundColor",d)})]}),!s&&(0,c.jsx)(Ce,{title:o("background"),children:(0,c.jsx)(yt,{label:o("backgroundColor"),value:n.backgroundColor,onChange:d=>i("backgroundColor",d)})}),(0,c.jsxs)(Ce,{title:o("lighting"),children:[(0,c.jsx)(ie,{label:o("exposure"),value:n.exposure,min:0,max:2,step:.05,onChange:d=>i("exposure",d)}),(0,c.jsx)(Ji,{label:o("toneMapping"),value:n.toneMapping,options:Object.keys(ra),optionLabels:{aces:o("toneMappingAces"),agx:o("toneMappingAgx"),neutral:o("toneMappingNeutral"),none:o("toneMappingNone")},onChange:d=>i("toneMapping",d)}),(0,c.jsx)(ie,{label:o("ambientLightIntensity"),value:n.ambientIntensity,min:0,max:3,step:.05,onChange:d=>i("ambientIntensity",d)}),(0,c.jsx)(yt,{label:o("ambientLightColor"),value:n.ambientColor,onChange:d=>i("ambientColor",d)}),(0,c.jsx)(ie,{label:o("directLightIntensity"),value:n.directionalIntensity,min:0,max:5,step:.05,onChange:d=>i("directionalIntensity",d)}),(0,c.jsx)(yt,{label:o("directLightColor"),value:n.directionalColor,onChange:d=>i("directionalColor",d)})]}),(0,c.jsxs)(Ce,{title:o("ground"),children:[(0,c.jsx)(ze,{label:o("groundShadow"),checked:n.groundShadow,onChange:d=>i("groundShadow",d)}),n.groundShadow&&(0,c.jsx)(ie,{label:o("groundShadowOpacity"),value:n.groundShadowOpacity,min:0,max:1,step:.01,onChange:d=>i("groundShadowOpacity",d)}),(0,c.jsx)(ze,{label:o("floorGrid"),checked:n.showFloorGrid,onChange:d=>i("showFloorGrid",d)})]}),(0,c.jsxs)(Ce,{title:o("display"),children:[(0,c.jsx)(ze,{label:o("wireframe"),checked:n.wireframe,onChange:d=>i("wireframe",d)}),(0,c.jsx)(ze,{label:o("autoRotate"),checked:n.autoRotate,onChange:d=>i("autoRotate",d)}),n.autoRotate&&(0,c.jsx)(ie,{label:o("autoRotateSpeed"),value:n.autoRotateSpeed,min:.1,max:5,step:.1,onChange:d=>i("autoRotateSpeed",d)}),(0,c.jsx)(ie,{label:o("fieldOfView"),value:n.fov,min:15,max:90,step:1,format:Qi,onChange:d=>i("fov",d)})]}),r&&(0,c.jsxs)(Ce,{title:o("modelInfo"),children:[(0,c.jsx)(bt,{label:o("modelInfoObjects"),value:r.objects.toLocaleString()}),(0,c.jsx)(bt,{label:o("modelInfoTriangles"),value:r.triangles.toLocaleString()}),(0,c.jsx)(bt,{label:o("modelInfoMaterials"),value:r.materials.toLocaleString()}),(0,c.jsx)(bt,{label:o("size"),value:r.size})]}),(0,c.jsx)("div",{className:"ri-env-footer",children:(0,c.jsxs)("button",{type:"button",className:"ri-env-reset",onClick:a,children:[(0,c.jsx)(D.RotateCcw,{size:12,"aria-hidden":"true"}),o("resetSettings")]})})]})]})]})}function bs(e){let t=0,n=new Set;e.traverse(i=>{if(Qt(i)){t+=1;for(let a of[i.material].flat())n.add(a.name||a.uuid)}});let r=new A.Box3().setFromObject(e).getSize(new A.Vector3);return{objects:t,triangles:ht(e),materials:n.size,size:[r.x,r.y,r.z].map(i=>Number(i.toPrecision(3))).join(" \xD7 ")}}function Ms({meshKeys:e,hiddenKeys:t,selectedKey:n,isOpen:r,onToggle:i,onFocus:a,onHover:s,onToggleVisibility:l}){let o=Se(),u=(0,h.useId)(),[d,m]=(0,h.useState)(""),[_,p]=(0,h.useState)(null),v=Object.values(e).filter(x=>x.label.toLowerCase().includes(d.toLowerCase()));return(0,c.jsxs)("div",{className:`ri-right-panel-wrapper ${r?"ri-right-panel-wrapper--open":"ri-right-panel-wrapper--closed"}`,children:[!r&&(0,c.jsx)("button",{type:"button","aria-label":o("openSceneObjectsPanel"),"aria-controls":u,"aria-expanded":!1,className:"ri-side-panel__open-btn",onClick:()=>i(!0),children:(0,c.jsx)(D.Boxes,{size:20,strokeWidth:1.8})}),(0,c.jsxs)("div",{className:`ri-side-panel ${r?"ri-side-panel--open":"ri-side-panel--closed"}`,id:u,"aria-hidden":!r,children:[(0,c.jsx)("div",{className:"ri-side-panel__header",children:(0,c.jsxs)("div",{className:"ri-side-panel__header-top",children:[(0,c.jsx)("span",{className:"ri-side-panel__eyebrow",children:o("sceneObjects")}),(0,c.jsx)("span",{className:"ri-side-panel__title","aria-label":o("objectCount",{count:v.length}),children:v.length}),(0,c.jsx)("button",{className:"ri-side-panel__close-btn",onClick:()=>i(!1),type:"button","aria-label":o("closeSceneObjectsPanel"),title:o("close"),children:(0,c.jsx)(D.X,{size:12,strokeWidth:1.6})})]})}),(0,c.jsx)("div",{className:"ri-side-panel__search-wrap",children:(0,c.jsx)("input",{className:"ri-side-panel__search",type:"text",placeholder:o("searchObjects"),value:d,onChange:x=>m(x.target.value)})}),(0,c.jsx)("div",{className:"ri-side-panel__list",children:v.map(({key:x,label:y})=>{let b=!t.has(x),S=n===x,U=_===x;return(0,c.jsxs)("div",{onClick:()=>a(x),onMouseEnter:()=>{p(x),s(x)},onMouseLeave:()=>{p(null),s(null)},className:["ri-side-panel__row",U?"ri-side-panel__row--hovered":"",S?"ri-side-panel__row--selected":""].filter(Boolean).join(" "),children:[(0,c.jsx)("button",{type:"button",className:`ri-side-panel__label ri-side-panel__labelButton${U||S?" ri-side-panel__label--hovered":""}`,"aria-current":S?"true":void 0,onFocus:()=>{p(x),s(x)},onBlur:()=>{p(null),s(null)},children:y}),(0,c.jsx)("button",{type:"button",className:"ri-side-panel__vis-btn",title:o(b?"hide":"show"),"aria-label":o(b?"hideObject":"showObject",{name:y}),onClick:P=>{P.stopPropagation(),l(x)},children:(0,c.jsx)("span",{className:`ri-side-panel__checkbox${b?" ri-side-panel__checkbox--checked":""}`,children:b&&(0,c.jsx)(D.Check,{size:9,strokeWidth:5,color:"white"})})})]},x)})})]})]})}function en(e){return(0,c.jsx)(ar,{labels:e.labels,children:(0,c.jsx)(ws,{...e})})}function ws({"aria-label":e,"aria-labelledby":t,modelUrl:n,poster:r,loading:i,reveal:a,modelFormat:s,dracoDecoderPath:l,ktx2TranscoderPath:o,meshopt:u=!0,backgroundColor:d="#1a1a1a",showSceneObjectsPanel:m=!0,showSceneSettingsPanel:_=!0,enableModelUpload:p=!1,zoomOnSelected:v=!1,highlightOnHover:x=!1,showLoadingOverlay:y=!0,showLoadError:b=!0,refitOnResize:S=!0,cameraLimits:U,showResetButton:P=!0,fitPadding:N=Wi,zoom:B=!0,pageScroll:j=!1,backgroundEnabled:q=!1,autoRotate:ee=!1,envPreset:de=mt,environmentUrl:M,environmentEnabled:f=!0,exposure:w=1,ambientIntensity:I=.6,ambientColor:O="#ffffff",directionalIntensity:L=1.2,directionalColor:Pe="#ffffff",envIntensity:V=1,envRotation:tn=0,backgroundBlur:nn=0,toneMapping:rn="aces",groundShadow:an=!1,groundShadowOpacity:on=.5,showFloorGrid:sn=!1,wireframe:ln=!1,autoRotateSpeed:cn=1,fov:dn=45,onModelLoaded:un,onLoadError:Ve,labels:ia,reducedMotion:aa="user"}){let X=Se(),Fe=cr(aa),hn=ee&&!Fe;Ri("simple-model-viewer","SimpleModelViewer");let te=(0,h.useRef)(null),He=(0,h.useRef)(null),pn=(0,h.useRef)({}),fn=(0,h.useRef)(null),wt=(0,h.useRef)(null),Le=(0,h.useRef)(0),[z,St]=(0,h.useState)(null),[mn,gn]=(0,h.useState)(null),[oa,At]=(0,h.useState)(!1),[sa,vn]=(0,h.useState)({}),[_n,xn]=(0,h.useState)(new Set),[yn,bn]=(0,h.useState)(null),[la,Mn]=(0,h.useState)(null),[wn,Sn]=(0,h.useState)(null),[ca,An]=(0,h.useState)(null),[En,Ge]=(0,h.useState)(!1),[da,Et]=(0,h.useState)(null),[ua,ha]=(0,h.useState)(0),[Tn,Cn]=(0,h.useState)(!1),[We,Tt]=(0,h.useState)(!1),[pa,je]=(0,h.useState)(null),fa=Di(pa),[ma,qe]=(0,h.useState)(!1),[ga,va]=(0,h.useState)(()=>typeof window>"u"?!0:window.innerWidth>900),[_a,xa]=(0,h.useState)(()=>typeof window>"u"?!0:window.innerWidth>900),Xe=(0,h.useMemo)(()=>({backgroundEnabled:q,backgroundColor:d,autoRotate:hn,envPreset:de,exposure:w,ambientIntensity:I,ambientColor:O,directionalIntensity:L,directionalColor:Pe,envIntensity:V,envRotation:tn,backgroundBlur:nn,toneMapping:rn,groundShadow:an,groundShadowOpacity:on,showFloorGrid:sn,wireframe:ln,autoRotateSpeed:cn,fov:dn}),[q,d,hn,de,w,I,O,L,Pe,V,tn,nn,rn,an,on,sn,ln,cn,dn]),[E,Ye]=(0,h.useState)(Xe),Pn=(0,h.useMemo)(()=>({fitPadding:N,spinning:E.autoRotate}),[N,E.autoRotate]),k=p?wn:n,Ln=(0,h.useRef)(null),Ct=(0,h.useRef)(null),Pt=(0,h.useRef)(null),[xe,Rn]=(0,h.useState)(null);(0,h.useEffect)(()=>()=>{xe&&URL.revokeObjectURL(xe)},[xe]);let Dn=(0,h.useRef)(k);Dn.current=k;let Lt=(0,h.useRef)(null),ae=jr({loading:i,reveal:a,rootRef:Ln,onPark:()=>{Lt.current=Ct.current?.gl??null;let g=te.current;if(g&&We){Pt.current={position:g.getPosition(new A.Vector3).toArray(),target:g.getTarget(new A.Vector3).toArray()};let T=k;Qr(Ct.current).then($=>{$&&(T===Dn.current?Rn($):URL.revokeObjectURL($))})}St(null),Tt(!1)}});(0,h.useEffect)(()=>{if(ae.live)return;let g=Lt.current;Lt.current=null,g&&Jr(g)},[ae.live]);let ue=(0,h.useCallback)(()=>{Pt.current=null,He.current=null,Rn(null),St(null),gn(null),At(!1),vn({}),xn(new Set),bn(null),Mn(null),Ge(!1),Et(null),Tt(!1),je(null)},[]),ye=(0,h.useCallback)(()=>{wt.current?.cleanup(),wt.current=null},[]),ya=(0,h.useCallback)(()=>{ye(),Sn(null),An(null),ue(),Ye(Xe)},[Xe,ue,ye]),In=(0,h.useCallback)(async g=>{Cn(!0);try{let T=await Kn(g);ye(),wt.current=T,Sn(T.url),An(T.name),ue()}catch(T){Ge(!0),Et(T),Ve?.(T)}finally{Cn(!1)}},[Ve,ue,ye]),Rt=(0,h.useCallback)(g=>{let T=g?.[0];T&&In(T)},[In]);(0,h.useEffect)(()=>()=>{ye()},[ye]);let ba=(0,h.useCallback)(()=>z,[z]),Ma=!(f&&E.backgroundEnabled)&&new A.Color(E.backgroundColor).getHSL({h:0,s:0,l:0}).l>.5?"#000000":"#ffffff",wa=(0,h.useMemo)(()=>z?bs(z):null,[z]),be=(0,h.useMemo)(()=>{if(!z)return null;let g=new A.Box3().setFromObject(z);if(g.isEmpty())return null;let T=g.getSize(new A.Vector3);return{y:g.min.y,center:g.getCenter(new A.Vector3),size:Math.max(T.x,T.y,T.z)}},[z]),Sa=(0,h.useCallback)((g,T)=>{Ye($=>({...$,[g]:T}))},[]);(0,h.useEffect)(()=>{Ye(g=>({...g,backgroundColor:d}))},[d]),(0,h.useEffect)(()=>{ue()},[k,ue]);let Aa=(0,h.useCallback)(g=>{vn(g)},[]),Ea=(0,h.useCallback)(g=>{St(g),Ge(!1);let T=ht(g);gn(T>ut?T:null),At(!1),je(null),un?.(mr(g))},[un]),Ta=(0,h.useCallback)(g=>{Ge(!0),Et(g),je(null),Ve?.(g)},[Ve]),Ca=(0,h.useCallback)(g=>{g.lengthComputable&&g.total>0&&je(g.loaded/g.total*100)},[]),Nn=(0,h.useCallback)(g=>{if(bn(g),!v)return;let T=pn.current[g];!T||!te.current||te.current.fitToBox(T,!0,{paddingTop:.5,paddingBottom:.5,paddingLeft:.5,paddingRight:.5}).catch(()=>{})},[v]),Pa=(0,h.useCallback)(g=>{xn(T=>{let $=new Set(T);return $.has(g)?$.delete(g):$.add(g),$})},[]),La=(0,h.useCallback)(g=>{!p||!xt(g.dataTransfer)||(g.preventDefault(),g.stopPropagation(),Le.current+=1,qe(!0))},[p]),Ra=(0,h.useCallback)(g=>{!p||!xt(g.dataTransfer)||(g.preventDefault(),g.stopPropagation(),g.dataTransfer.dropEffect="copy",qe(!0))},[p]),Da=(0,h.useCallback)(g=>{!p||!xt(g.dataTransfer)||(g.preventDefault(),g.stopPropagation(),Le.current=Math.max(0,Le.current-1),Le.current===0&&qe(!1))},[p]),Ia=(0,h.useCallback)(g=>{!p||!xt(g.dataTransfer)||(g.preventDefault(),g.stopPropagation(),Le.current=0,qe(!1),Rt(g.dataTransfer.files))},[p,Rt]),Na=y&&(Tn||!!(k&&ae.live&&!En&&(!z||!We)));return(0,c.jsxs)("div",{className:"smv-root",role:"region","aria-label":e??X("modelViewer"),"aria-labelledby":t,ref:Ln,"data-reduced-motion":Fe?"":void 0,style:{background:E.backgroundColor},onDragEnter:La,onDragOver:Ra,onDragLeave:Da,onDrop:Ia,children:[_&&k&&(0,c.jsx)(ys,{isOpen:_a,onToggle:xa,environmentUrl:M,environmentEnabled:f,settings:E,modelInfo:wa,onReset:()=>Ye(Xe),onChange:Sa}),(0,c.jsxs)("div",{className:"smv-canvasArea",children:[b&&En&&k&&(0,c.jsxs)("div",{className:"smv-load-error",role:"alert",children:[(0,c.jsx)("strong",{children:X("loadErrorTitle")}),(0,c.jsx)("p",{children:nr(da,k,s,ia).detail}),(0,c.jsx)("button",{type:"button",onClick:()=>{he(k),ue(),ha(g=>g+1)},children:X("retryModelLoad")})]}),P&&z&&We&&(0,c.jsx)("button",{type:"button",className:"smv-reset-camera",onClick:()=>{let g=te.current,T=He.current;!g||!T||g.setLookAt(...T.position,...T.target,!1).then(()=>_t(g,z,Pn,!Fe)).catch(()=>{})},children:X("resetCameraView")}),mn!==null&&!oa&&(0,c.jsxs)("div",{className:"smv-largeModelBanner",children:[(0,c.jsx)(D.AlertTriangle,{size:14,className:"smv-largeModelBanner__icon"}),(0,c.jsx)("span",{children:X("simpleLargeModelWarning",{millions:Math.round(mn/1e6)})}),(0,c.jsx)("button",{type:"button",className:"smv-largeModelBanner__dismiss",onClick:()=>At(!0),"aria-label":X("dismiss"),children:(0,c.jsx)(D.X,{size:12})})]}),p?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("input",{ref:fn,type:"file",accept:Yn,className:"smv-upload-input",onChange:g=>{Rt(g.target.files),g.currentTarget.value=""}}),k?(0,c.jsx)("div",{className:"smv-upload-toolbar",children:(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{className:"smv-upload-toolbar__name",children:ca??X("uploadedModel")}),(0,c.jsxs)("button",{type:"button",className:"smv-upload-toolbar__button smv-upload-toolbar__button--ghost",onClick:ya,children:[(0,c.jsx)(D.Trash2,{size:14}),X("clear")]})]})}):null]}):null,k&&!ae.live?(0,c.jsx)(Xr,{className:"ri-viewerPlaceholder--inset",background:E.backgroundColor,poster:xe??r,onReveal:ae.awaitingReveal?ae.reveal:void 0}):k?(0,c.jsxs)(ta.Canvas,{dpr:[1,2],frameloop:ae.visible?"demand":"never",resize:{debounce:0,scroll:!1},raycaster:{firstHitOnly:!0},style:{background:E.backgroundColor},camera:{position:[0,0,5],fov:45,near:.1,far:1e3},children:[(0,c.jsx)(Kr,{captureRef:Ct}),(0,c.jsx)($r,{}),(0,c.jsxs)(h.Suspense,{fallback:null,children:[(0,c.jsx)("ambientLight",{intensity:E.ambientIntensity,color:E.ambientColor}),(0,c.jsx)("directionalLight",{position:[-4,5,7],intensity:E.directionalIntensity,color:E.directionalColor,castShadow:!0}),(0,c.jsx)("directionalLight",{position:[-5,5,5],intensity:.5}),f&&(0,c.jsx)(Mt,{children:(0,c.jsxs)(h.Suspense,{fallback:null,children:[(0,c.jsx)(Gi,{...M?{files:M}:{preset:E.envPreset},background:E.backgroundEnabled,environmentIntensity:E.envIntensity,backgroundIntensity:E.envIntensity,backgroundBlurriness:E.backgroundBlur}),(0,c.jsx)(Ai,{})]})},M??E.envPreset),(0,c.jsx)(Ei,{rotation:E.envRotation}),(0,c.jsx)(_s,{scene:z,exposure:E.exposure,toneMapping:E.toneMapping,fov:E.fov,wireframe:E.wireframe}),(0,c.jsx)(xs,{enabled:E.autoRotate,speed:E.autoRotateSpeed,controlsRef:te}),E.groundShadow&&be&&(0,c.jsx)(Si,{position:[be.center.x,be.y,be.center.z],scale:be.size*2,opacity:E.groundShadowOpacity,blur:2,far:be.size,resolution:1024,color:"#000000"}),E.showFloorGrid&&(0,c.jsx)(bi,{getTarget:ba,revision:z,lineColor:Ma}),(0,c.jsx)(Mt,{onLoadError:Ta,children:(0,c.jsx)(h.Suspense,{fallback:null,children:(0,c.jsx)(gs,{url:k,format:wn?void 0:s,dracoDecoderPath:l,ktx2TranscoderPath:o,meshopt:u,hiddenKeys:_n,selectedKey:yn,panelHoveredKey:la,nodeRefsOut:pn,onMeshesReady:Aa,onModelLoaded:Ea,onLoadProgress:Ca,onMeshClick:Nn,highlightOnHover:x})})},`${k}:${ua}`),(0,c.jsx)(vs,{scene:z,controlsRef:te,refitOnResize:S,onInitialFitComplete:()=>{let g=te.current;g&&!He.current&&(He.current={position:g.getPosition(new A.Vector3).toArray(),target:g.getTarget(new A.Vector3).toArray()}),Tt(!0)},cameraLimits:U,resumeViewRef:Pt,framing:Pn}),(0,c.jsx)(ea.CameraControls,{ref:te,makeDefault:!0,smoothTime:Fe?0:.3}),(0,c.jsx)(Ui,{controlsRef:te,zoom:B,pageScroll:j})]})]}):(0,c.jsx)("div",{className:"smv-upload-empty-state",style:{background:E.backgroundColor},children:(0,c.jsxs)("div",{className:"smv-upload-empty-state__card",children:[(0,c.jsx)("div",{className:"smv-upload-empty-state__icon",children:(0,c.jsx)(D.Upload,{size:24})}),(0,c.jsx)("p",{className:"smv-upload-empty-state__body",children:X("dropModelHint",{formats:".glb, .gltf, .obj, .fbx, .usdz, .stl, .ply, .zip"})}),(0,c.jsxs)("button",{type:"button",className:"smv-upload-empty-state__button",onClick:()=>fn.current?.click(),children:[(0,c.jsx)(D.Upload,{size:15}),X("chooseModel")]})]})}),k&&ae.live?(0,c.jsx)(Ft,{src:xe??r,hidden:!!(z&&We)}):null,(0,c.jsx)(Or,{visible:Na,message:X("loadingModel"),progress:Tn?void 0:fa??void 0,background:E.backgroundColor,seeThrough:!!(xe??r)}),p&&ma?(0,c.jsx)("div",{className:"smv-upload-drop-overlay",children:(0,c.jsxs)("div",{className:"smv-upload-drop-overlay__card",children:[(0,c.jsx)(D.Upload,{size:20}),(0,c.jsx)("span",{children:X("releaseToLoadYourModel")})]})}):null]}),m&&k&&(0,c.jsx)(Ms,{meshKeys:sa,hiddenKeys:_n,selectedKey:yn,isOpen:ga,onToggle:va,onFocus:Nn,onHover:Mn,onToggleVisibility:Pa})]})}0&&(module.exports={DEFAULT_MODEL_VIEWER_LABELS,SimpleModelViewer});
|