@viamrobotics/motion-tools 1.15.8 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/attribute.d.ts +3 -2
  2. package/dist/attribute.js +24 -16
  3. package/dist/buf/draw/v1/drawing_pb.d.ts +33 -16
  4. package/dist/buf/draw/v1/drawing_pb.js +35 -17
  5. package/dist/buf/draw/v1/metadata_pb.d.ts +44 -3
  6. package/dist/buf/draw/v1/metadata_pb.js +54 -3
  7. package/dist/buf/draw/v1/scene_pb.d.ts +6 -6
  8. package/dist/buf/draw/v1/scene_pb.js +7 -7
  9. package/dist/buffer.d.ts +54 -45
  10. package/dist/buffer.js +91 -57
  11. package/dist/color.d.ts +1 -2
  12. package/dist/color.js +5 -12
  13. package/dist/components/App.svelte +18 -3
  14. package/dist/components/App.svelte.d.ts +15 -2
  15. package/dist/components/Entities/Arrows/ArrowGroups.svelte +5 -6
  16. package/dist/components/Entities/Arrows/Arrows.svelte +9 -0
  17. package/dist/components/Entities/Entities.svelte +18 -1
  18. package/dist/components/Entities/Frame.svelte +7 -1
  19. package/dist/components/Entities/GLTF.svelte +13 -2
  20. package/dist/components/Entities/Line.svelte +46 -18
  21. package/dist/components/Entities/LineDots.svelte +38 -8
  22. package/dist/components/Entities/LineDots.svelte.d.ts +2 -2
  23. package/dist/components/Entities/LineGeometry.svelte +2 -1
  24. package/dist/components/Entities/LineGeometry.svelte.d.ts +2 -0
  25. package/dist/components/Entities/Mesh.svelte +8 -1
  26. package/dist/components/Entities/Points.svelte +22 -11
  27. package/dist/components/Entities/hooks/useEntityEvents.svelte.js +6 -2
  28. package/dist/components/FileDrop/FileDrop.svelte +5 -1
  29. package/dist/components/KeyboardControls.svelte +2 -10
  30. package/dist/components/PCD.svelte +11 -4
  31. package/dist/components/PCD.svelte.d.ts +3 -1
  32. package/dist/components/SceneProviders.svelte +2 -0
  33. package/dist/components/Selected.svelte +2 -12
  34. package/dist/components/{Lasso → Selection}/Debug.svelte +8 -8
  35. package/dist/components/{Lasso → Selection}/Debug.svelte.d.ts +2 -2
  36. package/dist/components/Selection/Ellipse.svelte +294 -0
  37. package/dist/components/Selection/Ellipse.svelte.d.ts +7 -0
  38. package/dist/components/{Lasso → Selection}/Lasso.svelte +33 -61
  39. package/dist/components/{Lasso → Selection}/Lasso.svelte.d.ts +1 -0
  40. package/dist/components/Selection/Tool.svelte +94 -0
  41. package/dist/components/{Lasso → Selection}/Tool.svelte.d.ts +2 -2
  42. package/dist/components/{Lasso → Selection}/traits.d.ts +11 -2
  43. package/dist/components/{Lasso → Selection}/traits.js +7 -2
  44. package/dist/components/Selection/useSelectionPlugin.svelte.d.ts +8 -0
  45. package/dist/components/Selection/useSelectionPlugin.svelte.js +24 -0
  46. package/dist/components/Selection/utils.d.ts +5 -0
  47. package/dist/components/Selection/utils.js +38 -0
  48. package/dist/components/Snapshot.svelte +4 -2
  49. package/dist/components/overlay/AddRelationship.svelte +1 -2
  50. package/dist/components/overlay/AddRelationship.svelte.d.ts +1 -1
  51. package/dist/components/overlay/Details.svelte +12 -12
  52. package/dist/components/overlay/Details.svelte.d.ts +8 -1
  53. package/dist/components/overlay/settings/Settings.svelte +8 -1
  54. package/dist/components/xr/OriginMarker.svelte +94 -17
  55. package/dist/components/xr/XR.svelte +1 -1
  56. package/dist/draw.d.ts +13 -0
  57. package/dist/draw.js +428 -0
  58. package/dist/ecs/traits.d.ts +31 -13
  59. package/dist/ecs/traits.js +25 -8
  60. package/dist/geometry.js +3 -0
  61. package/dist/hooks/useDrawAPI.svelte.js +61 -24
  62. package/dist/hooks/useDrawService.svelte.d.ts +12 -0
  63. package/dist/hooks/useDrawService.svelte.js +240 -0
  64. package/dist/hooks/usePointcloudObjects.svelte.js +7 -2
  65. package/dist/hooks/usePointclouds.svelte.js +7 -2
  66. package/dist/hooks/useSettings.svelte.d.ts +3 -2
  67. package/dist/hooks/useSettings.svelte.js +2 -2
  68. package/dist/hooks/useWorldState.svelte.js +5 -52
  69. package/dist/index.d.ts +9 -1
  70. package/dist/index.js +10 -1
  71. package/dist/lib.d.ts +2 -0
  72. package/dist/lib.js +2 -0
  73. package/dist/loaders/pcd/index.d.ts +1 -1
  74. package/dist/loaders/pcd/messages.d.ts +2 -2
  75. package/dist/loaders/pcd/worker.inline.d.ts +1 -1
  76. package/dist/loaders/pcd/worker.inline.js +229 -187
  77. package/dist/loaders/pcd/worker.js +2 -2
  78. package/dist/metadata.d.ts +9 -15
  79. package/dist/metadata.js +45 -9
  80. package/dist/plugins/bvh.svelte.js +6 -2
  81. package/dist/snapshot.d.ts +3 -9
  82. package/dist/snapshot.js +11 -204
  83. package/dist/three/InstancedArrows/InstancedArrows.js +3 -2
  84. package/package.json +14 -11
  85. package/dist/components/Lasso/Tool.svelte +0 -108
  86. package/dist/components/xr/Hands.svelte +0 -23
  87. package/dist/components/xr/Hands.svelte.d.ts +0 -18
@@ -1,7 +1,7 @@
1
1
  // AUTO-GENERATED by scripts/build-workers.js - do not edit
2
- export const workerCode = `"use strict";(()=>{var Kn=1;var Qn=3,Kt=0;var Qt=1;var jt=100;var en=204,tn=205;var vn=0,yn=1,Mn=2,We=3,Sn=4,bn=5,An=6,Tn=7,jn=0,ei=1,ti=2;var En=1,wn=2,Cn=3,Rn=4,In=5,Pn=6,Ln=7;var Dn=300,ni=301,Un=302;var ii=306,nn=1e3,Ge=1001,sn=1002;var si=1006;var ri=1008;var ai=1009;var oi=1015;var li=1023;var Xe=2300,yt=2301,xt=2302,rn=2400,an=2401,on=2402;var Nn="",G="srgb",ln="srgb-linear",cn="linear",vt="srgb";var Me=7680;var hn=519;var un=35044;var He=2e3,dn=2001;function ci(p){for(let e=p.length-1;e>=0;--e)if(p[e]>=65535)return!0;return!1}function pi(p){return ArrayBuffer.isView(p)&&!(p instanceof DataView)}function fn(p){return document.createElementNS("http://www.w3.org/1999/xhtml",p)}var Bn={},Mt=null;function N(...p){let e="THREE."+p.shift();Mt?Mt("warn",e,...p):console.warn(e,...p)}function L(...p){let e="THREE."+p.shift();Mt?Mt("error",e,...p):console.error(e,...p)}function pn(...p){let e=p.join(" ");e in Bn||(Bn[e]=!0,N(...p))}var Se=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let s=0,r=i.length;s<r;s++)i[s].call(this,e);e.target=null}}},V=["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 xa=Math.PI/180,mi=180/Math.PI;function Qe(){let p=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(V[p&255]+V[p>>8&255]+V[p>>16&255]+V[p>>24&255]+"-"+V[e&255]+V[e>>8&255]+"-"+V[e>>16&15|64]+V[e>>24&255]+"-"+V[t&63|128]+V[t>>8&255]+"-"+V[t>>16&255]+V[t>>24&255]+V[n&255]+V[n>>8&255]+V[n>>16&255]+V[n>>24&255]).toLowerCase()}function R(p,e,t){return Math.max(e,Math.min(t,p))}function gi(p,e){return(p%e+e)%e}function Bt(p,e,t){return(1-t)*p+t*e}function Oe(p,e){switch(e.constructor){case Float32Array:return p;case Uint32Array:return p/4294967295;case Uint16Array:return p/65535;case Uint8Array:return p/255;case Int32Array:return Math.max(p/2147483647,-1);case Int16Array:return Math.max(p/32767,-1);case Int8Array:return Math.max(p/127,-1);default:throw new Error("Invalid component type.")}}function X(p,e){switch(e.constructor){case Float32Array:return p;case Uint32Array:return Math.round(p*4294967295);case Uint16Array:return Math.round(p*65535);case Uint8Array:return Math.round(p*255);case Int32Array:return Math.round(p*2147483647);case Int16Array:return Math.round(p*32767);case Int8Array:return Math.round(p*127);default:throw new Error("Invalid component type.")}}var H=class p{constructor(e=0,t=0){p.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=R(this.x,e.x,t.x),this.y=R(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=R(this.x,e,t),this.y=R(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(R(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(R(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,r=this.y-e.y;return this.x=s*n-r*i+e.x,this.y=s*i+r*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},ae=class{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,r,a){let l=n[i+0],o=n[i+1],c=n[i+2],u=n[i+3],f=s[r+0],d=s[r+1],h=s[r+2],m=s[r+3];if(a<=0){e[t+0]=l,e[t+1]=o,e[t+2]=c,e[t+3]=u;return}if(a>=1){e[t+0]=f,e[t+1]=d,e[t+2]=h,e[t+3]=m;return}if(u!==m||l!==f||o!==d||c!==h){let _=l*f+o*d+c*h+u*m;_<0&&(f=-f,d=-d,h=-h,m=-m,_=-_);let g=1-a;if(_<.9995){let y=Math.acos(_),v=Math.sin(y);g=Math.sin(g*y)/v,a=Math.sin(a*y)/v,l=l*g+f*a,o=o*g+d*a,c=c*g+h*a,u=u*g+m*a}else{l=l*g+f*a,o=o*g+d*a,c=c*g+h*a,u=u*g+m*a;let y=1/Math.sqrt(l*l+o*o+c*c+u*u);l*=y,o*=y,c*=y,u*=y}}e[t]=l,e[t+1]=o,e[t+2]=c,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,s,r){let a=n[i],l=n[i+1],o=n[i+2],c=n[i+3],u=s[r],f=s[r+1],d=s[r+2],h=s[r+3];return e[t]=a*h+c*u+l*d-o*f,e[t+1]=l*h+c*f+o*u-a*d,e[t+2]=o*h+c*d+a*f-l*u,e[t+3]=c*h-a*u-l*f-o*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,i=e._y,s=e._z,r=e._order,a=Math.cos,l=Math.sin,o=a(n/2),c=a(i/2),u=a(s/2),f=l(n/2),d=l(i/2),h=l(s/2);switch(r){case"XYZ":this._x=f*c*u+o*d*h,this._y=o*d*u-f*c*h,this._z=o*c*h+f*d*u,this._w=o*c*u-f*d*h;break;case"YXZ":this._x=f*c*u+o*d*h,this._y=o*d*u-f*c*h,this._z=o*c*h-f*d*u,this._w=o*c*u+f*d*h;break;case"ZXY":this._x=f*c*u-o*d*h,this._y=o*d*u+f*c*h,this._z=o*c*h+f*d*u,this._w=o*c*u-f*d*h;break;case"ZYX":this._x=f*c*u-o*d*h,this._y=o*d*u+f*c*h,this._z=o*c*h-f*d*u,this._w=o*c*u+f*d*h;break;case"YZX":this._x=f*c*u+o*d*h,this._y=o*d*u+f*c*h,this._z=o*c*h-f*d*u,this._w=o*c*u-f*d*h;break;case"XZY":this._x=f*c*u-o*d*h,this._y=o*d*u-f*c*h,this._z=o*c*h+f*d*u,this._w=o*c*u+f*d*h;break;default:N("Quaternion: .setFromEuler() encountered an unknown order: "+r)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],s=t[8],r=t[1],a=t[5],l=t[9],o=t[2],c=t[6],u=t[10],f=n+a+u;if(f>0){let d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(c-l)*d,this._y=(s-o)*d,this._z=(r-i)*d}else if(n>a&&n>u){let d=2*Math.sqrt(1+n-a-u);this._w=(c-l)/d,this._x=.25*d,this._y=(i+r)/d,this._z=(s+o)/d}else if(a>u){let d=2*Math.sqrt(1+a-n-u);this._w=(s-o)/d,this._x=(i+r)/d,this._y=.25*d,this._z=(l+c)/d}else{let d=2*Math.sqrt(1+u-n-a);this._w=(r-i)/d,this._x=(s+o)/d,this._y=(l+c)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(R(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,i=e._y,s=e._z,r=e._w,a=t._x,l=t._y,o=t._z,c=t._w;return this._x=n*c+r*a+i*o-s*l,this._y=i*c+r*l+s*a-n*o,this._z=s*c+r*o+n*l-i*a,this._w=r*c-n*a-i*l-s*o,this._onChangeCallback(),this}slerp(e,t){if(t<=0)return this;if(t>=1)return this.copy(e);let n=e._x,i=e._y,s=e._z,r=e._w,a=this.dot(e);a<0&&(n=-n,i=-i,s=-s,r=-r,a=-a);let l=1-t;if(a<.9995){let o=Math.acos(a),c=Math.sin(o);l=Math.sin(l*o)/c,t=Math.sin(t*o)/c,this._x=this._x*l+n*t,this._y=this._y*l+i*t,this._z=this._z*l+s*t,this._w=this._w*l+r*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+i*t,this._z=this._z*l+s*t,this._w=this._w*l+r*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},x=class p{constructor(e=0,t=0,n=0){p.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(zn.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(zn.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,s=e.elements,r=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*r,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*r,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*r,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,s=e.x,r=e.y,a=e.z,l=e.w,o=2*(r*i-a*n),c=2*(a*t-s*i),u=2*(s*n-r*t);return this.x=t+l*o+r*u-a*c,this.y=n+l*c+a*o-s*u,this.z=i+l*u+s*c-r*o,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=R(this.x,e.x,t.x),this.y=R(this.y,e.y,t.y),this.z=R(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=R(this.x,e,t),this.y=R(this.y,e,t),this.z=R(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(R(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,s=e.z,r=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*r-n*l,this.z=n*a-i*r,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return zt.copy(this).projectOnVector(e),this.sub(zt)}reflect(e){return this.sub(zt.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(R(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},zt=new x,zn=new ae,w=class p{constructor(e,t,n,i,s,r,a,l,o){p.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,r,a,l,o)}set(e,t,n,i,s,r,a,l,o){let c=this.elements;return c[0]=e,c[1]=i,c[2]=a,c[3]=t,c[4]=s,c[5]=l,c[6]=n,c[7]=r,c[8]=o,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,s=this.elements,r=n[0],a=n[3],l=n[6],o=n[1],c=n[4],u=n[7],f=n[2],d=n[5],h=n[8],m=i[0],_=i[3],g=i[6],y=i[1],v=i[4],b=i[7],S=i[2],E=i[5],T=i[8];return s[0]=r*m+a*y+l*S,s[3]=r*_+a*v+l*E,s[6]=r*g+a*b+l*T,s[1]=o*m+c*y+u*S,s[4]=o*_+c*v+u*E,s[7]=o*g+c*b+u*T,s[2]=f*m+d*y+h*S,s[5]=f*_+d*v+h*E,s[8]=f*g+d*b+h*T,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],l=e[6],o=e[7],c=e[8];return t*r*c-t*a*o-n*s*c+n*a*l+i*s*o-i*r*l}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],l=e[6],o=e[7],c=e[8],u=c*r-a*o,f=a*l-c*s,d=o*s-r*l,h=t*u+n*f+i*d;if(h===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/h;return e[0]=u*m,e[1]=(i*o-c*n)*m,e[2]=(a*n-i*r)*m,e[3]=f*m,e[4]=(c*t-i*l)*m,e[5]=(i*s-a*t)*m,e[6]=d*m,e[7]=(n*l-o*t)*m,e[8]=(r*t-n*s)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,r,a){let l=Math.cos(s),o=Math.sin(s);return this.set(n*l,n*o,-n*(l*r+o*a)+r+e,-i*o,i*l,-i*(-o*r+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Vt.makeScale(e,t)),this}rotate(e){return this.premultiply(Vt.makeRotation(-e)),this}translate(e,t){return this.premultiply(Vt.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},Vt=new w,Vn=new w().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),kn=new w().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function _i(){let p={enabled:!0,workingColorSpace:ln,spaces:{},convert:function(i,s,r){return this.enabled===!1||s===r||!s||!r||(this.spaces[s].transfer===vt&&(i.r=re(i.r),i.g=re(i.g),i.b=re(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===vt&&(i.r=De(i.r),i.g=De(i.g),i.b=De(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===Nn?cn: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 pn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),p.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return pn("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),p.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return p.define({[ln]:{primaries:e,whitePoint:n,transfer:cn,toXYZ:Vn,fromXYZ:kn,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:G},outputColorSpaceConfig:{drawingBufferColorSpace:G}},[G]:{primaries:e,whitePoint:n,transfer:vt,toXYZ:Vn,fromXYZ:kn,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:G}}}),p}var \$=_i();function re(p){return p<.04045?p*.0773993808:Math.pow(p*.9478672986+.0521327014,2.4)}function De(p){return p<.0031308?p*12.92:1.055*Math.pow(p,.41666)-.055}var Te,St=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Te===void 0&&(Te=fn("canvas")),Te.width=e.width,Te.height=e.height;let i=Te.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Te}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=fn("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let r=0;r<s.length;r++)s[r]=re(s[r]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(re(t[n]/255)*255):t[n]=re(t[n]);return{data:t,width:e.width,height:e.height}}else return N("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},xi=0,bt=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:xi++}),this.uuid=Qe(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.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,a=i.length;r<a;r++)i[r].isDataTexture?s.push(kt(i[r].image)):s.push(kt(i[r]))}else s=kt(i);n.url=s}return t||(e.images[this.uuid]=n),n}};function kt(p){return typeof HTMLImageElement<"u"&&p instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&p instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&p instanceof ImageBitmap?St.getDataURL(p):p.data?{data:Array.from(p.data),width:p.width,height:p.height,type:p.data.constructor.name}:(N("Texture: Unable to serialize Texture."),{})}var vi=0,Gt=new x,Ue=class p extends Se{constructor(e=p.DEFAULT_IMAGE,t=p.DEFAULT_MAPPING,n=Ge,i=Ge,s=si,r=ri,a=li,l=ai,o=p.DEFAULT_ANISOTROPY,c=Nn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:vi++}),this.uuid=Qe(),this.name="",this.source=new bt(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=r,this.anisotropy=o,this.format=a,this.internalFormat=null,this.type=l,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 w,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Gt).x}get height(){return this.source.getSize(Gt).y}get depth(){return this.source.getSize(Gt).z}get image(){return this.source.data}set image(e=null){this.source.data=e}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(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){N(\`Texture.setValues(): parameter '\${t}' has value of undefined.\`);continue}let i=this[t];if(i===void 0){N(\`Texture.setValues(): property '\${t}' 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[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Dn)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case nn:e.x=e.x-Math.floor(e.x);break;case Ge:e.x=e.x<0?0:1;break;case sn:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case nn:e.y=e.y-Math.floor(e.y);break;case Ge:e.y=e.y<0?0:1;break;case sn:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Ue.DEFAULT_IMAGE=null;Ue.DEFAULT_MAPPING=Dn;Ue.DEFAULT_ANISOTROPY=1;var me=class{constructor(e=new x(1/0,1/0,1/0),t=new x(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(K.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(K.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=K.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let r=0,a=s.count;r<a;r++)e.isMesh===!0?e.getVertexPosition(r,K):K.fromBufferAttribute(s,r),K.applyMatrix4(e.matrixWorld),this.expandByPoint(K);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),at.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),at.copy(n.boundingBox)),at.applyMatrix4(e.matrixWorld),this.union(at)}let i=e.children;for(let s=0,r=i.length;s<r;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,K),K.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Be),ot.subVectors(this.max,Be),Ee.subVectors(e.a,Be),we.subVectors(e.b,Be),Ce.subVectors(e.c,Be),he.subVectors(we,Ee),ue.subVectors(Ce,we),ve.subVectors(Ee,Ce);let t=[0,-he.z,he.y,0,-ue.z,ue.y,0,-ve.z,ve.y,he.z,0,-he.x,ue.z,0,-ue.x,ve.z,0,-ve.x,-he.y,he.x,0,-ue.y,ue.x,0,-ve.y,ve.x,0];return!Ht(t,Ee,we,Ce,ot)||(t=[1,0,0,0,1,0,0,0,1],!Ht(t,Ee,we,Ce,ot))?!1:(lt.crossVectors(he,ue),t=[lt.x,lt.y,lt.z],Ht(t,Ee,we,Ce,ot))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,K).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(K).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(te[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),te[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),te[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),te[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),te[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),te[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),te[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),te[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(te),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},te=[new x,new x,new x,new x,new x,new x,new x,new x],K=new x,at=new me,Ee=new x,we=new x,Ce=new x,he=new x,ue=new x,ve=new x,Be=new x,ot=new x,lt=new x,ye=new x;function Ht(p,e,t,n,i){for(let s=0,r=p.length-3;s<=r;s+=3){ye.fromArray(p,s);let a=i.x*Math.abs(ye.x)+i.y*Math.abs(ye.y)+i.z*Math.abs(ye.z),l=e.dot(ye),o=t.dot(ye),c=n.dot(ye);if(Math.max(-Math.max(l,o,c),Math.min(l,o,c))>a)return!1}return!0}var yi=new me,ze=new x,Wt=new x,qe=class{constructor(e=new x,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):yi.setFromPoints(e).getCenter(n);let i=0;for(let s=0,r=e.length;s<r;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ze.subVectors(e,this.center);let t=ze.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ze,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Wt.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ze.copy(e.center).add(Wt)),this.expandByPoint(ze.copy(e.center).sub(Wt))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},ne=new x,Xt=new x,ct=new x,de=new x,qt=new x,ht=new x,Yt=new x,At=class{constructor(e=new x,t=new x(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ne)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=ne.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ne.copy(this.origin).addScaledVector(this.direction,t),ne.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Xt.copy(e).add(t).multiplyScalar(.5),ct.copy(t).sub(e).normalize(),de.copy(this.origin).sub(Xt);let s=e.distanceTo(t)*.5,r=-this.direction.dot(ct),a=de.dot(this.direction),l=-de.dot(ct),o=de.lengthSq(),c=Math.abs(1-r*r),u,f,d,h;if(c>0)if(u=r*l-a,f=r*a-l,h=s*c,u>=0)if(f>=-h)if(f<=h){let m=1/c;u*=m,f*=m,d=u*(u+r*f+2*a)+f*(r*u+f+2*l)+o}else f=s,u=Math.max(0,-(r*f+a)),d=-u*u+f*(f+2*l)+o;else f=-s,u=Math.max(0,-(r*f+a)),d=-u*u+f*(f+2*l)+o;else f<=-h?(u=Math.max(0,-(-r*s+a)),f=u>0?-s:Math.min(Math.max(-s,-l),s),d=-u*u+f*(f+2*l)+o):f<=h?(u=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+o):(u=Math.max(0,-(r*s+a)),f=u>0?s:Math.min(Math.max(-s,-l),s),d=-u*u+f*(f+2*l)+o);else f=r>0?-s:s,u=Math.max(0,-(r*f+a)),d=-u*u+f*(f+2*l)+o;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(Xt).addScaledVector(ct,f),d}intersectSphere(e,t){ne.subVectors(e.center,this.origin);let n=ne.dot(this.direction),i=ne.dot(ne)-n*n,s=e.radius*e.radius;if(i>s)return null;let r=Math.sqrt(s-i),a=n-r,l=n+r;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,r,a,l,o=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,f=this.origin;return o>=0?(n=(e.min.x-f.x)*o,i=(e.max.x-f.x)*o):(n=(e.max.x-f.x)*o,i=(e.min.x-f.x)*o),c>=0?(s=(e.min.y-f.y)*c,r=(e.max.y-f.y)*c):(s=(e.max.y-f.y)*c,r=(e.min.y-f.y)*c),n>r||s>i||((s>n||isNaN(n))&&(n=s),(r<i||isNaN(i))&&(i=r),u>=0?(a=(e.min.z-f.z)*u,l=(e.max.z-f.z)*u):(a=(e.max.z-f.z)*u,l=(e.min.z-f.z)*u),n>l||a>i)||((a>n||n!==n)&&(n=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,ne)!==null}intersectTriangle(e,t,n,i,s){qt.subVectors(t,e),ht.subVectors(n,e),Yt.crossVectors(qt,ht);let r=this.direction.dot(Yt),a;if(r>0){if(i)return null;a=1}else if(r<0)a=-1,r=-r;else return null;de.subVectors(this.origin,e);let l=a*this.direction.dot(ht.crossVectors(de,ht));if(l<0)return null;let o=a*this.direction.dot(qt.cross(de));if(o<0||l+o>r)return null;let c=-a*de.dot(Yt);return c<0?null:this.at(c/r,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},j=class p{constructor(e,t,n,i,s,r,a,l,o,c,u,f,d,h,m,_){p.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,r,a,l,o,c,u,f,d,h,m,_)}set(e,t,n,i,s,r,a,l,o,c,u,f,d,h,m,_){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=s,g[5]=r,g[9]=a,g[13]=l,g[2]=o,g[6]=c,g[10]=u,g[14]=f,g[3]=d,g[7]=h,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 p().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();let t=this.elements,n=e.elements,i=1/Re.setFromMatrixColumn(e,0).length(),s=1/Re.setFromMatrixColumn(e,1).length(),r=1/Re.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*r,t[9]=n[9]*r,t[10]=n[10]*r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,i=e.y,s=e.z,r=Math.cos(n),a=Math.sin(n),l=Math.cos(i),o=Math.sin(i),c=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){let f=r*c,d=r*u,h=a*c,m=a*u;t[0]=l*c,t[4]=-l*u,t[8]=o,t[1]=d+h*o,t[5]=f-m*o,t[9]=-a*l,t[2]=m-f*o,t[6]=h+d*o,t[10]=r*l}else if(e.order==="YXZ"){let f=l*c,d=l*u,h=o*c,m=o*u;t[0]=f+m*a,t[4]=h*a-d,t[8]=r*o,t[1]=r*u,t[5]=r*c,t[9]=-a,t[2]=d*a-h,t[6]=m+f*a,t[10]=r*l}else if(e.order==="ZXY"){let f=l*c,d=l*u,h=o*c,m=o*u;t[0]=f-m*a,t[4]=-r*u,t[8]=h+d*a,t[1]=d+h*a,t[5]=r*c,t[9]=m-f*a,t[2]=-r*o,t[6]=a,t[10]=r*l}else if(e.order==="ZYX"){let f=r*c,d=r*u,h=a*c,m=a*u;t[0]=l*c,t[4]=h*o-d,t[8]=f*o+m,t[1]=l*u,t[5]=m*o+f,t[9]=d*o-h,t[2]=-o,t[6]=a*l,t[10]=r*l}else if(e.order==="YZX"){let f=r*l,d=r*o,h=a*l,m=a*o;t[0]=l*c,t[4]=m-f*u,t[8]=h*u+d,t[1]=u,t[5]=r*c,t[9]=-a*c,t[2]=-o*c,t[6]=d*u+h,t[10]=f-m*u}else if(e.order==="XZY"){let f=r*l,d=r*o,h=a*l,m=a*o;t[0]=l*c,t[4]=-u,t[8]=o*c,t[1]=f*u+m,t[5]=r*c,t[9]=d*u-h,t[2]=h*u-d,t[6]=a*c,t[10]=m*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Mi,e,Si)}lookAt(e,t,n){let i=this.elements;return q.subVectors(e,t),q.lengthSq()===0&&(q.z=1),q.normalize(),fe.crossVectors(n,q),fe.lengthSq()===0&&(Math.abs(n.z)===1?q.x+=1e-4:q.z+=1e-4,q.normalize(),fe.crossVectors(n,q)),fe.normalize(),ut.crossVectors(q,fe),i[0]=fe.x,i[4]=ut.x,i[8]=q.x,i[1]=fe.y,i[5]=ut.y,i[9]=q.y,i[2]=fe.z,i[6]=ut.z,i[10]=q.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,s=this.elements,r=n[0],a=n[4],l=n[8],o=n[12],c=n[1],u=n[5],f=n[9],d=n[13],h=n[2],m=n[6],_=n[10],g=n[14],y=n[3],v=n[7],b=n[11],S=n[15],E=i[0],T=i[4],A=i[8],P=i[12],O=i[1],U=i[5],le=i[9],z=i[13],ce=i[2],je=i[6],et=i[10],tt=i[14],nt=i[3],it=i[7],st=i[11],rt=i[15];return s[0]=r*E+a*O+l*ce+o*nt,s[4]=r*T+a*U+l*je+o*it,s[8]=r*A+a*le+l*et+o*st,s[12]=r*P+a*z+l*tt+o*rt,s[1]=c*E+u*O+f*ce+d*nt,s[5]=c*T+u*U+f*je+d*it,s[9]=c*A+u*le+f*et+d*st,s[13]=c*P+u*z+f*tt+d*rt,s[2]=h*E+m*O+_*ce+g*nt,s[6]=h*T+m*U+_*je+g*it,s[10]=h*A+m*le+_*et+g*st,s[14]=h*P+m*z+_*tt+g*rt,s[3]=y*E+v*O+b*ce+S*nt,s[7]=y*T+v*U+b*je+S*it,s[11]=y*A+v*le+b*et+S*st,s[15]=y*P+v*z+b*tt+S*rt,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],r=e[1],a=e[5],l=e[9],o=e[13],c=e[2],u=e[6],f=e[10],d=e[14],h=e[3],m=e[7],_=e[11],g=e[15],y=l*d-o*f,v=a*d-o*u,b=a*f-l*u,S=r*d-o*c,E=r*f-l*c,T=r*u-a*c;return t*(m*y-_*v+g*b)-n*(h*y-_*S+g*E)+i*(h*v-m*S+g*T)-s*(h*b-m*E+_*T)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],l=e[6],o=e[7],c=e[8],u=e[9],f=e[10],d=e[11],h=e[12],m=e[13],_=e[14],g=e[15],y=u*_*o-m*f*o+m*l*d-a*_*d-u*l*g+a*f*g,v=h*f*o-c*_*o-h*l*d+r*_*d+c*l*g-r*f*g,b=c*m*o-h*u*o+h*a*d-r*m*d-c*a*g+r*u*g,S=h*u*l-c*m*l-h*a*f+r*m*f+c*a*_-r*u*_,E=t*y+n*v+i*b+s*S;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let T=1/E;return e[0]=y*T,e[1]=(m*f*s-u*_*s-m*i*d+n*_*d+u*i*g-n*f*g)*T,e[2]=(a*_*s-m*l*s+m*i*o-n*_*o-a*i*g+n*l*g)*T,e[3]=(u*l*s-a*f*s-u*i*o+n*f*o+a*i*d-n*l*d)*T,e[4]=v*T,e[5]=(c*_*s-h*f*s+h*i*d-t*_*d-c*i*g+t*f*g)*T,e[6]=(h*l*s-r*_*s-h*i*o+t*_*o+r*i*g-t*l*g)*T,e[7]=(r*f*s-c*l*s+c*i*o-t*f*o-r*i*d+t*l*d)*T,e[8]=b*T,e[9]=(h*u*s-c*m*s-h*n*d+t*m*d+c*n*g-t*u*g)*T,e[10]=(r*m*s-h*a*s+h*n*o-t*m*o-r*n*g+t*a*g)*T,e[11]=(c*a*s-r*u*s-c*n*o+t*u*o+r*n*d-t*a*d)*T,e[12]=S*T,e[13]=(c*m*i-h*u*i+h*n*f-t*m*f-c*n*_+t*u*_)*T,e[14]=(h*a*i-r*m*i-h*n*l+t*m*l+r*n*_-t*a*_)*T,e[15]=(r*u*i-c*a*i+c*n*l-t*u*l-r*n*f+t*a*f)*T,this}scale(e){let t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),s=1-n,r=e.x,a=e.y,l=e.z,o=s*r,c=s*a;return this.set(o*r+n,o*a-i*l,o*l+i*a,0,o*a+i*l,c*a+n,c*l-i*r,0,o*l-i*a,c*l+i*r,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,r){return this.set(1,n,s,0,e,1,r,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,s=t._x,r=t._y,a=t._z,l=t._w,o=s+s,c=r+r,u=a+a,f=s*o,d=s*c,h=s*u,m=r*c,_=r*u,g=a*u,y=l*o,v=l*c,b=l*u,S=n.x,E=n.y,T=n.z;return i[0]=(1-(m+g))*S,i[1]=(d+b)*S,i[2]=(h-v)*S,i[3]=0,i[4]=(d-b)*E,i[5]=(1-(f+g))*E,i[6]=(_+y)*E,i[7]=0,i[8]=(h+v)*T,i[9]=(_-y)*T,i[10]=(1-(f+m))*T,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;if(e.x=i[12],e.y=i[13],e.z=i[14],this.determinant()===0)return n.set(1,1,1),t.identity(),this;let s=Re.set(i[0],i[1],i[2]).length(),r=Re.set(i[4],i[5],i[6]).length(),a=Re.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),Q.copy(this);let o=1/s,c=1/r,u=1/a;return Q.elements[0]*=o,Q.elements[1]*=o,Q.elements[2]*=o,Q.elements[4]*=c,Q.elements[5]*=c,Q.elements[6]*=c,Q.elements[8]*=u,Q.elements[9]*=u,Q.elements[10]*=u,t.setFromRotationMatrix(Q),n.x=s,n.y=r,n.z=a,this}makePerspective(e,t,n,i,s,r,a=He,l=!1){let o=this.elements,c=2*s/(t-e),u=2*s/(n-i),f=(t+e)/(t-e),d=(n+i)/(n-i),h,m;if(l)h=s/(r-s),m=r*s/(r-s);else if(a===He)h=-(r+s)/(r-s),m=-2*r*s/(r-s);else if(a===dn)h=-r/(r-s),m=-r*s/(r-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return o[0]=c,o[4]=0,o[8]=f,o[12]=0,o[1]=0,o[5]=u,o[9]=d,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=m,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,s,r,a=He,l=!1){let o=this.elements,c=2/(t-e),u=2/(n-i),f=-(t+e)/(t-e),d=-(n+i)/(n-i),h,m;if(l)h=1/(r-s),m=r/(r-s);else if(a===He)h=-2/(r-s),m=-(r+s)/(r-s);else if(a===dn)h=-1/(r-s),m=-s/(r-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return o[0]=c,o[4]=0,o[8]=0,o[12]=f,o[1]=0,o[5]=u,o[9]=0,o[13]=d,o[2]=0,o[6]=0,o[10]=h,o[14]=m,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},Re=new x,Q=new j,Mi=new x(0,0,0),Si=new x(1,1,1),fe=new x,ut=new x,q=new x,Gn=new j,Hn=new ae,Ye=class p{constructor(e=0,t=0,n=0,i=p.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,s=i[0],r=i[4],a=i[8],l=i[1],o=i[5],c=i[9],u=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(R(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(f,o),this._z=0);break;case"YXZ":this._x=Math.asin(-R(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,o)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(R(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-r,o)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-R(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-r,o));break;case"YZX":this._z=Math.asin(R(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,o),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-R(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(f,o),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-c,d),this._y=0);break;default:N("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Gn.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Gn,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Hn.setFromEuler(this),this.setFromQuaternion(Hn,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Ye.DEFAULT_ORDER="XYZ";var Tt=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},bi=0,Wn=new x,Ie=new ae,ie=new j,dt=new x,Ve=new x,Ai=new x,Ti=new ae,Xn=new x(1,0,0),qn=new x(0,1,0),Yn=new x(0,0,1),Zn={type:"added"},Ei={type:"removed"},Pe={type:"childadded",child:null},Zt={type:"childremoved",child:null},ge=class p extends Se{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:bi++}),this.uuid=Qe(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=p.DEFAULT_UP.clone();let e=new x,t=new Ye,n=new ae,i=new x(1,1,1);function s(){n.setFromEuler(t,!1)}function r(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new j},normalMatrix:{value:new w}}),this.matrix=new j,this.matrixWorld=new j,this.matrixAutoUpdate=p.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=p.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Tt,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Ie.setFromAxisAngle(e,t),this.quaternion.multiply(Ie),this}rotateOnWorldAxis(e,t){return Ie.setFromAxisAngle(e,t),this.quaternion.premultiply(Ie),this}rotateX(e){return this.rotateOnAxis(Xn,e)}rotateY(e){return this.rotateOnAxis(qn,e)}rotateZ(e){return this.rotateOnAxis(Yn,e)}translateOnAxis(e,t){return Wn.copy(e).applyQuaternion(this.quaternion),this.position.add(Wn.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Xn,e)}translateY(e){return this.translateOnAxis(qn,e)}translateZ(e){return this.translateOnAxis(Yn,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ie.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?dt.copy(e):dt.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),Ve.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ie.lookAt(Ve,dt,this.up):ie.lookAt(dt,Ve,this.up),this.quaternion.setFromRotationMatrix(ie),i&&(ie.extractRotation(i.matrixWorld),Ie.setFromRotationMatrix(ie),this.quaternion.premultiply(Ie.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(L("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Zn),Pe.child=e,this.dispatchEvent(Pe),Pe.child=null):L("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ei),Zt.child=e,this.dispatchEvent(Zt),Zt.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ie.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ie.multiply(e.parent.matrixWorld)),e.applyMatrix4(ie),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Zn),Pe.child=e,this.dispatchEvent(Pe),Pe.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ve,e,Ai),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ve,Ti,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!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)),t===!0){let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={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),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.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),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(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(a=>({...a})),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(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let o=0,c=l.length;o<c;o++){let u=l[o];s(e.shapes,u)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,o=this.material.length;l<o;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];i.animations.push(s(e.animations,l))}}if(t){let a=r(e.geometries),l=r(e.materials),o=r(e.textures),c=r(e.images),u=r(e.shapes),f=r(e.skeletons),d=r(e.animations),h=r(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),o.length>0&&(n.textures=o),c.length>0&&(n.images=c),u.length>0&&(n.shapes=u),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),h.length>0&&(n.nodes=h)}return n.object=i,n;function r(a){let l=[];for(let o in a){let c=a[o];delete c.metadata,l.push(c)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}};ge.DEFAULT_UP=new x(0,1,0);ge.DEFAULT_MATRIX_AUTO_UPDATE=!0;ge.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var hi={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},pe={h:0,s:0,l:0},ft={h:0,s:0,l:0};function Jt(p,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?p+(e-p)*6*t:t<1/2?e:t<2/3?p+(e-p)*6*(2/3-t):p}var D=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=G){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,\$.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=\$.workingColorSpace){return this.r=e,this.g=t,this.b=n,\$.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=\$.workingColorSpace){if(e=gi(e,1),t=R(t,0,1),n=R(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,r=2*n-s;this.r=Jt(r,s,e+1/3),this.g=Jt(r,s,e),this.b=Jt(r,s,e-1/3)}return \$.colorSpaceToWorking(this,i),this}setStyle(e,t=G){function n(s){s!==void 0&&parseFloat(s)<1&&N("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\\w+)\\(([^\\)]*)\\)/.exec(e)){let s,r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(s=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?\$/.exec(a))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,t);if(s=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?\$/.exec(a))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,t);break;case"hsl":case"hsla":if(s=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?\$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:N("Color: Unknown color model "+e)}}else if(i=/^\\#([A-Fa-f\\d]+)\$/.exec(e)){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,t);if(r===6)return this.setHex(parseInt(s,16),t);N("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=G){let n=hi[e.toLowerCase()];return n!==void 0?this.setHex(n,t):N("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=re(e.r),this.g=re(e.g),this.b=re(e.b),this}copyLinearToSRGB(e){return this.r=De(e.r),this.g=De(e.g),this.b=De(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=G){return \$.workingToColorSpace(k.copy(this),e),Math.round(R(k.r*255,0,255))*65536+Math.round(R(k.g*255,0,255))*256+Math.round(R(k.b*255,0,255))}getHexString(e=G){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=\$.workingColorSpace){\$.workingToColorSpace(k.copy(this),t);let n=k.r,i=k.g,s=k.b,r=Math.max(n,i,s),a=Math.min(n,i,s),l,o,c=(a+r)/2;if(a===r)l=0,o=0;else{let u=r-a;switch(o=c<=.5?u/(r+a):u/(2-r-a),r){case n:l=(i-s)/u+(i<s?6:0);break;case i:l=(s-n)/u+2;break;case s:l=(n-i)/u+4;break}l/=6}return e.h=l,e.s=o,e.l=c,e}getRGB(e,t=\$.workingColorSpace){return \$.workingToColorSpace(k.copy(this),t),e.r=k.r,e.g=k.g,e.b=k.b,e}getStyle(e=G){\$.workingToColorSpace(k.copy(this),e);let t=k.r,n=k.g,i=k.b;return e!==G?\`color(\${e} \${t.toFixed(3)} \${n.toFixed(3)} \${i.toFixed(3)})\`:\`rgb(\${Math.round(t*255)},\${Math.round(n*255)},\${Math.round(i*255)})\`}offsetHSL(e,t,n){return this.getHSL(pe),this.setHSL(pe.h+e,pe.s+t,pe.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(pe),e.getHSL(ft);let n=Bt(pe.h,ft.h,t),i=Bt(pe.s,ft.s,t),s=Bt(pe.l,ft.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},k=new D;D.NAMES=hi;var wi=0,Et=class extends Se{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:wi++}),this.uuid=Qe(),this.name="",this.type="Material",this.blending=Qt,this.side=Kt,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=en,this.blendDst=tn,this.blendEquation=jt,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new D(0,0,0),this.blendAlpha=0,this.depthFunc=We,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=hn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Me,this.stencilZFail=Me,this.stencilZPass=Me,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){N(\`Material: parameter '\${t}' has value of undefined.\`);continue}let i=this[t];if(i===void 0){N(\`Material: '\${t}' is not a property of THREE.\${this.type}.\`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Qt&&(n.blending=this.blending),this.side!==Kt&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==en&&(n.blendSrc=this.blendSrc),this.blendDst!==tn&&(n.blendDst=this.blendDst),this.blendEquation!==jt&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==We&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==hn&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Me&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Me&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Me&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){let r=[];for(let a in s){let l=s[a];delete l.metadata,r.push(l)}return r}if(t){let s=i(e.textures),r=i(e.images);s.length>0&&(n.textures=s),r.length>0&&(n.images=r)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};var F=new x,pt=new H,Ci=0,ee=class{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Ci++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=un,this.updateRanges=[],this.gpuType=oi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)pt.fromBufferAttribute(this,t),pt.applyMatrix3(e),this.setXY(t,pt.x,pt.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)F.fromBufferAttribute(this,t),F.applyMatrix3(e),this.setXYZ(t,F.x,F.y,F.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)F.fromBufferAttribute(this,t),F.applyMatrix4(e),this.setXYZ(t,F.x,F.y,F.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)F.fromBufferAttribute(this,t),F.applyNormalMatrix(e),this.setXYZ(t,F.x,F.y,F.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)F.fromBufferAttribute(this,t),F.transformDirection(e),this.setXYZ(t,F.x,F.y,F.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Oe(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=X(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Oe(t,this.array)),t}setX(e,t){return this.normalized&&(t=X(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Oe(t,this.array)),t}setY(e,t){return this.normalized&&(t=X(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Oe(t,this.array)),t}setZ(e,t){return this.normalized&&(t=X(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Oe(t,this.array)),t}setW(e,t){return this.normalized&&(t=X(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=X(t,this.array),n=X(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=X(t,this.array),n=X(n,this.array),i=X(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=X(t,this.array),n=X(n,this.array),i=X(i,this.array),s=X(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==un&&(e.usage=this.usage),e}};var wt=class extends ee{constructor(e,t,n){super(new Uint16Array(e),t,n)}},Ze=class extends ee{constructor(e,t,n){super(new Int32Array(e),t,n)}},Ct=class extends ee{constructor(e,t,n){super(new Uint32Array(e),t,n)}};var oe=class extends ee{constructor(e,t,n){super(new Float32Array(e),t,n)}},Ri=0,J=new j,\$t=new ge,Le=new x,Y=new me,ke=new me,B=new x,Ne=class p extends Se{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Ri++}),this.uuid=Qe(),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(e){return Array.isArray(e)?this.index=new(ci(e)?Ct:wt)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new w().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return J.makeRotationFromQuaternion(e),this.applyMatrix4(J),this}rotateX(e){return J.makeRotationX(e),this.applyMatrix4(J),this}rotateY(e){return J.makeRotationY(e),this.applyMatrix4(J),this}rotateZ(e){return J.makeRotationZ(e),this.applyMatrix4(J),this}translate(e,t,n){return J.makeTranslation(e,t,n),this.applyMatrix4(J),this}scale(e,t,n){return J.makeScale(e,t,n),this.applyMatrix4(J),this}lookAt(e){return \$t.lookAt(e),\$t.updateMatrix(),this.applyMatrix4(\$t.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Le).negate(),this.translate(Le.x,Le.y,Le.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let i=0,s=e.length;i<s;i++){let r=e[i];n.push(r.x,r.y,r.z||0)}this.setAttribute("position",new oe(n,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&N("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new me);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){L("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new x(-1/0,-1/0,-1/0),new x(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let s=t[n];Y.setFromBufferAttribute(s),this.morphTargetsRelative?(B.addVectors(this.boundingBox.min,Y.min),this.boundingBox.expandByPoint(B),B.addVectors(this.boundingBox.max,Y.max),this.boundingBox.expandByPoint(B)):(this.boundingBox.expandByPoint(Y.min),this.boundingBox.expandByPoint(Y.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&L('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 qe);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){L("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new x,1/0);return}if(e){let n=this.boundingSphere.center;if(Y.setFromBufferAttribute(e),t)for(let s=0,r=t.length;s<r;s++){let a=t[s];ke.setFromBufferAttribute(a),this.morphTargetsRelative?(B.addVectors(Y.min,ke.min),Y.expandByPoint(B),B.addVectors(Y.max,ke.max),Y.expandByPoint(B)):(Y.expandByPoint(ke.min),Y.expandByPoint(ke.max))}Y.getCenter(n);let i=0;for(let s=0,r=e.count;s<r;s++)B.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(B));if(t)for(let s=0,r=t.length;s<r;s++){let a=t[s],l=this.morphTargetsRelative;for(let o=0,c=a.count;o<c;o++)B.fromBufferAttribute(a,o),l&&(Le.fromBufferAttribute(e,o),B.add(Le)),i=Math.max(i,n.distanceToSquared(B))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&L('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){L("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ee(new Float32Array(4*n.count),4));let r=this.getAttribute("tangent"),a=[],l=[];for(let A=0;A<n.count;A++)a[A]=new x,l[A]=new x;let o=new x,c=new x,u=new x,f=new H,d=new H,h=new H,m=new x,_=new x;function g(A,P,O){o.fromBufferAttribute(n,A),c.fromBufferAttribute(n,P),u.fromBufferAttribute(n,O),f.fromBufferAttribute(s,A),d.fromBufferAttribute(s,P),h.fromBufferAttribute(s,O),c.sub(o),u.sub(o),d.sub(f),h.sub(f);let U=1/(d.x*h.y-h.x*d.y);isFinite(U)&&(m.copy(c).multiplyScalar(h.y).addScaledVector(u,-d.y).multiplyScalar(U),_.copy(u).multiplyScalar(d.x).addScaledVector(c,-h.x).multiplyScalar(U),a[A].add(m),a[P].add(m),a[O].add(m),l[A].add(_),l[P].add(_),l[O].add(_))}let y=this.groups;y.length===0&&(y=[{start:0,count:e.count}]);for(let A=0,P=y.length;A<P;++A){let O=y[A],U=O.start,le=O.count;for(let z=U,ce=U+le;z<ce;z+=3)g(e.getX(z+0),e.getX(z+1),e.getX(z+2))}let v=new x,b=new x,S=new x,E=new x;function T(A){S.fromBufferAttribute(i,A),E.copy(S);let P=a[A];v.copy(P),v.sub(S.multiplyScalar(S.dot(P))).normalize(),b.crossVectors(E,P);let U=b.dot(l[A])<0?-1:1;r.setXYZW(A,v.x,v.y,v.z,U)}for(let A=0,P=y.length;A<P;++A){let O=y[A],U=O.start,le=O.count;for(let z=U,ce=U+le;z<ce;z+=3)T(e.getX(z+0)),T(e.getX(z+1)),T(e.getX(z+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new ee(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,d=n.count;f<d;f++)n.setXYZ(f,0,0,0);let i=new x,s=new x,r=new x,a=new x,l=new x,o=new x,c=new x,u=new x;if(e)for(let f=0,d=e.count;f<d;f+=3){let h=e.getX(f+0),m=e.getX(f+1),_=e.getX(f+2);i.fromBufferAttribute(t,h),s.fromBufferAttribute(t,m),r.fromBufferAttribute(t,_),c.subVectors(r,s),u.subVectors(i,s),c.cross(u),a.fromBufferAttribute(n,h),l.fromBufferAttribute(n,m),o.fromBufferAttribute(n,_),a.add(c),l.add(c),o.add(c),n.setXYZ(h,a.x,a.y,a.z),n.setXYZ(m,l.x,l.y,l.z),n.setXYZ(_,o.x,o.y,o.z)}else for(let f=0,d=t.count;f<d;f+=3)i.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),r.fromBufferAttribute(t,f+2),c.subVectors(r,s),u.subVectors(i,s),c.cross(u),n.setXYZ(f+0,c.x,c.y,c.z),n.setXYZ(f+1,c.x,c.y,c.z),n.setXYZ(f+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)B.fromBufferAttribute(e,t),B.normalize(),e.setXYZ(t,B.x,B.y,B.z)}toNonIndexed(){function e(a,l){let o=a.array,c=a.itemSize,u=a.normalized,f=new o.constructor(l.length*c),d=0,h=0;for(let m=0,_=l.length;m<_;m++){a.isInterleavedBufferAttribute?d=l[m]*a.data.stride+a.offset:d=l[m]*c;for(let g=0;g<c;g++)f[h++]=o[d++]}return new ee(f,c,u)}if(this.index===null)return N("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new p,n=this.index.array,i=this.attributes;for(let a in i){let l=i[a],o=e(l,n);t.setAttribute(a,o)}let s=this.morphAttributes;for(let a in s){let l=[],o=s[a];for(let c=0,u=o.length;c<u;c++){let f=o[c],d=e(f,n);l.push(d)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let r=this.groups;for(let a=0,l=r.length;a<l;a++){let o=r[a];t.addGroup(o.start,o.count,o.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let o in l)l[o]!==void 0&&(e[o]=l[o]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let o=n[l];e.data.attributes[l]=o.toJSON(e.data)}let i={},s=!1;for(let l in this.morphAttributes){let o=this.morphAttributes[l],c=[];for(let u=0,f=o.length;u<f;u++){let d=o[u];c.push(d.toJSON(e.data))}c.length>0&&(i[l]=c,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let i=e.attributes;for(let o in i){let c=i[o];this.setAttribute(o,c.clone(t))}let s=e.morphAttributes;for(let o in s){let c=[],u=s[o];for(let f=0,d=u.length;f<d;f++)c.push(u[f].clone(t));this.morphAttributes[o]=c}this.morphTargetsRelative=e.morphTargetsRelative;let r=e.groups;for(let o=0,c=r.length;o<c;o++){let u=r[o];this.addGroup(u.start,u.count,u.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};function ui(p){let e={};for(let t in p){e[t]={};for(let n in p[t]){let i=p[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(N("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function W(p){let e={};for(let t=0;t<p.length;t++){let n=ui(p[t]);for(let i in n)e[i]=n[i]}return e}var Fe=class extends Et{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new D(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Jn=new j,mn=new At,mt=new qe,gt=new x,Je=class extends ge{constructor(e=new Ne,t=new Fe){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,r=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),mt.copy(n.boundingSphere),mt.applyMatrix4(i),mt.radius+=s,e.ray.intersectsSphere(mt)===!1)return;Jn.copy(i).invert(),mn.copy(e.ray).applyMatrix4(Jn);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,o=n.index,u=n.attributes.position;if(o!==null){let f=Math.max(0,r.start),d=Math.min(o.count,r.start+r.count);for(let h=f,m=d;h<m;h++){let _=o.getX(h);gt.fromBufferAttribute(u,_),\$n(gt,_,l,i,e,t,this)}}else{let f=Math.max(0,r.start),d=Math.min(u.count,r.start+r.count);for(let h=f,m=d;h<m;h++)gt.fromBufferAttribute(u,h),\$n(gt,h,l,i,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,r=i.length;s<r;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function \$n(p,e,t,n,i,s,r){let a=mn.distanceSqToPoint(p);if(a<t){let l=new x;mn.closestPointToPoint(p,l),l.applyMatrix4(n);let o=i.ray.origin.distanceTo(l);if(o<i.near||o>i.far)return;s.push({distance:o,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:r})}}function _t(p,e){return!p||p.constructor===e?p:typeof e.BYTES_PER_ELEMENT=="number"?new e(p):Array.prototype.slice.call(p)}var be=class{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],s=t[n-1];n:{e:{let r;t:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=i,i=t[++n],e<i)break e}r=t.length;break t}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=s,s=t[--n-1],e>=s)break e}r=n,n=0;break t}break n}for(;n<r;){let a=n+r>>>1;e<t[a]?r=a:n=a+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let r=0;r!==i;++r)t[r]=n[s+r];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Rt=class extends be{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:rn,endingEnd:rn}}intervalChanged_(e,t,n){let i=this.parameterPositions,s=e-2,r=e+1,a=i[s],l=i[r];if(a===void 0)switch(this.getSettings_().endingStart){case an:s=e,a=2*t-n;break;case on:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case an:r=e,l=2*n-t;break;case on:r=1,l=n+i[1]-i[0];break;default:r=e-1,l=t}let o=(n-t)*.5,c=this.valueSize;this._weightPrev=o/(t-a),this._weightNext=o/(l-n),this._offsetPrev=s*c,this._offsetNext=r*c}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,l=e*a,o=l-a,c=this._offsetPrev,u=this._offsetNext,f=this._weightPrev,d=this._weightNext,h=(n-t)/(i-t),m=h*h,_=m*h,g=-f*_+2*f*m-f*h,y=(1+f)*_+(-1.5-2*f)*m+(-.5+f)*h+1,v=(-1-d)*_+(1.5+d)*m+.5*h,b=d*_-d*m;for(let S=0;S!==a;++S)s[S]=g*r[c+S]+y*r[o+S]+v*r[l+S]+b*r[u+S];return s}},It=class extends be{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,l=e*a,o=l-a,c=(n-t)/(i-t),u=1-c;for(let f=0;f!==a;++f)s[f]=r[o+f]*u+r[l+f]*c;return s}},Pt=class extends be{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}},Z=class{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=_t(t,this.TimeBufferType),this.values=_t(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:_t(e.times,Array),values:_t(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Pt(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new It(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Rt(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Xe:t=this.InterpolantFactoryMethodDiscrete;break;case yt:t=this.InterpolantFactoryMethodLinear;break;case xt:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return N("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Xe;case this.InterpolantFactoryMethodLinear:return yt;case this.InterpolantFactoryMethodSmooth:return xt}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,s=0,r=i-1;for(;s!==i&&n[s]<e;)++s;for(;r!==-1&&n[r]>t;)--r;if(++r,s!==0||r!==i){s>=r&&(r=Math.max(r,1),s=r-1);let a=this.getValueSize();this.times=n.slice(s,r),this.values=this.values.slice(s*a,r*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(L("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,s=n.length;s===0&&(L("KeyframeTrack: Track is empty.",this),e=!1);let r=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){L("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(r!==null&&r>l){L("KeyframeTrack: Out of order keys.",this,a,l,r),e=!1;break}r=l}if(i!==void 0&&pi(i))for(let a=0,l=i.length;a!==l;++a){let o=i[a];if(isNaN(o)){L("KeyframeTrack: Value is not a valid number.",this,a,o),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===xt,s=e.length-1,r=1;for(let a=1;a<s;++a){let l=!1,o=e[a],c=e[a+1];if(o!==c&&(a!==1||o!==e[0]))if(i)l=!0;else{let u=a*n,f=u-n,d=u+n;for(let h=0;h!==n;++h){let m=t[u+h];if(m!==t[f+h]||m!==t[d+h]){l=!0;break}}}if(l){if(a!==r){e[r]=e[a];let u=a*n,f=r*n;for(let d=0;d!==n;++d)t[f+d]=t[u+d]}++r}}if(s>0){e[r]=e[s];for(let a=s*n,l=r*n,o=0;o!==n;++o)t[l+o]=t[a+o];++r}return r!==e.length?(this.times=e.slice(0,r),this.values=t.slice(0,r*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};Z.prototype.ValueTypeName="";Z.prototype.TimeBufferType=Float32Array;Z.prototype.ValueBufferType=Float32Array;Z.prototype.DefaultInterpolation=yt;var _e=class extends Z{constructor(e,t,n){super(e,t,n)}};_e.prototype.ValueTypeName="bool";_e.prototype.ValueBufferType=Array;_e.prototype.DefaultInterpolation=Xe;_e.prototype.InterpolantFactoryMethodLinear=void 0;_e.prototype.InterpolantFactoryMethodSmooth=void 0;var Lt=class extends Z{constructor(e,t,n,i){super(e,t,n,i)}};Lt.prototype.ValueTypeName="color";var Dt=class extends Z{constructor(e,t,n,i){super(e,t,n,i)}};Dt.prototype.ValueTypeName="number";var Ut=class extends be{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t),o=e*a;for(let c=o+a;o!==c;o+=4)ae.slerpFlat(s,0,r,o-a,r,o,l);return s}},\$e=class extends Z{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Ut(this.times,this.values,this.getValueSize(),e)}};\$e.prototype.ValueTypeName="quaternion";\$e.prototype.InterpolantFactoryMethodSmooth=void 0;var xe=class extends Z{constructor(e,t,n){super(e,t,n)}};xe.prototype.ValueTypeName="string";xe.prototype.ValueBufferType=Array;xe.prototype.DefaultInterpolation=Xe;xe.prototype.InterpolantFactoryMethodLinear=void 0;xe.prototype.InterpolantFactoryMethodSmooth=void 0;var Nt=class extends Z{constructor(e,t,n,i){super(e,t,n,i)}};Nt.prototype.ValueTypeName="vector";var gn={enabled:!1,files:{},add:function(p,e){this.enabled!==!1&&(this.files[p]=e)},get:function(p){if(this.enabled!==!1)return this.files[p]},remove:function(p){delete this.files[p]},clear:function(){this.files={}}},Ft=class{constructor(e,t,n){let i=this,s=!1,r=0,a=0,l,o=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(c){a++,s===!1&&i.onStart!==void 0&&i.onStart(c,r,a),s=!0},this.itemEnd=function(c){r++,i.onProgress!==void 0&&i.onProgress(c,r,a),r===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(c){i.onError!==void 0&&i.onError(c)},this.resolveURL=function(c){return l?l(c):c},this.setURLModifier=function(c){return l=c,this},this.addHandler=function(c,u){return o.push(c,u),this},this.removeHandler=function(c){let u=o.indexOf(c);return u!==-1&&o.splice(u,2),this},this.getHandler=function(c){for(let u=0,f=o.length;u<f;u+=2){let d=o[u],h=o[u+1];if(d.global&&(d.lastIndex=0),d.test(c))return h}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},di=new Ft,Ae=class{constructor(e){this.manager=e!==void 0?e:di,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};Ae.DEFAULT_MATERIAL_NAME="__DEFAULT";var se={},_n=class extends Error{constructor(e,t){super(e),this.response=t}},Ke=class extends Ae{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=gn.get(\`file:\${e}\`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(se[e]!==void 0){se[e].push({onLoad:t,onProgress:n,onError:i});return}se[e]=[],se[e].push({onLoad:t,onProgress:n,onError:i});let r=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,l=this.responseType;fetch(r).then(o=>{if(o.status===200||o.status===0){if(o.status===0&&N("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||o.body===void 0||o.body.getReader===void 0)return o;let c=se[e],u=o.body.getReader(),f=o.headers.get("X-File-Size")||o.headers.get("Content-Length"),d=f?parseInt(f):0,h=d!==0,m=0,_=new ReadableStream({start(g){y();function y(){u.read().then(({done:v,value:b})=>{if(v)g.close();else{m+=b.byteLength;let S=new ProgressEvent("progress",{lengthComputable:h,loaded:m,total:d});for(let E=0,T=c.length;E<T;E++){let A=c[E];A.onProgress&&A.onProgress(S)}g.enqueue(b),y()}},v=>{g.error(v)})}}});return new Response(_)}else throw new _n(\`fetch for "\${o.url}" responded with \${o.status}: \${o.statusText}\`,o)}).then(o=>{switch(l){case"arraybuffer":return o.arrayBuffer();case"blob":return o.blob();case"document":return o.text().then(c=>new DOMParser().parseFromString(c,a));case"json":return o.json();default:if(a==="")return o.text();{let u=/charset="?([^;"\\s]*)"?/i.exec(a),f=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(f);return o.arrayBuffer().then(h=>d.decode(h))}}}).then(o=>{gn.add(\`file:\${e}\`,o);let c=se[e];delete se[e];for(let u=0,f=c.length;u<f;u++){let d=c[u];d.onLoad&&d.onLoad(o)}}).catch(o=>{let c=se[e];if(c===void 0)throw this.manager.itemError(e),o;delete se[e];for(let u=0,f=c.length;u<f;u++){let d=c[u];d.onError&&d.onError(o)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var Fn="\\\\[\\\\]\\\\.:\\\\/",Ii=new RegExp("["+Fn+"]","g"),On="[^"+Fn+"]",Pi="[^"+Fn.replace("\\\\.","")+"]",Li=/((?:WC+[\\/:])*)/.source.replace("WC",On),Di=/(WCOD+)?/.source.replace("WCOD",Pi),Ui=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",On),Ni=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",On),Fi=new RegExp("^"+Li+Di+Ui+Ni+"\$"),Oi=["material","materials","bones","map"],xn=class{constructor(e,t,n){let i=n||I.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},I=class p{constructor(e,t,n){this.path=t,this.parsedPath=n||p.parseTrackName(t),this.node=p.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new p.Composite(e,t,n):new p(e,t,n)}static sanitizeNodeName(e){return e.replace(/\\s/g,"_").replace(Ii,"")}static parseTrackName(e){let t=Fi.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let s=n.nodeName.substring(i+1);Oi.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: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let r=0;r<s.length;r++){let a=s[r];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,s=t.propertyIndex;if(e||(e=p.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){N("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let o=t.objectIndex;switch(n){case"materials":if(!e.material){L("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){L("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){L("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let c=0;c<e.length;c++)if(e[c].name===o){o=c;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){L("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){L("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){L("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(o!==void 0){if(e[o]===void 0){L("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[o]}}let r=e[i];if(r===void 0){let o=t.nodeName;L("PropertyBinding: Trying to update property for track: "+o+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){L("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){L("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s}else r.fromArray!==void 0&&r.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(l=this.BindingType.EntireArray,this.resolvedProperty=r):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};I.Composite=xn;I.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};I.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};I.prototype.GetterByBindingType=[I.prototype._getValue_direct,I.prototype._getValue_array,I.prototype._getValue_arrayElement,I.prototype._getValue_toArray];I.prototype.SetterByBindingTypeAndVersioning=[[I.prototype._setValue_direct,I.prototype._setValue_direct_setNeedsUpdate,I.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[I.prototype._setValue_array,I.prototype._setValue_array_setNeedsUpdate,I.prototype._setValue_array_setMatrixWorldNeedsUpdate],[I.prototype._setValue_arrayElement,I.prototype._setValue_arrayElement_setNeedsUpdate,I.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[I.prototype._setValue_fromArray,I.prototype._setValue_fromArray_setNeedsUpdate,I.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var va=new Float32Array(1);typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"182"}}));typeof window<"u"&&(window.__THREE__?N("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="182");var Bi=\`#ifdef USE_ALPHAHASH
2
+ export const workerCode = `"use strict";(()=>{var ei=1;var ti=3,Qt=0;var jt=1;var en=100;var tn=204,nn=205;var sn=0,rn=1,an=2,Ye=3,on=4,ln=5,cn=6,hn=7,ni=0,ii=1,si=2;var Cn=1,Rn=2,In=3,Pn=4,Dn=5,Ln=6,Un=7;var Nn=300,ri=301,Fn=302;var ai=306,un=1e3,Xe=1001,dn=1002;var oi=1006;var li=1008;var ci=1009;var hi=1015;var ui=1023;var Ze=2300,yt=2301,xt=2302,fn=2303,pn=2400,mn=2401,gn=2402;var On="",W="srgb",_n="srgb-linear",xn="linear",vt="srgb";var Ae=7680;var vn=519;var yn=35044;var qe=2e3,Mn=2001;function _i(p){for(let e=p.length-1;e>=0;--e)if(p[e]>=65535)return!0;return!1}function xi(p){return ArrayBuffer.isView(p)&&!(p instanceof DataView)}function Sn(p){return document.createElementNS("http://www.w3.org/1999/xhtml",p)}var Vn={},Mt=null;function di(p){let e=p[0];if(typeof e=="string"&&e.startsWith("TSL:")){let t=p[1];t&&t.isStackTrace?p[0]+=" "+t.getLocation():p[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return p}function B(...p){p=di(p);let e="THREE."+p.shift();if(Mt)Mt("warn",e,...p);else{let t=p[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...p)}}function N(...p){p=di(p);let e="THREE."+p.shift();if(Mt)Mt("error",e,...p);else{let t=p[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...p)}}function bn(...p){let e=p.join(" ");e in Vn||(Vn[e]=!0,B(...p))}var vi={[sn]:rn,[an]:cn,[on]:hn,[Ye]:ln,[rn]:sn,[cn]:an,[hn]:on,[ln]:Ye},Ee=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let i=n[e];if(i!==void 0){let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let i=n.slice(0);for(let s=0,r=i.length;s<r;s++)i[s].call(this,e);e.target=null}}},G=["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 ba=Math.PI/180,yi=180/Math.PI;function tt(){let p=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(G[p&255]+G[p>>8&255]+G[p>>16&255]+G[p>>24&255]+"-"+G[e&255]+G[e>>8&255]+"-"+G[e>>16&15|64]+G[e>>24&255]+"-"+G[t&63|128]+G[t>>8&255]+"-"+G[t>>16&255]+G[t>>24&255]+G[n&255]+G[n>>8&255]+G[n>>16&255]+G[n>>24&255]).toLowerCase()}function L(p,e,t){return Math.max(e,Math.min(t,p))}function Mi(p,e){return(p%e+e)%e}function zt(p,e,t){return(1-t)*p+t*e}function Ve(p,e){switch(e.constructor){case Float32Array:return p;case Uint32Array:return p/4294967295;case Uint16Array:return p/65535;case Uint8Array:return p/255;case Int32Array:return Math.max(p/2147483647,-1);case Int16Array:return Math.max(p/32767,-1);case Int8Array:return Math.max(p/127,-1);default:throw new Error("Invalid component type.")}}function Z(p,e){switch(e.constructor){case Float32Array:return p;case Uint32Array:return Math.round(p*4294967295);case Uint16Array:return Math.round(p*65535);case Uint8Array:return Math.round(p*255);case Int32Array:return Math.round(p*2147483647);case Int16Array:return Math.round(p*32767);case Int8Array:return Math.round(p*127);default:throw new Error("Invalid component type.")}}var X=class p{constructor(e=0,t=0){p.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=L(this.x,e.x,t.x),this.y=L(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=L(this.x,e,t),this.y=L(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(L(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(L(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,r=this.y-e.y;return this.x=s*n-r*i+e.x,this.y=s*i+r*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},ce=class{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,r,a){let l=n[i+0],o=n[i+1],c=n[i+2],u=n[i+3],f=s[r+0],d=s[r+1],h=s[r+2],m=s[r+3];if(u!==m||l!==f||o!==d||c!==h){let _=l*f+o*d+c*h+u*m;_<0&&(f=-f,d=-d,h=-h,m=-m,_=-_);let g=1-a;if(_<.9995){let y=Math.acos(_),x=Math.sin(y);g=Math.sin(g*y)/x,a=Math.sin(a*y)/x,l=l*g+f*a,o=o*g+d*a,c=c*g+h*a,u=u*g+m*a}else{l=l*g+f*a,o=o*g+d*a,c=c*g+h*a,u=u*g+m*a;let y=1/Math.sqrt(l*l+o*o+c*c+u*u);l*=y,o*=y,c*=y,u*=y}}e[t]=l,e[t+1]=o,e[t+2]=c,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,s,r){let a=n[i],l=n[i+1],o=n[i+2],c=n[i+3],u=s[r],f=s[r+1],d=s[r+2],h=s[r+3];return e[t]=a*h+c*u+l*d-o*f,e[t+1]=l*h+c*f+o*u-a*d,e[t+2]=o*h+c*d+a*f-l*u,e[t+3]=c*h-a*u-l*f-o*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,i=e._y,s=e._z,r=e._order,a=Math.cos,l=Math.sin,o=a(n/2),c=a(i/2),u=a(s/2),f=l(n/2),d=l(i/2),h=l(s/2);switch(r){case"XYZ":this._x=f*c*u+o*d*h,this._y=o*d*u-f*c*h,this._z=o*c*h+f*d*u,this._w=o*c*u-f*d*h;break;case"YXZ":this._x=f*c*u+o*d*h,this._y=o*d*u-f*c*h,this._z=o*c*h-f*d*u,this._w=o*c*u+f*d*h;break;case"ZXY":this._x=f*c*u-o*d*h,this._y=o*d*u+f*c*h,this._z=o*c*h+f*d*u,this._w=o*c*u-f*d*h;break;case"ZYX":this._x=f*c*u-o*d*h,this._y=o*d*u+f*c*h,this._z=o*c*h-f*d*u,this._w=o*c*u+f*d*h;break;case"YZX":this._x=f*c*u+o*d*h,this._y=o*d*u+f*c*h,this._z=o*c*h-f*d*u,this._w=o*c*u-f*d*h;break;case"XZY":this._x=f*c*u-o*d*h,this._y=o*d*u-f*c*h,this._z=o*c*h+f*d*u,this._w=o*c*u+f*d*h;break;default:B("Quaternion: .setFromEuler() encountered an unknown order: "+r)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],i=t[4],s=t[8],r=t[1],a=t[5],l=t[9],o=t[2],c=t[6],u=t[10],f=n+a+u;if(f>0){let d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(c-l)*d,this._y=(s-o)*d,this._z=(r-i)*d}else if(n>a&&n>u){let d=2*Math.sqrt(1+n-a-u);this._w=(c-l)/d,this._x=.25*d,this._y=(i+r)/d,this._z=(s+o)/d}else if(a>u){let d=2*Math.sqrt(1+a-n-u);this._w=(s-o)/d,this._x=(i+r)/d,this._y=.25*d,this._z=(l+c)/d}else{let d=2*Math.sqrt(1+u-n-a);this._w=(r-i)/d,this._x=(s+o)/d,this._y=(l+c)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(L(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let i=Math.min(1,t/n);return this.slerp(e,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,i=e._y,s=e._z,r=e._w,a=t._x,l=t._y,o=t._z,c=t._w;return this._x=n*c+r*a+i*o-s*l,this._y=i*c+r*l+s*a-n*o,this._z=s*c+r*o+n*l-i*a,this._w=r*c-n*a-i*l-s*o,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,s=e._z,r=e._w,a=this.dot(e);a<0&&(n=-n,i=-i,s=-s,r=-r,a=-a);let l=1-t;if(a<.9995){let o=Math.acos(a),c=Math.sin(o);l=Math.sin(l*o)/c,t=Math.sin(t*o)/c,this._x=this._x*l+n*t,this._y=this._y*l+i*t,this._z=this._z*l+s*t,this._w=this._w*l+r*t,this._onChangeCallback()}else this._x=this._x*l+n*t,this._y=this._y*l+i*t,this._z=this._z*l+s*t,this._w=this._w*l+r*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},v=class p{constructor(e=0,t=0,n=0){p.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(kn.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(kn.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,i=this.z,s=e.elements,r=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*r,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*r,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*r,this}applyQuaternion(e){let t=this.x,n=this.y,i=this.z,s=e.x,r=e.y,a=e.z,l=e.w,o=2*(r*i-a*n),c=2*(a*t-s*i),u=2*(s*n-r*t);return this.x=t+l*o+r*u-a*c,this.y=n+l*c+a*o-s*u,this.z=i+l*u+s*c-r*o,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=L(this.x,e.x,t.x),this.y=L(this.y,e.y,t.y),this.z=L(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=L(this.x,e,t),this.y=L(this.y,e,t),this.z=L(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(L(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,i=e.y,s=e.z,r=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*r-n*l,this.z=n*a-i*r,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Vt.copy(this).projectOnVector(e),this.sub(Vt)}reflect(e){return this.sub(Vt.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(L(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Vt=new v,kn=new ce,w=class p{constructor(e,t,n,i,s,r,a,l,o){p.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,r,a,l,o)}set(e,t,n,i,s,r,a,l,o){let c=this.elements;return c[0]=e,c[1]=i,c[2]=a,c[3]=t,c[4]=s,c[5]=l,c[6]=n,c[7]=r,c[8]=o,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,s=this.elements,r=n[0],a=n[3],l=n[6],o=n[1],c=n[4],u=n[7],f=n[2],d=n[5],h=n[8],m=i[0],_=i[3],g=i[6],y=i[1],x=i[4],b=i[7],T=i[2],A=i[5],E=i[8];return s[0]=r*m+a*y+l*T,s[3]=r*_+a*x+l*A,s[6]=r*g+a*b+l*E,s[1]=o*m+c*y+u*T,s[4]=o*_+c*x+u*A,s[7]=o*g+c*b+u*E,s[2]=f*m+d*y+h*T,s[5]=f*_+d*x+h*A,s[8]=f*g+d*b+h*E,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],l=e[6],o=e[7],c=e[8];return t*r*c-t*a*o-n*s*c+n*a*l+i*s*o-i*r*l}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],l=e[6],o=e[7],c=e[8],u=c*r-a*o,f=a*l-c*s,d=o*s-r*l,h=t*u+n*f+i*d;if(h===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/h;return e[0]=u*m,e[1]=(i*o-c*n)*m,e[2]=(a*n-i*r)*m,e[3]=f*m,e[4]=(c*t-i*l)*m,e[5]=(i*s-a*t)*m,e[6]=d*m,e[7]=(n*l-o*t)*m,e[8]=(r*t-n*s)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,r,a){let l=Math.cos(s),o=Math.sin(s);return this.set(n*l,n*o,-n*(l*r+o*a)+r+e,-i*o,i*l,-i*(-o*r+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(kt.makeScale(e,t)),this}rotate(e){return this.premultiply(kt.makeRotation(-e)),this}translate(e,t){return this.premultiply(kt.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},kt=new w,Gn=new w().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Hn=new w().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Si(){let p={enabled:!0,workingColorSpace:_n,spaces:{},convert:function(i,s,r){return this.enabled===!1||s===r||!s||!r||(this.spaces[s].transfer===vt&&(i.r=le(i.r),i.g=le(i.g),i.b=le(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===vt&&(i.r=Fe(i.r),i.g=Fe(i.g),i.b=Fe(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===On?xn: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 bn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),p.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return bn("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),p.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return p.define({[_n]:{primaries:e,whitePoint:n,transfer:xn,toXYZ:Gn,fromXYZ:Hn,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:W},outputColorSpaceConfig:{drawingBufferColorSpace:W}},[W]:{primaries:e,whitePoint:n,transfer:vt,toXYZ:Gn,fromXYZ:Hn,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:W}}}),p}var j=Si();function le(p){return p<.04045?p*.0773993808:Math.pow(p*.9478672986+.0521327014,2.4)}function Fe(p){return p<.0031308?p*12.92:1.055*Math.pow(p,.41666)-.055}var Ce,St=class{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Ce===void 0&&(Ce=Sn("canvas")),Ce.width=e.width,Ce.height=e.height;let i=Ce.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Ce}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){let t=Sn("canvas");t.width=e.width,t.height=e.height;let n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);let i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let r=0;r<s.length;r++)s[r]=le(s[r]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){let t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(le(t[n]/255)*255):t[n]=le(t[n]);return{data:t,width:e.width,height:e.height}}else return B("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},bi=0,bt=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:bi++}),this.uuid=tt(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){let t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.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,a=i.length;r<a;r++)i[r].isDataTexture?s.push(Gt(i[r].image)):s.push(Gt(i[r]))}else s=Gt(i);n.url=s}return t||(e.images[this.uuid]=n),n}};function Gt(p){return typeof HTMLImageElement<"u"&&p instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&p instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&p instanceof ImageBitmap?St.getDataURL(p):p.data?{data:Array.from(p.data),width:p.width,height:p.height,type:p.data.constructor.name}:(B("Texture: Unable to serialize Texture."),{})}var Ti=0,Ht=new v,Oe=class p extends Ee{constructor(e=p.DEFAULT_IMAGE,t=p.DEFAULT_MAPPING,n=Xe,i=Xe,s=oi,r=li,a=ui,l=ci,o=p.DEFAULT_ANISOTROPY,c=On){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ti++}),this.uuid=tt(),this.name="",this.source=new bt(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=r,this.anisotropy=o,this.format=a,this.internalFormat=null,this.type=l,this.offset=new X(0,0),this.repeat=new X(1,1),this.center=new X(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new w,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Ht).x}get height(){return this.source.getSize(Ht).y}get depth(){return this.source.getSize(Ht).z}get image(){return this.source.data}set image(e=null){this.source.data=e}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(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){B(\`Texture.setValues(): parameter '\${t}' has value of undefined.\`);continue}let i=this[t];if(i===void 0){B(\`Texture.setValues(): property '\${t}' 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[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Nn)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case un:e.x=e.x-Math.floor(e.x);break;case Xe:e.x=e.x<0?0:1;break;case dn:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case un:e.y=e.y-Math.floor(e.y);break;case Xe:e.y=e.y<0?0:1;break;case dn:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Oe.DEFAULT_IMAGE=null;Oe.DEFAULT_MAPPING=Nn;Oe.DEFAULT_ANISOTROPY=1;var ne=class p{constructor(e,t,n,i,s,r,a,l,o,c,u,f,d,h,m,_){p.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,r,a,l,o,c,u,f,d,h,m,_)}set(e,t,n,i,s,r,a,l,o,c,u,f,d,h,m,_){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=s,g[5]=r,g[9]=a,g[13]=l,g[2]=o,g[6]=c,g[10]=u,g[14]=f,g[3]=d,g[7]=h,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 p().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();let t=this.elements,n=e.elements,i=1/Re.setFromMatrixColumn(e,0).length(),s=1/Re.setFromMatrixColumn(e,1).length(),r=1/Re.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*r,t[9]=n[9]*r,t[10]=n[10]*r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,i=e.y,s=e.z,r=Math.cos(n),a=Math.sin(n),l=Math.cos(i),o=Math.sin(i),c=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){let f=r*c,d=r*u,h=a*c,m=a*u;t[0]=l*c,t[4]=-l*u,t[8]=o,t[1]=d+h*o,t[5]=f-m*o,t[9]=-a*l,t[2]=m-f*o,t[6]=h+d*o,t[10]=r*l}else if(e.order==="YXZ"){let f=l*c,d=l*u,h=o*c,m=o*u;t[0]=f+m*a,t[4]=h*a-d,t[8]=r*o,t[1]=r*u,t[5]=r*c,t[9]=-a,t[2]=d*a-h,t[6]=m+f*a,t[10]=r*l}else if(e.order==="ZXY"){let f=l*c,d=l*u,h=o*c,m=o*u;t[0]=f-m*a,t[4]=-r*u,t[8]=h+d*a,t[1]=d+h*a,t[5]=r*c,t[9]=m-f*a,t[2]=-r*o,t[6]=a,t[10]=r*l}else if(e.order==="ZYX"){let f=r*c,d=r*u,h=a*c,m=a*u;t[0]=l*c,t[4]=h*o-d,t[8]=f*o+m,t[1]=l*u,t[5]=m*o+f,t[9]=d*o-h,t[2]=-o,t[6]=a*l,t[10]=r*l}else if(e.order==="YZX"){let f=r*l,d=r*o,h=a*l,m=a*o;t[0]=l*c,t[4]=m-f*u,t[8]=h*u+d,t[1]=u,t[5]=r*c,t[9]=-a*c,t[2]=-o*c,t[6]=d*u+h,t[10]=f-m*u}else if(e.order==="XZY"){let f=r*l,d=r*o,h=a*l,m=a*o;t[0]=l*c,t[4]=-u,t[8]=o*c,t[1]=f*u+m,t[5]=r*c,t[9]=d*u-h,t[2]=h*u-d,t[6]=a*c,t[10]=m*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Ai,e,Ei)}lookAt(e,t,n){let i=this.elements;return J.subVectors(e,t),J.lengthSq()===0&&(J.z=1),J.normalize(),ue.crossVectors(n,J),ue.lengthSq()===0&&(Math.abs(n.z)===1?J.x+=1e-4:J.z+=1e-4,J.normalize(),ue.crossVectors(n,J)),ue.normalize(),at.crossVectors(J,ue),i[0]=ue.x,i[4]=at.x,i[8]=J.x,i[1]=ue.y,i[5]=at.y,i[9]=J.y,i[2]=ue.z,i[6]=at.z,i[10]=J.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,i=t.elements,s=this.elements,r=n[0],a=n[4],l=n[8],o=n[12],c=n[1],u=n[5],f=n[9],d=n[13],h=n[2],m=n[6],_=n[10],g=n[14],y=n[3],x=n[7],b=n[11],T=n[15],A=i[0],E=i[4],S=i[8],R=i[12],P=i[1],I=i[5],z=i[9],D=i[13],Y=i[2],F=i[6],Me=i[10],Se=i[14],nt=i[3],it=i[7],st=i[11],rt=i[15];return s[0]=r*A+a*P+l*Y+o*nt,s[4]=r*E+a*I+l*F+o*it,s[8]=r*S+a*z+l*Me+o*st,s[12]=r*R+a*D+l*Se+o*rt,s[1]=c*A+u*P+f*Y+d*nt,s[5]=c*E+u*I+f*F+d*it,s[9]=c*S+u*z+f*Me+d*st,s[13]=c*R+u*D+f*Se+d*rt,s[2]=h*A+m*P+_*Y+g*nt,s[6]=h*E+m*I+_*F+g*it,s[10]=h*S+m*z+_*Me+g*st,s[14]=h*R+m*D+_*Se+g*rt,s[3]=y*A+x*P+b*Y+T*nt,s[7]=y*E+x*I+b*F+T*it,s[11]=y*S+x*z+b*Me+T*st,s[15]=y*R+x*D+b*Se+T*rt,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],r=e[1],a=e[5],l=e[9],o=e[13],c=e[2],u=e[6],f=e[10],d=e[14],h=e[3],m=e[7],_=e[11],g=e[15],y=l*d-o*f,x=a*d-o*u,b=a*f-l*u,T=r*d-o*c,A=r*f-l*c,E=r*u-a*c;return t*(m*y-_*x+g*b)-n*(h*y-_*T+g*A)+i*(h*x-m*T+g*E)-s*(h*b-m*A+_*E)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],r=e[4],a=e[5],l=e[6],o=e[7],c=e[8],u=e[9],f=e[10],d=e[11],h=e[12],m=e[13],_=e[14],g=e[15],y=t*a-n*r,x=t*l-i*r,b=t*o-s*r,T=n*l-i*a,A=n*o-s*a,E=i*o-s*l,S=c*m-u*h,R=c*_-f*h,P=c*g-d*h,I=u*_-f*m,z=u*g-d*m,D=f*g-d*_,Y=y*D-x*z+b*I+T*P-A*R+E*S;if(Y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let F=1/Y;return e[0]=(a*D-l*z+o*I)*F,e[1]=(i*z-n*D-s*I)*F,e[2]=(m*E-_*A+g*T)*F,e[3]=(f*A-u*E-d*T)*F,e[4]=(l*P-r*D-o*R)*F,e[5]=(t*D-i*P+s*R)*F,e[6]=(_*b-h*E-g*x)*F,e[7]=(c*E-f*b+d*x)*F,e[8]=(r*z-a*P+o*S)*F,e[9]=(n*P-t*z-s*S)*F,e[10]=(h*A-m*b+g*y)*F,e[11]=(u*b-c*A-d*y)*F,e[12]=(a*R-r*I-l*S)*F,e[13]=(t*I-n*R+i*S)*F,e[14]=(m*x-h*T-_*y)*F,e[15]=(c*T-u*x+f*y)*F,this}scale(e){let t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),i=Math.sin(t),s=1-n,r=e.x,a=e.y,l=e.z,o=s*r,c=s*a;return this.set(o*r+n,o*a-i*l,o*l+i*a,0,o*a+i*l,c*a+n,c*l-i*r,0,o*l-i*a,c*l+i*r,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,r){return this.set(1,n,s,0,e,1,r,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){let i=this.elements,s=t._x,r=t._y,a=t._z,l=t._w,o=s+s,c=r+r,u=a+a,f=s*o,d=s*c,h=s*u,m=r*c,_=r*u,g=a*u,y=l*o,x=l*c,b=l*u,T=n.x,A=n.y,E=n.z;return i[0]=(1-(m+g))*T,i[1]=(d+b)*T,i[2]=(h-x)*T,i[3]=0,i[4]=(d-b)*A,i[5]=(1-(f+g))*A,i[6]=(_+y)*A,i[7]=0,i[8]=(h+x)*E,i[9]=(_-y)*E,i[10]=(1-(f+m))*E,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){let i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];let s=this.determinant();if(s===0)return n.set(1,1,1),t.identity(),this;let r=Re.set(i[0],i[1],i[2]).length(),a=Re.set(i[4],i[5],i[6]).length(),l=Re.set(i[8],i[9],i[10]).length();s<0&&(r=-r),ee.copy(this);let o=1/r,c=1/a,u=1/l;return ee.elements[0]*=o,ee.elements[1]*=o,ee.elements[2]*=o,ee.elements[4]*=c,ee.elements[5]*=c,ee.elements[6]*=c,ee.elements[8]*=u,ee.elements[9]*=u,ee.elements[10]*=u,t.setFromRotationMatrix(ee),n.x=r,n.y=a,n.z=l,this}makePerspective(e,t,n,i,s,r,a=qe,l=!1){let o=this.elements,c=2*s/(t-e),u=2*s/(n-i),f=(t+e)/(t-e),d=(n+i)/(n-i),h,m;if(l)h=s/(r-s),m=r*s/(r-s);else if(a===qe)h=-(r+s)/(r-s),m=-2*r*s/(r-s);else if(a===Mn)h=-r/(r-s),m=-r*s/(r-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return o[0]=c,o[4]=0,o[8]=f,o[12]=0,o[1]=0,o[5]=u,o[9]=d,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=m,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(e,t,n,i,s,r,a=qe,l=!1){let o=this.elements,c=2/(t-e),u=2/(n-i),f=-(t+e)/(t-e),d=-(n+i)/(n-i),h,m;if(l)h=1/(r-s),m=r/(r-s);else if(a===qe)h=-2/(r-s),m=-(r+s)/(r-s);else if(a===Mn)h=-1/(r-s),m=-s/(r-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return o[0]=c,o[4]=0,o[8]=0,o[12]=f,o[1]=0,o[5]=u,o[9]=0,o[13]=d,o[2]=0,o[6]=0,o[10]=h,o[14]=m,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},Re=new v,ee=new ne,Ai=new v(0,0,0),Ei=new v(1,1,1),ue=new v,at=new v,J=new v,Wn=new ne,Xn=new ce,Je=class p{constructor(e=0,t=0,n=0,i=p.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let i=e.elements,s=i[0],r=i[4],a=i[8],l=i[1],o=i[5],c=i[9],u=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(L(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(f,o),this._z=0);break;case"YXZ":this._x=Math.asin(-L(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(l,o)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(L(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-r,o)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-L(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-r,o));break;case"YZX":this._z=Math.asin(L(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,o),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-L(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(f,o),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-c,d),this._y=0);break;default:B("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Wn.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Wn,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Xn.setFromEuler(this),this.setFromQuaternion(Xn,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Je.DEFAULT_ORDER="XYZ";var Tt=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},wi=0,qn=new v,Ie=new ce,se=new ne,ot=new v,ke=new v,Ci=new v,Ri=new ce,Yn=new v(1,0,0),Zn=new v(0,1,0),Jn=new v(0,0,1),\$n={type:"added"},Ii={type:"removed"},Pe={type:"childadded",child:null},Wt={type:"childremoved",child:null},ge=class p extends Ee{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:wi++}),this.uuid=tt(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=p.DEFAULT_UP.clone();let e=new v,t=new Je,n=new ce,i=new v(1,1,1);function s(){n.setFromEuler(t,!1)}function r(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new ne},normalMatrix:{value:new w}}),this.matrix=new ne,this.matrixWorld=new ne,this.matrixAutoUpdate=p.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=p.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Tt,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(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Ie.setFromAxisAngle(e,t),this.quaternion.multiply(Ie),this}rotateOnWorldAxis(e,t){return Ie.setFromAxisAngle(e,t),this.quaternion.premultiply(Ie),this}rotateX(e){return this.rotateOnAxis(Yn,e)}rotateY(e){return this.rotateOnAxis(Zn,e)}rotateZ(e){return this.rotateOnAxis(Jn,e)}translateOnAxis(e,t){return qn.copy(e).applyQuaternion(this.quaternion),this.position.add(qn.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Yn,e)}translateY(e){return this.translateOnAxis(Zn,e)}translateZ(e){return this.translateOnAxis(Jn,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(se.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ot.copy(e):ot.set(e,t,n);let i=this.parent;this.updateWorldMatrix(!0,!1),ke.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?se.lookAt(ke,ot,this.up):se.lookAt(ot,ke,this.up),this.quaternion.setFromRotationMatrix(se),i&&(se.extractRotation(i.matrixWorld),Ie.setFromRotationMatrix(se),this.quaternion.premultiply(Ie.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(N("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(\$n),Pe.child=e,this.dispatchEvent(Pe),Pe.child=null):N("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Ii),Wt.child=e,this.dispatchEvent(Wt),Wt.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),se.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),se.multiply(e.parent.matrixWorld)),e.applyMatrix4(se),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(\$n),Pe.child=e,this.dispatchEvent(Pe),Pe.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){let r=this.children[n].getObjectByProperty(e,t);if(r!==void 0)return r}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ke,e,Ci),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ke,Ri,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let e=this.pivot;if(e!==null){let t=e.x,n=e.y,i=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*i,s[13]+=n-s[1]*t-s[5]*n-s[9]*i,s[14]+=i-s[2]*t-s[6]*n-s[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){let n=this.parent;if(e===!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)),t===!0){let i=this.children;for(let s=0,r=i.length;s<r;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){let t=e===void 0||typeof e=="string",n={};t&&(e={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(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(a=>({...a})),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(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let l=a.shapes;if(Array.isArray(l))for(let o=0,c=l.length;o<c;o++){let u=l[o];s(e.shapes,u)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let l=0,o=this.material.length;l<o;l++)a.push(s(e.materials,this.material[l]));i.material=a}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let a=0;a<this.children.length;a++)i.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let a=0;a<this.animations.length;a++){let l=this.animations[a];i.animations.push(s(e.animations,l))}}if(t){let a=r(e.geometries),l=r(e.materials),o=r(e.textures),c=r(e.images),u=r(e.shapes),f=r(e.skeletons),d=r(e.animations),h=r(e.nodes);a.length>0&&(n.geometries=a),l.length>0&&(n.materials=l),o.length>0&&(n.textures=o),c.length>0&&(n.images=c),u.length>0&&(n.shapes=u),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),h.length>0&&(n.nodes=h)}return n.object=i,n;function r(a){let l=[];for(let o in a){let c=a[o];delete c.metadata,l.push(c)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){let i=e.children[n];this.add(i.clone())}return this}};ge.DEFAULT_UP=new v(0,1,0);ge.DEFAULT_MATRIX_AUTO_UPDATE=!0;ge.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var fi={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},de={h:0,s:0,l:0},lt={h:0,s:0,l:0};function Xt(p,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?p+(e-p)*6*t:t<1/2?e:t<2/3?p+(e-p)*6*(2/3-t):p}var O=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=W){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,j.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=j.workingColorSpace){return this.r=e,this.g=t,this.b=n,j.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=j.workingColorSpace){if(e=Mi(e,1),t=L(t,0,1),n=L(n,0,1),t===0)this.r=this.g=this.b=n;else{let s=n<=.5?n*(1+t):n+t-n*t,r=2*n-s;this.r=Xt(r,s,e+1/3),this.g=Xt(r,s,e),this.b=Xt(r,s,e-1/3)}return j.colorSpaceToWorking(this,i),this}setStyle(e,t=W){function n(s){s!==void 0&&parseFloat(s)<1&&B("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\\w+)\\(([^\\)]*)\\)/.exec(e)){let s,r=i[1],a=i[2];switch(r){case"rgb":case"rgba":if(s=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?\$/.exec(a))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,t);if(s=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?\$/.exec(a))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,t);break;case"hsl":case"hsla":if(s=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?\$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:B("Color: Unknown color model "+e)}}else if(i=/^\\#([A-Fa-f\\d]+)\$/.exec(e)){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,t);if(r===6)return this.setHex(parseInt(s,16),t);B("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=W){let n=fi[e.toLowerCase()];return n!==void 0?this.setHex(n,t):B("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=le(e.r),this.g=le(e.g),this.b=le(e.b),this}copyLinearToSRGB(e){return this.r=Fe(e.r),this.g=Fe(e.g),this.b=Fe(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=W){return j.workingToColorSpace(H.copy(this),e),Math.round(L(H.r*255,0,255))*65536+Math.round(L(H.g*255,0,255))*256+Math.round(L(H.b*255,0,255))}getHexString(e=W){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=j.workingColorSpace){j.workingToColorSpace(H.copy(this),t);let n=H.r,i=H.g,s=H.b,r=Math.max(n,i,s),a=Math.min(n,i,s),l,o,c=(a+r)/2;if(a===r)l=0,o=0;else{let u=r-a;switch(o=c<=.5?u/(r+a):u/(2-r-a),r){case n:l=(i-s)/u+(i<s?6:0);break;case i:l=(s-n)/u+2;break;case s:l=(n-i)/u+4;break}l/=6}return e.h=l,e.s=o,e.l=c,e}getRGB(e,t=j.workingColorSpace){return j.workingToColorSpace(H.copy(this),t),e.r=H.r,e.g=H.g,e.b=H.b,e}getStyle(e=W){j.workingToColorSpace(H.copy(this),e);let t=H.r,n=H.g,i=H.b;return e!==W?\`color(\${e} \${t.toFixed(3)} \${n.toFixed(3)} \${i.toFixed(3)})\`:\`rgb(\${Math.round(t*255)},\${Math.round(n*255)},\${Math.round(i*255)})\`}offsetHSL(e,t,n){return this.getHSL(de),this.setHSL(de.h+e,de.s+t,de.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(de),e.getHSL(lt);let n=zt(de.h,lt.h,t),i=zt(de.s,lt.s,t),s=zt(de.l,lt.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},H=new O;O.NAMES=fi;var _e=class{constructor(e=new v(1/0,1/0,1/0),t=new v(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(te.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(te.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let n=te.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let n=e.geometry;if(n!==void 0){let s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let r=0,a=s.count;r<a;r++)e.isMesh===!0?e.getVertexPosition(r,te):te.fromBufferAttribute(s,r),te.applyMatrix4(e.matrixWorld),this.expandByPoint(te);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ct.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),ct.copy(n.boundingBox)),ct.applyMatrix4(e.matrixWorld),this.union(ct)}let i=e.children;for(let s=0,r=i.length;s<r;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,te),te.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ge),ht.subVectors(this.max,Ge),De.subVectors(e.a,Ge),Le.subVectors(e.b,Ge),Ue.subVectors(e.c,Ge),fe.subVectors(Le,De),pe.subVectors(Ue,Le),be.subVectors(De,Ue);let t=[0,-fe.z,fe.y,0,-pe.z,pe.y,0,-be.z,be.y,fe.z,0,-fe.x,pe.z,0,-pe.x,be.z,0,-be.x,-fe.y,fe.x,0,-pe.y,pe.x,0,-be.y,be.x,0];return!qt(t,De,Le,Ue,ht)||(t=[1,0,0,0,1,0,0,0,1],!qt(t,De,Le,Ue,ht))?!1:(ut.crossVectors(fe,pe),t=[ut.x,ut.y,ut.z],qt(t,De,Le,Ue,ht))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,te).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(te).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(re[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),re[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),re[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),re[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),re[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),re[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),re[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),re[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(re),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},re=[new v,new v,new v,new v,new v,new v,new v,new v],te=new v,ct=new _e,De=new v,Le=new v,Ue=new v,fe=new v,pe=new v,be=new v,Ge=new v,ht=new v,ut=new v,Te=new v;function qt(p,e,t,n,i){for(let s=0,r=p.length-3;s<=r;s+=3){Te.fromArray(p,s);let a=i.x*Math.abs(Te.x)+i.y*Math.abs(Te.y)+i.z*Math.abs(Te.z),l=e.dot(Te),o=t.dot(Te),c=n.dot(Te);if(Math.max(-Math.max(l,o,c),Math.min(l,o,c))>a)return!1}return!0}var V=new v,dt=new X,Pi=0,ie=class{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Pi++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=yn,this.updateRanges=[],this.gpuType=hi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)dt.fromBufferAttribute(this,t),dt.applyMatrix3(e),this.setXY(t,dt.x,dt.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)V.fromBufferAttribute(this,t),V.applyMatrix3(e),this.setXYZ(t,V.x,V.y,V.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)V.fromBufferAttribute(this,t),V.applyMatrix4(e),this.setXYZ(t,V.x,V.y,V.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)V.fromBufferAttribute(this,t),V.applyNormalMatrix(e),this.setXYZ(t,V.x,V.y,V.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)V.fromBufferAttribute(this,t),V.transformDirection(e),this.setXYZ(t,V.x,V.y,V.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Ve(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Z(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Ve(t,this.array)),t}setX(e,t){return this.normalized&&(t=Z(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Ve(t,this.array)),t}setY(e,t){return this.normalized&&(t=Z(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Ve(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Z(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Ve(t,this.array)),t}setW(e,t){return this.normalized&&(t=Z(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Z(t,this.array),n=Z(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Z(t,this.array),n=Z(n,this.array),i=Z(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=Z(t,this.array),n=Z(n,this.array),i=Z(i,this.array),s=Z(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==yn&&(e.usage=this.usage),e}};var At=class extends ie{constructor(e,t,n){super(new Uint16Array(e),t,n)}},\$e=class extends ie{constructor(e,t,n){super(new Int32Array(e),t,n)}},Et=class extends ie{constructor(e,t,n){super(new Uint32Array(e),t,n)}};var he=class extends ie{constructor(e,t,n){super(new Float32Array(e),t,n)}},Di=new _e,He=new v,Yt=new v,Ke=class{constructor(e=new v,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t!==void 0?n.copy(t):Di.setFromPoints(e).getCenter(n);let i=0;for(let s=0,r=e.length;s<r;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;He.subVectors(e,this.center);let t=He.lengthSq();if(t>this.radius*this.radius){let n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(He,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Yt.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(He.copy(e.center).add(Yt)),this.expandByPoint(He.copy(e.center).sub(Yt))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Li=0,Q=new ne,Zt=new ge,Ne=new v,\$=new _e,We=new _e,k=new v,Be=class p extends Ee{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Li++}),this.uuid=tt(),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(e){return Array.isArray(e)?this.index=new(_i(e)?Et:At)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let n=this.attributes.normal;if(n!==void 0){let s=new w().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}let i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Q.makeRotationFromQuaternion(e),this.applyMatrix4(Q),this}rotateX(e){return Q.makeRotationX(e),this.applyMatrix4(Q),this}rotateY(e){return Q.makeRotationY(e),this.applyMatrix4(Q),this}rotateZ(e){return Q.makeRotationZ(e),this.applyMatrix4(Q),this}translate(e,t,n){return Q.makeTranslation(e,t,n),this.applyMatrix4(Q),this}scale(e,t,n){return Q.makeScale(e,t,n),this.applyMatrix4(Q),this}lookAt(e){return Zt.lookAt(e),Zt.updateMatrix(),this.applyMatrix4(Zt.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ne).negate(),this.translate(Ne.x,Ne.y,Ne.z),this}setFromPoints(e){let t=this.getAttribute("position");if(t===void 0){let n=[];for(let i=0,s=e.length;i<s;i++){let r=e[i];n.push(r.x,r.y,r.z||0)}this.setAttribute("position",new he(n,3))}else{let n=Math.min(e.length,t.count);for(let i=0;i<n;i++){let s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&B("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _e);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){N("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new v(-1/0,-1/0,-1/0),new v(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){let s=t[n];\$.setFromBufferAttribute(s),this.morphTargetsRelative?(k.addVectors(this.boundingBox.min,\$.min),this.boundingBox.expandByPoint(k),k.addVectors(this.boundingBox.max,\$.max),this.boundingBox.expandByPoint(k)):(this.boundingBox.expandByPoint(\$.min),this.boundingBox.expandByPoint(\$.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&N('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 Ke);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){N("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new v,1/0);return}if(e){let n=this.boundingSphere.center;if(\$.setFromBufferAttribute(e),t)for(let s=0,r=t.length;s<r;s++){let a=t[s];We.setFromBufferAttribute(a),this.morphTargetsRelative?(k.addVectors(\$.min,We.min),\$.expandByPoint(k),k.addVectors(\$.max,We.max),\$.expandByPoint(k)):(\$.expandByPoint(We.min),\$.expandByPoint(We.max))}\$.getCenter(n);let i=0;for(let s=0,r=e.count;s<r;s++)k.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared(k));if(t)for(let s=0,r=t.length;s<r;s++){let a=t[s],l=this.morphTargetsRelative;for(let o=0,c=a.count;o<c;o++)k.fromBufferAttribute(a,o),l&&(Ne.fromBufferAttribute(e,o),k.add(Ne)),i=Math.max(i,n.distanceToSquared(k))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&N('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){N("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new ie(new Float32Array(4*n.count),4));let r=this.getAttribute("tangent"),a=[],l=[];for(let S=0;S<n.count;S++)a[S]=new v,l[S]=new v;let o=new v,c=new v,u=new v,f=new X,d=new X,h=new X,m=new v,_=new v;function g(S,R,P){o.fromBufferAttribute(n,S),c.fromBufferAttribute(n,R),u.fromBufferAttribute(n,P),f.fromBufferAttribute(s,S),d.fromBufferAttribute(s,R),h.fromBufferAttribute(s,P),c.sub(o),u.sub(o),d.sub(f),h.sub(f);let I=1/(d.x*h.y-h.x*d.y);isFinite(I)&&(m.copy(c).multiplyScalar(h.y).addScaledVector(u,-d.y).multiplyScalar(I),_.copy(u).multiplyScalar(d.x).addScaledVector(c,-h.x).multiplyScalar(I),a[S].add(m),a[R].add(m),a[P].add(m),l[S].add(_),l[R].add(_),l[P].add(_))}let y=this.groups;y.length===0&&(y=[{start:0,count:e.count}]);for(let S=0,R=y.length;S<R;++S){let P=y[S],I=P.start,z=P.count;for(let D=I,Y=I+z;D<Y;D+=3)g(e.getX(D+0),e.getX(D+1),e.getX(D+2))}let x=new v,b=new v,T=new v,A=new v;function E(S){T.fromBufferAttribute(i,S),A.copy(T);let R=a[S];x.copy(R),x.sub(T.multiplyScalar(T.dot(R))).normalize(),b.crossVectors(A,R);let I=b.dot(l[S])<0?-1:1;r.setXYZW(S,x.x,x.y,x.z,I)}for(let S=0,R=y.length;S<R;++S){let P=y[S],I=P.start,z=P.count;for(let D=I,Y=I+z;D<Y;D+=3)E(e.getX(D+0)),E(e.getX(D+1)),E(e.getX(D+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new ie(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let f=0,d=n.count;f<d;f++)n.setXYZ(f,0,0,0);let i=new v,s=new v,r=new v,a=new v,l=new v,o=new v,c=new v,u=new v;if(e)for(let f=0,d=e.count;f<d;f+=3){let h=e.getX(f+0),m=e.getX(f+1),_=e.getX(f+2);i.fromBufferAttribute(t,h),s.fromBufferAttribute(t,m),r.fromBufferAttribute(t,_),c.subVectors(r,s),u.subVectors(i,s),c.cross(u),a.fromBufferAttribute(n,h),l.fromBufferAttribute(n,m),o.fromBufferAttribute(n,_),a.add(c),l.add(c),o.add(c),n.setXYZ(h,a.x,a.y,a.z),n.setXYZ(m,l.x,l.y,l.z),n.setXYZ(_,o.x,o.y,o.z)}else for(let f=0,d=t.count;f<d;f+=3)i.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),r.fromBufferAttribute(t,f+2),c.subVectors(r,s),u.subVectors(i,s),c.cross(u),n.setXYZ(f+0,c.x,c.y,c.z),n.setXYZ(f+1,c.x,c.y,c.z),n.setXYZ(f+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)k.fromBufferAttribute(e,t),k.normalize(),e.setXYZ(t,k.x,k.y,k.z)}toNonIndexed(){function e(a,l){let o=a.array,c=a.itemSize,u=a.normalized,f=new o.constructor(l.length*c),d=0,h=0;for(let m=0,_=l.length;m<_;m++){a.isInterleavedBufferAttribute?d=l[m]*a.data.stride+a.offset:d=l[m]*c;for(let g=0;g<c;g++)f[h++]=o[d++]}return new ie(f,c,u)}if(this.index===null)return B("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new p,n=this.index.array,i=this.attributes;for(let a in i){let l=i[a],o=e(l,n);t.setAttribute(a,o)}let s=this.morphAttributes;for(let a in s){let l=[],o=s[a];for(let c=0,u=o.length;c<u;c++){let f=o[c],d=e(f,n);l.push(d)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;let r=this.groups;for(let a=0,l=r.length;a<l;a++){let o=r[a];t.addGroup(o.start,o.count,o.materialIndex)}return t}toJSON(){let e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let l=this.parameters;for(let o in l)l[o]!==void 0&&(e[o]=l[o]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let l in n){let o=n[l];e.data.attributes[l]=o.toJSON(e.data)}let i={},s=!1;for(let l in this.morphAttributes){let o=this.morphAttributes[l],c=[];for(let u=0,f=o.length;u<f;u++){let d=o[u];c.push(d.toJSON(e.data))}c.length>0&&(i[l]=c,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);let r=this.groups;r.length>0&&(e.data.groups=JSON.parse(JSON.stringify(r)));let a=this.boundingSphere;return a!==null&&(e.data.boundingSphere=a.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let i=e.attributes;for(let o in i){let c=i[o];this.setAttribute(o,c.clone(t))}let s=e.morphAttributes;for(let o in s){let c=[],u=s[o];for(let f=0,d=u.length;f<d;f++)c.push(u[f].clone(t));this.morphAttributes[o]=c}this.morphTargetsRelative=e.morphTargetsRelative;let r=e.groups;for(let o=0,c=r.length;o<c;o++){let u=r[o];this.addGroup(u.start,u.count,u.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}};var Ui=0,wt=class extends Ee{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ui++}),this.uuid=tt(),this.name="",this.type="Material",this.blending=jt,this.side=Qt,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=tn,this.blendDst=nn,this.blendEquation=en,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new O(0,0,0),this.blendAlpha=0,this.depthFunc=Ye,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=vn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ae,this.stencilZFail=Ae,this.stencilZPass=Ae,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){B(\`Material: parameter '\${t}' has value of undefined.\`);continue}let i=this[t];if(i===void 0){B(\`Material: '\${t}' is not a property of THREE.\${this.type}.\`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==jt&&(n.blending=this.blending),this.side!==Qt&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==tn&&(n.blendSrc=this.blendSrc),this.blendDst!==nn&&(n.blendDst=this.blendDst),this.blendEquation!==en&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==Ye&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==vn&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ae&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ae&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ae&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){let r=[];for(let a in s){let l=s[a];delete l.metadata,r.push(l)}return r}if(t){let s=i(e.textures),r=i(e.images);s.length>0&&(n.textures=s),r.length>0&&(n.images=r)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};var ae=new v,Jt=new v,ft=new v,me=new v,\$t=new v,pt=new v,Kt=new v,Ct=class{constructor(e=new v,t=new v(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ae)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=ae.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ae.copy(this.origin).addScaledVector(this.direction,t),ae.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Jt.copy(e).add(t).multiplyScalar(.5),ft.copy(t).sub(e).normalize(),me.copy(this.origin).sub(Jt);let s=e.distanceTo(t)*.5,r=-this.direction.dot(ft),a=me.dot(this.direction),l=-me.dot(ft),o=me.lengthSq(),c=Math.abs(1-r*r),u,f,d,h;if(c>0)if(u=r*l-a,f=r*a-l,h=s*c,u>=0)if(f>=-h)if(f<=h){let m=1/c;u*=m,f*=m,d=u*(u+r*f+2*a)+f*(r*u+f+2*l)+o}else f=s,u=Math.max(0,-(r*f+a)),d=-u*u+f*(f+2*l)+o;else f=-s,u=Math.max(0,-(r*f+a)),d=-u*u+f*(f+2*l)+o;else f<=-h?(u=Math.max(0,-(-r*s+a)),f=u>0?-s:Math.min(Math.max(-s,-l),s),d=-u*u+f*(f+2*l)+o):f<=h?(u=0,f=Math.min(Math.max(-s,-l),s),d=f*(f+2*l)+o):(u=Math.max(0,-(r*s+a)),f=u>0?s:Math.min(Math.max(-s,-l),s),d=-u*u+f*(f+2*l)+o);else f=r>0?-s:s,u=Math.max(0,-(r*f+a)),d=-u*u+f*(f+2*l)+o;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(Jt).addScaledVector(ft,f),d}intersectSphere(e,t){ae.subVectors(e.center,this.origin);let n=ae.dot(this.direction),i=ae.dot(ae)-n*n,s=e.radius*e.radius;if(i>s)return null;let r=Math.sqrt(s-i),a=n-r,l=n+r;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,r,a,l,o=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,f=this.origin;return o>=0?(n=(e.min.x-f.x)*o,i=(e.max.x-f.x)*o):(n=(e.max.x-f.x)*o,i=(e.min.x-f.x)*o),c>=0?(s=(e.min.y-f.y)*c,r=(e.max.y-f.y)*c):(s=(e.max.y-f.y)*c,r=(e.min.y-f.y)*c),n>r||s>i||((s>n||isNaN(n))&&(n=s),(r<i||isNaN(i))&&(i=r),u>=0?(a=(e.min.z-f.z)*u,l=(e.max.z-f.z)*u):(a=(e.max.z-f.z)*u,l=(e.min.z-f.z)*u),n>l||a>i)||((a>n||n!==n)&&(n=a),(l<i||i!==i)&&(i=l),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,ae)!==null}intersectTriangle(e,t,n,i,s){\$t.subVectors(t,e),pt.subVectors(n,e),Kt.crossVectors(\$t,pt);let r=this.direction.dot(Kt),a;if(r>0){if(i)return null;a=1}else if(r<0)a=-1,r=-r;else return null;me.subVectors(this.origin,e);let l=a*this.direction.dot(pt.crossVectors(me,pt));if(l<0)return null;let o=a*this.direction.dot(\$t.cross(me));if(o<0||l+o>r)return null;let c=-a*me.dot(Kt);return c<0?null:this.at(c/r,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}};var ze=class extends wt{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new O(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}},Kn=new ne,Tn=new Ct,mt=new Ke,gt=new v,Qe=class extends ge{constructor(e=new Be,t=new ze){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,r=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),mt.copy(n.boundingSphere),mt.applyMatrix4(i),mt.radius+=s,e.ray.intersectsSphere(mt)===!1)return;Kn.copy(i).invert(),Tn.copy(e.ray).applyMatrix4(Kn);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,o=n.index,u=n.attributes.position;if(o!==null){let f=Math.max(0,r.start),d=Math.min(o.count,r.start+r.count);for(let h=f,m=d;h<m;h++){let _=o.getX(h);gt.fromBufferAttribute(u,_),Qn(gt,_,l,i,e,t,this)}}else{let f=Math.max(0,r.start),d=Math.min(u.count,r.start+r.count);for(let h=f,m=d;h<m;h++)gt.fromBufferAttribute(u,h),Qn(gt,h,l,i,e,t,this)}}updateMorphTargets(){let t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){let i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,r=i.length;s<r;s++){let a=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}};function Qn(p,e,t,n,i,s,r){let a=Tn.distanceSqToPoint(p);if(a<t){let l=new v;Tn.closestPointToPoint(p,l),l.applyMatrix4(n);let o=i.ray.origin.distanceTo(l);if(o<i.near||o>i.far)return;s.push({distance:o,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:r})}}function pi(p){let e={};for(let t in p){e[t]={};for(let n in p[t]){let i=p[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(B("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function q(p){let e={};for(let t=0;t<p.length;t++){let n=pi(p[t]);for(let i in n)e[i]=n[i]}return e}function _t(p,e){return!p||p.constructor===e?p:typeof e.BYTES_PER_ELEMENT=="number"?new e(p):Array.prototype.slice.call(p)}var xe=class{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,i=t[n],s=t[n-1];n:{e:{let r;t:{i:if(!(e<i)){for(let a=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(s=i,i=t[++n],e<i)break e}r=t.length;break t}if(!(e>=s)){let a=t[1];e<a&&(n=2,s=a);for(let l=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===l)break;if(i=s,s=t[--n-1],e>=s)break e}r=n,n=0;break t}break n}for(;n<r;){let a=n+r>>>1;e<t[a]?r=a:n=a+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let r=0;r!==i;++r)t[r]=n[s+r];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Rt=class extends xe{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:pn,endingEnd:pn}}intervalChanged_(e,t,n){let i=this.parameterPositions,s=e-2,r=e+1,a=i[s],l=i[r];if(a===void 0)switch(this.getSettings_().endingStart){case mn:s=e,a=2*t-n;break;case gn:s=i.length-2,a=t+i[s]-i[s+1];break;default:s=e,a=n}if(l===void 0)switch(this.getSettings_().endingEnd){case mn:r=e,l=2*n-t;break;case gn:r=1,l=n+i[1]-i[0];break;default:r=e-1,l=t}let o=(n-t)*.5,c=this.valueSize;this._weightPrev=o/(t-a),this._weightNext=o/(l-n),this._offsetPrev=s*c,this._offsetNext=r*c}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,l=e*a,o=l-a,c=this._offsetPrev,u=this._offsetNext,f=this._weightPrev,d=this._weightNext,h=(n-t)/(i-t),m=h*h,_=m*h,g=-f*_+2*f*m-f*h,y=(1+f)*_+(-1.5-2*f)*m+(-.5+f)*h+1,x=(-1-d)*_+(1.5+d)*m+.5*h,b=d*_-d*m;for(let T=0;T!==a;++T)s[T]=g*r[c+T]+y*r[o+T]+x*r[l+T]+b*r[u+T];return s}},It=class extends xe{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,l=e*a,o=l-a,c=(n-t)/(i-t),u=1-c;for(let f=0;f!==a;++f)s[f]=r[o+f]*u+r[l+f]*c;return s}},Pt=class extends xe{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}},Dt=class extends xe{interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,l=e*a,o=l-a,c=this.settings||this.DefaultSettings_,u=c.inTangents,f=c.outTangents;if(!u||!f){let m=(n-t)/(i-t),_=1-m;for(let g=0;g!==a;++g)s[g]=r[o+g]*_+r[l+g]*m;return s}let d=a*2,h=e-1;for(let m=0;m!==a;++m){let _=r[o+m],g=r[l+m],y=h*d+m*2,x=f[y],b=f[y+1],T=e*d+m*2,A=u[T],E=u[T+1],S=(n-t)/(i-t),R,P,I,z,D;for(let Y=0;Y<8;Y++){R=S*S,P=R*S,I=1-S,z=I*I,D=z*I;let Me=D*t+3*z*S*x+3*I*R*A+P*i-n;if(Math.abs(Me)<1e-10)break;let Se=3*z*(x-t)+6*I*S*(A-x)+3*R*(i-A);if(Math.abs(Se)<1e-10)break;S=S-Me/Se,S=Math.max(0,Math.min(1,S))}s[m]=D*_+3*z*S*b+3*I*R*E+P*g}return s}},K=class{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=_t(t,this.TimeBufferType),this.values=_t(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:_t(e.times,Array),values:_t(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Pt(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new It(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Rt(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){let t=new Dt(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case Ze:t=this.InterpolantFactoryMethodDiscrete;break;case yt:t=this.InterpolantFactoryMethodLinear;break;case xt:t=this.InterpolantFactoryMethodSmooth;break;case fn:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){let n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return B("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ze;case this.InterpolantFactoryMethodLinear:return yt;case this.InterpolantFactoryMethodSmooth:return xt;case this.InterpolantFactoryMethodBezier:return fn}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){let n=this.times,i=n.length,s=0,r=i-1;for(;s!==i&&n[s]<e;)++s;for(;r!==-1&&n[r]>t;)--r;if(++r,s!==0||r!==i){s>=r&&(r=Math.max(r,1),s=r-1);let a=this.getValueSize();this.times=n.slice(s,r),this.values=this.values.slice(s*a,r*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(N("KeyframeTrack: Invalid value size in track.",this),e=!1);let n=this.times,i=this.values,s=n.length;s===0&&(N("KeyframeTrack: Track is empty.",this),e=!1);let r=null;for(let a=0;a!==s;a++){let l=n[a];if(typeof l=="number"&&isNaN(l)){N("KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(r!==null&&r>l){N("KeyframeTrack: Out of order keys.",this,a,l,r),e=!1;break}r=l}if(i!==void 0&&xi(i))for(let a=0,l=i.length;a!==l;++a){let o=i[a];if(isNaN(o)){N("KeyframeTrack: Value is not a valid number.",this,a,o),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===xt,s=e.length-1,r=1;for(let a=1;a<s;++a){let l=!1,o=e[a],c=e[a+1];if(o!==c&&(a!==1||o!==e[0]))if(i)l=!0;else{let u=a*n,f=u-n,d=u+n;for(let h=0;h!==n;++h){let m=t[u+h];if(m!==t[f+h]||m!==t[d+h]){l=!0;break}}}if(l){if(a!==r){e[r]=e[a];let u=a*n,f=r*n;for(let d=0;d!==n;++d)t[f+d]=t[u+d]}++r}}if(s>0){e[r]=e[s];for(let a=s*n,l=r*n,o=0;o!==n;++o)t[l+o]=t[a+o];++r}return r!==e.length?(this.times=e.slice(0,r),this.values=t.slice(0,r*n)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}};K.prototype.ValueTypeName="";K.prototype.TimeBufferType=Float32Array;K.prototype.ValueBufferType=Float32Array;K.prototype.DefaultInterpolation=yt;var ve=class extends K{constructor(e,t,n){super(e,t,n)}};ve.prototype.ValueTypeName="bool";ve.prototype.ValueBufferType=Array;ve.prototype.DefaultInterpolation=Ze;ve.prototype.InterpolantFactoryMethodLinear=void 0;ve.prototype.InterpolantFactoryMethodSmooth=void 0;var Lt=class extends K{constructor(e,t,n,i){super(e,t,n,i)}};Lt.prototype.ValueTypeName="color";var Ut=class extends K{constructor(e,t,n,i){super(e,t,n,i)}};Ut.prototype.ValueTypeName="number";var Nt=class extends xe{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){let s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t),o=e*a;for(let c=o+a;o!==c;o+=4)ce.slerpFlat(s,0,r,o-a,r,o,l);return s}},je=class extends K{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Nt(this.times,this.values,this.getValueSize(),e)}};je.prototype.ValueTypeName="quaternion";je.prototype.InterpolantFactoryMethodSmooth=void 0;var ye=class extends K{constructor(e,t,n){super(e,t,n)}};ye.prototype.ValueTypeName="string";ye.prototype.ValueBufferType=Array;ye.prototype.DefaultInterpolation=Ze;ye.prototype.InterpolantFactoryMethodLinear=void 0;ye.prototype.InterpolantFactoryMethodSmooth=void 0;var Ft=class extends K{constructor(e,t,n,i){super(e,t,n,i)}};Ft.prototype.ValueTypeName="vector";var An={enabled:!1,files:{},add:function(p,e){this.enabled!==!1&&(jn(p)||(this.files[p]=e))},get:function(p){if(this.enabled!==!1&&!jn(p))return this.files[p]},remove:function(p){delete this.files[p]},clear:function(){this.files={}}};function jn(p){try{let e=p.slice(p.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}var Ot=class{constructor(e,t,n){let i=this,s=!1,r=0,a=0,l,o=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(c){a++,s===!1&&i.onStart!==void 0&&i.onStart(c,r,a),s=!0},this.itemEnd=function(c){r++,i.onProgress!==void 0&&i.onProgress(c,r,a),r===a&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(c){i.onError!==void 0&&i.onError(c)},this.resolveURL=function(c){return l?l(c):c},this.setURLModifier=function(c){return l=c,this},this.addHandler=function(c,u){return o.push(c,u),this},this.removeHandler=function(c){let u=o.indexOf(c);return u!==-1&&o.splice(u,2),this},this.getHandler=function(c){for(let u=0,f=o.length;u<f;u+=2){let d=o[u],h=o[u+1];if(d.global&&(d.lastIndex=0),d.test(c))return h}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}},mi=new Ot,we=class{constructor(e){this.manager=e!==void 0?e:mi,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(e,t){let n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}};we.DEFAULT_MATERIAL_NAME="__DEFAULT";var oe={},En=class extends Error{constructor(e,t){super(e),this.response=t}},et=class extends we{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=An.get(\`file:\${e}\`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(oe[e]!==void 0){oe[e].push({onLoad:t,onProgress:n,onError:i});return}oe[e]=[],oe[e].push({onLoad:t,onProgress:n,onError:i});let r=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,l=this.responseType;fetch(r).then(o=>{if(o.status===200||o.status===0){if(o.status===0&&B("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||o.body===void 0||o.body.getReader===void 0)return o;let c=oe[e],u=o.body.getReader(),f=o.headers.get("X-File-Size")||o.headers.get("Content-Length"),d=f?parseInt(f):0,h=d!==0,m=0,_=new ReadableStream({start(g){y();function y(){u.read().then(({done:x,value:b})=>{if(x)g.close();else{m+=b.byteLength;let T=new ProgressEvent("progress",{lengthComputable:h,loaded:m,total:d});for(let A=0,E=c.length;A<E;A++){let S=c[A];S.onProgress&&S.onProgress(T)}g.enqueue(b),y()}},x=>{g.error(x)})}}});return new Response(_)}else throw new En(\`fetch for "\${o.url}" responded with \${o.status}: \${o.statusText}\`,o)}).then(o=>{switch(l){case"arraybuffer":return o.arrayBuffer();case"blob":return o.blob();case"document":return o.text().then(c=>new DOMParser().parseFromString(c,a));case"json":return o.json();default:if(a==="")return o.text();{let u=/charset="?([^;"\\s]*)"?/i.exec(a),f=u&&u[1]?u[1].toLowerCase():void 0,d=new TextDecoder(f);return o.arrayBuffer().then(h=>d.decode(h))}}}).then(o=>{An.add(\`file:\${e}\`,o);let c=oe[e];delete oe[e];for(let u=0,f=c.length;u<f;u++){let d=c[u];d.onLoad&&d.onLoad(o)}}).catch(o=>{let c=oe[e];if(c===void 0)throw this.manager.itemError(e),o;delete oe[e];for(let u=0,f=c.length;u<f;u++){let d=c[u];d.onError&&d.onError(o)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}};var Bn="\\\\[\\\\]\\\\.:\\\\/",Ni=new RegExp("["+Bn+"]","g"),zn="[^"+Bn+"]",Fi="[^"+Bn.replace("\\\\.","")+"]",Oi=/((?:WC+[\\/:])*)/.source.replace("WC",zn),Bi=/(WCOD+)?/.source.replace("WCOD",Fi),zi=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",zn),Vi=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",zn),ki=new RegExp("^"+Oi+Bi+zi+Vi+"\$"),Gi=["material","materials","bones","map"],wn=class{constructor(e,t,n){let i=n||U.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},U=class p{constructor(e,t,n){this.path=t,this.parsedPath=n||p.parseTrackName(t),this.node=p.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new p.Composite(e,t,n):new p(e,t,n)}static sanitizeNodeName(e){return e.replace(/\\s/g,"_").replace(Ni,"")}static parseTrackName(e){let t=ki.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){let s=n.nodeName.substring(i+1);Gi.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: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(s){for(let r=0;r<s.length;r++){let a=s[r];if(a.name===t||a.uuid===t)return a;let l=n(a.children);if(l)return l}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,s=t.propertyIndex;if(e||(e=p.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){B("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let o=t.objectIndex;switch(n){case"materials":if(!e.material){N("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){N("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){N("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let c=0;c<e.length;c++)if(e[c].name===o){o=c;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){N("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){N("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){N("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(o!==void 0){if(e[o]===void 0){N("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[o]}}let r=e[i];if(r===void 0){let o=t.nodeName;N("PropertyBinding: Trying to update property for track: "+o+"."+i+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?a=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){N("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){N("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s}else r.fromArray!==void 0&&r.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(l=this.BindingType.EntireArray,this.resolvedProperty=r):this.propertyName=i;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};U.Composite=wn;U.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};U.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};U.prototype.GetterByBindingType=[U.prototype._getValue_direct,U.prototype._getValue_array,U.prototype._getValue_arrayElement,U.prototype._getValue_toArray];U.prototype.SetterByBindingTypeAndVersioning=[[U.prototype._setValue_direct,U.prototype._setValue_direct_setNeedsUpdate,U.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[U.prototype._setValue_array,U.prototype._setValue_array_setNeedsUpdate,U.prototype._setValue_array_setMatrixWorldNeedsUpdate],[U.prototype._setValue_arrayElement,U.prototype._setValue_arrayElement_setNeedsUpdate,U.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[U.prototype._setValue_fromArray,U.prototype._setValue_fromArray_setNeedsUpdate,U.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Ta=new Float32Array(1);typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"183"}}));typeof window<"u"&&(window.__THREE__?B("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="183");var Hi=\`#ifdef USE_ALPHAHASH
3
3
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
4
- #endif\`,zi=\`#ifdef USE_ALPHAHASH
4
+ #endif\`,Wi=\`#ifdef USE_ALPHAHASH
5
5
  const float ALPHA_HASH_SCALE = 0.05;
6
6
  float hash2D( vec2 value ) {
7
7
  return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -36,20 +36,20 @@ export const workerCode = `"use strict";(()=>{var Kn=1;var Qn=3,Kt=0;var Qt=1;va
36
36
  : cases.z;
37
37
  return clamp( threshold , 1.0e-6, 1.0 );
38
38
  }
39
- #endif\`,Vi=\`#ifdef USE_ALPHAMAP
39
+ #endif\`,Xi=\`#ifdef USE_ALPHAMAP
40
40
  diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
41
- #endif\`,ki=\`#ifdef USE_ALPHAMAP
41
+ #endif\`,qi=\`#ifdef USE_ALPHAMAP
42
42
  uniform sampler2D alphaMap;
43
- #endif\`,Gi=\`#ifdef USE_ALPHATEST
43
+ #endif\`,Yi=\`#ifdef USE_ALPHATEST
44
44
  #ifdef ALPHA_TO_COVERAGE
45
45
  diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
46
46
  if ( diffuseColor.a == 0.0 ) discard;
47
47
  #else
48
48
  if ( diffuseColor.a < alphaTest ) discard;
49
49
  #endif
50
- #endif\`,Hi=\`#ifdef USE_ALPHATEST
50
+ #endif\`,Zi=\`#ifdef USE_ALPHATEST
51
51
  uniform float alphaTest;
52
- #endif\`,Wi=\`#ifdef USE_AOMAP
52
+ #endif\`,Ji=\`#ifdef USE_AOMAP
53
53
  float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
54
54
  reflectedLight.indirectDiffuse *= ambientOcclusion;
55
55
  #if defined( USE_CLEARCOAT )
@@ -62,10 +62,10 @@ export const workerCode = `"use strict";(()=>{var Kn=1;var Qn=3,Kt=0;var Qt=1;va
62
62
  float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
63
63
  reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
64
64
  #endif
65
- #endif\`,Xi=\`#ifdef USE_AOMAP
65
+ #endif\`,\$i=\`#ifdef USE_AOMAP
66
66
  uniform sampler2D aoMap;
67
67
  uniform float aoMapIntensity;
68
- #endif\`,qi=\`#ifdef USE_BATCHING
68
+ #endif\`,Ki=\`#ifdef USE_BATCHING
69
69
  #if ! defined( GL_ANGLE_multi_draw )
70
70
  #define gl_DrawID _gl_DrawID
71
71
  uniform int _gl_DrawID;
@@ -92,22 +92,22 @@ export const workerCode = `"use strict";(()=>{var Kn=1;var Qn=3,Kt=0;var Qt=1;va
92
92
  #endif
93
93
  #ifdef USE_BATCHING_COLOR
94
94
  uniform sampler2D batchingColorTexture;
95
- vec3 getBatchingColor( const in float i ) {
95
+ vec4 getBatchingColor( const in float i ) {
96
96
  int size = textureSize( batchingColorTexture, 0 ).x;
97
97
  int j = int( i );
98
98
  int x = j % size;
99
99
  int y = j / size;
100
- return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
100
+ return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
101
101
  }
102
- #endif\`,Yi=\`#ifdef USE_BATCHING
102
+ #endif\`,Qi=\`#ifdef USE_BATCHING
103
103
  mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
104
- #endif\`,Zi=\`vec3 transformed = vec3( position );
104
+ #endif\`,ji=\`vec3 transformed = vec3( position );
105
105
  #ifdef USE_ALPHAHASH
106
106
  vPosition = vec3( position );
107
- #endif\`,Ji=\`vec3 objectNormal = vec3( normal );
107
+ #endif\`,es=\`vec3 objectNormal = vec3( normal );
108
108
  #ifdef USE_TANGENT
109
109
  vec3 objectTangent = vec3( tangent.xyz );
110
- #endif\`,\$i=\`float G_BlinnPhong_Implicit( ) {
110
+ #endif\`,ts=\`float G_BlinnPhong_Implicit( ) {
111
111
  return 0.25;
112
112
  }
113
113
  float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -121,7 +121,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
121
121
  float G = G_BlinnPhong_Implicit( );
122
122
  float D = D_BlinnPhong( shininess, dotNH );
123
123
  return F * ( G * D );
124
- } // validated\`,Ki=\`#ifdef USE_IRIDESCENCE
124
+ } // validated\`,ns=\`#ifdef USE_IRIDESCENCE
125
125
  const mat3 XYZ_TO_REC709 = mat3(
126
126
  3.2404542, -0.9692660, 0.0556434,
127
127
  -1.5371385, 1.8760108, -0.2040259,
@@ -184,7 +184,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
184
184
  }
185
185
  return max( I, vec3( 0.0 ) );
186
186
  }
187
- #endif\`,Qi=\`#ifdef USE_BUMPMAP
187
+ #endif\`,is=\`#ifdef USE_BUMPMAP
188
188
  uniform sampler2D bumpMap;
189
189
  uniform float bumpScale;
190
190
  vec2 dHdxy_fwd() {
@@ -205,7 +205,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
205
205
  vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
206
206
  return normalize( abs( fDet ) * surf_norm - vGrad );
207
207
  }
208
- #endif\`,ji=\`#if NUM_CLIPPING_PLANES > 0
208
+ #endif\`,ss=\`#if NUM_CLIPPING_PLANES > 0
209
209
  vec4 plane;
210
210
  #ifdef ALPHA_TO_COVERAGE
211
211
  float distanceToPlane, distanceGradient;
@@ -251,40 +251,33 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
251
251
  if ( clipped ) discard;
252
252
  #endif
253
253
  #endif
254
- #endif\`,es=\`#if NUM_CLIPPING_PLANES > 0
254
+ #endif\`,rs=\`#if NUM_CLIPPING_PLANES > 0
255
255
  varying vec3 vClipPosition;
256
256
  uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
257
- #endif\`,ts=\`#if NUM_CLIPPING_PLANES > 0
257
+ #endif\`,as=\`#if NUM_CLIPPING_PLANES > 0
258
258
  varying vec3 vClipPosition;
259
- #endif\`,ns=\`#if NUM_CLIPPING_PLANES > 0
259
+ #endif\`,os=\`#if NUM_CLIPPING_PLANES > 0
260
260
  vClipPosition = - mvPosition.xyz;
261
- #endif\`,is=\`#if defined( USE_COLOR_ALPHA )
261
+ #endif\`,ls=\`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
262
262
  diffuseColor *= vColor;
263
- #elif defined( USE_COLOR )
264
- diffuseColor.rgb *= vColor;
265
- #endif\`,ss=\`#if defined( USE_COLOR_ALPHA )
263
+ #endif\`,cs=\`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
266
264
  varying vec4 vColor;
267
- #elif defined( USE_COLOR )
268
- varying vec3 vColor;
269
- #endif\`,rs=\`#if defined( USE_COLOR_ALPHA )
265
+ #endif\`,hs=\`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
270
266
  varying vec4 vColor;
271
- #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
272
- varying vec3 vColor;
273
- #endif\`,as=\`#if defined( USE_COLOR_ALPHA )
267
+ #endif\`,us=\`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
274
268
  vColor = vec4( 1.0 );
275
- #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
276
- vColor = vec3( 1.0 );
277
269
  #endif
278
- #ifdef USE_COLOR
270
+ #ifdef USE_COLOR_ALPHA
279
271
  vColor *= color;
272
+ #elif defined( USE_COLOR )
273
+ vColor.rgb *= color;
280
274
  #endif
281
275
  #ifdef USE_INSTANCING_COLOR
282
- vColor.xyz *= instanceColor.xyz;
276
+ vColor.rgb *= instanceColor.rgb;
283
277
  #endif
284
278
  #ifdef USE_BATCHING_COLOR
285
- vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
286
- vColor.xyz *= batchingColor.xyz;
287
- #endif\`,os=\`#define PI 3.141592653589793
279
+ vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
280
+ #endif\`,ds=\`#define PI 3.141592653589793
288
281
  #define PI2 6.283185307179586
289
282
  #define PI_HALF 1.5707963267948966
290
283
  #define RECIPROCAL_PI 0.3183098861837907
@@ -351,7 +344,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
351
344
  float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
352
345
  float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
353
346
  return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
354
- } // validated\`,ls=\`#ifdef ENVMAP_TYPE_CUBE_UV
347
+ } // validated\`,fs=\`#ifdef ENVMAP_TYPE_CUBE_UV
355
348
  #define cubeUV_minMipLevel 4.0
356
349
  #define cubeUV_minTileSize 16.0
357
350
  float getFace( vec3 direction ) {
@@ -444,7 +437,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
444
437
  return vec4( mix( color0, color1, mipF ), 1.0 );
445
438
  }
446
439
  }
447
- #endif\`,cs=\`vec3 transformedNormal = objectNormal;
440
+ #endif\`,ps=\`vec3 transformedNormal = objectNormal;
448
441
  #ifdef USE_TANGENT
449
442
  vec3 transformedTangent = objectTangent;
450
443
  #endif
@@ -473,21 +466,21 @@ transformedNormal = normalMatrix * transformedNormal;
473
466
  #ifdef FLIP_SIDED
474
467
  transformedTangent = - transformedTangent;
475
468
  #endif
476
- #endif\`,hs=\`#ifdef USE_DISPLACEMENTMAP
469
+ #endif\`,ms=\`#ifdef USE_DISPLACEMENTMAP
477
470
  uniform sampler2D displacementMap;
478
471
  uniform float displacementScale;
479
472
  uniform float displacementBias;
480
- #endif\`,us=\`#ifdef USE_DISPLACEMENTMAP
473
+ #endif\`,gs=\`#ifdef USE_DISPLACEMENTMAP
481
474
  transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
482
- #endif\`,ds=\`#ifdef USE_EMISSIVEMAP
475
+ #endif\`,_s=\`#ifdef USE_EMISSIVEMAP
483
476
  vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
484
477
  #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
485
478
  emissiveColor = sRGBTransferEOTF( emissiveColor );
486
479
  #endif
487
480
  totalEmissiveRadiance *= emissiveColor.rgb;
488
- #endif\`,fs=\`#ifdef USE_EMISSIVEMAP
481
+ #endif\`,xs=\`#ifdef USE_EMISSIVEMAP
489
482
  uniform sampler2D emissiveMap;
490
- #endif\`,ps="gl_FragColor = linearToOutputTexel( gl_FragColor );",ms=\`vec4 LinearTransferOETF( in vec4 value ) {
483
+ #endif\`,vs="gl_FragColor = linearToOutputTexel( gl_FragColor );",ys=\`vec4 LinearTransferOETF( in vec4 value ) {
491
484
  return value;
492
485
  }
493
486
  vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -495,7 +488,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
495
488
  }
496
489
  vec4 sRGBTransferOETF( in vec4 value ) {
497
490
  return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
498
- }\`,gs=\`#ifdef USE_ENVMAP
491
+ }\`,Ms=\`#ifdef USE_ENVMAP
499
492
  #ifdef ENV_WORLDPOS
500
493
  vec3 cameraToFrag;
501
494
  if ( isOrthographic ) {
@@ -514,17 +507,15 @@ vec4 sRGBTransferOETF( in vec4 value ) {
514
507
  #endif
515
508
  #ifdef ENVMAP_TYPE_CUBE
516
509
  vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
517
- #else
518
- vec4 envColor = vec4( 0.0 );
519
- #endif
520
- #ifdef ENVMAP_BLENDING_MULTIPLY
521
- outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
522
- #elif defined( ENVMAP_BLENDING_MIX )
523
- outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
524
- #elif defined( ENVMAP_BLENDING_ADD )
525
- outgoingLight += envColor.xyz * specularStrength * reflectivity;
510
+ #ifdef ENVMAP_BLENDING_MULTIPLY
511
+ outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
512
+ #elif defined( ENVMAP_BLENDING_MIX )
513
+ outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
514
+ #elif defined( ENVMAP_BLENDING_ADD )
515
+ outgoingLight += envColor.xyz * specularStrength * reflectivity;
516
+ #endif
526
517
  #endif
527
- #endif\`,_s=\`#ifdef USE_ENVMAP
518
+ #endif\`,Ss=\`#ifdef USE_ENVMAP
528
519
  uniform float envMapIntensity;
529
520
  uniform float flipEnvMap;
530
521
  uniform mat3 envMapRotation;
@@ -533,7 +524,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
533
524
  #else
534
525
  uniform sampler2D envMap;
535
526
  #endif
536
- #endif\`,xs=\`#ifdef USE_ENVMAP
527
+ #endif\`,bs=\`#ifdef USE_ENVMAP
537
528
  uniform float reflectivity;
538
529
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
539
530
  #define ENV_WORLDPOS
@@ -544,7 +535,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
544
535
  #else
545
536
  varying vec3 vReflect;
546
537
  #endif
547
- #endif\`,vs=\`#ifdef USE_ENVMAP
538
+ #endif\`,Ts=\`#ifdef USE_ENVMAP
548
539
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
549
540
  #define ENV_WORLDPOS
550
541
  #endif
@@ -555,7 +546,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
555
546
  varying vec3 vReflect;
556
547
  uniform float refractionRatio;
557
548
  #endif
558
- #endif\`,ys=\`#ifdef USE_ENVMAP
549
+ #endif\`,As=\`#ifdef USE_ENVMAP
559
550
  #ifdef ENV_WORLDPOS
560
551
  vWorldPosition = worldPosition.xyz;
561
552
  #else
@@ -572,18 +563,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
572
563
  vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
573
564
  #endif
574
565
  #endif
575
- #endif\`,Ms=\`#ifdef USE_FOG
566
+ #endif\`,Es=\`#ifdef USE_FOG
576
567
  vFogDepth = - mvPosition.z;
577
- #endif\`,Ss=\`#ifdef USE_FOG
568
+ #endif\`,ws=\`#ifdef USE_FOG
578
569
  varying float vFogDepth;
579
- #endif\`,bs=\`#ifdef USE_FOG
570
+ #endif\`,Cs=\`#ifdef USE_FOG
580
571
  #ifdef FOG_EXP2
581
572
  float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
582
573
  #else
583
574
  float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
584
575
  #endif
585
576
  gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
586
- #endif\`,As=\`#ifdef USE_FOG
577
+ #endif\`,Rs=\`#ifdef USE_FOG
587
578
  uniform vec3 fogColor;
588
579
  varying float vFogDepth;
589
580
  #ifdef FOG_EXP2
@@ -592,7 +583,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
592
583
  uniform float fogNear;
593
584
  uniform float fogFar;
594
585
  #endif
595
- #endif\`,Ts=\`#ifdef USE_GRADIENTMAP
586
+ #endif\`,Is=\`#ifdef USE_GRADIENTMAP
596
587
  uniform sampler2D gradientMap;
597
588
  #endif
598
589
  vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -604,12 +595,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
604
595
  vec2 fw = fwidth( coord ) * 0.5;
605
596
  return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
606
597
  #endif
607
- }\`,Es=\`#ifdef USE_LIGHTMAP
598
+ }\`,Ps=\`#ifdef USE_LIGHTMAP
608
599
  uniform sampler2D lightMap;
609
600
  uniform float lightMapIntensity;
610
- #endif\`,ws=\`LambertMaterial material;
601
+ #endif\`,Ds=\`LambertMaterial material;
611
602
  material.diffuseColor = diffuseColor.rgb;
612
- material.specularStrength = specularStrength;\`,Cs=\`varying vec3 vViewPosition;
603
+ material.specularStrength = specularStrength;\`,Ls=\`varying vec3 vViewPosition;
613
604
  struct LambertMaterial {
614
605
  vec3 diffuseColor;
615
606
  float specularStrength;
@@ -623,7 +614,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
623
614
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
624
615
  }
625
616
  #define RE_Direct RE_Direct_Lambert
626
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert\`,Rs=\`uniform bool receiveShadow;
617
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert\`,Us=\`uniform bool receiveShadow;
627
618
  uniform vec3 ambientLightColor;
628
619
  #if defined( USE_LIGHT_PROBES )
629
620
  uniform vec3 lightProbe[ 9 ];
@@ -739,7 +730,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
739
730
  vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
740
731
  return irradiance;
741
732
  }
742
- #endif\`,Is=\`#ifdef USE_ENVMAP
733
+ #endif\`,Ns=\`#ifdef USE_ENVMAP
743
734
  vec3 getIBLIrradiance( const in vec3 normal ) {
744
735
  #ifdef ENVMAP_TYPE_CUBE_UV
745
736
  vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
@@ -772,8 +763,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
772
763
  #endif
773
764
  }
774
765
  #endif
775
- #endif\`,Ps=\`ToonMaterial material;
776
- material.diffuseColor = diffuseColor.rgb;\`,Ls=\`varying vec3 vViewPosition;
766
+ #endif\`,Fs=\`ToonMaterial material;
767
+ material.diffuseColor = diffuseColor.rgb;\`,Os=\`varying vec3 vViewPosition;
777
768
  struct ToonMaterial {
778
769
  vec3 diffuseColor;
779
770
  };
@@ -785,11 +776,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
785
776
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
786
777
  }
787
778
  #define RE_Direct RE_Direct_Toon
788
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon\`,Ds=\`BlinnPhongMaterial material;
779
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon\`,Bs=\`BlinnPhongMaterial material;
789
780
  material.diffuseColor = diffuseColor.rgb;
790
781
  material.specularColor = specular;
791
782
  material.specularShininess = shininess;
792
- material.specularStrength = specularStrength;\`,Us=\`varying vec3 vViewPosition;
783
+ material.specularStrength = specularStrength;\`,zs=\`varying vec3 vViewPosition;
793
784
  struct BlinnPhongMaterial {
794
785
  vec3 diffuseColor;
795
786
  vec3 specularColor;
@@ -806,7 +797,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
806
797
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
807
798
  }
808
799
  #define RE_Direct RE_Direct_BlinnPhong
809
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\`,Ns=\`PhysicalMaterial material;
800
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\`,Vs=\`PhysicalMaterial material;
810
801
  material.diffuseColor = diffuseColor.rgb;
811
802
  material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
812
803
  material.metalness = metalnessFactor;
@@ -896,7 +887,7 @@ material.roughness = min( material.roughness, 1.0 );
896
887
  material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
897
888
  material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
898
889
  material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
899
- #endif\`,Fs=\`uniform sampler2D dfgLUT;
890
+ #endif\`,ks=\`uniform sampler2D dfgLUT;
900
891
  struct PhysicalMaterial {
901
892
  vec3 diffuseColor;
902
893
  vec3 diffuseContribution;
@@ -1166,9 +1157,22 @@ vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const
1166
1157
  vec3( 0, 1, 0 ),
1167
1158
  vec3( t1.z, 0, t1.w )
1168
1159
  );
1169
- vec3 fresnel = ( material.specularColorBlended * t2.x + ( vec3( 1.0 ) - material.specularColorBlended ) * t2.y );
1160
+ vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
1170
1161
  reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1171
1162
  reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1163
+ #ifdef USE_CLEARCOAT
1164
+ vec3 Ncc = geometryClearcoatNormal;
1165
+ vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
1166
+ vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
1167
+ vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
1168
+ mat3 mInvClearcoat = mat3(
1169
+ vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
1170
+ vec3( 0, 1, 0 ),
1171
+ vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
1172
+ );
1173
+ vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
1174
+ clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
1175
+ #endif
1172
1176
  }
1173
1177
  #endif
1174
1178
  void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
@@ -1244,7 +1248,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
1244
1248
  #define RE_IndirectSpecular RE_IndirectSpecular_Physical
1245
1249
  float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1246
1250
  return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1247
- }\`,Os=\`
1251
+ }\`,Gs=\`
1248
1252
  vec3 geometryPosition = - vViewPosition;
1249
1253
  vec3 geometryNormal = normal;
1250
1254
  vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1361,14 +1365,16 @@ IncidentLight directLight;
1361
1365
  #if defined( RE_IndirectSpecular )
1362
1366
  vec3 radiance = vec3( 0.0 );
1363
1367
  vec3 clearcoatRadiance = vec3( 0.0 );
1364
- #endif\`,Bs=\`#if defined( RE_IndirectDiffuse )
1368
+ #endif\`,Hs=\`#if defined( RE_IndirectDiffuse )
1365
1369
  #ifdef USE_LIGHTMAP
1366
1370
  vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1367
1371
  vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1368
1372
  irradiance += lightMapIrradiance;
1369
1373
  #endif
1370
- #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1371
- iblIrradiance += getIBLIrradiance( geometryNormal );
1374
+ #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1375
+ #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1376
+ iblIrradiance += getIBLIrradiance( geometryNormal );
1377
+ #endif
1372
1378
  #endif
1373
1379
  #endif
1374
1380
  #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
@@ -1380,32 +1386,35 @@ IncidentLight directLight;
1380
1386
  #ifdef USE_CLEARCOAT
1381
1387
  clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1382
1388
  #endif
1383
- #endif\`,zs=\`#if defined( RE_IndirectDiffuse )
1389
+ #endif\`,Ws=\`#if defined( RE_IndirectDiffuse )
1390
+ #if defined( LAMBERT ) || defined( PHONG )
1391
+ irradiance += iblIrradiance;
1392
+ #endif
1384
1393
  RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1385
1394
  #endif
1386
1395
  #if defined( RE_IndirectSpecular )
1387
1396
  RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1388
- #endif\`,Vs=\`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1397
+ #endif\`,Xs=\`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1389
1398
  gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1390
- #endif\`,ks=\`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1399
+ #endif\`,qs=\`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1391
1400
  uniform float logDepthBufFC;
1392
1401
  varying float vFragDepth;
1393
1402
  varying float vIsPerspective;
1394
- #endif\`,Gs=\`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1403
+ #endif\`,Ys=\`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1395
1404
  varying float vFragDepth;
1396
1405
  varying float vIsPerspective;
1397
- #endif\`,Hs=\`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1406
+ #endif\`,Zs=\`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1398
1407
  vFragDepth = 1.0 + gl_Position.w;
1399
1408
  vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1400
- #endif\`,Ws=\`#ifdef USE_MAP
1409
+ #endif\`,Js=\`#ifdef USE_MAP
1401
1410
  vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1402
1411
  #ifdef DECODE_VIDEO_TEXTURE
1403
1412
  sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1404
1413
  #endif
1405
1414
  diffuseColor *= sampledDiffuseColor;
1406
- #endif\`,Xs=\`#ifdef USE_MAP
1415
+ #endif\`,\$s=\`#ifdef USE_MAP
1407
1416
  uniform sampler2D map;
1408
- #endif\`,qs=\`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1417
+ #endif\`,Ks=\`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1409
1418
  #if defined( USE_POINTS_UV )
1410
1419
  vec2 uv = vUv;
1411
1420
  #else
@@ -1417,7 +1426,7 @@ IncidentLight directLight;
1417
1426
  #endif
1418
1427
  #ifdef USE_ALPHAMAP
1419
1428
  diffuseColor.a *= texture2D( alphaMap, uv ).g;
1420
- #endif\`,Ys=\`#if defined( USE_POINTS_UV )
1429
+ #endif\`,Qs=\`#if defined( USE_POINTS_UV )
1421
1430
  varying vec2 vUv;
1422
1431
  #else
1423
1432
  #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1429,19 +1438,19 @@ IncidentLight directLight;
1429
1438
  #endif
1430
1439
  #ifdef USE_ALPHAMAP
1431
1440
  uniform sampler2D alphaMap;
1432
- #endif\`,Zs=\`float metalnessFactor = metalness;
1441
+ #endif\`,js=\`float metalnessFactor = metalness;
1433
1442
  #ifdef USE_METALNESSMAP
1434
1443
  vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1435
1444
  metalnessFactor *= texelMetalness.b;
1436
- #endif\`,Js=\`#ifdef USE_METALNESSMAP
1445
+ #endif\`,er=\`#ifdef USE_METALNESSMAP
1437
1446
  uniform sampler2D metalnessMap;
1438
- #endif\`,\$s=\`#ifdef USE_INSTANCING_MORPH
1447
+ #endif\`,tr=\`#ifdef USE_INSTANCING_MORPH
1439
1448
  float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1440
1449
  float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1441
1450
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1442
1451
  morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1443
1452
  }
1444
- #endif\`,Ks=\`#if defined( USE_MORPHCOLORS )
1453
+ #endif\`,nr=\`#if defined( USE_MORPHCOLORS )
1445
1454
  vColor *= morphTargetBaseInfluence;
1446
1455
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1447
1456
  #if defined( USE_COLOR_ALPHA )
@@ -1450,12 +1459,12 @@ IncidentLight directLight;
1450
1459
  if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1451
1460
  #endif
1452
1461
  }
1453
- #endif\`,Qs=\`#ifdef USE_MORPHNORMALS
1462
+ #endif\`,ir=\`#ifdef USE_MORPHNORMALS
1454
1463
  objectNormal *= morphTargetBaseInfluence;
1455
1464
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1456
1465
  if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1457
1466
  }
1458
- #endif\`,js=\`#ifdef USE_MORPHTARGETS
1467
+ #endif\`,sr=\`#ifdef USE_MORPHTARGETS
1459
1468
  #ifndef USE_INSTANCING_MORPH
1460
1469
  uniform float morphTargetBaseInfluence;
1461
1470
  uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1469,12 +1478,12 @@ IncidentLight directLight;
1469
1478
  ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1470
1479
  return texelFetch( morphTargetsTexture, morphUV, 0 );
1471
1480
  }
1472
- #endif\`,er=\`#ifdef USE_MORPHTARGETS
1481
+ #endif\`,rr=\`#ifdef USE_MORPHTARGETS
1473
1482
  transformed *= morphTargetBaseInfluence;
1474
1483
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1475
1484
  if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1476
1485
  }
1477
- #endif\`,tr=\`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1486
+ #endif\`,ar=\`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1478
1487
  #ifdef FLAT_SHADED
1479
1488
  vec3 fdx = dFdx( vViewPosition );
1480
1489
  vec3 fdy = dFdy( vViewPosition );
@@ -1515,7 +1524,7 @@ IncidentLight directLight;
1515
1524
  tbn2[1] *= faceDirection;
1516
1525
  #endif
1517
1526
  #endif
1518
- vec3 nonPerturbedNormal = normal;\`,nr=\`#ifdef USE_NORMALMAP_OBJECTSPACE
1527
+ vec3 nonPerturbedNormal = normal;\`,or=\`#ifdef USE_NORMALMAP_OBJECTSPACE
1519
1528
  normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1520
1529
  #ifdef FLIP_SIDED
1521
1530
  normal = - normal;
@@ -1530,25 +1539,25 @@ vec3 nonPerturbedNormal = normal;\`,nr=\`#ifdef USE_NORMALMAP_OBJECTSPACE
1530
1539
  normal = normalize( tbn * mapN );
1531
1540
  #elif defined( USE_BUMPMAP )
1532
1541
  normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1533
- #endif\`,ir=\`#ifndef FLAT_SHADED
1542
+ #endif\`,lr=\`#ifndef FLAT_SHADED
1534
1543
  varying vec3 vNormal;
1535
1544
  #ifdef USE_TANGENT
1536
1545
  varying vec3 vTangent;
1537
1546
  varying vec3 vBitangent;
1538
1547
  #endif
1539
- #endif\`,sr=\`#ifndef FLAT_SHADED
1548
+ #endif\`,cr=\`#ifndef FLAT_SHADED
1540
1549
  varying vec3 vNormal;
1541
1550
  #ifdef USE_TANGENT
1542
1551
  varying vec3 vTangent;
1543
1552
  varying vec3 vBitangent;
1544
1553
  #endif
1545
- #endif\`,rr=\`#ifndef FLAT_SHADED
1554
+ #endif\`,hr=\`#ifndef FLAT_SHADED
1546
1555
  vNormal = normalize( transformedNormal );
1547
1556
  #ifdef USE_TANGENT
1548
1557
  vTangent = normalize( transformedTangent );
1549
1558
  vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1550
1559
  #endif
1551
- #endif\`,ar=\`#ifdef USE_NORMALMAP
1560
+ #endif\`,ur=\`#ifdef USE_NORMALMAP
1552
1561
  uniform sampler2D normalMap;
1553
1562
  uniform vec2 normalScale;
1554
1563
  #endif
@@ -1570,13 +1579,13 @@ vec3 nonPerturbedNormal = normal;\`,nr=\`#ifdef USE_NORMALMAP_OBJECTSPACE
1570
1579
  float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1571
1580
  return mat3( T * scale, B * scale, N );
1572
1581
  }
1573
- #endif\`,or=\`#ifdef USE_CLEARCOAT
1582
+ #endif\`,dr=\`#ifdef USE_CLEARCOAT
1574
1583
  vec3 clearcoatNormal = nonPerturbedNormal;
1575
- #endif\`,lr=\`#ifdef USE_CLEARCOAT_NORMALMAP
1584
+ #endif\`,fr=\`#ifdef USE_CLEARCOAT_NORMALMAP
1576
1585
  vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1577
1586
  clearcoatMapN.xy *= clearcoatNormalScale;
1578
1587
  clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1579
- #endif\`,cr=\`#ifdef USE_CLEARCOATMAP
1588
+ #endif\`,pr=\`#ifdef USE_CLEARCOATMAP
1580
1589
  uniform sampler2D clearcoatMap;
1581
1590
  #endif
1582
1591
  #ifdef USE_CLEARCOAT_NORMALMAP
@@ -1585,18 +1594,18 @@ vec3 nonPerturbedNormal = normal;\`,nr=\`#ifdef USE_NORMALMAP_OBJECTSPACE
1585
1594
  #endif
1586
1595
  #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1587
1596
  uniform sampler2D clearcoatRoughnessMap;
1588
- #endif\`,hr=\`#ifdef USE_IRIDESCENCEMAP
1597
+ #endif\`,mr=\`#ifdef USE_IRIDESCENCEMAP
1589
1598
  uniform sampler2D iridescenceMap;
1590
1599
  #endif
1591
1600
  #ifdef USE_IRIDESCENCE_THICKNESSMAP
1592
1601
  uniform sampler2D iridescenceThicknessMap;
1593
- #endif\`,ur=\`#ifdef OPAQUE
1602
+ #endif\`,gr=\`#ifdef OPAQUE
1594
1603
  diffuseColor.a = 1.0;
1595
1604
  #endif
1596
1605
  #ifdef USE_TRANSMISSION
1597
1606
  diffuseColor.a *= material.transmissionAlpha;
1598
1607
  #endif
1599
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );\`,dr=\`vec3 packNormalToRGB( const in vec3 normal ) {
1608
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );\`,_r=\`vec3 packNormalToRGB( const in vec3 normal ) {
1600
1609
  return normalize( normal ) * 0.5 + 0.5;
1601
1610
  }
1602
1611
  vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1658,16 +1667,26 @@ float viewZToOrthographicDepth( const in float viewZ, const in float near, const
1658
1667
  return ( viewZ + near ) / ( near - far );
1659
1668
  }
1660
1669
  float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1661
- return depth * ( near - far ) - near;
1670
+ #ifdef USE_REVERSED_DEPTH_BUFFER
1671
+
1672
+ return depth * ( far - near ) - far;
1673
+ #else
1674
+ return depth * ( near - far ) - near;
1675
+ #endif
1662
1676
  }
1663
1677
  float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1664
1678
  return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1665
1679
  }
1666
1680
  float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1667
- return ( near * far ) / ( ( far - near ) * depth - far );
1668
- }\`,fr=\`#ifdef PREMULTIPLIED_ALPHA
1681
+
1682
+ #ifdef USE_REVERSED_DEPTH_BUFFER
1683
+ return ( near * far ) / ( ( near - far ) * depth - near );
1684
+ #else
1685
+ return ( near * far ) / ( ( far - near ) * depth - far );
1686
+ #endif
1687
+ }\`,xr=\`#ifdef PREMULTIPLIED_ALPHA
1669
1688
  gl_FragColor.rgb *= gl_FragColor.a;
1670
- #endif\`,pr=\`vec4 mvPosition = vec4( transformed, 1.0 );
1689
+ #endif\`,vr=\`vec4 mvPosition = vec4( transformed, 1.0 );
1671
1690
  #ifdef USE_BATCHING
1672
1691
  mvPosition = batchingMatrix * mvPosition;
1673
1692
  #endif
@@ -1675,22 +1694,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
1675
1694
  mvPosition = instanceMatrix * mvPosition;
1676
1695
  #endif
1677
1696
  mvPosition = modelViewMatrix * mvPosition;
1678
- gl_Position = projectionMatrix * mvPosition;\`,mr=\`#ifdef DITHERING
1697
+ gl_Position = projectionMatrix * mvPosition;\`,yr=\`#ifdef DITHERING
1679
1698
  gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1680
- #endif\`,gr=\`#ifdef DITHERING
1699
+ #endif\`,Mr=\`#ifdef DITHERING
1681
1700
  vec3 dithering( vec3 color ) {
1682
1701
  float grid_position = rand( gl_FragCoord.xy );
1683
1702
  vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1684
1703
  dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1685
1704
  return color + dither_shift_RGB;
1686
1705
  }
1687
- #endif\`,_r=\`float roughnessFactor = roughness;
1706
+ #endif\`,Sr=\`float roughnessFactor = roughness;
1688
1707
  #ifdef USE_ROUGHNESSMAP
1689
1708
  vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1690
1709
  roughnessFactor *= texelRoughness.g;
1691
- #endif\`,xr=\`#ifdef USE_ROUGHNESSMAP
1710
+ #endif\`,br=\`#ifdef USE_ROUGHNESSMAP
1692
1711
  uniform sampler2D roughnessMap;
1693
- #endif\`,vr=\`#if NUM_SPOT_LIGHT_COORDS > 0
1712
+ #endif\`,Tr=\`#if NUM_SPOT_LIGHT_COORDS > 0
1694
1713
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1695
1714
  #endif
1696
1715
  #if NUM_SPOT_LIGHT_MAPS > 0
@@ -1767,7 +1786,7 @@ gl_Position = projectionMatrix * mvPosition;\`,mr=\`#ifdef DITHERING
1767
1786
  if ( frustumTest ) {
1768
1787
  vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1769
1788
  float radius = shadowRadius * texelSize.x;
1770
- float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;
1789
+ float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1771
1790
  shadow = (
1772
1791
  texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
1773
1792
  texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
@@ -1782,7 +1801,11 @@ gl_Position = projectionMatrix * mvPosition;\`,mr=\`#ifdef DITHERING
1782
1801
  float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1783
1802
  float shadow = 1.0;
1784
1803
  shadowCoord.xyz /= shadowCoord.w;
1785
- shadowCoord.z += shadowBias;
1804
+ #ifdef USE_REVERSED_DEPTH_BUFFER
1805
+ shadowCoord.z -= shadowBias;
1806
+ #else
1807
+ shadowCoord.z += shadowBias;
1808
+ #endif
1786
1809
  bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1787
1810
  bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1788
1811
  if ( frustumTest ) {
@@ -1794,6 +1817,7 @@ gl_Position = projectionMatrix * mvPosition;\`,mr=\`#ifdef DITHERING
1794
1817
  #else
1795
1818
  float hard_shadow = step( shadowCoord.z, mean );
1796
1819
  #endif
1820
+
1797
1821
  if ( hard_shadow == 1.0 ) {
1798
1822
  shadow = 1.0;
1799
1823
  } else {
@@ -1810,7 +1834,11 @@ gl_Position = projectionMatrix * mvPosition;\`,mr=\`#ifdef DITHERING
1810
1834
  float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1811
1835
  float shadow = 1.0;
1812
1836
  shadowCoord.xyz /= shadowCoord.w;
1813
- shadowCoord.z += shadowBias;
1837
+ #ifdef USE_REVERSED_DEPTH_BUFFER
1838
+ shadowCoord.z -= shadowBias;
1839
+ #else
1840
+ shadowCoord.z += shadowBias;
1841
+ #endif
1814
1842
  bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1815
1843
  bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1816
1844
  if ( frustumTest ) {
@@ -1833,20 +1861,30 @@ gl_Position = projectionMatrix * mvPosition;\`,mr=\`#ifdef DITHERING
1833
1861
  vec3 absVec = abs( lightToPosition );
1834
1862
  float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1835
1863
  if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1836
- float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1837
- dp += shadowBias;
1864
+ #ifdef USE_REVERSED_DEPTH_BUFFER
1865
+ float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1866
+ dp -= shadowBias;
1867
+ #else
1868
+ float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1869
+ dp += shadowBias;
1870
+ #endif
1838
1871
  float texelSize = shadowRadius / shadowMapSize.x;
1839
1872
  vec3 absDir = abs( bd3D );
1840
1873
  vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
1841
1874
  tangent = normalize( cross( bd3D, tangent ) );
1842
1875
  vec3 bitangent = cross( bd3D, tangent );
1843
- float phi = interleavedGradientNoise( gl_FragCoord.xy ) * 6.28318530718;
1876
+ float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1877
+ vec2 sample0 = vogelDiskSample( 0, 5, phi );
1878
+ vec2 sample1 = vogelDiskSample( 1, 5, phi );
1879
+ vec2 sample2 = vogelDiskSample( 2, 5, phi );
1880
+ vec2 sample3 = vogelDiskSample( 3, 5, phi );
1881
+ vec2 sample4 = vogelDiskSample( 4, 5, phi );
1844
1882
  shadow = (
1845
- texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 0, 5, phi ).x + bitangent * vogelDiskSample( 0, 5, phi ).y ) * texelSize, dp ) ) +
1846
- texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 1, 5, phi ).x + bitangent * vogelDiskSample( 1, 5, phi ).y ) * texelSize, dp ) ) +
1847
- texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 2, 5, phi ).x + bitangent * vogelDiskSample( 2, 5, phi ).y ) * texelSize, dp ) ) +
1848
- texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 3, 5, phi ).x + bitangent * vogelDiskSample( 3, 5, phi ).y ) * texelSize, dp ) ) +
1849
- texture( shadowMap, vec4( bd3D + ( tangent * vogelDiskSample( 4, 5, phi ).x + bitangent * vogelDiskSample( 4, 5, phi ).y ) * texelSize, dp ) )
1883
+ texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
1884
+ texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
1885
+ texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
1886
+ texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
1887
+ texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
1850
1888
  ) * 0.2;
1851
1889
  }
1852
1890
  return mix( 1.0, shadow, shadowIntensity );
@@ -1855,24 +1893,23 @@ gl_Position = projectionMatrix * mvPosition;\`,mr=\`#ifdef DITHERING
1855
1893
  float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1856
1894
  float shadow = 1.0;
1857
1895
  vec3 lightToPosition = shadowCoord.xyz;
1858
- vec3 bd3D = normalize( lightToPosition );
1859
1896
  vec3 absVec = abs( lightToPosition );
1860
1897
  float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1861
1898
  if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1862
1899
  float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1863
1900
  dp += shadowBias;
1901
+ vec3 bd3D = normalize( lightToPosition );
1864
1902
  float depth = textureCube( shadowMap, bd3D ).r;
1865
1903
  #ifdef USE_REVERSED_DEPTH_BUFFER
1866
- shadow = step( depth, dp );
1867
- #else
1868
- shadow = step( dp, depth );
1904
+ depth = 1.0 - depth;
1869
1905
  #endif
1906
+ shadow = step( dp, depth );
1870
1907
  }
1871
1908
  return mix( 1.0, shadow, shadowIntensity );
1872
1909
  }
1873
1910
  #endif
1874
1911
  #endif
1875
- #endif\`,yr=\`#if NUM_SPOT_LIGHT_COORDS > 0
1912
+ #endif\`,Ar=\`#if NUM_SPOT_LIGHT_COORDS > 0
1876
1913
  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1877
1914
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1878
1915
  #endif
@@ -1913,7 +1950,7 @@ gl_Position = projectionMatrix * mvPosition;\`,mr=\`#ifdef DITHERING
1913
1950
  };
1914
1951
  uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1915
1952
  #endif
1916
- #endif\`,Mr=\`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1953
+ #endif\`,Er=\`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1917
1954
  vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1918
1955
  vec4 shadowWorldPosition;
1919
1956
  #endif
@@ -1945,7 +1982,7 @@ gl_Position = projectionMatrix * mvPosition;\`,mr=\`#ifdef DITHERING
1945
1982
  vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1946
1983
  }
1947
1984
  #pragma unroll_loop_end
1948
- #endif\`,Sr=\`float getShadowMask() {
1985
+ #endif\`,wr=\`float getShadowMask() {
1949
1986
  float shadow = 1.0;
1950
1987
  #ifdef USE_SHADOWMAP
1951
1988
  #if NUM_DIR_LIGHT_SHADOWS > 0
@@ -1977,12 +2014,12 @@ gl_Position = projectionMatrix * mvPosition;\`,mr=\`#ifdef DITHERING
1977
2014
  #endif
1978
2015
  #endif
1979
2016
  return shadow;
1980
- }\`,br=\`#ifdef USE_SKINNING
2017
+ }\`,Cr=\`#ifdef USE_SKINNING
1981
2018
  mat4 boneMatX = getBoneMatrix( skinIndex.x );
1982
2019
  mat4 boneMatY = getBoneMatrix( skinIndex.y );
1983
2020
  mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1984
2021
  mat4 boneMatW = getBoneMatrix( skinIndex.w );
1985
- #endif\`,Ar=\`#ifdef USE_SKINNING
2022
+ #endif\`,Rr=\`#ifdef USE_SKINNING
1986
2023
  uniform mat4 bindMatrix;
1987
2024
  uniform mat4 bindMatrixInverse;
1988
2025
  uniform highp sampler2D boneTexture;
@@ -1997,7 +2034,7 @@ gl_Position = projectionMatrix * mvPosition;\`,mr=\`#ifdef DITHERING
1997
2034
  vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
1998
2035
  return mat4( v1, v2, v3, v4 );
1999
2036
  }
2000
- #endif\`,Tr=\`#ifdef USE_SKINNING
2037
+ #endif\`,Ir=\`#ifdef USE_SKINNING
2001
2038
  vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2002
2039
  vec4 skinned = vec4( 0.0 );
2003
2040
  skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2005,7 +2042,7 @@ gl_Position = projectionMatrix * mvPosition;\`,mr=\`#ifdef DITHERING
2005
2042
  skinned += boneMatZ * skinVertex * skinWeight.z;
2006
2043
  skinned += boneMatW * skinVertex * skinWeight.w;
2007
2044
  transformed = ( bindMatrixInverse * skinned ).xyz;
2008
- #endif\`,Er=\`#ifdef USE_SKINNING
2045
+ #endif\`,Pr=\`#ifdef USE_SKINNING
2009
2046
  mat4 skinMatrix = mat4( 0.0 );
2010
2047
  skinMatrix += skinWeight.x * boneMatX;
2011
2048
  skinMatrix += skinWeight.y * boneMatY;
@@ -2016,17 +2053,17 @@ gl_Position = projectionMatrix * mvPosition;\`,mr=\`#ifdef DITHERING
2016
2053
  #ifdef USE_TANGENT
2017
2054
  objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2018
2055
  #endif
2019
- #endif\`,wr=\`float specularStrength;
2056
+ #endif\`,Dr=\`float specularStrength;
2020
2057
  #ifdef USE_SPECULARMAP
2021
2058
  vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2022
2059
  specularStrength = texelSpecular.r;
2023
2060
  #else
2024
2061
  specularStrength = 1.0;
2025
- #endif\`,Cr=\`#ifdef USE_SPECULARMAP
2062
+ #endif\`,Lr=\`#ifdef USE_SPECULARMAP
2026
2063
  uniform sampler2D specularMap;
2027
- #endif\`,Rr=\`#if defined( TONE_MAPPING )
2064
+ #endif\`,Ur=\`#if defined( TONE_MAPPING )
2028
2065
  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2029
- #endif\`,Ir=\`#ifndef saturate
2066
+ #endif\`,Nr=\`#ifndef saturate
2030
2067
  #define saturate( a ) clamp( a, 0.0, 1.0 )
2031
2068
  #endif
2032
2069
  uniform float toneMappingExposure;
@@ -2123,7 +2160,7 @@ vec3 NeutralToneMapping( vec3 color ) {
2123
2160
  float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2124
2161
  return mix( color, vec3( newPeak ), g );
2125
2162
  }
2126
- vec3 CustomToneMapping( vec3 color ) { return color; }\`,Pr=\`#ifdef USE_TRANSMISSION
2163
+ vec3 CustomToneMapping( vec3 color ) { return color; }\`,Fr=\`#ifdef USE_TRANSMISSION
2127
2164
  material.transmission = transmission;
2128
2165
  material.transmissionAlpha = 1.0;
2129
2166
  material.thickness = thickness;
@@ -2144,7 +2181,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }\`,Pr=\`#ifdef USE_TRANSMI
2144
2181
  material.attenuationColor, material.attenuationDistance );
2145
2182
  material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2146
2183
  totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2147
- #endif\`,Lr=\`#ifdef USE_TRANSMISSION
2184
+ #endif\`,Or=\`#ifdef USE_TRANSMISSION
2148
2185
  uniform float transmission;
2149
2186
  uniform float thickness;
2150
2187
  uniform float attenuationDistance;
@@ -2270,7 +2307,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }\`,Pr=\`#ifdef USE_TRANSMI
2270
2307
  float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2271
2308
  return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2272
2309
  }
2273
- #endif\`,Dr=\`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2310
+ #endif\`,Br=\`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2274
2311
  varying vec2 vUv;
2275
2312
  #endif
2276
2313
  #ifdef USE_MAP
@@ -2340,7 +2377,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }\`,Pr=\`#ifdef USE_TRANSMI
2340
2377
  #ifdef USE_THICKNESSMAP
2341
2378
  uniform mat3 thicknessMapTransform;
2342
2379
  varying vec2 vThicknessMapUv;
2343
- #endif\`,Ur=\`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2380
+ #endif\`,zr=\`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2344
2381
  varying vec2 vUv;
2345
2382
  #endif
2346
2383
  #ifdef USE_MAP
@@ -2434,7 +2471,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }\`,Pr=\`#ifdef USE_TRANSMI
2434
2471
  #ifdef USE_THICKNESSMAP
2435
2472
  uniform mat3 thicknessMapTransform;
2436
2473
  varying vec2 vThicknessMapUv;
2437
- #endif\`,Nr=\`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2474
+ #endif\`,Vr=\`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2438
2475
  vUv = vec3( uv, 1 ).xy;
2439
2476
  #endif
2440
2477
  #ifdef USE_MAP
@@ -2505,7 +2542,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }\`,Pr=\`#ifdef USE_TRANSMI
2505
2542
  #endif
2506
2543
  #ifdef USE_THICKNESSMAP
2507
2544
  vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2508
- #endif\`,Fr=\`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2545
+ #endif\`,kr=\`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2509
2546
  vec4 worldPosition = vec4( transformed, 1.0 );
2510
2547
  #ifdef USE_BATCHING
2511
2548
  worldPosition = batchingMatrix * worldPosition;
@@ -2514,12 +2551,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }\`,Pr=\`#ifdef USE_TRANSMI
2514
2551
  worldPosition = instanceMatrix * worldPosition;
2515
2552
  #endif
2516
2553
  worldPosition = modelMatrix * worldPosition;
2517
- #endif\`,Or=\`varying vec2 vUv;
2554
+ #endif\`,Gr=\`varying vec2 vUv;
2518
2555
  uniform mat3 uvTransform;
2519
2556
  void main() {
2520
2557
  vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2521
2558
  gl_Position = vec4( position.xy, 1.0, 1.0 );
2522
- }\`,Br=\`uniform sampler2D t2D;
2559
+ }\`,Hr=\`uniform sampler2D t2D;
2523
2560
  uniform float backgroundIntensity;
2524
2561
  varying vec2 vUv;
2525
2562
  void main() {
@@ -2531,14 +2568,14 @@ void main() {
2531
2568
  gl_FragColor = texColor;
2532
2569
  #include <tonemapping_fragment>
2533
2570
  #include <colorspace_fragment>
2534
- }\`,zr=\`varying vec3 vWorldDirection;
2571
+ }\`,Wr=\`varying vec3 vWorldDirection;
2535
2572
  #include <common>
2536
2573
  void main() {
2537
2574
  vWorldDirection = transformDirection( position, modelMatrix );
2538
2575
  #include <begin_vertex>
2539
2576
  #include <project_vertex>
2540
2577
  gl_Position.z = gl_Position.w;
2541
- }\`,Vr=\`#ifdef ENVMAP_TYPE_CUBE
2578
+ }\`,Xr=\`#ifdef ENVMAP_TYPE_CUBE
2542
2579
  uniform samplerCube envMap;
2543
2580
  #elif defined( ENVMAP_TYPE_CUBE_UV )
2544
2581
  uniform sampler2D envMap;
@@ -2561,14 +2598,14 @@ void main() {
2561
2598
  gl_FragColor = texColor;
2562
2599
  #include <tonemapping_fragment>
2563
2600
  #include <colorspace_fragment>
2564
- }\`,kr=\`varying vec3 vWorldDirection;
2601
+ }\`,qr=\`varying vec3 vWorldDirection;
2565
2602
  #include <common>
2566
2603
  void main() {
2567
2604
  vWorldDirection = transformDirection( position, modelMatrix );
2568
2605
  #include <begin_vertex>
2569
2606
  #include <project_vertex>
2570
2607
  gl_Position.z = gl_Position.w;
2571
- }\`,Gr=\`uniform samplerCube tCube;
2608
+ }\`,Yr=\`uniform samplerCube tCube;
2572
2609
  uniform float tFlip;
2573
2610
  uniform float opacity;
2574
2611
  varying vec3 vWorldDirection;
@@ -2578,7 +2615,7 @@ void main() {
2578
2615
  gl_FragColor.a *= opacity;
2579
2616
  #include <tonemapping_fragment>
2580
2617
  #include <colorspace_fragment>
2581
- }\`,Hr=\`#include <common>
2618
+ }\`,Zr=\`#include <common>
2582
2619
  #include <batching_pars_vertex>
2583
2620
  #include <uv_pars_vertex>
2584
2621
  #include <displacementmap_pars_vertex>
@@ -2605,7 +2642,7 @@ void main() {
2605
2642
  #include <logdepthbuf_vertex>
2606
2643
  #include <clipping_planes_vertex>
2607
2644
  vHighPrecisionZW = gl_Position.zw;
2608
- }\`,Wr=\`#if DEPTH_PACKING == 3200
2645
+ }\`,Jr=\`#if DEPTH_PACKING == 3200
2609
2646
  uniform float opacity;
2610
2647
  #endif
2611
2648
  #include <common>
@@ -2643,7 +2680,7 @@ void main() {
2643
2680
  #elif DEPTH_PACKING == 3203
2644
2681
  gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2645
2682
  #endif
2646
- }\`,Xr=\`#define DISTANCE
2683
+ }\`,\$r=\`#define DISTANCE
2647
2684
  varying vec3 vWorldPosition;
2648
2685
  #include <common>
2649
2686
  #include <batching_pars_vertex>
@@ -2670,7 +2707,7 @@ void main() {
2670
2707
  #include <worldpos_vertex>
2671
2708
  #include <clipping_planes_vertex>
2672
2709
  vWorldPosition = worldPosition.xyz;
2673
- }\`,qr=\`#define DISTANCE
2710
+ }\`,Kr=\`#define DISTANCE
2674
2711
  uniform vec3 referencePosition;
2675
2712
  uniform float nearDistance;
2676
2713
  uniform float farDistance;
@@ -2693,13 +2730,13 @@ void main () {
2693
2730
  dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2694
2731
  dist = saturate( dist );
2695
2732
  gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2696
- }\`,Yr=\`varying vec3 vWorldDirection;
2733
+ }\`,Qr=\`varying vec3 vWorldDirection;
2697
2734
  #include <common>
2698
2735
  void main() {
2699
2736
  vWorldDirection = transformDirection( position, modelMatrix );
2700
2737
  #include <begin_vertex>
2701
2738
  #include <project_vertex>
2702
- }\`,Zr=\`uniform sampler2D tEquirect;
2739
+ }\`,jr=\`uniform sampler2D tEquirect;
2703
2740
  varying vec3 vWorldDirection;
2704
2741
  #include <common>
2705
2742
  void main() {
@@ -2708,7 +2745,7 @@ void main() {
2708
2745
  gl_FragColor = texture2D( tEquirect, sampleUV );
2709
2746
  #include <tonemapping_fragment>
2710
2747
  #include <colorspace_fragment>
2711
- }\`,Jr=\`uniform float scale;
2748
+ }\`,ea=\`uniform float scale;
2712
2749
  attribute float lineDistance;
2713
2750
  varying float vLineDistance;
2714
2751
  #include <common>
@@ -2730,7 +2767,7 @@ void main() {
2730
2767
  #include <logdepthbuf_vertex>
2731
2768
  #include <clipping_planes_vertex>
2732
2769
  #include <fog_vertex>
2733
- }\`,\$r=\`uniform vec3 diffuse;
2770
+ }\`,ta=\`uniform vec3 diffuse;
2734
2771
  uniform float opacity;
2735
2772
  uniform float dashSize;
2736
2773
  uniform float totalSize;
@@ -2758,7 +2795,7 @@ void main() {
2758
2795
  #include <colorspace_fragment>
2759
2796
  #include <fog_fragment>
2760
2797
  #include <premultiplied_alpha_fragment>
2761
- }\`,Kr=\`#include <common>
2798
+ }\`,na=\`#include <common>
2762
2799
  #include <batching_pars_vertex>
2763
2800
  #include <uv_pars_vertex>
2764
2801
  #include <envmap_pars_vertex>
@@ -2790,7 +2827,7 @@ void main() {
2790
2827
  #include <worldpos_vertex>
2791
2828
  #include <envmap_vertex>
2792
2829
  #include <fog_vertex>
2793
- }\`,Qr=\`uniform vec3 diffuse;
2830
+ }\`,ia=\`uniform vec3 diffuse;
2794
2831
  uniform float opacity;
2795
2832
  #ifndef FLAT_SHADED
2796
2833
  varying vec3 vNormal;
@@ -2838,7 +2875,7 @@ void main() {
2838
2875
  #include <fog_fragment>
2839
2876
  #include <premultiplied_alpha_fragment>
2840
2877
  #include <dithering_fragment>
2841
- }\`,jr=\`#define LAMBERT
2878
+ }\`,sa=\`#define LAMBERT
2842
2879
  varying vec3 vViewPosition;
2843
2880
  #include <common>
2844
2881
  #include <batching_pars_vertex>
@@ -2877,7 +2914,7 @@ void main() {
2877
2914
  #include <envmap_vertex>
2878
2915
  #include <shadowmap_vertex>
2879
2916
  #include <fog_vertex>
2880
- }\`,ea=\`#define LAMBERT
2917
+ }\`,ra=\`#define LAMBERT
2881
2918
  uniform vec3 diffuse;
2882
2919
  uniform vec3 emissive;
2883
2920
  uniform float opacity;
@@ -2892,8 +2929,10 @@ uniform float opacity;
2892
2929
  #include <aomap_pars_fragment>
2893
2930
  #include <lightmap_pars_fragment>
2894
2931
  #include <emissivemap_pars_fragment>
2932
+ #include <cube_uv_reflection_fragment>
2895
2933
  #include <envmap_common_pars_fragment>
2896
2934
  #include <envmap_pars_fragment>
2935
+ #include <envmap_physical_pars_fragment>
2897
2936
  #include <fog_pars_fragment>
2898
2937
  #include <bsdfs>
2899
2938
  #include <lights_pars_begin>
@@ -2933,7 +2972,7 @@ void main() {
2933
2972
  #include <fog_fragment>
2934
2973
  #include <premultiplied_alpha_fragment>
2935
2974
  #include <dithering_fragment>
2936
- }\`,ta=\`#define MATCAP
2975
+ }\`,aa=\`#define MATCAP
2937
2976
  varying vec3 vViewPosition;
2938
2977
  #include <common>
2939
2978
  #include <batching_pars_vertex>
@@ -2967,7 +3006,7 @@ void main() {
2967
3006
  #include <clipping_planes_vertex>
2968
3007
  #include <fog_vertex>
2969
3008
  vViewPosition = - mvPosition.xyz;
2970
- }\`,na=\`#define MATCAP
3009
+ }\`,oa=\`#define MATCAP
2971
3010
  uniform vec3 diffuse;
2972
3011
  uniform float opacity;
2973
3012
  uniform sampler2D matcap;
@@ -3013,7 +3052,7 @@ void main() {
3013
3052
  #include <fog_fragment>
3014
3053
  #include <premultiplied_alpha_fragment>
3015
3054
  #include <dithering_fragment>
3016
- }\`,ia=\`#define NORMAL
3055
+ }\`,la=\`#define NORMAL
3017
3056
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3018
3057
  varying vec3 vViewPosition;
3019
3058
  #endif
@@ -3046,7 +3085,7 @@ void main() {
3046
3085
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3047
3086
  vViewPosition = - mvPosition.xyz;
3048
3087
  #endif
3049
- }\`,sa=\`#define NORMAL
3088
+ }\`,ca=\`#define NORMAL
3050
3089
  uniform float opacity;
3051
3090
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3052
3091
  varying vec3 vViewPosition;
@@ -3067,7 +3106,7 @@ void main() {
3067
3106
  #ifdef OPAQUE
3068
3107
  gl_FragColor.a = 1.0;
3069
3108
  #endif
3070
- }\`,ra=\`#define PHONG
3109
+ }\`,ha=\`#define PHONG
3071
3110
  varying vec3 vViewPosition;
3072
3111
  #include <common>
3073
3112
  #include <batching_pars_vertex>
@@ -3106,7 +3145,7 @@ void main() {
3106
3145
  #include <envmap_vertex>
3107
3146
  #include <shadowmap_vertex>
3108
3147
  #include <fog_vertex>
3109
- }\`,aa=\`#define PHONG
3148
+ }\`,ua=\`#define PHONG
3110
3149
  uniform vec3 diffuse;
3111
3150
  uniform vec3 emissive;
3112
3151
  uniform vec3 specular;
@@ -3123,8 +3162,10 @@ uniform float opacity;
3123
3162
  #include <aomap_pars_fragment>
3124
3163
  #include <lightmap_pars_fragment>
3125
3164
  #include <emissivemap_pars_fragment>
3165
+ #include <cube_uv_reflection_fragment>
3126
3166
  #include <envmap_common_pars_fragment>
3127
3167
  #include <envmap_pars_fragment>
3168
+ #include <envmap_physical_pars_fragment>
3128
3169
  #include <fog_pars_fragment>
3129
3170
  #include <bsdfs>
3130
3171
  #include <lights_pars_begin>
@@ -3164,7 +3205,7 @@ void main() {
3164
3205
  #include <fog_fragment>
3165
3206
  #include <premultiplied_alpha_fragment>
3166
3207
  #include <dithering_fragment>
3167
- }\`,oa=\`#define STANDARD
3208
+ }\`,da=\`#define STANDARD
3168
3209
  varying vec3 vViewPosition;
3169
3210
  #ifdef USE_TRANSMISSION
3170
3211
  varying vec3 vWorldPosition;
@@ -3207,7 +3248,7 @@ void main() {
3207
3248
  #ifdef USE_TRANSMISSION
3208
3249
  vWorldPosition = worldPosition.xyz;
3209
3250
  #endif
3210
- }\`,la=\`#define STANDARD
3251
+ }\`,fa=\`#define STANDARD
3211
3252
  #ifdef PHYSICAL
3212
3253
  #define IOR
3213
3254
  #define USE_SPECULAR
@@ -3332,7 +3373,7 @@ void main() {
3332
3373
  #include <fog_fragment>
3333
3374
  #include <premultiplied_alpha_fragment>
3334
3375
  #include <dithering_fragment>
3335
- }\`,ca=\`#define TOON
3376
+ }\`,pa=\`#define TOON
3336
3377
  varying vec3 vViewPosition;
3337
3378
  #include <common>
3338
3379
  #include <batching_pars_vertex>
@@ -3369,7 +3410,7 @@ void main() {
3369
3410
  #include <worldpos_vertex>
3370
3411
  #include <shadowmap_vertex>
3371
3412
  #include <fog_vertex>
3372
- }\`,ha=\`#define TOON
3413
+ }\`,ma=\`#define TOON
3373
3414
  uniform vec3 diffuse;
3374
3415
  uniform vec3 emissive;
3375
3416
  uniform float opacity;
@@ -3421,7 +3462,7 @@ void main() {
3421
3462
  #include <fog_fragment>
3422
3463
  #include <premultiplied_alpha_fragment>
3423
3464
  #include <dithering_fragment>
3424
- }\`,ua=\`uniform float size;
3465
+ }\`,ga=\`uniform float size;
3425
3466
  uniform float scale;
3426
3467
  #include <common>
3427
3468
  #include <color_pars_vertex>
@@ -3452,7 +3493,7 @@ void main() {
3452
3493
  #include <clipping_planes_vertex>
3453
3494
  #include <worldpos_vertex>
3454
3495
  #include <fog_vertex>
3455
- }\`,da=\`uniform vec3 diffuse;
3496
+ }\`,_a=\`uniform vec3 diffuse;
3456
3497
  uniform float opacity;
3457
3498
  #include <common>
3458
3499
  #include <color_pars_fragment>
@@ -3477,7 +3518,7 @@ void main() {
3477
3518
  #include <colorspace_fragment>
3478
3519
  #include <fog_fragment>
3479
3520
  #include <premultiplied_alpha_fragment>
3480
- }\`,fa=\`#include <common>
3521
+ }\`,xa=\`#include <common>
3481
3522
  #include <batching_pars_vertex>
3482
3523
  #include <fog_pars_vertex>
3483
3524
  #include <morphtarget_pars_vertex>
@@ -3500,7 +3541,7 @@ void main() {
3500
3541
  #include <worldpos_vertex>
3501
3542
  #include <shadowmap_vertex>
3502
3543
  #include <fog_vertex>
3503
- }\`,pa=\`uniform vec3 color;
3544
+ }\`,va=\`uniform vec3 color;
3504
3545
  uniform float opacity;
3505
3546
  #include <common>
3506
3547
  #include <fog_pars_fragment>
@@ -3515,7 +3556,8 @@ void main() {
3515
3556
  #include <tonemapping_fragment>
3516
3557
  #include <colorspace_fragment>
3517
3558
  #include <fog_fragment>
3518
- }\`,ma=\`uniform float rotation;
3559
+ #include <premultiplied_alpha_fragment>
3560
+ }\`,ya=\`uniform float rotation;
3519
3561
  uniform vec2 center;
3520
3562
  #include <common>
3521
3563
  #include <uv_pars_vertex>
@@ -3539,7 +3581,7 @@ void main() {
3539
3581
  #include <logdepthbuf_vertex>
3540
3582
  #include <clipping_planes_vertex>
3541
3583
  #include <fog_vertex>
3542
- }\`,ga=\`uniform vec3 diffuse;
3584
+ }\`,Ma=\`uniform vec3 diffuse;
3543
3585
  uniform float opacity;
3544
3586
  #include <common>
3545
3587
  #include <uv_pars_fragment>
@@ -3564,16 +3606,16 @@ void main() {
3564
3606
  #include <tonemapping_fragment>
3565
3607
  #include <colorspace_fragment>
3566
3608
  #include <fog_fragment>
3567
- }\`,C={alphahash_fragment:Bi,alphahash_pars_fragment:zi,alphamap_fragment:Vi,alphamap_pars_fragment:ki,alphatest_fragment:Gi,alphatest_pars_fragment:Hi,aomap_fragment:Wi,aomap_pars_fragment:Xi,batching_pars_vertex:qi,batching_vertex:Yi,begin_vertex:Zi,beginnormal_vertex:Ji,bsdfs:\$i,iridescence_fragment:Ki,bumpmap_pars_fragment:Qi,clipping_planes_fragment:ji,clipping_planes_pars_fragment:es,clipping_planes_pars_vertex:ts,clipping_planes_vertex:ns,color_fragment:is,color_pars_fragment:ss,color_pars_vertex:rs,color_vertex:as,common:os,cube_uv_reflection_fragment:ls,defaultnormal_vertex:cs,displacementmap_pars_vertex:hs,displacementmap_vertex:us,emissivemap_fragment:ds,emissivemap_pars_fragment:fs,colorspace_fragment:ps,colorspace_pars_fragment:ms,envmap_fragment:gs,envmap_common_pars_fragment:_s,envmap_pars_fragment:xs,envmap_pars_vertex:vs,envmap_physical_pars_fragment:Is,envmap_vertex:ys,fog_vertex:Ms,fog_pars_vertex:Ss,fog_fragment:bs,fog_pars_fragment:As,gradientmap_pars_fragment:Ts,lightmap_pars_fragment:Es,lights_lambert_fragment:ws,lights_lambert_pars_fragment:Cs,lights_pars_begin:Rs,lights_toon_fragment:Ps,lights_toon_pars_fragment:Ls,lights_phong_fragment:Ds,lights_phong_pars_fragment:Us,lights_physical_fragment:Ns,lights_physical_pars_fragment:Fs,lights_fragment_begin:Os,lights_fragment_maps:Bs,lights_fragment_end:zs,logdepthbuf_fragment:Vs,logdepthbuf_pars_fragment:ks,logdepthbuf_pars_vertex:Gs,logdepthbuf_vertex:Hs,map_fragment:Ws,map_pars_fragment:Xs,map_particle_fragment:qs,map_particle_pars_fragment:Ys,metalnessmap_fragment:Zs,metalnessmap_pars_fragment:Js,morphinstance_vertex:\$s,morphcolor_vertex:Ks,morphnormal_vertex:Qs,morphtarget_pars_vertex:js,morphtarget_vertex:er,normal_fragment_begin:tr,normal_fragment_maps:nr,normal_pars_fragment:ir,normal_pars_vertex:sr,normal_vertex:rr,normalmap_pars_fragment:ar,clearcoat_normal_fragment_begin:or,clearcoat_normal_fragment_maps:lr,clearcoat_pars_fragment:cr,iridescence_pars_fragment:hr,opaque_fragment:ur,packing:dr,premultiplied_alpha_fragment:fr,project_vertex:pr,dithering_fragment:mr,dithering_pars_fragment:gr,roughnessmap_fragment:_r,roughnessmap_pars_fragment:xr,shadowmap_pars_fragment:vr,shadowmap_pars_vertex:yr,shadowmap_vertex:Mr,shadowmask_pars_fragment:Sr,skinbase_vertex:br,skinning_pars_vertex:Ar,skinning_vertex:Tr,skinnormal_vertex:Er,specularmap_fragment:wr,specularmap_pars_fragment:Cr,tonemapping_fragment:Rr,tonemapping_pars_fragment:Ir,transmission_fragment:Pr,transmission_pars_fragment:Lr,uv_pars_fragment:Dr,uv_pars_vertex:Ur,uv_vertex:Nr,worldpos_vertex:Fr,background_vert:Or,background_frag:Br,backgroundCube_vert:zr,backgroundCube_frag:Vr,cube_vert:kr,cube_frag:Gr,depth_vert:Hr,depth_frag:Wr,distance_vert:Xr,distance_frag:qr,equirect_vert:Yr,equirect_frag:Zr,linedashed_vert:Jr,linedashed_frag:\$r,meshbasic_vert:Kr,meshbasic_frag:Qr,meshlambert_vert:jr,meshlambert_frag:ea,meshmatcap_vert:ta,meshmatcap_frag:na,meshnormal_vert:ia,meshnormal_frag:sa,meshphong_vert:ra,meshphong_frag:aa,meshphysical_vert:oa,meshphysical_frag:la,meshtoon_vert:ca,meshtoon_frag:ha,points_vert:ua,points_frag:da,shadow_vert:fa,shadow_frag:pa,sprite_vert:ma,sprite_frag:ga},M={common:{diffuse:{value:new D(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new w},alphaMap:{value:null},alphaMapTransform:{value:new w},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new w}},envmap:{envMap:{value:null},envMapRotation:{value:new w},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new w}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new w}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new w},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new w},normalScale:{value:new H(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new w},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new w}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new w}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new w}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new D(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new D(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new w},alphaTest:{value:0},uvTransform:{value:new w}},sprite:{diffuse:{value:new D(16777215)},opacity:{value:1},center:{value:new H(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new w},alphaMap:{value:null},alphaMapTransform:{value:new w},alphaTest:{value:0}}},fi={basic:{uniforms:W([M.common,M.specularmap,M.envmap,M.aomap,M.lightmap,M.fog]),vertexShader:C.meshbasic_vert,fragmentShader:C.meshbasic_frag},lambert:{uniforms:W([M.common,M.specularmap,M.envmap,M.aomap,M.lightmap,M.emissivemap,M.bumpmap,M.normalmap,M.displacementmap,M.fog,M.lights,{emissive:{value:new D(0)}}]),vertexShader:C.meshlambert_vert,fragmentShader:C.meshlambert_frag},phong:{uniforms:W([M.common,M.specularmap,M.envmap,M.aomap,M.lightmap,M.emissivemap,M.bumpmap,M.normalmap,M.displacementmap,M.fog,M.lights,{emissive:{value:new D(0)},specular:{value:new D(1118481)},shininess:{value:30}}]),vertexShader:C.meshphong_vert,fragmentShader:C.meshphong_frag},standard:{uniforms:W([M.common,M.envmap,M.aomap,M.lightmap,M.emissivemap,M.bumpmap,M.normalmap,M.displacementmap,M.roughnessmap,M.metalnessmap,M.fog,M.lights,{emissive:{value:new D(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:C.meshphysical_vert,fragmentShader:C.meshphysical_frag},toon:{uniforms:W([M.common,M.aomap,M.lightmap,M.emissivemap,M.bumpmap,M.normalmap,M.displacementmap,M.gradientmap,M.fog,M.lights,{emissive:{value:new D(0)}}]),vertexShader:C.meshtoon_vert,fragmentShader:C.meshtoon_frag},matcap:{uniforms:W([M.common,M.bumpmap,M.normalmap,M.displacementmap,M.fog,{matcap:{value:null}}]),vertexShader:C.meshmatcap_vert,fragmentShader:C.meshmatcap_frag},points:{uniforms:W([M.points,M.fog]),vertexShader:C.points_vert,fragmentShader:C.points_frag},dashed:{uniforms:W([M.common,M.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:C.linedashed_vert,fragmentShader:C.linedashed_frag},depth:{uniforms:W([M.common,M.displacementmap]),vertexShader:C.depth_vert,fragmentShader:C.depth_frag},normal:{uniforms:W([M.common,M.bumpmap,M.normalmap,M.displacementmap,{opacity:{value:1}}]),vertexShader:C.meshnormal_vert,fragmentShader:C.meshnormal_frag},sprite:{uniforms:W([M.sprite,M.fog]),vertexShader:C.sprite_vert,fragmentShader:C.sprite_frag},background:{uniforms:{uvTransform:{value:new w},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:C.background_vert,fragmentShader:C.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new w}},vertexShader:C.backgroundCube_vert,fragmentShader:C.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:C.cube_vert,fragmentShader:C.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:C.equirect_vert,fragmentShader:C.equirect_frag},distance:{uniforms:W([M.common,M.displacementmap,{referencePosition:{value:new x},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:C.distance_vert,fragmentShader:C.distance_frag},shadow:{uniforms:W([M.lights,M.fog,{color:{value:new D(0)},opacity:{value:1}}]),vertexShader:C.shadow_vert,fragmentShader:C.shadow_frag}};fi.physical={uniforms:W([fi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new w},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new w},clearcoatNormalScale:{value:new H(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new w},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new w},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new w},sheen:{value:0},sheenColor:{value:new D(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new w},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new w},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new w},transmissionSamplerSize:{value:new H},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new w},attenuationDistance:{value:0},attenuationColor:{value:new D(0)},specularColor:{value:new D(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new w},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new w},anisotropyVector:{value:new H},anisotropyMap:{value:null},anisotropyMapTransform:{value:new w}}]),vertexShader:C.meshphysical_vert,fragmentShader:C.meshphysical_frag};var Ld={[En]:"LINEAR_TONE_MAPPING",[wn]:"REINHARD_TONE_MAPPING",[Cn]:"CINEON_TONE_MAPPING",[Rn]:"ACES_FILMIC_TONE_MAPPING",[Pn]:"AGX_TONE_MAPPING",[Ln]:"NEUTRAL_TONE_MAPPING",[In]:"CUSTOM_TONE_MAPPING"};var Dd=new Float32Array(16),Ud=new Float32Array(9),Nd=new Float32Array(4);var Fd={[En]:"Linear",[wn]:"Reinhard",[Cn]:"Cineon",[Rn]:"ACESFilmic",[Pn]:"AgX",[Ln]:"Neutral",[In]:"Custom"};var Od={[Kn]:"SHADOWMAP_TYPE_PCF",[Qn]:"SHADOWMAP_TYPE_VSM"};var Bd={[ni]:"ENVMAP_TYPE_CUBE",[Un]:"ENVMAP_TYPE_CUBE",[ii]:"ENVMAP_TYPE_CUBE_UV"};var zd={[Un]:"ENVMAP_MODE_REFRACTION"};var Vd={[jn]:"ENVMAP_BLENDING_MULTIPLY",[ei]:"ENVMAP_BLENDING_MIX",[ti]:"ENVMAP_BLENDING_ADD"};var kd={[vn]:yn,[Mn]:An,[Sn]:Tn,[We]:bn,[yn]:vn,[An]:Mn,[Tn]:Sn,[bn]:We};var Gd=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 Ot=class extends Ae{constructor(e){super(e),this.littleEndian=!0}load(e,t,n,i){let s=this,r=new Ke(s.manager);r.setPath(s.path),r.setResponseType("arraybuffer"),r.setRequestHeader(s.requestHeader),r.setWithCredentials(s.withCredentials),r.load(e,function(a){try{t(s.parse(a))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}_getDataView(e,t,n,i){switch(n){case"F":return i===8?e.getFloat64(t,this.littleEndian):e.getFloat32(t,this.littleEndian);case"I":return i===1?e.getInt8(t):i===2?e.getInt16(t,this.littleEndian):e.getInt32(t,this.littleEndian);case"U":return i===1?e.getUint8(t):i===2?e.getUint16(t,this.littleEndian):e.getUint32(t,this.littleEndian)}}parse(e){function t(d,h){let m=d.length,_=new Uint8Array(h),g=0,y=0,v,b,S;do if(v=d[g++],v<32){if(v++,y+v>h)throw new Error("Output buffer is not large enough");if(g+v>m)throw new Error("Invalid compressed data");do _[y++]=d[g++];while(--v)}else{if(b=v>>5,S=y-((v&31)<<8)-1,g>=m)throw new Error("Invalid compressed data");if(b===7&&(b+=d[g++],g>=m))throw new Error("Invalid compressed data");if(S-=d[g++],y+b+2>h)throw new Error("Output buffer is not large enough");if(S<0)throw new Error("Invalid compressed data");if(S>=y)throw new Error("Invalid compressed data");do _[y++]=_[S++];while(--b+2)}while(g<m);return _}function n(d){let h={},m=new Uint8Array(d),_="",g="",y=0,v=!1,b=m.length;for(;y<b&&v===!1;){let A=String.fromCharCode(m[y++]);A===\`
3568
- \`||A==="\\r"?(g.trim().toLowerCase().startsWith("data")&&(v=!0),g=""):g+=A,_+=A}let S=_.search(/[\\r\\n]DATA\\s(\\S*)\\s/i),E=/[\\r\\n]DATA\\s(\\S*)\\s/i.exec(_.slice(S-1));if(h.data=E[1],h.headerLen=E[0].length+S,h.str=_.slice(0,h.headerLen),h.str=h.str.replace(/#.*/gi,""),h.version=/^VERSION (.*)/im.exec(h.str),h.fields=/^FIELDS (.*)/im.exec(h.str),h.size=/^SIZE (.*)/im.exec(h.str),h.type=/^TYPE (.*)/im.exec(h.str),h.count=/^COUNT (.*)/im.exec(h.str),h.width=/^WIDTH (.*)/im.exec(h.str),h.height=/^HEIGHT (.*)/im.exec(h.str),h.viewpoint=/^VIEWPOINT (.*)/im.exec(h.str),h.points=/^POINTS (.*)/im.exec(h.str),h.version!==null&&(h.version=parseFloat(h.version[1])),h.fields=h.fields!==null?h.fields[1].split(" "):[],h.type!==null&&(h.type=h.type[1].split(" ")),h.width!==null&&(h.width=parseInt(h.width[1])),h.height!==null&&(h.height=parseInt(h.height[1])),h.viewpoint!==null&&(h.viewpoint=h.viewpoint[1]),h.points!==null&&(h.points=parseInt(h.points[1],10)),h.points===null&&(h.points=h.width*h.height),h.size!==null&&(h.size=h.size[1].split(" ").map(function(A){return parseInt(A,10)})),h.count!==null)h.count=h.count[1].split(" ").map(function(A){return parseInt(A,10)});else{h.count=[];for(let A=0,P=h.fields.length;A<P;A++)h.count.push(1)}h.offset={};let T=0;for(let A=0,P=h.fields.length;A<P;A++)h.data==="ascii"?h.offset[h.fields[A]]=A:(h.offset[h.fields[A]]=T,T+=h.size[A]*h.count[A]);return h.rowSize=T,h}let i=n(e),s=[],r=[],a=[],l=[],o=[],c=new D;if(i.data==="ascii"){let d=i.offset,_=new TextDecoder().decode(e).slice(i.headerLen).split(\`
3569
- \`);for(let g=0,y=_.length;g<y;g++){if(_[g]==="")continue;let v=_[g].split(" ");if(d.x!==void 0&&(s.push(parseFloat(v[d.x])),s.push(parseFloat(v[d.y])),s.push(parseFloat(v[d.z]))),d.rgb!==void 0){let b=i.fields.findIndex(U=>U==="rgb"),S=i.type[b],E=parseFloat(v[d.rgb]),T=E;if(S==="F"){let U=new Float32Array(1);U[0]=E,T=new Int32Array(U.buffer)[0]}let A=(T>>16&255)/255,P=(T>>8&255)/255,O=(T>>0&255)/255;c.setRGB(A,P,O,G),a.push(c.r,c.g,c.b)}d.normal_x!==void 0&&(r.push(parseFloat(v[d.normal_x])),r.push(parseFloat(v[d.normal_y])),r.push(parseFloat(v[d.normal_z]))),d.intensity!==void 0&&l.push(parseFloat(v[d.intensity])),d.label!==void 0&&o.push(parseInt(v[d.label]))}}if(i.data==="binary_compressed"){let d=new Uint32Array(e.slice(i.headerLen,i.headerLen+8)),h=d[0],m=d[1],_=t(new Uint8Array(e,i.headerLen+8,h),m),g=new DataView(_.buffer),y=i.offset;for(let v=0;v<i.points;v++){if(y.x!==void 0){let b=i.fields.indexOf("x"),S=i.fields.indexOf("y"),E=i.fields.indexOf("z");s.push(this._getDataView(g,i.points*y.x+i.size[b]*v,i.type[b],i.size[b])),s.push(this._getDataView(g,i.points*y.y+i.size[S]*v,i.type[S],i.size[S])),s.push(this._getDataView(g,i.points*y.z+i.size[E]*v,i.type[E],i.size[E]))}if(y.rgb!==void 0){let b=i.fields.indexOf("rgb"),S=g.getUint8(i.points*y.rgb+i.size[b]*v+2)/255,E=g.getUint8(i.points*y.rgb+i.size[b]*v+1)/255,T=g.getUint8(i.points*y.rgb+i.size[b]*v+0)/255;c.setRGB(S,E,T,G),a.push(c.r,c.g,c.b)}if(y.normal_x!==void 0){let b=i.fields.indexOf("normal_x"),S=i.fields.indexOf("normal_y"),E=i.fields.indexOf("normal_z");r.push(this._getDataView(g,i.points*y.normal_x+i.size[b]*v,i.type[b],i.size[b])),r.push(this._getDataView(g,i.points*y.normal_y+i.size[S]*v,i.type[S],i.size[S])),r.push(this._getDataView(g,i.points*y.normal_z+i.size[E]*v,i.type[E],i.size[E]))}if(y.intensity!==void 0){let b=i.fields.indexOf("intensity");l.push(this._getDataView(g,i.points*y.intensity+i.size[b]*v,i.type[b],i.size[b]))}if(y.label!==void 0){let b=i.fields.indexOf("label");o.push(g.getInt32(i.points*y.label+i.size[b]*v,this.littleEndian))}}}if(i.data==="binary"){let d=new DataView(e,i.headerLen),h=i.offset;for(let m=0,_=0;m<i.points;m++,_+=i.rowSize){if(h.x!==void 0){let g=i.fields.indexOf("x"),y=i.fields.indexOf("y"),v=i.fields.indexOf("z");s.push(this._getDataView(d,_+h.x,i.type[g],i.size[g])),s.push(this._getDataView(d,_+h.y,i.type[y],i.size[y])),s.push(this._getDataView(d,_+h.z,i.type[v],i.size[v]))}if(h.rgb!==void 0){let g=d.getUint8(_+h.rgb+2)/255,y=d.getUint8(_+h.rgb+1)/255,v=d.getUint8(_+h.rgb+0)/255;c.setRGB(g,y,v,G),a.push(c.r,c.g,c.b)}if(h.normal_x!==void 0){let g=i.fields.indexOf("normal_x"),y=i.fields.indexOf("normal_y"),v=i.fields.indexOf("normal_z");r.push(this._getDataView(d,_+h.normal_x,i.type[g],i.size[g])),r.push(this._getDataView(d,_+h.normal_y,i.type[y],i.size[y])),r.push(this._getDataView(d,_+h.normal_z,i.type[v],i.size[v]))}if(h.intensity!==void 0){let g=i.fields.indexOf("intensity");l.push(this._getDataView(d,_+h.intensity,i.type[g],i.size[g]))}h.label!==void 0&&o.push(d.getInt32(_+h.label,this.littleEndian))}}let u=new Ne;s.length>0&&u.setAttribute("position",new oe(s,3)),r.length>0&&u.setAttribute("normal",new oe(r,3)),a.length>0&&u.setAttribute("color",new oe(a,3)),l.length>0&&u.setAttribute("intensity",new oe(l,1)),o.length>0&&u.setAttribute("label",new Ze(o,1)),u.computeBoundingSphere();let f=new Fe({size:.005});return a.length>0&&(f.vertexColors=!0),new Je(u,f)}};var _a=new Ot;globalThis.onmessage=async p=>{let{data:e,id:t}=p.data;if(!(e instanceof Uint8Array)){postMessage({id:t,error:"Invalid data format"});return}try{let n=_a.parse(e.buffer);if(n.geometry){let i=n.geometry.attributes.position?.array??new Float32Array(0),s=n.geometry.attributes.color?.array??null,r=s?new Uint8Array(s.length):null;if(r)for(let a=0,l=s.length;a<l;a++)r[a]=Math.round(s[a]*255);postMessage({positions:i,colors:r,id:t},r?[i.buffer,r.buffer]:[i.buffer])}else postMessage({id:t,error:"Failed to extract geometry"})}catch(n){postMessage({id:t,error:n.message})}};})();
3609
+ }\`,C={alphahash_fragment:Hi,alphahash_pars_fragment:Wi,alphamap_fragment:Xi,alphamap_pars_fragment:qi,alphatest_fragment:Yi,alphatest_pars_fragment:Zi,aomap_fragment:Ji,aomap_pars_fragment:\$i,batching_pars_vertex:Ki,batching_vertex:Qi,begin_vertex:ji,beginnormal_vertex:es,bsdfs:ts,iridescence_fragment:ns,bumpmap_pars_fragment:is,clipping_planes_fragment:ss,clipping_planes_pars_fragment:rs,clipping_planes_pars_vertex:as,clipping_planes_vertex:os,color_fragment:ls,color_pars_fragment:cs,color_pars_vertex:hs,color_vertex:us,common:ds,cube_uv_reflection_fragment:fs,defaultnormal_vertex:ps,displacementmap_pars_vertex:ms,displacementmap_vertex:gs,emissivemap_fragment:_s,emissivemap_pars_fragment:xs,colorspace_fragment:vs,colorspace_pars_fragment:ys,envmap_fragment:Ms,envmap_common_pars_fragment:Ss,envmap_pars_fragment:bs,envmap_pars_vertex:Ts,envmap_physical_pars_fragment:Ns,envmap_vertex:As,fog_vertex:Es,fog_pars_vertex:ws,fog_fragment:Cs,fog_pars_fragment:Rs,gradientmap_pars_fragment:Is,lightmap_pars_fragment:Ps,lights_lambert_fragment:Ds,lights_lambert_pars_fragment:Ls,lights_pars_begin:Us,lights_toon_fragment:Fs,lights_toon_pars_fragment:Os,lights_phong_fragment:Bs,lights_phong_pars_fragment:zs,lights_physical_fragment:Vs,lights_physical_pars_fragment:ks,lights_fragment_begin:Gs,lights_fragment_maps:Hs,lights_fragment_end:Ws,logdepthbuf_fragment:Xs,logdepthbuf_pars_fragment:qs,logdepthbuf_pars_vertex:Ys,logdepthbuf_vertex:Zs,map_fragment:Js,map_pars_fragment:\$s,map_particle_fragment:Ks,map_particle_pars_fragment:Qs,metalnessmap_fragment:js,metalnessmap_pars_fragment:er,morphinstance_vertex:tr,morphcolor_vertex:nr,morphnormal_vertex:ir,morphtarget_pars_vertex:sr,morphtarget_vertex:rr,normal_fragment_begin:ar,normal_fragment_maps:or,normal_pars_fragment:lr,normal_pars_vertex:cr,normal_vertex:hr,normalmap_pars_fragment:ur,clearcoat_normal_fragment_begin:dr,clearcoat_normal_fragment_maps:fr,clearcoat_pars_fragment:pr,iridescence_pars_fragment:mr,opaque_fragment:gr,packing:_r,premultiplied_alpha_fragment:xr,project_vertex:vr,dithering_fragment:yr,dithering_pars_fragment:Mr,roughnessmap_fragment:Sr,roughnessmap_pars_fragment:br,shadowmap_pars_fragment:Tr,shadowmap_pars_vertex:Ar,shadowmap_vertex:Er,shadowmask_pars_fragment:wr,skinbase_vertex:Cr,skinning_pars_vertex:Rr,skinning_vertex:Ir,skinnormal_vertex:Pr,specularmap_fragment:Dr,specularmap_pars_fragment:Lr,tonemapping_fragment:Ur,tonemapping_pars_fragment:Nr,transmission_fragment:Fr,transmission_pars_fragment:Or,uv_pars_fragment:Br,uv_pars_vertex:zr,uv_vertex:Vr,worldpos_vertex:kr,background_vert:Gr,background_frag:Hr,backgroundCube_vert:Wr,backgroundCube_frag:Xr,cube_vert:qr,cube_frag:Yr,depth_vert:Zr,depth_frag:Jr,distance_vert:\$r,distance_frag:Kr,equirect_vert:Qr,equirect_frag:jr,linedashed_vert:ea,linedashed_frag:ta,meshbasic_vert:na,meshbasic_frag:ia,meshlambert_vert:sa,meshlambert_frag:ra,meshmatcap_vert:aa,meshmatcap_frag:oa,meshnormal_vert:la,meshnormal_frag:ca,meshphong_vert:ha,meshphong_frag:ua,meshphysical_vert:da,meshphysical_frag:fa,meshtoon_vert:pa,meshtoon_frag:ma,points_vert:ga,points_frag:_a,shadow_vert:xa,shadow_frag:va,sprite_vert:ya,sprite_frag:Ma},M={common:{diffuse:{value:new O(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new w},alphaMap:{value:null},alphaMapTransform:{value:new w},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new w}},envmap:{envMap:{value:null},envMapRotation:{value:new w},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new w}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new w}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new w},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new w},normalScale:{value:new X(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new w},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new w}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new w}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new w}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new O(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}},points:{diffuse:{value:new O(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new w},alphaTest:{value:0},uvTransform:{value:new w}},sprite:{diffuse:{value:new O(16777215)},opacity:{value:1},center:{value:new X(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new w},alphaMap:{value:null},alphaMapTransform:{value:new w},alphaTest:{value:0}}},gi={basic:{uniforms:q([M.common,M.specularmap,M.envmap,M.aomap,M.lightmap,M.fog]),vertexShader:C.meshbasic_vert,fragmentShader:C.meshbasic_frag},lambert:{uniforms:q([M.common,M.specularmap,M.envmap,M.aomap,M.lightmap,M.emissivemap,M.bumpmap,M.normalmap,M.displacementmap,M.fog,M.lights,{emissive:{value:new O(0)},envMapIntensity:{value:1}}]),vertexShader:C.meshlambert_vert,fragmentShader:C.meshlambert_frag},phong:{uniforms:q([M.common,M.specularmap,M.envmap,M.aomap,M.lightmap,M.emissivemap,M.bumpmap,M.normalmap,M.displacementmap,M.fog,M.lights,{emissive:{value:new O(0)},specular:{value:new O(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:C.meshphong_vert,fragmentShader:C.meshphong_frag},standard:{uniforms:q([M.common,M.envmap,M.aomap,M.lightmap,M.emissivemap,M.bumpmap,M.normalmap,M.displacementmap,M.roughnessmap,M.metalnessmap,M.fog,M.lights,{emissive:{value:new O(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:C.meshphysical_vert,fragmentShader:C.meshphysical_frag},toon:{uniforms:q([M.common,M.aomap,M.lightmap,M.emissivemap,M.bumpmap,M.normalmap,M.displacementmap,M.gradientmap,M.fog,M.lights,{emissive:{value:new O(0)}}]),vertexShader:C.meshtoon_vert,fragmentShader:C.meshtoon_frag},matcap:{uniforms:q([M.common,M.bumpmap,M.normalmap,M.displacementmap,M.fog,{matcap:{value:null}}]),vertexShader:C.meshmatcap_vert,fragmentShader:C.meshmatcap_frag},points:{uniforms:q([M.points,M.fog]),vertexShader:C.points_vert,fragmentShader:C.points_frag},dashed:{uniforms:q([M.common,M.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:C.linedashed_vert,fragmentShader:C.linedashed_frag},depth:{uniforms:q([M.common,M.displacementmap]),vertexShader:C.depth_vert,fragmentShader:C.depth_frag},normal:{uniforms:q([M.common,M.bumpmap,M.normalmap,M.displacementmap,{opacity:{value:1}}]),vertexShader:C.meshnormal_vert,fragmentShader:C.meshnormal_frag},sprite:{uniforms:q([M.sprite,M.fog]),vertexShader:C.sprite_vert,fragmentShader:C.sprite_frag},background:{uniforms:{uvTransform:{value:new w},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:C.background_vert,fragmentShader:C.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new w}},vertexShader:C.backgroundCube_vert,fragmentShader:C.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:C.cube_vert,fragmentShader:C.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:C.equirect_vert,fragmentShader:C.equirect_frag},distance:{uniforms:q([M.common,M.displacementmap,{referencePosition:{value:new v},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:C.distance_vert,fragmentShader:C.distance_frag},shadow:{uniforms:q([M.lights,M.fog,{color:{value:new O(0)},opacity:{value:1}}]),vertexShader:C.shadow_vert,fragmentShader:C.shadow_frag}};gi.physical={uniforms:q([gi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new w},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new w},clearcoatNormalScale:{value:new X(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new w},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new w},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new w},sheen:{value:0},sheenColor:{value:new O(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new w},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new w},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new w},transmissionSamplerSize:{value:new X},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new w},attenuationDistance:{value:0},attenuationColor:{value:new O(0)},specularColor:{value:new O(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new w},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new w},anisotropyVector:{value:new X},anisotropyMap:{value:null},anisotropyMapTransform:{value:new w}}]),vertexShader:C.meshphysical_vert,fragmentShader:C.meshphysical_frag};var Bd={[Cn]:"LINEAR_TONE_MAPPING",[Rn]:"REINHARD_TONE_MAPPING",[In]:"CINEON_TONE_MAPPING",[Pn]:"ACES_FILMIC_TONE_MAPPING",[Ln]:"AGX_TONE_MAPPING",[Un]:"NEUTRAL_TONE_MAPPING",[Dn]:"CUSTOM_TONE_MAPPING"};var zd=new Float32Array(16),Vd=new Float32Array(9),kd=new Float32Array(4);var Gd={[Cn]:"Linear",[Rn]:"Reinhard",[In]:"Cineon",[Pn]:"ACESFilmic",[Ln]:"AgX",[Un]:"Neutral",[Dn]:"Custom"};var Hd={[ei]:"SHADOWMAP_TYPE_PCF",[ti]:"SHADOWMAP_TYPE_VSM"};var Wd={[ri]:"ENVMAP_TYPE_CUBE",[Fn]:"ENVMAP_TYPE_CUBE",[ai]:"ENVMAP_TYPE_CUBE_UV"};var Xd={[Fn]:"ENVMAP_MODE_REFRACTION"};var qd={[ni]:"ENVMAP_BLENDING_MULTIPLY",[ii]:"ENVMAP_BLENDING_MIX",[si]:"ENVMAP_BLENDING_ADD"};var Yd=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 Bt=class extends we{constructor(e){super(e),this.littleEndian=!0}load(e,t,n,i){let s=this,r=new et(s.manager);r.setPath(s.path),r.setResponseType("arraybuffer"),r.setRequestHeader(s.requestHeader),r.setWithCredentials(s.withCredentials),r.load(e,function(a){try{t(s.parse(a))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},n,i)}_getDataView(e,t,n,i){switch(n){case"F":return i===8?e.getFloat64(t,this.littleEndian):e.getFloat32(t,this.littleEndian);case"I":return i===1?e.getInt8(t):i===2?e.getInt16(t,this.littleEndian):e.getInt32(t,this.littleEndian);case"U":return i===1?e.getUint8(t):i===2?e.getUint16(t,this.littleEndian):e.getUint32(t,this.littleEndian)}}parse(e){function t(d,h){let m=d.length,_=new Uint8Array(h),g=0,y=0,x,b,T;do if(x=d[g++],x<32){if(x++,y+x>h)throw new Error("Output buffer is not large enough");if(g+x>m)throw new Error("Invalid compressed data");do _[y++]=d[g++];while(--x)}else{if(b=x>>5,T=y-((x&31)<<8)-1,g>=m)throw new Error("Invalid compressed data");if(b===7&&(b+=d[g++],g>=m))throw new Error("Invalid compressed data");if(T-=d[g++],y+b+2>h)throw new Error("Output buffer is not large enough");if(T<0)throw new Error("Invalid compressed data");if(T>=y)throw new Error("Invalid compressed data");do _[y++]=_[T++];while(--b+2)}while(g<m);return _}function n(d){let h={},m=new Uint8Array(d),_="",g="",y=0,x=!1,b=m.length;for(;y<b&&x===!1;){let S=String.fromCharCode(m[y++]);S===\`
3610
+ \`||S==="\\r"?(g.trim().toLowerCase().startsWith("data")&&(x=!0),g=""):g+=S,_+=S}let T=_.search(/[\\r\\n]DATA\\s(\\S*)\\s/i),A=/[\\r\\n]DATA\\s(\\S*)\\s/i.exec(_.slice(T-1));if(h.data=A[1],h.headerLen=A[0].length+T,h.str=_.slice(0,h.headerLen),h.str=h.str.replace(/#.*/gi,""),h.version=/^VERSION (.*)/im.exec(h.str),h.fields=/^FIELDS (.*)/im.exec(h.str),h.size=/^SIZE (.*)/im.exec(h.str),h.type=/^TYPE (.*)/im.exec(h.str),h.count=/^COUNT (.*)/im.exec(h.str),h.width=/^WIDTH (.*)/im.exec(h.str),h.height=/^HEIGHT (.*)/im.exec(h.str),h.viewpoint=/^VIEWPOINT (.*)/im.exec(h.str),h.points=/^POINTS (.*)/im.exec(h.str),h.version!==null&&(h.version=parseFloat(h.version[1])),h.fields=h.fields!==null?h.fields[1].split(" "):[],h.type!==null&&(h.type=h.type[1].split(" ")),h.width!==null&&(h.width=parseInt(h.width[1])),h.height!==null&&(h.height=parseInt(h.height[1])),h.viewpoint!==null&&(h.viewpoint=h.viewpoint[1]),h.points!==null&&(h.points=parseInt(h.points[1],10)),h.points===null&&(h.points=h.width*h.height),h.size!==null&&(h.size=h.size[1].split(" ").map(function(S){return parseInt(S,10)})),h.count!==null)h.count=h.count[1].split(" ").map(function(S){return parseInt(S,10)});else{h.count=[];for(let S=0,R=h.fields.length;S<R;S++)h.count.push(1)}h.offset={};let E=0;for(let S=0,R=h.fields.length;S<R;S++)h.data==="ascii"?h.offset[h.fields[S]]=S:(h.offset[h.fields[S]]=E,E+=h.size[S]*h.count[S]);return h.rowSize=E,h}let i=n(e),s=[],r=[],a=[],l=[],o=[],c=new O;if(i.data==="ascii"){let d=i.offset,_=new TextDecoder().decode(e).slice(i.headerLen).split(\`
3611
+ \`);for(let g=0,y=_.length;g<y;g++){if(_[g]==="")continue;let x=_[g].split(" ");if(d.x!==void 0&&(s.push(parseFloat(x[d.x])),s.push(parseFloat(x[d.y])),s.push(parseFloat(x[d.z]))),d.rgb!==void 0){let b=i.fields.findIndex(I=>I==="rgb"),T=i.type[b],A=parseFloat(x[d.rgb]),E=A;if(T==="F"){let I=new Float32Array(1);I[0]=A,E=new Int32Array(I.buffer)[0]}let S=(E>>16&255)/255,R=(E>>8&255)/255,P=(E>>0&255)/255;c.setRGB(S,R,P,W),a.push(c.r,c.g,c.b)}d.normal_x!==void 0&&(r.push(parseFloat(x[d.normal_x])),r.push(parseFloat(x[d.normal_y])),r.push(parseFloat(x[d.normal_z]))),d.intensity!==void 0&&l.push(parseFloat(x[d.intensity])),d.label!==void 0&&o.push(parseInt(x[d.label]))}}if(i.data==="binary_compressed"){let d=new Uint32Array(e.slice(i.headerLen,i.headerLen+8)),h=d[0],m=d[1],_=t(new Uint8Array(e,i.headerLen+8,h),m),g=new DataView(_.buffer),y=i.offset;for(let x=0;x<i.points;x++){if(y.x!==void 0){let b=i.fields.indexOf("x"),T=i.fields.indexOf("y"),A=i.fields.indexOf("z");s.push(this._getDataView(g,i.points*y.x+i.size[b]*x,i.type[b],i.size[b])),s.push(this._getDataView(g,i.points*y.y+i.size[T]*x,i.type[T],i.size[T])),s.push(this._getDataView(g,i.points*y.z+i.size[A]*x,i.type[A],i.size[A]))}if(y.rgb!==void 0){let b=i.fields.indexOf("rgb"),T=g.getUint8(i.points*y.rgb+i.size[b]*x+2)/255,A=g.getUint8(i.points*y.rgb+i.size[b]*x+1)/255,E=g.getUint8(i.points*y.rgb+i.size[b]*x+0)/255;c.setRGB(T,A,E,W),a.push(c.r,c.g,c.b)}if(y.normal_x!==void 0){let b=i.fields.indexOf("normal_x"),T=i.fields.indexOf("normal_y"),A=i.fields.indexOf("normal_z");r.push(this._getDataView(g,i.points*y.normal_x+i.size[b]*x,i.type[b],i.size[b])),r.push(this._getDataView(g,i.points*y.normal_y+i.size[T]*x,i.type[T],i.size[T])),r.push(this._getDataView(g,i.points*y.normal_z+i.size[A]*x,i.type[A],i.size[A]))}if(y.intensity!==void 0){let b=i.fields.indexOf("intensity");l.push(this._getDataView(g,i.points*y.intensity+i.size[b]*x,i.type[b],i.size[b]))}if(y.label!==void 0){let b=i.fields.indexOf("label");o.push(this._getDataView(g,i.points*y.label+i.size[b]*x,i.type[b],i.size[b]))}}}if(i.data==="binary"){let d=new DataView(e,i.headerLen),h=i.offset;for(let m=0,_=0;m<i.points;m++,_+=i.rowSize){if(h.x!==void 0){let g=i.fields.indexOf("x"),y=i.fields.indexOf("y"),x=i.fields.indexOf("z");s.push(this._getDataView(d,_+h.x,i.type[g],i.size[g])),s.push(this._getDataView(d,_+h.y,i.type[y],i.size[y])),s.push(this._getDataView(d,_+h.z,i.type[x],i.size[x]))}if(h.rgb!==void 0){let g=d.getUint8(_+h.rgb+2)/255,y=d.getUint8(_+h.rgb+1)/255,x=d.getUint8(_+h.rgb+0)/255;c.setRGB(g,y,x,W),a.push(c.r,c.g,c.b)}if(h.normal_x!==void 0){let g=i.fields.indexOf("normal_x"),y=i.fields.indexOf("normal_y"),x=i.fields.indexOf("normal_z");r.push(this._getDataView(d,_+h.normal_x,i.type[g],i.size[g])),r.push(this._getDataView(d,_+h.normal_y,i.type[y],i.size[y])),r.push(this._getDataView(d,_+h.normal_z,i.type[x],i.size[x]))}if(h.intensity!==void 0){let g=i.fields.indexOf("intensity");l.push(this._getDataView(d,_+h.intensity,i.type[g],i.size[g]))}if(h.label!==void 0){let g=i.fields.indexOf("label");o.push(this._getDataView(d,_+h.label,i.type[g],i.size[g]))}}}let u=new Be;s.length>0&&u.setAttribute("position",new he(s,3)),r.length>0&&u.setAttribute("normal",new he(r,3)),a.length>0&&u.setAttribute("color",new he(a,3)),l.length>0&&u.setAttribute("intensity",new he(l,1)),o.length>0&&u.setAttribute("label",new \$e(o,1)),u.computeBoundingSphere();let f=new ze({size:.005});return a.length>0&&(f.vertexColors=!0),new Qe(u,f)}};var Sa=new Bt;globalThis.onmessage=async p=>{let{data:e,id:t}=p.data;if(!(e instanceof Uint8Array)){postMessage({id:t,error:"Invalid data format"});return}try{let n=Sa.parse(e.buffer);if(n.geometry){let i=n.geometry.attributes.position?.array??new Float32Array(0),s=n.geometry.attributes.color?.array??void 0,r=s?new Uint8Array(s.length):void 0;if(r)for(let a=0,l=s.length;a<l;a++)r[a]=Math.round(s[a]*255);postMessage({positions:i,colors:r,id:t},r?[i.buffer,r.buffer]:[i.buffer])}else postMessage({id:t,error:"Failed to extract geometry"})}catch(n){postMessage({id:t,error:n.message})}};})();
3570
3612
  /*! Bundled license information:
3571
3613
 
3572
3614
  three/build/three.core.js:
3573
3615
  three/build/three.module.js:
3574
3616
  (**
3575
3617
  * @license
3576
- * Copyright 2010-2025 Three.js Authors
3618
+ * Copyright 2010-2026 Three.js Authors
3577
3619
  * SPDX-License-Identifier: MIT
3578
3620
  *)
3579
3621
  */