tokentracker-cli 0.31.1 → 0.33.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 (44) hide show
  1. package/README.ja.md +6 -4
  2. package/README.ko.md +6 -4
  3. package/README.md +7 -4
  4. package/README.zh-CN.md +6 -4
  5. package/dashboard/dist/assets/{ActivityHeatmap-BjiEMIl2.js → ActivityHeatmap-C5lQst9A.js} +1 -1
  6. package/dashboard/dist/assets/{Card-Nlgzr57Q.js → Card-CTEL3aXx.js} +1 -1
  7. package/dashboard/dist/assets/DashboardPage-D7Zl3qdP.js +19 -0
  8. package/dashboard/dist/assets/{DevicePage-B1NhBt9Q.js → DevicePage-D4bkFEEt.js} +1 -1
  9. package/dashboard/dist/assets/{DialogTitle-CEBn-oBo.js → DialogTitle-DD717-IL.js} +2 -2
  10. package/dashboard/dist/assets/{FadeIn-Dbk47nhk.js → FadeIn-BXVxQ51G.js} +1 -1
  11. package/dashboard/dist/assets/{HeaderGithubStar-B0OAKXVw.js → HeaderGithubStar-BxYJXuVn.js} +1 -1
  12. package/dashboard/dist/assets/{IpCheckPage-C0wQLtdK.js → IpCheckPage-B3Se3vu3.js} +1 -1
  13. package/dashboard/dist/assets/{LandingPage-DWSbmVip.js → LandingPage-B-AM1mgc.js} +176 -176
  14. package/dashboard/dist/assets/{LeaderboardAvatar-CLMnffKE.js → LeaderboardAvatar-BNpzqU-s.js} +1 -1
  15. package/dashboard/dist/assets/{LeaderboardPage-CZvefN8H.js → LeaderboardPage-BwlrqFjQ.js} +3 -3
  16. package/dashboard/dist/assets/{LeaderboardProfileModal-DasxA8Lo.js → LeaderboardProfileModal-BXUUSlGG.js} +1 -1
  17. package/dashboard/dist/assets/{LeaderboardProfilePage-DJJ7l3Ix.js → LeaderboardProfilePage-CBXZv4R_.js} +1 -1
  18. package/dashboard/dist/assets/{LimitsPage-xUmhxOqT.js → LimitsPage-Cnk3Do9Y.js} +1 -1
  19. package/dashboard/dist/assets/{LocalOnlyNotice-B3uM29rj.js → LocalOnlyNotice-ilp-Q8oP.js} +1 -1
  20. package/dashboard/dist/assets/{LoginPage-BejL6eIO.js → LoginPage-69LMUSLd.js} +1 -1
  21. package/dashboard/dist/assets/{PopoverPopup-V6vxWbIV.js → PopoverPopup-BvUHJ3fH.js} +1 -1
  22. package/dashboard/dist/assets/{SettingsPage-DossFM4s.js → SettingsPage-B5XGzOcZ.js} +1 -1
  23. package/dashboard/dist/assets/{SkillsPage-COwiRUo1.js → SkillsPage-tCvpIDbZ.js} +1 -1
  24. package/dashboard/dist/assets/{WidgetsPage-CtkM_RQn.js → WidgetsPage-DEsp4TVs.js} +1 -1
  25. package/dashboard/dist/assets/{WrappedPage-BpXrsSoG.js → WrappedPage-3kImp9sV.js} +1 -1
  26. package/dashboard/dist/assets/{agent-logos-D6Jmq7E1.js → agent-logos-4uqTG-g5.js} +1 -1
  27. package/dashboard/dist/assets/{arrow-up-right-BS0sCPTz.js → arrow-up-right-C6REzMq8.js} +1 -1
  28. package/dashboard/dist/assets/check-DF1-jcTm.js +1 -0
  29. package/dashboard/dist/assets/{chevron-down-DyiXbuAL.js → chevron-down-p9KAHQhU.js} +1 -1
  30. package/dashboard/dist/assets/{download-CqDWRO99.js → download-CvJjPKnF.js} +1 -1
  31. package/dashboard/dist/assets/{info-DMW1GFmI.js → info-R9MgHQlV.js} +1 -1
  32. package/dashboard/dist/assets/main-Ctn8FyBC.css +1 -0
  33. package/dashboard/dist/assets/{main-uqC1VAKB.js → main-DdKVCJWa.js} +23 -18
  34. package/dashboard/dist/assets/{use-limits-display-prefs-C04zvO7N.js → use-limits-display-prefs-CbobmO9m.js} +1 -1
  35. package/dashboard/dist/assets/{use-native-settings-BvFr6zgZ.js → use-native-settings-DtFQtjxR.js} +1 -1
  36. package/dashboard/dist/assets/{use-usage-limits-5fwy0xeB.js → use-usage-limits-BwMwzl_A.js} +1 -1
  37. package/dashboard/dist/assets/{useCurrency-vRzRfd7L.js → useCurrency-D8PqG8hW.js} +1 -1
  38. package/dashboard/dist/index.html +2 -2
  39. package/dashboard/dist/share.html +2 -2
  40. package/package.json +1 -1
  41. package/src/lib/pricing/seed-snapshot.json +1 -1
  42. package/dashboard/dist/assets/DashboardPage-z7rLj1gX.js +0 -19
  43. package/dashboard/dist/assets/check-DKwh5hl-.js +0 -1
  44. package/dashboard/dist/assets/main-CjFrTufR.css +0 -1
@@ -1,10 +1,10 @@
1
- import{r as De,u as L,A as wi,N as na,z as Ol,Q as Bl,O as zl,L as qn,a6 as Gl,a7 as Vl,s as Ht,W as kl,a5 as Hl}from"./main-uqC1VAKB.js";import{H as Wl}from"./HeaderGithubStar-B0OAKXVw.js";import{u as ba,a as Ta,b as gi,L as Xl,A as ql}from"./agent-logos-D6Jmq7E1.js";function jl(){if(typeof window>"u")return!1;const n=window.location.hostname;return n==="localhost"||n==="127.0.0.1"||n==="::1"}function Aa(){return jl()?"/":"/dashboard"}const ia="183",Yl=0,wa=1,$l=2,or=1,Zl=2,Ti=3,An=0,At=1,cn=2,un=0,Gn=1,Ra=2,Ca=3,Pa=4,Kl=5,Un=100,Jl=101,Ql=102,ec=103,tc=104,nc=200,ic=201,rc=202,sc=203,ls=204,cs=205,ac=206,oc=207,lc=208,cc=209,hc=210,uc=211,dc=212,fc=213,pc=214,hs=0,us=1,ds=2,ci=3,fs=4,ps=5,ms=6,gs=7,Ho=0,mc=1,gc=2,$t=0,Wo=1,Xo=2,qo=3,jo=4,Yo=5,$o=6,Zo=7,Ko=300,Vn=301,hi=302,Tr=303,Ar=304,xr=306,_s=1e3,hn=1001,xs=1002,xt=1003,_c=1004,Oi=1005,Et=1006,wr=1007,Bn=1008,It=1009,Jo=1010,Qo=1011,Ci=1012,ra=1013,Kt=1014,jt=1015,pn=1016,sa=1017,aa=1018,Pi=1020,el=35902,tl=35899,nl=1021,il=1022,zt=1023,mn=1026,zn=1027,rl=1028,oa=1029,ui=1030,la=1031,ca=1033,lr=33776,cr=33777,hr=33778,ur=33779,vs=35840,Ms=35841,Ss=35842,Es=35843,ys=36196,bs=37492,Ts=37496,As=37488,ws=37489,Rs=37490,Cs=37491,Ps=37808,Ds=37809,Ls=37810,Is=37811,Ns=37812,Fs=37813,Us=37814,Os=37815,Bs=37816,zs=37817,Gs=37818,Vs=37819,ks=37820,Hs=37821,Ws=36492,Xs=36494,qs=36495,js=36283,Ys=36284,$s=36285,Zs=36286,xc=3200,vc=0,Mc=1,bn="",Lt="srgb",kn="srgb-linear",fr="linear",Qe="srgb",jn=7680,Da=519,Sc=512,Ec=513,yc=514,ha=515,bc=516,Tc=517,ua=518,Ac=519,La=35044,Ia="300 es",Yt=2e3,pr=2001;function wc(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function mr(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Rc(){const n=mr("canvas");return n.style.display="block",n}const Na={};function Fa(...n){const e="THREE."+n.shift();console.log(e,...n)}function sl(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function Ie(...n){n=sl(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function je(...n){n=sl(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function gr(...n){const e=n.join(" ");e in Na||(Na[e]=!0,Ie(...n))}function Cc(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const Pc={[hs]:us,[ds]:ms,[fs]:gs,[ci]:ps,[us]:hs,[ms]:ds,[gs]:fs,[ps]:ci};class fi{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const i=t[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const Mt=["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"],Rr=Math.PI/180,Ks=180/Math.PI;function Li(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Mt[n&255]+Mt[n>>8&255]+Mt[n>>16&255]+Mt[n>>24&255]+"-"+Mt[e&255]+Mt[e>>8&255]+"-"+Mt[e>>16&15|64]+Mt[e>>24&255]+"-"+Mt[t&63|128]+Mt[t>>8&255]+"-"+Mt[t>>16&255]+Mt[t>>24&255]+Mt[i&255]+Mt[i>>8&255]+Mt[i>>16&255]+Mt[i>>24&255]).toLowerCase()}function We(n,e,t){return Math.max(e,Math.min(t,n))}function Dc(n,e){return(n%e+e)%e}function Cr(n,e,t){return(1-t)*n+t*e}function _i(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Tt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}class Ke{constructor(e=0,t=0){Ke.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){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[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=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(We(i,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){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(We(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,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){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class pi{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],u=i[r+2],p=i[r+3],h=s[a+0],f=s[a+1],g=s[a+2],v=s[a+3];if(p!==v||l!==h||c!==f||u!==g){let m=l*h+c*f+u*g+p*v;m<0&&(h=-h,f=-f,g=-g,v=-v,m=-m);let d=1-o;if(m<.9995){const S=Math.acos(m),b=Math.sin(S);d=Math.sin(d*S)/b,o=Math.sin(o*S)/b,l=l*d+h*o,c=c*d+f*o,u=u*d+g*o,p=p*d+v*o}else{l=l*d+h*o,c=c*d+f*o,u=u*d+g*o,p=p*d+v*o;const S=1/Math.sqrt(l*l+c*c+u*u+p*p);l*=S,c*=S,u*=S,p*=S}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=p}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],u=i[r+3],p=s[a],h=s[a+1],f=s[a+2],g=s[a+3];return e[t]=o*g+u*p+l*f-c*h,e[t+1]=l*g+u*h+c*p-o*f,e[t+2]=c*g+u*f+o*h-l*p,e[t+3]=u*g-o*p-l*h-c*f,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,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,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){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),u=o(r/2),p=o(s/2),h=l(i/2),f=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=h*u*p+c*f*g,this._y=c*f*p-h*u*g,this._z=c*u*g+h*f*p,this._w=c*u*p-h*f*g;break;case"YXZ":this._x=h*u*p+c*f*g,this._y=c*f*p-h*u*g,this._z=c*u*g-h*f*p,this._w=c*u*p+h*f*g;break;case"ZXY":this._x=h*u*p-c*f*g,this._y=c*f*p+h*u*g,this._z=c*u*g+h*f*p,this._w=c*u*p-h*f*g;break;case"ZYX":this._x=h*u*p-c*f*g,this._y=c*f*p+h*u*g,this._z=c*u*g-h*f*p,this._w=c*u*p+h*f*g;break;case"YZX":this._x=h*u*p+c*f*g,this._y=c*f*p+h*u*g,this._z=c*u*g-h*f*p,this._w=c*u*p-h*f*g;break;case"XZY":this._x=h*u*p-c*f*g,this._y=c*f*p-h*u*g,this._z=c*u*g+h*f*p,this._w=c*u*p+h*f*g;break;default:Ie("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],p=t[10],h=i+o+p;if(h>0){const f=.5/Math.sqrt(h+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(a-r)*f}else if(i>o&&i>p){const f=2*Math.sqrt(1+i-o-p);this._w=(u-l)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(s+c)/f}else if(o>p){const f=2*Math.sqrt(1+o-i-p);this._w=(s-c)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(l+u)/f}else{const f=2*Math.sqrt(1+p-i-o);this._w=(a-r)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(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=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(We(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),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){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-i*c,this._z=s*u+a*c+i*l-r*o,this._w=a*u-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(i=-i,r=-r,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*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}}class W{constructor(e=0,t=0,i=0){W.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,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(Ua.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ua.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*i),u=2*(o*t-s*r),p=2*(s*i-a*t);return this.x=t+l*c+a*p-o*u,this.y=i+l*u+o*c-s*p,this.z=r+l*p+s*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,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=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(We(i,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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Pr.copy(this).projectOnVector(e),this.sub(Pr)}reflect(e){return this.sub(Pr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(We(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}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,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,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(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Pr=new W,Ua=new pi;class Be{constructor(e,t,i,r,s,a,o,l,c){Be.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const 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){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],u=i[4],p=i[7],h=i[2],f=i[5],g=i[8],v=r[0],m=r[3],d=r[6],S=r[1],b=r[4],E=r[7],R=r[2],A=r[5],C=r[8];return s[0]=a*v+o*S+l*R,s[3]=a*m+o*b+l*A,s[6]=a*d+o*E+l*C,s[1]=c*v+u*S+p*R,s[4]=c*m+u*b+p*A,s[7]=c*d+u*E+p*C,s[2]=h*v+f*S+g*R,s[5]=h*m+f*b+g*A,s[8]=h*d+f*E+g*C,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-i*s*u+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],p=u*a-o*c,h=o*l-u*s,f=c*s-a*l,g=t*p+i*h+r*f;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/g;return e[0]=p*v,e[1]=(r*c-u*i)*v,e[2]=(o*i-r*a)*v,e[3]=h*v,e[4]=(u*t-r*l)*v,e[5]=(r*s-o*t)*v,e[6]=f*v,e[7]=(i*l-c*t)*v,e[8]=(a*t-i*s)*v,this}transpose(){let e;const 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){const 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,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Dr.makeScale(e,t)),this}rotate(e){return this.premultiply(Dr.makeRotation(-e)),this}translate(e,t){return this.premultiply(Dr.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){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Dr=new Be,Oa=new Be().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Ba=new Be().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Lc(){const n={enabled:!0,workingColorSpace:kn,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Qe&&(r.r=dn(r.r),r.g=dn(r.g),r.b=dn(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Qe&&(r.r=li(r.r),r.g=li(r.g),r.b=li(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===bn?fr:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return gr("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return gr("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[kn]:{primaries:e,whitePoint:i,transfer:fr,toXYZ:Oa,fromXYZ:Ba,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Lt},outputColorSpaceConfig:{drawingBufferColorSpace:Lt}},[Lt]:{primaries:e,whitePoint:i,transfer:Qe,toXYZ:Oa,fromXYZ:Ba,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Lt}}}),n}const Xe=Lc();function dn(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function li(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Yn;class Ic{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Yn===void 0&&(Yn=mr("canvas")),Yn.width=e.width,Yn.height=e.height;const r=Yn.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=Yn}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=mr("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=dn(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(dn(t[i]/255)*255):t[i]=dn(t[i]);return{data:t,width:e.width,height:e.height}}else return Ie("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Nc=0;class da{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Nc++}),this.uuid=Li(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const 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){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Lr(r[a].image)):s.push(Lr(r[a]))}else s=Lr(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function Lr(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Ic.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(Ie("Texture: Unable to serialize Texture."),{})}let Fc=0;const Ir=new W;class bt extends fi{constructor(e=bt.DEFAULT_IMAGE,t=bt.DEFAULT_MAPPING,i=hn,r=hn,s=Et,a=Bn,o=zt,l=It,c=bt.DEFAULT_ANISOTROPY,u=bn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Fc++}),this.uuid=Li(),this.name="",this.source=new da(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Ke(0,0),this.repeat=new Ke(1,1),this.center=new Ke(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Be,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Ir).x}get height(){return this.source.getSize(Ir).y}get depth(){return this.source.getSize(Ir).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(const t in e){const i=e[t];if(i===void 0){Ie(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Ie(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={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&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Ko)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case _s:e.x=e.x-Math.floor(e.x);break;case hn:e.x=e.x<0?0:1;break;case xs: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 _s:e.y=e.y-Math.floor(e.y);break;case hn:e.y=e.y<0?0:1;break;case xs: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++}}bt.DEFAULT_IMAGE=null;bt.DEFAULT_MAPPING=Ko;bt.DEFAULT_ANISOTROPY=1;class ct{constructor(e=0,t=0,i=0,r=1){ct.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=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;case 3:this.w=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;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}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!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=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.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=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.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],u=l[4],p=l[8],h=l[1],f=l[5],g=l[9],v=l[2],m=l[6],d=l[10];if(Math.abs(u-h)<.01&&Math.abs(p-v)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(p+v)<.1&&Math.abs(g+m)<.1&&Math.abs(c+f+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const b=(c+1)/2,E=(f+1)/2,R=(d+1)/2,A=(u+h)/4,C=(p+v)/4,x=(g+m)/4;return b>E&&b>R?b<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(b),r=A/i,s=C/i):E>R?E<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(E),i=A/r,s=x/r):R<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),i=C/s,r=x/s),this.set(i,r,s,t),this}let S=Math.sqrt((m-g)*(m-g)+(p-v)*(p-v)+(h-u)*(h-u));return Math.abs(S)<.001&&(S=1),this.x=(m-g)/S,this.y=(p-v)/S,this.z=(h-u)/S,this.w=Math.acos((c+f+d-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}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.w=Math.min(this.w,e.w),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.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this.w=We(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this.w=We(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(We(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(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)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(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.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}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}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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Uc extends fi{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Et,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new ct(0,0,e,t),this.scissorTest=!1,this.viewport=new ct(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:i.depth},s=new bt(r),a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:Et,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new da(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Zt extends Uc{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class al extends bt{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xt,this.minFilter=xt,this.wrapR=hn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Oc extends bt{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xt,this.minFilter=xt,this.wrapR=hn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class dt{constructor(e,t,i,r,s,a,o,l,c,u,p,h,f,g,v,m){dt.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,i,r,s,a,o,l,c,u,p,h,f,g,v,m)}set(e,t,i,r,s,a,o,l,c,u,p,h,f,g,v,m){const d=this.elements;return d[0]=e,d[4]=t,d[8]=i,d[12]=r,d[1]=s,d[5]=a,d[9]=o,d[13]=l,d[2]=c,d[6]=u,d[10]=p,d[14]=h,d[3]=f,d[7]=g,d[11]=v,d[15]=m,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 dt().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const 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,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,i=e.elements,r=1/$n.setFromMatrixColumn(e,0).length(),s=1/$n.setFromMatrixColumn(e,1).length(),a=1/$n.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),p=Math.sin(s);if(e.order==="XYZ"){const h=a*u,f=a*p,g=o*u,v=o*p;t[0]=l*u,t[4]=-l*p,t[8]=c,t[1]=f+g*c,t[5]=h-v*c,t[9]=-o*l,t[2]=v-h*c,t[6]=g+f*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*u,f=l*p,g=c*u,v=c*p;t[0]=h+v*o,t[4]=g*o-f,t[8]=a*c,t[1]=a*p,t[5]=a*u,t[9]=-o,t[2]=f*o-g,t[6]=v+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*u,f=l*p,g=c*u,v=c*p;t[0]=h-v*o,t[4]=-a*p,t[8]=g+f*o,t[1]=f+g*o,t[5]=a*u,t[9]=v-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*u,f=a*p,g=o*u,v=o*p;t[0]=l*u,t[4]=g*c-f,t[8]=h*c+v,t[1]=l*p,t[5]=v*c+h,t[9]=f*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,f=a*c,g=o*l,v=o*c;t[0]=l*u,t[4]=v-h*p,t[8]=g*p+f,t[1]=p,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=f*p+g,t[10]=h-v*p}else if(e.order==="XZY"){const h=a*l,f=a*c,g=o*l,v=o*c;t[0]=l*u,t[4]=-p,t[8]=c*u,t[1]=h*p+v,t[5]=a*u,t[9]=f*p-g,t[2]=g*p-f,t[6]=o*u,t[10]=v*p+h}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(Bc,e,zc)}lookAt(e,t,i){const r=this.elements;return Rt.subVectors(e,t),Rt.lengthSq()===0&&(Rt.z=1),Rt.normalize(),xn.crossVectors(i,Rt),xn.lengthSq()===0&&(Math.abs(i.z)===1?Rt.x+=1e-4:Rt.z+=1e-4,Rt.normalize(),xn.crossVectors(i,Rt)),xn.normalize(),Bi.crossVectors(Rt,xn),r[0]=xn.x,r[4]=Bi.x,r[8]=Rt.x,r[1]=xn.y,r[5]=Bi.y,r[9]=Rt.y,r[2]=xn.z,r[6]=Bi.z,r[10]=Rt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],u=i[1],p=i[5],h=i[9],f=i[13],g=i[2],v=i[6],m=i[10],d=i[14],S=i[3],b=i[7],E=i[11],R=i[15],A=r[0],C=r[4],x=r[8],y=r[12],z=r[1],w=r[5],F=r[9],B=r[13],I=r[2],G=r[6],V=r[10],U=r[14],K=r[3],Y=r[7],se=r[11],ce=r[15];return s[0]=a*A+o*z+l*I+c*K,s[4]=a*C+o*w+l*G+c*Y,s[8]=a*x+o*F+l*V+c*se,s[12]=a*y+o*B+l*U+c*ce,s[1]=u*A+p*z+h*I+f*K,s[5]=u*C+p*w+h*G+f*Y,s[9]=u*x+p*F+h*V+f*se,s[13]=u*y+p*B+h*U+f*ce,s[2]=g*A+v*z+m*I+d*K,s[6]=g*C+v*w+m*G+d*Y,s[10]=g*x+v*F+m*V+d*se,s[14]=g*y+v*B+m*U+d*ce,s[3]=S*A+b*z+E*I+R*K,s[7]=S*C+b*w+E*G+R*Y,s[11]=S*x+b*F+E*V+R*se,s[15]=S*y+b*B+E*U+R*ce,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],p=e[6],h=e[10],f=e[14],g=e[3],v=e[7],m=e[11],d=e[15],S=l*f-c*h,b=o*f-c*p,E=o*h-l*p,R=a*f-c*u,A=a*h-l*u,C=a*p-o*u;return t*(v*S-m*b+d*E)-i*(g*S-m*R+d*A)+r*(g*b-v*R+d*C)-s*(g*E-v*A+m*C)}transpose(){const e=this.elements;let 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,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],p=e[9],h=e[10],f=e[11],g=e[12],v=e[13],m=e[14],d=e[15],S=t*o-i*a,b=t*l-r*a,E=t*c-s*a,R=i*l-r*o,A=i*c-s*o,C=r*c-s*l,x=u*v-p*g,y=u*m-h*g,z=u*d-f*g,w=p*m-h*v,F=p*d-f*v,B=h*d-f*m,I=S*B-b*F+E*w+R*z-A*y+C*x;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const G=1/I;return e[0]=(o*B-l*F+c*w)*G,e[1]=(r*F-i*B-s*w)*G,e[2]=(v*C-m*A+d*R)*G,e[3]=(h*A-p*C-f*R)*G,e[4]=(l*z-a*B-c*y)*G,e[5]=(t*B-r*z+s*y)*G,e[6]=(m*E-g*C-d*b)*G,e[7]=(u*C-h*E+f*b)*G,e[8]=(a*F-o*z+c*x)*G,e[9]=(i*z-t*F-s*x)*G,e[10]=(g*A-v*E+d*S)*G,e[11]=(p*E-u*A-f*S)*G,e[12]=(o*y-a*w-l*x)*G,e[13]=(t*w-i*y+r*x)*G,e[14]=(v*b-g*R-m*S)*G,e[15]=(u*R-p*b+h*S)*G,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){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,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+i,u*l-r*a,0,c*l-r*o,u*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,p=o+o,h=s*c,f=s*u,g=s*p,v=a*u,m=a*p,d=o*p,S=l*c,b=l*u,E=l*p,R=i.x,A=i.y,C=i.z;return r[0]=(1-(v+d))*R,r[1]=(f+E)*R,r[2]=(g-b)*R,r[3]=0,r[4]=(f-E)*A,r[5]=(1-(h+d))*A,r[6]=(m+S)*A,r[7]=0,r[8]=(g+b)*C,r[9]=(m-S)*C,r[10]=(1-(h+v))*C,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return i.set(1,1,1),t.identity(),this;let a=$n.set(r[0],r[1],r[2]).length();const o=$n.set(r[4],r[5],r[6]).length(),l=$n.set(r[8],r[9],r[10]).length();s<0&&(a=-a),Ft.copy(this);const c=1/a,u=1/o,p=1/l;return Ft.elements[0]*=c,Ft.elements[1]*=c,Ft.elements[2]*=c,Ft.elements[4]*=u,Ft.elements[5]*=u,Ft.elements[6]*=u,Ft.elements[8]*=p,Ft.elements[9]*=p,Ft.elements[10]*=p,t.setFromRotationMatrix(Ft),i.x=a,i.y=o,i.z=l,this}makePerspective(e,t,i,r,s,a,o=Yt,l=!1){const c=this.elements,u=2*s/(t-e),p=2*s/(i-r),h=(t+e)/(t-e),f=(i+r)/(i-r);let g,v;if(l)g=s/(a-s),v=a*s/(a-s);else if(o===Yt)g=-(a+s)/(a-s),v=-2*a*s/(a-s);else if(o===pr)g=-a/(a-s),v=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=u,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=p,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=g,c[14]=v,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=Yt,l=!1){const c=this.elements,u=2/(t-e),p=2/(i-r),h=-(t+e)/(t-e),f=-(i+r)/(i-r);let g,v;if(l)g=1/(a-s),v=a/(a-s);else if(o===Yt)g=-2/(a-s),v=-(a+s)/(a-s);else if(o===pr)g=-1/(a-s),v=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=u,c[4]=0,c[8]=0,c[12]=h,c[1]=0,c[5]=p,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=g,c[14]=v,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const $n=new W,Ft=new dt,Bc=new W(0,0,0),zc=new W(1,1,1),xn=new W,Bi=new W,Rt=new W,za=new dt,Ga=new pi;let Hn=class ol{constructor(e=0,t=0,i=0,r=ol.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}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,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,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,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],u=r[9],p=r[2],h=r[6],f=r[10];switch(t){case"XYZ":this._y=Math.asin(We(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-We(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-p,s),this._z=0);break;case"ZXY":this._x=Math.asin(We(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-p,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-We(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(h,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(We(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-p,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-We(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:Ie("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return za.makeRotationFromQuaternion(e),this.setFromRotationMatrix(za,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Ga.setFromEuler(this),this.setFromQuaternion(Ga,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}};Hn.DEFAULT_ORDER="XYZ";class ll{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}}let Gc=0;const Va=new W,Zn=new pi,rn=new dt,zi=new W,xi=new W,Vc=new W,kc=new pi,ka=new W(1,0,0),Ha=new W(0,1,0),Wa=new W(0,0,1),Xa={type:"added"},Hc={type:"removed"},Kn={type:"childadded",child:null},Nr={type:"childremoved",child:null};class Pt extends fi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Gc++}),this.uuid=Li(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Pt.DEFAULT_UP.clone();const e=new W,t=new Hn,i=new pi,r=new W(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new dt},normalMatrix:{value:new Be}}),this.matrix=new dt,this.matrixWorld=new dt,this.matrixAutoUpdate=Pt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Pt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ll,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 Zn.setFromAxisAngle(e,t),this.quaternion.multiply(Zn),this}rotateOnWorldAxis(e,t){return Zn.setFromAxisAngle(e,t),this.quaternion.premultiply(Zn),this}rotateX(e){return this.rotateOnAxis(ka,e)}rotateY(e){return this.rotateOnAxis(Ha,e)}rotateZ(e){return this.rotateOnAxis(Wa,e)}translateOnAxis(e,t){return Va.copy(e).applyQuaternion(this.quaternion),this.position.add(Va.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ka,e)}translateY(e){return this.translateOnAxis(Ha,e)}translateZ(e){return this.translateOnAxis(Wa,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(rn.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?zi.copy(e):zi.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),xi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?rn.lookAt(xi,zi,this.up):rn.lookAt(zi,xi,this.up),this.quaternion.setFromRotationMatrix(rn),r&&(rn.extractRotation(r.matrixWorld),Zn.setFromRotationMatrix(rn),this.quaternion.premultiply(Zn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(je("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(Xa),Kn.child=e,this.dispatchEvent(Kn),Kn.child=null):je("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Hc),Nr.child=e,this.dispatchEvent(Nr),Nr.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),rn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),rn.multiply(e.parent.matrixWorld)),e.applyMatrix4(rn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Xa),Kn.child=e,this.dispatchEvent(Kn),Kn.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 i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xi,e,Vc),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xi,kc,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*i-s[8]*r,s[13]+=i-s[1]*t-s[5]*i-s[9]*r,s[14]+=r-s[2]*t-s[6]*i-s[10]*r}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);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.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){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const p=l[c];s(e.shapes,p)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),p=a(e.shapes),h=a(e.skeletons),f=a(e.animations),g=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),p.length>0&&(i.shapes=p),h.length>0&&(i.skeletons=h),f.length>0&&(i.animations=f),g.length>0&&(i.nodes=g)}return i.object=r,i;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}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 i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}Pt.DEFAULT_UP=new W(0,1,0);Pt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Pt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Gi extends Pt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Wc={type:"move"};class Fr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Gi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Gi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new W,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new W),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Gi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new W,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new W),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const v of e.hand.values()){const m=t.getJointPose(v,i),d=this._getHandJoint(c,v);m!==null&&(d.matrix.fromArray(m.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.matrixWorldNeedsUpdate=!0,d.jointRadius=m.radius),d.visible=m!==null}const u=c.joints["index-finger-tip"],p=c.joints["thumb-tip"],h=u.position.distanceTo(p.position),f=.02,g=.005;c.inputState.pinching&&h>f+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=f-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Wc)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Gi;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const cl={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},vn={h:0,s:0,l:0},Vi={h:0,s:0,l:0};function Ur(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class nt{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Lt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Xe.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=Xe.workingColorSpace){return this.r=e,this.g=t,this.b=i,Xe.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=Xe.workingColorSpace){if(e=Dc(e,1),t=We(t,0,1),i=We(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=Ur(a,s,e+1/3),this.g=Ur(a,s,e),this.b=Ur(a,s,e-1/3)}return Xe.colorSpaceToWorking(this,r),this}setStyle(e,t=Lt){function i(s){s!==void 0&&parseFloat(s)<1&&Ie("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(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(o))return i(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(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Ie("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);Ie("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Lt){const i=cl[e.toLowerCase()];return i!==void 0?this.setHex(i,t):Ie("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=dn(e.r),this.g=dn(e.g),this.b=dn(e.b),this}copyLinearToSRGB(e){return this.r=li(e.r),this.g=li(e.g),this.b=li(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Lt){return Xe.workingToColorSpace(St.copy(this),e),Math.round(We(St.r*255,0,255))*65536+Math.round(We(St.g*255,0,255))*256+Math.round(We(St.b*255,0,255))}getHexString(e=Lt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Xe.workingColorSpace){Xe.workingToColorSpace(St.copy(this),t);const i=St.r,r=St.g,s=St.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const p=a-o;switch(c=u<=.5?p/(a+o):p/(2-a-o),a){case i:l=(r-s)/p+(r<s?6:0);break;case r:l=(s-i)/p+2;break;case s:l=(i-r)/p+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=Xe.workingColorSpace){return Xe.workingToColorSpace(St.copy(this),t),e.r=St.r,e.g=St.g,e.b=St.b,e}getStyle(e=Lt){Xe.workingToColorSpace(St.copy(this),e);const t=St.r,i=St.g,r=St.b;return e!==Lt?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(vn),this.setHSL(vn.h+e,vn.s+t,vn.l+i)}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,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(vn),e.getHSL(Vi);const i=Cr(vn.h,Vi.h,t),r=Cr(vn.s,Vi.s,t),s=Cr(vn.l,Vi.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,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}}const St=new nt;nt.NAMES=cl;class Xc extends Pt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Hn,this.environmentIntensity=1,this.environmentRotation=new Hn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Ut=new W,sn=new W,Or=new W,an=new W,Jn=new W,Qn=new W,qa=new W,Br=new W,zr=new W,Gr=new W,Vr=new ct,kr=new ct,Hr=new ct;let vi=class oi{constructor(e=new W,t=new W,i=new W){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),Ut.subVectors(e,t),r.cross(Ut);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){Ut.subVectors(r,t),sn.subVectors(i,t),Or.subVectors(e,t);const a=Ut.dot(Ut),o=Ut.dot(sn),l=Ut.dot(Or),c=sn.dot(sn),u=sn.dot(Or),p=a*c-o*o;if(p===0)return s.set(0,0,0),null;const h=1/p,f=(c*l-o*u)*h,g=(a*u-o*l)*h;return s.set(1-f-g,g,f)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,an)===null?!1:an.x>=0&&an.y>=0&&an.x+an.y<=1}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,an)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,an.x),l.addScaledVector(a,an.y),l.addScaledVector(o,an.z),l)}static getInterpolatedAttribute(e,t,i,r,s,a){return Vr.setScalar(0),kr.setScalar(0),Hr.setScalar(0),Vr.fromBufferAttribute(e,t),kr.fromBufferAttribute(e,i),Hr.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Vr,s.x),a.addScaledVector(kr,s.y),a.addScaledVector(Hr,s.z),a}static isFrontFacing(e,t,i,r){return Ut.subVectors(i,t),sn.subVectors(e,t),Ut.cross(sn).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ut.subVectors(this.c,this.b),sn.subVectors(this.a,this.b),Ut.cross(sn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return oi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return oi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return oi.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return oi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return oi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;Jn.subVectors(r,i),Qn.subVectors(s,i),Br.subVectors(e,i);const l=Jn.dot(Br),c=Qn.dot(Br);if(l<=0&&c<=0)return t.copy(i);zr.subVectors(e,r);const u=Jn.dot(zr),p=Qn.dot(zr);if(u>=0&&p<=u)return t.copy(r);const h=l*p-u*c;if(h<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(i).addScaledVector(Jn,a);Gr.subVectors(e,s);const f=Jn.dot(Gr),g=Qn.dot(Gr);if(g>=0&&f<=g)return t.copy(s);const v=f*c-l*g;if(v<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(i).addScaledVector(Qn,o);const m=u*g-f*p;if(m<=0&&p-u>=0&&f-g>=0)return qa.subVectors(s,r),o=(p-u)/(p-u+(f-g)),t.copy(r).addScaledVector(qa,o);const d=1/(m+v+h);return a=v*d,o=h*d,t.copy(i).addScaledVector(Jn,a).addScaledVector(Qn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};class Ii{constructor(e=new W(1/0,1/0,1/0),t=new W(-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,i=e.length;t<i;t+=3)this.expandByPoint(Ot.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Ot.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Ot.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Ot):Ot.fromBufferAttribute(s,a),Ot.applyMatrix4(e.matrixWorld),this.expandByPoint(Ot);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ki.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),ki.copy(i.boundingBox)),ki.applyMatrix4(e.matrixWorld),this.union(ki)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[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,Ot),Ot.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Mi),Hi.subVectors(this.max,Mi),ei.subVectors(e.a,Mi),ti.subVectors(e.b,Mi),ni.subVectors(e.c,Mi),Mn.subVectors(ti,ei),Sn.subVectors(ni,ti),Cn.subVectors(ei,ni);let t=[0,-Mn.z,Mn.y,0,-Sn.z,Sn.y,0,-Cn.z,Cn.y,Mn.z,0,-Mn.x,Sn.z,0,-Sn.x,Cn.z,0,-Cn.x,-Mn.y,Mn.x,0,-Sn.y,Sn.x,0,-Cn.y,Cn.x,0];return!Wr(t,ei,ti,ni,Hi)||(t=[1,0,0,0,1,0,0,0,1],!Wr(t,ei,ti,ni,Hi))?!1:(Wi.crossVectors(Mn,Sn),t=[Wi.x,Wi.y,Wi.z],Wr(t,ei,ti,ni,Hi))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ot).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ot).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:(on[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),on[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),on[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),on[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),on[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),on[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),on[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),on[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(on),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}}const on=[new W,new W,new W,new W,new W,new W,new W,new W],Ot=new W,ki=new Ii,ei=new W,ti=new W,ni=new W,Mn=new W,Sn=new W,Cn=new W,Mi=new W,Hi=new W,Wi=new W,Pn=new W;function Wr(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){Pn.fromArray(n,s);const o=r.x*Math.abs(Pn.x)+r.y*Math.abs(Pn.y)+r.z*Math.abs(Pn.z),l=e.dot(Pn),c=t.dot(Pn),u=i.dot(Pn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const ut=new W,Xi=new Ke;let qc=0;class Vt{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:qc++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=La,this.updateRanges=[],this.gpuType=jt,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,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Xi.fromBufferAttribute(this,t),Xi.applyMatrix3(e),this.setXY(t,Xi.x,Xi.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)ut.fromBufferAttribute(this,t),ut.applyMatrix3(e),this.setXYZ(t,ut.x,ut.y,ut.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)ut.fromBufferAttribute(this,t),ut.applyMatrix4(e),this.setXYZ(t,ut.x,ut.y,ut.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)ut.fromBufferAttribute(this,t),ut.applyNormalMatrix(e),this.setXYZ(t,ut.x,ut.y,ut.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)ut.fromBufferAttribute(this,t),ut.transformDirection(e),this.setXYZ(t,ut.x,ut.y,ut.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=_i(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Tt(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=_i(t,this.array)),t}setX(e,t){return this.normalized&&(t=Tt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=_i(t,this.array)),t}setY(e,t){return this.normalized&&(t=Tt(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=_i(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Tt(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=_i(t,this.array)),t}setW(e,t){return this.normalized&&(t=Tt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Tt(t,this.array),i=Tt(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Tt(t,this.array),i=Tt(i,this.array),r=Tt(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Tt(t,this.array),i=Tt(i,this.array),r=Tt(r,this.array),s=Tt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,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(){const 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!==La&&(e.usage=this.usage),e}}class hl extends Vt{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class ul extends Vt{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class fn extends Vt{constructor(e,t,i){super(new Float32Array(e),t,i)}}const jc=new Ii,Si=new W,Xr=new W;class fa{constructor(e=new W,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){const i=this.center;t!==void 0?i.copy(t):jc.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),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){const 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){const i=this.center.distanceToSquared(e);return t.copy(e),i>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;Si.subVectors(e,this.center);const t=Si.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Si,r/i),this.radius+=r}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):(Xr.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Si.copy(e.center).add(Xr)),this.expandByPoint(Si.copy(e.center).sub(Xr))),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}}let Yc=0;const Dt=new dt,qr=new Pt,ii=new W,Ct=new Ii,Ei=new Ii,gt=new W;class en extends fi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Yc++}),this.uuid=Li(),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(wc(e)?ul:hl)(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,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new Be().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Dt.makeRotationFromQuaternion(e),this.applyMatrix4(Dt),this}rotateX(e){return Dt.makeRotationX(e),this.applyMatrix4(Dt),this}rotateY(e){return Dt.makeRotationY(e),this.applyMatrix4(Dt),this}rotateZ(e){return Dt.makeRotationZ(e),this.applyMatrix4(Dt),this}translate(e,t,i){return Dt.makeTranslation(e,t,i),this.applyMatrix4(Dt),this}scale(e,t,i){return Dt.makeScale(e,t,i),this.applyMatrix4(Dt),this}lookAt(e){return qr.lookAt(e),qr.updateMatrix(),this.applyMatrix4(qr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ii).negate(),this.translate(ii.x,ii.y,ii.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new fn(i,3))}else{const i=Math.min(e.length,t.count);for(let r=0;r<i;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Ie("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 Ii);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){je("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new W(-1/0,-1/0,-1/0),new W(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Ct.setFromBufferAttribute(s),this.morphTargetsRelative?(gt.addVectors(this.boundingBox.min,Ct.min),this.boundingBox.expandByPoint(gt),gt.addVectors(this.boundingBox.max,Ct.max),this.boundingBox.expandByPoint(gt)):(this.boundingBox.expandByPoint(Ct.min),this.boundingBox.expandByPoint(Ct.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&je('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 fa);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){je("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new W,1/0);return}if(e){const i=this.boundingSphere.center;if(Ct.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Ei.setFromBufferAttribute(o),this.morphTargetsRelative?(gt.addVectors(Ct.min,Ei.min),Ct.expandByPoint(gt),gt.addVectors(Ct.max,Ei.max),Ct.expandByPoint(gt)):(Ct.expandByPoint(Ei.min),Ct.expandByPoint(Ei.max))}Ct.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)gt.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(gt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)gt.fromBufferAttribute(o,c),l&&(ii.fromBufferAttribute(e,c),gt.add(ii)),r=Math.max(r,i.distanceToSquared(gt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&je('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){je("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Vt(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let x=0;x<i.count;x++)o[x]=new W,l[x]=new W;const c=new W,u=new W,p=new W,h=new Ke,f=new Ke,g=new Ke,v=new W,m=new W;function d(x,y,z){c.fromBufferAttribute(i,x),u.fromBufferAttribute(i,y),p.fromBufferAttribute(i,z),h.fromBufferAttribute(s,x),f.fromBufferAttribute(s,y),g.fromBufferAttribute(s,z),u.sub(c),p.sub(c),f.sub(h),g.sub(h);const w=1/(f.x*g.y-g.x*f.y);isFinite(w)&&(v.copy(u).multiplyScalar(g.y).addScaledVector(p,-f.y).multiplyScalar(w),m.copy(p).multiplyScalar(f.x).addScaledVector(u,-g.x).multiplyScalar(w),o[x].add(v),o[y].add(v),o[z].add(v),l[x].add(m),l[y].add(m),l[z].add(m))}let S=this.groups;S.length===0&&(S=[{start:0,count:e.count}]);for(let x=0,y=S.length;x<y;++x){const z=S[x],w=z.start,F=z.count;for(let B=w,I=w+F;B<I;B+=3)d(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const b=new W,E=new W,R=new W,A=new W;function C(x){R.fromBufferAttribute(r,x),A.copy(R);const y=o[x];b.copy(y),b.sub(R.multiplyScalar(R.dot(y))).normalize(),E.crossVectors(A,y);const w=E.dot(l[x])<0?-1:1;a.setXYZW(x,b.x,b.y,b.z,w)}for(let x=0,y=S.length;x<y;++x){const z=S[x],w=z.start,F=z.count;for(let B=w,I=w+F;B<I;B+=3)C(e.getX(B+0)),C(e.getX(B+1)),C(e.getX(B+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Vt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let h=0,f=i.count;h<f;h++)i.setXYZ(h,0,0,0);const r=new W,s=new W,a=new W,o=new W,l=new W,c=new W,u=new W,p=new W;if(e)for(let h=0,f=e.count;h<f;h+=3){const g=e.getX(h+0),v=e.getX(h+1),m=e.getX(h+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,v),a.fromBufferAttribute(t,m),u.subVectors(a,s),p.subVectors(r,s),u.cross(p),o.fromBufferAttribute(i,g),l.fromBufferAttribute(i,v),c.fromBufferAttribute(i,m),o.add(u),l.add(u),c.add(u),i.setXYZ(g,o.x,o.y,o.z),i.setXYZ(v,l.x,l.y,l.z),i.setXYZ(m,c.x,c.y,c.z)}else for(let h=0,f=t.count;h<f;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),u.subVectors(a,s),p.subVectors(r,s),u.cross(p),i.setXYZ(h+0,u.x,u.y,u.z),i.setXYZ(h+1,u.x,u.y,u.z),i.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)gt.fromBufferAttribute(e,t),gt.normalize(),e.setXYZ(t,gt.x,gt.y,gt.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,p=o.normalized,h=new c.constructor(l.length*u);let f=0,g=0;for(let v=0,m=l.length;v<m;v++){o.isInterleavedBufferAttribute?f=l[v]*o.data.stride+o.offset:f=l[v]*u;for(let d=0;d<u;d++)h[g++]=c[f++]}return new Vt(h,u,p)}if(this.index===null)return Ie("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new en,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,p=c.length;u<p;u++){const h=c[u],f=e(h,i);l.push(f)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const 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){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let p=0,h=c.length;p<h;p++){const f=c[p];u.push(f.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.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;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],p=s[c];for(let h=0,f=p.length;h<f;h++)u.push(p[h].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const p=a[c];this.addGroup(p.start,p.count,p.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const 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"})}}let $c=0;class vr extends fi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:$c++}),this.uuid=Li(),this.name="",this.type="Material",this.blending=Gn,this.side=An,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ls,this.blendDst=cs,this.blendEquation=Un,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new nt(0,0,0),this.blendAlpha=0,this.depthFunc=ci,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Da,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=jn,this.stencilZFail=jn,this.stencilZPass=jn,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(const t in e){const i=e[t];if(i===void 0){Ie(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Ie(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Gn&&(i.blending=this.blending),this.side!==An&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==ls&&(i.blendSrc=this.blendSrc),this.blendDst!==cs&&(i.blendDst=this.blendDst),this.blendEquation!==Un&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==ci&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Da&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==jn&&(i.stencilFail=this.stencilFail),this.stencilZFail!==jn&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==jn&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}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;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,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++}}const ln=new W,jr=new W,qi=new W,En=new W,Yr=new W,ji=new W,$r=new W;class Zc{constructor(e=new W,t=new W(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,ln)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ln.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ln.copy(this.origin).addScaledVector(this.direction,t),ln.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){jr.copy(e).add(t).multiplyScalar(.5),qi.copy(t).sub(e).normalize(),En.copy(this.origin).sub(jr);const s=e.distanceTo(t)*.5,a=-this.direction.dot(qi),o=En.dot(this.direction),l=-En.dot(qi),c=En.lengthSq(),u=Math.abs(1-a*a);let p,h,f,g;if(u>0)if(p=a*l-o,h=a*o-l,g=s*u,p>=0)if(h>=-g)if(h<=g){const v=1/u;p*=v,h*=v,f=p*(p+a*h+2*o)+h*(a*p+h+2*l)+c}else h=s,p=Math.max(0,-(a*h+o)),f=-p*p+h*(h+2*l)+c;else h=-s,p=Math.max(0,-(a*h+o)),f=-p*p+h*(h+2*l)+c;else h<=-g?(p=Math.max(0,-(-a*s+o)),h=p>0?-s:Math.min(Math.max(-s,-l),s),f=-p*p+h*(h+2*l)+c):h<=g?(p=0,h=Math.min(Math.max(-s,-l),s),f=h*(h+2*l)+c):(p=Math.max(0,-(a*s+o)),h=p>0?s:Math.min(Math.max(-s,-l),s),f=-p*p+h*(h+2*l)+c);else h=a>0?-s:s,p=Math.max(0,-(a*h+o)),f=-p*p+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,p),r&&r.copy(jr).addScaledVector(qi,h),f}intersectSphere(e,t){ln.subVectors(e.center,this.origin);const i=ln.dot(this.direction),r=ln.dot(ln)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,p=1/this.direction.z,h=this.origin;return c>=0?(i=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(i=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),u>=0?(s=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),p>=0?(o=(e.min.z-h.z)*p,l=(e.max.z-h.z)*p):(o=(e.max.z-h.z)*p,l=(e.min.z-h.z)*p),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,ln)!==null}intersectTriangle(e,t,i,r,s){Yr.subVectors(t,e),ji.subVectors(i,e),$r.crossVectors(Yr,ji);let a=this.direction.dot($r),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;En.subVectors(this.origin,e);const l=o*this.direction.dot(ji.crossVectors(En,ji));if(l<0)return null;const c=o*this.direction.dot(Yr.cross(En));if(c<0||l+c>a)return null;const u=-o*En.dot($r);return u<0?null:this.at(u/a,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)}}class dl extends vr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new nt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Hn,this.combine=Ho,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const ja=new dt,Dn=new Zc,Yi=new fa,Ya=new W,$i=new W,Zi=new W,Ki=new W,Zr=new W,Ji=new W,$a=new W,Qi=new W;let Jt=class extends Pt{constructor(e=new en,t=new dl){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){Ji.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],p=s[l];u!==0&&(Zr.fromBufferAttribute(p,e),a?Ji.addScaledVector(Zr,u):Ji.addScaledVector(Zr.sub(t),u))}t.add(Ji)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Yi.copy(i.boundingSphere),Yi.applyMatrix4(s),Dn.copy(e.ray).recast(e.near),!(Yi.containsPoint(Dn.origin)===!1&&(Dn.intersectSphere(Yi,Ya)===null||Dn.origin.distanceToSquared(Ya)>(e.far-e.near)**2))&&(ja.copy(s).invert(),Dn.copy(e.ray).applyMatrix4(ja),!(i.boundingBox!==null&&Dn.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Dn)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,p=s.attributes.normal,h=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,v=h.length;g<v;g++){const m=h[g],d=a[m.materialIndex],S=Math.max(m.start,f.start),b=Math.min(o.count,Math.min(m.start+m.count,f.start+f.count));for(let E=S,R=b;E<R;E+=3){const A=o.getX(E),C=o.getX(E+1),x=o.getX(E+2);r=er(this,d,e,i,c,u,p,A,C,x),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,f.start),v=Math.min(o.count,f.start+f.count);for(let m=g,d=v;m<d;m+=3){const S=o.getX(m),b=o.getX(m+1),E=o.getX(m+2);r=er(this,a,e,i,c,u,p,S,b,E),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,v=h.length;g<v;g++){const m=h[g],d=a[m.materialIndex],S=Math.max(m.start,f.start),b=Math.min(l.count,Math.min(m.start+m.count,f.start+f.count));for(let E=S,R=b;E<R;E+=3){const A=E,C=E+1,x=E+2;r=er(this,d,e,i,c,u,p,A,C,x),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,f.start),v=Math.min(l.count,f.start+f.count);for(let m=g,d=v;m<d;m+=3){const S=m,b=m+1,E=m+2;r=er(this,a,e,i,c,u,p,S,b,E),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}};function Kc(n,e,t,i,r,s,a,o){let l;if(e.side===At?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,e.side===An,o),l===null)return null;Qi.copy(o),Qi.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(Qi);return c<t.near||c>t.far?null:{distance:c,point:Qi.clone(),object:n}}function er(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,$i),n.getVertexPosition(l,Zi),n.getVertexPosition(c,Ki);const u=Kc(n,e,t,i,$i,Zi,Ki,$a);if(u){const p=new W;vi.getBarycoord($a,$i,Zi,Ki,p),r&&(u.uv=vi.getInterpolatedAttribute(r,o,l,c,p,new Ke)),s&&(u.uv1=vi.getInterpolatedAttribute(s,o,l,c,p,new Ke)),a&&(u.normal=vi.getInterpolatedAttribute(a,o,l,c,p,new W),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new W,materialIndex:0};vi.getNormal($i,Zi,Ki,h.normal),u.face=h,u.barycoord=p}return u}class Jc extends bt{constructor(e=null,t=1,i=1,r,s,a,o,l,c=xt,u=xt,p,h){super(null,a,o,l,c,u,r,s,p,h),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Kr=new W,Qc=new W,eh=new Be;class Fn{constructor(e=new W(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=Kr.subVectors(i,t).cross(Qc.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(Kr),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||eh.getNormalMatrix(e),r=this.coplanarPoint(Kr).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ln=new fa,th=new Ke(.5,.5),tr=new W;class fl{constructor(e=new Fn,t=new Fn,i=new Fn,r=new Fn,s=new Fn,a=new Fn){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Yt,i=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],u=s[4],p=s[5],h=s[6],f=s[7],g=s[8],v=s[9],m=s[10],d=s[11],S=s[12],b=s[13],E=s[14],R=s[15];if(r[0].setComponents(c-a,f-u,d-g,R-S).normalize(),r[1].setComponents(c+a,f+u,d+g,R+S).normalize(),r[2].setComponents(c+o,f+p,d+v,R+b).normalize(),r[3].setComponents(c-o,f-p,d-v,R-b).normalize(),i)r[4].setComponents(l,h,m,E).normalize(),r[5].setComponents(c-l,f-h,d-m,R-E).normalize();else if(r[4].setComponents(c-l,f-h,d-m,R-E).normalize(),t===Yt)r[5].setComponents(c+l,f+h,d+m,R+E).normalize();else if(t===pr)r[5].setComponents(l,h,m,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ln.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ln.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ln)}intersectsSprite(e){Ln.center.set(0,0,0);const t=th.distanceTo(e.center);return Ln.radius=.7071067811865476+t,Ln.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ln)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(tr.x=r.normal.x>0?e.max.x:e.min.x,tr.y=r.normal.y>0?e.max.y:e.min.y,tr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(tr)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class pl extends bt{constructor(e=[],t=Vn,i,r,s,a,o,l,c,u){super(e,t,i,r,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Di extends bt{constructor(e,t,i=Kt,r,s,a,o=xt,l=xt,c,u=mn,p=1){if(u!==mn&&u!==zn)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const h={width:e,height:t,depth:p};super(h,r,s,a,o,l,u,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new da(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class nh extends Di{constructor(e,t=Kt,i=Vn,r,s,a=xt,o=xt,l,c=mn){const u={width:e,height:e,depth:1},p=[u,u,u,u,u,u];super(e,e,t,i,r,s,a,o,l,c),this.image=p,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ml extends bt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ni extends en{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],p=[];let h=0,f=0;g("z","y","x",-1,-1,i,t,e,a,s,0),g("z","y","x",1,-1,i,t,-e,a,s,1),g("x","z","y",1,1,e,i,t,r,a,2),g("x","z","y",1,-1,e,i,-t,r,a,3),g("x","y","z",1,-1,e,t,i,r,s,4),g("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new fn(c,3)),this.setAttribute("normal",new fn(u,3)),this.setAttribute("uv",new fn(p,2));function g(v,m,d,S,b,E,R,A,C,x,y){const z=E/C,w=R/x,F=E/2,B=R/2,I=A/2,G=C+1,V=x+1;let U=0,K=0;const Y=new W;for(let se=0;se<V;se++){const ce=se*w-B;for(let le=0;le<G;le++){const we=le*z-F;Y[v]=we*S,Y[m]=ce*b,Y[d]=I,c.push(Y.x,Y.y,Y.z),Y[v]=0,Y[m]=0,Y[d]=A>0?1:-1,u.push(Y.x,Y.y,Y.z),p.push(le/C),p.push(1-se/x),U+=1}}for(let se=0;se<x;se++)for(let ce=0;ce<C;ce++){const le=h+ce+G*se,we=h+ce+G*(se+1),Ye=h+(ce+1)+G*(se+1),He=h+(ce+1)+G*se;l.push(le,we,He),l.push(we,Ye,He),K+=6}o.addGroup(f,K,y),f+=K,h+=U}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ni(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Mr extends en{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,u=l+1,p=e/o,h=t/l,f=[],g=[],v=[],m=[];for(let d=0;d<u;d++){const S=d*h-a;for(let b=0;b<c;b++){const E=b*p-s;g.push(E,-S,0),v.push(0,0,1),m.push(b/o),m.push(1-d/l)}}for(let d=0;d<l;d++)for(let S=0;S<o;S++){const b=S+c*d,E=S+c*(d+1),R=S+1+c*(d+1),A=S+1+c*d;f.push(b,E,A),f.push(E,R,A)}this.setIndex(f),this.setAttribute("position",new fn(g,3)),this.setAttribute("normal",new fn(v,3)),this.setAttribute("uv",new fn(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Mr(e.width,e.height,e.widthSegments,e.heightSegments)}}function di(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(Ie("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function yt(n){const e={};for(let t=0;t<n.length;t++){const i=di(n[t]);for(const r in i)e[r]=i[r]}return e}function ih(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function gl(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Xe.workingColorSpace}const rh={clone:di,merge:yt};var sh=`void main() {
1
+ import{r as Pe,u as D,A as wi,N as na,z as kl,Q as Hl,O as Wl,L as jn,a7 as Xl,a8 as jl,s as Ht,Y as ql,a6 as Yl}from"./main-DdKVCJWa.js";import{H as $l}from"./HeaderGithubStar-BxYJXuVn.js";import{u as Ta,a as Aa,b as gi,L as Zl,A as Kl}from"./agent-logos-4uqTG-g5.js";function Jl(){if(typeof window>"u")return!1;const n=window.location.hostname;return n==="localhost"||n==="127.0.0.1"||n==="::1"}function wa(){return Jl()?"/":"/dashboard"}const ia="183",Ql=0,Ra=1,ec=2,or=1,tc=2,Ti=3,An=0,At=1,cn=2,dn=0,Gn=1,Ca=2,Pa=3,Da=4,nc=5,Un=100,ic=101,rc=102,sc=103,ac=104,oc=200,lc=201,cc=202,hc=203,ls=204,cs=205,dc=206,uc=207,fc=208,pc=209,mc=210,gc=211,_c=212,xc=213,vc=214,hs=0,ds=1,us=2,ci=3,fs=4,ps=5,ms=6,gs=7,Yo=0,Mc=1,Sc=2,$t=0,$o=1,Zo=2,Ko=3,Jo=4,Qo=5,el=6,tl=7,nl=300,Vn=301,hi=302,Tr=303,Ar=304,xr=306,_s=1e3,hn=1001,xs=1002,xt=1003,Ec=1004,Oi=1005,Et=1006,wr=1007,Bn=1008,It=1009,il=1010,rl=1011,Ci=1012,ra=1013,Kt=1014,qt=1015,pn=1016,sa=1017,aa=1018,Pi=1020,sl=35902,al=35899,ol=1021,ll=1022,zt=1023,mn=1026,zn=1027,cl=1028,oa=1029,di=1030,la=1031,ca=1033,lr=33776,cr=33777,hr=33778,dr=33779,vs=35840,Ms=35841,Ss=35842,Es=35843,ys=36196,bs=37492,Ts=37496,As=37488,ws=37489,Rs=37490,Cs=37491,Ps=37808,Ds=37809,Ls=37810,Is=37811,Ns=37812,Fs=37813,Us=37814,Os=37815,Bs=37816,zs=37817,Gs=37818,Vs=37819,ks=37820,Hs=37821,Ws=36492,Xs=36494,js=36495,qs=36283,Ys=36284,$s=36285,Zs=36286,yc=3200,bc=0,Tc=1,bn="",Lt="srgb",kn="srgb-linear",fr="linear",Qe="srgb",qn=7680,La=519,Ac=512,wc=513,Rc=514,ha=515,Cc=516,Pc=517,da=518,Dc=519,Ia=35044,Na="300 es",Yt=2e3,pr=2001;function Lc(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function mr(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Ic(){const n=mr("canvas");return n.style.display="block",n}const Fa={};function Ua(...n){const e="THREE."+n.shift();console.log(e,...n)}function hl(n){const e=n[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=n[1];t&&t.isStackTrace?n[0]+=" "+t.getLocation():n[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return n}function Ie(...n){n=hl(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...n)}}function qe(...n){n=hl(n);const e="THREE."+n.shift();{const t=n[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...n)}}function gr(...n){const e=n.join(" ");e in Fa||(Fa[e]=!0,Ie(...n))}function Nc(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const Fc={[hs]:ds,[us]:ms,[fs]:gs,[ci]:ps,[ds]:hs,[ms]:us,[gs]:fs,[ps]:ci};class fi{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const r=i[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const i=t[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s<a;s++)r[s].call(this,e);e.target=null}}}const Mt=["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"],Rr=Math.PI/180,Ks=180/Math.PI;function Li(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Mt[n&255]+Mt[n>>8&255]+Mt[n>>16&255]+Mt[n>>24&255]+"-"+Mt[e&255]+Mt[e>>8&255]+"-"+Mt[e>>16&15|64]+Mt[e>>24&255]+"-"+Mt[t&63|128]+Mt[t>>8&255]+"-"+Mt[t>>16&255]+Mt[t>>24&255]+Mt[i&255]+Mt[i>>8&255]+Mt[i>>16&255]+Mt[i>>24&255]).toLowerCase()}function We(n,e,t){return Math.max(e,Math.min(t,n))}function Uc(n,e){return(n%e+e)%e}function Cr(n,e,t){return(1-t)*n+t*e}function _i(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Tt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}class Ke{constructor(e=0,t=0){Ke.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){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[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=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(We(i,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){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(We(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,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){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class pi{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,a,o){let l=i[r+0],c=i[r+1],d=i[r+2],p=i[r+3],h=s[a+0],f=s[a+1],g=s[a+2],v=s[a+3];if(p!==v||l!==h||c!==f||d!==g){let m=l*h+c*f+d*g+p*v;m<0&&(h=-h,f=-f,g=-g,v=-v,m=-m);let u=1-o;if(m<.9995){const S=Math.acos(m),b=Math.sin(S);u=Math.sin(u*S)/b,o=Math.sin(o*S)/b,l=l*u+h*o,c=c*u+f*o,d=d*u+g*o,p=p*u+v*o}else{l=l*u+h*o,c=c*u+f*o,d=d*u+g*o,p=p*u+v*o;const S=1/Math.sqrt(l*l+c*c+d*d+p*p);l*=S,c*=S,d*=S,p*=S}}e[t]=l,e[t+1]=c,e[t+2]=d,e[t+3]=p}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],d=i[r+3],p=s[a],h=s[a+1],f=s[a+2],g=s[a+3];return e[t]=o*g+d*p+l*f-c*h,e[t+1]=l*g+d*h+c*p-o*f,e[t+2]=c*g+d*f+o*h-l*p,e[t+3]=d*g-o*p-l*h-c*f,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,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,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){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),d=o(r/2),p=o(s/2),h=l(i/2),f=l(r/2),g=l(s/2);switch(a){case"XYZ":this._x=h*d*p+c*f*g,this._y=c*f*p-h*d*g,this._z=c*d*g+h*f*p,this._w=c*d*p-h*f*g;break;case"YXZ":this._x=h*d*p+c*f*g,this._y=c*f*p-h*d*g,this._z=c*d*g-h*f*p,this._w=c*d*p+h*f*g;break;case"ZXY":this._x=h*d*p-c*f*g,this._y=c*f*p+h*d*g,this._z=c*d*g+h*f*p,this._w=c*d*p-h*f*g;break;case"ZYX":this._x=h*d*p-c*f*g,this._y=c*f*p+h*d*g,this._z=c*d*g-h*f*p,this._w=c*d*p+h*f*g;break;case"YZX":this._x=h*d*p+c*f*g,this._y=c*f*p+h*d*g,this._z=c*d*g-h*f*p,this._w=c*d*p-h*f*g;break;case"XZY":this._x=h*d*p-c*f*g,this._y=c*f*p-h*d*g,this._z=c*d*g+h*f*p,this._w=c*d*p+h*f*g;break;default:Ie("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],d=t[6],p=t[10],h=i+o+p;if(h>0){const f=.5/Math.sqrt(h+1);this._w=.25/f,this._x=(d-l)*f,this._y=(s-c)*f,this._z=(a-r)*f}else if(i>o&&i>p){const f=2*Math.sqrt(1+i-o-p);this._w=(d-l)/f,this._x=.25*f,this._y=(r+a)/f,this._z=(s+c)/f}else if(o>p){const f=2*Math.sqrt(1+o-i-p);this._w=(s-c)/f,this._x=(r+a)/f,this._y=.25*f,this._z=(l+d)/f}else{const f=2*Math.sqrt(1+p-i-o);this._w=(a-r)/f,this._x=(s+c)/f,this._y=(l+d)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(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=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(We(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),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){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,d=t._w;return this._x=i*d+a*o+r*c-s*l,this._y=r*d+a*l+s*o-i*c,this._z=s*d+a*c+i*l-r*o,this._w=a*d-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){let i=e._x,r=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(i=-i,r=-r,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),d=Math.sin(c);l=Math.sin(l*c)/d,t=Math.sin(t*c)/d,this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+i*t,this._y=this._y*l+r*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*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}}class W{constructor(e=0,t=0,i=0){W.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,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(Oa.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Oa.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*r-o*i),d=2*(o*t-s*r),p=2*(s*i-a*t);return this.x=t+l*c+a*p-o*d,this.y=i+l*d+o*c-s*p,this.z=r+l*p+s*d-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,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=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(We(i,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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Pr.copy(this).projectOnVector(e),this.sub(Pr)}reflect(e){return this.sub(Pr.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(We(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}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,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,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(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Pr=new W,Oa=new pi;class Be{constructor(e,t,i,r,s,a,o,l,c){Be.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=o,d[3]=t,d[4]=s,d[5]=l,d[6]=i,d[7]=a,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const 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){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],d=i[4],p=i[7],h=i[2],f=i[5],g=i[8],v=r[0],m=r[3],u=r[6],S=r[1],b=r[4],E=r[7],R=r[2],A=r[5],C=r[8];return s[0]=a*v+o*S+l*R,s[3]=a*m+o*b+l*A,s[6]=a*u+o*E+l*C,s[1]=c*v+d*S+p*R,s[4]=c*m+d*b+p*A,s[7]=c*u+d*E+p*C,s[2]=h*v+f*S+g*R,s[5]=h*m+f*b+g*A,s[8]=h*u+f*E+g*C,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return t*a*d-t*o*c-i*s*d+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],p=d*a-o*c,h=o*l-d*s,f=c*s-a*l,g=t*p+i*h+r*f;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/g;return e[0]=p*v,e[1]=(r*c-d*i)*v,e[2]=(o*i-r*a)*v,e[3]=h*v,e[4]=(d*t-r*l)*v,e[5]=(r*s-o*t)*v,e[6]=f*v,e[7]=(i*l-c*t)*v,e[8]=(a*t-i*s)*v,this}transpose(){let e;const 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){const 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,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Dr.makeScale(e,t)),this}rotate(e){return this.premultiply(Dr.makeRotation(-e)),this}translate(e,t){return this.premultiply(Dr.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){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Dr=new Be,Ba=new Be().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),za=new Be().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Oc(){const n={enabled:!0,workingColorSpace:kn,spaces:{},convert:function(r,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===Qe&&(r.r=un(r.r),r.g=un(r.g),r.b=un(r.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===Qe&&(r.r=li(r.r),r.g=li(r.g),r.b=li(r.b))),r},workingToColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},colorSpaceToWorking:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===bn?fr:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,a){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(r,s){return gr("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),n.workingToColorSpace(r,s)},toWorkingColorSpace:function(r,s){return gr("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),n.colorSpaceToWorking(r,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[kn]:{primaries:e,whitePoint:i,transfer:fr,toXYZ:Ba,fromXYZ:za,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Lt},outputColorSpaceConfig:{drawingBufferColorSpace:Lt}},[Lt]:{primaries:e,whitePoint:i,transfer:Qe,toXYZ:Ba,fromXYZ:za,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Lt}}}),n}const Xe=Oc();function un(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function li(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Yn;class Bc{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{Yn===void 0&&(Yn=mr("canvas")),Yn.width=e.width,Yn.height=e.height;const r=Yn.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),i=Yn}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=mr("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a<s.length;a++)s[a]=un(s[a]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(un(t[i]/255)*255):t[i]=un(t[i]);return{data:t,width:e.width,height:e.height}}else return Ie("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let zc=0;class ua{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:zc++}),this.uuid=Li(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const 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){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let a=0,o=r.length;a<o;a++)r[a].isDataTexture?s.push(Lr(r[a].image)):s.push(Lr(r[a]))}else s=Lr(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function Lr(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?Bc.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(Ie("Texture: Unable to serialize Texture."),{})}let Gc=0;const Ir=new W;class bt extends fi{constructor(e=bt.DEFAULT_IMAGE,t=bt.DEFAULT_MAPPING,i=hn,r=hn,s=Et,a=Bn,o=zt,l=It,c=bt.DEFAULT_ANISOTROPY,d=bn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Gc++}),this.uuid=Li(),this.name="",this.source=new ua(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new Ke(0,0),this.repeat=new Ke(1,1),this.center=new Ke(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Be,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=d,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(Ir).x}get height(){return this.source.getSize(Ir).y}get depth(){return this.source.getSize(Ir).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(const t in e){const i=e[t];if(i===void 0){Ie(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Ie(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&i&&r.isVector2&&i.isVector2||r&&i&&r.isVector3&&i.isVector3||r&&i&&r.isMatrix3&&i.isMatrix3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={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&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==nl)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case _s:e.x=e.x-Math.floor(e.x);break;case hn:e.x=e.x<0?0:1;break;case xs: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 _s:e.y=e.y-Math.floor(e.y);break;case hn:e.y=e.y<0?0:1;break;case xs: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++}}bt.DEFAULT_IMAGE=null;bt.DEFAULT_MAPPING=nl;bt.DEFAULT_ANISOTROPY=1;class ct{constructor(e=0,t=0,i=0,r=1){ct.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=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;case 3:this.w=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;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}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!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=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.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=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.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],d=l[4],p=l[8],h=l[1],f=l[5],g=l[9],v=l[2],m=l[6],u=l[10];if(Math.abs(d-h)<.01&&Math.abs(p-v)<.01&&Math.abs(g-m)<.01){if(Math.abs(d+h)<.1&&Math.abs(p+v)<.1&&Math.abs(g+m)<.1&&Math.abs(c+f+u-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const b=(c+1)/2,E=(f+1)/2,R=(u+1)/2,A=(d+h)/4,C=(p+v)/4,x=(g+m)/4;return b>E&&b>R?b<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(b),r=A/i,s=C/i):E>R?E<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(E),i=A/r,s=x/r):R<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(R),i=C/s,r=x/s),this.set(i,r,s,t),this}let S=Math.sqrt((m-g)*(m-g)+(p-v)*(p-v)+(h-d)*(h-d));return Math.abs(S)<.001&&(S=1),this.x=(m-g)/S,this.y=(p-v)/S,this.z=(h-d)/S,this.w=Math.acos((c+f+u-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}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.w=Math.min(this.w,e.w),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.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this.w=We(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this.w=We(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(We(i,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(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)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(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.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}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}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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Vc extends fi{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Et,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new ct(0,0,e,t),this.scissorTest=!1,this.viewport=new ct(0,0,e,t),this.textures=[];const r={width:e,height:t,depth:i.depth},s=new bt(r),a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:Et,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new ua(r)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Zt extends Vc{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class dl extends bt{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xt,this.minFilter=xt,this.wrapR=hn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class kc extends bt{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=xt,this.minFilter=xt,this.wrapR=hn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ut{constructor(e,t,i,r,s,a,o,l,c,d,p,h,f,g,v,m){ut.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,i,r,s,a,o,l,c,d,p,h,f,g,v,m)}set(e,t,i,r,s,a,o,l,c,d,p,h,f,g,v,m){const u=this.elements;return u[0]=e,u[4]=t,u[8]=i,u[12]=r,u[1]=s,u[5]=a,u[9]=o,u[13]=l,u[2]=c,u[6]=d,u[10]=p,u[14]=h,u[3]=f,u[7]=g,u[11]=v,u[15]=m,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 ut().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const 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,i){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,i=e.elements,r=1/$n.setFromMatrixColumn(e,0).length(),s=1/$n.setFromMatrixColumn(e,1).length(),a=1/$n.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),d=Math.cos(s),p=Math.sin(s);if(e.order==="XYZ"){const h=a*d,f=a*p,g=o*d,v=o*p;t[0]=l*d,t[4]=-l*p,t[8]=c,t[1]=f+g*c,t[5]=h-v*c,t[9]=-o*l,t[2]=v-h*c,t[6]=g+f*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*d,f=l*p,g=c*d,v=c*p;t[0]=h+v*o,t[4]=g*o-f,t[8]=a*c,t[1]=a*p,t[5]=a*d,t[9]=-o,t[2]=f*o-g,t[6]=v+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*d,f=l*p,g=c*d,v=c*p;t[0]=h-v*o,t[4]=-a*p,t[8]=g+f*o,t[1]=f+g*o,t[5]=a*d,t[9]=v-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*d,f=a*p,g=o*d,v=o*p;t[0]=l*d,t[4]=g*c-f,t[8]=h*c+v,t[1]=l*p,t[5]=v*c+h,t[9]=f*c-g,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,f=a*c,g=o*l,v=o*c;t[0]=l*d,t[4]=v-h*p,t[8]=g*p+f,t[1]=p,t[5]=a*d,t[9]=-o*d,t[2]=-c*d,t[6]=f*p+g,t[10]=h-v*p}else if(e.order==="XZY"){const h=a*l,f=a*c,g=o*l,v=o*c;t[0]=l*d,t[4]=-p,t[8]=c*d,t[1]=h*p+v,t[5]=a*d,t[9]=f*p-g,t[2]=g*p-f,t[6]=o*d,t[10]=v*p+h}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(Hc,e,Wc)}lookAt(e,t,i){const r=this.elements;return Rt.subVectors(e,t),Rt.lengthSq()===0&&(Rt.z=1),Rt.normalize(),xn.crossVectors(i,Rt),xn.lengthSq()===0&&(Math.abs(i.z)===1?Rt.x+=1e-4:Rt.z+=1e-4,Rt.normalize(),xn.crossVectors(i,Rt)),xn.normalize(),Bi.crossVectors(Rt,xn),r[0]=xn.x,r[4]=Bi.x,r[8]=Rt.x,r[1]=xn.y,r[5]=Bi.y,r[9]=Rt.y,r[2]=xn.z,r[6]=Bi.z,r[10]=Rt.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],d=i[1],p=i[5],h=i[9],f=i[13],g=i[2],v=i[6],m=i[10],u=i[14],S=i[3],b=i[7],E=i[11],R=i[15],A=r[0],C=r[4],x=r[8],y=r[12],z=r[1],w=r[5],F=r[9],B=r[13],I=r[2],G=r[6],V=r[10],U=r[14],K=r[3],Y=r[7],se=r[11],ce=r[15];return s[0]=a*A+o*z+l*I+c*K,s[4]=a*C+o*w+l*G+c*Y,s[8]=a*x+o*F+l*V+c*se,s[12]=a*y+o*B+l*U+c*ce,s[1]=d*A+p*z+h*I+f*K,s[5]=d*C+p*w+h*G+f*Y,s[9]=d*x+p*F+h*V+f*se,s[13]=d*y+p*B+h*U+f*ce,s[2]=g*A+v*z+m*I+u*K,s[6]=g*C+v*w+m*G+u*Y,s[10]=g*x+v*F+m*V+u*se,s[14]=g*y+v*B+m*U+u*ce,s[3]=S*A+b*z+E*I+R*K,s[7]=S*C+b*w+E*G+R*Y,s[11]=S*x+b*F+E*V+R*se,s[15]=S*y+b*B+E*U+R*ce,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],p=e[6],h=e[10],f=e[14],g=e[3],v=e[7],m=e[11],u=e[15],S=l*f-c*h,b=o*f-c*p,E=o*h-l*p,R=a*f-c*d,A=a*h-l*d,C=a*p-o*d;return t*(v*S-m*b+u*E)-i*(g*S-m*R+u*A)+r*(g*b-v*R+u*C)-s*(g*E-v*A+m*C)}transpose(){const e=this.elements;let 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,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],p=e[9],h=e[10],f=e[11],g=e[12],v=e[13],m=e[14],u=e[15],S=t*o-i*a,b=t*l-r*a,E=t*c-s*a,R=i*l-r*o,A=i*c-s*o,C=r*c-s*l,x=d*v-p*g,y=d*m-h*g,z=d*u-f*g,w=p*m-h*v,F=p*u-f*v,B=h*u-f*m,I=S*B-b*F+E*w+R*z-A*y+C*x;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const G=1/I;return e[0]=(o*B-l*F+c*w)*G,e[1]=(r*F-i*B-s*w)*G,e[2]=(v*C-m*A+u*R)*G,e[3]=(h*A-p*C-f*R)*G,e[4]=(l*z-a*B-c*y)*G,e[5]=(t*B-r*z+s*y)*G,e[6]=(m*E-g*C-u*b)*G,e[7]=(d*C-h*E+f*b)*G,e[8]=(a*F-o*z+c*x)*G,e[9]=(i*z-t*F-s*x)*G,e[10]=(g*A-v*E+u*S)*G,e[11]=(p*E-d*A-f*S)*G,e[12]=(o*y-a*w-l*x)*G,e[13]=(t*w-i*y+r*x)*G,e[14]=(v*b-g*R-m*S)*G,e[15]=(d*R-p*b+h*S)*G,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){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,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,d*o+i,d*l-r*a,0,c*l-r*o,d*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,d=a+a,p=o+o,h=s*c,f=s*d,g=s*p,v=a*d,m=a*p,u=o*p,S=l*c,b=l*d,E=l*p,R=i.x,A=i.y,C=i.z;return r[0]=(1-(v+u))*R,r[1]=(f+E)*R,r[2]=(g-b)*R,r[3]=0,r[4]=(f-E)*A,r[5]=(1-(h+u))*A,r[6]=(m+S)*A,r[7]=0,r[8]=(g+b)*C,r[9]=(m-S)*C,r[10]=(1-(h+v))*C,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const s=this.determinant();if(s===0)return i.set(1,1,1),t.identity(),this;let a=$n.set(r[0],r[1],r[2]).length();const o=$n.set(r[4],r[5],r[6]).length(),l=$n.set(r[8],r[9],r[10]).length();s<0&&(a=-a),Ft.copy(this);const c=1/a,d=1/o,p=1/l;return Ft.elements[0]*=c,Ft.elements[1]*=c,Ft.elements[2]*=c,Ft.elements[4]*=d,Ft.elements[5]*=d,Ft.elements[6]*=d,Ft.elements[8]*=p,Ft.elements[9]*=p,Ft.elements[10]*=p,t.setFromRotationMatrix(Ft),i.x=a,i.y=o,i.z=l,this}makePerspective(e,t,i,r,s,a,o=Yt,l=!1){const c=this.elements,d=2*s/(t-e),p=2*s/(i-r),h=(t+e)/(t-e),f=(i+r)/(i-r);let g,v;if(l)g=s/(a-s),v=a*s/(a-s);else if(o===Yt)g=-(a+s)/(a-s),v=-2*a*s/(a-s);else if(o===pr)g=-a/(a-s),v=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=p,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=g,c[14]=v,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=Yt,l=!1){const c=this.elements,d=2/(t-e),p=2/(i-r),h=-(t+e)/(t-e),f=-(i+r)/(i-r);let g,v;if(l)g=1/(a-s),v=a/(a-s);else if(o===Yt)g=-2/(a-s),v=-(a+s)/(a-s);else if(o===pr)g=-1/(a-s),v=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=d,c[4]=0,c[8]=0,c[12]=h,c[1]=0,c[5]=p,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=g,c[14]=v,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const $n=new W,Ft=new ut,Hc=new W(0,0,0),Wc=new W(1,1,1),xn=new W,Bi=new W,Rt=new W,Ga=new ut,Va=new pi;let Hn=class ul{constructor(e=0,t=0,i=0,r=ul.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}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,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,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,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],d=r[9],p=r[2],h=r[6],f=r[10];switch(t){case"XYZ":this._y=Math.asin(We(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-We(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-p,s),this._z=0);break;case"ZXY":this._x=Math.asin(We(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-p,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-We(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(h,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(We(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-p,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-We(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-d,f),this._y=0);break;default:Ie("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Ga.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ga,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Va.setFromEuler(this),this.setFromQuaternion(Va,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}};Hn.DEFAULT_ORDER="XYZ";class fl{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}}let Xc=0;const ka=new W,Zn=new pi,rn=new ut,zi=new W,xi=new W,jc=new W,qc=new pi,Ha=new W(1,0,0),Wa=new W(0,1,0),Xa=new W(0,0,1),ja={type:"added"},Yc={type:"removed"},Kn={type:"childadded",child:null},Nr={type:"childremoved",child:null};class Pt extends fi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Xc++}),this.uuid=Li(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Pt.DEFAULT_UP.clone();const e=new W,t=new Hn,i=new pi,r=new W(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new ut},normalMatrix:{value:new Be}}),this.matrix=new ut,this.matrixWorld=new ut,this.matrixAutoUpdate=Pt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Pt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new fl,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 Zn.setFromAxisAngle(e,t),this.quaternion.multiply(Zn),this}rotateOnWorldAxis(e,t){return Zn.setFromAxisAngle(e,t),this.quaternion.premultiply(Zn),this}rotateX(e){return this.rotateOnAxis(Ha,e)}rotateY(e){return this.rotateOnAxis(Wa,e)}rotateZ(e){return this.rotateOnAxis(Xa,e)}translateOnAxis(e,t){return ka.copy(e).applyQuaternion(this.quaternion),this.position.add(ka.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ha,e)}translateY(e){return this.translateOnAxis(Wa,e)}translateZ(e){return this.translateOnAxis(Xa,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(rn.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?zi.copy(e):zi.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),xi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?rn.lookAt(xi,zi,this.up):rn.lookAt(zi,xi,this.up),this.quaternion.setFromRotationMatrix(rn),r&&(rn.extractRotation(r.matrixWorld),Zn.setFromRotationMatrix(rn),this.quaternion.premultiply(Zn.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(qe("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(ja),Kn.child=e,this.dispatchEvent(Kn),Kn.child=null):qe("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Yc),Nr.child=e,this.dispatchEvent(Nr),Nr.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),rn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),rn.multiply(e.parent.matrixWorld)),e.applyMatrix4(rn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ja),Kn.child=e,this.dispatchEvent(Kn),Kn.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 i=0,r=this.children.length;i<r;i++){const a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xi,e,jc),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xi,qc,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,i=e.y,r=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*i-s[8]*r,s[13]+=i-s[1]*t-s[5]*i-s[9]*r,s[14]+=r-s[2]*t-s[6]*i-s[10]*r}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);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.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){const r=this.children;for(let s=0,a=r.length;s<a;s++)r[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),this.static!==!1&&(r.static=this.static),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(o=>({...o})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c<d;c++){const p=l[c];s(e.shapes,p)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));r.material=o}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let o=0;o<this.children.length;o++)r.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];r.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),d=a(e.images),p=a(e.shapes),h=a(e.skeletons),f=a(e.animations),g=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),d.length>0&&(i.images=d),p.length>0&&(i.shapes=p),h.length>0&&(i.skeletons=h),f.length>0&&(i.animations=f),g.length>0&&(i.nodes=g)}return i.object=r,i;function a(o){const l=[];for(const c in o){const d=o[c];delete d.metadata,l.push(d)}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 i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}Pt.DEFAULT_UP=new W(0,1,0);Pt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Pt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Gi extends Pt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const $c={type:"move"};class Fr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Gi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Gi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new W,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new W),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Gi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new W,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new W),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const v of e.hand.values()){const m=t.getJointPose(v,i),u=this._getHandJoint(c,v);m!==null&&(u.matrix.fromArray(m.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,u.jointRadius=m.radius),u.visible=m!==null}const d=c.joints["index-finger-tip"],p=c.joints["thumb-tip"],h=d.position.distanceTo(p.position),f=.02,g=.005;c.inputState.pinching&&h>f+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=f-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent($c)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Gi;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const pl={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},vn={h:0,s:0,l:0},Vi={h:0,s:0,l:0};function Ur(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class nt{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Lt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Xe.colorSpaceToWorking(this,t),this}setRGB(e,t,i,r=Xe.workingColorSpace){return this.r=e,this.g=t,this.b=i,Xe.colorSpaceToWorking(this,r),this}setHSL(e,t,i,r=Xe.workingColorSpace){if(e=Uc(e,1),t=We(t,0,1),i=We(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=Ur(a,s,e+1/3),this.g=Ur(a,s,e),this.b=Ur(a,s,e-1/3)}return Xe.colorSpaceToWorking(this,r),this}setStyle(e,t=Lt){function i(s){s!==void 0&&parseFloat(s)<1&&Ie("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(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(o))return i(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(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Ie("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);Ie("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Lt){const i=pl[e.toLowerCase()];return i!==void 0?this.setHex(i,t):Ie("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=un(e.r),this.g=un(e.g),this.b=un(e.b),this}copyLinearToSRGB(e){return this.r=li(e.r),this.g=li(e.g),this.b=li(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Lt){return Xe.workingToColorSpace(St.copy(this),e),Math.round(We(St.r*255,0,255))*65536+Math.round(We(St.g*255,0,255))*256+Math.round(We(St.b*255,0,255))}getHexString(e=Lt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Xe.workingColorSpace){Xe.workingToColorSpace(St.copy(this),t);const i=St.r,r=St.g,s=St.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const p=a-o;switch(c=d<=.5?p/(a+o):p/(2-a-o),a){case i:l=(r-s)/p+(r<s?6:0);break;case r:l=(s-i)/p+2;break;case s:l=(i-r)/p+4;break}l/=6}return e.h=l,e.s=c,e.l=d,e}getRGB(e,t=Xe.workingColorSpace){return Xe.workingToColorSpace(St.copy(this),t),e.r=St.r,e.g=St.g,e.b=St.b,e}getStyle(e=Lt){Xe.workingToColorSpace(St.copy(this),e);const t=St.r,i=St.g,r=St.b;return e!==Lt?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(vn),this.setHSL(vn.h+e,vn.s+t,vn.l+i)}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,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(vn),e.getHSL(Vi);const i=Cr(vn.h,Vi.h,t),r=Cr(vn.s,Vi.s,t),s=Cr(vn.l,Vi.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,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}}const St=new nt;nt.NAMES=pl;class Zc extends Pt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Hn,this.environmentIntensity=1,this.environmentRotation=new Hn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Ut=new W,sn=new W,Or=new W,an=new W,Jn=new W,Qn=new W,qa=new W,Br=new W,zr=new W,Gr=new W,Vr=new ct,kr=new ct,Hr=new ct;let vi=class oi{constructor(e=new W,t=new W,i=new W){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),Ut.subVectors(e,t),r.cross(Ut);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){Ut.subVectors(r,t),sn.subVectors(i,t),Or.subVectors(e,t);const a=Ut.dot(Ut),o=Ut.dot(sn),l=Ut.dot(Or),c=sn.dot(sn),d=sn.dot(Or),p=a*c-o*o;if(p===0)return s.set(0,0,0),null;const h=1/p,f=(c*l-o*d)*h,g=(a*d-o*l)*h;return s.set(1-f-g,g,f)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,an)===null?!1:an.x>=0&&an.y>=0&&an.x+an.y<=1}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,an)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,an.x),l.addScaledVector(a,an.y),l.addScaledVector(o,an.z),l)}static getInterpolatedAttribute(e,t,i,r,s,a){return Vr.setScalar(0),kr.setScalar(0),Hr.setScalar(0),Vr.fromBufferAttribute(e,t),kr.fromBufferAttribute(e,i),Hr.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(Vr,s.x),a.addScaledVector(kr,s.y),a.addScaledVector(Hr,s.z),a}static isFrontFacing(e,t,i,r){return Ut.subVectors(i,t),sn.subVectors(e,t),Ut.cross(sn).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ut.subVectors(this.c,this.b),sn.subVectors(this.a,this.b),Ut.cross(sn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return oi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return oi.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return oi.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return oi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return oi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;Jn.subVectors(r,i),Qn.subVectors(s,i),Br.subVectors(e,i);const l=Jn.dot(Br),c=Qn.dot(Br);if(l<=0&&c<=0)return t.copy(i);zr.subVectors(e,r);const d=Jn.dot(zr),p=Qn.dot(zr);if(d>=0&&p<=d)return t.copy(r);const h=l*p-d*c;if(h<=0&&l>=0&&d<=0)return a=l/(l-d),t.copy(i).addScaledVector(Jn,a);Gr.subVectors(e,s);const f=Jn.dot(Gr),g=Qn.dot(Gr);if(g>=0&&f<=g)return t.copy(s);const v=f*c-l*g;if(v<=0&&c>=0&&g<=0)return o=c/(c-g),t.copy(i).addScaledVector(Qn,o);const m=d*g-f*p;if(m<=0&&p-d>=0&&f-g>=0)return qa.subVectors(s,r),o=(p-d)/(p-d+(f-g)),t.copy(r).addScaledVector(qa,o);const u=1/(m+v+h);return a=v*u,o=h*u,t.copy(i).addScaledVector(Jn,a).addScaledVector(Qn,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};class Ii{constructor(e=new W(1/0,1/0,1/0),t=new W(-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,i=e.length;t<i;t+=3)this.expandByPoint(Ot.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Ot.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=Ot.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),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);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Ot):Ot.fromBufferAttribute(s,a),Ot.applyMatrix4(e.matrixWorld),this.expandByPoint(Ot);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ki.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),ki.copy(i.boundingBox)),ki.applyMatrix4(e.matrixWorld),this.union(ki)}const r=e.children;for(let s=0,a=r.length;s<a;s++)this.expandByObject(r[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,Ot),Ot.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Mi),Hi.subVectors(this.max,Mi),ei.subVectors(e.a,Mi),ti.subVectors(e.b,Mi),ni.subVectors(e.c,Mi),Mn.subVectors(ti,ei),Sn.subVectors(ni,ti),Cn.subVectors(ei,ni);let t=[0,-Mn.z,Mn.y,0,-Sn.z,Sn.y,0,-Cn.z,Cn.y,Mn.z,0,-Mn.x,Sn.z,0,-Sn.x,Cn.z,0,-Cn.x,-Mn.y,Mn.x,0,-Sn.y,Sn.x,0,-Cn.y,Cn.x,0];return!Wr(t,ei,ti,ni,Hi)||(t=[1,0,0,0,1,0,0,0,1],!Wr(t,ei,ti,ni,Hi))?!1:(Wi.crossVectors(Mn,Sn),t=[Wi.x,Wi.y,Wi.z],Wr(t,ei,ti,ni,Hi))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ot).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ot).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:(on[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),on[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),on[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),on[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),on[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),on[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),on[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),on[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(on),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}}const on=[new W,new W,new W,new W,new W,new W,new W,new W],Ot=new W,ki=new Ii,ei=new W,ti=new W,ni=new W,Mn=new W,Sn=new W,Cn=new W,Mi=new W,Hi=new W,Wi=new W,Pn=new W;function Wr(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){Pn.fromArray(n,s);const o=r.x*Math.abs(Pn.x)+r.y*Math.abs(Pn.y)+r.z*Math.abs(Pn.z),l=e.dot(Pn),c=t.dot(Pn),d=i.dot(Pn);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const dt=new W,Xi=new Ke;let Kc=0;class Vt{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Kc++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Ia,this.updateRanges=[],this.gpuType=qt,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,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Xi.fromBufferAttribute(this,t),Xi.applyMatrix3(e),this.setXY(t,Xi.x,Xi.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)dt.fromBufferAttribute(this,t),dt.applyMatrix3(e),this.setXYZ(t,dt.x,dt.y,dt.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)dt.fromBufferAttribute(this,t),dt.applyMatrix4(e),this.setXYZ(t,dt.x,dt.y,dt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)dt.fromBufferAttribute(this,t),dt.applyNormalMatrix(e),this.setXYZ(t,dt.x,dt.y,dt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)dt.fromBufferAttribute(this,t),dt.transformDirection(e),this.setXYZ(t,dt.x,dt.y,dt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=_i(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Tt(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=_i(t,this.array)),t}setX(e,t){return this.normalized&&(t=Tt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=_i(t,this.array)),t}setY(e,t){return this.normalized&&(t=Tt(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=_i(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Tt(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=_i(t,this.array)),t}setW(e,t){return this.normalized&&(t=Tt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Tt(t,this.array),i=Tt(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Tt(t,this.array),i=Tt(i,this.array),r=Tt(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Tt(t,this.array),i=Tt(i,this.array),r=Tt(r,this.array),s=Tt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,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(){const 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!==Ia&&(e.usage=this.usage),e}}class ml extends Vt{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class gl extends Vt{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class fn extends Vt{constructor(e,t,i){super(new Float32Array(e),t,i)}}const Jc=new Ii,Si=new W,Xr=new W;class fa{constructor(e=new W,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){const i=this.center;t!==void 0?i.copy(t):Jc.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=e.length;s<a;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),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){const 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){const i=this.center.distanceToSquared(e);return t.copy(e),i>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;Si.subVectors(e,this.center);const t=Si.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Si,r/i),this.radius+=r}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):(Xr.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Si.copy(e.center).add(Xr)),this.expandByPoint(Si.copy(e.center).sub(Xr))),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}}let Qc=0;const Dt=new ut,jr=new Pt,ii=new W,Ct=new Ii,Ei=new Ii,gt=new W;class en extends fi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Qc++}),this.uuid=Li(),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(Lc(e)?gl:ml)(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,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new Be().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Dt.makeRotationFromQuaternion(e),this.applyMatrix4(Dt),this}rotateX(e){return Dt.makeRotationX(e),this.applyMatrix4(Dt),this}rotateY(e){return Dt.makeRotationY(e),this.applyMatrix4(Dt),this}rotateZ(e){return Dt.makeRotationZ(e),this.applyMatrix4(Dt),this}translate(e,t,i){return Dt.makeTranslation(e,t,i),this.applyMatrix4(Dt),this}scale(e,t,i){return Dt.makeScale(e,t,i),this.applyMatrix4(Dt),this}lookAt(e){return jr.lookAt(e),jr.updateMatrix(),this.applyMatrix4(jr.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ii).negate(),this.translate(ii.x,ii.y,ii.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new fn(i,3))}else{const i=Math.min(e.length,t.count);for(let r=0;r<i;r++){const s=e[r];t.setXYZ(r,s.x,s.y,s.z||0)}e.length>t.count&&Ie("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 Ii);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){qe("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new W(-1/0,-1/0,-1/0),new W(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Ct.setFromBufferAttribute(s),this.morphTargetsRelative?(gt.addVectors(this.boundingBox.min,Ct.min),this.boundingBox.expandByPoint(gt),gt.addVectors(this.boundingBox.max,Ct.max),this.boundingBox.expandByPoint(gt)):(this.boundingBox.expandByPoint(Ct.min),this.boundingBox.expandByPoint(Ct.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&qe('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 fa);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){qe("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new W,1/0);return}if(e){const i=this.boundingSphere.center;if(Ct.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Ei.setFromBufferAttribute(o),this.morphTargetsRelative?(gt.addVectors(Ct.min,Ei.min),Ct.expandByPoint(gt),gt.addVectors(Ct.max,Ei.max),Ct.expandByPoint(gt)):(Ct.expandByPoint(Ei.min),Ct.expandByPoint(Ei.max))}Ct.getCenter(i);let r=0;for(let s=0,a=e.count;s<a;s++)gt.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(gt));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,d=o.count;c<d;c++)gt.fromBufferAttribute(o,c),l&&(ii.fromBufferAttribute(e,c),gt.add(ii)),r=Math.max(r,i.distanceToSquared(gt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&qe('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){qe("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Vt(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let x=0;x<i.count;x++)o[x]=new W,l[x]=new W;const c=new W,d=new W,p=new W,h=new Ke,f=new Ke,g=new Ke,v=new W,m=new W;function u(x,y,z){c.fromBufferAttribute(i,x),d.fromBufferAttribute(i,y),p.fromBufferAttribute(i,z),h.fromBufferAttribute(s,x),f.fromBufferAttribute(s,y),g.fromBufferAttribute(s,z),d.sub(c),p.sub(c),f.sub(h),g.sub(h);const w=1/(f.x*g.y-g.x*f.y);isFinite(w)&&(v.copy(d).multiplyScalar(g.y).addScaledVector(p,-f.y).multiplyScalar(w),m.copy(p).multiplyScalar(f.x).addScaledVector(d,-g.x).multiplyScalar(w),o[x].add(v),o[y].add(v),o[z].add(v),l[x].add(m),l[y].add(m),l[z].add(m))}let S=this.groups;S.length===0&&(S=[{start:0,count:e.count}]);for(let x=0,y=S.length;x<y;++x){const z=S[x],w=z.start,F=z.count;for(let B=w,I=w+F;B<I;B+=3)u(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const b=new W,E=new W,R=new W,A=new W;function C(x){R.fromBufferAttribute(r,x),A.copy(R);const y=o[x];b.copy(y),b.sub(R.multiplyScalar(R.dot(y))).normalize(),E.crossVectors(A,y);const w=E.dot(l[x])<0?-1:1;a.setXYZW(x,b.x,b.y,b.z,w)}for(let x=0,y=S.length;x<y;++x){const z=S[x],w=z.start,F=z.count;for(let B=w,I=w+F;B<I;B+=3)C(e.getX(B+0)),C(e.getX(B+1)),C(e.getX(B+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Vt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let h=0,f=i.count;h<f;h++)i.setXYZ(h,0,0,0);const r=new W,s=new W,a=new W,o=new W,l=new W,c=new W,d=new W,p=new W;if(e)for(let h=0,f=e.count;h<f;h+=3){const g=e.getX(h+0),v=e.getX(h+1),m=e.getX(h+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,v),a.fromBufferAttribute(t,m),d.subVectors(a,s),p.subVectors(r,s),d.cross(p),o.fromBufferAttribute(i,g),l.fromBufferAttribute(i,v),c.fromBufferAttribute(i,m),o.add(d),l.add(d),c.add(d),i.setXYZ(g,o.x,o.y,o.z),i.setXYZ(v,l.x,l.y,l.z),i.setXYZ(m,c.x,c.y,c.z)}else for(let h=0,f=t.count;h<f;h+=3)r.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),d.subVectors(a,s),p.subVectors(r,s),d.cross(p),i.setXYZ(h+0,d.x,d.y,d.z),i.setXYZ(h+1,d.x,d.y,d.z),i.setXYZ(h+2,d.x,d.y,d.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)gt.fromBufferAttribute(e,t),gt.normalize(),e.setXYZ(t,gt.x,gt.y,gt.z)}toNonIndexed(){function e(o,l){const c=o.array,d=o.itemSize,p=o.normalized,h=new c.constructor(l.length*d);let f=0,g=0;for(let v=0,m=l.length;v<m;v++){o.isInterleavedBufferAttribute?f=l[v]*o.data.stride+o.offset:f=l[v]*d;for(let u=0;u<d;u++)h[g++]=c[f++]}return new Vt(h,d,p)}if(this.index===null)return Ie("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new en,i=this.index.array,r=this.attributes;for(const o in r){const l=r[o],c=e(l,i);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let d=0,p=c.length;d<p;d++){const h=c[d],f=e(h,i);l.push(f)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const 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){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let p=0,h=c.length;p<h;p++){const f=c[p];d.push(f.toJSON(e.data))}d.length>0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.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;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const r=e.attributes;for(const c in r){const d=r[c];this.setAttribute(c,d.clone(t))}const s=e.morphAttributes;for(const c in s){const d=[],p=s[c];for(let h=0,f=p.length;h<f;h++)d.push(p[h].clone(t));this.morphAttributes[c]=d}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,d=a.length;c<d;c++){const p=a[c];this.addGroup(p.start,p.count,p.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const 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"})}}let eh=0;class vr extends fi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:eh++}),this.uuid=Li(),this.name="",this.type="Material",this.blending=Gn,this.side=An,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ls,this.blendDst=cs,this.blendEquation=Un,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new nt(0,0,0),this.blendAlpha=0,this.depthFunc=ci,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=La,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=qn,this.stencilZFail=qn,this.stencilZPass=qn,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(const t in e){const i=e[t];if(i===void 0){Ie(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Ie(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Gn&&(i.blending=this.blending),this.side!==An&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==ls&&(i.blendSrc=this.blendSrc),this.blendDst!==cs&&(i.blendDst=this.blendDst),this.blendEquation!==Un&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==ci&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==La&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==qn&&(i.stencilFail=this.stencilFail),this.stencilZFail!==qn&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==qn&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}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;const t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,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++}}const ln=new W,qr=new W,ji=new W,En=new W,Yr=new W,qi=new W,$r=new W;class th{constructor(e=new W,t=new W(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,ln)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ln.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ln.copy(this.origin).addScaledVector(this.direction,t),ln.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){qr.copy(e).add(t).multiplyScalar(.5),ji.copy(t).sub(e).normalize(),En.copy(this.origin).sub(qr);const s=e.distanceTo(t)*.5,a=-this.direction.dot(ji),o=En.dot(this.direction),l=-En.dot(ji),c=En.lengthSq(),d=Math.abs(1-a*a);let p,h,f,g;if(d>0)if(p=a*l-o,h=a*o-l,g=s*d,p>=0)if(h>=-g)if(h<=g){const v=1/d;p*=v,h*=v,f=p*(p+a*h+2*o)+h*(a*p+h+2*l)+c}else h=s,p=Math.max(0,-(a*h+o)),f=-p*p+h*(h+2*l)+c;else h=-s,p=Math.max(0,-(a*h+o)),f=-p*p+h*(h+2*l)+c;else h<=-g?(p=Math.max(0,-(-a*s+o)),h=p>0?-s:Math.min(Math.max(-s,-l),s),f=-p*p+h*(h+2*l)+c):h<=g?(p=0,h=Math.min(Math.max(-s,-l),s),f=h*(h+2*l)+c):(p=Math.max(0,-(a*s+o)),h=p>0?s:Math.min(Math.max(-s,-l),s),f=-p*p+h*(h+2*l)+c);else h=a>0?-s:s,p=Math.max(0,-(a*h+o)),f=-p*p+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,p),r&&r.copy(qr).addScaledVector(ji,h),f}intersectSphere(e,t){ln.subVectors(e.center,this.origin);const i=ln.dot(this.direction),r=ln.dot(ln)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,p=1/this.direction.z,h=this.origin;return c>=0?(i=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(i=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),d>=0?(s=(e.min.y-h.y)*d,a=(e.max.y-h.y)*d):(s=(e.max.y-h.y)*d,a=(e.min.y-h.y)*d),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a<r||isNaN(r))&&(r=a),p>=0?(o=(e.min.z-h.z)*p,l=(e.max.z-h.z)*p):(o=(e.max.z-h.z)*p,l=(e.min.z-h.z)*p),i>l||o>r)||((o>i||i!==i)&&(i=o),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,ln)!==null}intersectTriangle(e,t,i,r,s){Yr.subVectors(t,e),qi.subVectors(i,e),$r.crossVectors(Yr,qi);let a=this.direction.dot($r),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;En.subVectors(this.origin,e);const l=o*this.direction.dot(qi.crossVectors(En,qi));if(l<0)return null;const c=o*this.direction.dot(Yr.cross(En));if(c<0||l+c>a)return null;const d=-o*En.dot($r);return d<0?null:this.at(d/a,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)}}class _l extends vr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new nt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Hn,this.combine=Yo,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Ya=new ut,Dn=new th,Yi=new fa,$a=new W,$i=new W,Zi=new W,Ki=new W,Zr=new W,Ji=new W,Za=new W,Qi=new W;let Jt=class extends Pt{constructor(e=new en,t=new _l){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s<a;s++){const o=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const o=this.morphTargetInfluences;if(s&&o){Ji.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const d=o[l],p=s[l];d!==0&&(Zr.fromBufferAttribute(p,e),a?Ji.addScaledVector(Zr,d):Ji.addScaledVector(Zr.sub(t),d))}t.add(Ji)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Yi.copy(i.boundingSphere),Yi.applyMatrix4(s),Dn.copy(e.ray).recast(e.near),!(Yi.containsPoint(Dn.origin)===!1&&(Dn.intersectSphere(Yi,$a)===null||Dn.origin.distanceToSquared($a)>(e.far-e.near)**2))&&(Ya.copy(s).invert(),Dn.copy(e.ray).applyMatrix4(Ya),!(i.boundingBox!==null&&Dn.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Dn)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,p=s.attributes.normal,h=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,v=h.length;g<v;g++){const m=h[g],u=a[m.materialIndex],S=Math.max(m.start,f.start),b=Math.min(o.count,Math.min(m.start+m.count,f.start+f.count));for(let E=S,R=b;E<R;E+=3){const A=o.getX(E),C=o.getX(E+1),x=o.getX(E+2);r=er(this,u,e,i,c,d,p,A,C,x),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,f.start),v=Math.min(o.count,f.start+f.count);for(let m=g,u=v;m<u;m+=3){const S=o.getX(m),b=o.getX(m+1),E=o.getX(m+2);r=er(this,a,e,i,c,d,p,S,b,E),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,v=h.length;g<v;g++){const m=h[g],u=a[m.materialIndex],S=Math.max(m.start,f.start),b=Math.min(l.count,Math.min(m.start+m.count,f.start+f.count));for(let E=S,R=b;E<R;E+=3){const A=E,C=E+1,x=E+2;r=er(this,u,e,i,c,d,p,A,C,x),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=m.materialIndex,t.push(r))}}else{const g=Math.max(0,f.start),v=Math.min(l.count,f.start+f.count);for(let m=g,u=v;m<u;m+=3){const S=m,b=m+1,E=m+2;r=er(this,a,e,i,c,d,p,S,b,E),r&&(r.faceIndex=Math.floor(m/3),t.push(r))}}}};function nh(n,e,t,i,r,s,a,o){let l;if(e.side===At?l=i.intersectTriangle(a,s,r,!0,o):l=i.intersectTriangle(r,s,a,e.side===An,o),l===null)return null;Qi.copy(o),Qi.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(Qi);return c<t.near||c>t.far?null:{distance:c,point:Qi.clone(),object:n}}function er(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,$i),n.getVertexPosition(l,Zi),n.getVertexPosition(c,Ki);const d=nh(n,e,t,i,$i,Zi,Ki,Za);if(d){const p=new W;vi.getBarycoord(Za,$i,Zi,Ki,p),r&&(d.uv=vi.getInterpolatedAttribute(r,o,l,c,p,new Ke)),s&&(d.uv1=vi.getInterpolatedAttribute(s,o,l,c,p,new Ke)),a&&(d.normal=vi.getInterpolatedAttribute(a,o,l,c,p,new W),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new W,materialIndex:0};vi.getNormal($i,Zi,Ki,h.normal),d.face=h,d.barycoord=p}return d}class ih extends bt{constructor(e=null,t=1,i=1,r,s,a,o,l,c=xt,d=xt,p,h){super(null,a,o,l,c,d,r,s,p,h),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Kr=new W,rh=new W,sh=new Be;class Fn{constructor(e=new W(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=Kr.subVectors(i,t).cross(rh.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(Kr),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||sh.getNormalMatrix(e),r=this.coplanarPoint(Kr).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Ln=new fa,ah=new Ke(.5,.5),tr=new W;class xl{constructor(e=new Fn,t=new Fn,i=new Fn,r=new Fn,s=new Fn,a=new Fn){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Yt,i=!1){const r=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],d=s[4],p=s[5],h=s[6],f=s[7],g=s[8],v=s[9],m=s[10],u=s[11],S=s[12],b=s[13],E=s[14],R=s[15];if(r[0].setComponents(c-a,f-d,u-g,R-S).normalize(),r[1].setComponents(c+a,f+d,u+g,R+S).normalize(),r[2].setComponents(c+o,f+p,u+v,R+b).normalize(),r[3].setComponents(c-o,f-p,u-v,R-b).normalize(),i)r[4].setComponents(l,h,m,E).normalize(),r[5].setComponents(c-l,f-h,u-m,R-E).normalize();else if(r[4].setComponents(c-l,f-h,u-m,R-E).normalize(),t===Yt)r[5].setComponents(c+l,f+h,u+m,R+E).normalize();else if(t===pr)r[5].setComponents(l,h,m,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ln.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ln.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ln)}intersectsSprite(e){Ln.center.set(0,0,0);const t=ah.distanceTo(e.center);return Ln.radius=.7071067811865476+t,Ln.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ln)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(tr.x=r.normal.x>0?e.max.x:e.min.x,tr.y=r.normal.y>0?e.max.y:e.min.y,tr.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(tr)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class vl extends bt{constructor(e=[],t=Vn,i,r,s,a,o,l,c,d){super(e,t,i,r,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Di extends bt{constructor(e,t,i=Kt,r,s,a,o=xt,l=xt,c,d=mn,p=1){if(d!==mn&&d!==zn)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const h={width:e,height:t,depth:p};super(h,r,s,a,o,l,d,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new ua(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class oh extends Di{constructor(e,t=Kt,i=Vn,r,s,a=xt,o=xt,l,c=mn){const d={width:e,height:e,depth:1},p=[d,d,d,d,d,d];super(e,e,t,i,r,s,a,o,l,c),this.image=p,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class Ml extends bt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ni extends en{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],p=[];let h=0,f=0;g("z","y","x",-1,-1,i,t,e,a,s,0),g("z","y","x",1,-1,i,t,-e,a,s,1),g("x","z","y",1,1,e,i,t,r,a,2),g("x","z","y",1,-1,e,i,-t,r,a,3),g("x","y","z",1,-1,e,t,i,r,s,4),g("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new fn(c,3)),this.setAttribute("normal",new fn(d,3)),this.setAttribute("uv",new fn(p,2));function g(v,m,u,S,b,E,R,A,C,x,y){const z=E/C,w=R/x,F=E/2,B=R/2,I=A/2,G=C+1,V=x+1;let U=0,K=0;const Y=new W;for(let se=0;se<V;se++){const ce=se*w-B;for(let le=0;le<G;le++){const we=le*z-F;Y[v]=we*S,Y[m]=ce*b,Y[u]=I,c.push(Y.x,Y.y,Y.z),Y[v]=0,Y[m]=0,Y[u]=A>0?1:-1,d.push(Y.x,Y.y,Y.z),p.push(le/C),p.push(1-se/x),U+=1}}for(let se=0;se<x;se++)for(let ce=0;ce<C;ce++){const le=h+ce+G*se,we=h+ce+G*(se+1),Ye=h+(ce+1)+G*(se+1),He=h+(ce+1)+G*se;l.push(le,we,He),l.push(we,Ye,He),K+=6}o.addGroup(f,K,y),f+=K,h+=U}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ni(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class Mr extends en{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(r),c=o+1,d=l+1,p=e/o,h=t/l,f=[],g=[],v=[],m=[];for(let u=0;u<d;u++){const S=u*h-a;for(let b=0;b<c;b++){const E=b*p-s;g.push(E,-S,0),v.push(0,0,1),m.push(b/o),m.push(1-u/l)}}for(let u=0;u<l;u++)for(let S=0;S<o;S++){const b=S+c*u,E=S+c*(u+1),R=S+1+c*(u+1),A=S+1+c*u;f.push(b,E,A),f.push(E,R,A)}this.setIndex(f),this.setAttribute("position",new fn(g,3)),this.setAttribute("normal",new fn(v,3)),this.setAttribute("uv",new fn(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Mr(e.width,e.height,e.widthSegments,e.heightSegments)}}function ui(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(Ie("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function yt(n){const e={};for(let t=0;t<n.length;t++){const i=ui(n[t]);for(const r in i)e[r]=i[r]}return e}function lh(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function Sl(n){const e=n.getRenderTarget();return e===null?n.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Xe.workingColorSpace}const ch={clone:ui,merge:yt};var hh=`void main() {
2
2
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3
- }`,ah=`void main() {
3
+ }`,dh=`void main() {
4
4
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
5
- }`;class Qt extends vr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=sh,this.fragmentShader=ah,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=di(e.uniforms),this.uniformsGroups=ih(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class _l extends Qt{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class oh extends vr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=xc,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class lh extends vr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const nr=new W,ir=new pi,Wt=new W;class xl extends Pt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new dt,this.projectionMatrix=new dt,this.projectionMatrixInverse=new dt,this.coordinateSystem=Yt,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(nr,ir,Wt),Wt.x===1&&Wt.y===1&&Wt.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(nr,ir,Wt.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(nr,ir,Wt),Wt.x===1&&Wt.y===1&&Wt.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(nr,ir,Wt.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const yn=new W,Za=new Ke,Ka=new Ke;class Bt extends xl{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ks*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Rr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ks*2*Math.atan(Math.tan(Rr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){yn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(yn.x,yn.y).multiplyScalar(-e/yn.z),yn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(yn.x,yn.y).multiplyScalar(-e/yn.z)}getViewSize(e,t){return this.getViewBounds(e,Za,Ka),t.subVectors(Ka,Za)}setViewOffset(e,t,i,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Rr*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*i/c,r*=a.width/l,i*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class pa extends xl{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const ri=-90,si=1;class ch extends Pt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Bt(ri,si,e,t);r.layers=this.layers,this.add(r);const s=new Bt(ri,si,e,t);s.layers=this.layers,this.add(s);const a=new Bt(ri,si,e,t);a.layers=this.layers,this.add(a);const o=new Bt(ri,si,e,t);o.layers=this.layers,this.add(o);const l=new Bt(ri,si,e,t);l.layers=this.layers,this.add(l);const c=new Bt(ri,si,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===Yt)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===pr)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,u]=this.children,p=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const v=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(i,0,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(i,1,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(i,2,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(i,3,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(i,4,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),i.texture.generateMipmaps=v,e.setRenderTarget(i,5,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(p,h,f),e.xr.enabled=g,i.texture.needsPMREMUpdate=!0}}class hh extends Bt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class uh{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,Ie("THREE.Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Ja(n,e,t,i){const r=dh(i);switch(t){case nl:return n*e;case rl:return n*e/r.components*r.byteLength;case oa:return n*e/r.components*r.byteLength;case ui:return n*e*2/r.components*r.byteLength;case la:return n*e*2/r.components*r.byteLength;case il:return n*e*3/r.components*r.byteLength;case zt:return n*e*4/r.components*r.byteLength;case ca:return n*e*4/r.components*r.byteLength;case lr:case cr:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case hr:case ur:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Ms:case Es:return Math.max(n,16)*Math.max(e,8)/4;case vs:case Ss:return Math.max(n,8)*Math.max(e,8)/2;case ys:case bs:case As:case ws:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Ts:case Rs:case Cs:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Ps:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Ds:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Ls:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Is:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Ns:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Fs:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Us:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Os:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Bs:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case zs:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Gs:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Vs:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case ks:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Hs:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Ws:case Xs:case qs:return Math.ceil(n/4)*Math.ceil(e/4)*16;case js:case Ys:return Math.ceil(n/4)*Math.ceil(e/4)*8;case $s:case Zs:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function dh(n){switch(n){case It:case Jo:return{byteLength:1,components:1};case Ci:case Qo:case pn:return{byteLength:2,components:1};case sa:case aa:return{byteLength:2,components:4};case Kt:case ra:case jt:return{byteLength:4,components:1};case el:case tl:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ia}}));typeof window<"u"&&(window.__THREE__?Ie("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ia);function vl(){let n=null,e=!1,t=null,i=null;function r(s,a){t(s,a),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function fh(n){const e=new WeakMap;function t(o,l){const c=o.array,u=o.usage,p=c.byteLength,h=n.createBuffer();n.bindBuffer(l,h),n.bufferData(l,c,u),o.onUploadCallback();let f;if(c instanceof Float32Array)f=n.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)f=n.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=n.HALF_FLOAT:f=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=n.SHORT;else if(c instanceof Uint32Array)f=n.UNSIGNED_INT;else if(c instanceof Int32Array)f=n.INT;else if(c instanceof Int8Array)f=n.BYTE;else if(c instanceof Uint8Array)f=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:p}}function i(o,l,c){const u=l.array,p=l.updateRanges;if(n.bindBuffer(c,o),p.length===0)n.bufferSubData(c,0,u);else{p.sort((f,g)=>f.start-g.start);let h=0;for(let f=1;f<p.length;f++){const g=p[h],v=p[f];v.start<=g.start+g.count+1?g.count=Math.max(g.count,v.start+v.count-g.start):(++h,p[h]=v)}p.length=h+1;for(let f=0,g=p.length;f<g;f++){const v=p[f];n.bufferSubData(c,v.start*u.BYTES_PER_ELEMENT,u,v.start,v.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(n.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const u=e.get(o);(!u||u.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var ph=`#ifdef USE_ALPHAHASH
5
+ }`;class Qt extends vr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=hh,this.fragmentShader=dh,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ui(e.uniforms),this.uniformsGroups=lh(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const a=this.uniforms[r].value;a&&a.isTexture?t.uniforms[r]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[r]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[r]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[r]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[r]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[r]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[r]={type:"m4",value:a.toArray()}:t.uniforms[r]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class El extends Qt{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class uh extends vr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=yc,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class fh extends vr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const nr=new W,ir=new pi,Wt=new W;class yl extends Pt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ut,this.projectionMatrix=new ut,this.projectionMatrixInverse=new ut,this.coordinateSystem=Yt,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(nr,ir,Wt),Wt.x===1&&Wt.y===1&&Wt.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(nr,ir,Wt.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(nr,ir,Wt),Wt.x===1&&Wt.y===1&&Wt.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(nr,ir,Wt.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const yn=new W,Ka=new Ke,Ja=new Ke;class Bt extends yl{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ks*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Rr*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ks*2*Math.atan(Math.tan(Rr*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){yn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(yn.x,yn.y).multiplyScalar(-e/yn.z),yn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(yn.x,yn.y).multiplyScalar(-e/yn.z)}getViewSize(e,t){return this.getViewBounds(e,Ka,Ja),t.subVectors(Ja,Ka)}setViewOffset(e,t,i,r,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Rr*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*i/c,r*=a.width/l,i*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class pa extends yl{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,o=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const ri=-90,si=1;class ph extends Pt{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Bt(ri,si,e,t);r.layers=this.layers,this.add(r);const s=new Bt(ri,si,e,t);s.layers=this.layers,this.add(s);const a=new Bt(ri,si,e,t);a.layers=this.layers,this.add(a);const o=new Bt(ri,si,e,t);o.layers=this.layers,this.add(o);const l=new Bt(ri,si,e,t);l.layers=this.layers,this.add(l);const c=new Bt(ri,si,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===Yt)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===pr)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,d]=this.children,p=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const v=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let m=!1;e.isWebGLRenderer===!0?m=e.state.buffers.depth.getReversed():m=e.reversedDepthBuffer,e.setRenderTarget(i,0,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(i,1,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(i,2,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(i,3,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(i,4,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),i.texture.generateMipmaps=v,e.setRenderTarget(i,5,r),m&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),e.setRenderTarget(p,h,f),e.xr.enabled=g,i.texture.needsPMREMUpdate=!0}}class mh extends Bt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class gh{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,Ie("THREE.Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Qa(n,e,t,i){const r=_h(i);switch(t){case ol:return n*e;case cl:return n*e/r.components*r.byteLength;case oa:return n*e/r.components*r.byteLength;case di:return n*e*2/r.components*r.byteLength;case la:return n*e*2/r.components*r.byteLength;case ll:return n*e*3/r.components*r.byteLength;case zt:return n*e*4/r.components*r.byteLength;case ca:return n*e*4/r.components*r.byteLength;case lr:case cr:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case hr:case dr:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Ms:case Es:return Math.max(n,16)*Math.max(e,8)/4;case vs:case Ss:return Math.max(n,8)*Math.max(e,8)/2;case ys:case bs:case As:case ws:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*8;case Ts:case Rs:case Cs:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Ps:return Math.floor((n+3)/4)*Math.floor((e+3)/4)*16;case Ds:return Math.floor((n+4)/5)*Math.floor((e+3)/4)*16;case Ls:return Math.floor((n+4)/5)*Math.floor((e+4)/5)*16;case Is:return Math.floor((n+5)/6)*Math.floor((e+4)/5)*16;case Ns:return Math.floor((n+5)/6)*Math.floor((e+5)/6)*16;case Fs:return Math.floor((n+7)/8)*Math.floor((e+4)/5)*16;case Us:return Math.floor((n+7)/8)*Math.floor((e+5)/6)*16;case Os:return Math.floor((n+7)/8)*Math.floor((e+7)/8)*16;case Bs:return Math.floor((n+9)/10)*Math.floor((e+4)/5)*16;case zs:return Math.floor((n+9)/10)*Math.floor((e+5)/6)*16;case Gs:return Math.floor((n+9)/10)*Math.floor((e+7)/8)*16;case Vs:return Math.floor((n+9)/10)*Math.floor((e+9)/10)*16;case ks:return Math.floor((n+11)/12)*Math.floor((e+9)/10)*16;case Hs:return Math.floor((n+11)/12)*Math.floor((e+11)/12)*16;case Ws:case Xs:case js:return Math.ceil(n/4)*Math.ceil(e/4)*16;case qs:case Ys:return Math.ceil(n/4)*Math.ceil(e/4)*8;case $s:case Zs:return Math.ceil(n/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function _h(n){switch(n){case It:case il:return{byteLength:1,components:1};case Ci:case rl:case pn:return{byteLength:2,components:1};case sa:case aa:return{byteLength:2,components:4};case Kt:case ra:case qt:return{byteLength:4,components:1};case sl:case al:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${n}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ia}}));typeof window<"u"&&(window.__THREE__?Ie("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ia);function bl(){let n=null,e=!1,t=null,i=null;function r(s,a){t(s,a),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function xh(n){const e=new WeakMap;function t(o,l){const c=o.array,d=o.usage,p=c.byteLength,h=n.createBuffer();n.bindBuffer(l,h),n.bufferData(l,c,d),o.onUploadCallback();let f;if(c instanceof Float32Array)f=n.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)f=n.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=n.HALF_FLOAT:f=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=n.SHORT;else if(c instanceof Uint32Array)f=n.UNSIGNED_INT;else if(c instanceof Int32Array)f=n.INT;else if(c instanceof Int8Array)f=n.BYTE;else if(c instanceof Uint8Array)f=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:p}}function i(o,l,c){const d=l.array,p=l.updateRanges;if(n.bindBuffer(c,o),p.length===0)n.bufferSubData(c,0,d);else{p.sort((f,g)=>f.start-g.start);let h=0;for(let f=1;f<p.length;f++){const g=p[h],v=p[f];v.start<=g.start+g.count+1?g.count=Math.max(g.count,v.start+v.count-g.start):(++h,p[h]=v)}p.length=h+1;for(let f=0,g=p.length;f<g;f++){const v=p[f];n.bufferSubData(c,v.start*d.BYTES_PER_ELEMENT,d,v.start,v.count)}l.clearUpdateRanges()}l.onUploadCallback()}function r(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(n.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const d=e.get(o);(!d||d.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,o,l),c.version=o.version}}return{get:r,remove:s,update:a}}var vh=`#ifdef USE_ALPHAHASH
6
6
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
7
- #endif`,mh=`#ifdef USE_ALPHAHASH
7
+ #endif`,Mh=`#ifdef USE_ALPHAHASH
8
8
  const float ALPHA_HASH_SCALE = 0.05;
9
9
  float hash2D( vec2 value ) {
10
10
  return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -39,20 +39,20 @@ import{r as De,u as L,A as wi,N as na,z as Ol,Q as Bl,O as zl,L as qn,a6 as Gl,a
39
39
  : cases.z;
40
40
  return clamp( threshold , 1.0e-6, 1.0 );
41
41
  }
42
- #endif`,gh=`#ifdef USE_ALPHAMAP
42
+ #endif`,Sh=`#ifdef USE_ALPHAMAP
43
43
  diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
44
- #endif`,_h=`#ifdef USE_ALPHAMAP
44
+ #endif`,Eh=`#ifdef USE_ALPHAMAP
45
45
  uniform sampler2D alphaMap;
46
- #endif`,xh=`#ifdef USE_ALPHATEST
46
+ #endif`,yh=`#ifdef USE_ALPHATEST
47
47
  #ifdef ALPHA_TO_COVERAGE
48
48
  diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
49
49
  if ( diffuseColor.a == 0.0 ) discard;
50
50
  #else
51
51
  if ( diffuseColor.a < alphaTest ) discard;
52
52
  #endif
53
- #endif`,vh=`#ifdef USE_ALPHATEST
53
+ #endif`,bh=`#ifdef USE_ALPHATEST
54
54
  uniform float alphaTest;
55
- #endif`,Mh=`#ifdef USE_AOMAP
55
+ #endif`,Th=`#ifdef USE_AOMAP
56
56
  float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
57
57
  reflectedLight.indirectDiffuse *= ambientOcclusion;
58
58
  #if defined( USE_CLEARCOAT )
@@ -65,10 +65,10 @@ import{r as De,u as L,A as wi,N as na,z as Ol,Q as Bl,O as zl,L as qn,a6 as Gl,a
65
65
  float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
66
66
  reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
67
67
  #endif
68
- #endif`,Sh=`#ifdef USE_AOMAP
68
+ #endif`,Ah=`#ifdef USE_AOMAP
69
69
  uniform sampler2D aoMap;
70
70
  uniform float aoMapIntensity;
71
- #endif`,Eh=`#ifdef USE_BATCHING
71
+ #endif`,wh=`#ifdef USE_BATCHING
72
72
  #if ! defined( GL_ANGLE_multi_draw )
73
73
  #define gl_DrawID _gl_DrawID
74
74
  uniform int _gl_DrawID;
@@ -102,15 +102,15 @@ import{r as De,u as L,A as wi,N as na,z as Ol,Q as Bl,O as zl,L as qn,a6 as Gl,a
102
102
  int y = j / size;
103
103
  return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
104
104
  }
105
- #endif`,yh=`#ifdef USE_BATCHING
105
+ #endif`,Rh=`#ifdef USE_BATCHING
106
106
  mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
107
- #endif`,bh=`vec3 transformed = vec3( position );
107
+ #endif`,Ch=`vec3 transformed = vec3( position );
108
108
  #ifdef USE_ALPHAHASH
109
109
  vPosition = vec3( position );
110
- #endif`,Th=`vec3 objectNormal = vec3( normal );
110
+ #endif`,Ph=`vec3 objectNormal = vec3( normal );
111
111
  #ifdef USE_TANGENT
112
112
  vec3 objectTangent = vec3( tangent.xyz );
113
- #endif`,Ah=`float G_BlinnPhong_Implicit( ) {
113
+ #endif`,Dh=`float G_BlinnPhong_Implicit( ) {
114
114
  return 0.25;
115
115
  }
116
116
  float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -124,7 +124,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
124
124
  float G = G_BlinnPhong_Implicit( );
125
125
  float D = D_BlinnPhong( shininess, dotNH );
126
126
  return F * ( G * D );
127
- } // validated`,wh=`#ifdef USE_IRIDESCENCE
127
+ } // validated`,Lh=`#ifdef USE_IRIDESCENCE
128
128
  const mat3 XYZ_TO_REC709 = mat3(
129
129
  3.2404542, -0.9692660, 0.0556434,
130
130
  -1.5371385, 1.8760108, -0.2040259,
@@ -187,7 +187,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
187
187
  }
188
188
  return max( I, vec3( 0.0 ) );
189
189
  }
190
- #endif`,Rh=`#ifdef USE_BUMPMAP
190
+ #endif`,Ih=`#ifdef USE_BUMPMAP
191
191
  uniform sampler2D bumpMap;
192
192
  uniform float bumpScale;
193
193
  vec2 dHdxy_fwd() {
@@ -208,7 +208,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
208
208
  vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
209
209
  return normalize( abs( fDet ) * surf_norm - vGrad );
210
210
  }
211
- #endif`,Ch=`#if NUM_CLIPPING_PLANES > 0
211
+ #endif`,Nh=`#if NUM_CLIPPING_PLANES > 0
212
212
  vec4 plane;
213
213
  #ifdef ALPHA_TO_COVERAGE
214
214
  float distanceToPlane, distanceGradient;
@@ -254,20 +254,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
254
254
  if ( clipped ) discard;
255
255
  #endif
256
256
  #endif
257
- #endif`,Ph=`#if NUM_CLIPPING_PLANES > 0
257
+ #endif`,Fh=`#if NUM_CLIPPING_PLANES > 0
258
258
  varying vec3 vClipPosition;
259
259
  uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
260
- #endif`,Dh=`#if NUM_CLIPPING_PLANES > 0
260
+ #endif`,Uh=`#if NUM_CLIPPING_PLANES > 0
261
261
  varying vec3 vClipPosition;
262
- #endif`,Lh=`#if NUM_CLIPPING_PLANES > 0
262
+ #endif`,Oh=`#if NUM_CLIPPING_PLANES > 0
263
263
  vClipPosition = - mvPosition.xyz;
264
- #endif`,Ih=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
264
+ #endif`,Bh=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
265
265
  diffuseColor *= vColor;
266
- #endif`,Nh=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
266
+ #endif`,zh=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
267
267
  varying vec4 vColor;
268
- #endif`,Fh=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
268
+ #endif`,Gh=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
269
269
  varying vec4 vColor;
270
- #endif`,Uh=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
270
+ #endif`,Vh=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
271
271
  vColor = vec4( 1.0 );
272
272
  #endif
273
273
  #ifdef USE_COLOR_ALPHA
@@ -280,7 +280,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
280
280
  #endif
281
281
  #ifdef USE_BATCHING_COLOR
282
282
  vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
283
- #endif`,Oh=`#define PI 3.141592653589793
283
+ #endif`,kh=`#define PI 3.141592653589793
284
284
  #define PI2 6.283185307179586
285
285
  #define PI_HALF 1.5707963267948966
286
286
  #define RECIPROCAL_PI 0.3183098861837907
@@ -347,7 +347,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
347
347
  float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
348
348
  float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
349
349
  return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
350
- } // validated`,Bh=`#ifdef ENVMAP_TYPE_CUBE_UV
350
+ } // validated`,Hh=`#ifdef ENVMAP_TYPE_CUBE_UV
351
351
  #define cubeUV_minMipLevel 4.0
352
352
  #define cubeUV_minTileSize 16.0
353
353
  float getFace( vec3 direction ) {
@@ -440,7 +440,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
440
440
  return vec4( mix( color0, color1, mipF ), 1.0 );
441
441
  }
442
442
  }
443
- #endif`,zh=`vec3 transformedNormal = objectNormal;
443
+ #endif`,Wh=`vec3 transformedNormal = objectNormal;
444
444
  #ifdef USE_TANGENT
445
445
  vec3 transformedTangent = objectTangent;
446
446
  #endif
@@ -469,21 +469,21 @@ transformedNormal = normalMatrix * transformedNormal;
469
469
  #ifdef FLIP_SIDED
470
470
  transformedTangent = - transformedTangent;
471
471
  #endif
472
- #endif`,Gh=`#ifdef USE_DISPLACEMENTMAP
472
+ #endif`,Xh=`#ifdef USE_DISPLACEMENTMAP
473
473
  uniform sampler2D displacementMap;
474
474
  uniform float displacementScale;
475
475
  uniform float displacementBias;
476
- #endif`,Vh=`#ifdef USE_DISPLACEMENTMAP
476
+ #endif`,jh=`#ifdef USE_DISPLACEMENTMAP
477
477
  transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
478
- #endif`,kh=`#ifdef USE_EMISSIVEMAP
478
+ #endif`,qh=`#ifdef USE_EMISSIVEMAP
479
479
  vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
480
480
  #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
481
481
  emissiveColor = sRGBTransferEOTF( emissiveColor );
482
482
  #endif
483
483
  totalEmissiveRadiance *= emissiveColor.rgb;
484
- #endif`,Hh=`#ifdef USE_EMISSIVEMAP
484
+ #endif`,Yh=`#ifdef USE_EMISSIVEMAP
485
485
  uniform sampler2D emissiveMap;
486
- #endif`,Wh="gl_FragColor = linearToOutputTexel( gl_FragColor );",Xh=`vec4 LinearTransferOETF( in vec4 value ) {
486
+ #endif`,$h="gl_FragColor = linearToOutputTexel( gl_FragColor );",Zh=`vec4 LinearTransferOETF( in vec4 value ) {
487
487
  return value;
488
488
  }
489
489
  vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -491,7 +491,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
491
491
  }
492
492
  vec4 sRGBTransferOETF( in vec4 value ) {
493
493
  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 );
494
- }`,qh=`#ifdef USE_ENVMAP
494
+ }`,Kh=`#ifdef USE_ENVMAP
495
495
  #ifdef ENV_WORLDPOS
496
496
  vec3 cameraToFrag;
497
497
  if ( isOrthographic ) {
@@ -518,7 +518,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
518
518
  outgoingLight += envColor.xyz * specularStrength * reflectivity;
519
519
  #endif
520
520
  #endif
521
- #endif`,jh=`#ifdef USE_ENVMAP
521
+ #endif`,Jh=`#ifdef USE_ENVMAP
522
522
  uniform float envMapIntensity;
523
523
  uniform float flipEnvMap;
524
524
  uniform mat3 envMapRotation;
@@ -527,7 +527,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
527
527
  #else
528
528
  uniform sampler2D envMap;
529
529
  #endif
530
- #endif`,Yh=`#ifdef USE_ENVMAP
530
+ #endif`,Qh=`#ifdef USE_ENVMAP
531
531
  uniform float reflectivity;
532
532
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
533
533
  #define ENV_WORLDPOS
@@ -538,7 +538,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
538
538
  #else
539
539
  varying vec3 vReflect;
540
540
  #endif
541
- #endif`,$h=`#ifdef USE_ENVMAP
541
+ #endif`,ed=`#ifdef USE_ENVMAP
542
542
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
543
543
  #define ENV_WORLDPOS
544
544
  #endif
@@ -549,7 +549,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
549
549
  varying vec3 vReflect;
550
550
  uniform float refractionRatio;
551
551
  #endif
552
- #endif`,Zh=`#ifdef USE_ENVMAP
552
+ #endif`,td=`#ifdef USE_ENVMAP
553
553
  #ifdef ENV_WORLDPOS
554
554
  vWorldPosition = worldPosition.xyz;
555
555
  #else
@@ -566,18 +566,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
566
566
  vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
567
567
  #endif
568
568
  #endif
569
- #endif`,Kh=`#ifdef USE_FOG
569
+ #endif`,nd=`#ifdef USE_FOG
570
570
  vFogDepth = - mvPosition.z;
571
- #endif`,Jh=`#ifdef USE_FOG
571
+ #endif`,id=`#ifdef USE_FOG
572
572
  varying float vFogDepth;
573
- #endif`,Qh=`#ifdef USE_FOG
573
+ #endif`,rd=`#ifdef USE_FOG
574
574
  #ifdef FOG_EXP2
575
575
  float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
576
576
  #else
577
577
  float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
578
578
  #endif
579
579
  gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
580
- #endif`,eu=`#ifdef USE_FOG
580
+ #endif`,sd=`#ifdef USE_FOG
581
581
  uniform vec3 fogColor;
582
582
  varying float vFogDepth;
583
583
  #ifdef FOG_EXP2
@@ -586,7 +586,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
586
586
  uniform float fogNear;
587
587
  uniform float fogFar;
588
588
  #endif
589
- #endif`,tu=`#ifdef USE_GRADIENTMAP
589
+ #endif`,ad=`#ifdef USE_GRADIENTMAP
590
590
  uniform sampler2D gradientMap;
591
591
  #endif
592
592
  vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -598,12 +598,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
598
598
  vec2 fw = fwidth( coord ) * 0.5;
599
599
  return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
600
600
  #endif
601
- }`,nu=`#ifdef USE_LIGHTMAP
601
+ }`,od=`#ifdef USE_LIGHTMAP
602
602
  uniform sampler2D lightMap;
603
603
  uniform float lightMapIntensity;
604
- #endif`,iu=`LambertMaterial material;
604
+ #endif`,ld=`LambertMaterial material;
605
605
  material.diffuseColor = diffuseColor.rgb;
606
- material.specularStrength = specularStrength;`,ru=`varying vec3 vViewPosition;
606
+ material.specularStrength = specularStrength;`,cd=`varying vec3 vViewPosition;
607
607
  struct LambertMaterial {
608
608
  vec3 diffuseColor;
609
609
  float specularStrength;
@@ -617,7 +617,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
617
617
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
618
618
  }
619
619
  #define RE_Direct RE_Direct_Lambert
620
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,su=`uniform bool receiveShadow;
620
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,hd=`uniform bool receiveShadow;
621
621
  uniform vec3 ambientLightColor;
622
622
  #if defined( USE_LIGHT_PROBES )
623
623
  uniform vec3 lightProbe[ 9 ];
@@ -733,7 +733,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
733
733
  vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
734
734
  return irradiance;
735
735
  }
736
- #endif`,au=`#ifdef USE_ENVMAP
736
+ #endif`,dd=`#ifdef USE_ENVMAP
737
737
  vec3 getIBLIrradiance( const in vec3 normal ) {
738
738
  #ifdef ENVMAP_TYPE_CUBE_UV
739
739
  vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
@@ -766,8 +766,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
766
766
  #endif
767
767
  }
768
768
  #endif
769
- #endif`,ou=`ToonMaterial material;
770
- material.diffuseColor = diffuseColor.rgb;`,lu=`varying vec3 vViewPosition;
769
+ #endif`,ud=`ToonMaterial material;
770
+ material.diffuseColor = diffuseColor.rgb;`,fd=`varying vec3 vViewPosition;
771
771
  struct ToonMaterial {
772
772
  vec3 diffuseColor;
773
773
  };
@@ -779,11 +779,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
779
779
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
780
780
  }
781
781
  #define RE_Direct RE_Direct_Toon
782
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,cu=`BlinnPhongMaterial material;
782
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,pd=`BlinnPhongMaterial material;
783
783
  material.diffuseColor = diffuseColor.rgb;
784
784
  material.specularColor = specular;
785
785
  material.specularShininess = shininess;
786
- material.specularStrength = specularStrength;`,hu=`varying vec3 vViewPosition;
786
+ material.specularStrength = specularStrength;`,md=`varying vec3 vViewPosition;
787
787
  struct BlinnPhongMaterial {
788
788
  vec3 diffuseColor;
789
789
  vec3 specularColor;
@@ -800,7 +800,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
800
800
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
801
801
  }
802
802
  #define RE_Direct RE_Direct_BlinnPhong
803
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,uu=`PhysicalMaterial material;
803
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,gd=`PhysicalMaterial material;
804
804
  material.diffuseColor = diffuseColor.rgb;
805
805
  material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
806
806
  material.metalness = metalnessFactor;
@@ -890,7 +890,7 @@ material.roughness = min( material.roughness, 1.0 );
890
890
  material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
891
891
  material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
892
892
  material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
893
- #endif`,du=`uniform sampler2D dfgLUT;
893
+ #endif`,_d=`uniform sampler2D dfgLUT;
894
894
  struct PhysicalMaterial {
895
895
  vec3 diffuseColor;
896
896
  vec3 diffuseContribution;
@@ -1251,7 +1251,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
1251
1251
  #define RE_IndirectSpecular RE_IndirectSpecular_Physical
1252
1252
  float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1253
1253
  return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1254
- }`,fu=`
1254
+ }`,xd=`
1255
1255
  vec3 geometryPosition = - vViewPosition;
1256
1256
  vec3 geometryNormal = normal;
1257
1257
  vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1368,7 +1368,7 @@ IncidentLight directLight;
1368
1368
  #if defined( RE_IndirectSpecular )
1369
1369
  vec3 radiance = vec3( 0.0 );
1370
1370
  vec3 clearcoatRadiance = vec3( 0.0 );
1371
- #endif`,pu=`#if defined( RE_IndirectDiffuse )
1371
+ #endif`,vd=`#if defined( RE_IndirectDiffuse )
1372
1372
  #ifdef USE_LIGHTMAP
1373
1373
  vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1374
1374
  vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1389,7 +1389,7 @@ IncidentLight directLight;
1389
1389
  #ifdef USE_CLEARCOAT
1390
1390
  clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1391
1391
  #endif
1392
- #endif`,mu=`#if defined( RE_IndirectDiffuse )
1392
+ #endif`,Md=`#if defined( RE_IndirectDiffuse )
1393
1393
  #if defined( LAMBERT ) || defined( PHONG )
1394
1394
  irradiance += iblIrradiance;
1395
1395
  #endif
@@ -1397,27 +1397,27 @@ IncidentLight directLight;
1397
1397
  #endif
1398
1398
  #if defined( RE_IndirectSpecular )
1399
1399
  RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1400
- #endif`,gu=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1400
+ #endif`,Sd=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1401
1401
  gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1402
- #endif`,_u=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1402
+ #endif`,Ed=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1403
1403
  uniform float logDepthBufFC;
1404
1404
  varying float vFragDepth;
1405
1405
  varying float vIsPerspective;
1406
- #endif`,xu=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1406
+ #endif`,yd=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1407
1407
  varying float vFragDepth;
1408
1408
  varying float vIsPerspective;
1409
- #endif`,vu=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1409
+ #endif`,bd=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1410
1410
  vFragDepth = 1.0 + gl_Position.w;
1411
1411
  vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1412
- #endif`,Mu=`#ifdef USE_MAP
1412
+ #endif`,Td=`#ifdef USE_MAP
1413
1413
  vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1414
1414
  #ifdef DECODE_VIDEO_TEXTURE
1415
1415
  sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1416
1416
  #endif
1417
1417
  diffuseColor *= sampledDiffuseColor;
1418
- #endif`,Su=`#ifdef USE_MAP
1418
+ #endif`,Ad=`#ifdef USE_MAP
1419
1419
  uniform sampler2D map;
1420
- #endif`,Eu=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1420
+ #endif`,wd=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1421
1421
  #if defined( USE_POINTS_UV )
1422
1422
  vec2 uv = vUv;
1423
1423
  #else
@@ -1429,7 +1429,7 @@ IncidentLight directLight;
1429
1429
  #endif
1430
1430
  #ifdef USE_ALPHAMAP
1431
1431
  diffuseColor.a *= texture2D( alphaMap, uv ).g;
1432
- #endif`,yu=`#if defined( USE_POINTS_UV )
1432
+ #endif`,Rd=`#if defined( USE_POINTS_UV )
1433
1433
  varying vec2 vUv;
1434
1434
  #else
1435
1435
  #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1441,19 +1441,19 @@ IncidentLight directLight;
1441
1441
  #endif
1442
1442
  #ifdef USE_ALPHAMAP
1443
1443
  uniform sampler2D alphaMap;
1444
- #endif`,bu=`float metalnessFactor = metalness;
1444
+ #endif`,Cd=`float metalnessFactor = metalness;
1445
1445
  #ifdef USE_METALNESSMAP
1446
1446
  vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1447
1447
  metalnessFactor *= texelMetalness.b;
1448
- #endif`,Tu=`#ifdef USE_METALNESSMAP
1448
+ #endif`,Pd=`#ifdef USE_METALNESSMAP
1449
1449
  uniform sampler2D metalnessMap;
1450
- #endif`,Au=`#ifdef USE_INSTANCING_MORPH
1450
+ #endif`,Dd=`#ifdef USE_INSTANCING_MORPH
1451
1451
  float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1452
1452
  float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1453
1453
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1454
1454
  morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1455
1455
  }
1456
- #endif`,wu=`#if defined( USE_MORPHCOLORS )
1456
+ #endif`,Ld=`#if defined( USE_MORPHCOLORS )
1457
1457
  vColor *= morphTargetBaseInfluence;
1458
1458
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1459
1459
  #if defined( USE_COLOR_ALPHA )
@@ -1462,12 +1462,12 @@ IncidentLight directLight;
1462
1462
  if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1463
1463
  #endif
1464
1464
  }
1465
- #endif`,Ru=`#ifdef USE_MORPHNORMALS
1465
+ #endif`,Id=`#ifdef USE_MORPHNORMALS
1466
1466
  objectNormal *= morphTargetBaseInfluence;
1467
1467
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1468
1468
  if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1469
1469
  }
1470
- #endif`,Cu=`#ifdef USE_MORPHTARGETS
1470
+ #endif`,Nd=`#ifdef USE_MORPHTARGETS
1471
1471
  #ifndef USE_INSTANCING_MORPH
1472
1472
  uniform float morphTargetBaseInfluence;
1473
1473
  uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1481,12 +1481,12 @@ IncidentLight directLight;
1481
1481
  ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1482
1482
  return texelFetch( morphTargetsTexture, morphUV, 0 );
1483
1483
  }
1484
- #endif`,Pu=`#ifdef USE_MORPHTARGETS
1484
+ #endif`,Fd=`#ifdef USE_MORPHTARGETS
1485
1485
  transformed *= morphTargetBaseInfluence;
1486
1486
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1487
1487
  if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1488
1488
  }
1489
- #endif`,Du=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1489
+ #endif`,Ud=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1490
1490
  #ifdef FLAT_SHADED
1491
1491
  vec3 fdx = dFdx( vViewPosition );
1492
1492
  vec3 fdy = dFdy( vViewPosition );
@@ -1527,7 +1527,7 @@ IncidentLight directLight;
1527
1527
  tbn2[1] *= faceDirection;
1528
1528
  #endif
1529
1529
  #endif
1530
- vec3 nonPerturbedNormal = normal;`,Lu=`#ifdef USE_NORMALMAP_OBJECTSPACE
1530
+ vec3 nonPerturbedNormal = normal;`,Od=`#ifdef USE_NORMALMAP_OBJECTSPACE
1531
1531
  normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1532
1532
  #ifdef FLIP_SIDED
1533
1533
  normal = - normal;
@@ -1542,25 +1542,25 @@ vec3 nonPerturbedNormal = normal;`,Lu=`#ifdef USE_NORMALMAP_OBJECTSPACE
1542
1542
  normal = normalize( tbn * mapN );
1543
1543
  #elif defined( USE_BUMPMAP )
1544
1544
  normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1545
- #endif`,Iu=`#ifndef FLAT_SHADED
1545
+ #endif`,Bd=`#ifndef FLAT_SHADED
1546
1546
  varying vec3 vNormal;
1547
1547
  #ifdef USE_TANGENT
1548
1548
  varying vec3 vTangent;
1549
1549
  varying vec3 vBitangent;
1550
1550
  #endif
1551
- #endif`,Nu=`#ifndef FLAT_SHADED
1551
+ #endif`,zd=`#ifndef FLAT_SHADED
1552
1552
  varying vec3 vNormal;
1553
1553
  #ifdef USE_TANGENT
1554
1554
  varying vec3 vTangent;
1555
1555
  varying vec3 vBitangent;
1556
1556
  #endif
1557
- #endif`,Fu=`#ifndef FLAT_SHADED
1557
+ #endif`,Gd=`#ifndef FLAT_SHADED
1558
1558
  vNormal = normalize( transformedNormal );
1559
1559
  #ifdef USE_TANGENT
1560
1560
  vTangent = normalize( transformedTangent );
1561
1561
  vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1562
1562
  #endif
1563
- #endif`,Uu=`#ifdef USE_NORMALMAP
1563
+ #endif`,Vd=`#ifdef USE_NORMALMAP
1564
1564
  uniform sampler2D normalMap;
1565
1565
  uniform vec2 normalScale;
1566
1566
  #endif
@@ -1582,13 +1582,13 @@ vec3 nonPerturbedNormal = normal;`,Lu=`#ifdef USE_NORMALMAP_OBJECTSPACE
1582
1582
  float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1583
1583
  return mat3( T * scale, B * scale, N );
1584
1584
  }
1585
- #endif`,Ou=`#ifdef USE_CLEARCOAT
1585
+ #endif`,kd=`#ifdef USE_CLEARCOAT
1586
1586
  vec3 clearcoatNormal = nonPerturbedNormal;
1587
- #endif`,Bu=`#ifdef USE_CLEARCOAT_NORMALMAP
1587
+ #endif`,Hd=`#ifdef USE_CLEARCOAT_NORMALMAP
1588
1588
  vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1589
1589
  clearcoatMapN.xy *= clearcoatNormalScale;
1590
1590
  clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1591
- #endif`,zu=`#ifdef USE_CLEARCOATMAP
1591
+ #endif`,Wd=`#ifdef USE_CLEARCOATMAP
1592
1592
  uniform sampler2D clearcoatMap;
1593
1593
  #endif
1594
1594
  #ifdef USE_CLEARCOAT_NORMALMAP
@@ -1597,18 +1597,18 @@ vec3 nonPerturbedNormal = normal;`,Lu=`#ifdef USE_NORMALMAP_OBJECTSPACE
1597
1597
  #endif
1598
1598
  #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1599
1599
  uniform sampler2D clearcoatRoughnessMap;
1600
- #endif`,Gu=`#ifdef USE_IRIDESCENCEMAP
1600
+ #endif`,Xd=`#ifdef USE_IRIDESCENCEMAP
1601
1601
  uniform sampler2D iridescenceMap;
1602
1602
  #endif
1603
1603
  #ifdef USE_IRIDESCENCE_THICKNESSMAP
1604
1604
  uniform sampler2D iridescenceThicknessMap;
1605
- #endif`,Vu=`#ifdef OPAQUE
1605
+ #endif`,jd=`#ifdef OPAQUE
1606
1606
  diffuseColor.a = 1.0;
1607
1607
  #endif
1608
1608
  #ifdef USE_TRANSMISSION
1609
1609
  diffuseColor.a *= material.transmissionAlpha;
1610
1610
  #endif
1611
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,ku=`vec3 packNormalToRGB( const in vec3 normal ) {
1611
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,qd=`vec3 packNormalToRGB( const in vec3 normal ) {
1612
1612
  return normalize( normal ) * 0.5 + 0.5;
1613
1613
  }
1614
1614
  vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1687,9 +1687,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
1687
1687
  #else
1688
1688
  return ( near * far ) / ( ( far - near ) * depth - far );
1689
1689
  #endif
1690
- }`,Hu=`#ifdef PREMULTIPLIED_ALPHA
1690
+ }`,Yd=`#ifdef PREMULTIPLIED_ALPHA
1691
1691
  gl_FragColor.rgb *= gl_FragColor.a;
1692
- #endif`,Wu=`vec4 mvPosition = vec4( transformed, 1.0 );
1692
+ #endif`,$d=`vec4 mvPosition = vec4( transformed, 1.0 );
1693
1693
  #ifdef USE_BATCHING
1694
1694
  mvPosition = batchingMatrix * mvPosition;
1695
1695
  #endif
@@ -1697,22 +1697,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
1697
1697
  mvPosition = instanceMatrix * mvPosition;
1698
1698
  #endif
1699
1699
  mvPosition = modelViewMatrix * mvPosition;
1700
- gl_Position = projectionMatrix * mvPosition;`,Xu=`#ifdef DITHERING
1700
+ gl_Position = projectionMatrix * mvPosition;`,Zd=`#ifdef DITHERING
1701
1701
  gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1702
- #endif`,qu=`#ifdef DITHERING
1702
+ #endif`,Kd=`#ifdef DITHERING
1703
1703
  vec3 dithering( vec3 color ) {
1704
1704
  float grid_position = rand( gl_FragCoord.xy );
1705
1705
  vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1706
1706
  dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1707
1707
  return color + dither_shift_RGB;
1708
1708
  }
1709
- #endif`,ju=`float roughnessFactor = roughness;
1709
+ #endif`,Jd=`float roughnessFactor = roughness;
1710
1710
  #ifdef USE_ROUGHNESSMAP
1711
1711
  vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1712
1712
  roughnessFactor *= texelRoughness.g;
1713
- #endif`,Yu=`#ifdef USE_ROUGHNESSMAP
1713
+ #endif`,Qd=`#ifdef USE_ROUGHNESSMAP
1714
1714
  uniform sampler2D roughnessMap;
1715
- #endif`,$u=`#if NUM_SPOT_LIGHT_COORDS > 0
1715
+ #endif`,eu=`#if NUM_SPOT_LIGHT_COORDS > 0
1716
1716
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1717
1717
  #endif
1718
1718
  #if NUM_SPOT_LIGHT_MAPS > 0
@@ -1912,7 +1912,7 @@ gl_Position = projectionMatrix * mvPosition;`,Xu=`#ifdef DITHERING
1912
1912
  }
1913
1913
  #endif
1914
1914
  #endif
1915
- #endif`,Zu=`#if NUM_SPOT_LIGHT_COORDS > 0
1915
+ #endif`,tu=`#if NUM_SPOT_LIGHT_COORDS > 0
1916
1916
  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1917
1917
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1918
1918
  #endif
@@ -1953,7 +1953,7 @@ gl_Position = projectionMatrix * mvPosition;`,Xu=`#ifdef DITHERING
1953
1953
  };
1954
1954
  uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1955
1955
  #endif
1956
- #endif`,Ku=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1956
+ #endif`,nu=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
1957
1957
  vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1958
1958
  vec4 shadowWorldPosition;
1959
1959
  #endif
@@ -1985,7 +1985,7 @@ gl_Position = projectionMatrix * mvPosition;`,Xu=`#ifdef DITHERING
1985
1985
  vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
1986
1986
  }
1987
1987
  #pragma unroll_loop_end
1988
- #endif`,Ju=`float getShadowMask() {
1988
+ #endif`,iu=`float getShadowMask() {
1989
1989
  float shadow = 1.0;
1990
1990
  #ifdef USE_SHADOWMAP
1991
1991
  #if NUM_DIR_LIGHT_SHADOWS > 0
@@ -2017,12 +2017,12 @@ gl_Position = projectionMatrix * mvPosition;`,Xu=`#ifdef DITHERING
2017
2017
  #endif
2018
2018
  #endif
2019
2019
  return shadow;
2020
- }`,Qu=`#ifdef USE_SKINNING
2020
+ }`,ru=`#ifdef USE_SKINNING
2021
2021
  mat4 boneMatX = getBoneMatrix( skinIndex.x );
2022
2022
  mat4 boneMatY = getBoneMatrix( skinIndex.y );
2023
2023
  mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2024
2024
  mat4 boneMatW = getBoneMatrix( skinIndex.w );
2025
- #endif`,ed=`#ifdef USE_SKINNING
2025
+ #endif`,su=`#ifdef USE_SKINNING
2026
2026
  uniform mat4 bindMatrix;
2027
2027
  uniform mat4 bindMatrixInverse;
2028
2028
  uniform highp sampler2D boneTexture;
@@ -2037,7 +2037,7 @@ gl_Position = projectionMatrix * mvPosition;`,Xu=`#ifdef DITHERING
2037
2037
  vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2038
2038
  return mat4( v1, v2, v3, v4 );
2039
2039
  }
2040
- #endif`,td=`#ifdef USE_SKINNING
2040
+ #endif`,au=`#ifdef USE_SKINNING
2041
2041
  vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2042
2042
  vec4 skinned = vec4( 0.0 );
2043
2043
  skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2045,7 +2045,7 @@ gl_Position = projectionMatrix * mvPosition;`,Xu=`#ifdef DITHERING
2045
2045
  skinned += boneMatZ * skinVertex * skinWeight.z;
2046
2046
  skinned += boneMatW * skinVertex * skinWeight.w;
2047
2047
  transformed = ( bindMatrixInverse * skinned ).xyz;
2048
- #endif`,nd=`#ifdef USE_SKINNING
2048
+ #endif`,ou=`#ifdef USE_SKINNING
2049
2049
  mat4 skinMatrix = mat4( 0.0 );
2050
2050
  skinMatrix += skinWeight.x * boneMatX;
2051
2051
  skinMatrix += skinWeight.y * boneMatY;
@@ -2056,17 +2056,17 @@ gl_Position = projectionMatrix * mvPosition;`,Xu=`#ifdef DITHERING
2056
2056
  #ifdef USE_TANGENT
2057
2057
  objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2058
2058
  #endif
2059
- #endif`,id=`float specularStrength;
2059
+ #endif`,lu=`float specularStrength;
2060
2060
  #ifdef USE_SPECULARMAP
2061
2061
  vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2062
2062
  specularStrength = texelSpecular.r;
2063
2063
  #else
2064
2064
  specularStrength = 1.0;
2065
- #endif`,rd=`#ifdef USE_SPECULARMAP
2065
+ #endif`,cu=`#ifdef USE_SPECULARMAP
2066
2066
  uniform sampler2D specularMap;
2067
- #endif`,sd=`#if defined( TONE_MAPPING )
2067
+ #endif`,hu=`#if defined( TONE_MAPPING )
2068
2068
  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2069
- #endif`,ad=`#ifndef saturate
2069
+ #endif`,du=`#ifndef saturate
2070
2070
  #define saturate( a ) clamp( a, 0.0, 1.0 )
2071
2071
  #endif
2072
2072
  uniform float toneMappingExposure;
@@ -2163,7 +2163,7 @@ vec3 NeutralToneMapping( vec3 color ) {
2163
2163
  float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2164
2164
  return mix( color, vec3( newPeak ), g );
2165
2165
  }
2166
- vec3 CustomToneMapping( vec3 color ) { return color; }`,od=`#ifdef USE_TRANSMISSION
2166
+ vec3 CustomToneMapping( vec3 color ) { return color; }`,uu=`#ifdef USE_TRANSMISSION
2167
2167
  material.transmission = transmission;
2168
2168
  material.transmissionAlpha = 1.0;
2169
2169
  material.thickness = thickness;
@@ -2184,7 +2184,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,od=`#ifdef USE_TRANSMISS
2184
2184
  material.attenuationColor, material.attenuationDistance );
2185
2185
  material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2186
2186
  totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2187
- #endif`,ld=`#ifdef USE_TRANSMISSION
2187
+ #endif`,fu=`#ifdef USE_TRANSMISSION
2188
2188
  uniform float transmission;
2189
2189
  uniform float thickness;
2190
2190
  uniform float attenuationDistance;
@@ -2310,7 +2310,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,od=`#ifdef USE_TRANSMISS
2310
2310
  float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2311
2311
  return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2312
2312
  }
2313
- #endif`,cd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2313
+ #endif`,pu=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2314
2314
  varying vec2 vUv;
2315
2315
  #endif
2316
2316
  #ifdef USE_MAP
@@ -2380,7 +2380,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,od=`#ifdef USE_TRANSMISS
2380
2380
  #ifdef USE_THICKNESSMAP
2381
2381
  uniform mat3 thicknessMapTransform;
2382
2382
  varying vec2 vThicknessMapUv;
2383
- #endif`,hd=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2383
+ #endif`,mu=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2384
2384
  varying vec2 vUv;
2385
2385
  #endif
2386
2386
  #ifdef USE_MAP
@@ -2474,7 +2474,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,od=`#ifdef USE_TRANSMISS
2474
2474
  #ifdef USE_THICKNESSMAP
2475
2475
  uniform mat3 thicknessMapTransform;
2476
2476
  varying vec2 vThicknessMapUv;
2477
- #endif`,ud=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2477
+ #endif`,gu=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2478
2478
  vUv = vec3( uv, 1 ).xy;
2479
2479
  #endif
2480
2480
  #ifdef USE_MAP
@@ -2545,7 +2545,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,od=`#ifdef USE_TRANSMISS
2545
2545
  #endif
2546
2546
  #ifdef USE_THICKNESSMAP
2547
2547
  vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2548
- #endif`,dd=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2548
+ #endif`,_u=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2549
2549
  vec4 worldPosition = vec4( transformed, 1.0 );
2550
2550
  #ifdef USE_BATCHING
2551
2551
  worldPosition = batchingMatrix * worldPosition;
@@ -2554,12 +2554,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,od=`#ifdef USE_TRANSMISS
2554
2554
  worldPosition = instanceMatrix * worldPosition;
2555
2555
  #endif
2556
2556
  worldPosition = modelMatrix * worldPosition;
2557
- #endif`;const fd=`varying vec2 vUv;
2557
+ #endif`;const xu=`varying vec2 vUv;
2558
2558
  uniform mat3 uvTransform;
2559
2559
  void main() {
2560
2560
  vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2561
2561
  gl_Position = vec4( position.xy, 1.0, 1.0 );
2562
- }`,pd=`uniform sampler2D t2D;
2562
+ }`,vu=`uniform sampler2D t2D;
2563
2563
  uniform float backgroundIntensity;
2564
2564
  varying vec2 vUv;
2565
2565
  void main() {
@@ -2571,14 +2571,14 @@ void main() {
2571
2571
  gl_FragColor = texColor;
2572
2572
  #include <tonemapping_fragment>
2573
2573
  #include <colorspace_fragment>
2574
- }`,md=`varying vec3 vWorldDirection;
2574
+ }`,Mu=`varying vec3 vWorldDirection;
2575
2575
  #include <common>
2576
2576
  void main() {
2577
2577
  vWorldDirection = transformDirection( position, modelMatrix );
2578
2578
  #include <begin_vertex>
2579
2579
  #include <project_vertex>
2580
2580
  gl_Position.z = gl_Position.w;
2581
- }`,gd=`#ifdef ENVMAP_TYPE_CUBE
2581
+ }`,Su=`#ifdef ENVMAP_TYPE_CUBE
2582
2582
  uniform samplerCube envMap;
2583
2583
  #elif defined( ENVMAP_TYPE_CUBE_UV )
2584
2584
  uniform sampler2D envMap;
@@ -2601,14 +2601,14 @@ void main() {
2601
2601
  gl_FragColor = texColor;
2602
2602
  #include <tonemapping_fragment>
2603
2603
  #include <colorspace_fragment>
2604
- }`,_d=`varying vec3 vWorldDirection;
2604
+ }`,Eu=`varying vec3 vWorldDirection;
2605
2605
  #include <common>
2606
2606
  void main() {
2607
2607
  vWorldDirection = transformDirection( position, modelMatrix );
2608
2608
  #include <begin_vertex>
2609
2609
  #include <project_vertex>
2610
2610
  gl_Position.z = gl_Position.w;
2611
- }`,xd=`uniform samplerCube tCube;
2611
+ }`,yu=`uniform samplerCube tCube;
2612
2612
  uniform float tFlip;
2613
2613
  uniform float opacity;
2614
2614
  varying vec3 vWorldDirection;
@@ -2618,7 +2618,7 @@ void main() {
2618
2618
  gl_FragColor.a *= opacity;
2619
2619
  #include <tonemapping_fragment>
2620
2620
  #include <colorspace_fragment>
2621
- }`,vd=`#include <common>
2621
+ }`,bu=`#include <common>
2622
2622
  #include <batching_pars_vertex>
2623
2623
  #include <uv_pars_vertex>
2624
2624
  #include <displacementmap_pars_vertex>
@@ -2645,7 +2645,7 @@ void main() {
2645
2645
  #include <logdepthbuf_vertex>
2646
2646
  #include <clipping_planes_vertex>
2647
2647
  vHighPrecisionZW = gl_Position.zw;
2648
- }`,Md=`#if DEPTH_PACKING == 3200
2648
+ }`,Tu=`#if DEPTH_PACKING == 3200
2649
2649
  uniform float opacity;
2650
2650
  #endif
2651
2651
  #include <common>
@@ -2683,7 +2683,7 @@ void main() {
2683
2683
  #elif DEPTH_PACKING == 3203
2684
2684
  gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2685
2685
  #endif
2686
- }`,Sd=`#define DISTANCE
2686
+ }`,Au=`#define DISTANCE
2687
2687
  varying vec3 vWorldPosition;
2688
2688
  #include <common>
2689
2689
  #include <batching_pars_vertex>
@@ -2710,7 +2710,7 @@ void main() {
2710
2710
  #include <worldpos_vertex>
2711
2711
  #include <clipping_planes_vertex>
2712
2712
  vWorldPosition = worldPosition.xyz;
2713
- }`,Ed=`#define DISTANCE
2713
+ }`,wu=`#define DISTANCE
2714
2714
  uniform vec3 referencePosition;
2715
2715
  uniform float nearDistance;
2716
2716
  uniform float farDistance;
@@ -2733,13 +2733,13 @@ void main () {
2733
2733
  dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2734
2734
  dist = saturate( dist );
2735
2735
  gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2736
- }`,yd=`varying vec3 vWorldDirection;
2736
+ }`,Ru=`varying vec3 vWorldDirection;
2737
2737
  #include <common>
2738
2738
  void main() {
2739
2739
  vWorldDirection = transformDirection( position, modelMatrix );
2740
2740
  #include <begin_vertex>
2741
2741
  #include <project_vertex>
2742
- }`,bd=`uniform sampler2D tEquirect;
2742
+ }`,Cu=`uniform sampler2D tEquirect;
2743
2743
  varying vec3 vWorldDirection;
2744
2744
  #include <common>
2745
2745
  void main() {
@@ -2748,7 +2748,7 @@ void main() {
2748
2748
  gl_FragColor = texture2D( tEquirect, sampleUV );
2749
2749
  #include <tonemapping_fragment>
2750
2750
  #include <colorspace_fragment>
2751
- }`,Td=`uniform float scale;
2751
+ }`,Pu=`uniform float scale;
2752
2752
  attribute float lineDistance;
2753
2753
  varying float vLineDistance;
2754
2754
  #include <common>
@@ -2770,7 +2770,7 @@ void main() {
2770
2770
  #include <logdepthbuf_vertex>
2771
2771
  #include <clipping_planes_vertex>
2772
2772
  #include <fog_vertex>
2773
- }`,Ad=`uniform vec3 diffuse;
2773
+ }`,Du=`uniform vec3 diffuse;
2774
2774
  uniform float opacity;
2775
2775
  uniform float dashSize;
2776
2776
  uniform float totalSize;
@@ -2798,7 +2798,7 @@ void main() {
2798
2798
  #include <colorspace_fragment>
2799
2799
  #include <fog_fragment>
2800
2800
  #include <premultiplied_alpha_fragment>
2801
- }`,wd=`#include <common>
2801
+ }`,Lu=`#include <common>
2802
2802
  #include <batching_pars_vertex>
2803
2803
  #include <uv_pars_vertex>
2804
2804
  #include <envmap_pars_vertex>
@@ -2830,7 +2830,7 @@ void main() {
2830
2830
  #include <worldpos_vertex>
2831
2831
  #include <envmap_vertex>
2832
2832
  #include <fog_vertex>
2833
- }`,Rd=`uniform vec3 diffuse;
2833
+ }`,Iu=`uniform vec3 diffuse;
2834
2834
  uniform float opacity;
2835
2835
  #ifndef FLAT_SHADED
2836
2836
  varying vec3 vNormal;
@@ -2878,7 +2878,7 @@ void main() {
2878
2878
  #include <fog_fragment>
2879
2879
  #include <premultiplied_alpha_fragment>
2880
2880
  #include <dithering_fragment>
2881
- }`,Cd=`#define LAMBERT
2881
+ }`,Nu=`#define LAMBERT
2882
2882
  varying vec3 vViewPosition;
2883
2883
  #include <common>
2884
2884
  #include <batching_pars_vertex>
@@ -2917,7 +2917,7 @@ void main() {
2917
2917
  #include <envmap_vertex>
2918
2918
  #include <shadowmap_vertex>
2919
2919
  #include <fog_vertex>
2920
- }`,Pd=`#define LAMBERT
2920
+ }`,Fu=`#define LAMBERT
2921
2921
  uniform vec3 diffuse;
2922
2922
  uniform vec3 emissive;
2923
2923
  uniform float opacity;
@@ -2975,7 +2975,7 @@ void main() {
2975
2975
  #include <fog_fragment>
2976
2976
  #include <premultiplied_alpha_fragment>
2977
2977
  #include <dithering_fragment>
2978
- }`,Dd=`#define MATCAP
2978
+ }`,Uu=`#define MATCAP
2979
2979
  varying vec3 vViewPosition;
2980
2980
  #include <common>
2981
2981
  #include <batching_pars_vertex>
@@ -3009,7 +3009,7 @@ void main() {
3009
3009
  #include <clipping_planes_vertex>
3010
3010
  #include <fog_vertex>
3011
3011
  vViewPosition = - mvPosition.xyz;
3012
- }`,Ld=`#define MATCAP
3012
+ }`,Ou=`#define MATCAP
3013
3013
  uniform vec3 diffuse;
3014
3014
  uniform float opacity;
3015
3015
  uniform sampler2D matcap;
@@ -3055,7 +3055,7 @@ void main() {
3055
3055
  #include <fog_fragment>
3056
3056
  #include <premultiplied_alpha_fragment>
3057
3057
  #include <dithering_fragment>
3058
- }`,Id=`#define NORMAL
3058
+ }`,Bu=`#define NORMAL
3059
3059
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3060
3060
  varying vec3 vViewPosition;
3061
3061
  #endif
@@ -3088,7 +3088,7 @@ void main() {
3088
3088
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3089
3089
  vViewPosition = - mvPosition.xyz;
3090
3090
  #endif
3091
- }`,Nd=`#define NORMAL
3091
+ }`,zu=`#define NORMAL
3092
3092
  uniform float opacity;
3093
3093
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3094
3094
  varying vec3 vViewPosition;
@@ -3109,7 +3109,7 @@ void main() {
3109
3109
  #ifdef OPAQUE
3110
3110
  gl_FragColor.a = 1.0;
3111
3111
  #endif
3112
- }`,Fd=`#define PHONG
3112
+ }`,Gu=`#define PHONG
3113
3113
  varying vec3 vViewPosition;
3114
3114
  #include <common>
3115
3115
  #include <batching_pars_vertex>
@@ -3148,7 +3148,7 @@ void main() {
3148
3148
  #include <envmap_vertex>
3149
3149
  #include <shadowmap_vertex>
3150
3150
  #include <fog_vertex>
3151
- }`,Ud=`#define PHONG
3151
+ }`,Vu=`#define PHONG
3152
3152
  uniform vec3 diffuse;
3153
3153
  uniform vec3 emissive;
3154
3154
  uniform vec3 specular;
@@ -3208,7 +3208,7 @@ void main() {
3208
3208
  #include <fog_fragment>
3209
3209
  #include <premultiplied_alpha_fragment>
3210
3210
  #include <dithering_fragment>
3211
- }`,Od=`#define STANDARD
3211
+ }`,ku=`#define STANDARD
3212
3212
  varying vec3 vViewPosition;
3213
3213
  #ifdef USE_TRANSMISSION
3214
3214
  varying vec3 vWorldPosition;
@@ -3251,7 +3251,7 @@ void main() {
3251
3251
  #ifdef USE_TRANSMISSION
3252
3252
  vWorldPosition = worldPosition.xyz;
3253
3253
  #endif
3254
- }`,Bd=`#define STANDARD
3254
+ }`,Hu=`#define STANDARD
3255
3255
  #ifdef PHYSICAL
3256
3256
  #define IOR
3257
3257
  #define USE_SPECULAR
@@ -3376,7 +3376,7 @@ void main() {
3376
3376
  #include <fog_fragment>
3377
3377
  #include <premultiplied_alpha_fragment>
3378
3378
  #include <dithering_fragment>
3379
- }`,zd=`#define TOON
3379
+ }`,Wu=`#define TOON
3380
3380
  varying vec3 vViewPosition;
3381
3381
  #include <common>
3382
3382
  #include <batching_pars_vertex>
@@ -3413,7 +3413,7 @@ void main() {
3413
3413
  #include <worldpos_vertex>
3414
3414
  #include <shadowmap_vertex>
3415
3415
  #include <fog_vertex>
3416
- }`,Gd=`#define TOON
3416
+ }`,Xu=`#define TOON
3417
3417
  uniform vec3 diffuse;
3418
3418
  uniform vec3 emissive;
3419
3419
  uniform float opacity;
@@ -3465,7 +3465,7 @@ void main() {
3465
3465
  #include <fog_fragment>
3466
3466
  #include <premultiplied_alpha_fragment>
3467
3467
  #include <dithering_fragment>
3468
- }`,Vd=`uniform float size;
3468
+ }`,ju=`uniform float size;
3469
3469
  uniform float scale;
3470
3470
  #include <common>
3471
3471
  #include <color_pars_vertex>
@@ -3496,7 +3496,7 @@ void main() {
3496
3496
  #include <clipping_planes_vertex>
3497
3497
  #include <worldpos_vertex>
3498
3498
  #include <fog_vertex>
3499
- }`,kd=`uniform vec3 diffuse;
3499
+ }`,qu=`uniform vec3 diffuse;
3500
3500
  uniform float opacity;
3501
3501
  #include <common>
3502
3502
  #include <color_pars_fragment>
@@ -3521,7 +3521,7 @@ void main() {
3521
3521
  #include <colorspace_fragment>
3522
3522
  #include <fog_fragment>
3523
3523
  #include <premultiplied_alpha_fragment>
3524
- }`,Hd=`#include <common>
3524
+ }`,Yu=`#include <common>
3525
3525
  #include <batching_pars_vertex>
3526
3526
  #include <fog_pars_vertex>
3527
3527
  #include <morphtarget_pars_vertex>
@@ -3544,7 +3544,7 @@ void main() {
3544
3544
  #include <worldpos_vertex>
3545
3545
  #include <shadowmap_vertex>
3546
3546
  #include <fog_vertex>
3547
- }`,Wd=`uniform vec3 color;
3547
+ }`,$u=`uniform vec3 color;
3548
3548
  uniform float opacity;
3549
3549
  #include <common>
3550
3550
  #include <fog_pars_fragment>
@@ -3560,7 +3560,7 @@ void main() {
3560
3560
  #include <colorspace_fragment>
3561
3561
  #include <fog_fragment>
3562
3562
  #include <premultiplied_alpha_fragment>
3563
- }`,Xd=`uniform float rotation;
3563
+ }`,Zu=`uniform float rotation;
3564
3564
  uniform vec2 center;
3565
3565
  #include <common>
3566
3566
  #include <uv_pars_vertex>
@@ -3584,7 +3584,7 @@ void main() {
3584
3584
  #include <logdepthbuf_vertex>
3585
3585
  #include <clipping_planes_vertex>
3586
3586
  #include <fog_vertex>
3587
- }`,qd=`uniform vec3 diffuse;
3587
+ }`,Ku=`uniform vec3 diffuse;
3588
3588
  uniform float opacity;
3589
3589
  #include <common>
3590
3590
  #include <uv_pars_fragment>
@@ -3609,7 +3609,7 @@ void main() {
3609
3609
  #include <tonemapping_fragment>
3610
3610
  #include <colorspace_fragment>
3611
3611
  #include <fog_fragment>
3612
- }`,ze={alphahash_fragment:ph,alphahash_pars_fragment:mh,alphamap_fragment:gh,alphamap_pars_fragment:_h,alphatest_fragment:xh,alphatest_pars_fragment:vh,aomap_fragment:Mh,aomap_pars_fragment:Sh,batching_pars_vertex:Eh,batching_vertex:yh,begin_vertex:bh,beginnormal_vertex:Th,bsdfs:Ah,iridescence_fragment:wh,bumpmap_pars_fragment:Rh,clipping_planes_fragment:Ch,clipping_planes_pars_fragment:Ph,clipping_planes_pars_vertex:Dh,clipping_planes_vertex:Lh,color_fragment:Ih,color_pars_fragment:Nh,color_pars_vertex:Fh,color_vertex:Uh,common:Oh,cube_uv_reflection_fragment:Bh,defaultnormal_vertex:zh,displacementmap_pars_vertex:Gh,displacementmap_vertex:Vh,emissivemap_fragment:kh,emissivemap_pars_fragment:Hh,colorspace_fragment:Wh,colorspace_pars_fragment:Xh,envmap_fragment:qh,envmap_common_pars_fragment:jh,envmap_pars_fragment:Yh,envmap_pars_vertex:$h,envmap_physical_pars_fragment:au,envmap_vertex:Zh,fog_vertex:Kh,fog_pars_vertex:Jh,fog_fragment:Qh,fog_pars_fragment:eu,gradientmap_pars_fragment:tu,lightmap_pars_fragment:nu,lights_lambert_fragment:iu,lights_lambert_pars_fragment:ru,lights_pars_begin:su,lights_toon_fragment:ou,lights_toon_pars_fragment:lu,lights_phong_fragment:cu,lights_phong_pars_fragment:hu,lights_physical_fragment:uu,lights_physical_pars_fragment:du,lights_fragment_begin:fu,lights_fragment_maps:pu,lights_fragment_end:mu,logdepthbuf_fragment:gu,logdepthbuf_pars_fragment:_u,logdepthbuf_pars_vertex:xu,logdepthbuf_vertex:vu,map_fragment:Mu,map_pars_fragment:Su,map_particle_fragment:Eu,map_particle_pars_fragment:yu,metalnessmap_fragment:bu,metalnessmap_pars_fragment:Tu,morphinstance_vertex:Au,morphcolor_vertex:wu,morphnormal_vertex:Ru,morphtarget_pars_vertex:Cu,morphtarget_vertex:Pu,normal_fragment_begin:Du,normal_fragment_maps:Lu,normal_pars_fragment:Iu,normal_pars_vertex:Nu,normal_vertex:Fu,normalmap_pars_fragment:Uu,clearcoat_normal_fragment_begin:Ou,clearcoat_normal_fragment_maps:Bu,clearcoat_pars_fragment:zu,iridescence_pars_fragment:Gu,opaque_fragment:Vu,packing:ku,premultiplied_alpha_fragment:Hu,project_vertex:Wu,dithering_fragment:Xu,dithering_pars_fragment:qu,roughnessmap_fragment:ju,roughnessmap_pars_fragment:Yu,shadowmap_pars_fragment:$u,shadowmap_pars_vertex:Zu,shadowmap_vertex:Ku,shadowmask_pars_fragment:Ju,skinbase_vertex:Qu,skinning_pars_vertex:ed,skinning_vertex:td,skinnormal_vertex:nd,specularmap_fragment:id,specularmap_pars_fragment:rd,tonemapping_fragment:sd,tonemapping_pars_fragment:ad,transmission_fragment:od,transmission_pars_fragment:ld,uv_pars_fragment:cd,uv_pars_vertex:hd,uv_vertex:ud,worldpos_vertex:dd,background_vert:fd,background_frag:pd,backgroundCube_vert:md,backgroundCube_frag:gd,cube_vert:_d,cube_frag:xd,depth_vert:vd,depth_frag:Md,distance_vert:Sd,distance_frag:Ed,equirect_vert:yd,equirect_frag:bd,linedashed_vert:Td,linedashed_frag:Ad,meshbasic_vert:wd,meshbasic_frag:Rd,meshlambert_vert:Cd,meshlambert_frag:Pd,meshmatcap_vert:Dd,meshmatcap_frag:Ld,meshnormal_vert:Id,meshnormal_frag:Nd,meshphong_vert:Fd,meshphong_frag:Ud,meshphysical_vert:Od,meshphysical_frag:Bd,meshtoon_vert:zd,meshtoon_frag:Gd,points_vert:Vd,points_frag:kd,shadow_vert:Hd,shadow_frag:Wd,sprite_vert:Xd,sprite_frag:qd},he={common:{diffuse:{value:new nt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Be}},envmap:{envMap:{value:null},envMapRotation:{value:new Be},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 Be}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Be}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Be},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Be},normalScale:{value:new Ke(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Be},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Be}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Be}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Be}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new nt(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 nt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0},uvTransform:{value:new Be}},sprite:{diffuse:{value:new nt(16777215)},opacity:{value:1},center:{value:new Ke(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}}},qt={basic:{uniforms:yt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.fog]),vertexShader:ze.meshbasic_vert,fragmentShader:ze.meshbasic_frag},lambert:{uniforms:yt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new nt(0)},envMapIntensity:{value:1}}]),vertexShader:ze.meshlambert_vert,fragmentShader:ze.meshlambert_frag},phong:{uniforms:yt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new nt(0)},specular:{value:new nt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:ze.meshphong_vert,fragmentShader:ze.meshphong_frag},standard:{uniforms:yt([he.common,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.roughnessmap,he.metalnessmap,he.fog,he.lights,{emissive:{value:new nt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag},toon:{uniforms:yt([he.common,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.gradientmap,he.fog,he.lights,{emissive:{value:new nt(0)}}]),vertexShader:ze.meshtoon_vert,fragmentShader:ze.meshtoon_frag},matcap:{uniforms:yt([he.common,he.bumpmap,he.normalmap,he.displacementmap,he.fog,{matcap:{value:null}}]),vertexShader:ze.meshmatcap_vert,fragmentShader:ze.meshmatcap_frag},points:{uniforms:yt([he.points,he.fog]),vertexShader:ze.points_vert,fragmentShader:ze.points_frag},dashed:{uniforms:yt([he.common,he.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ze.linedashed_vert,fragmentShader:ze.linedashed_frag},depth:{uniforms:yt([he.common,he.displacementmap]),vertexShader:ze.depth_vert,fragmentShader:ze.depth_frag},normal:{uniforms:yt([he.common,he.bumpmap,he.normalmap,he.displacementmap,{opacity:{value:1}}]),vertexShader:ze.meshnormal_vert,fragmentShader:ze.meshnormal_frag},sprite:{uniforms:yt([he.sprite,he.fog]),vertexShader:ze.sprite_vert,fragmentShader:ze.sprite_frag},background:{uniforms:{uvTransform:{value:new Be},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ze.background_vert,fragmentShader:ze.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Be}},vertexShader:ze.backgroundCube_vert,fragmentShader:ze.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ze.cube_vert,fragmentShader:ze.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ze.equirect_vert,fragmentShader:ze.equirect_frag},distance:{uniforms:yt([he.common,he.displacementmap,{referencePosition:{value:new W},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ze.distance_vert,fragmentShader:ze.distance_frag},shadow:{uniforms:yt([he.lights,he.fog,{color:{value:new nt(0)},opacity:{value:1}}]),vertexShader:ze.shadow_vert,fragmentShader:ze.shadow_frag}};qt.physical={uniforms:yt([qt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Be},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Be},clearcoatNormalScale:{value:new Ke(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Be},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Be},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Be},sheen:{value:0},sheenColor:{value:new nt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Be},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Be},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Be},transmissionSamplerSize:{value:new Ke},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Be},attenuationDistance:{value:0},attenuationColor:{value:new nt(0)},specularColor:{value:new nt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Be},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Be},anisotropyVector:{value:new Ke},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Be}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag};const rr={r:0,b:0,g:0},In=new Hn,jd=new dt;function Yd(n,e,t,i,r,s){const a=new nt(0);let o=r===!0?0:1,l,c,u=null,p=0,h=null;function f(S){let b=S.isScene===!0?S.background:null;if(b&&b.isTexture){const E=S.backgroundBlurriness>0;b=e.get(b,E)}return b}function g(S){let b=!1;const E=f(S);E===null?m(a,o):E&&E.isColor&&(m(E,1),b=!0);const R=n.xr.getEnvironmentBlendMode();R==="additive"?t.buffers.color.setClear(0,0,0,1,s):R==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(n.autoClear||b)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function v(S,b){const E=f(b);E&&(E.isCubeTexture||E.mapping===xr)?(c===void 0&&(c=new Jt(new Ni(1,1,1),new Qt({name:"BackgroundCubeMaterial",uniforms:di(qt.backgroundCube.uniforms),vertexShader:qt.backgroundCube.vertexShader,fragmentShader:qt.backgroundCube.fragmentShader,side:At,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(R,A,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),In.copy(b.backgroundRotation),In.x*=-1,In.y*=-1,In.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(In.y*=-1,In.z*=-1),c.material.uniforms.envMap.value=E,c.material.uniforms.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=b.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(jd.makeRotationFromEuler(In)),c.material.toneMapped=Xe.getTransfer(E.colorSpace)!==Qe,(u!==E||p!==E.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,u=E,p=E.version,h=n.toneMapping),c.layers.enableAll(),S.unshift(c,c.geometry,c.material,0,0,null)):E&&E.isTexture&&(l===void 0&&(l=new Jt(new Mr(2,2),new Qt({name:"BackgroundMaterial",uniforms:di(qt.background.uniforms),vertexShader:qt.background.vertexShader,fragmentShader:qt.background.fragmentShader,side:An,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=E,l.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,l.material.toneMapped=Xe.getTransfer(E.colorSpace)!==Qe,E.matrixAutoUpdate===!0&&E.updateMatrix(),l.material.uniforms.uvTransform.value.copy(E.matrix),(u!==E||p!==E.version||h!==n.toneMapping)&&(l.material.needsUpdate=!0,u=E,p=E.version,h=n.toneMapping),l.layers.enableAll(),S.unshift(l,l.geometry,l.material,0,0,null))}function m(S,b){S.getRGB(rr,gl(n)),t.buffers.color.setClear(rr.r,rr.g,rr.b,b,s)}function d(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(S,b=1){a.set(S),o=b,m(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(S){o=S,m(a,o)},render:g,addToRenderList:v,dispose:d}}function $d(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=h(null);let s=r,a=!1;function o(w,F,B,I,G){let V=!1;const U=p(w,I,B,F);s!==U&&(s=U,c(s.object)),V=f(w,I,B,G),V&&g(w,I,B,G),G!==null&&e.update(G,n.ELEMENT_ARRAY_BUFFER),(V||a)&&(a=!1,E(w,F,B,I),G!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(G).buffer))}function l(){return n.createVertexArray()}function c(w){return n.bindVertexArray(w)}function u(w){return n.deleteVertexArray(w)}function p(w,F,B,I){const G=I.wireframe===!0;let V=i[F.id];V===void 0&&(V={},i[F.id]=V);const U=w.isInstancedMesh===!0?w.id:0;let K=V[U];K===void 0&&(K={},V[U]=K);let Y=K[B.id];Y===void 0&&(Y={},K[B.id]=Y);let se=Y[G];return se===void 0&&(se=h(l()),Y[G]=se),se}function h(w){const F=[],B=[],I=[];for(let G=0;G<t;G++)F[G]=0,B[G]=0,I[G]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:B,attributeDivisors:I,object:w,attributes:{},index:null}}function f(w,F,B,I){const G=s.attributes,V=F.attributes;let U=0;const K=B.getAttributes();for(const Y in K)if(K[Y].location>=0){const ce=G[Y];let le=V[Y];if(le===void 0&&(Y==="instanceMatrix"&&w.instanceMatrix&&(le=w.instanceMatrix),Y==="instanceColor"&&w.instanceColor&&(le=w.instanceColor)),ce===void 0||ce.attribute!==le||le&&ce.data!==le.data)return!0;U++}return s.attributesNum!==U||s.index!==I}function g(w,F,B,I){const G={},V=F.attributes;let U=0;const K=B.getAttributes();for(const Y in K)if(K[Y].location>=0){let ce=V[Y];ce===void 0&&(Y==="instanceMatrix"&&w.instanceMatrix&&(ce=w.instanceMatrix),Y==="instanceColor"&&w.instanceColor&&(ce=w.instanceColor));const le={};le.attribute=ce,ce&&ce.data&&(le.data=ce.data),G[Y]=le,U++}s.attributes=G,s.attributesNum=U,s.index=I}function v(){const w=s.newAttributes;for(let F=0,B=w.length;F<B;F++)w[F]=0}function m(w){d(w,0)}function d(w,F){const B=s.newAttributes,I=s.enabledAttributes,G=s.attributeDivisors;B[w]=1,I[w]===0&&(n.enableVertexAttribArray(w),I[w]=1),G[w]!==F&&(n.vertexAttribDivisor(w,F),G[w]=F)}function S(){const w=s.newAttributes,F=s.enabledAttributes;for(let B=0,I=F.length;B<I;B++)F[B]!==w[B]&&(n.disableVertexAttribArray(B),F[B]=0)}function b(w,F,B,I,G,V,U){U===!0?n.vertexAttribIPointer(w,F,B,G,V):n.vertexAttribPointer(w,F,B,I,G,V)}function E(w,F,B,I){v();const G=I.attributes,V=B.getAttributes(),U=F.defaultAttributeValues;for(const K in V){const Y=V[K];if(Y.location>=0){let se=G[K];if(se===void 0&&(K==="instanceMatrix"&&w.instanceMatrix&&(se=w.instanceMatrix),K==="instanceColor"&&w.instanceColor&&(se=w.instanceColor)),se!==void 0){const ce=se.normalized,le=se.itemSize,we=e.get(se);if(we===void 0)continue;const Ye=we.buffer,He=we.type,Z=we.bytesPerElement,te=He===n.INT||He===n.UNSIGNED_INT||se.gpuType===ra;if(se.isInterleavedBufferAttribute){const re=se.data,Le=re.stride,Ae=se.offset;if(re.isInstancedInterleavedBuffer){for(let Re=0;Re<Y.locationSize;Re++)d(Y.location+Re,re.meshPerAttribute);w.isInstancedMesh!==!0&&I._maxInstanceCount===void 0&&(I._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let Re=0;Re<Y.locationSize;Re++)m(Y.location+Re);n.bindBuffer(n.ARRAY_BUFFER,Ye);for(let Re=0;Re<Y.locationSize;Re++)b(Y.location+Re,le/Y.locationSize,He,ce,Le*Z,(Ae+le/Y.locationSize*Re)*Z,te)}else{if(se.isInstancedBufferAttribute){for(let re=0;re<Y.locationSize;re++)d(Y.location+re,se.meshPerAttribute);w.isInstancedMesh!==!0&&I._maxInstanceCount===void 0&&(I._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let re=0;re<Y.locationSize;re++)m(Y.location+re);n.bindBuffer(n.ARRAY_BUFFER,Ye);for(let re=0;re<Y.locationSize;re++)b(Y.location+re,le/Y.locationSize,He,ce,le*Z,le/Y.locationSize*re*Z,te)}}else if(U!==void 0){const ce=U[K];if(ce!==void 0)switch(ce.length){case 2:n.vertexAttrib2fv(Y.location,ce);break;case 3:n.vertexAttrib3fv(Y.location,ce);break;case 4:n.vertexAttrib4fv(Y.location,ce);break;default:n.vertexAttrib1fv(Y.location,ce)}}}}S()}function R(){y();for(const w in i){const F=i[w];for(const B in F){const I=F[B];for(const G in I){const V=I[G];for(const U in V)u(V[U].object),delete V[U];delete I[G]}}delete i[w]}}function A(w){if(i[w.id]===void 0)return;const F=i[w.id];for(const B in F){const I=F[B];for(const G in I){const V=I[G];for(const U in V)u(V[U].object),delete V[U];delete I[G]}}delete i[w.id]}function C(w){for(const F in i){const B=i[F];for(const I in B){const G=B[I];if(G[w.id]===void 0)continue;const V=G[w.id];for(const U in V)u(V[U].object),delete V[U];delete G[w.id]}}}function x(w){for(const F in i){const B=i[F],I=w.isInstancedMesh===!0?w.id:0,G=B[I];if(G!==void 0){for(const V in G){const U=G[V];for(const K in U)u(U[K].object),delete U[K];delete G[V]}delete B[I],Object.keys(B).length===0&&delete i[F]}}}function y(){z(),a=!0,s!==r&&(s=r,c(s.object))}function z(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:y,resetDefaultState:z,dispose:R,releaseStatesOfGeometry:A,releaseStatesOfObject:x,releaseStatesOfProgram:C,initAttributes:v,enableAttribute:m,disableUnusedAttributes:S}}function Zd(n,e,t){let i;function r(c){i=c}function s(c,u){n.drawArrays(i,c,u),t.update(u,i,1)}function a(c,u,p){p!==0&&(n.drawArraysInstanced(i,c,u,p),t.update(u,i,p))}function o(c,u,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,u,0,p);let f=0;for(let g=0;g<p;g++)f+=u[g];t.update(f,i,1)}function l(c,u,p,h){if(p===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let g=0;g<c.length;g++)a(c[g],u[g],h[g]);else{f.multiDrawArraysInstancedWEBGL(i,c,0,u,0,h,0,p);let g=0;for(let v=0;v<p;v++)g+=u[v]*h[v];t.update(g,i,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function Kd(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(C){return!(C!==zt&&i.convert(C)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){const x=C===pn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==It&&i.convert(C)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==jt&&!x)}function l(C){if(C==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(Ie("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const p=t.logarithmicDepthBuffer===!0,h=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),f=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),g=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),v=n.getParameter(n.MAX_TEXTURE_SIZE),m=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),d=n.getParameter(n.MAX_VERTEX_ATTRIBS),S=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),b=n.getParameter(n.MAX_VARYING_VECTORS),E=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),R=n.getParameter(n.MAX_SAMPLES),A=n.getParameter(n.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:p,reversedDepthBuffer:h,maxTextures:f,maxVertexTextures:g,maxTextureSize:v,maxCubemapSize:m,maxAttributes:d,maxVertexUniforms:S,maxVaryings:b,maxFragmentUniforms:E,maxSamples:R,samples:A}}function Jd(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new Fn,o=new Be,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(p,h){const f=p.length!==0||h||i!==0||r;return r=h,i=p.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(p,h){t=u(p,h,0)},this.setState=function(p,h,f){const g=p.clippingPlanes,v=p.clipIntersection,m=p.clipShadows,d=n.get(p);if(!r||g===null||g.length===0||s&&!m)s?u(null):c();else{const S=s?0:i,b=S*4;let E=d.clippingState||null;l.value=E,E=u(g,h,b,f);for(let R=0;R!==b;++R)E[R]=t[R];d.clippingState=E,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=S}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(p,h,f,g){const v=p!==null?p.length:0;let m=null;if(v!==0){if(m=l.value,g!==!0||m===null){const d=f+v*4,S=h.matrixWorldInverse;o.getNormalMatrix(S),(m===null||m.length<d)&&(m=new Float32Array(d));for(let b=0,E=f;b!==v;++b,E+=4)a.copy(p[b]).applyMatrix4(S,o),a.normal.toArray(m,E),m[E+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,m}}const Tn=4,Qa=[.125,.215,.35,.446,.526,.582],On=20,Qd=256,yi=new pa,eo=new nt;let Jr=null,Qr=0,es=0,ts=!1;const ef=new W;class to{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,i=.1,r=100,s={}){const{size:a=256,position:o=ef}=s;Jr=this._renderer.getRenderTarget(),Qr=this._renderer.getActiveCubeFace(),es=this._renderer.getActiveMipmapLevel(),ts=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=ro(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=io(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Jr,Qr,es),this._renderer.xr.enabled=ts,e.scissorTest=!1,ai(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Vn||e.mapping===hi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Jr=this._renderer.getRenderTarget(),Qr=this._renderer.getActiveCubeFace(),es=this._renderer.getActiveMipmapLevel(),ts=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Et,minFilter:Et,generateMipmaps:!1,type:pn,format:zt,colorSpace:kn,depthBuffer:!1},r=no(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=no(e,t,i);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=tf(s)),this._blurMaterial=rf(s,e,t),this._ggxMaterial=nf(s,e,t)}return r}_compileMaterial(e){const t=new Jt(new en,e);this._renderer.compile(t,yi)}_sceneToCubeUV(e,t,i,r,s){const l=new Bt(90,1,t,i),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],p=this._renderer,h=p.autoClear,f=p.toneMapping;p.getClearColor(eo),p.toneMapping=$t,p.autoClear=!1,p.state.buffers.depth.getReversed()&&(p.setRenderTarget(r),p.clearDepth(),p.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Jt(new Ni,new dl({name:"PMREM.Background",side:At,depthWrite:!1,depthTest:!1})));const v=this._backgroundBox,m=v.material;let d=!1;const S=e.background;S?S.isColor&&(m.color.copy(S),e.background=null,d=!0):(m.color.copy(eo),d=!0);for(let b=0;b<6;b++){const E=b%3;E===0?(l.up.set(0,c[b],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[b],s.y,s.z)):E===1?(l.up.set(0,0,c[b]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[b],s.z)):(l.up.set(0,c[b],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[b]));const R=this._cubeSize;ai(r,E*R,b>2?R:0,R,R),p.setRenderTarget(r),d&&p.render(v,l),p.render(e,l)}p.toneMapping=f,p.autoClear=h,e.background=S}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Vn||e.mapping===hi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=ro()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=io());const s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;ai(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,yi)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=i}_applyGGXFilter(e,t,i){const r=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[i];o.material=a;const l=a.uniforms,c=i/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),p=Math.sqrt(c*c-u*u),h=0+c*1.25,f=p*h,{_lodMax:g}=this,v=this._sizeLods[i],m=3*v*(i>g-Tn?i-g+Tn:0),d=4*(this._cubeSize-v);l.envMap.value=e.texture,l.roughness.value=f,l.mipInt.value=g-t,ai(s,m,d,3*v,2*v),r.setRenderTarget(s),r.render(o,yi),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=g-i,ai(e,m,d,3*v,2*v),r.setRenderTarget(e),r.render(o,yi)}_blur(e,t,i,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",s),this._halfBlur(a,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&je("blur direction must be either latitudinal or longitudinal!");const u=3,p=this._lodMeshes[r];p.material=c;const h=c.uniforms,f=this._sizeLods[i]-1,g=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*On-1),v=s/g,m=isFinite(s)?1+Math.floor(u*v):On;m>On&&Ie(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${On}`);const d=[];let S=0;for(let C=0;C<On;++C){const x=C/v,y=Math.exp(-x*x/2);d.push(y),C===0?S+=y:C<m&&(S+=2*y)}for(let C=0;C<d.length;C++)d[C]=d[C]/S;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=d,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:b}=this;h.dTheta.value=g,h.mipInt.value=b-i;const E=this._sizeLods[r],R=3*E*(r>b-Tn?r-b+Tn:0),A=4*(this._cubeSize-E);ai(t,R,A,3*E,2*E),l.setRenderTarget(t),l.render(p,yi)}}function tf(n){const e=[],t=[],i=[];let r=n;const s=n-Tn+1+Qa.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);e.push(o);let l=1/o;a>n-Tn?l=Qa[a-n+Tn-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),u=-c,p=1+c,h=[u,u,p,u,p,p,u,u,p,p,u,p],f=6,g=6,v=3,m=2,d=1,S=new Float32Array(v*g*f),b=new Float32Array(m*g*f),E=new Float32Array(d*g*f);for(let A=0;A<f;A++){const C=A%3*2/3-1,x=A>2?0:-1,y=[C,x,0,C+2/3,x,0,C+2/3,x+1,0,C,x,0,C+2/3,x+1,0,C,x+1,0];S.set(y,v*g*A),b.set(h,m*g*A);const z=[A,A,A,A,A,A];E.set(z,d*g*A)}const R=new en;R.setAttribute("position",new Vt(S,v)),R.setAttribute("uv",new Vt(b,m)),R.setAttribute("faceIndex",new Vt(E,d)),i.push(new Jt(R,null)),r>Tn&&r--}return{lodMeshes:i,sizeLods:e,sigmas:t}}function no(n,e,t){const i=new Zt(n,e,t);return i.texture.mapping=xr,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function ai(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function nf(n,e,t){return new Qt({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:Qd,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Sr(),fragmentShader:`
3612
+ }`,ze={alphahash_fragment:vh,alphahash_pars_fragment:Mh,alphamap_fragment:Sh,alphamap_pars_fragment:Eh,alphatest_fragment:yh,alphatest_pars_fragment:bh,aomap_fragment:Th,aomap_pars_fragment:Ah,batching_pars_vertex:wh,batching_vertex:Rh,begin_vertex:Ch,beginnormal_vertex:Ph,bsdfs:Dh,iridescence_fragment:Lh,bumpmap_pars_fragment:Ih,clipping_planes_fragment:Nh,clipping_planes_pars_fragment:Fh,clipping_planes_pars_vertex:Uh,clipping_planes_vertex:Oh,color_fragment:Bh,color_pars_fragment:zh,color_pars_vertex:Gh,color_vertex:Vh,common:kh,cube_uv_reflection_fragment:Hh,defaultnormal_vertex:Wh,displacementmap_pars_vertex:Xh,displacementmap_vertex:jh,emissivemap_fragment:qh,emissivemap_pars_fragment:Yh,colorspace_fragment:$h,colorspace_pars_fragment:Zh,envmap_fragment:Kh,envmap_common_pars_fragment:Jh,envmap_pars_fragment:Qh,envmap_pars_vertex:ed,envmap_physical_pars_fragment:dd,envmap_vertex:td,fog_vertex:nd,fog_pars_vertex:id,fog_fragment:rd,fog_pars_fragment:sd,gradientmap_pars_fragment:ad,lightmap_pars_fragment:od,lights_lambert_fragment:ld,lights_lambert_pars_fragment:cd,lights_pars_begin:hd,lights_toon_fragment:ud,lights_toon_pars_fragment:fd,lights_phong_fragment:pd,lights_phong_pars_fragment:md,lights_physical_fragment:gd,lights_physical_pars_fragment:_d,lights_fragment_begin:xd,lights_fragment_maps:vd,lights_fragment_end:Md,logdepthbuf_fragment:Sd,logdepthbuf_pars_fragment:Ed,logdepthbuf_pars_vertex:yd,logdepthbuf_vertex:bd,map_fragment:Td,map_pars_fragment:Ad,map_particle_fragment:wd,map_particle_pars_fragment:Rd,metalnessmap_fragment:Cd,metalnessmap_pars_fragment:Pd,morphinstance_vertex:Dd,morphcolor_vertex:Ld,morphnormal_vertex:Id,morphtarget_pars_vertex:Nd,morphtarget_vertex:Fd,normal_fragment_begin:Ud,normal_fragment_maps:Od,normal_pars_fragment:Bd,normal_pars_vertex:zd,normal_vertex:Gd,normalmap_pars_fragment:Vd,clearcoat_normal_fragment_begin:kd,clearcoat_normal_fragment_maps:Hd,clearcoat_pars_fragment:Wd,iridescence_pars_fragment:Xd,opaque_fragment:jd,packing:qd,premultiplied_alpha_fragment:Yd,project_vertex:$d,dithering_fragment:Zd,dithering_pars_fragment:Kd,roughnessmap_fragment:Jd,roughnessmap_pars_fragment:Qd,shadowmap_pars_fragment:eu,shadowmap_pars_vertex:tu,shadowmap_vertex:nu,shadowmask_pars_fragment:iu,skinbase_vertex:ru,skinning_pars_vertex:su,skinning_vertex:au,skinnormal_vertex:ou,specularmap_fragment:lu,specularmap_pars_fragment:cu,tonemapping_fragment:hu,tonemapping_pars_fragment:du,transmission_fragment:uu,transmission_pars_fragment:fu,uv_pars_fragment:pu,uv_pars_vertex:mu,uv_vertex:gu,worldpos_vertex:_u,background_vert:xu,background_frag:vu,backgroundCube_vert:Mu,backgroundCube_frag:Su,cube_vert:Eu,cube_frag:yu,depth_vert:bu,depth_frag:Tu,distance_vert:Au,distance_frag:wu,equirect_vert:Ru,equirect_frag:Cu,linedashed_vert:Pu,linedashed_frag:Du,meshbasic_vert:Lu,meshbasic_frag:Iu,meshlambert_vert:Nu,meshlambert_frag:Fu,meshmatcap_vert:Uu,meshmatcap_frag:Ou,meshnormal_vert:Bu,meshnormal_frag:zu,meshphong_vert:Gu,meshphong_frag:Vu,meshphysical_vert:ku,meshphysical_frag:Hu,meshtoon_vert:Wu,meshtoon_frag:Xu,points_vert:ju,points_frag:qu,shadow_vert:Yu,shadow_frag:$u,sprite_vert:Zu,sprite_frag:Ku},he={common:{diffuse:{value:new nt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Be}},envmap:{envMap:{value:null},envMapRotation:{value:new Be},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 Be}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Be}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Be},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Be},normalScale:{value:new Ke(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Be},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Be}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Be}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Be}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new nt(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 nt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0},uvTransform:{value:new Be}},sprite:{diffuse:{value:new nt(16777215)},opacity:{value:1},center:{value:new Ke(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Be},alphaMap:{value:null},alphaMapTransform:{value:new Be},alphaTest:{value:0}}},jt={basic:{uniforms:yt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.fog]),vertexShader:ze.meshbasic_vert,fragmentShader:ze.meshbasic_frag},lambert:{uniforms:yt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new nt(0)},envMapIntensity:{value:1}}]),vertexShader:ze.meshlambert_vert,fragmentShader:ze.meshlambert_frag},phong:{uniforms:yt([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new nt(0)},specular:{value:new nt(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:ze.meshphong_vert,fragmentShader:ze.meshphong_frag},standard:{uniforms:yt([he.common,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.roughnessmap,he.metalnessmap,he.fog,he.lights,{emissive:{value:new nt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag},toon:{uniforms:yt([he.common,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.gradientmap,he.fog,he.lights,{emissive:{value:new nt(0)}}]),vertexShader:ze.meshtoon_vert,fragmentShader:ze.meshtoon_frag},matcap:{uniforms:yt([he.common,he.bumpmap,he.normalmap,he.displacementmap,he.fog,{matcap:{value:null}}]),vertexShader:ze.meshmatcap_vert,fragmentShader:ze.meshmatcap_frag},points:{uniforms:yt([he.points,he.fog]),vertexShader:ze.points_vert,fragmentShader:ze.points_frag},dashed:{uniforms:yt([he.common,he.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ze.linedashed_vert,fragmentShader:ze.linedashed_frag},depth:{uniforms:yt([he.common,he.displacementmap]),vertexShader:ze.depth_vert,fragmentShader:ze.depth_frag},normal:{uniforms:yt([he.common,he.bumpmap,he.normalmap,he.displacementmap,{opacity:{value:1}}]),vertexShader:ze.meshnormal_vert,fragmentShader:ze.meshnormal_frag},sprite:{uniforms:yt([he.sprite,he.fog]),vertexShader:ze.sprite_vert,fragmentShader:ze.sprite_frag},background:{uniforms:{uvTransform:{value:new Be},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ze.background_vert,fragmentShader:ze.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Be}},vertexShader:ze.backgroundCube_vert,fragmentShader:ze.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ze.cube_vert,fragmentShader:ze.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ze.equirect_vert,fragmentShader:ze.equirect_frag},distance:{uniforms:yt([he.common,he.displacementmap,{referencePosition:{value:new W},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ze.distance_vert,fragmentShader:ze.distance_frag},shadow:{uniforms:yt([he.lights,he.fog,{color:{value:new nt(0)},opacity:{value:1}}]),vertexShader:ze.shadow_vert,fragmentShader:ze.shadow_frag}};jt.physical={uniforms:yt([jt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Be},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Be},clearcoatNormalScale:{value:new Ke(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Be},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Be},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Be},sheen:{value:0},sheenColor:{value:new nt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Be},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Be},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Be},transmissionSamplerSize:{value:new Ke},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Be},attenuationDistance:{value:0},attenuationColor:{value:new nt(0)},specularColor:{value:new nt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Be},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Be},anisotropyVector:{value:new Ke},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Be}}]),vertexShader:ze.meshphysical_vert,fragmentShader:ze.meshphysical_frag};const rr={r:0,b:0,g:0},In=new Hn,Ju=new ut;function Qu(n,e,t,i,r,s){const a=new nt(0);let o=r===!0?0:1,l,c,d=null,p=0,h=null;function f(S){let b=S.isScene===!0?S.background:null;if(b&&b.isTexture){const E=S.backgroundBlurriness>0;b=e.get(b,E)}return b}function g(S){let b=!1;const E=f(S);E===null?m(a,o):E&&E.isColor&&(m(E,1),b=!0);const R=n.xr.getEnvironmentBlendMode();R==="additive"?t.buffers.color.setClear(0,0,0,1,s):R==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(n.autoClear||b)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function v(S,b){const E=f(b);E&&(E.isCubeTexture||E.mapping===xr)?(c===void 0&&(c=new Jt(new Ni(1,1,1),new Qt({name:"BackgroundCubeMaterial",uniforms:ui(jt.backgroundCube.uniforms),vertexShader:jt.backgroundCube.vertexShader,fragmentShader:jt.backgroundCube.fragmentShader,side:At,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(R,A,C){this.matrixWorld.copyPosition(C.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),In.copy(b.backgroundRotation),In.x*=-1,In.y*=-1,In.z*=-1,E.isCubeTexture&&E.isRenderTargetTexture===!1&&(In.y*=-1,In.z*=-1),c.material.uniforms.envMap.value=E,c.material.uniforms.flipEnvMap.value=E.isCubeTexture&&E.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=b.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Ju.makeRotationFromEuler(In)),c.material.toneMapped=Xe.getTransfer(E.colorSpace)!==Qe,(d!==E||p!==E.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,d=E,p=E.version,h=n.toneMapping),c.layers.enableAll(),S.unshift(c,c.geometry,c.material,0,0,null)):E&&E.isTexture&&(l===void 0&&(l=new Jt(new Mr(2,2),new Qt({name:"BackgroundMaterial",uniforms:ui(jt.background.uniforms),vertexShader:jt.background.vertexShader,fragmentShader:jt.background.fragmentShader,side:An,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=E,l.material.uniforms.backgroundIntensity.value=b.backgroundIntensity,l.material.toneMapped=Xe.getTransfer(E.colorSpace)!==Qe,E.matrixAutoUpdate===!0&&E.updateMatrix(),l.material.uniforms.uvTransform.value.copy(E.matrix),(d!==E||p!==E.version||h!==n.toneMapping)&&(l.material.needsUpdate=!0,d=E,p=E.version,h=n.toneMapping),l.layers.enableAll(),S.unshift(l,l.geometry,l.material,0,0,null))}function m(S,b){S.getRGB(rr,Sl(n)),t.buffers.color.setClear(rr.r,rr.g,rr.b,b,s)}function u(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(S,b=1){a.set(S),o=b,m(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(S){o=S,m(a,o)},render:g,addToRenderList:v,dispose:u}}function ef(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=h(null);let s=r,a=!1;function o(w,F,B,I,G){let V=!1;const U=p(w,I,B,F);s!==U&&(s=U,c(s.object)),V=f(w,I,B,G),V&&g(w,I,B,G),G!==null&&e.update(G,n.ELEMENT_ARRAY_BUFFER),(V||a)&&(a=!1,E(w,F,B,I),G!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(G).buffer))}function l(){return n.createVertexArray()}function c(w){return n.bindVertexArray(w)}function d(w){return n.deleteVertexArray(w)}function p(w,F,B,I){const G=I.wireframe===!0;let V=i[F.id];V===void 0&&(V={},i[F.id]=V);const U=w.isInstancedMesh===!0?w.id:0;let K=V[U];K===void 0&&(K={},V[U]=K);let Y=K[B.id];Y===void 0&&(Y={},K[B.id]=Y);let se=Y[G];return se===void 0&&(se=h(l()),Y[G]=se),se}function h(w){const F=[],B=[],I=[];for(let G=0;G<t;G++)F[G]=0,B[G]=0,I[G]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:F,enabledAttributes:B,attributeDivisors:I,object:w,attributes:{},index:null}}function f(w,F,B,I){const G=s.attributes,V=F.attributes;let U=0;const K=B.getAttributes();for(const Y in K)if(K[Y].location>=0){const ce=G[Y];let le=V[Y];if(le===void 0&&(Y==="instanceMatrix"&&w.instanceMatrix&&(le=w.instanceMatrix),Y==="instanceColor"&&w.instanceColor&&(le=w.instanceColor)),ce===void 0||ce.attribute!==le||le&&ce.data!==le.data)return!0;U++}return s.attributesNum!==U||s.index!==I}function g(w,F,B,I){const G={},V=F.attributes;let U=0;const K=B.getAttributes();for(const Y in K)if(K[Y].location>=0){let ce=V[Y];ce===void 0&&(Y==="instanceMatrix"&&w.instanceMatrix&&(ce=w.instanceMatrix),Y==="instanceColor"&&w.instanceColor&&(ce=w.instanceColor));const le={};le.attribute=ce,ce&&ce.data&&(le.data=ce.data),G[Y]=le,U++}s.attributes=G,s.attributesNum=U,s.index=I}function v(){const w=s.newAttributes;for(let F=0,B=w.length;F<B;F++)w[F]=0}function m(w){u(w,0)}function u(w,F){const B=s.newAttributes,I=s.enabledAttributes,G=s.attributeDivisors;B[w]=1,I[w]===0&&(n.enableVertexAttribArray(w),I[w]=1),G[w]!==F&&(n.vertexAttribDivisor(w,F),G[w]=F)}function S(){const w=s.newAttributes,F=s.enabledAttributes;for(let B=0,I=F.length;B<I;B++)F[B]!==w[B]&&(n.disableVertexAttribArray(B),F[B]=0)}function b(w,F,B,I,G,V,U){U===!0?n.vertexAttribIPointer(w,F,B,G,V):n.vertexAttribPointer(w,F,B,I,G,V)}function E(w,F,B,I){v();const G=I.attributes,V=B.getAttributes(),U=F.defaultAttributeValues;for(const K in V){const Y=V[K];if(Y.location>=0){let se=G[K];if(se===void 0&&(K==="instanceMatrix"&&w.instanceMatrix&&(se=w.instanceMatrix),K==="instanceColor"&&w.instanceColor&&(se=w.instanceColor)),se!==void 0){const ce=se.normalized,le=se.itemSize,we=e.get(se);if(we===void 0)continue;const Ye=we.buffer,He=we.type,Z=we.bytesPerElement,te=He===n.INT||He===n.UNSIGNED_INT||se.gpuType===ra;if(se.isInterleavedBufferAttribute){const re=se.data,Le=re.stride,Ae=se.offset;if(re.isInstancedInterleavedBuffer){for(let Re=0;Re<Y.locationSize;Re++)u(Y.location+Re,re.meshPerAttribute);w.isInstancedMesh!==!0&&I._maxInstanceCount===void 0&&(I._maxInstanceCount=re.meshPerAttribute*re.count)}else for(let Re=0;Re<Y.locationSize;Re++)m(Y.location+Re);n.bindBuffer(n.ARRAY_BUFFER,Ye);for(let Re=0;Re<Y.locationSize;Re++)b(Y.location+Re,le/Y.locationSize,He,ce,Le*Z,(Ae+le/Y.locationSize*Re)*Z,te)}else{if(se.isInstancedBufferAttribute){for(let re=0;re<Y.locationSize;re++)u(Y.location+re,se.meshPerAttribute);w.isInstancedMesh!==!0&&I._maxInstanceCount===void 0&&(I._maxInstanceCount=se.meshPerAttribute*se.count)}else for(let re=0;re<Y.locationSize;re++)m(Y.location+re);n.bindBuffer(n.ARRAY_BUFFER,Ye);for(let re=0;re<Y.locationSize;re++)b(Y.location+re,le/Y.locationSize,He,ce,le*Z,le/Y.locationSize*re*Z,te)}}else if(U!==void 0){const ce=U[K];if(ce!==void 0)switch(ce.length){case 2:n.vertexAttrib2fv(Y.location,ce);break;case 3:n.vertexAttrib3fv(Y.location,ce);break;case 4:n.vertexAttrib4fv(Y.location,ce);break;default:n.vertexAttrib1fv(Y.location,ce)}}}}S()}function R(){y();for(const w in i){const F=i[w];for(const B in F){const I=F[B];for(const G in I){const V=I[G];for(const U in V)d(V[U].object),delete V[U];delete I[G]}}delete i[w]}}function A(w){if(i[w.id]===void 0)return;const F=i[w.id];for(const B in F){const I=F[B];for(const G in I){const V=I[G];for(const U in V)d(V[U].object),delete V[U];delete I[G]}}delete i[w.id]}function C(w){for(const F in i){const B=i[F];for(const I in B){const G=B[I];if(G[w.id]===void 0)continue;const V=G[w.id];for(const U in V)d(V[U].object),delete V[U];delete G[w.id]}}}function x(w){for(const F in i){const B=i[F],I=w.isInstancedMesh===!0?w.id:0,G=B[I];if(G!==void 0){for(const V in G){const U=G[V];for(const K in U)d(U[K].object),delete U[K];delete G[V]}delete B[I],Object.keys(B).length===0&&delete i[F]}}}function y(){z(),a=!0,s!==r&&(s=r,c(s.object))}function z(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:o,reset:y,resetDefaultState:z,dispose:R,releaseStatesOfGeometry:A,releaseStatesOfObject:x,releaseStatesOfProgram:C,initAttributes:v,enableAttribute:m,disableUnusedAttributes:S}}function tf(n,e,t){let i;function r(c){i=c}function s(c,d){n.drawArrays(i,c,d),t.update(d,i,1)}function a(c,d,p){p!==0&&(n.drawArraysInstanced(i,c,d,p),t.update(d,i,p))}function o(c,d,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,c,0,d,0,p);let f=0;for(let g=0;g<p;g++)f+=d[g];t.update(f,i,1)}function l(c,d,p,h){if(p===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let g=0;g<c.length;g++)a(c[g],d[g],h[g]);else{f.multiDrawArraysInstancedWEBGL(i,c,0,d,0,h,0,p);let g=0;for(let v=0;v<p;v++)g+=d[v]*h[v];t.update(g,i,1)}}this.setMode=r,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function nf(n,e,t,i){let r;function s(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const C=e.get("EXT_texture_filter_anisotropic");r=n.getParameter(C.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function a(C){return!(C!==zt&&i.convert(C)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(C){const x=C===pn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(C!==It&&i.convert(C)!==n.getParameter(n.IMPLEMENTATION_COLOR_READ_TYPE)&&C!==qt&&!x)}function l(C){if(C==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";C="mediump"}return C==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const d=l(c);d!==c&&(Ie("WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const p=t.logarithmicDepthBuffer===!0,h=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),f=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),g=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),v=n.getParameter(n.MAX_TEXTURE_SIZE),m=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),u=n.getParameter(n.MAX_VERTEX_ATTRIBS),S=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),b=n.getParameter(n.MAX_VARYING_VECTORS),E=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),R=n.getParameter(n.MAX_SAMPLES),A=n.getParameter(n.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:p,reversedDepthBuffer:h,maxTextures:f,maxVertexTextures:g,maxTextureSize:v,maxCubemapSize:m,maxAttributes:u,maxVertexUniforms:S,maxVaryings:b,maxFragmentUniforms:E,maxSamples:R,samples:A}}function rf(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new Fn,o=new Be,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(p,h){const f=p.length!==0||h||i!==0||r;return r=h,i=p.length,f},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(p,h){t=d(p,h,0)},this.setState=function(p,h,f){const g=p.clippingPlanes,v=p.clipIntersection,m=p.clipShadows,u=n.get(p);if(!r||g===null||g.length===0||s&&!m)s?d(null):c();else{const S=s?0:i,b=S*4;let E=u.clippingState||null;l.value=E,E=d(g,h,b,f);for(let R=0;R!==b;++R)E[R]=t[R];u.clippingState=E,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=S}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function d(p,h,f,g){const v=p!==null?p.length:0;let m=null;if(v!==0){if(m=l.value,g!==!0||m===null){const u=f+v*4,S=h.matrixWorldInverse;o.getNormalMatrix(S),(m===null||m.length<u)&&(m=new Float32Array(u));for(let b=0,E=f;b!==v;++b,E+=4)a.copy(p[b]).applyMatrix4(S,o),a.normal.toArray(m,E),m[E+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,m}}const Tn=4,eo=[.125,.215,.35,.446,.526,.582],On=20,sf=256,yi=new pa,to=new nt;let Jr=null,Qr=0,es=0,ts=!1;const af=new W;class no{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,i=.1,r=100,s={}){const{size:a=256,position:o=af}=s;Jr=this._renderer.getRenderTarget(),Qr=this._renderer.getActiveCubeFace(),es=this._renderer.getActiveMipmapLevel(),ts=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=so(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ro(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Jr,Qr,es),this._renderer.xr.enabled=ts,e.scissorTest=!1,ai(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Vn||e.mapping===hi?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Jr=this._renderer.getRenderTarget(),Qr=this._renderer.getActiveCubeFace(),es=this._renderer.getActiveMipmapLevel(),ts=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:Et,minFilter:Et,generateMipmaps:!1,type:pn,format:zt,colorSpace:kn,depthBuffer:!1},r=io(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=io(e,t,i);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=of(s)),this._blurMaterial=cf(s,e,t),this._ggxMaterial=lf(s,e,t)}return r}_compileMaterial(e){const t=new Jt(new en,e);this._renderer.compile(t,yi)}_sceneToCubeUV(e,t,i,r,s){const l=new Bt(90,1,t,i),c=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],p=this._renderer,h=p.autoClear,f=p.toneMapping;p.getClearColor(to),p.toneMapping=$t,p.autoClear=!1,p.state.buffers.depth.getReversed()&&(p.setRenderTarget(r),p.clearDepth(),p.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Jt(new Ni,new _l({name:"PMREM.Background",side:At,depthWrite:!1,depthTest:!1})));const v=this._backgroundBox,m=v.material;let u=!1;const S=e.background;S?S.isColor&&(m.color.copy(S),e.background=null,u=!0):(m.color.copy(to),u=!0);for(let b=0;b<6;b++){const E=b%3;E===0?(l.up.set(0,c[b],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+d[b],s.y,s.z)):E===1?(l.up.set(0,0,c[b]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+d[b],s.z)):(l.up.set(0,c[b],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+d[b]));const R=this._cubeSize;ai(r,E*R,b>2?R:0,R,R),p.setRenderTarget(r),u&&p.render(v,l),p.render(e,l)}p.toneMapping=f,p.autoClear=h,e.background=S}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Vn||e.mapping===hi;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=so()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ro());const s=r?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;ai(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,yi)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodMeshes.length;for(let s=1;s<r;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=i}_applyGGXFilter(e,t,i){const r=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[i];o.material=a;const l=a.uniforms,c=i/(this._lodMeshes.length-1),d=t/(this._lodMeshes.length-1),p=Math.sqrt(c*c-d*d),h=0+c*1.25,f=p*h,{_lodMax:g}=this,v=this._sizeLods[i],m=3*v*(i>g-Tn?i-g+Tn:0),u=4*(this._cubeSize-v);l.envMap.value=e.texture,l.roughness.value=f,l.mipInt.value=g-t,ai(s,m,u,3*v,2*v),r.setRenderTarget(s),r.render(o,yi),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=g-i,ai(e,m,u,3*v,2*v),r.setRenderTarget(e),r.render(o,yi)}_blur(e,t,i,r,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,r,"latitudinal",s),this._halfBlur(a,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&qe("blur direction must be either latitudinal or longitudinal!");const d=3,p=this._lodMeshes[r];p.material=c;const h=c.uniforms,f=this._sizeLods[i]-1,g=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*On-1),v=s/g,m=isFinite(s)?1+Math.floor(d*v):On;m>On&&Ie(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${On}`);const u=[];let S=0;for(let C=0;C<On;++C){const x=C/v,y=Math.exp(-x*x/2);u.push(y),C===0?S+=y:C<m&&(S+=2*y)}for(let C=0;C<u.length;C++)u[C]=u[C]/S;h.envMap.value=e.texture,h.samples.value=m,h.weights.value=u,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:b}=this;h.dTheta.value=g,h.mipInt.value=b-i;const E=this._sizeLods[r],R=3*E*(r>b-Tn?r-b+Tn:0),A=4*(this._cubeSize-E);ai(t,R,A,3*E,2*E),l.setRenderTarget(t),l.render(p,yi)}}function of(n){const e=[],t=[],i=[];let r=n;const s=n-Tn+1+eo.length;for(let a=0;a<s;a++){const o=Math.pow(2,r);e.push(o);let l=1/o;a>n-Tn?l=eo[a-n+Tn-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),d=-c,p=1+c,h=[d,d,p,d,p,p,d,d,p,p,d,p],f=6,g=6,v=3,m=2,u=1,S=new Float32Array(v*g*f),b=new Float32Array(m*g*f),E=new Float32Array(u*g*f);for(let A=0;A<f;A++){const C=A%3*2/3-1,x=A>2?0:-1,y=[C,x,0,C+2/3,x,0,C+2/3,x+1,0,C,x,0,C+2/3,x+1,0,C,x+1,0];S.set(y,v*g*A),b.set(h,m*g*A);const z=[A,A,A,A,A,A];E.set(z,u*g*A)}const R=new en;R.setAttribute("position",new Vt(S,v)),R.setAttribute("uv",new Vt(b,m)),R.setAttribute("faceIndex",new Vt(E,u)),i.push(new Jt(R,null)),r>Tn&&r--}return{lodMeshes:i,sizeLods:e,sigmas:t}}function io(n,e,t){const i=new Zt(n,e,t);return i.texture.mapping=xr,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function ai(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function lf(n,e,t){return new Qt({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:sf,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Sr(),fragmentShader:`
3613
3613
 
3614
3614
  precision highp float;
3615
3615
  precision highp int;
@@ -3713,7 +3713,7 @@ void main() {
3713
3713
 
3714
3714
  gl_FragColor = vec4(prefilteredColor, 1.0);
3715
3715
  }
3716
- `,blending:un,depthTest:!1,depthWrite:!1})}function rf(n,e,t){const i=new Float32Array(On),r=new W(0,1,0);return new Qt({name:"SphericalGaussianBlur",defines:{n:On,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Sr(),fragmentShader:`
3716
+ `,blending:dn,depthTest:!1,depthWrite:!1})}function cf(n,e,t){const i=new Float32Array(On),r=new W(0,1,0);return new Qt({name:"SphericalGaussianBlur",defines:{n:On,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Sr(),fragmentShader:`
3717
3717
 
3718
3718
  precision mediump float;
3719
3719
  precision mediump int;
@@ -3773,7 +3773,7 @@ void main() {
3773
3773
  }
3774
3774
 
3775
3775
  }
3776
- `,blending:un,depthTest:!1,depthWrite:!1})}function io(){return new Qt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Sr(),fragmentShader:`
3776
+ `,blending:dn,depthTest:!1,depthWrite:!1})}function ro(){return new Qt({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Sr(),fragmentShader:`
3777
3777
 
3778
3778
  precision mediump float;
3779
3779
  precision mediump int;
@@ -3792,7 +3792,7 @@ void main() {
3792
3792
  gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3793
3793
 
3794
3794
  }
3795
- `,blending:un,depthTest:!1,depthWrite:!1})}function ro(){return new Qt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Sr(),fragmentShader:`
3795
+ `,blending:dn,depthTest:!1,depthWrite:!1})}function so(){return new Qt({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Sr(),fragmentShader:`
3796
3796
 
3797
3797
  precision mediump float;
3798
3798
  precision mediump int;
@@ -3808,7 +3808,7 @@ void main() {
3808
3808
  gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3809
3809
 
3810
3810
  }
3811
- `,blending:un,depthTest:!1,depthWrite:!1})}function Sr(){return`
3811
+ `,blending:dn,depthTest:!1,depthWrite:!1})}function Sr(){return`
3812
3812
 
3813
3813
  precision mediump float;
3814
3814
  precision mediump int;
@@ -3863,7 +3863,7 @@ void main() {
3863
3863
  gl_Position = vec4( position, 1.0 );
3864
3864
 
3865
3865
  }
3866
- `}class Ml extends Zt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new pl(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
3866
+ `}class Tl extends Zt{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new vl(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
3867
3867
 
3868
3868
  varying vec3 vWorldDirection;
3869
3869
 
@@ -3898,7 +3898,7 @@ void main() {
3898
3898
  gl_FragColor = texture2D( tEquirect, sampleUV );
3899
3899
 
3900
3900
  }
3901
- `},r=new Ni(5,5,5),s=new Qt({name:"CubemapFromEquirect",uniforms:di(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:At,blending:un});s.uniforms.tEquirect.value=t;const a=new Jt(r,s),o=t.minFilter;return t.minFilter===Bn&&(t.minFilter=Et),new ch(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,i=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}}function sf(n){let e=new WeakMap,t=new WeakMap,i=null;function r(h,f=!1){return h==null?null:f?a(h):s(h)}function s(h){if(h&&h.isTexture){const f=h.mapping;if(f===Tr||f===Ar)if(e.has(h)){const g=e.get(h).texture;return o(g,h.mapping)}else{const g=h.image;if(g&&g.height>0){const v=new Ml(g.height);return v.fromEquirectangularTexture(n,h),e.set(h,v),h.addEventListener("dispose",c),o(v.texture,h.mapping)}else return null}}return h}function a(h){if(h&&h.isTexture){const f=h.mapping,g=f===Tr||f===Ar,v=f===Vn||f===hi;if(g||v){let m=t.get(h);const d=m!==void 0?m.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==d)return i===null&&(i=new to(n)),m=g?i.fromEquirectangular(h,m):i.fromCubemap(h,m),m.texture.pmremVersion=h.pmremVersion,t.set(h,m),m.texture;if(m!==void 0)return m.texture;{const S=h.image;return g&&S&&S.height>0||v&&S&&l(S)?(i===null&&(i=new to(n)),m=g?i.fromEquirectangular(h):i.fromCubemap(h),m.texture.pmremVersion=h.pmremVersion,t.set(h,m),h.addEventListener("dispose",u),m.texture):null}}}return h}function o(h,f){return f===Tr?h.mapping=Vn:f===Ar&&(h.mapping=hi),h}function l(h){let f=0;const g=6;for(let v=0;v<g;v++)h[v]!==void 0&&f++;return f===g}function c(h){const f=h.target;f.removeEventListener("dispose",c);const g=e.get(f);g!==void 0&&(e.delete(f),g.dispose())}function u(h){const f=h.target;f.removeEventListener("dispose",u);const g=t.get(f);g!==void 0&&(t.delete(f),g.dispose())}function p(){e=new WeakMap,t=new WeakMap,i!==null&&(i.dispose(),i=null)}return{get:r,dispose:p}}function af(n){const e={};function t(i){if(e[i]!==void 0)return e[i];const r=n.getExtension(i);return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const r=t(i);return r===null&&gr("WebGLRenderer: "+i+" extension not supported."),r}}}function of(n,e,t,i){const r={},s=new WeakMap;function a(p){const h=p.target;h.index!==null&&e.remove(h.index);for(const g in h.attributes)e.remove(h.attributes[g]);h.removeEventListener("dispose",a),delete r[h.id];const f=s.get(h);f&&(e.remove(f),s.delete(h)),i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function o(p,h){return r[h.id]===!0||(h.addEventListener("dispose",a),r[h.id]=!0,t.memory.geometries++),h}function l(p){const h=p.attributes;for(const f in h)e.update(h[f],n.ARRAY_BUFFER)}function c(p){const h=[],f=p.index,g=p.attributes.position;let v=0;if(g===void 0)return;if(f!==null){const S=f.array;v=f.version;for(let b=0,E=S.length;b<E;b+=3){const R=S[b+0],A=S[b+1],C=S[b+2];h.push(R,A,A,C,C,R)}}else{const S=g.array;v=g.version;for(let b=0,E=S.length/3-1;b<E;b+=3){const R=b+0,A=b+1,C=b+2;h.push(R,A,A,C,C,R)}}const m=new(g.count>=65535?ul:hl)(h,1);m.version=v;const d=s.get(p);d&&e.remove(d),s.set(p,m)}function u(p){const h=s.get(p);if(h){const f=p.index;f!==null&&h.version<f.version&&c(p)}else c(p);return s.get(p)}return{get:o,update:l,getWireframeAttribute:u}}function lf(n,e,t){let i;function r(h){i=h}let s,a;function o(h){s=h.type,a=h.bytesPerElement}function l(h,f){n.drawElements(i,f,s,h*a),t.update(f,i,1)}function c(h,f,g){g!==0&&(n.drawElementsInstanced(i,f,s,h*a,g),t.update(f,i,g))}function u(h,f,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,f,0,s,h,0,g);let m=0;for(let d=0;d<g;d++)m+=f[d];t.update(m,i,1)}function p(h,f,g,v){if(g===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let d=0;d<h.length;d++)c(h[d]/a,f[d],v[d]);else{m.multiDrawElementsInstancedWEBGL(i,f,0,s,h,0,v,0,g);let d=0;for(let S=0;S<g;S++)d+=f[S]*v[S];t.update(d,i,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=p}function cf(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,a,o){switch(t.calls++,a){case n.TRIANGLES:t.triangles+=o*(s/3);break;case n.LINES:t.lines+=o*(s/2);break;case n.LINE_STRIP:t.lines+=o*(s-1);break;case n.LINE_LOOP:t.lines+=o*s;break;case n.POINTS:t.points+=o*s;break;default:je("WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function hf(n,e,t){const i=new WeakMap,r=new ct;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,p=u!==void 0?u.length:0;let h=i.get(o);if(h===void 0||h.count!==p){let y=function(){C.dispose(),i.delete(o),o.removeEventListener("dispose",y)};h!==void 0&&h.texture.dispose();const f=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,v=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],d=o.morphAttributes.normal||[],S=o.morphAttributes.color||[];let b=0;f===!0&&(b=1),g===!0&&(b=2),v===!0&&(b=3);let E=o.attributes.position.count*b,R=1;E>e.maxTextureSize&&(R=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const A=new Float32Array(E*R*4*p),C=new al(A,E,R,p);C.type=jt,C.needsUpdate=!0;const x=b*4;for(let z=0;z<p;z++){const w=m[z],F=d[z],B=S[z],I=E*R*4*z;for(let G=0;G<w.count;G++){const V=G*x;f===!0&&(r.fromBufferAttribute(w,G),A[I+V+0]=r.x,A[I+V+1]=r.y,A[I+V+2]=r.z,A[I+V+3]=0),g===!0&&(r.fromBufferAttribute(F,G),A[I+V+4]=r.x,A[I+V+5]=r.y,A[I+V+6]=r.z,A[I+V+7]=0),v===!0&&(r.fromBufferAttribute(B,G),A[I+V+8]=r.x,A[I+V+9]=r.y,A[I+V+10]=r.z,A[I+V+11]=B.itemSize===4?r.w:1)}}h={count:p,texture:C,size:new Ke(E,R)},i.set(o,h),o.addEventListener("dispose",y)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",a.morphTexture,t);else{let f=0;for(let v=0;v<c.length;v++)f+=c[v];const g=o.morphTargetsRelative?1:1-f;l.getUniforms().setValue(n,"morphTargetBaseInfluence",g),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",h.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",h.size)}return{update:s}}function uf(n,e,t,i,r){let s=new WeakMap;function a(c){const u=r.render.frame,p=c.geometry,h=e.get(c,p);if(s.get(h)!==u&&(e.update(h),s.set(h,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(t.update(c.instanceMatrix,n.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,n.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){const f=c.skeleton;s.get(f)!==u&&(f.update(),s.set(f,u))}return h}function o(){s=new WeakMap}function l(c){const u=c.target;u.removeEventListener("dispose",l),i.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:a,dispose:o}}const df={[Wo]:"LINEAR_TONE_MAPPING",[Xo]:"REINHARD_TONE_MAPPING",[qo]:"CINEON_TONE_MAPPING",[jo]:"ACES_FILMIC_TONE_MAPPING",[$o]:"AGX_TONE_MAPPING",[Zo]:"NEUTRAL_TONE_MAPPING",[Yo]:"CUSTOM_TONE_MAPPING"};function ff(n,e,t,i,r){const s=new Zt(e,t,{type:n,depthBuffer:i,stencilBuffer:r}),a=new Zt(e,t,{type:pn,depthBuffer:!1,stencilBuffer:!1}),o=new en;o.setAttribute("position",new fn([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new fn([0,2,0,0,2,0],2));const l=new _l({uniforms:{tDiffuse:{value:null}},vertexShader:`
3901
+ `},r=new Ni(5,5,5),s=new Qt({name:"CubemapFromEquirect",uniforms:ui(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:At,blending:dn});s.uniforms.tEquirect.value=t;const a=new Jt(r,s),o=t.minFilter;return t.minFilter===Bn&&(t.minFilter=Et),new ph(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,i=!0,r=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}}function hf(n){let e=new WeakMap,t=new WeakMap,i=null;function r(h,f=!1){return h==null?null:f?a(h):s(h)}function s(h){if(h&&h.isTexture){const f=h.mapping;if(f===Tr||f===Ar)if(e.has(h)){const g=e.get(h).texture;return o(g,h.mapping)}else{const g=h.image;if(g&&g.height>0){const v=new Tl(g.height);return v.fromEquirectangularTexture(n,h),e.set(h,v),h.addEventListener("dispose",c),o(v.texture,h.mapping)}else return null}}return h}function a(h){if(h&&h.isTexture){const f=h.mapping,g=f===Tr||f===Ar,v=f===Vn||f===hi;if(g||v){let m=t.get(h);const u=m!==void 0?m.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==u)return i===null&&(i=new no(n)),m=g?i.fromEquirectangular(h,m):i.fromCubemap(h,m),m.texture.pmremVersion=h.pmremVersion,t.set(h,m),m.texture;if(m!==void 0)return m.texture;{const S=h.image;return g&&S&&S.height>0||v&&S&&l(S)?(i===null&&(i=new no(n)),m=g?i.fromEquirectangular(h):i.fromCubemap(h),m.texture.pmremVersion=h.pmremVersion,t.set(h,m),h.addEventListener("dispose",d),m.texture):null}}}return h}function o(h,f){return f===Tr?h.mapping=Vn:f===Ar&&(h.mapping=hi),h}function l(h){let f=0;const g=6;for(let v=0;v<g;v++)h[v]!==void 0&&f++;return f===g}function c(h){const f=h.target;f.removeEventListener("dispose",c);const g=e.get(f);g!==void 0&&(e.delete(f),g.dispose())}function d(h){const f=h.target;f.removeEventListener("dispose",d);const g=t.get(f);g!==void 0&&(t.delete(f),g.dispose())}function p(){e=new WeakMap,t=new WeakMap,i!==null&&(i.dispose(),i=null)}return{get:r,dispose:p}}function df(n){const e={};function t(i){if(e[i]!==void 0)return e[i];const r=n.getExtension(i);return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const r=t(i);return r===null&&gr("WebGLRenderer: "+i+" extension not supported."),r}}}function uf(n,e,t,i){const r={},s=new WeakMap;function a(p){const h=p.target;h.index!==null&&e.remove(h.index);for(const g in h.attributes)e.remove(h.attributes[g]);h.removeEventListener("dispose",a),delete r[h.id];const f=s.get(h);f&&(e.remove(f),s.delete(h)),i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function o(p,h){return r[h.id]===!0||(h.addEventListener("dispose",a),r[h.id]=!0,t.memory.geometries++),h}function l(p){const h=p.attributes;for(const f in h)e.update(h[f],n.ARRAY_BUFFER)}function c(p){const h=[],f=p.index,g=p.attributes.position;let v=0;if(g===void 0)return;if(f!==null){const S=f.array;v=f.version;for(let b=0,E=S.length;b<E;b+=3){const R=S[b+0],A=S[b+1],C=S[b+2];h.push(R,A,A,C,C,R)}}else{const S=g.array;v=g.version;for(let b=0,E=S.length/3-1;b<E;b+=3){const R=b+0,A=b+1,C=b+2;h.push(R,A,A,C,C,R)}}const m=new(g.count>=65535?gl:ml)(h,1);m.version=v;const u=s.get(p);u&&e.remove(u),s.set(p,m)}function d(p){const h=s.get(p);if(h){const f=p.index;f!==null&&h.version<f.version&&c(p)}else c(p);return s.get(p)}return{get:o,update:l,getWireframeAttribute:d}}function ff(n,e,t){let i;function r(h){i=h}let s,a;function o(h){s=h.type,a=h.bytesPerElement}function l(h,f){n.drawElements(i,f,s,h*a),t.update(f,i,1)}function c(h,f,g){g!==0&&(n.drawElementsInstanced(i,f,s,h*a,g),t.update(f,i,g))}function d(h,f,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,f,0,s,h,0,g);let m=0;for(let u=0;u<g;u++)m+=f[u];t.update(m,i,1)}function p(h,f,g,v){if(g===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let u=0;u<h.length;u++)c(h[u]/a,f[u],v[u]);else{m.multiDrawElementsInstancedWEBGL(i,f,0,s,h,0,v,0,g);let u=0;for(let S=0;S<g;S++)u+=f[S]*v[S];t.update(u,i,1)}}this.setMode=r,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=d,this.renderMultiDrawInstances=p}function pf(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,a,o){switch(t.calls++,a){case n.TRIANGLES:t.triangles+=o*(s/3);break;case n.LINES:t.lines+=o*(s/2);break;case n.LINE_STRIP:t.lines+=o*(s-1);break;case n.LINE_LOOP:t.lines+=o*s;break;case n.POINTS:t.points+=o*s;break;default:qe("WebGLInfo: Unknown draw mode:",a);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function mf(n,e,t){const i=new WeakMap,r=new ct;function s(a,o,l){const c=a.morphTargetInfluences,d=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,p=d!==void 0?d.length:0;let h=i.get(o);if(h===void 0||h.count!==p){let y=function(){C.dispose(),i.delete(o),o.removeEventListener("dispose",y)};h!==void 0&&h.texture.dispose();const f=o.morphAttributes.position!==void 0,g=o.morphAttributes.normal!==void 0,v=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],u=o.morphAttributes.normal||[],S=o.morphAttributes.color||[];let b=0;f===!0&&(b=1),g===!0&&(b=2),v===!0&&(b=3);let E=o.attributes.position.count*b,R=1;E>e.maxTextureSize&&(R=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const A=new Float32Array(E*R*4*p),C=new dl(A,E,R,p);C.type=qt,C.needsUpdate=!0;const x=b*4;for(let z=0;z<p;z++){const w=m[z],F=u[z],B=S[z],I=E*R*4*z;for(let G=0;G<w.count;G++){const V=G*x;f===!0&&(r.fromBufferAttribute(w,G),A[I+V+0]=r.x,A[I+V+1]=r.y,A[I+V+2]=r.z,A[I+V+3]=0),g===!0&&(r.fromBufferAttribute(F,G),A[I+V+4]=r.x,A[I+V+5]=r.y,A[I+V+6]=r.z,A[I+V+7]=0),v===!0&&(r.fromBufferAttribute(B,G),A[I+V+8]=r.x,A[I+V+9]=r.y,A[I+V+10]=r.z,A[I+V+11]=B.itemSize===4?r.w:1)}}h={count:p,texture:C,size:new Ke(E,R)},i.set(o,h),o.addEventListener("dispose",y)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(n,"morphTexture",a.morphTexture,t);else{let f=0;for(let v=0;v<c.length;v++)f+=c[v];const g=o.morphTargetsRelative?1:1-f;l.getUniforms().setValue(n,"morphTargetBaseInfluence",g),l.getUniforms().setValue(n,"morphTargetInfluences",c)}l.getUniforms().setValue(n,"morphTargetsTexture",h.texture,t),l.getUniforms().setValue(n,"morphTargetsTextureSize",h.size)}return{update:s}}function gf(n,e,t,i,r){let s=new WeakMap;function a(c){const d=r.render.frame,p=c.geometry,h=e.get(c,p);if(s.get(h)!==d&&(e.update(h),s.set(h,d)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==d&&(t.update(c.instanceMatrix,n.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,n.ARRAY_BUFFER),s.set(c,d))),c.isSkinnedMesh){const f=c.skeleton;s.get(f)!==d&&(f.update(),s.set(f,d))}return h}function o(){s=new WeakMap}function l(c){const d=c.target;d.removeEventListener("dispose",l),i.releaseStatesOfObject(d),t.remove(d.instanceMatrix),d.instanceColor!==null&&t.remove(d.instanceColor)}return{update:a,dispose:o}}const _f={[$o]:"LINEAR_TONE_MAPPING",[Zo]:"REINHARD_TONE_MAPPING",[Ko]:"CINEON_TONE_MAPPING",[Jo]:"ACES_FILMIC_TONE_MAPPING",[el]:"AGX_TONE_MAPPING",[tl]:"NEUTRAL_TONE_MAPPING",[Qo]:"CUSTOM_TONE_MAPPING"};function xf(n,e,t,i,r){const s=new Zt(e,t,{type:n,depthBuffer:i,stencilBuffer:r}),a=new Zt(e,t,{type:pn,depthBuffer:!1,stencilBuffer:!1}),o=new en;o.setAttribute("position",new fn([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new fn([0,2,0,0,2,0],2));const l=new El({uniforms:{tDiffuse:{value:null}},vertexShader:`
3902
3902
  precision highp float;
3903
3903
 
3904
3904
  uniform mat4 modelViewMatrix;
@@ -3944,17 +3944,17 @@ void main() {
3944
3944
  #ifdef SRGB_TRANSFER
3945
3945
  gl_FragColor = sRGBTransferOETF( gl_FragColor );
3946
3946
  #endif
3947
- }`,depthTest:!1,depthWrite:!1}),c=new Jt(o,l),u=new pa(-1,1,1,-1,0,1);let p=null,h=null,f=!1,g,v=null,m=[],d=!1;this.setSize=function(S,b){s.setSize(S,b),a.setSize(S,b);for(let E=0;E<m.length;E++){const R=m[E];R.setSize&&R.setSize(S,b)}},this.setEffects=function(S){m=S,d=m.length>0&&m[0].isRenderPass===!0;const b=s.width,E=s.height;for(let R=0;R<m.length;R++){const A=m[R];A.setSize&&A.setSize(b,E)}},this.begin=function(S,b){if(f||S.toneMapping===$t&&m.length===0)return!1;if(v=b,b!==null){const E=b.width,R=b.height;(s.width!==E||s.height!==R)&&this.setSize(E,R)}return d===!1&&S.setRenderTarget(s),g=S.toneMapping,S.toneMapping=$t,!0},this.hasRenderPass=function(){return d},this.end=function(S,b){S.toneMapping=g,f=!0;let E=s,R=a;for(let A=0;A<m.length;A++){const C=m[A];if(C.enabled!==!1&&(C.render(S,R,E,b),C.needsSwap!==!1)){const x=E;E=R,R=x}}if(p!==S.outputColorSpace||h!==S.toneMapping){p=S.outputColorSpace,h=S.toneMapping,l.defines={},Xe.getTransfer(p)===Qe&&(l.defines.SRGB_TRANSFER="");const A=df[h];A&&(l.defines[A]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=E.texture,S.setRenderTarget(v),S.render(c,u),v=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){s.dispose(),a.dispose(),o.dispose(),l.dispose()}}const Sl=new bt,Js=new Di(1,1),El=new al,yl=new Oc,bl=new pl,so=[],ao=[],oo=new Float32Array(16),lo=new Float32Array(9),co=new Float32Array(4);function mi(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=so[r];if(s===void 0&&(s=new Float32Array(r),so[r]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,n[a].toArray(s,o)}return s}function ft(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function pt(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function Er(n,e){let t=ao[e];t===void 0&&(t=new Int32Array(e),ao[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function pf(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function mf(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ft(t,e))return;n.uniform2fv(this.addr,e),pt(t,e)}}function gf(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(ft(t,e))return;n.uniform3fv(this.addr,e),pt(t,e)}}function _f(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ft(t,e))return;n.uniform4fv(this.addr,e),pt(t,e)}}function xf(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(ft(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),pt(t,e)}else{if(ft(t,i))return;co.set(i),n.uniformMatrix2fv(this.addr,!1,co),pt(t,i)}}function vf(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(ft(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),pt(t,e)}else{if(ft(t,i))return;lo.set(i),n.uniformMatrix3fv(this.addr,!1,lo),pt(t,i)}}function Mf(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(ft(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),pt(t,e)}else{if(ft(t,i))return;oo.set(i),n.uniformMatrix4fv(this.addr,!1,oo),pt(t,i)}}function Sf(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function Ef(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ft(t,e))return;n.uniform2iv(this.addr,e),pt(t,e)}}function yf(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(ft(t,e))return;n.uniform3iv(this.addr,e),pt(t,e)}}function bf(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ft(t,e))return;n.uniform4iv(this.addr,e),pt(t,e)}}function Tf(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function Af(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ft(t,e))return;n.uniform2uiv(this.addr,e),pt(t,e)}}function wf(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(ft(t,e))return;n.uniform3uiv(this.addr,e),pt(t,e)}}function Rf(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ft(t,e))return;n.uniform4uiv(this.addr,e),pt(t,e)}}function Cf(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);let s;this.type===n.SAMPLER_2D_SHADOW?(Js.compareFunction=t.isReversedDepthBuffer()?ua:ha,s=Js):s=Sl,t.setTexture2D(e||s,r)}function Pf(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||yl,r)}function Df(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||bl,r)}function Lf(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||El,r)}function If(n){switch(n){case 5126:return pf;case 35664:return mf;case 35665:return gf;case 35666:return _f;case 35674:return xf;case 35675:return vf;case 35676:return Mf;case 5124:case 35670:return Sf;case 35667:case 35671:return Ef;case 35668:case 35672:return yf;case 35669:case 35673:return bf;case 5125:return Tf;case 36294:return Af;case 36295:return wf;case 36296:return Rf;case 35678:case 36198:case 36298:case 36306:case 35682:return Cf;case 35679:case 36299:case 36307:return Pf;case 35680:case 36300:case 36308:case 36293:return Df;case 36289:case 36303:case 36311:case 36292:return Lf}}function Nf(n,e){n.uniform1fv(this.addr,e)}function Ff(n,e){const t=mi(e,this.size,2);n.uniform2fv(this.addr,t)}function Uf(n,e){const t=mi(e,this.size,3);n.uniform3fv(this.addr,t)}function Of(n,e){const t=mi(e,this.size,4);n.uniform4fv(this.addr,t)}function Bf(n,e){const t=mi(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function zf(n,e){const t=mi(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function Gf(n,e){const t=mi(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function Vf(n,e){n.uniform1iv(this.addr,e)}function kf(n,e){n.uniform2iv(this.addr,e)}function Hf(n,e){n.uniform3iv(this.addr,e)}function Wf(n,e){n.uniform4iv(this.addr,e)}function Xf(n,e){n.uniform1uiv(this.addr,e)}function qf(n,e){n.uniform2uiv(this.addr,e)}function jf(n,e){n.uniform3uiv(this.addr,e)}function Yf(n,e){n.uniform4uiv(this.addr,e)}function $f(n,e,t){const i=this.cache,r=e.length,s=Er(t,r);ft(i,s)||(n.uniform1iv(this.addr,s),pt(i,s));let a;this.type===n.SAMPLER_2D_SHADOW?a=Js:a=Sl;for(let o=0;o!==r;++o)t.setTexture2D(e[o]||a,s[o])}function Zf(n,e,t){const i=this.cache,r=e.length,s=Er(t,r);ft(i,s)||(n.uniform1iv(this.addr,s),pt(i,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||yl,s[a])}function Kf(n,e,t){const i=this.cache,r=e.length,s=Er(t,r);ft(i,s)||(n.uniform1iv(this.addr,s),pt(i,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||bl,s[a])}function Jf(n,e,t){const i=this.cache,r=e.length,s=Er(t,r);ft(i,s)||(n.uniform1iv(this.addr,s),pt(i,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||El,s[a])}function Qf(n){switch(n){case 5126:return Nf;case 35664:return Ff;case 35665:return Uf;case 35666:return Of;case 35674:return Bf;case 35675:return zf;case 35676:return Gf;case 5124:case 35670:return Vf;case 35667:case 35671:return kf;case 35668:case 35672:return Hf;case 35669:case 35673:return Wf;case 5125:return Xf;case 36294:return qf;case 36295:return jf;case 36296:return Yf;case 35678:case 36198:case 36298:case 36306:case 35682:return $f;case 35679:case 36299:case 36307:return Zf;case 35680:case 36300:case 36308:case 36293:return Kf;case 36289:case 36303:case 36311:case 36292:return Jf}}class ep{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=If(t.type)}}class tp{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=Qf(t.type)}}class np{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],i)}}}const ns=/(\w+)(\])?(\[|\.)?/g;function ho(n,e){n.seq.push(e),n.map[e.id]=e}function ip(n,e,t){const i=n.name,r=i.length;for(ns.lastIndex=0;;){const s=ns.exec(i),a=ns.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){ho(t,c===void 0?new ep(o,n,e):new tp(o,n,e));break}else{let p=t.map[o];p===void 0&&(p=new np(o),ho(t,p)),t=p}}}class dr{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<i;++a){const o=e.getActiveUniform(t,a),l=e.getUniformLocation(t,o.name);ip(o,l,this)}const r=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(a):s.push(a);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=i[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&i.push(a)}return i}}function uo(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const rp=37297;let sp=0;function ap(n,e){const t=n.split(`
3947
+ }`,depthTest:!1,depthWrite:!1}),c=new Jt(o,l),d=new pa(-1,1,1,-1,0,1);let p=null,h=null,f=!1,g,v=null,m=[],u=!1;this.setSize=function(S,b){s.setSize(S,b),a.setSize(S,b);for(let E=0;E<m.length;E++){const R=m[E];R.setSize&&R.setSize(S,b)}},this.setEffects=function(S){m=S,u=m.length>0&&m[0].isRenderPass===!0;const b=s.width,E=s.height;for(let R=0;R<m.length;R++){const A=m[R];A.setSize&&A.setSize(b,E)}},this.begin=function(S,b){if(f||S.toneMapping===$t&&m.length===0)return!1;if(v=b,b!==null){const E=b.width,R=b.height;(s.width!==E||s.height!==R)&&this.setSize(E,R)}return u===!1&&S.setRenderTarget(s),g=S.toneMapping,S.toneMapping=$t,!0},this.hasRenderPass=function(){return u},this.end=function(S,b){S.toneMapping=g,f=!0;let E=s,R=a;for(let A=0;A<m.length;A++){const C=m[A];if(C.enabled!==!1&&(C.render(S,R,E,b),C.needsSwap!==!1)){const x=E;E=R,R=x}}if(p!==S.outputColorSpace||h!==S.toneMapping){p=S.outputColorSpace,h=S.toneMapping,l.defines={},Xe.getTransfer(p)===Qe&&(l.defines.SRGB_TRANSFER="");const A=_f[h];A&&(l.defines[A]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=E.texture,S.setRenderTarget(v),S.render(c,d),v=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){s.dispose(),a.dispose(),o.dispose(),l.dispose()}}const Al=new bt,Js=new Di(1,1),wl=new dl,Rl=new kc,Cl=new vl,ao=[],oo=[],lo=new Float32Array(16),co=new Float32Array(9),ho=new Float32Array(4);function mi(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=ao[r];if(s===void 0&&(s=new Float32Array(r),ao[r]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,n[a].toArray(s,o)}return s}function ft(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function pt(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function Er(n,e){let t=oo[e];t===void 0&&(t=new Int32Array(e),oo[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function vf(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function Mf(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ft(t,e))return;n.uniform2fv(this.addr,e),pt(t,e)}}function Sf(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(ft(t,e))return;n.uniform3fv(this.addr,e),pt(t,e)}}function Ef(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ft(t,e))return;n.uniform4fv(this.addr,e),pt(t,e)}}function yf(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(ft(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),pt(t,e)}else{if(ft(t,i))return;ho.set(i),n.uniformMatrix2fv(this.addr,!1,ho),pt(t,i)}}function bf(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(ft(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),pt(t,e)}else{if(ft(t,i))return;co.set(i),n.uniformMatrix3fv(this.addr,!1,co),pt(t,i)}}function Tf(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(ft(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),pt(t,e)}else{if(ft(t,i))return;lo.set(i),n.uniformMatrix4fv(this.addr,!1,lo),pt(t,i)}}function Af(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function wf(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ft(t,e))return;n.uniform2iv(this.addr,e),pt(t,e)}}function Rf(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(ft(t,e))return;n.uniform3iv(this.addr,e),pt(t,e)}}function Cf(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ft(t,e))return;n.uniform4iv(this.addr,e),pt(t,e)}}function Pf(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function Df(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(ft(t,e))return;n.uniform2uiv(this.addr,e),pt(t,e)}}function Lf(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(ft(t,e))return;n.uniform3uiv(this.addr,e),pt(t,e)}}function If(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(ft(t,e))return;n.uniform4uiv(this.addr,e),pt(t,e)}}function Nf(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);let s;this.type===n.SAMPLER_2D_SHADOW?(Js.compareFunction=t.isReversedDepthBuffer()?da:ha,s=Js):s=Al,t.setTexture2D(e||s,r)}function Ff(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||Rl,r)}function Uf(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||Cl,r)}function Of(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||wl,r)}function Bf(n){switch(n){case 5126:return vf;case 35664:return Mf;case 35665:return Sf;case 35666:return Ef;case 35674:return yf;case 35675:return bf;case 35676:return Tf;case 5124:case 35670:return Af;case 35667:case 35671:return wf;case 35668:case 35672:return Rf;case 35669:case 35673:return Cf;case 5125:return Pf;case 36294:return Df;case 36295:return Lf;case 36296:return If;case 35678:case 36198:case 36298:case 36306:case 35682:return Nf;case 35679:case 36299:case 36307:return Ff;case 35680:case 36300:case 36308:case 36293:return Uf;case 36289:case 36303:case 36311:case 36292:return Of}}function zf(n,e){n.uniform1fv(this.addr,e)}function Gf(n,e){const t=mi(e,this.size,2);n.uniform2fv(this.addr,t)}function Vf(n,e){const t=mi(e,this.size,3);n.uniform3fv(this.addr,t)}function kf(n,e){const t=mi(e,this.size,4);n.uniform4fv(this.addr,t)}function Hf(n,e){const t=mi(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function Wf(n,e){const t=mi(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function Xf(n,e){const t=mi(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function jf(n,e){n.uniform1iv(this.addr,e)}function qf(n,e){n.uniform2iv(this.addr,e)}function Yf(n,e){n.uniform3iv(this.addr,e)}function $f(n,e){n.uniform4iv(this.addr,e)}function Zf(n,e){n.uniform1uiv(this.addr,e)}function Kf(n,e){n.uniform2uiv(this.addr,e)}function Jf(n,e){n.uniform3uiv(this.addr,e)}function Qf(n,e){n.uniform4uiv(this.addr,e)}function ep(n,e,t){const i=this.cache,r=e.length,s=Er(t,r);ft(i,s)||(n.uniform1iv(this.addr,s),pt(i,s));let a;this.type===n.SAMPLER_2D_SHADOW?a=Js:a=Al;for(let o=0;o!==r;++o)t.setTexture2D(e[o]||a,s[o])}function tp(n,e,t){const i=this.cache,r=e.length,s=Er(t,r);ft(i,s)||(n.uniform1iv(this.addr,s),pt(i,s));for(let a=0;a!==r;++a)t.setTexture3D(e[a]||Rl,s[a])}function np(n,e,t){const i=this.cache,r=e.length,s=Er(t,r);ft(i,s)||(n.uniform1iv(this.addr,s),pt(i,s));for(let a=0;a!==r;++a)t.setTextureCube(e[a]||Cl,s[a])}function ip(n,e,t){const i=this.cache,r=e.length,s=Er(t,r);ft(i,s)||(n.uniform1iv(this.addr,s),pt(i,s));for(let a=0;a!==r;++a)t.setTexture2DArray(e[a]||wl,s[a])}function rp(n){switch(n){case 5126:return zf;case 35664:return Gf;case 35665:return Vf;case 35666:return kf;case 35674:return Hf;case 35675:return Wf;case 35676:return Xf;case 5124:case 35670:return jf;case 35667:case 35671:return qf;case 35668:case 35672:return Yf;case 35669:case 35673:return $f;case 5125:return Zf;case 36294:return Kf;case 36295:return Jf;case 36296:return Qf;case 35678:case 36198:case 36298:case 36306:case 35682:return ep;case 35679:case 36299:case 36307:return tp;case 35680:case 36300:case 36308:case 36293:return np;case 36289:case 36303:case 36311:case 36292:return ip}}class sp{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=Bf(t.type)}}class ap{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=rp(t.type)}}class op{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,a=r.length;s!==a;++s){const o=r[s];o.setValue(e,t[o.id],i)}}}const ns=/(\w+)(\])?(\[|\.)?/g;function uo(n,e){n.seq.push(e),n.map[e.id]=e}function lp(n,e,t){const i=n.name,r=i.length;for(ns.lastIndex=0;;){const s=ns.exec(i),a=ns.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===r){uo(t,c===void 0?new sp(o,n,e):new ap(o,n,e));break}else{let p=t.map[o];p===void 0&&(p=new op(o),uo(t,p)),t=p}}}class ur{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<i;++a){const o=e.getActiveUniform(t,a),l=e.getUniformLocation(t,o.name);lp(o,l,this)}const r=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(a):s.push(a);r.length>0&&(this.seq=r.concat(s))}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=i[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const a=e[r];a.id in t&&i.push(a)}return i}}function fo(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const cp=37297;let hp=0;function dp(n,e){const t=n.split(`
3948
3948
  `),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=r;a<s;a++){const o=a+1;i.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return i.join(`
3949
- `)}const fo=new Be;function op(n){Xe._getMatrix(fo,Xe.workingColorSpace,n);const e=`mat3( ${fo.elements.map(t=>t.toFixed(4))} )`;switch(Xe.getTransfer(n)){case fr:return[e,"LinearTransferOETF"];case Qe:return[e,"sRGBTransferOETF"];default:return Ie("WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function po(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),s=(n.getShaderInfoLog(e)||"").trim();if(i&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
3949
+ `)}const po=new Be;function up(n){Xe._getMatrix(po,Xe.workingColorSpace,n);const e=`mat3( ${po.elements.map(t=>t.toFixed(4))} )`;switch(Xe.getTransfer(n)){case fr:return[e,"LinearTransferOETF"];case Qe:return[e,"sRGBTransferOETF"];default:return Ie("WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function mo(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),s=(n.getShaderInfoLog(e)||"").trim();if(i&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
3950
3950
 
3951
3951
  `+s+`
3952
3952
 
3953
- `+ap(n.getShaderSource(e),o)}else return s}function lp(n,e){const t=op(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
3954
- `)}const cp={[Wo]:"Linear",[Xo]:"Reinhard",[qo]:"Cineon",[jo]:"ACESFilmic",[$o]:"AgX",[Zo]:"Neutral",[Yo]:"Custom"};function hp(n,e){const t=cp[e];return t===void 0?(Ie("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+n+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const sr=new W;function up(){Xe.getLuminanceCoefficients(sr);const n=sr.x.toFixed(4),e=sr.y.toFixed(4),t=sr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
3955
- `)}function dp(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ai).join(`
3956
- `)}function fp(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
3957
- `)}function pp(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),a=s.name;let o=1;s.type===n.FLOAT_MAT2&&(o=2),s.type===n.FLOAT_MAT3&&(o=3),s.type===n.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:n.getAttribLocation(e,a),locationSize:o}}return t}function Ai(n){return n!==""}function mo(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function go(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const mp=/^[ \t]*#include +<([\w\d./]+)>/gm;function Qs(n){return n.replace(mp,_p)}const gp=new Map;function _p(n,e){let t=ze[e];if(t===void 0){const i=gp.get(e);if(i!==void 0)t=ze[i],Ie('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return Qs(t)}const xp=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function _o(n){return n.replace(xp,vp)}function vp(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function xo(n){let e=`precision ${n.precision} float;
3953
+ `+dp(n.getShaderSource(e),o)}else return s}function fp(n,e){const t=up(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
3954
+ `)}const pp={[$o]:"Linear",[Zo]:"Reinhard",[Ko]:"Cineon",[Jo]:"ACESFilmic",[el]:"AgX",[tl]:"Neutral",[Qo]:"Custom"};function mp(n,e){const t=pp[e];return t===void 0?(Ie("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+n+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const sr=new W;function gp(){Xe.getLuminanceCoefficients(sr);const n=sr.x.toFixed(4),e=sr.y.toFixed(4),t=sr.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(`
3955
+ `)}function _p(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ai).join(`
3956
+ `)}function xp(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
3957
+ `)}function vp(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),a=s.name;let o=1;s.type===n.FLOAT_MAT2&&(o=2),s.type===n.FLOAT_MAT3&&(o=3),s.type===n.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:n.getAttribLocation(e,a),locationSize:o}}return t}function Ai(n){return n!==""}function go(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function _o(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Mp=/^[ \t]*#include +<([\w\d./]+)>/gm;function Qs(n){return n.replace(Mp,Ep)}const Sp=new Map;function Ep(n,e){let t=ze[e];if(t===void 0){const i=Sp.get(e);if(i!==void 0)t=ze[i],Ie('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return Qs(t)}const yp=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function xo(n){return n.replace(yp,bp)}function bp(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function vo(n){let e=`precision ${n.precision} float;
3958
3958
  precision ${n.precision} int;
3959
3959
  precision ${n.precision} sampler2D;
3960
3960
  precision ${n.precision} samplerCube;
@@ -3974,30 +3974,30 @@ void main() {
3974
3974
  `;return n.precision==="highp"?e+=`
3975
3975
  #define HIGH_PRECISION`:n.precision==="mediump"?e+=`
3976
3976
  #define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
3977
- #define LOW_PRECISION`),e}const Mp={[or]:"SHADOWMAP_TYPE_PCF",[Ti]:"SHADOWMAP_TYPE_VSM"};function Sp(n){return Mp[n.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const Ep={[Vn]:"ENVMAP_TYPE_CUBE",[hi]:"ENVMAP_TYPE_CUBE",[xr]:"ENVMAP_TYPE_CUBE_UV"};function yp(n){return n.envMap===!1?"ENVMAP_TYPE_CUBE":Ep[n.envMapMode]||"ENVMAP_TYPE_CUBE"}const bp={[hi]:"ENVMAP_MODE_REFRACTION"};function Tp(n){return n.envMap===!1?"ENVMAP_MODE_REFLECTION":bp[n.envMapMode]||"ENVMAP_MODE_REFLECTION"}const Ap={[Ho]:"ENVMAP_BLENDING_MULTIPLY",[mc]:"ENVMAP_BLENDING_MIX",[gc]:"ENVMAP_BLENDING_ADD"};function wp(n){return n.envMap===!1?"ENVMAP_BLENDING_NONE":Ap[n.combine]||"ENVMAP_BLENDING_NONE"}function Rp(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:i,maxMip:t}}function Cp(n,e,t,i){const r=n.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Sp(t),c=yp(t),u=Tp(t),p=wp(t),h=Rp(t),f=dp(t),g=fp(s),v=r.createProgram();let m,d,S=t.glslVersion?"#version "+t.glslVersion+`
3977
+ #define LOW_PRECISION`),e}const Tp={[or]:"SHADOWMAP_TYPE_PCF",[Ti]:"SHADOWMAP_TYPE_VSM"};function Ap(n){return Tp[n.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const wp={[Vn]:"ENVMAP_TYPE_CUBE",[hi]:"ENVMAP_TYPE_CUBE",[xr]:"ENVMAP_TYPE_CUBE_UV"};function Rp(n){return n.envMap===!1?"ENVMAP_TYPE_CUBE":wp[n.envMapMode]||"ENVMAP_TYPE_CUBE"}const Cp={[hi]:"ENVMAP_MODE_REFRACTION"};function Pp(n){return n.envMap===!1?"ENVMAP_MODE_REFLECTION":Cp[n.envMapMode]||"ENVMAP_MODE_REFLECTION"}const Dp={[Yo]:"ENVMAP_BLENDING_MULTIPLY",[Mc]:"ENVMAP_BLENDING_MIX",[Sc]:"ENVMAP_BLENDING_ADD"};function Lp(n){return n.envMap===!1?"ENVMAP_BLENDING_NONE":Dp[n.combine]||"ENVMAP_BLENDING_NONE"}function Ip(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:i,maxMip:t}}function Np(n,e,t,i){const r=n.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=Ap(t),c=Rp(t),d=Pp(t),p=Lp(t),h=Ip(t),f=_p(t),g=xp(s),v=r.createProgram();let m,u,S=t.glslVersion?"#version "+t.glslVersion+`
3978
3978
  `:"";t.isRawShaderMaterial?(m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Ai).join(`
3979
3979
  `),m.length>0&&(m+=`
3980
- `),d=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Ai).join(`
3981
- `),d.length>0&&(d+=`
3982
- `)):(m=[xo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
3980
+ `),u=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Ai).join(`
3981
+ `),u.length>0&&(u+=`
3982
+ `)):(m=[vo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+d:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
3983
3983
  `].filter(Ai).join(`
3984
- `),d=[xo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+p:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==$t?"#define TONE_MAPPING":"",t.toneMapping!==$t?ze.tonemapping_pars_fragment:"",t.toneMapping!==$t?hp("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ze.colorspace_pars_fragment,lp("linearToOutputTexel",t.outputColorSpace),up(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3984
+ `),u=[vo(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+d:"",t.envMap?"#define "+p:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==$t?"#define TONE_MAPPING":"",t.toneMapping!==$t?ze.tonemapping_pars_fragment:"",t.toneMapping!==$t?mp("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ze.colorspace_pars_fragment,fp("linearToOutputTexel",t.outputColorSpace),gp(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3985
3985
  `].filter(Ai).join(`
3986
- `)),a=Qs(a),a=mo(a,t),a=go(a,t),o=Qs(o),o=mo(o,t),o=go(o,t),a=_o(a),o=_o(o),t.isRawShaderMaterial!==!0&&(S=`#version 300 es
3986
+ `)),a=Qs(a),a=go(a,t),a=_o(a,t),o=Qs(o),o=go(o,t),o=_o(o,t),a=xo(a),o=xo(o),t.isRawShaderMaterial!==!0&&(S=`#version 300 es
3987
3987
  `,m=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
3988
3988
  `)+`
3989
- `+m,d=["#define varying in",t.glslVersion===Ia?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Ia?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
3989
+ `+m,u=["#define varying in",t.glslVersion===Na?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Na?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
3990
3990
  `)+`
3991
- `+d);const b=S+m+a,E=S+d+o,R=uo(r,r.VERTEX_SHADER,b),A=uo(r,r.FRAGMENT_SHADER,E);r.attachShader(v,R),r.attachShader(v,A),t.index0AttributeName!==void 0?r.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v);function C(w){if(n.debug.checkShaderErrors){const F=r.getProgramInfoLog(v)||"",B=r.getShaderInfoLog(R)||"",I=r.getShaderInfoLog(A)||"",G=F.trim(),V=B.trim(),U=I.trim();let K=!0,Y=!0;if(r.getProgramParameter(v,r.LINK_STATUS)===!1)if(K=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,v,R,A);else{const se=po(r,R,"vertex"),ce=po(r,A,"fragment");je("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(v,r.VALIDATE_STATUS)+`
3991
+ `+u);const b=S+m+a,E=S+u+o,R=fo(r,r.VERTEX_SHADER,b),A=fo(r,r.FRAGMENT_SHADER,E);r.attachShader(v,R),r.attachShader(v,A),t.index0AttributeName!==void 0?r.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v);function C(w){if(n.debug.checkShaderErrors){const F=r.getProgramInfoLog(v)||"",B=r.getShaderInfoLog(R)||"",I=r.getShaderInfoLog(A)||"",G=F.trim(),V=B.trim(),U=I.trim();let K=!0,Y=!0;if(r.getProgramParameter(v,r.LINK_STATUS)===!1)if(K=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,v,R,A);else{const se=mo(r,R,"vertex"),ce=mo(r,A,"fragment");qe("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(v,r.VALIDATE_STATUS)+`
3992
3992
 
3993
3993
  Material Name: `+w.name+`
3994
3994
  Material Type: `+w.type+`
3995
3995
 
3996
3996
  Program Info Log: `+G+`
3997
3997
  `+se+`
3998
- `+ce)}else G!==""?Ie("WebGLProgram: Program Info Log:",G):(V===""||U==="")&&(Y=!1);Y&&(w.diagnostics={runnable:K,programLog:G,vertexShader:{log:V,prefix:m},fragmentShader:{log:U,prefix:d}})}r.deleteShader(R),r.deleteShader(A),x=new dr(r,v),y=pp(r,v)}let x;this.getUniforms=function(){return x===void 0&&C(this),x};let y;this.getAttributes=function(){return y===void 0&&C(this),y};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=r.getProgramParameter(v,rp)),z},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=sp++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=R,this.fragmentShader=A,this}let Pp=0;class Dp{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new Lp(e),t.set(e,i)),i}}class Lp{constructor(e){this.id=Pp++,this.code=e,this.usedTimes=0}}function Ip(n,e,t,i,r,s){const a=new ll,o=new Dp,l=new Set,c=[],u=new Map,p=i.logarithmicDepthBuffer;let h=i.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(x){return l.add(x),x===0?"uv":`uv${x}`}function v(x,y,z,w,F){const B=w.fog,I=F.geometry,G=x.isMeshStandardMaterial||x.isMeshLambertMaterial||x.isMeshPhongMaterial?w.environment:null,V=x.isMeshStandardMaterial||x.isMeshLambertMaterial&&!x.envMap||x.isMeshPhongMaterial&&!x.envMap,U=e.get(x.envMap||G,V),K=U&&U.mapping===xr?U.image.height:null,Y=f[x.type];x.precision!==null&&(h=i.getMaxPrecision(x.precision),h!==x.precision&&Ie("WebGLProgram.getParameters:",x.precision,"not supported, using",h,"instead."));const se=I.morphAttributes.position||I.morphAttributes.normal||I.morphAttributes.color,ce=se!==void 0?se.length:0;let le=0;I.morphAttributes.position!==void 0&&(le=1),I.morphAttributes.normal!==void 0&&(le=2),I.morphAttributes.color!==void 0&&(le=3);let we,Ye,He,Z;if(Y){const Je=qt[Y];we=Je.vertexShader,Ye=Je.fragmentShader}else we=x.vertexShader,Ye=x.fragmentShader,o.update(x),He=o.getVertexShaderID(x),Z=o.getFragmentShaderID(x);const te=n.getRenderTarget(),re=n.state.buffers.depth.getReversed(),Le=F.isInstancedMesh===!0,Ae=F.isBatchedMesh===!0,Re=!!x.map,ot=!!x.matcap,ke=!!U,$e=!!x.aoMap,Ze=!!x.lightMap,Ne=!!x.bumpMap,st=!!x.normalMap,P=!!x.displacementMap,at=!!x.emissiveMap,Pe=!!x.metalnessMap,Oe=!!x.roughnessMap,ge=x.anisotropy>0,T=x.clearcoat>0,_=x.dispersion>0,N=x.iridescence>0,$=x.sheen>0,J=x.transmission>0,j=ge&&!!x.anisotropyMap,_e=T&&!!x.clearcoatMap,ae=T&&!!x.clearcoatNormalMap,Te=T&&!!x.clearcoatRoughnessMap,Ce=N&&!!x.iridescenceMap,Q=N&&!!x.iridescenceThicknessMap,ne=$&&!!x.sheenColorMap,xe=$&&!!x.sheenRoughnessMap,Me=!!x.specularMap,fe=!!x.specularColorMap,Ge=!!x.specularIntensityMap,D=J&&!!x.transmissionMap,oe=J&&!!x.thicknessMap,ie=!!x.gradientMap,me=!!x.alphaMap,ee=x.alphaTest>0,q=!!x.alphaHash,ve=!!x.extensions;let Fe=$t;x.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(Fe=n.toneMapping);const rt={shaderID:Y,shaderType:x.type,shaderName:x.name,vertexShader:we,fragmentShader:Ye,defines:x.defines,customVertexShaderID:He,customFragmentShaderID:Z,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:h,batching:Ae,batchingColor:Ae&&F._colorsTexture!==null,instancing:Le,instancingColor:Le&&F.instanceColor!==null,instancingMorph:Le&&F.morphTexture!==null,outputColorSpace:te===null?n.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:kn,alphaToCoverage:!!x.alphaToCoverage,map:Re,matcap:ot,envMap:ke,envMapMode:ke&&U.mapping,envMapCubeUVHeight:K,aoMap:$e,lightMap:Ze,bumpMap:Ne,normalMap:st,displacementMap:P,emissiveMap:at,normalMapObjectSpace:st&&x.normalMapType===Mc,normalMapTangentSpace:st&&x.normalMapType===vc,metalnessMap:Pe,roughnessMap:Oe,anisotropy:ge,anisotropyMap:j,clearcoat:T,clearcoatMap:_e,clearcoatNormalMap:ae,clearcoatRoughnessMap:Te,dispersion:_,iridescence:N,iridescenceMap:Ce,iridescenceThicknessMap:Q,sheen:$,sheenColorMap:ne,sheenRoughnessMap:xe,specularMap:Me,specularColorMap:fe,specularIntensityMap:Ge,transmission:J,transmissionMap:D,thicknessMap:oe,gradientMap:ie,opaque:x.transparent===!1&&x.blending===Gn&&x.alphaToCoverage===!1,alphaMap:me,alphaTest:ee,alphaHash:q,combine:x.combine,mapUv:Re&&g(x.map.channel),aoMapUv:$e&&g(x.aoMap.channel),lightMapUv:Ze&&g(x.lightMap.channel),bumpMapUv:Ne&&g(x.bumpMap.channel),normalMapUv:st&&g(x.normalMap.channel),displacementMapUv:P&&g(x.displacementMap.channel),emissiveMapUv:at&&g(x.emissiveMap.channel),metalnessMapUv:Pe&&g(x.metalnessMap.channel),roughnessMapUv:Oe&&g(x.roughnessMap.channel),anisotropyMapUv:j&&g(x.anisotropyMap.channel),clearcoatMapUv:_e&&g(x.clearcoatMap.channel),clearcoatNormalMapUv:ae&&g(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Te&&g(x.clearcoatRoughnessMap.channel),iridescenceMapUv:Ce&&g(x.iridescenceMap.channel),iridescenceThicknessMapUv:Q&&g(x.iridescenceThicknessMap.channel),sheenColorMapUv:ne&&g(x.sheenColorMap.channel),sheenRoughnessMapUv:xe&&g(x.sheenRoughnessMap.channel),specularMapUv:Me&&g(x.specularMap.channel),specularColorMapUv:fe&&g(x.specularColorMap.channel),specularIntensityMapUv:Ge&&g(x.specularIntensityMap.channel),transmissionMapUv:D&&g(x.transmissionMap.channel),thicknessMapUv:oe&&g(x.thicknessMap.channel),alphaMapUv:me&&g(x.alphaMap.channel),vertexTangents:!!I.attributes.tangent&&(st||ge),vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!I.attributes.color&&I.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!I.attributes.uv&&(Re||me),fog:!!B,useFog:x.fog===!0,fogExp2:!!B&&B.isFogExp2,flatShading:x.wireframe===!1&&(x.flatShading===!0||I.attributes.normal===void 0&&st===!1&&(x.isMeshLambertMaterial||x.isMeshPhongMaterial||x.isMeshStandardMaterial||x.isMeshPhysicalMaterial)),sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:p,reversedDepthBuffer:re,skinning:F.isSkinnedMesh===!0,morphTargets:I.morphAttributes.position!==void 0,morphNormals:I.morphAttributes.normal!==void 0,morphColors:I.morphAttributes.color!==void 0,morphTargetsCount:ce,morphTextureStride:le,numDirLights:y.directional.length,numPointLights:y.point.length,numSpotLights:y.spot.length,numSpotLightMaps:y.spotLightMap.length,numRectAreaLights:y.rectArea.length,numHemiLights:y.hemi.length,numDirLightShadows:y.directionalShadowMap.length,numPointLightShadows:y.pointShadowMap.length,numSpotLightShadows:y.spotShadowMap.length,numSpotLightShadowsWithMaps:y.numSpotLightShadowsWithMaps,numLightProbes:y.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:x.dithering,shadowMapEnabled:n.shadowMap.enabled&&z.length>0,shadowMapType:n.shadowMap.type,toneMapping:Fe,decodeVideoTexture:Re&&x.map.isVideoTexture===!0&&Xe.getTransfer(x.map.colorSpace)===Qe,decodeVideoTextureEmissive:at&&x.emissiveMap.isVideoTexture===!0&&Xe.getTransfer(x.emissiveMap.colorSpace)===Qe,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===cn,flipSided:x.side===At,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionClipCullDistance:ve&&x.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ve&&x.extensions.multiDraw===!0||Ae)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:x.customProgramCacheKey()};return rt.vertexUv1s=l.has(1),rt.vertexUv2s=l.has(2),rt.vertexUv3s=l.has(3),l.clear(),rt}function m(x){const y=[];if(x.shaderID?y.push(x.shaderID):(y.push(x.customVertexShaderID),y.push(x.customFragmentShaderID)),x.defines!==void 0)for(const z in x.defines)y.push(z),y.push(x.defines[z]);return x.isRawShaderMaterial===!1&&(d(y,x),S(y,x),y.push(n.outputColorSpace)),y.push(x.customProgramCacheKey),y.join()}function d(x,y){x.push(y.precision),x.push(y.outputColorSpace),x.push(y.envMapMode),x.push(y.envMapCubeUVHeight),x.push(y.mapUv),x.push(y.alphaMapUv),x.push(y.lightMapUv),x.push(y.aoMapUv),x.push(y.bumpMapUv),x.push(y.normalMapUv),x.push(y.displacementMapUv),x.push(y.emissiveMapUv),x.push(y.metalnessMapUv),x.push(y.roughnessMapUv),x.push(y.anisotropyMapUv),x.push(y.clearcoatMapUv),x.push(y.clearcoatNormalMapUv),x.push(y.clearcoatRoughnessMapUv),x.push(y.iridescenceMapUv),x.push(y.iridescenceThicknessMapUv),x.push(y.sheenColorMapUv),x.push(y.sheenRoughnessMapUv),x.push(y.specularMapUv),x.push(y.specularColorMapUv),x.push(y.specularIntensityMapUv),x.push(y.transmissionMapUv),x.push(y.thicknessMapUv),x.push(y.combine),x.push(y.fogExp2),x.push(y.sizeAttenuation),x.push(y.morphTargetsCount),x.push(y.morphAttributeCount),x.push(y.numDirLights),x.push(y.numPointLights),x.push(y.numSpotLights),x.push(y.numSpotLightMaps),x.push(y.numHemiLights),x.push(y.numRectAreaLights),x.push(y.numDirLightShadows),x.push(y.numPointLightShadows),x.push(y.numSpotLightShadows),x.push(y.numSpotLightShadowsWithMaps),x.push(y.numLightProbes),x.push(y.shadowMapType),x.push(y.toneMapping),x.push(y.numClippingPlanes),x.push(y.numClipIntersection),x.push(y.depthPacking)}function S(x,y){a.disableAll(),y.instancing&&a.enable(0),y.instancingColor&&a.enable(1),y.instancingMorph&&a.enable(2),y.matcap&&a.enable(3),y.envMap&&a.enable(4),y.normalMapObjectSpace&&a.enable(5),y.normalMapTangentSpace&&a.enable(6),y.clearcoat&&a.enable(7),y.iridescence&&a.enable(8),y.alphaTest&&a.enable(9),y.vertexColors&&a.enable(10),y.vertexAlphas&&a.enable(11),y.vertexUv1s&&a.enable(12),y.vertexUv2s&&a.enable(13),y.vertexUv3s&&a.enable(14),y.vertexTangents&&a.enable(15),y.anisotropy&&a.enable(16),y.alphaHash&&a.enable(17),y.batching&&a.enable(18),y.dispersion&&a.enable(19),y.batchingColor&&a.enable(20),y.gradientMap&&a.enable(21),x.push(a.mask),a.disableAll(),y.fog&&a.enable(0),y.useFog&&a.enable(1),y.flatShading&&a.enable(2),y.logarithmicDepthBuffer&&a.enable(3),y.reversedDepthBuffer&&a.enable(4),y.skinning&&a.enable(5),y.morphTargets&&a.enable(6),y.morphNormals&&a.enable(7),y.morphColors&&a.enable(8),y.premultipliedAlpha&&a.enable(9),y.shadowMapEnabled&&a.enable(10),y.doubleSided&&a.enable(11),y.flipSided&&a.enable(12),y.useDepthPacking&&a.enable(13),y.dithering&&a.enable(14),y.transmission&&a.enable(15),y.sheen&&a.enable(16),y.opaque&&a.enable(17),y.pointsUvs&&a.enable(18),y.decodeVideoTexture&&a.enable(19),y.decodeVideoTextureEmissive&&a.enable(20),y.alphaToCoverage&&a.enable(21),x.push(a.mask)}function b(x){const y=f[x.type];let z;if(y){const w=qt[y];z=rh.clone(w.uniforms)}else z=x.uniforms;return z}function E(x,y){let z=u.get(y);return z!==void 0?++z.usedTimes:(z=new Cp(n,y,x,r),c.push(z),u.set(y,z)),z}function R(x){if(--x.usedTimes===0){const y=c.indexOf(x);c[y]=c[c.length-1],c.pop(),u.delete(x.cacheKey),x.destroy()}}function A(x){o.remove(x)}function C(){o.dispose()}return{getParameters:v,getProgramCacheKey:m,getUniforms:b,acquireProgram:E,releaseProgram:R,releaseShaderCache:A,programs:c,dispose:C}}function Np(){let n=new WeakMap;function e(a){return n.has(a)}function t(a){let o=n.get(a);return o===void 0&&(o={},n.set(a,o)),o}function i(a){n.delete(a)}function r(a,o,l){n.get(a)[o]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function Fp(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.materialVariant!==e.materialVariant?n.materialVariant-e.materialVariant:n.z!==e.z?n.z-e.z:n.id-e.id}function vo(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function Mo(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function a(h){let f=0;return h.isInstancedMesh&&(f+=2),h.isSkinnedMesh&&(f+=1),f}function o(h,f,g,v,m,d){let S=n[e];return S===void 0?(S={id:h.id,object:h,geometry:f,material:g,materialVariant:a(h),groupOrder:v,renderOrder:h.renderOrder,z:m,group:d},n[e]=S):(S.id=h.id,S.object=h,S.geometry=f,S.material=g,S.materialVariant=a(h),S.groupOrder=v,S.renderOrder=h.renderOrder,S.z=m,S.group=d),e++,S}function l(h,f,g,v,m,d){const S=o(h,f,g,v,m,d);g.transmission>0?i.push(S):g.transparent===!0?r.push(S):t.push(S)}function c(h,f,g,v,m,d){const S=o(h,f,g,v,m,d);g.transmission>0?i.unshift(S):g.transparent===!0?r.unshift(S):t.unshift(S)}function u(h,f){t.length>1&&t.sort(h||Fp),i.length>1&&i.sort(f||vo),r.length>1&&r.sort(f||vo)}function p(){for(let h=e,f=n.length;h<f;h++){const g=n[h];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:l,unshift:c,finish:p,sort:u}}function Up(){let n=new WeakMap;function e(i,r){const s=n.get(i);let a;return s===void 0?(a=new Mo,n.set(i,[a])):r>=s.length?(a=new Mo,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function Op(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new W,color:new nt};break;case"SpotLight":t={position:new W,direction:new W,color:new nt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new W,color:new nt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new W,skyColor:new nt,groundColor:new nt};break;case"RectAreaLight":t={color:new nt,position:new W,halfWidth:new W,halfHeight:new W};break}return n[e.id]=t,t}}}function Bp(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let zp=0;function Gp(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Vp(n){const e=new Op,t=Bp(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new W);const r=new W,s=new dt,a=new dt;function o(c){let u=0,p=0,h=0;for(let y=0;y<9;y++)i.probe[y].set(0,0,0);let f=0,g=0,v=0,m=0,d=0,S=0,b=0,E=0,R=0,A=0,C=0;c.sort(Gp);for(let y=0,z=c.length;y<z;y++){const w=c[y],F=w.color,B=w.intensity,I=w.distance;let G=null;if(w.shadow&&w.shadow.map&&(w.shadow.map.texture.format===ui?G=w.shadow.map.texture:G=w.shadow.map.depthTexture||w.shadow.map.texture),w.isAmbientLight)u+=F.r*B,p+=F.g*B,h+=F.b*B;else if(w.isLightProbe){for(let V=0;V<9;V++)i.probe[V].addScaledVector(w.sh.coefficients[V],B);C++}else if(w.isDirectionalLight){const V=e.get(w);if(V.color.copy(w.color).multiplyScalar(w.intensity),w.castShadow){const U=w.shadow,K=t.get(w);K.shadowIntensity=U.intensity,K.shadowBias=U.bias,K.shadowNormalBias=U.normalBias,K.shadowRadius=U.radius,K.shadowMapSize=U.mapSize,i.directionalShadow[f]=K,i.directionalShadowMap[f]=G,i.directionalShadowMatrix[f]=w.shadow.matrix,S++}i.directional[f]=V,f++}else if(w.isSpotLight){const V=e.get(w);V.position.setFromMatrixPosition(w.matrixWorld),V.color.copy(F).multiplyScalar(B),V.distance=I,V.coneCos=Math.cos(w.angle),V.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),V.decay=w.decay,i.spot[v]=V;const U=w.shadow;if(w.map&&(i.spotLightMap[R]=w.map,R++,U.updateMatrices(w),w.castShadow&&A++),i.spotLightMatrix[v]=U.matrix,w.castShadow){const K=t.get(w);K.shadowIntensity=U.intensity,K.shadowBias=U.bias,K.shadowNormalBias=U.normalBias,K.shadowRadius=U.radius,K.shadowMapSize=U.mapSize,i.spotShadow[v]=K,i.spotShadowMap[v]=G,E++}v++}else if(w.isRectAreaLight){const V=e.get(w);V.color.copy(F).multiplyScalar(B),V.halfWidth.set(w.width*.5,0,0),V.halfHeight.set(0,w.height*.5,0),i.rectArea[m]=V,m++}else if(w.isPointLight){const V=e.get(w);if(V.color.copy(w.color).multiplyScalar(w.intensity),V.distance=w.distance,V.decay=w.decay,w.castShadow){const U=w.shadow,K=t.get(w);K.shadowIntensity=U.intensity,K.shadowBias=U.bias,K.shadowNormalBias=U.normalBias,K.shadowRadius=U.radius,K.shadowMapSize=U.mapSize,K.shadowCameraNear=U.camera.near,K.shadowCameraFar=U.camera.far,i.pointShadow[g]=K,i.pointShadowMap[g]=G,i.pointShadowMatrix[g]=w.shadow.matrix,b++}i.point[g]=V,g++}else if(w.isHemisphereLight){const V=e.get(w);V.skyColor.copy(w.color).multiplyScalar(B),V.groundColor.copy(w.groundColor).multiplyScalar(B),i.hemi[d]=V,d++}}m>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=he.LTC_FLOAT_1,i.rectAreaLTC2=he.LTC_FLOAT_2):(i.rectAreaLTC1=he.LTC_HALF_1,i.rectAreaLTC2=he.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=p,i.ambient[2]=h;const x=i.hash;(x.directionalLength!==f||x.pointLength!==g||x.spotLength!==v||x.rectAreaLength!==m||x.hemiLength!==d||x.numDirectionalShadows!==S||x.numPointShadows!==b||x.numSpotShadows!==E||x.numSpotMaps!==R||x.numLightProbes!==C)&&(i.directional.length=f,i.spot.length=v,i.rectArea.length=m,i.point.length=g,i.hemi.length=d,i.directionalShadow.length=S,i.directionalShadowMap.length=S,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=E,i.spotShadowMap.length=E,i.directionalShadowMatrix.length=S,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=E+R-A,i.spotLightMap.length=R,i.numSpotLightShadowsWithMaps=A,i.numLightProbes=C,x.directionalLength=f,x.pointLength=g,x.spotLength=v,x.rectAreaLength=m,x.hemiLength=d,x.numDirectionalShadows=S,x.numPointShadows=b,x.numSpotShadows=E,x.numSpotMaps=R,x.numLightProbes=C,i.version=zp++)}function l(c,u){let p=0,h=0,f=0,g=0,v=0;const m=u.matrixWorldInverse;for(let d=0,S=c.length;d<S;d++){const b=c[d];if(b.isDirectionalLight){const E=i.directional[p];E.direction.setFromMatrixPosition(b.matrixWorld),r.setFromMatrixPosition(b.target.matrixWorld),E.direction.sub(r),E.direction.transformDirection(m),p++}else if(b.isSpotLight){const E=i.spot[f];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(m),E.direction.setFromMatrixPosition(b.matrixWorld),r.setFromMatrixPosition(b.target.matrixWorld),E.direction.sub(r),E.direction.transformDirection(m),f++}else if(b.isRectAreaLight){const E=i.rectArea[g];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(m),a.identity(),s.copy(b.matrixWorld),s.premultiply(m),a.extractRotation(s),E.halfWidth.set(b.width*.5,0,0),E.halfHeight.set(0,b.height*.5,0),E.halfWidth.applyMatrix4(a),E.halfHeight.applyMatrix4(a),g++}else if(b.isPointLight){const E=i.point[h];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(m),h++}else if(b.isHemisphereLight){const E=i.hemi[v];E.direction.setFromMatrixPosition(b.matrixWorld),E.direction.transformDirection(m),v++}}}return{setup:o,setupView:l,state:i}}function So(n){const e=new Vp(n),t=[],i=[];function r(u){c.camera=u,t.length=0,i.length=0}function s(u){t.push(u)}function a(u){i.push(u)}function o(){e.setup(t)}function l(u){e.setupView(t,u)}const c={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function kp(n){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new So(n),e.set(r,[o])):s>=a.length?(o=new So(n),a.push(o)):o=a[s],o}function i(){e=new WeakMap}return{get:t,dispose:i}}const Hp=`void main() {
3998
+ `+ce)}else G!==""?Ie("WebGLProgram: Program Info Log:",G):(V===""||U==="")&&(Y=!1);Y&&(w.diagnostics={runnable:K,programLog:G,vertexShader:{log:V,prefix:m},fragmentShader:{log:U,prefix:u}})}r.deleteShader(R),r.deleteShader(A),x=new ur(r,v),y=vp(r,v)}let x;this.getUniforms=function(){return x===void 0&&C(this),x};let y;this.getAttributes=function(){return y===void 0&&C(this),y};let z=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return z===!1&&(z=r.getProgramParameter(v,cp)),z},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=hp++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=R,this.fragmentShader=A,this}let Fp=0;class Up{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new Op(e),t.set(e,i)),i}}class Op{constructor(e){this.id=Fp++,this.code=e,this.usedTimes=0}}function Bp(n,e,t,i,r,s){const a=new fl,o=new Up,l=new Set,c=[],d=new Map,p=i.logarithmicDepthBuffer;let h=i.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(x){return l.add(x),x===0?"uv":`uv${x}`}function v(x,y,z,w,F){const B=w.fog,I=F.geometry,G=x.isMeshStandardMaterial||x.isMeshLambertMaterial||x.isMeshPhongMaterial?w.environment:null,V=x.isMeshStandardMaterial||x.isMeshLambertMaterial&&!x.envMap||x.isMeshPhongMaterial&&!x.envMap,U=e.get(x.envMap||G,V),K=U&&U.mapping===xr?U.image.height:null,Y=f[x.type];x.precision!==null&&(h=i.getMaxPrecision(x.precision),h!==x.precision&&Ie("WebGLProgram.getParameters:",x.precision,"not supported, using",h,"instead."));const se=I.morphAttributes.position||I.morphAttributes.normal||I.morphAttributes.color,ce=se!==void 0?se.length:0;let le=0;I.morphAttributes.position!==void 0&&(le=1),I.morphAttributes.normal!==void 0&&(le=2),I.morphAttributes.color!==void 0&&(le=3);let we,Ye,He,Z;if(Y){const Je=jt[Y];we=Je.vertexShader,Ye=Je.fragmentShader}else we=x.vertexShader,Ye=x.fragmentShader,o.update(x),He=o.getVertexShaderID(x),Z=o.getFragmentShaderID(x);const te=n.getRenderTarget(),re=n.state.buffers.depth.getReversed(),Le=F.isInstancedMesh===!0,Ae=F.isBatchedMesh===!0,Re=!!x.map,ot=!!x.matcap,ke=!!U,$e=!!x.aoMap,Ze=!!x.lightMap,Ne=!!x.bumpMap,st=!!x.normalMap,P=!!x.displacementMap,at=!!x.emissiveMap,De=!!x.metalnessMap,Oe=!!x.roughnessMap,ge=x.anisotropy>0,T=x.clearcoat>0,_=x.dispersion>0,N=x.iridescence>0,$=x.sheen>0,J=x.transmission>0,q=ge&&!!x.anisotropyMap,_e=T&&!!x.clearcoatMap,ae=T&&!!x.clearcoatNormalMap,Te=T&&!!x.clearcoatRoughnessMap,Ce=N&&!!x.iridescenceMap,Q=N&&!!x.iridescenceThicknessMap,ne=$&&!!x.sheenColorMap,xe=$&&!!x.sheenRoughnessMap,Me=!!x.specularMap,fe=!!x.specularColorMap,Ge=!!x.specularIntensityMap,L=J&&!!x.transmissionMap,oe=J&&!!x.thicknessMap,ie=!!x.gradientMap,me=!!x.alphaMap,ee=x.alphaTest>0,j=!!x.alphaHash,ve=!!x.extensions;let Fe=$t;x.toneMapped&&(te===null||te.isXRRenderTarget===!0)&&(Fe=n.toneMapping);const rt={shaderID:Y,shaderType:x.type,shaderName:x.name,vertexShader:we,fragmentShader:Ye,defines:x.defines,customVertexShaderID:He,customFragmentShaderID:Z,isRawShaderMaterial:x.isRawShaderMaterial===!0,glslVersion:x.glslVersion,precision:h,batching:Ae,batchingColor:Ae&&F._colorsTexture!==null,instancing:Le,instancingColor:Le&&F.instanceColor!==null,instancingMorph:Le&&F.morphTexture!==null,outputColorSpace:te===null?n.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:kn,alphaToCoverage:!!x.alphaToCoverage,map:Re,matcap:ot,envMap:ke,envMapMode:ke&&U.mapping,envMapCubeUVHeight:K,aoMap:$e,lightMap:Ze,bumpMap:Ne,normalMap:st,displacementMap:P,emissiveMap:at,normalMapObjectSpace:st&&x.normalMapType===Tc,normalMapTangentSpace:st&&x.normalMapType===bc,metalnessMap:De,roughnessMap:Oe,anisotropy:ge,anisotropyMap:q,clearcoat:T,clearcoatMap:_e,clearcoatNormalMap:ae,clearcoatRoughnessMap:Te,dispersion:_,iridescence:N,iridescenceMap:Ce,iridescenceThicknessMap:Q,sheen:$,sheenColorMap:ne,sheenRoughnessMap:xe,specularMap:Me,specularColorMap:fe,specularIntensityMap:Ge,transmission:J,transmissionMap:L,thicknessMap:oe,gradientMap:ie,opaque:x.transparent===!1&&x.blending===Gn&&x.alphaToCoverage===!1,alphaMap:me,alphaTest:ee,alphaHash:j,combine:x.combine,mapUv:Re&&g(x.map.channel),aoMapUv:$e&&g(x.aoMap.channel),lightMapUv:Ze&&g(x.lightMap.channel),bumpMapUv:Ne&&g(x.bumpMap.channel),normalMapUv:st&&g(x.normalMap.channel),displacementMapUv:P&&g(x.displacementMap.channel),emissiveMapUv:at&&g(x.emissiveMap.channel),metalnessMapUv:De&&g(x.metalnessMap.channel),roughnessMapUv:Oe&&g(x.roughnessMap.channel),anisotropyMapUv:q&&g(x.anisotropyMap.channel),clearcoatMapUv:_e&&g(x.clearcoatMap.channel),clearcoatNormalMapUv:ae&&g(x.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Te&&g(x.clearcoatRoughnessMap.channel),iridescenceMapUv:Ce&&g(x.iridescenceMap.channel),iridescenceThicknessMapUv:Q&&g(x.iridescenceThicknessMap.channel),sheenColorMapUv:ne&&g(x.sheenColorMap.channel),sheenRoughnessMapUv:xe&&g(x.sheenRoughnessMap.channel),specularMapUv:Me&&g(x.specularMap.channel),specularColorMapUv:fe&&g(x.specularColorMap.channel),specularIntensityMapUv:Ge&&g(x.specularIntensityMap.channel),transmissionMapUv:L&&g(x.transmissionMap.channel),thicknessMapUv:oe&&g(x.thicknessMap.channel),alphaMapUv:me&&g(x.alphaMap.channel),vertexTangents:!!I.attributes.tangent&&(st||ge),vertexColors:x.vertexColors,vertexAlphas:x.vertexColors===!0&&!!I.attributes.color&&I.attributes.color.itemSize===4,pointsUvs:F.isPoints===!0&&!!I.attributes.uv&&(Re||me),fog:!!B,useFog:x.fog===!0,fogExp2:!!B&&B.isFogExp2,flatShading:x.wireframe===!1&&(x.flatShading===!0||I.attributes.normal===void 0&&st===!1&&(x.isMeshLambertMaterial||x.isMeshPhongMaterial||x.isMeshStandardMaterial||x.isMeshPhysicalMaterial)),sizeAttenuation:x.sizeAttenuation===!0,logarithmicDepthBuffer:p,reversedDepthBuffer:re,skinning:F.isSkinnedMesh===!0,morphTargets:I.morphAttributes.position!==void 0,morphNormals:I.morphAttributes.normal!==void 0,morphColors:I.morphAttributes.color!==void 0,morphTargetsCount:ce,morphTextureStride:le,numDirLights:y.directional.length,numPointLights:y.point.length,numSpotLights:y.spot.length,numSpotLightMaps:y.spotLightMap.length,numRectAreaLights:y.rectArea.length,numHemiLights:y.hemi.length,numDirLightShadows:y.directionalShadowMap.length,numPointLightShadows:y.pointShadowMap.length,numSpotLightShadows:y.spotShadowMap.length,numSpotLightShadowsWithMaps:y.numSpotLightShadowsWithMaps,numLightProbes:y.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:x.dithering,shadowMapEnabled:n.shadowMap.enabled&&z.length>0,shadowMapType:n.shadowMap.type,toneMapping:Fe,decodeVideoTexture:Re&&x.map.isVideoTexture===!0&&Xe.getTransfer(x.map.colorSpace)===Qe,decodeVideoTextureEmissive:at&&x.emissiveMap.isVideoTexture===!0&&Xe.getTransfer(x.emissiveMap.colorSpace)===Qe,premultipliedAlpha:x.premultipliedAlpha,doubleSided:x.side===cn,flipSided:x.side===At,useDepthPacking:x.depthPacking>=0,depthPacking:x.depthPacking||0,index0AttributeName:x.index0AttributeName,extensionClipCullDistance:ve&&x.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(ve&&x.extensions.multiDraw===!0||Ae)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:x.customProgramCacheKey()};return rt.vertexUv1s=l.has(1),rt.vertexUv2s=l.has(2),rt.vertexUv3s=l.has(3),l.clear(),rt}function m(x){const y=[];if(x.shaderID?y.push(x.shaderID):(y.push(x.customVertexShaderID),y.push(x.customFragmentShaderID)),x.defines!==void 0)for(const z in x.defines)y.push(z),y.push(x.defines[z]);return x.isRawShaderMaterial===!1&&(u(y,x),S(y,x),y.push(n.outputColorSpace)),y.push(x.customProgramCacheKey),y.join()}function u(x,y){x.push(y.precision),x.push(y.outputColorSpace),x.push(y.envMapMode),x.push(y.envMapCubeUVHeight),x.push(y.mapUv),x.push(y.alphaMapUv),x.push(y.lightMapUv),x.push(y.aoMapUv),x.push(y.bumpMapUv),x.push(y.normalMapUv),x.push(y.displacementMapUv),x.push(y.emissiveMapUv),x.push(y.metalnessMapUv),x.push(y.roughnessMapUv),x.push(y.anisotropyMapUv),x.push(y.clearcoatMapUv),x.push(y.clearcoatNormalMapUv),x.push(y.clearcoatRoughnessMapUv),x.push(y.iridescenceMapUv),x.push(y.iridescenceThicknessMapUv),x.push(y.sheenColorMapUv),x.push(y.sheenRoughnessMapUv),x.push(y.specularMapUv),x.push(y.specularColorMapUv),x.push(y.specularIntensityMapUv),x.push(y.transmissionMapUv),x.push(y.thicknessMapUv),x.push(y.combine),x.push(y.fogExp2),x.push(y.sizeAttenuation),x.push(y.morphTargetsCount),x.push(y.morphAttributeCount),x.push(y.numDirLights),x.push(y.numPointLights),x.push(y.numSpotLights),x.push(y.numSpotLightMaps),x.push(y.numHemiLights),x.push(y.numRectAreaLights),x.push(y.numDirLightShadows),x.push(y.numPointLightShadows),x.push(y.numSpotLightShadows),x.push(y.numSpotLightShadowsWithMaps),x.push(y.numLightProbes),x.push(y.shadowMapType),x.push(y.toneMapping),x.push(y.numClippingPlanes),x.push(y.numClipIntersection),x.push(y.depthPacking)}function S(x,y){a.disableAll(),y.instancing&&a.enable(0),y.instancingColor&&a.enable(1),y.instancingMorph&&a.enable(2),y.matcap&&a.enable(3),y.envMap&&a.enable(4),y.normalMapObjectSpace&&a.enable(5),y.normalMapTangentSpace&&a.enable(6),y.clearcoat&&a.enable(7),y.iridescence&&a.enable(8),y.alphaTest&&a.enable(9),y.vertexColors&&a.enable(10),y.vertexAlphas&&a.enable(11),y.vertexUv1s&&a.enable(12),y.vertexUv2s&&a.enable(13),y.vertexUv3s&&a.enable(14),y.vertexTangents&&a.enable(15),y.anisotropy&&a.enable(16),y.alphaHash&&a.enable(17),y.batching&&a.enable(18),y.dispersion&&a.enable(19),y.batchingColor&&a.enable(20),y.gradientMap&&a.enable(21),x.push(a.mask),a.disableAll(),y.fog&&a.enable(0),y.useFog&&a.enable(1),y.flatShading&&a.enable(2),y.logarithmicDepthBuffer&&a.enable(3),y.reversedDepthBuffer&&a.enable(4),y.skinning&&a.enable(5),y.morphTargets&&a.enable(6),y.morphNormals&&a.enable(7),y.morphColors&&a.enable(8),y.premultipliedAlpha&&a.enable(9),y.shadowMapEnabled&&a.enable(10),y.doubleSided&&a.enable(11),y.flipSided&&a.enable(12),y.useDepthPacking&&a.enable(13),y.dithering&&a.enable(14),y.transmission&&a.enable(15),y.sheen&&a.enable(16),y.opaque&&a.enable(17),y.pointsUvs&&a.enable(18),y.decodeVideoTexture&&a.enable(19),y.decodeVideoTextureEmissive&&a.enable(20),y.alphaToCoverage&&a.enable(21),x.push(a.mask)}function b(x){const y=f[x.type];let z;if(y){const w=jt[y];z=ch.clone(w.uniforms)}else z=x.uniforms;return z}function E(x,y){let z=d.get(y);return z!==void 0?++z.usedTimes:(z=new Np(n,y,x,r),c.push(z),d.set(y,z)),z}function R(x){if(--x.usedTimes===0){const y=c.indexOf(x);c[y]=c[c.length-1],c.pop(),d.delete(x.cacheKey),x.destroy()}}function A(x){o.remove(x)}function C(){o.dispose()}return{getParameters:v,getProgramCacheKey:m,getUniforms:b,acquireProgram:E,releaseProgram:R,releaseShaderCache:A,programs:c,dispose:C}}function zp(){let n=new WeakMap;function e(a){return n.has(a)}function t(a){let o=n.get(a);return o===void 0&&(o={},n.set(a,o)),o}function i(a){n.delete(a)}function r(a,o,l){n.get(a)[o]=l}function s(){n=new WeakMap}return{has:e,get:t,remove:i,update:r,dispose:s}}function Gp(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.materialVariant!==e.materialVariant?n.materialVariant-e.materialVariant:n.z!==e.z?n.z-e.z:n.id-e.id}function Mo(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function So(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function a(h){let f=0;return h.isInstancedMesh&&(f+=2),h.isSkinnedMesh&&(f+=1),f}function o(h,f,g,v,m,u){let S=n[e];return S===void 0?(S={id:h.id,object:h,geometry:f,material:g,materialVariant:a(h),groupOrder:v,renderOrder:h.renderOrder,z:m,group:u},n[e]=S):(S.id=h.id,S.object=h,S.geometry=f,S.material=g,S.materialVariant=a(h),S.groupOrder=v,S.renderOrder=h.renderOrder,S.z=m,S.group=u),e++,S}function l(h,f,g,v,m,u){const S=o(h,f,g,v,m,u);g.transmission>0?i.push(S):g.transparent===!0?r.push(S):t.push(S)}function c(h,f,g,v,m,u){const S=o(h,f,g,v,m,u);g.transmission>0?i.unshift(S):g.transparent===!0?r.unshift(S):t.unshift(S)}function d(h,f){t.length>1&&t.sort(h||Gp),i.length>1&&i.sort(f||Mo),r.length>1&&r.sort(f||Mo)}function p(){for(let h=e,f=n.length;h<f;h++){const g=n[h];if(g.id===null)break;g.id=null,g.object=null,g.geometry=null,g.material=null,g.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:l,unshift:c,finish:p,sort:d}}function Vp(){let n=new WeakMap;function e(i,r){const s=n.get(i);let a;return s===void 0?(a=new So,n.set(i,[a])):r>=s.length?(a=new So,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function kp(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new W,color:new nt};break;case"SpotLight":t={position:new W,direction:new W,color:new nt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new W,color:new nt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new W,skyColor:new nt,groundColor:new nt};break;case"RectAreaLight":t={color:new nt,position:new W,halfWidth:new W,halfHeight:new W};break}return n[e.id]=t,t}}}function Hp(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let Wp=0;function Xp(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function jp(n){const e=new kp,t=Hp(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new W);const r=new W,s=new ut,a=new ut;function o(c){let d=0,p=0,h=0;for(let y=0;y<9;y++)i.probe[y].set(0,0,0);let f=0,g=0,v=0,m=0,u=0,S=0,b=0,E=0,R=0,A=0,C=0;c.sort(Xp);for(let y=0,z=c.length;y<z;y++){const w=c[y],F=w.color,B=w.intensity,I=w.distance;let G=null;if(w.shadow&&w.shadow.map&&(w.shadow.map.texture.format===di?G=w.shadow.map.texture:G=w.shadow.map.depthTexture||w.shadow.map.texture),w.isAmbientLight)d+=F.r*B,p+=F.g*B,h+=F.b*B;else if(w.isLightProbe){for(let V=0;V<9;V++)i.probe[V].addScaledVector(w.sh.coefficients[V],B);C++}else if(w.isDirectionalLight){const V=e.get(w);if(V.color.copy(w.color).multiplyScalar(w.intensity),w.castShadow){const U=w.shadow,K=t.get(w);K.shadowIntensity=U.intensity,K.shadowBias=U.bias,K.shadowNormalBias=U.normalBias,K.shadowRadius=U.radius,K.shadowMapSize=U.mapSize,i.directionalShadow[f]=K,i.directionalShadowMap[f]=G,i.directionalShadowMatrix[f]=w.shadow.matrix,S++}i.directional[f]=V,f++}else if(w.isSpotLight){const V=e.get(w);V.position.setFromMatrixPosition(w.matrixWorld),V.color.copy(F).multiplyScalar(B),V.distance=I,V.coneCos=Math.cos(w.angle),V.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),V.decay=w.decay,i.spot[v]=V;const U=w.shadow;if(w.map&&(i.spotLightMap[R]=w.map,R++,U.updateMatrices(w),w.castShadow&&A++),i.spotLightMatrix[v]=U.matrix,w.castShadow){const K=t.get(w);K.shadowIntensity=U.intensity,K.shadowBias=U.bias,K.shadowNormalBias=U.normalBias,K.shadowRadius=U.radius,K.shadowMapSize=U.mapSize,i.spotShadow[v]=K,i.spotShadowMap[v]=G,E++}v++}else if(w.isRectAreaLight){const V=e.get(w);V.color.copy(F).multiplyScalar(B),V.halfWidth.set(w.width*.5,0,0),V.halfHeight.set(0,w.height*.5,0),i.rectArea[m]=V,m++}else if(w.isPointLight){const V=e.get(w);if(V.color.copy(w.color).multiplyScalar(w.intensity),V.distance=w.distance,V.decay=w.decay,w.castShadow){const U=w.shadow,K=t.get(w);K.shadowIntensity=U.intensity,K.shadowBias=U.bias,K.shadowNormalBias=U.normalBias,K.shadowRadius=U.radius,K.shadowMapSize=U.mapSize,K.shadowCameraNear=U.camera.near,K.shadowCameraFar=U.camera.far,i.pointShadow[g]=K,i.pointShadowMap[g]=G,i.pointShadowMatrix[g]=w.shadow.matrix,b++}i.point[g]=V,g++}else if(w.isHemisphereLight){const V=e.get(w);V.skyColor.copy(w.color).multiplyScalar(B),V.groundColor.copy(w.groundColor).multiplyScalar(B),i.hemi[u]=V,u++}}m>0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=he.LTC_FLOAT_1,i.rectAreaLTC2=he.LTC_FLOAT_2):(i.rectAreaLTC1=he.LTC_HALF_1,i.rectAreaLTC2=he.LTC_HALF_2)),i.ambient[0]=d,i.ambient[1]=p,i.ambient[2]=h;const x=i.hash;(x.directionalLength!==f||x.pointLength!==g||x.spotLength!==v||x.rectAreaLength!==m||x.hemiLength!==u||x.numDirectionalShadows!==S||x.numPointShadows!==b||x.numSpotShadows!==E||x.numSpotMaps!==R||x.numLightProbes!==C)&&(i.directional.length=f,i.spot.length=v,i.rectArea.length=m,i.point.length=g,i.hemi.length=u,i.directionalShadow.length=S,i.directionalShadowMap.length=S,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=E,i.spotShadowMap.length=E,i.directionalShadowMatrix.length=S,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=E+R-A,i.spotLightMap.length=R,i.numSpotLightShadowsWithMaps=A,i.numLightProbes=C,x.directionalLength=f,x.pointLength=g,x.spotLength=v,x.rectAreaLength=m,x.hemiLength=u,x.numDirectionalShadows=S,x.numPointShadows=b,x.numSpotShadows=E,x.numSpotMaps=R,x.numLightProbes=C,i.version=Wp++)}function l(c,d){let p=0,h=0,f=0,g=0,v=0;const m=d.matrixWorldInverse;for(let u=0,S=c.length;u<S;u++){const b=c[u];if(b.isDirectionalLight){const E=i.directional[p];E.direction.setFromMatrixPosition(b.matrixWorld),r.setFromMatrixPosition(b.target.matrixWorld),E.direction.sub(r),E.direction.transformDirection(m),p++}else if(b.isSpotLight){const E=i.spot[f];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(m),E.direction.setFromMatrixPosition(b.matrixWorld),r.setFromMatrixPosition(b.target.matrixWorld),E.direction.sub(r),E.direction.transformDirection(m),f++}else if(b.isRectAreaLight){const E=i.rectArea[g];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(m),a.identity(),s.copy(b.matrixWorld),s.premultiply(m),a.extractRotation(s),E.halfWidth.set(b.width*.5,0,0),E.halfHeight.set(0,b.height*.5,0),E.halfWidth.applyMatrix4(a),E.halfHeight.applyMatrix4(a),g++}else if(b.isPointLight){const E=i.point[h];E.position.setFromMatrixPosition(b.matrixWorld),E.position.applyMatrix4(m),h++}else if(b.isHemisphereLight){const E=i.hemi[v];E.direction.setFromMatrixPosition(b.matrixWorld),E.direction.transformDirection(m),v++}}}return{setup:o,setupView:l,state:i}}function Eo(n){const e=new jp(n),t=[],i=[];function r(d){c.camera=d,t.length=0,i.length=0}function s(d){t.push(d)}function a(d){i.push(d)}function o(){e.setup(t)}function l(d){e.setupView(t,d)}const c={lightsArray:t,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function qp(n){let e=new WeakMap;function t(r,s=0){const a=e.get(r);let o;return a===void 0?(o=new Eo(n),e.set(r,[o])):s>=a.length?(o=new Eo(n),a.push(o)):o=a[s],o}function i(){e=new WeakMap}return{get:t,dispose:i}}const Yp=`void main() {
3999
3999
  gl_Position = vec4( position, 1.0 );
4000
- }`,Wp=`uniform sampler2D shadow_pass;
4000
+ }`,$p=`uniform sampler2D shadow_pass;
4001
4001
  uniform vec2 resolution;
4002
4002
  uniform float radius;
4003
4003
  void main() {
@@ -4022,12 +4022,12 @@ void main() {
4022
4022
  squared_mean = squared_mean / samples;
4023
4023
  float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4024
4024
  gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4025
- }`,Xp=[new W(1,0,0),new W(-1,0,0),new W(0,1,0),new W(0,-1,0),new W(0,0,1),new W(0,0,-1)],qp=[new W(0,-1,0),new W(0,-1,0),new W(0,0,1),new W(0,0,-1),new W(0,-1,0),new W(0,-1,0)],Eo=new dt,bi=new W,is=new W;function jp(n,e,t){let i=new fl;const r=new Ke,s=new Ke,a=new ct,o=new oh,l=new lh,c={},u=t.maxTextureSize,p={[An]:At,[At]:An,[cn]:cn},h=new Qt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ke},radius:{value:4}},vertexShader:Hp,fragmentShader:Wp}),f=h.clone();f.defines.HORIZONTAL_PASS=1;const g=new en;g.setAttribute("position",new Vt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Jt(g,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=or;let d=this.type;this.render=function(A,C,x){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||A.length===0)return;this.type===Zl&&(Ie("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=or);const y=n.getRenderTarget(),z=n.getActiveCubeFace(),w=n.getActiveMipmapLevel(),F=n.state;F.setBlending(un),F.buffers.depth.getReversed()===!0?F.buffers.color.setClear(0,0,0,0):F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const B=d!==this.type;B&&C.traverse(function(I){I.material&&(Array.isArray(I.material)?I.material.forEach(G=>G.needsUpdate=!0):I.material.needsUpdate=!0)});for(let I=0,G=A.length;I<G;I++){const V=A[I],U=V.shadow;if(U===void 0){Ie("WebGLShadowMap:",V,"has no shadow.");continue}if(U.autoUpdate===!1&&U.needsUpdate===!1)continue;r.copy(U.mapSize);const K=U.getFrameExtents();r.multiply(K),s.copy(U.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/K.x),r.x=s.x*K.x,U.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/K.y),r.y=s.y*K.y,U.mapSize.y=s.y));const Y=n.state.buffers.depth.getReversed();if(U.camera._reversedDepth=Y,U.map===null||B===!0){if(U.map!==null&&(U.map.depthTexture!==null&&(U.map.depthTexture.dispose(),U.map.depthTexture=null),U.map.dispose()),this.type===Ti){if(V.isPointLight){Ie("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}U.map=new Zt(r.x,r.y,{format:ui,type:pn,minFilter:Et,magFilter:Et,generateMipmaps:!1}),U.map.texture.name=V.name+".shadowMap",U.map.depthTexture=new Di(r.x,r.y,jt),U.map.depthTexture.name=V.name+".shadowMapDepth",U.map.depthTexture.format=mn,U.map.depthTexture.compareFunction=null,U.map.depthTexture.minFilter=xt,U.map.depthTexture.magFilter=xt}else V.isPointLight?(U.map=new Ml(r.x),U.map.depthTexture=new nh(r.x,Kt)):(U.map=new Zt(r.x,r.y),U.map.depthTexture=new Di(r.x,r.y,Kt)),U.map.depthTexture.name=V.name+".shadowMap",U.map.depthTexture.format=mn,this.type===or?(U.map.depthTexture.compareFunction=Y?ua:ha,U.map.depthTexture.minFilter=Et,U.map.depthTexture.magFilter=Et):(U.map.depthTexture.compareFunction=null,U.map.depthTexture.minFilter=xt,U.map.depthTexture.magFilter=xt);U.camera.updateProjectionMatrix()}const se=U.map.isWebGLCubeRenderTarget?6:1;for(let ce=0;ce<se;ce++){if(U.map.isWebGLCubeRenderTarget)n.setRenderTarget(U.map,ce),n.clear();else{ce===0&&(n.setRenderTarget(U.map),n.clear());const le=U.getViewport(ce);a.set(s.x*le.x,s.y*le.y,s.x*le.z,s.y*le.w),F.viewport(a)}if(V.isPointLight){const le=U.camera,we=U.matrix,Ye=V.distance||le.far;Ye!==le.far&&(le.far=Ye,le.updateProjectionMatrix()),bi.setFromMatrixPosition(V.matrixWorld),le.position.copy(bi),is.copy(le.position),is.add(Xp[ce]),le.up.copy(qp[ce]),le.lookAt(is),le.updateMatrixWorld(),we.makeTranslation(-bi.x,-bi.y,-bi.z),Eo.multiplyMatrices(le.projectionMatrix,le.matrixWorldInverse),U._frustum.setFromProjectionMatrix(Eo,le.coordinateSystem,le.reversedDepth)}else U.updateMatrices(V);i=U.getFrustum(),E(C,x,U.camera,V,this.type)}U.isPointLightShadow!==!0&&this.type===Ti&&S(U,x),U.needsUpdate=!1}d=this.type,m.needsUpdate=!1,n.setRenderTarget(y,z,w)};function S(A,C){const x=e.update(v);h.defines.VSM_SAMPLES!==A.blurSamples&&(h.defines.VSM_SAMPLES=A.blurSamples,f.defines.VSM_SAMPLES=A.blurSamples,h.needsUpdate=!0,f.needsUpdate=!0),A.mapPass===null&&(A.mapPass=new Zt(r.x,r.y,{format:ui,type:pn})),h.uniforms.shadow_pass.value=A.map.depthTexture,h.uniforms.resolution.value=A.mapSize,h.uniforms.radius.value=A.radius,n.setRenderTarget(A.mapPass),n.clear(),n.renderBufferDirect(C,null,x,h,v,null),f.uniforms.shadow_pass.value=A.mapPass.texture,f.uniforms.resolution.value=A.mapSize,f.uniforms.radius.value=A.radius,n.setRenderTarget(A.map),n.clear(),n.renderBufferDirect(C,null,x,f,v,null)}function b(A,C,x,y){let z=null;const w=x.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(w!==void 0)z=w;else if(z=x.isPointLight===!0?l:o,n.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){const F=z.uuid,B=C.uuid;let I=c[F];I===void 0&&(I={},c[F]=I);let G=I[B];G===void 0&&(G=z.clone(),I[B]=G,C.addEventListener("dispose",R)),z=G}if(z.visible=C.visible,z.wireframe=C.wireframe,y===Ti?z.side=C.shadowSide!==null?C.shadowSide:C.side:z.side=C.shadowSide!==null?C.shadowSide:p[C.side],z.alphaMap=C.alphaMap,z.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,z.map=C.map,z.clipShadows=C.clipShadows,z.clippingPlanes=C.clippingPlanes,z.clipIntersection=C.clipIntersection,z.displacementMap=C.displacementMap,z.displacementScale=C.displacementScale,z.displacementBias=C.displacementBias,z.wireframeLinewidth=C.wireframeLinewidth,z.linewidth=C.linewidth,x.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const F=n.properties.get(z);F.light=x}return z}function E(A,C,x,y,z){if(A.visible===!1)return;if(A.layers.test(C.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&z===Ti)&&(!A.frustumCulled||i.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,A.matrixWorld);const B=e.update(A),I=A.material;if(Array.isArray(I)){const G=B.groups;for(let V=0,U=G.length;V<U;V++){const K=G[V],Y=I[K.materialIndex];if(Y&&Y.visible){const se=b(A,Y,y,z);A.onBeforeShadow(n,A,C,x,B,se,K),n.renderBufferDirect(x,null,B,se,A,K),A.onAfterShadow(n,A,C,x,B,se,K)}}}else if(I.visible){const G=b(A,I,y,z);A.onBeforeShadow(n,A,C,x,B,G,null),n.renderBufferDirect(x,null,B,G,A,null),A.onAfterShadow(n,A,C,x,B,G,null)}}const F=A.children;for(let B=0,I=F.length;B<I;B++)E(F[B],C,x,y,z)}function R(A){A.target.removeEventListener("dispose",R);for(const x in c){const y=c[x],z=A.target.uuid;z in y&&(y[z].dispose(),delete y[z])}}}function Yp(n,e){function t(){let D=!1;const oe=new ct;let ie=null;const me=new ct(0,0,0,0);return{setMask:function(ee){ie!==ee&&!D&&(n.colorMask(ee,ee,ee,ee),ie=ee)},setLocked:function(ee){D=ee},setClear:function(ee,q,ve,Fe,rt){rt===!0&&(ee*=Fe,q*=Fe,ve*=Fe),oe.set(ee,q,ve,Fe),me.equals(oe)===!1&&(n.clearColor(ee,q,ve,Fe),me.copy(oe))},reset:function(){D=!1,ie=null,me.set(-1,0,0,0)}}}function i(){let D=!1,oe=!1,ie=null,me=null,ee=null;return{setReversed:function(q){if(oe!==q){const ve=e.get("EXT_clip_control");q?ve.clipControlEXT(ve.LOWER_LEFT_EXT,ve.ZERO_TO_ONE_EXT):ve.clipControlEXT(ve.LOWER_LEFT_EXT,ve.NEGATIVE_ONE_TO_ONE_EXT),oe=q;const Fe=ee;ee=null,this.setClear(Fe)}},getReversed:function(){return oe},setTest:function(q){q?te(n.DEPTH_TEST):re(n.DEPTH_TEST)},setMask:function(q){ie!==q&&!D&&(n.depthMask(q),ie=q)},setFunc:function(q){if(oe&&(q=Pc[q]),me!==q){switch(q){case hs:n.depthFunc(n.NEVER);break;case us:n.depthFunc(n.ALWAYS);break;case ds:n.depthFunc(n.LESS);break;case ci:n.depthFunc(n.LEQUAL);break;case fs:n.depthFunc(n.EQUAL);break;case ps:n.depthFunc(n.GEQUAL);break;case ms:n.depthFunc(n.GREATER);break;case gs:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}me=q}},setLocked:function(q){D=q},setClear:function(q){ee!==q&&(ee=q,oe&&(q=1-q),n.clearDepth(q))},reset:function(){D=!1,ie=null,me=null,ee=null,oe=!1}}}function r(){let D=!1,oe=null,ie=null,me=null,ee=null,q=null,ve=null,Fe=null,rt=null;return{setTest:function(Je){D||(Je?te(n.STENCIL_TEST):re(n.STENCIL_TEST))},setMask:function(Je){oe!==Je&&!D&&(n.stencilMask(Je),oe=Je)},setFunc:function(Je,tn,nn){(ie!==Je||me!==tn||ee!==nn)&&(n.stencilFunc(Je,tn,nn),ie=Je,me=tn,ee=nn)},setOp:function(Je,tn,nn){(q!==Je||ve!==tn||Fe!==nn)&&(n.stencilOp(Je,tn,nn),q=Je,ve=tn,Fe=nn)},setLocked:function(Je){D=Je},setClear:function(Je){rt!==Je&&(n.clearStencil(Je),rt=Je)},reset:function(){D=!1,oe=null,ie=null,me=null,ee=null,q=null,ve=null,Fe=null,rt=null}}}const s=new t,a=new i,o=new r,l=new WeakMap,c=new WeakMap;let u={},p={},h=new WeakMap,f=[],g=null,v=!1,m=null,d=null,S=null,b=null,E=null,R=null,A=null,C=new nt(0,0,0),x=0,y=!1,z=null,w=null,F=null,B=null,I=null;const G=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let V=!1,U=0;const K=n.getParameter(n.VERSION);K.indexOf("WebGL")!==-1?(U=parseFloat(/^WebGL (\d)/.exec(K)[1]),V=U>=1):K.indexOf("OpenGL ES")!==-1&&(U=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),V=U>=2);let Y=null,se={};const ce=n.getParameter(n.SCISSOR_BOX),le=n.getParameter(n.VIEWPORT),we=new ct().fromArray(ce),Ye=new ct().fromArray(le);function He(D,oe,ie,me){const ee=new Uint8Array(4),q=n.createTexture();n.bindTexture(D,q),n.texParameteri(D,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(D,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let ve=0;ve<ie;ve++)D===n.TEXTURE_3D||D===n.TEXTURE_2D_ARRAY?n.texImage3D(oe,0,n.RGBA,1,1,me,0,n.RGBA,n.UNSIGNED_BYTE,ee):n.texImage2D(oe+ve,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,ee);return q}const Z={};Z[n.TEXTURE_2D]=He(n.TEXTURE_2D,n.TEXTURE_2D,1),Z[n.TEXTURE_CUBE_MAP]=He(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),Z[n.TEXTURE_2D_ARRAY]=He(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Z[n.TEXTURE_3D]=He(n.TEXTURE_3D,n.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),te(n.DEPTH_TEST),a.setFunc(ci),Ne(!1),st(wa),te(n.CULL_FACE),$e(un);function te(D){u[D]!==!0&&(n.enable(D),u[D]=!0)}function re(D){u[D]!==!1&&(n.disable(D),u[D]=!1)}function Le(D,oe){return p[D]!==oe?(n.bindFramebuffer(D,oe),p[D]=oe,D===n.DRAW_FRAMEBUFFER&&(p[n.FRAMEBUFFER]=oe),D===n.FRAMEBUFFER&&(p[n.DRAW_FRAMEBUFFER]=oe),!0):!1}function Ae(D,oe){let ie=f,me=!1;if(D){ie=h.get(oe),ie===void 0&&(ie=[],h.set(oe,ie));const ee=D.textures;if(ie.length!==ee.length||ie[0]!==n.COLOR_ATTACHMENT0){for(let q=0,ve=ee.length;q<ve;q++)ie[q]=n.COLOR_ATTACHMENT0+q;ie.length=ee.length,me=!0}}else ie[0]!==n.BACK&&(ie[0]=n.BACK,me=!0);me&&n.drawBuffers(ie)}function Re(D){return g!==D?(n.useProgram(D),g=D,!0):!1}const ot={[Un]:n.FUNC_ADD,[Jl]:n.FUNC_SUBTRACT,[Ql]:n.FUNC_REVERSE_SUBTRACT};ot[ec]=n.MIN,ot[tc]=n.MAX;const ke={[nc]:n.ZERO,[ic]:n.ONE,[rc]:n.SRC_COLOR,[ls]:n.SRC_ALPHA,[hc]:n.SRC_ALPHA_SATURATE,[lc]:n.DST_COLOR,[ac]:n.DST_ALPHA,[sc]:n.ONE_MINUS_SRC_COLOR,[cs]:n.ONE_MINUS_SRC_ALPHA,[cc]:n.ONE_MINUS_DST_COLOR,[oc]:n.ONE_MINUS_DST_ALPHA,[uc]:n.CONSTANT_COLOR,[dc]:n.ONE_MINUS_CONSTANT_COLOR,[fc]:n.CONSTANT_ALPHA,[pc]:n.ONE_MINUS_CONSTANT_ALPHA};function $e(D,oe,ie,me,ee,q,ve,Fe,rt,Je){if(D===un){v===!0&&(re(n.BLEND),v=!1);return}if(v===!1&&(te(n.BLEND),v=!0),D!==Kl){if(D!==m||Je!==y){if((d!==Un||E!==Un)&&(n.blendEquation(n.FUNC_ADD),d=Un,E=Un),Je)switch(D){case Gn:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Ra:n.blendFunc(n.ONE,n.ONE);break;case Ca:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Pa:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:je("WebGLState: Invalid blending: ",D);break}else switch(D){case Gn:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Ra:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Ca:je("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Pa:je("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:je("WebGLState: Invalid blending: ",D);break}S=null,b=null,R=null,A=null,C.set(0,0,0),x=0,m=D,y=Je}return}ee=ee||oe,q=q||ie,ve=ve||me,(oe!==d||ee!==E)&&(n.blendEquationSeparate(ot[oe],ot[ee]),d=oe,E=ee),(ie!==S||me!==b||q!==R||ve!==A)&&(n.blendFuncSeparate(ke[ie],ke[me],ke[q],ke[ve]),S=ie,b=me,R=q,A=ve),(Fe.equals(C)===!1||rt!==x)&&(n.blendColor(Fe.r,Fe.g,Fe.b,rt),C.copy(Fe),x=rt),m=D,y=!1}function Ze(D,oe){D.side===cn?re(n.CULL_FACE):te(n.CULL_FACE);let ie=D.side===At;oe&&(ie=!ie),Ne(ie),D.blending===Gn&&D.transparent===!1?$e(un):$e(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.blendColor,D.blendAlpha,D.premultipliedAlpha),a.setFunc(D.depthFunc),a.setTest(D.depthTest),a.setMask(D.depthWrite),s.setMask(D.colorWrite);const me=D.stencilWrite;o.setTest(me),me&&(o.setMask(D.stencilWriteMask),o.setFunc(D.stencilFunc,D.stencilRef,D.stencilFuncMask),o.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),at(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),D.alphaToCoverage===!0?te(n.SAMPLE_ALPHA_TO_COVERAGE):re(n.SAMPLE_ALPHA_TO_COVERAGE)}function Ne(D){z!==D&&(D?n.frontFace(n.CW):n.frontFace(n.CCW),z=D)}function st(D){D!==Yl?(te(n.CULL_FACE),D!==w&&(D===wa?n.cullFace(n.BACK):D===$l?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):re(n.CULL_FACE),w=D}function P(D){D!==F&&(V&&n.lineWidth(D),F=D)}function at(D,oe,ie){D?(te(n.POLYGON_OFFSET_FILL),(B!==oe||I!==ie)&&(B=oe,I=ie,a.getReversed()&&(oe=-oe),n.polygonOffset(oe,ie))):re(n.POLYGON_OFFSET_FILL)}function Pe(D){D?te(n.SCISSOR_TEST):re(n.SCISSOR_TEST)}function Oe(D){D===void 0&&(D=n.TEXTURE0+G-1),Y!==D&&(n.activeTexture(D),Y=D)}function ge(D,oe,ie){ie===void 0&&(Y===null?ie=n.TEXTURE0+G-1:ie=Y);let me=se[ie];me===void 0&&(me={type:void 0,texture:void 0},se[ie]=me),(me.type!==D||me.texture!==oe)&&(Y!==ie&&(n.activeTexture(ie),Y=ie),n.bindTexture(D,oe||Z[D]),me.type=D,me.texture=oe)}function T(){const D=se[Y];D!==void 0&&D.type!==void 0&&(n.bindTexture(D.type,null),D.type=void 0,D.texture=void 0)}function _(){try{n.compressedTexImage2D(...arguments)}catch(D){je("WebGLState:",D)}}function N(){try{n.compressedTexImage3D(...arguments)}catch(D){je("WebGLState:",D)}}function $(){try{n.texSubImage2D(...arguments)}catch(D){je("WebGLState:",D)}}function J(){try{n.texSubImage3D(...arguments)}catch(D){je("WebGLState:",D)}}function j(){try{n.compressedTexSubImage2D(...arguments)}catch(D){je("WebGLState:",D)}}function _e(){try{n.compressedTexSubImage3D(...arguments)}catch(D){je("WebGLState:",D)}}function ae(){try{n.texStorage2D(...arguments)}catch(D){je("WebGLState:",D)}}function Te(){try{n.texStorage3D(...arguments)}catch(D){je("WebGLState:",D)}}function Ce(){try{n.texImage2D(...arguments)}catch(D){je("WebGLState:",D)}}function Q(){try{n.texImage3D(...arguments)}catch(D){je("WebGLState:",D)}}function ne(D){we.equals(D)===!1&&(n.scissor(D.x,D.y,D.z,D.w),we.copy(D))}function xe(D){Ye.equals(D)===!1&&(n.viewport(D.x,D.y,D.z,D.w),Ye.copy(D))}function Me(D,oe){let ie=c.get(oe);ie===void 0&&(ie=new WeakMap,c.set(oe,ie));let me=ie.get(D);me===void 0&&(me=n.getUniformBlockIndex(oe,D.name),ie.set(D,me))}function fe(D,oe){const me=c.get(oe).get(D);l.get(oe)!==me&&(n.uniformBlockBinding(oe,me,D.__bindingPointIndex),l.set(oe,me))}function Ge(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),a.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),u={},Y=null,se={},p={},h=new WeakMap,f=[],g=null,v=!1,m=null,d=null,S=null,b=null,E=null,R=null,A=null,C=new nt(0,0,0),x=0,y=!1,z=null,w=null,F=null,B=null,I=null,we.set(0,0,n.canvas.width,n.canvas.height),Ye.set(0,0,n.canvas.width,n.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:te,disable:re,bindFramebuffer:Le,drawBuffers:Ae,useProgram:Re,setBlending:$e,setMaterial:Ze,setFlipSided:Ne,setCullFace:st,setLineWidth:P,setPolygonOffset:at,setScissorTest:Pe,activeTexture:Oe,bindTexture:ge,unbindTexture:T,compressedTexImage2D:_,compressedTexImage3D:N,texImage2D:Ce,texImage3D:Q,updateUBOMapping:Me,uniformBlockBinding:fe,texStorage2D:ae,texStorage3D:Te,texSubImage2D:$,texSubImage3D:J,compressedTexSubImage2D:j,compressedTexSubImage3D:_e,scissor:ne,viewport:xe,reset:Ge}}function $p(n,e,t,i,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ke,u=new WeakMap;let p;const h=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(T,_){return f?new OffscreenCanvas(T,_):mr("canvas")}function v(T,_,N){let $=1;const J=ge(T);if((J.width>N||J.height>N)&&($=N/Math.max(J.width,J.height)),$<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){const j=Math.floor($*J.width),_e=Math.floor($*J.height);p===void 0&&(p=g(j,_e));const ae=_?g(j,_e):p;return ae.width=j,ae.height=_e,ae.getContext("2d").drawImage(T,0,0,j,_e),Ie("WebGLRenderer: Texture has been resized from ("+J.width+"x"+J.height+") to ("+j+"x"+_e+")."),ae}else return"data"in T&&Ie("WebGLRenderer: Image in DataTexture is too big ("+J.width+"x"+J.height+")."),T;return T}function m(T){return T.generateMipmaps}function d(T){n.generateMipmap(T)}function S(T){return T.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:T.isWebGL3DRenderTarget?n.TEXTURE_3D:T.isWebGLArrayRenderTarget||T.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function b(T,_,N,$,J=!1){if(T!==null){if(n[T]!==void 0)return n[T];Ie("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let j=_;if(_===n.RED&&(N===n.FLOAT&&(j=n.R32F),N===n.HALF_FLOAT&&(j=n.R16F),N===n.UNSIGNED_BYTE&&(j=n.R8)),_===n.RED_INTEGER&&(N===n.UNSIGNED_BYTE&&(j=n.R8UI),N===n.UNSIGNED_SHORT&&(j=n.R16UI),N===n.UNSIGNED_INT&&(j=n.R32UI),N===n.BYTE&&(j=n.R8I),N===n.SHORT&&(j=n.R16I),N===n.INT&&(j=n.R32I)),_===n.RG&&(N===n.FLOAT&&(j=n.RG32F),N===n.HALF_FLOAT&&(j=n.RG16F),N===n.UNSIGNED_BYTE&&(j=n.RG8)),_===n.RG_INTEGER&&(N===n.UNSIGNED_BYTE&&(j=n.RG8UI),N===n.UNSIGNED_SHORT&&(j=n.RG16UI),N===n.UNSIGNED_INT&&(j=n.RG32UI),N===n.BYTE&&(j=n.RG8I),N===n.SHORT&&(j=n.RG16I),N===n.INT&&(j=n.RG32I)),_===n.RGB_INTEGER&&(N===n.UNSIGNED_BYTE&&(j=n.RGB8UI),N===n.UNSIGNED_SHORT&&(j=n.RGB16UI),N===n.UNSIGNED_INT&&(j=n.RGB32UI),N===n.BYTE&&(j=n.RGB8I),N===n.SHORT&&(j=n.RGB16I),N===n.INT&&(j=n.RGB32I)),_===n.RGBA_INTEGER&&(N===n.UNSIGNED_BYTE&&(j=n.RGBA8UI),N===n.UNSIGNED_SHORT&&(j=n.RGBA16UI),N===n.UNSIGNED_INT&&(j=n.RGBA32UI),N===n.BYTE&&(j=n.RGBA8I),N===n.SHORT&&(j=n.RGBA16I),N===n.INT&&(j=n.RGBA32I)),_===n.RGB&&(N===n.UNSIGNED_INT_5_9_9_9_REV&&(j=n.RGB9_E5),N===n.UNSIGNED_INT_10F_11F_11F_REV&&(j=n.R11F_G11F_B10F)),_===n.RGBA){const _e=J?fr:Xe.getTransfer($);N===n.FLOAT&&(j=n.RGBA32F),N===n.HALF_FLOAT&&(j=n.RGBA16F),N===n.UNSIGNED_BYTE&&(j=_e===Qe?n.SRGB8_ALPHA8:n.RGBA8),N===n.UNSIGNED_SHORT_4_4_4_4&&(j=n.RGBA4),N===n.UNSIGNED_SHORT_5_5_5_1&&(j=n.RGB5_A1)}return(j===n.R16F||j===n.R32F||j===n.RG16F||j===n.RG32F||j===n.RGBA16F||j===n.RGBA32F)&&e.get("EXT_color_buffer_float"),j}function E(T,_){let N;return T?_===null||_===Kt||_===Pi?N=n.DEPTH24_STENCIL8:_===jt?N=n.DEPTH32F_STENCIL8:_===Ci&&(N=n.DEPTH24_STENCIL8,Ie("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):_===null||_===Kt||_===Pi?N=n.DEPTH_COMPONENT24:_===jt?N=n.DEPTH_COMPONENT32F:_===Ci&&(N=n.DEPTH_COMPONENT16),N}function R(T,_){return m(T)===!0||T.isFramebufferTexture&&T.minFilter!==xt&&T.minFilter!==Et?Math.log2(Math.max(_.width,_.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?_.mipmaps.length:1}function A(T){const _=T.target;_.removeEventListener("dispose",A),x(_),_.isVideoTexture&&u.delete(_)}function C(T){const _=T.target;_.removeEventListener("dispose",C),z(_)}function x(T){const _=i.get(T);if(_.__webglInit===void 0)return;const N=T.source,$=h.get(N);if($){const J=$[_.__cacheKey];J.usedTimes--,J.usedTimes===0&&y(T),Object.keys($).length===0&&h.delete(N)}i.remove(T)}function y(T){const _=i.get(T);n.deleteTexture(_.__webglTexture);const N=T.source,$=h.get(N);delete $[_.__cacheKey],a.memory.textures--}function z(T){const _=i.get(T);if(T.depthTexture&&(T.depthTexture.dispose(),i.remove(T.depthTexture)),T.isWebGLCubeRenderTarget)for(let $=0;$<6;$++){if(Array.isArray(_.__webglFramebuffer[$]))for(let J=0;J<_.__webglFramebuffer[$].length;J++)n.deleteFramebuffer(_.__webglFramebuffer[$][J]);else n.deleteFramebuffer(_.__webglFramebuffer[$]);_.__webglDepthbuffer&&n.deleteRenderbuffer(_.__webglDepthbuffer[$])}else{if(Array.isArray(_.__webglFramebuffer))for(let $=0;$<_.__webglFramebuffer.length;$++)n.deleteFramebuffer(_.__webglFramebuffer[$]);else n.deleteFramebuffer(_.__webglFramebuffer);if(_.__webglDepthbuffer&&n.deleteRenderbuffer(_.__webglDepthbuffer),_.__webglMultisampledFramebuffer&&n.deleteFramebuffer(_.__webglMultisampledFramebuffer),_.__webglColorRenderbuffer)for(let $=0;$<_.__webglColorRenderbuffer.length;$++)_.__webglColorRenderbuffer[$]&&n.deleteRenderbuffer(_.__webglColorRenderbuffer[$]);_.__webglDepthRenderbuffer&&n.deleteRenderbuffer(_.__webglDepthRenderbuffer)}const N=T.textures;for(let $=0,J=N.length;$<J;$++){const j=i.get(N[$]);j.__webglTexture&&(n.deleteTexture(j.__webglTexture),a.memory.textures--),i.remove(N[$])}i.remove(T)}let w=0;function F(){w=0}function B(){const T=w;return T>=r.maxTextures&&Ie("WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+r.maxTextures),w+=1,T}function I(T){const _=[];return _.push(T.wrapS),_.push(T.wrapT),_.push(T.wrapR||0),_.push(T.magFilter),_.push(T.minFilter),_.push(T.anisotropy),_.push(T.internalFormat),_.push(T.format),_.push(T.type),_.push(T.generateMipmaps),_.push(T.premultiplyAlpha),_.push(T.flipY),_.push(T.unpackAlignment),_.push(T.colorSpace),_.join()}function G(T,_){const N=i.get(T);if(T.isVideoTexture&&Pe(T),T.isRenderTargetTexture===!1&&T.isExternalTexture!==!0&&T.version>0&&N.__version!==T.version){const $=T.image;if($===null)Ie("WebGLRenderer: Texture marked for update but no image data found.");else if($.complete===!1)Ie("WebGLRenderer: Texture marked for update but image is incomplete");else{Z(N,T,_);return}}else T.isExternalTexture&&(N.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,N.__webglTexture,n.TEXTURE0+_)}function V(T,_){const N=i.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&N.__version!==T.version){Z(N,T,_);return}else T.isExternalTexture&&(N.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(n.TEXTURE_2D_ARRAY,N.__webglTexture,n.TEXTURE0+_)}function U(T,_){const N=i.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&N.__version!==T.version){Z(N,T,_);return}t.bindTexture(n.TEXTURE_3D,N.__webglTexture,n.TEXTURE0+_)}function K(T,_){const N=i.get(T);if(T.isCubeDepthTexture!==!0&&T.version>0&&N.__version!==T.version){te(N,T,_);return}t.bindTexture(n.TEXTURE_CUBE_MAP,N.__webglTexture,n.TEXTURE0+_)}const Y={[_s]:n.REPEAT,[hn]:n.CLAMP_TO_EDGE,[xs]:n.MIRRORED_REPEAT},se={[xt]:n.NEAREST,[_c]:n.NEAREST_MIPMAP_NEAREST,[Oi]:n.NEAREST_MIPMAP_LINEAR,[Et]:n.LINEAR,[wr]:n.LINEAR_MIPMAP_NEAREST,[Bn]:n.LINEAR_MIPMAP_LINEAR},ce={[Sc]:n.NEVER,[Ac]:n.ALWAYS,[Ec]:n.LESS,[ha]:n.LEQUAL,[yc]:n.EQUAL,[ua]:n.GEQUAL,[bc]:n.GREATER,[Tc]:n.NOTEQUAL};function le(T,_){if(_.type===jt&&e.has("OES_texture_float_linear")===!1&&(_.magFilter===Et||_.magFilter===wr||_.magFilter===Oi||_.magFilter===Bn||_.minFilter===Et||_.minFilter===wr||_.minFilter===Oi||_.minFilter===Bn)&&Ie("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(T,n.TEXTURE_WRAP_S,Y[_.wrapS]),n.texParameteri(T,n.TEXTURE_WRAP_T,Y[_.wrapT]),(T===n.TEXTURE_3D||T===n.TEXTURE_2D_ARRAY)&&n.texParameteri(T,n.TEXTURE_WRAP_R,Y[_.wrapR]),n.texParameteri(T,n.TEXTURE_MAG_FILTER,se[_.magFilter]),n.texParameteri(T,n.TEXTURE_MIN_FILTER,se[_.minFilter]),_.compareFunction&&(n.texParameteri(T,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(T,n.TEXTURE_COMPARE_FUNC,ce[_.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(_.magFilter===xt||_.minFilter!==Oi&&_.minFilter!==Bn||_.type===jt&&e.has("OES_texture_float_linear")===!1)return;if(_.anisotropy>1||i.get(_).__currentAnisotropy){const N=e.get("EXT_texture_filter_anisotropic");n.texParameterf(T,N.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,r.getMaxAnisotropy())),i.get(_).__currentAnisotropy=_.anisotropy}}}function we(T,_){let N=!1;T.__webglInit===void 0&&(T.__webglInit=!0,_.addEventListener("dispose",A));const $=_.source;let J=h.get($);J===void 0&&(J={},h.set($,J));const j=I(_);if(j!==T.__cacheKey){J[j]===void 0&&(J[j]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,N=!0),J[j].usedTimes++;const _e=J[T.__cacheKey];_e!==void 0&&(J[T.__cacheKey].usedTimes--,_e.usedTimes===0&&y(_)),T.__cacheKey=j,T.__webglTexture=J[j].texture}return N}function Ye(T,_,N){return Math.floor(Math.floor(T/N)/_)}function He(T,_,N,$){const j=T.updateRanges;if(j.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,_.width,_.height,N,$,_.data);else{j.sort((Q,ne)=>Q.start-ne.start);let _e=0;for(let Q=1;Q<j.length;Q++){const ne=j[_e],xe=j[Q],Me=ne.start+ne.count,fe=Ye(xe.start,_.width,4),Ge=Ye(ne.start,_.width,4);xe.start<=Me+1&&fe===Ge&&Ye(xe.start+xe.count-1,_.width,4)===fe?ne.count=Math.max(ne.count,xe.start+xe.count-ne.start):(++_e,j[_e]=xe)}j.length=_e+1;const ae=n.getParameter(n.UNPACK_ROW_LENGTH),Te=n.getParameter(n.UNPACK_SKIP_PIXELS),Ce=n.getParameter(n.UNPACK_SKIP_ROWS);n.pixelStorei(n.UNPACK_ROW_LENGTH,_.width);for(let Q=0,ne=j.length;Q<ne;Q++){const xe=j[Q],Me=Math.floor(xe.start/4),fe=Math.ceil(xe.count/4),Ge=Me%_.width,D=Math.floor(Me/_.width),oe=fe,ie=1;n.pixelStorei(n.UNPACK_SKIP_PIXELS,Ge),n.pixelStorei(n.UNPACK_SKIP_ROWS,D),t.texSubImage2D(n.TEXTURE_2D,0,Ge,D,oe,ie,N,$,_.data)}T.clearUpdateRanges(),n.pixelStorei(n.UNPACK_ROW_LENGTH,ae),n.pixelStorei(n.UNPACK_SKIP_PIXELS,Te),n.pixelStorei(n.UNPACK_SKIP_ROWS,Ce)}}function Z(T,_,N){let $=n.TEXTURE_2D;(_.isDataArrayTexture||_.isCompressedArrayTexture)&&($=n.TEXTURE_2D_ARRAY),_.isData3DTexture&&($=n.TEXTURE_3D);const J=we(T,_),j=_.source;t.bindTexture($,T.__webglTexture,n.TEXTURE0+N);const _e=i.get(j);if(j.version!==_e.__version||J===!0){t.activeTexture(n.TEXTURE0+N);const ae=Xe.getPrimaries(Xe.workingColorSpace),Te=_.colorSpace===bn?null:Xe.getPrimaries(_.colorSpace),Ce=_.colorSpace===bn||ae===Te?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,_.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,_.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ce);let Q=v(_.image,!1,r.maxTextureSize);Q=Oe(_,Q);const ne=s.convert(_.format,_.colorSpace),xe=s.convert(_.type);let Me=b(_.internalFormat,ne,xe,_.colorSpace,_.isVideoTexture);le($,_);let fe;const Ge=_.mipmaps,D=_.isVideoTexture!==!0,oe=_e.__version===void 0||J===!0,ie=j.dataReady,me=R(_,Q);if(_.isDepthTexture)Me=E(_.format===zn,_.type),oe&&(D?t.texStorage2D(n.TEXTURE_2D,1,Me,Q.width,Q.height):t.texImage2D(n.TEXTURE_2D,0,Me,Q.width,Q.height,0,ne,xe,null));else if(_.isDataTexture)if(Ge.length>0){D&&oe&&t.texStorage2D(n.TEXTURE_2D,me,Me,Ge[0].width,Ge[0].height);for(let ee=0,q=Ge.length;ee<q;ee++)fe=Ge[ee],D?ie&&t.texSubImage2D(n.TEXTURE_2D,ee,0,0,fe.width,fe.height,ne,xe,fe.data):t.texImage2D(n.TEXTURE_2D,ee,Me,fe.width,fe.height,0,ne,xe,fe.data);_.generateMipmaps=!1}else D?(oe&&t.texStorage2D(n.TEXTURE_2D,me,Me,Q.width,Q.height),ie&&He(_,Q,ne,xe)):t.texImage2D(n.TEXTURE_2D,0,Me,Q.width,Q.height,0,ne,xe,Q.data);else if(_.isCompressedTexture)if(_.isCompressedArrayTexture){D&&oe&&t.texStorage3D(n.TEXTURE_2D_ARRAY,me,Me,Ge[0].width,Ge[0].height,Q.depth);for(let ee=0,q=Ge.length;ee<q;ee++)if(fe=Ge[ee],_.format!==zt)if(ne!==null)if(D){if(ie)if(_.layerUpdates.size>0){const ve=Ja(fe.width,fe.height,_.format,_.type);for(const Fe of _.layerUpdates){const rt=fe.data.subarray(Fe*ve/fe.data.BYTES_PER_ELEMENT,(Fe+1)*ve/fe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,ee,0,0,Fe,fe.width,fe.height,1,ne,rt)}_.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,ee,0,0,0,fe.width,fe.height,Q.depth,ne,fe.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,ee,Me,fe.width,fe.height,Q.depth,0,fe.data,0,0);else Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else D?ie&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,ee,0,0,0,fe.width,fe.height,Q.depth,ne,xe,fe.data):t.texImage3D(n.TEXTURE_2D_ARRAY,ee,Me,fe.width,fe.height,Q.depth,0,ne,xe,fe.data)}else{D&&oe&&t.texStorage2D(n.TEXTURE_2D,me,Me,Ge[0].width,Ge[0].height);for(let ee=0,q=Ge.length;ee<q;ee++)fe=Ge[ee],_.format!==zt?ne!==null?D?ie&&t.compressedTexSubImage2D(n.TEXTURE_2D,ee,0,0,fe.width,fe.height,ne,fe.data):t.compressedTexImage2D(n.TEXTURE_2D,ee,Me,fe.width,fe.height,0,fe.data):Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):D?ie&&t.texSubImage2D(n.TEXTURE_2D,ee,0,0,fe.width,fe.height,ne,xe,fe.data):t.texImage2D(n.TEXTURE_2D,ee,Me,fe.width,fe.height,0,ne,xe,fe.data)}else if(_.isDataArrayTexture)if(D){if(oe&&t.texStorage3D(n.TEXTURE_2D_ARRAY,me,Me,Q.width,Q.height,Q.depth),ie)if(_.layerUpdates.size>0){const ee=Ja(Q.width,Q.height,_.format,_.type);for(const q of _.layerUpdates){const ve=Q.data.subarray(q*ee/Q.data.BYTES_PER_ELEMENT,(q+1)*ee/Q.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,q,Q.width,Q.height,1,ne,xe,ve)}_.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,ne,xe,Q.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Me,Q.width,Q.height,Q.depth,0,ne,xe,Q.data);else if(_.isData3DTexture)D?(oe&&t.texStorage3D(n.TEXTURE_3D,me,Me,Q.width,Q.height,Q.depth),ie&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,ne,xe,Q.data)):t.texImage3D(n.TEXTURE_3D,0,Me,Q.width,Q.height,Q.depth,0,ne,xe,Q.data);else if(_.isFramebufferTexture){if(oe)if(D)t.texStorage2D(n.TEXTURE_2D,me,Me,Q.width,Q.height);else{let ee=Q.width,q=Q.height;for(let ve=0;ve<me;ve++)t.texImage2D(n.TEXTURE_2D,ve,Me,ee,q,0,ne,xe,null),ee>>=1,q>>=1}}else if(Ge.length>0){if(D&&oe){const ee=ge(Ge[0]);t.texStorage2D(n.TEXTURE_2D,me,Me,ee.width,ee.height)}for(let ee=0,q=Ge.length;ee<q;ee++)fe=Ge[ee],D?ie&&t.texSubImage2D(n.TEXTURE_2D,ee,0,0,ne,xe,fe):t.texImage2D(n.TEXTURE_2D,ee,Me,ne,xe,fe);_.generateMipmaps=!1}else if(D){if(oe){const ee=ge(Q);t.texStorage2D(n.TEXTURE_2D,me,Me,ee.width,ee.height)}ie&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,ne,xe,Q)}else t.texImage2D(n.TEXTURE_2D,0,Me,ne,xe,Q);m(_)&&d($),_e.__version=j.version,_.onUpdate&&_.onUpdate(_)}T.__version=_.version}function te(T,_,N){if(_.image.length!==6)return;const $=we(T,_),J=_.source;t.bindTexture(n.TEXTURE_CUBE_MAP,T.__webglTexture,n.TEXTURE0+N);const j=i.get(J);if(J.version!==j.__version||$===!0){t.activeTexture(n.TEXTURE0+N);const _e=Xe.getPrimaries(Xe.workingColorSpace),ae=_.colorSpace===bn?null:Xe.getPrimaries(_.colorSpace),Te=_.colorSpace===bn||_e===ae?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,_.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,_.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Te);const Ce=_.isCompressedTexture||_.image[0].isCompressedTexture,Q=_.image[0]&&_.image[0].isDataTexture,ne=[];for(let q=0;q<6;q++)!Ce&&!Q?ne[q]=v(_.image[q],!0,r.maxCubemapSize):ne[q]=Q?_.image[q].image:_.image[q],ne[q]=Oe(_,ne[q]);const xe=ne[0],Me=s.convert(_.format,_.colorSpace),fe=s.convert(_.type),Ge=b(_.internalFormat,Me,fe,_.colorSpace),D=_.isVideoTexture!==!0,oe=j.__version===void 0||$===!0,ie=J.dataReady;let me=R(_,xe);le(n.TEXTURE_CUBE_MAP,_);let ee;if(Ce){D&&oe&&t.texStorage2D(n.TEXTURE_CUBE_MAP,me,Ge,xe.width,xe.height);for(let q=0;q<6;q++){ee=ne[q].mipmaps;for(let ve=0;ve<ee.length;ve++){const Fe=ee[ve];_.format!==zt?Me!==null?D?ie&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,ve,0,0,Fe.width,Fe.height,Me,Fe.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,ve,Ge,Fe.width,Fe.height,0,Fe.data):Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):D?ie&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,ve,0,0,Fe.width,Fe.height,Me,fe,Fe.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,ve,Ge,Fe.width,Fe.height,0,Me,fe,Fe.data)}}}else{if(ee=_.mipmaps,D&&oe){ee.length>0&&me++;const q=ge(ne[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,me,Ge,q.width,q.height)}for(let q=0;q<6;q++)if(Q){D?ie&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,0,0,ne[q].width,ne[q].height,Me,fe,ne[q].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,Ge,ne[q].width,ne[q].height,0,Me,fe,ne[q].data);for(let ve=0;ve<ee.length;ve++){const rt=ee[ve].image[q].image;D?ie&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,ve+1,0,0,rt.width,rt.height,Me,fe,rt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,ve+1,Ge,rt.width,rt.height,0,Me,fe,rt.data)}}else{D?ie&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,0,0,Me,fe,ne[q]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,Ge,Me,fe,ne[q]);for(let ve=0;ve<ee.length;ve++){const Fe=ee[ve];D?ie&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,ve+1,0,0,Me,fe,Fe.image[q]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,ve+1,Ge,Me,fe,Fe.image[q])}}}m(_)&&d(n.TEXTURE_CUBE_MAP),j.__version=J.version,_.onUpdate&&_.onUpdate(_)}T.__version=_.version}function re(T,_,N,$,J,j){const _e=s.convert(N.format,N.colorSpace),ae=s.convert(N.type),Te=b(N.internalFormat,_e,ae,N.colorSpace),Ce=i.get(_),Q=i.get(N);if(Q.__renderTarget=_,!Ce.__hasExternalTextures){const ne=Math.max(1,_.width>>j),xe=Math.max(1,_.height>>j);J===n.TEXTURE_3D||J===n.TEXTURE_2D_ARRAY?t.texImage3D(J,j,Te,ne,xe,_.depth,0,_e,ae,null):t.texImage2D(J,j,Te,ne,xe,0,_e,ae,null)}t.bindFramebuffer(n.FRAMEBUFFER,T),at(_)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,$,J,Q.__webglTexture,0,P(_)):(J===n.TEXTURE_2D||J>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&J<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,$,J,Q.__webglTexture,j),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Le(T,_,N){if(n.bindRenderbuffer(n.RENDERBUFFER,T),_.depthBuffer){const $=_.depthTexture,J=$&&$.isDepthTexture?$.type:null,j=E(_.stencilBuffer,J),_e=_.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;at(_)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,P(_),j,_.width,_.height):N?n.renderbufferStorageMultisample(n.RENDERBUFFER,P(_),j,_.width,_.height):n.renderbufferStorage(n.RENDERBUFFER,j,_.width,_.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,_e,n.RENDERBUFFER,T)}else{const $=_.textures;for(let J=0;J<$.length;J++){const j=$[J],_e=s.convert(j.format,j.colorSpace),ae=s.convert(j.type),Te=b(j.internalFormat,_e,ae,j.colorSpace);at(_)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,P(_),Te,_.width,_.height):N?n.renderbufferStorageMultisample(n.RENDERBUFFER,P(_),Te,_.width,_.height):n.renderbufferStorage(n.RENDERBUFFER,Te,_.width,_.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Ae(T,_,N){const $=_.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(n.FRAMEBUFFER,T),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const J=i.get(_.depthTexture);if(J.__renderTarget=_,(!J.__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)&&(_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0),$){if(J.__webglInit===void 0&&(J.__webglInit=!0,_.depthTexture.addEventListener("dispose",A)),J.__webglTexture===void 0){J.__webglTexture=n.createTexture(),t.bindTexture(n.TEXTURE_CUBE_MAP,J.__webglTexture),le(n.TEXTURE_CUBE_MAP,_.depthTexture);const Ce=s.convert(_.depthTexture.format),Q=s.convert(_.depthTexture.type);let ne;_.depthTexture.format===mn?ne=n.DEPTH_COMPONENT24:_.depthTexture.format===zn&&(ne=n.DEPTH24_STENCIL8);for(let xe=0;xe<6;xe++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+xe,0,ne,_.width,_.height,0,Ce,Q,null)}}else G(_.depthTexture,0);const j=J.__webglTexture,_e=P(_),ae=$?n.TEXTURE_CUBE_MAP_POSITIVE_X+N:n.TEXTURE_2D,Te=_.depthTexture.format===zn?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;if(_.depthTexture.format===mn)at(_)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Te,ae,j,0,_e):n.framebufferTexture2D(n.FRAMEBUFFER,Te,ae,j,0);else if(_.depthTexture.format===zn)at(_)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Te,ae,j,0,_e):n.framebufferTexture2D(n.FRAMEBUFFER,Te,ae,j,0);else throw new Error("Unknown depthTexture format")}function Re(T){const _=i.get(T),N=T.isWebGLCubeRenderTarget===!0;if(_.__boundDepthTexture!==T.depthTexture){const $=T.depthTexture;if(_.__depthDisposeCallback&&_.__depthDisposeCallback(),$){const J=()=>{delete _.__boundDepthTexture,delete _.__depthDisposeCallback,$.removeEventListener("dispose",J)};$.addEventListener("dispose",J),_.__depthDisposeCallback=J}_.__boundDepthTexture=$}if(T.depthTexture&&!_.__autoAllocateDepthBuffer)if(N)for(let $=0;$<6;$++)Ae(_.__webglFramebuffer[$],T,$);else{const $=T.texture.mipmaps;$&&$.length>0?Ae(_.__webglFramebuffer[0],T,0):Ae(_.__webglFramebuffer,T,0)}else if(N){_.__webglDepthbuffer=[];for(let $=0;$<6;$++)if(t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer[$]),_.__webglDepthbuffer[$]===void 0)_.__webglDepthbuffer[$]=n.createRenderbuffer(),Le(_.__webglDepthbuffer[$],T,!1);else{const J=T.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,j=_.__webglDepthbuffer[$];n.bindRenderbuffer(n.RENDERBUFFER,j),n.framebufferRenderbuffer(n.FRAMEBUFFER,J,n.RENDERBUFFER,j)}}else{const $=T.texture.mipmaps;if($&&$.length>0?t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer),_.__webglDepthbuffer===void 0)_.__webglDepthbuffer=n.createRenderbuffer(),Le(_.__webglDepthbuffer,T,!1);else{const J=T.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,j=_.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,j),n.framebufferRenderbuffer(n.FRAMEBUFFER,J,n.RENDERBUFFER,j)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function ot(T,_,N){const $=i.get(T);_!==void 0&&re($.__webglFramebuffer,T,T.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),N!==void 0&&Re(T)}function ke(T){const _=T.texture,N=i.get(T),$=i.get(_);T.addEventListener("dispose",C);const J=T.textures,j=T.isWebGLCubeRenderTarget===!0,_e=J.length>1;if(_e||($.__webglTexture===void 0&&($.__webglTexture=n.createTexture()),$.__version=_.version,a.memory.textures++),j){N.__webglFramebuffer=[];for(let ae=0;ae<6;ae++)if(_.mipmaps&&_.mipmaps.length>0){N.__webglFramebuffer[ae]=[];for(let Te=0;Te<_.mipmaps.length;Te++)N.__webglFramebuffer[ae][Te]=n.createFramebuffer()}else N.__webglFramebuffer[ae]=n.createFramebuffer()}else{if(_.mipmaps&&_.mipmaps.length>0){N.__webglFramebuffer=[];for(let ae=0;ae<_.mipmaps.length;ae++)N.__webglFramebuffer[ae]=n.createFramebuffer()}else N.__webglFramebuffer=n.createFramebuffer();if(_e)for(let ae=0,Te=J.length;ae<Te;ae++){const Ce=i.get(J[ae]);Ce.__webglTexture===void 0&&(Ce.__webglTexture=n.createTexture(),a.memory.textures++)}if(T.samples>0&&at(T)===!1){N.__webglMultisampledFramebuffer=n.createFramebuffer(),N.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,N.__webglMultisampledFramebuffer);for(let ae=0;ae<J.length;ae++){const Te=J[ae];N.__webglColorRenderbuffer[ae]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,N.__webglColorRenderbuffer[ae]);const Ce=s.convert(Te.format,Te.colorSpace),Q=s.convert(Te.type),ne=b(Te.internalFormat,Ce,Q,Te.colorSpace,T.isXRRenderTarget===!0),xe=P(T);n.renderbufferStorageMultisample(n.RENDERBUFFER,xe,ne,T.width,T.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ae,n.RENDERBUFFER,N.__webglColorRenderbuffer[ae])}n.bindRenderbuffer(n.RENDERBUFFER,null),T.depthBuffer&&(N.__webglDepthRenderbuffer=n.createRenderbuffer(),Le(N.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(j){t.bindTexture(n.TEXTURE_CUBE_MAP,$.__webglTexture),le(n.TEXTURE_CUBE_MAP,_);for(let ae=0;ae<6;ae++)if(_.mipmaps&&_.mipmaps.length>0)for(let Te=0;Te<_.mipmaps.length;Te++)re(N.__webglFramebuffer[ae][Te],T,_,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+ae,Te);else re(N.__webglFramebuffer[ae],T,_,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0);m(_)&&d(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(_e){for(let ae=0,Te=J.length;ae<Te;ae++){const Ce=J[ae],Q=i.get(Ce);let ne=n.TEXTURE_2D;(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(ne=T.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(ne,Q.__webglTexture),le(ne,Ce),re(N.__webglFramebuffer,T,Ce,n.COLOR_ATTACHMENT0+ae,ne,0),m(Ce)&&d(ne)}t.unbindTexture()}else{let ae=n.TEXTURE_2D;if((T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(ae=T.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(ae,$.__webglTexture),le(ae,_),_.mipmaps&&_.mipmaps.length>0)for(let Te=0;Te<_.mipmaps.length;Te++)re(N.__webglFramebuffer[Te],T,_,n.COLOR_ATTACHMENT0,ae,Te);else re(N.__webglFramebuffer,T,_,n.COLOR_ATTACHMENT0,ae,0);m(_)&&d(ae),t.unbindTexture()}T.depthBuffer&&Re(T)}function $e(T){const _=T.textures;for(let N=0,$=_.length;N<$;N++){const J=_[N];if(m(J)){const j=S(T),_e=i.get(J).__webglTexture;t.bindTexture(j,_e),d(j),t.unbindTexture()}}}const Ze=[],Ne=[];function st(T){if(T.samples>0){if(at(T)===!1){const _=T.textures,N=T.width,$=T.height;let J=n.COLOR_BUFFER_BIT;const j=T.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,_e=i.get(T),ae=_.length>1;if(ae)for(let Ce=0;Ce<_.length;Ce++)t.bindFramebuffer(n.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ce,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,_e.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ce,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,_e.__webglMultisampledFramebuffer);const Te=T.texture.mipmaps;Te&&Te.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,_e.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,_e.__webglFramebuffer);for(let Ce=0;Ce<_.length;Ce++){if(T.resolveDepthBuffer&&(T.depthBuffer&&(J|=n.DEPTH_BUFFER_BIT),T.stencilBuffer&&T.resolveStencilBuffer&&(J|=n.STENCIL_BUFFER_BIT)),ae){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,_e.__webglColorRenderbuffer[Ce]);const Q=i.get(_[Ce]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Q,0)}n.blitFramebuffer(0,0,N,$,0,0,N,$,J,n.NEAREST),l===!0&&(Ze.length=0,Ne.length=0,Ze.push(n.COLOR_ATTACHMENT0+Ce),T.depthBuffer&&T.resolveDepthBuffer===!1&&(Ze.push(j),Ne.push(j),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,Ne)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Ze))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),ae)for(let Ce=0;Ce<_.length;Ce++){t.bindFramebuffer(n.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ce,n.RENDERBUFFER,_e.__webglColorRenderbuffer[Ce]);const Q=i.get(_[Ce]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,_e.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ce,n.TEXTURE_2D,Q,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,_e.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.resolveDepthBuffer===!1&&l){const _=T.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[_])}}}function P(T){return Math.min(r.maxSamples,T.samples)}function at(T){const _=i.get(T);return T.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&_.__useRenderToTexture!==!1}function Pe(T){const _=a.render.frame;u.get(T)!==_&&(u.set(T,_),T.update())}function Oe(T,_){const N=T.colorSpace,$=T.format,J=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||N!==kn&&N!==bn&&(Xe.getTransfer(N)===Qe?($!==zt||J!==It)&&Ie("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):je("WebGLTextures: Unsupported texture color space:",N)),_}function ge(T){return typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement?(c.width=T.naturalWidth||T.width,c.height=T.naturalHeight||T.height):typeof VideoFrame<"u"&&T instanceof VideoFrame?(c.width=T.displayWidth,c.height=T.displayHeight):(c.width=T.width,c.height=T.height),c}this.allocateTextureUnit=B,this.resetTextureUnits=F,this.setTexture2D=G,this.setTexture2DArray=V,this.setTexture3D=U,this.setTextureCube=K,this.rebindTextures=ot,this.setupRenderTarget=ke,this.updateRenderTargetMipmap=$e,this.updateMultisampleRenderTarget=st,this.setupDepthRenderbuffer=Re,this.setupFrameBufferTexture=re,this.useMultisampledRTT=at,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Zp(n,e){function t(i,r=bn){let s;const a=Xe.getTransfer(r);if(i===It)return n.UNSIGNED_BYTE;if(i===sa)return n.UNSIGNED_SHORT_4_4_4_4;if(i===aa)return n.UNSIGNED_SHORT_5_5_5_1;if(i===el)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===tl)return n.UNSIGNED_INT_10F_11F_11F_REV;if(i===Jo)return n.BYTE;if(i===Qo)return n.SHORT;if(i===Ci)return n.UNSIGNED_SHORT;if(i===ra)return n.INT;if(i===Kt)return n.UNSIGNED_INT;if(i===jt)return n.FLOAT;if(i===pn)return n.HALF_FLOAT;if(i===nl)return n.ALPHA;if(i===il)return n.RGB;if(i===zt)return n.RGBA;if(i===mn)return n.DEPTH_COMPONENT;if(i===zn)return n.DEPTH_STENCIL;if(i===rl)return n.RED;if(i===oa)return n.RED_INTEGER;if(i===ui)return n.RG;if(i===la)return n.RG_INTEGER;if(i===ca)return n.RGBA_INTEGER;if(i===lr||i===cr||i===hr||i===ur)if(a===Qe)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===lr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===cr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===hr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===ur)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===lr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===cr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===hr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===ur)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===vs||i===Ms||i===Ss||i===Es)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===vs)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Ms)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Ss)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Es)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===ys||i===bs||i===Ts||i===As||i===ws||i===Rs||i===Cs)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===ys||i===bs)return a===Qe?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Ts)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(i===As)return s.COMPRESSED_R11_EAC;if(i===ws)return s.COMPRESSED_SIGNED_R11_EAC;if(i===Rs)return s.COMPRESSED_RG11_EAC;if(i===Cs)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===Ps||i===Ds||i===Ls||i===Is||i===Ns||i===Fs||i===Us||i===Os||i===Bs||i===zs||i===Gs||i===Vs||i===ks||i===Hs)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===Ps)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Ds)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Ls)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Is)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Ns)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Fs)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Us)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Os)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Bs)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===zs)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Gs)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Vs)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===ks)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Hs)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Ws||i===Xs||i===qs)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Ws)return a===Qe?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Xs)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===qs)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===js||i===Ys||i===$s||i===Zs)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===js)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Ys)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===$s)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Zs)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Pi?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}const Kp=`
4025
+ }`,Zp=[new W(1,0,0),new W(-1,0,0),new W(0,1,0),new W(0,-1,0),new W(0,0,1),new W(0,0,-1)],Kp=[new W(0,-1,0),new W(0,-1,0),new W(0,0,1),new W(0,0,-1),new W(0,-1,0),new W(0,-1,0)],yo=new ut,bi=new W,is=new W;function Jp(n,e,t){let i=new xl;const r=new Ke,s=new Ke,a=new ct,o=new uh,l=new fh,c={},d=t.maxTextureSize,p={[An]:At,[At]:An,[cn]:cn},h=new Qt({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ke},radius:{value:4}},vertexShader:Yp,fragmentShader:$p}),f=h.clone();f.defines.HORIZONTAL_PASS=1;const g=new en;g.setAttribute("position",new Vt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Jt(g,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=or;let u=this.type;this.render=function(A,C,x){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||A.length===0)return;this.type===tc&&(Ie("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=or);const y=n.getRenderTarget(),z=n.getActiveCubeFace(),w=n.getActiveMipmapLevel(),F=n.state;F.setBlending(dn),F.buffers.depth.getReversed()===!0?F.buffers.color.setClear(0,0,0,0):F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const B=u!==this.type;B&&C.traverse(function(I){I.material&&(Array.isArray(I.material)?I.material.forEach(G=>G.needsUpdate=!0):I.material.needsUpdate=!0)});for(let I=0,G=A.length;I<G;I++){const V=A[I],U=V.shadow;if(U===void 0){Ie("WebGLShadowMap:",V,"has no shadow.");continue}if(U.autoUpdate===!1&&U.needsUpdate===!1)continue;r.copy(U.mapSize);const K=U.getFrameExtents();r.multiply(K),s.copy(U.mapSize),(r.x>d||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/K.x),r.x=s.x*K.x,U.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/K.y),r.y=s.y*K.y,U.mapSize.y=s.y));const Y=n.state.buffers.depth.getReversed();if(U.camera._reversedDepth=Y,U.map===null||B===!0){if(U.map!==null&&(U.map.depthTexture!==null&&(U.map.depthTexture.dispose(),U.map.depthTexture=null),U.map.dispose()),this.type===Ti){if(V.isPointLight){Ie("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}U.map=new Zt(r.x,r.y,{format:di,type:pn,minFilter:Et,magFilter:Et,generateMipmaps:!1}),U.map.texture.name=V.name+".shadowMap",U.map.depthTexture=new Di(r.x,r.y,qt),U.map.depthTexture.name=V.name+".shadowMapDepth",U.map.depthTexture.format=mn,U.map.depthTexture.compareFunction=null,U.map.depthTexture.minFilter=xt,U.map.depthTexture.magFilter=xt}else V.isPointLight?(U.map=new Tl(r.x),U.map.depthTexture=new oh(r.x,Kt)):(U.map=new Zt(r.x,r.y),U.map.depthTexture=new Di(r.x,r.y,Kt)),U.map.depthTexture.name=V.name+".shadowMap",U.map.depthTexture.format=mn,this.type===or?(U.map.depthTexture.compareFunction=Y?da:ha,U.map.depthTexture.minFilter=Et,U.map.depthTexture.magFilter=Et):(U.map.depthTexture.compareFunction=null,U.map.depthTexture.minFilter=xt,U.map.depthTexture.magFilter=xt);U.camera.updateProjectionMatrix()}const se=U.map.isWebGLCubeRenderTarget?6:1;for(let ce=0;ce<se;ce++){if(U.map.isWebGLCubeRenderTarget)n.setRenderTarget(U.map,ce),n.clear();else{ce===0&&(n.setRenderTarget(U.map),n.clear());const le=U.getViewport(ce);a.set(s.x*le.x,s.y*le.y,s.x*le.z,s.y*le.w),F.viewport(a)}if(V.isPointLight){const le=U.camera,we=U.matrix,Ye=V.distance||le.far;Ye!==le.far&&(le.far=Ye,le.updateProjectionMatrix()),bi.setFromMatrixPosition(V.matrixWorld),le.position.copy(bi),is.copy(le.position),is.add(Zp[ce]),le.up.copy(Kp[ce]),le.lookAt(is),le.updateMatrixWorld(),we.makeTranslation(-bi.x,-bi.y,-bi.z),yo.multiplyMatrices(le.projectionMatrix,le.matrixWorldInverse),U._frustum.setFromProjectionMatrix(yo,le.coordinateSystem,le.reversedDepth)}else U.updateMatrices(V);i=U.getFrustum(),E(C,x,U.camera,V,this.type)}U.isPointLightShadow!==!0&&this.type===Ti&&S(U,x),U.needsUpdate=!1}u=this.type,m.needsUpdate=!1,n.setRenderTarget(y,z,w)};function S(A,C){const x=e.update(v);h.defines.VSM_SAMPLES!==A.blurSamples&&(h.defines.VSM_SAMPLES=A.blurSamples,f.defines.VSM_SAMPLES=A.blurSamples,h.needsUpdate=!0,f.needsUpdate=!0),A.mapPass===null&&(A.mapPass=new Zt(r.x,r.y,{format:di,type:pn})),h.uniforms.shadow_pass.value=A.map.depthTexture,h.uniforms.resolution.value=A.mapSize,h.uniforms.radius.value=A.radius,n.setRenderTarget(A.mapPass),n.clear(),n.renderBufferDirect(C,null,x,h,v,null),f.uniforms.shadow_pass.value=A.mapPass.texture,f.uniforms.resolution.value=A.mapSize,f.uniforms.radius.value=A.radius,n.setRenderTarget(A.map),n.clear(),n.renderBufferDirect(C,null,x,f,v,null)}function b(A,C,x,y){let z=null;const w=x.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(w!==void 0)z=w;else if(z=x.isPointLight===!0?l:o,n.localClippingEnabled&&C.clipShadows===!0&&Array.isArray(C.clippingPlanes)&&C.clippingPlanes.length!==0||C.displacementMap&&C.displacementScale!==0||C.alphaMap&&C.alphaTest>0||C.map&&C.alphaTest>0||C.alphaToCoverage===!0){const F=z.uuid,B=C.uuid;let I=c[F];I===void 0&&(I={},c[F]=I);let G=I[B];G===void 0&&(G=z.clone(),I[B]=G,C.addEventListener("dispose",R)),z=G}if(z.visible=C.visible,z.wireframe=C.wireframe,y===Ti?z.side=C.shadowSide!==null?C.shadowSide:C.side:z.side=C.shadowSide!==null?C.shadowSide:p[C.side],z.alphaMap=C.alphaMap,z.alphaTest=C.alphaToCoverage===!0?.5:C.alphaTest,z.map=C.map,z.clipShadows=C.clipShadows,z.clippingPlanes=C.clippingPlanes,z.clipIntersection=C.clipIntersection,z.displacementMap=C.displacementMap,z.displacementScale=C.displacementScale,z.displacementBias=C.displacementBias,z.wireframeLinewidth=C.wireframeLinewidth,z.linewidth=C.linewidth,x.isPointLight===!0&&z.isMeshDistanceMaterial===!0){const F=n.properties.get(z);F.light=x}return z}function E(A,C,x,y,z){if(A.visible===!1)return;if(A.layers.test(C.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&z===Ti)&&(!A.frustumCulled||i.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,A.matrixWorld);const B=e.update(A),I=A.material;if(Array.isArray(I)){const G=B.groups;for(let V=0,U=G.length;V<U;V++){const K=G[V],Y=I[K.materialIndex];if(Y&&Y.visible){const se=b(A,Y,y,z);A.onBeforeShadow(n,A,C,x,B,se,K),n.renderBufferDirect(x,null,B,se,A,K),A.onAfterShadow(n,A,C,x,B,se,K)}}}else if(I.visible){const G=b(A,I,y,z);A.onBeforeShadow(n,A,C,x,B,G,null),n.renderBufferDirect(x,null,B,G,A,null),A.onAfterShadow(n,A,C,x,B,G,null)}}const F=A.children;for(let B=0,I=F.length;B<I;B++)E(F[B],C,x,y,z)}function R(A){A.target.removeEventListener("dispose",R);for(const x in c){const y=c[x],z=A.target.uuid;z in y&&(y[z].dispose(),delete y[z])}}}function Qp(n,e){function t(){let L=!1;const oe=new ct;let ie=null;const me=new ct(0,0,0,0);return{setMask:function(ee){ie!==ee&&!L&&(n.colorMask(ee,ee,ee,ee),ie=ee)},setLocked:function(ee){L=ee},setClear:function(ee,j,ve,Fe,rt){rt===!0&&(ee*=Fe,j*=Fe,ve*=Fe),oe.set(ee,j,ve,Fe),me.equals(oe)===!1&&(n.clearColor(ee,j,ve,Fe),me.copy(oe))},reset:function(){L=!1,ie=null,me.set(-1,0,0,0)}}}function i(){let L=!1,oe=!1,ie=null,me=null,ee=null;return{setReversed:function(j){if(oe!==j){const ve=e.get("EXT_clip_control");j?ve.clipControlEXT(ve.LOWER_LEFT_EXT,ve.ZERO_TO_ONE_EXT):ve.clipControlEXT(ve.LOWER_LEFT_EXT,ve.NEGATIVE_ONE_TO_ONE_EXT),oe=j;const Fe=ee;ee=null,this.setClear(Fe)}},getReversed:function(){return oe},setTest:function(j){j?te(n.DEPTH_TEST):re(n.DEPTH_TEST)},setMask:function(j){ie!==j&&!L&&(n.depthMask(j),ie=j)},setFunc:function(j){if(oe&&(j=Fc[j]),me!==j){switch(j){case hs:n.depthFunc(n.NEVER);break;case ds:n.depthFunc(n.ALWAYS);break;case us:n.depthFunc(n.LESS);break;case ci:n.depthFunc(n.LEQUAL);break;case fs:n.depthFunc(n.EQUAL);break;case ps:n.depthFunc(n.GEQUAL);break;case ms:n.depthFunc(n.GREATER);break;case gs:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}me=j}},setLocked:function(j){L=j},setClear:function(j){ee!==j&&(ee=j,oe&&(j=1-j),n.clearDepth(j))},reset:function(){L=!1,ie=null,me=null,ee=null,oe=!1}}}function r(){let L=!1,oe=null,ie=null,me=null,ee=null,j=null,ve=null,Fe=null,rt=null;return{setTest:function(Je){L||(Je?te(n.STENCIL_TEST):re(n.STENCIL_TEST))},setMask:function(Je){oe!==Je&&!L&&(n.stencilMask(Je),oe=Je)},setFunc:function(Je,tn,nn){(ie!==Je||me!==tn||ee!==nn)&&(n.stencilFunc(Je,tn,nn),ie=Je,me=tn,ee=nn)},setOp:function(Je,tn,nn){(j!==Je||ve!==tn||Fe!==nn)&&(n.stencilOp(Je,tn,nn),j=Je,ve=tn,Fe=nn)},setLocked:function(Je){L=Je},setClear:function(Je){rt!==Je&&(n.clearStencil(Je),rt=Je)},reset:function(){L=!1,oe=null,ie=null,me=null,ee=null,j=null,ve=null,Fe=null,rt=null}}}const s=new t,a=new i,o=new r,l=new WeakMap,c=new WeakMap;let d={},p={},h=new WeakMap,f=[],g=null,v=!1,m=null,u=null,S=null,b=null,E=null,R=null,A=null,C=new nt(0,0,0),x=0,y=!1,z=null,w=null,F=null,B=null,I=null;const G=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let V=!1,U=0;const K=n.getParameter(n.VERSION);K.indexOf("WebGL")!==-1?(U=parseFloat(/^WebGL (\d)/.exec(K)[1]),V=U>=1):K.indexOf("OpenGL ES")!==-1&&(U=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),V=U>=2);let Y=null,se={};const ce=n.getParameter(n.SCISSOR_BOX),le=n.getParameter(n.VIEWPORT),we=new ct().fromArray(ce),Ye=new ct().fromArray(le);function He(L,oe,ie,me){const ee=new Uint8Array(4),j=n.createTexture();n.bindTexture(L,j),n.texParameteri(L,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(L,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let ve=0;ve<ie;ve++)L===n.TEXTURE_3D||L===n.TEXTURE_2D_ARRAY?n.texImage3D(oe,0,n.RGBA,1,1,me,0,n.RGBA,n.UNSIGNED_BYTE,ee):n.texImage2D(oe+ve,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,ee);return j}const Z={};Z[n.TEXTURE_2D]=He(n.TEXTURE_2D,n.TEXTURE_2D,1),Z[n.TEXTURE_CUBE_MAP]=He(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),Z[n.TEXTURE_2D_ARRAY]=He(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Z[n.TEXTURE_3D]=He(n.TEXTURE_3D,n.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),te(n.DEPTH_TEST),a.setFunc(ci),Ne(!1),st(Ra),te(n.CULL_FACE),$e(dn);function te(L){d[L]!==!0&&(n.enable(L),d[L]=!0)}function re(L){d[L]!==!1&&(n.disable(L),d[L]=!1)}function Le(L,oe){return p[L]!==oe?(n.bindFramebuffer(L,oe),p[L]=oe,L===n.DRAW_FRAMEBUFFER&&(p[n.FRAMEBUFFER]=oe),L===n.FRAMEBUFFER&&(p[n.DRAW_FRAMEBUFFER]=oe),!0):!1}function Ae(L,oe){let ie=f,me=!1;if(L){ie=h.get(oe),ie===void 0&&(ie=[],h.set(oe,ie));const ee=L.textures;if(ie.length!==ee.length||ie[0]!==n.COLOR_ATTACHMENT0){for(let j=0,ve=ee.length;j<ve;j++)ie[j]=n.COLOR_ATTACHMENT0+j;ie.length=ee.length,me=!0}}else ie[0]!==n.BACK&&(ie[0]=n.BACK,me=!0);me&&n.drawBuffers(ie)}function Re(L){return g!==L?(n.useProgram(L),g=L,!0):!1}const ot={[Un]:n.FUNC_ADD,[ic]:n.FUNC_SUBTRACT,[rc]:n.FUNC_REVERSE_SUBTRACT};ot[sc]=n.MIN,ot[ac]=n.MAX;const ke={[oc]:n.ZERO,[lc]:n.ONE,[cc]:n.SRC_COLOR,[ls]:n.SRC_ALPHA,[mc]:n.SRC_ALPHA_SATURATE,[fc]:n.DST_COLOR,[dc]:n.DST_ALPHA,[hc]:n.ONE_MINUS_SRC_COLOR,[cs]:n.ONE_MINUS_SRC_ALPHA,[pc]:n.ONE_MINUS_DST_COLOR,[uc]:n.ONE_MINUS_DST_ALPHA,[gc]:n.CONSTANT_COLOR,[_c]:n.ONE_MINUS_CONSTANT_COLOR,[xc]:n.CONSTANT_ALPHA,[vc]:n.ONE_MINUS_CONSTANT_ALPHA};function $e(L,oe,ie,me,ee,j,ve,Fe,rt,Je){if(L===dn){v===!0&&(re(n.BLEND),v=!1);return}if(v===!1&&(te(n.BLEND),v=!0),L!==nc){if(L!==m||Je!==y){if((u!==Un||E!==Un)&&(n.blendEquation(n.FUNC_ADD),u=Un,E=Un),Je)switch(L){case Gn:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Ca:n.blendFunc(n.ONE,n.ONE);break;case Pa:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case Da:n.blendFuncSeparate(n.DST_COLOR,n.ONE_MINUS_SRC_ALPHA,n.ZERO,n.ONE);break;default:qe("WebGLState: Invalid blending: ",L);break}else switch(L){case Gn:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case Ca:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE,n.ONE,n.ONE);break;case Pa:qe("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Da:qe("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:qe("WebGLState: Invalid blending: ",L);break}S=null,b=null,R=null,A=null,C.set(0,0,0),x=0,m=L,y=Je}return}ee=ee||oe,j=j||ie,ve=ve||me,(oe!==u||ee!==E)&&(n.blendEquationSeparate(ot[oe],ot[ee]),u=oe,E=ee),(ie!==S||me!==b||j!==R||ve!==A)&&(n.blendFuncSeparate(ke[ie],ke[me],ke[j],ke[ve]),S=ie,b=me,R=j,A=ve),(Fe.equals(C)===!1||rt!==x)&&(n.blendColor(Fe.r,Fe.g,Fe.b,rt),C.copy(Fe),x=rt),m=L,y=!1}function Ze(L,oe){L.side===cn?re(n.CULL_FACE):te(n.CULL_FACE);let ie=L.side===At;oe&&(ie=!ie),Ne(ie),L.blending===Gn&&L.transparent===!1?$e(dn):$e(L.blending,L.blendEquation,L.blendSrc,L.blendDst,L.blendEquationAlpha,L.blendSrcAlpha,L.blendDstAlpha,L.blendColor,L.blendAlpha,L.premultipliedAlpha),a.setFunc(L.depthFunc),a.setTest(L.depthTest),a.setMask(L.depthWrite),s.setMask(L.colorWrite);const me=L.stencilWrite;o.setTest(me),me&&(o.setMask(L.stencilWriteMask),o.setFunc(L.stencilFunc,L.stencilRef,L.stencilFuncMask),o.setOp(L.stencilFail,L.stencilZFail,L.stencilZPass)),at(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),L.alphaToCoverage===!0?te(n.SAMPLE_ALPHA_TO_COVERAGE):re(n.SAMPLE_ALPHA_TO_COVERAGE)}function Ne(L){z!==L&&(L?n.frontFace(n.CW):n.frontFace(n.CCW),z=L)}function st(L){L!==Ql?(te(n.CULL_FACE),L!==w&&(L===Ra?n.cullFace(n.BACK):L===ec?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):re(n.CULL_FACE),w=L}function P(L){L!==F&&(V&&n.lineWidth(L),F=L)}function at(L,oe,ie){L?(te(n.POLYGON_OFFSET_FILL),(B!==oe||I!==ie)&&(B=oe,I=ie,a.getReversed()&&(oe=-oe),n.polygonOffset(oe,ie))):re(n.POLYGON_OFFSET_FILL)}function De(L){L?te(n.SCISSOR_TEST):re(n.SCISSOR_TEST)}function Oe(L){L===void 0&&(L=n.TEXTURE0+G-1),Y!==L&&(n.activeTexture(L),Y=L)}function ge(L,oe,ie){ie===void 0&&(Y===null?ie=n.TEXTURE0+G-1:ie=Y);let me=se[ie];me===void 0&&(me={type:void 0,texture:void 0},se[ie]=me),(me.type!==L||me.texture!==oe)&&(Y!==ie&&(n.activeTexture(ie),Y=ie),n.bindTexture(L,oe||Z[L]),me.type=L,me.texture=oe)}function T(){const L=se[Y];L!==void 0&&L.type!==void 0&&(n.bindTexture(L.type,null),L.type=void 0,L.texture=void 0)}function _(){try{n.compressedTexImage2D(...arguments)}catch(L){qe("WebGLState:",L)}}function N(){try{n.compressedTexImage3D(...arguments)}catch(L){qe("WebGLState:",L)}}function $(){try{n.texSubImage2D(...arguments)}catch(L){qe("WebGLState:",L)}}function J(){try{n.texSubImage3D(...arguments)}catch(L){qe("WebGLState:",L)}}function q(){try{n.compressedTexSubImage2D(...arguments)}catch(L){qe("WebGLState:",L)}}function _e(){try{n.compressedTexSubImage3D(...arguments)}catch(L){qe("WebGLState:",L)}}function ae(){try{n.texStorage2D(...arguments)}catch(L){qe("WebGLState:",L)}}function Te(){try{n.texStorage3D(...arguments)}catch(L){qe("WebGLState:",L)}}function Ce(){try{n.texImage2D(...arguments)}catch(L){qe("WebGLState:",L)}}function Q(){try{n.texImage3D(...arguments)}catch(L){qe("WebGLState:",L)}}function ne(L){we.equals(L)===!1&&(n.scissor(L.x,L.y,L.z,L.w),we.copy(L))}function xe(L){Ye.equals(L)===!1&&(n.viewport(L.x,L.y,L.z,L.w),Ye.copy(L))}function Me(L,oe){let ie=c.get(oe);ie===void 0&&(ie=new WeakMap,c.set(oe,ie));let me=ie.get(L);me===void 0&&(me=n.getUniformBlockIndex(oe,L.name),ie.set(L,me))}function fe(L,oe){const me=c.get(oe).get(L);l.get(oe)!==me&&(n.uniformBlockBinding(oe,me,L.__bindingPointIndex),l.set(oe,me))}function Ge(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),a.setReversed(!1),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),d={},Y=null,se={},p={},h=new WeakMap,f=[],g=null,v=!1,m=null,u=null,S=null,b=null,E=null,R=null,A=null,C=new nt(0,0,0),x=0,y=!1,z=null,w=null,F=null,B=null,I=null,we.set(0,0,n.canvas.width,n.canvas.height),Ye.set(0,0,n.canvas.width,n.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:te,disable:re,bindFramebuffer:Le,drawBuffers:Ae,useProgram:Re,setBlending:$e,setMaterial:Ze,setFlipSided:Ne,setCullFace:st,setLineWidth:P,setPolygonOffset:at,setScissorTest:De,activeTexture:Oe,bindTexture:ge,unbindTexture:T,compressedTexImage2D:_,compressedTexImage3D:N,texImage2D:Ce,texImage3D:Q,updateUBOMapping:Me,uniformBlockBinding:fe,texStorage2D:ae,texStorage3D:Te,texSubImage2D:$,texSubImage3D:J,compressedTexSubImage2D:q,compressedTexSubImage3D:_e,scissor:ne,viewport:xe,reset:Ge}}function em(n,e,t,i,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ke,d=new WeakMap;let p;const h=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(T,_){return f?new OffscreenCanvas(T,_):mr("canvas")}function v(T,_,N){let $=1;const J=ge(T);if((J.width>N||J.height>N)&&($=N/Math.max(J.width,J.height)),$<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){const q=Math.floor($*J.width),_e=Math.floor($*J.height);p===void 0&&(p=g(q,_e));const ae=_?g(q,_e):p;return ae.width=q,ae.height=_e,ae.getContext("2d").drawImage(T,0,0,q,_e),Ie("WebGLRenderer: Texture has been resized from ("+J.width+"x"+J.height+") to ("+q+"x"+_e+")."),ae}else return"data"in T&&Ie("WebGLRenderer: Image in DataTexture is too big ("+J.width+"x"+J.height+")."),T;return T}function m(T){return T.generateMipmaps}function u(T){n.generateMipmap(T)}function S(T){return T.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:T.isWebGL3DRenderTarget?n.TEXTURE_3D:T.isWebGLArrayRenderTarget||T.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function b(T,_,N,$,J=!1){if(T!==null){if(n[T]!==void 0)return n[T];Ie("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let q=_;if(_===n.RED&&(N===n.FLOAT&&(q=n.R32F),N===n.HALF_FLOAT&&(q=n.R16F),N===n.UNSIGNED_BYTE&&(q=n.R8)),_===n.RED_INTEGER&&(N===n.UNSIGNED_BYTE&&(q=n.R8UI),N===n.UNSIGNED_SHORT&&(q=n.R16UI),N===n.UNSIGNED_INT&&(q=n.R32UI),N===n.BYTE&&(q=n.R8I),N===n.SHORT&&(q=n.R16I),N===n.INT&&(q=n.R32I)),_===n.RG&&(N===n.FLOAT&&(q=n.RG32F),N===n.HALF_FLOAT&&(q=n.RG16F),N===n.UNSIGNED_BYTE&&(q=n.RG8)),_===n.RG_INTEGER&&(N===n.UNSIGNED_BYTE&&(q=n.RG8UI),N===n.UNSIGNED_SHORT&&(q=n.RG16UI),N===n.UNSIGNED_INT&&(q=n.RG32UI),N===n.BYTE&&(q=n.RG8I),N===n.SHORT&&(q=n.RG16I),N===n.INT&&(q=n.RG32I)),_===n.RGB_INTEGER&&(N===n.UNSIGNED_BYTE&&(q=n.RGB8UI),N===n.UNSIGNED_SHORT&&(q=n.RGB16UI),N===n.UNSIGNED_INT&&(q=n.RGB32UI),N===n.BYTE&&(q=n.RGB8I),N===n.SHORT&&(q=n.RGB16I),N===n.INT&&(q=n.RGB32I)),_===n.RGBA_INTEGER&&(N===n.UNSIGNED_BYTE&&(q=n.RGBA8UI),N===n.UNSIGNED_SHORT&&(q=n.RGBA16UI),N===n.UNSIGNED_INT&&(q=n.RGBA32UI),N===n.BYTE&&(q=n.RGBA8I),N===n.SHORT&&(q=n.RGBA16I),N===n.INT&&(q=n.RGBA32I)),_===n.RGB&&(N===n.UNSIGNED_INT_5_9_9_9_REV&&(q=n.RGB9_E5),N===n.UNSIGNED_INT_10F_11F_11F_REV&&(q=n.R11F_G11F_B10F)),_===n.RGBA){const _e=J?fr:Xe.getTransfer($);N===n.FLOAT&&(q=n.RGBA32F),N===n.HALF_FLOAT&&(q=n.RGBA16F),N===n.UNSIGNED_BYTE&&(q=_e===Qe?n.SRGB8_ALPHA8:n.RGBA8),N===n.UNSIGNED_SHORT_4_4_4_4&&(q=n.RGBA4),N===n.UNSIGNED_SHORT_5_5_5_1&&(q=n.RGB5_A1)}return(q===n.R16F||q===n.R32F||q===n.RG16F||q===n.RG32F||q===n.RGBA16F||q===n.RGBA32F)&&e.get("EXT_color_buffer_float"),q}function E(T,_){let N;return T?_===null||_===Kt||_===Pi?N=n.DEPTH24_STENCIL8:_===qt?N=n.DEPTH32F_STENCIL8:_===Ci&&(N=n.DEPTH24_STENCIL8,Ie("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):_===null||_===Kt||_===Pi?N=n.DEPTH_COMPONENT24:_===qt?N=n.DEPTH_COMPONENT32F:_===Ci&&(N=n.DEPTH_COMPONENT16),N}function R(T,_){return m(T)===!0||T.isFramebufferTexture&&T.minFilter!==xt&&T.minFilter!==Et?Math.log2(Math.max(_.width,_.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?_.mipmaps.length:1}function A(T){const _=T.target;_.removeEventListener("dispose",A),x(_),_.isVideoTexture&&d.delete(_)}function C(T){const _=T.target;_.removeEventListener("dispose",C),z(_)}function x(T){const _=i.get(T);if(_.__webglInit===void 0)return;const N=T.source,$=h.get(N);if($){const J=$[_.__cacheKey];J.usedTimes--,J.usedTimes===0&&y(T),Object.keys($).length===0&&h.delete(N)}i.remove(T)}function y(T){const _=i.get(T);n.deleteTexture(_.__webglTexture);const N=T.source,$=h.get(N);delete $[_.__cacheKey],a.memory.textures--}function z(T){const _=i.get(T);if(T.depthTexture&&(T.depthTexture.dispose(),i.remove(T.depthTexture)),T.isWebGLCubeRenderTarget)for(let $=0;$<6;$++){if(Array.isArray(_.__webglFramebuffer[$]))for(let J=0;J<_.__webglFramebuffer[$].length;J++)n.deleteFramebuffer(_.__webglFramebuffer[$][J]);else n.deleteFramebuffer(_.__webglFramebuffer[$]);_.__webglDepthbuffer&&n.deleteRenderbuffer(_.__webglDepthbuffer[$])}else{if(Array.isArray(_.__webglFramebuffer))for(let $=0;$<_.__webglFramebuffer.length;$++)n.deleteFramebuffer(_.__webglFramebuffer[$]);else n.deleteFramebuffer(_.__webglFramebuffer);if(_.__webglDepthbuffer&&n.deleteRenderbuffer(_.__webglDepthbuffer),_.__webglMultisampledFramebuffer&&n.deleteFramebuffer(_.__webglMultisampledFramebuffer),_.__webglColorRenderbuffer)for(let $=0;$<_.__webglColorRenderbuffer.length;$++)_.__webglColorRenderbuffer[$]&&n.deleteRenderbuffer(_.__webglColorRenderbuffer[$]);_.__webglDepthRenderbuffer&&n.deleteRenderbuffer(_.__webglDepthRenderbuffer)}const N=T.textures;for(let $=0,J=N.length;$<J;$++){const q=i.get(N[$]);q.__webglTexture&&(n.deleteTexture(q.__webglTexture),a.memory.textures--),i.remove(N[$])}i.remove(T)}let w=0;function F(){w=0}function B(){const T=w;return T>=r.maxTextures&&Ie("WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+r.maxTextures),w+=1,T}function I(T){const _=[];return _.push(T.wrapS),_.push(T.wrapT),_.push(T.wrapR||0),_.push(T.magFilter),_.push(T.minFilter),_.push(T.anisotropy),_.push(T.internalFormat),_.push(T.format),_.push(T.type),_.push(T.generateMipmaps),_.push(T.premultiplyAlpha),_.push(T.flipY),_.push(T.unpackAlignment),_.push(T.colorSpace),_.join()}function G(T,_){const N=i.get(T);if(T.isVideoTexture&&De(T),T.isRenderTargetTexture===!1&&T.isExternalTexture!==!0&&T.version>0&&N.__version!==T.version){const $=T.image;if($===null)Ie("WebGLRenderer: Texture marked for update but no image data found.");else if($.complete===!1)Ie("WebGLRenderer: Texture marked for update but image is incomplete");else{Z(N,T,_);return}}else T.isExternalTexture&&(N.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(n.TEXTURE_2D,N.__webglTexture,n.TEXTURE0+_)}function V(T,_){const N=i.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&N.__version!==T.version){Z(N,T,_);return}else T.isExternalTexture&&(N.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(n.TEXTURE_2D_ARRAY,N.__webglTexture,n.TEXTURE0+_)}function U(T,_){const N=i.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&N.__version!==T.version){Z(N,T,_);return}t.bindTexture(n.TEXTURE_3D,N.__webglTexture,n.TEXTURE0+_)}function K(T,_){const N=i.get(T);if(T.isCubeDepthTexture!==!0&&T.version>0&&N.__version!==T.version){te(N,T,_);return}t.bindTexture(n.TEXTURE_CUBE_MAP,N.__webglTexture,n.TEXTURE0+_)}const Y={[_s]:n.REPEAT,[hn]:n.CLAMP_TO_EDGE,[xs]:n.MIRRORED_REPEAT},se={[xt]:n.NEAREST,[Ec]:n.NEAREST_MIPMAP_NEAREST,[Oi]:n.NEAREST_MIPMAP_LINEAR,[Et]:n.LINEAR,[wr]:n.LINEAR_MIPMAP_NEAREST,[Bn]:n.LINEAR_MIPMAP_LINEAR},ce={[Ac]:n.NEVER,[Dc]:n.ALWAYS,[wc]:n.LESS,[ha]:n.LEQUAL,[Rc]:n.EQUAL,[da]:n.GEQUAL,[Cc]:n.GREATER,[Pc]:n.NOTEQUAL};function le(T,_){if(_.type===qt&&e.has("OES_texture_float_linear")===!1&&(_.magFilter===Et||_.magFilter===wr||_.magFilter===Oi||_.magFilter===Bn||_.minFilter===Et||_.minFilter===wr||_.minFilter===Oi||_.minFilter===Bn)&&Ie("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(T,n.TEXTURE_WRAP_S,Y[_.wrapS]),n.texParameteri(T,n.TEXTURE_WRAP_T,Y[_.wrapT]),(T===n.TEXTURE_3D||T===n.TEXTURE_2D_ARRAY)&&n.texParameteri(T,n.TEXTURE_WRAP_R,Y[_.wrapR]),n.texParameteri(T,n.TEXTURE_MAG_FILTER,se[_.magFilter]),n.texParameteri(T,n.TEXTURE_MIN_FILTER,se[_.minFilter]),_.compareFunction&&(n.texParameteri(T,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(T,n.TEXTURE_COMPARE_FUNC,ce[_.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(_.magFilter===xt||_.minFilter!==Oi&&_.minFilter!==Bn||_.type===qt&&e.has("OES_texture_float_linear")===!1)return;if(_.anisotropy>1||i.get(_).__currentAnisotropy){const N=e.get("EXT_texture_filter_anisotropic");n.texParameterf(T,N.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,r.getMaxAnisotropy())),i.get(_).__currentAnisotropy=_.anisotropy}}}function we(T,_){let N=!1;T.__webglInit===void 0&&(T.__webglInit=!0,_.addEventListener("dispose",A));const $=_.source;let J=h.get($);J===void 0&&(J={},h.set($,J));const q=I(_);if(q!==T.__cacheKey){J[q]===void 0&&(J[q]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,N=!0),J[q].usedTimes++;const _e=J[T.__cacheKey];_e!==void 0&&(J[T.__cacheKey].usedTimes--,_e.usedTimes===0&&y(_)),T.__cacheKey=q,T.__webglTexture=J[q].texture}return N}function Ye(T,_,N){return Math.floor(Math.floor(T/N)/_)}function He(T,_,N,$){const q=T.updateRanges;if(q.length===0)t.texSubImage2D(n.TEXTURE_2D,0,0,0,_.width,_.height,N,$,_.data);else{q.sort((Q,ne)=>Q.start-ne.start);let _e=0;for(let Q=1;Q<q.length;Q++){const ne=q[_e],xe=q[Q],Me=ne.start+ne.count,fe=Ye(xe.start,_.width,4),Ge=Ye(ne.start,_.width,4);xe.start<=Me+1&&fe===Ge&&Ye(xe.start+xe.count-1,_.width,4)===fe?ne.count=Math.max(ne.count,xe.start+xe.count-ne.start):(++_e,q[_e]=xe)}q.length=_e+1;const ae=n.getParameter(n.UNPACK_ROW_LENGTH),Te=n.getParameter(n.UNPACK_SKIP_PIXELS),Ce=n.getParameter(n.UNPACK_SKIP_ROWS);n.pixelStorei(n.UNPACK_ROW_LENGTH,_.width);for(let Q=0,ne=q.length;Q<ne;Q++){const xe=q[Q],Me=Math.floor(xe.start/4),fe=Math.ceil(xe.count/4),Ge=Me%_.width,L=Math.floor(Me/_.width),oe=fe,ie=1;n.pixelStorei(n.UNPACK_SKIP_PIXELS,Ge),n.pixelStorei(n.UNPACK_SKIP_ROWS,L),t.texSubImage2D(n.TEXTURE_2D,0,Ge,L,oe,ie,N,$,_.data)}T.clearUpdateRanges(),n.pixelStorei(n.UNPACK_ROW_LENGTH,ae),n.pixelStorei(n.UNPACK_SKIP_PIXELS,Te),n.pixelStorei(n.UNPACK_SKIP_ROWS,Ce)}}function Z(T,_,N){let $=n.TEXTURE_2D;(_.isDataArrayTexture||_.isCompressedArrayTexture)&&($=n.TEXTURE_2D_ARRAY),_.isData3DTexture&&($=n.TEXTURE_3D);const J=we(T,_),q=_.source;t.bindTexture($,T.__webglTexture,n.TEXTURE0+N);const _e=i.get(q);if(q.version!==_e.__version||J===!0){t.activeTexture(n.TEXTURE0+N);const ae=Xe.getPrimaries(Xe.workingColorSpace),Te=_.colorSpace===bn?null:Xe.getPrimaries(_.colorSpace),Ce=_.colorSpace===bn||ae===Te?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,_.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,_.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ce);let Q=v(_.image,!1,r.maxTextureSize);Q=Oe(_,Q);const ne=s.convert(_.format,_.colorSpace),xe=s.convert(_.type);let Me=b(_.internalFormat,ne,xe,_.colorSpace,_.isVideoTexture);le($,_);let fe;const Ge=_.mipmaps,L=_.isVideoTexture!==!0,oe=_e.__version===void 0||J===!0,ie=q.dataReady,me=R(_,Q);if(_.isDepthTexture)Me=E(_.format===zn,_.type),oe&&(L?t.texStorage2D(n.TEXTURE_2D,1,Me,Q.width,Q.height):t.texImage2D(n.TEXTURE_2D,0,Me,Q.width,Q.height,0,ne,xe,null));else if(_.isDataTexture)if(Ge.length>0){L&&oe&&t.texStorage2D(n.TEXTURE_2D,me,Me,Ge[0].width,Ge[0].height);for(let ee=0,j=Ge.length;ee<j;ee++)fe=Ge[ee],L?ie&&t.texSubImage2D(n.TEXTURE_2D,ee,0,0,fe.width,fe.height,ne,xe,fe.data):t.texImage2D(n.TEXTURE_2D,ee,Me,fe.width,fe.height,0,ne,xe,fe.data);_.generateMipmaps=!1}else L?(oe&&t.texStorage2D(n.TEXTURE_2D,me,Me,Q.width,Q.height),ie&&He(_,Q,ne,xe)):t.texImage2D(n.TEXTURE_2D,0,Me,Q.width,Q.height,0,ne,xe,Q.data);else if(_.isCompressedTexture)if(_.isCompressedArrayTexture){L&&oe&&t.texStorage3D(n.TEXTURE_2D_ARRAY,me,Me,Ge[0].width,Ge[0].height,Q.depth);for(let ee=0,j=Ge.length;ee<j;ee++)if(fe=Ge[ee],_.format!==zt)if(ne!==null)if(L){if(ie)if(_.layerUpdates.size>0){const ve=Qa(fe.width,fe.height,_.format,_.type);for(const Fe of _.layerUpdates){const rt=fe.data.subarray(Fe*ve/fe.data.BYTES_PER_ELEMENT,(Fe+1)*ve/fe.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,ee,0,0,Fe,fe.width,fe.height,1,ne,rt)}_.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,ee,0,0,0,fe.width,fe.height,Q.depth,ne,fe.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,ee,Me,fe.width,fe.height,Q.depth,0,fe.data,0,0);else Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else L?ie&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,ee,0,0,0,fe.width,fe.height,Q.depth,ne,xe,fe.data):t.texImage3D(n.TEXTURE_2D_ARRAY,ee,Me,fe.width,fe.height,Q.depth,0,ne,xe,fe.data)}else{L&&oe&&t.texStorage2D(n.TEXTURE_2D,me,Me,Ge[0].width,Ge[0].height);for(let ee=0,j=Ge.length;ee<j;ee++)fe=Ge[ee],_.format!==zt?ne!==null?L?ie&&t.compressedTexSubImage2D(n.TEXTURE_2D,ee,0,0,fe.width,fe.height,ne,fe.data):t.compressedTexImage2D(n.TEXTURE_2D,ee,Me,fe.width,fe.height,0,fe.data):Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):L?ie&&t.texSubImage2D(n.TEXTURE_2D,ee,0,0,fe.width,fe.height,ne,xe,fe.data):t.texImage2D(n.TEXTURE_2D,ee,Me,fe.width,fe.height,0,ne,xe,fe.data)}else if(_.isDataArrayTexture)if(L){if(oe&&t.texStorage3D(n.TEXTURE_2D_ARRAY,me,Me,Q.width,Q.height,Q.depth),ie)if(_.layerUpdates.size>0){const ee=Qa(Q.width,Q.height,_.format,_.type);for(const j of _.layerUpdates){const ve=Q.data.subarray(j*ee/Q.data.BYTES_PER_ELEMENT,(j+1)*ee/Q.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,j,Q.width,Q.height,1,ne,xe,ve)}_.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Q.width,Q.height,Q.depth,ne,xe,Q.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Me,Q.width,Q.height,Q.depth,0,ne,xe,Q.data);else if(_.isData3DTexture)L?(oe&&t.texStorage3D(n.TEXTURE_3D,me,Me,Q.width,Q.height,Q.depth),ie&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Q.width,Q.height,Q.depth,ne,xe,Q.data)):t.texImage3D(n.TEXTURE_3D,0,Me,Q.width,Q.height,Q.depth,0,ne,xe,Q.data);else if(_.isFramebufferTexture){if(oe)if(L)t.texStorage2D(n.TEXTURE_2D,me,Me,Q.width,Q.height);else{let ee=Q.width,j=Q.height;for(let ve=0;ve<me;ve++)t.texImage2D(n.TEXTURE_2D,ve,Me,ee,j,0,ne,xe,null),ee>>=1,j>>=1}}else if(Ge.length>0){if(L&&oe){const ee=ge(Ge[0]);t.texStorage2D(n.TEXTURE_2D,me,Me,ee.width,ee.height)}for(let ee=0,j=Ge.length;ee<j;ee++)fe=Ge[ee],L?ie&&t.texSubImage2D(n.TEXTURE_2D,ee,0,0,ne,xe,fe):t.texImage2D(n.TEXTURE_2D,ee,Me,ne,xe,fe);_.generateMipmaps=!1}else if(L){if(oe){const ee=ge(Q);t.texStorage2D(n.TEXTURE_2D,me,Me,ee.width,ee.height)}ie&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,ne,xe,Q)}else t.texImage2D(n.TEXTURE_2D,0,Me,ne,xe,Q);m(_)&&u($),_e.__version=q.version,_.onUpdate&&_.onUpdate(_)}T.__version=_.version}function te(T,_,N){if(_.image.length!==6)return;const $=we(T,_),J=_.source;t.bindTexture(n.TEXTURE_CUBE_MAP,T.__webglTexture,n.TEXTURE0+N);const q=i.get(J);if(J.version!==q.__version||$===!0){t.activeTexture(n.TEXTURE0+N);const _e=Xe.getPrimaries(Xe.workingColorSpace),ae=_.colorSpace===bn?null:Xe.getPrimaries(_.colorSpace),Te=_.colorSpace===bn||_e===ae?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,_.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,_.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Te);const Ce=_.isCompressedTexture||_.image[0].isCompressedTexture,Q=_.image[0]&&_.image[0].isDataTexture,ne=[];for(let j=0;j<6;j++)!Ce&&!Q?ne[j]=v(_.image[j],!0,r.maxCubemapSize):ne[j]=Q?_.image[j].image:_.image[j],ne[j]=Oe(_,ne[j]);const xe=ne[0],Me=s.convert(_.format,_.colorSpace),fe=s.convert(_.type),Ge=b(_.internalFormat,Me,fe,_.colorSpace),L=_.isVideoTexture!==!0,oe=q.__version===void 0||$===!0,ie=J.dataReady;let me=R(_,xe);le(n.TEXTURE_CUBE_MAP,_);let ee;if(Ce){L&&oe&&t.texStorage2D(n.TEXTURE_CUBE_MAP,me,Ge,xe.width,xe.height);for(let j=0;j<6;j++){ee=ne[j].mipmaps;for(let ve=0;ve<ee.length;ve++){const Fe=ee[ve];_.format!==zt?Me!==null?L?ie&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+j,ve,0,0,Fe.width,Fe.height,Me,Fe.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+j,ve,Ge,Fe.width,Fe.height,0,Fe.data):Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):L?ie&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+j,ve,0,0,Fe.width,Fe.height,Me,fe,Fe.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+j,ve,Ge,Fe.width,Fe.height,0,Me,fe,Fe.data)}}}else{if(ee=_.mipmaps,L&&oe){ee.length>0&&me++;const j=ge(ne[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,me,Ge,j.width,j.height)}for(let j=0;j<6;j++)if(Q){L?ie&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,0,0,ne[j].width,ne[j].height,Me,fe,ne[j].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,Ge,ne[j].width,ne[j].height,0,Me,fe,ne[j].data);for(let ve=0;ve<ee.length;ve++){const rt=ee[ve].image[j].image;L?ie&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+j,ve+1,0,0,rt.width,rt.height,Me,fe,rt.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+j,ve+1,Ge,rt.width,rt.height,0,Me,fe,rt.data)}}else{L?ie&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,0,0,Me,fe,ne[j]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,Ge,Me,fe,ne[j]);for(let ve=0;ve<ee.length;ve++){const Fe=ee[ve];L?ie&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+j,ve+1,0,0,Me,fe,Fe.image[j]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+j,ve+1,Ge,Me,fe,Fe.image[j])}}}m(_)&&u(n.TEXTURE_CUBE_MAP),q.__version=J.version,_.onUpdate&&_.onUpdate(_)}T.__version=_.version}function re(T,_,N,$,J,q){const _e=s.convert(N.format,N.colorSpace),ae=s.convert(N.type),Te=b(N.internalFormat,_e,ae,N.colorSpace),Ce=i.get(_),Q=i.get(N);if(Q.__renderTarget=_,!Ce.__hasExternalTextures){const ne=Math.max(1,_.width>>q),xe=Math.max(1,_.height>>q);J===n.TEXTURE_3D||J===n.TEXTURE_2D_ARRAY?t.texImage3D(J,q,Te,ne,xe,_.depth,0,_e,ae,null):t.texImage2D(J,q,Te,ne,xe,0,_e,ae,null)}t.bindFramebuffer(n.FRAMEBUFFER,T),at(_)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,$,J,Q.__webglTexture,0,P(_)):(J===n.TEXTURE_2D||J>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&J<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,$,J,Q.__webglTexture,q),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Le(T,_,N){if(n.bindRenderbuffer(n.RENDERBUFFER,T),_.depthBuffer){const $=_.depthTexture,J=$&&$.isDepthTexture?$.type:null,q=E(_.stencilBuffer,J),_e=_.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;at(_)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,P(_),q,_.width,_.height):N?n.renderbufferStorageMultisample(n.RENDERBUFFER,P(_),q,_.width,_.height):n.renderbufferStorage(n.RENDERBUFFER,q,_.width,_.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,_e,n.RENDERBUFFER,T)}else{const $=_.textures;for(let J=0;J<$.length;J++){const q=$[J],_e=s.convert(q.format,q.colorSpace),ae=s.convert(q.type),Te=b(q.internalFormat,_e,ae,q.colorSpace);at(_)?o.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,P(_),Te,_.width,_.height):N?n.renderbufferStorageMultisample(n.RENDERBUFFER,P(_),Te,_.width,_.height):n.renderbufferStorage(n.RENDERBUFFER,Te,_.width,_.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Ae(T,_,N){const $=_.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(n.FRAMEBUFFER,T),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const J=i.get(_.depthTexture);if(J.__renderTarget=_,(!J.__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)&&(_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0),$){if(J.__webglInit===void 0&&(J.__webglInit=!0,_.depthTexture.addEventListener("dispose",A)),J.__webglTexture===void 0){J.__webglTexture=n.createTexture(),t.bindTexture(n.TEXTURE_CUBE_MAP,J.__webglTexture),le(n.TEXTURE_CUBE_MAP,_.depthTexture);const Ce=s.convert(_.depthTexture.format),Q=s.convert(_.depthTexture.type);let ne;_.depthTexture.format===mn?ne=n.DEPTH_COMPONENT24:_.depthTexture.format===zn&&(ne=n.DEPTH24_STENCIL8);for(let xe=0;xe<6;xe++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+xe,0,ne,_.width,_.height,0,Ce,Q,null)}}else G(_.depthTexture,0);const q=J.__webglTexture,_e=P(_),ae=$?n.TEXTURE_CUBE_MAP_POSITIVE_X+N:n.TEXTURE_2D,Te=_.depthTexture.format===zn?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;if(_.depthTexture.format===mn)at(_)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Te,ae,q,0,_e):n.framebufferTexture2D(n.FRAMEBUFFER,Te,ae,q,0);else if(_.depthTexture.format===zn)at(_)?o.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Te,ae,q,0,_e):n.framebufferTexture2D(n.FRAMEBUFFER,Te,ae,q,0);else throw new Error("Unknown depthTexture format")}function Re(T){const _=i.get(T),N=T.isWebGLCubeRenderTarget===!0;if(_.__boundDepthTexture!==T.depthTexture){const $=T.depthTexture;if(_.__depthDisposeCallback&&_.__depthDisposeCallback(),$){const J=()=>{delete _.__boundDepthTexture,delete _.__depthDisposeCallback,$.removeEventListener("dispose",J)};$.addEventListener("dispose",J),_.__depthDisposeCallback=J}_.__boundDepthTexture=$}if(T.depthTexture&&!_.__autoAllocateDepthBuffer)if(N)for(let $=0;$<6;$++)Ae(_.__webglFramebuffer[$],T,$);else{const $=T.texture.mipmaps;$&&$.length>0?Ae(_.__webglFramebuffer[0],T,0):Ae(_.__webglFramebuffer,T,0)}else if(N){_.__webglDepthbuffer=[];for(let $=0;$<6;$++)if(t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer[$]),_.__webglDepthbuffer[$]===void 0)_.__webglDepthbuffer[$]=n.createRenderbuffer(),Le(_.__webglDepthbuffer[$],T,!1);else{const J=T.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,q=_.__webglDepthbuffer[$];n.bindRenderbuffer(n.RENDERBUFFER,q),n.framebufferRenderbuffer(n.FRAMEBUFFER,J,n.RENDERBUFFER,q)}}else{const $=T.texture.mipmaps;if($&&$.length>0?t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer[0]):t.bindFramebuffer(n.FRAMEBUFFER,_.__webglFramebuffer),_.__webglDepthbuffer===void 0)_.__webglDepthbuffer=n.createRenderbuffer(),Le(_.__webglDepthbuffer,T,!1);else{const J=T.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,q=_.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,q),n.framebufferRenderbuffer(n.FRAMEBUFFER,J,n.RENDERBUFFER,q)}}t.bindFramebuffer(n.FRAMEBUFFER,null)}function ot(T,_,N){const $=i.get(T);_!==void 0&&re($.__webglFramebuffer,T,T.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),N!==void 0&&Re(T)}function ke(T){const _=T.texture,N=i.get(T),$=i.get(_);T.addEventListener("dispose",C);const J=T.textures,q=T.isWebGLCubeRenderTarget===!0,_e=J.length>1;if(_e||($.__webglTexture===void 0&&($.__webglTexture=n.createTexture()),$.__version=_.version,a.memory.textures++),q){N.__webglFramebuffer=[];for(let ae=0;ae<6;ae++)if(_.mipmaps&&_.mipmaps.length>0){N.__webglFramebuffer[ae]=[];for(let Te=0;Te<_.mipmaps.length;Te++)N.__webglFramebuffer[ae][Te]=n.createFramebuffer()}else N.__webglFramebuffer[ae]=n.createFramebuffer()}else{if(_.mipmaps&&_.mipmaps.length>0){N.__webglFramebuffer=[];for(let ae=0;ae<_.mipmaps.length;ae++)N.__webglFramebuffer[ae]=n.createFramebuffer()}else N.__webglFramebuffer=n.createFramebuffer();if(_e)for(let ae=0,Te=J.length;ae<Te;ae++){const Ce=i.get(J[ae]);Ce.__webglTexture===void 0&&(Ce.__webglTexture=n.createTexture(),a.memory.textures++)}if(T.samples>0&&at(T)===!1){N.__webglMultisampledFramebuffer=n.createFramebuffer(),N.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,N.__webglMultisampledFramebuffer);for(let ae=0;ae<J.length;ae++){const Te=J[ae];N.__webglColorRenderbuffer[ae]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,N.__webglColorRenderbuffer[ae]);const Ce=s.convert(Te.format,Te.colorSpace),Q=s.convert(Te.type),ne=b(Te.internalFormat,Ce,Q,Te.colorSpace,T.isXRRenderTarget===!0),xe=P(T);n.renderbufferStorageMultisample(n.RENDERBUFFER,xe,ne,T.width,T.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+ae,n.RENDERBUFFER,N.__webglColorRenderbuffer[ae])}n.bindRenderbuffer(n.RENDERBUFFER,null),T.depthBuffer&&(N.__webglDepthRenderbuffer=n.createRenderbuffer(),Le(N.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(q){t.bindTexture(n.TEXTURE_CUBE_MAP,$.__webglTexture),le(n.TEXTURE_CUBE_MAP,_);for(let ae=0;ae<6;ae++)if(_.mipmaps&&_.mipmaps.length>0)for(let Te=0;Te<_.mipmaps.length;Te++)re(N.__webglFramebuffer[ae][Te],T,_,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+ae,Te);else re(N.__webglFramebuffer[ae],T,_,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0);m(_)&&u(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(_e){for(let ae=0,Te=J.length;ae<Te;ae++){const Ce=J[ae],Q=i.get(Ce);let ne=n.TEXTURE_2D;(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(ne=T.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(ne,Q.__webglTexture),le(ne,Ce),re(N.__webglFramebuffer,T,Ce,n.COLOR_ATTACHMENT0+ae,ne,0),m(Ce)&&u(ne)}t.unbindTexture()}else{let ae=n.TEXTURE_2D;if((T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(ae=T.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY),t.bindTexture(ae,$.__webglTexture),le(ae,_),_.mipmaps&&_.mipmaps.length>0)for(let Te=0;Te<_.mipmaps.length;Te++)re(N.__webglFramebuffer[Te],T,_,n.COLOR_ATTACHMENT0,ae,Te);else re(N.__webglFramebuffer,T,_,n.COLOR_ATTACHMENT0,ae,0);m(_)&&u(ae),t.unbindTexture()}T.depthBuffer&&Re(T)}function $e(T){const _=T.textures;for(let N=0,$=_.length;N<$;N++){const J=_[N];if(m(J)){const q=S(T),_e=i.get(J).__webglTexture;t.bindTexture(q,_e),u(q),t.unbindTexture()}}}const Ze=[],Ne=[];function st(T){if(T.samples>0){if(at(T)===!1){const _=T.textures,N=T.width,$=T.height;let J=n.COLOR_BUFFER_BIT;const q=T.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,_e=i.get(T),ae=_.length>1;if(ae)for(let Ce=0;Ce<_.length;Ce++)t.bindFramebuffer(n.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ce,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,_e.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ce,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,_e.__webglMultisampledFramebuffer);const Te=T.texture.mipmaps;Te&&Te.length>0?t.bindFramebuffer(n.DRAW_FRAMEBUFFER,_e.__webglFramebuffer[0]):t.bindFramebuffer(n.DRAW_FRAMEBUFFER,_e.__webglFramebuffer);for(let Ce=0;Ce<_.length;Ce++){if(T.resolveDepthBuffer&&(T.depthBuffer&&(J|=n.DEPTH_BUFFER_BIT),T.stencilBuffer&&T.resolveStencilBuffer&&(J|=n.STENCIL_BUFFER_BIT)),ae){n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,_e.__webglColorRenderbuffer[Ce]);const Q=i.get(_[Ce]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,Q,0)}n.blitFramebuffer(0,0,N,$,0,0,N,$,J,n.NEAREST),l===!0&&(Ze.length=0,Ne.length=0,Ze.push(n.COLOR_ATTACHMENT0+Ce),T.depthBuffer&&T.resolveDepthBuffer===!1&&(Ze.push(q),Ne.push(q),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,Ne)),n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Ze))}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),ae)for(let Ce=0;Ce<_.length;Ce++){t.bindFramebuffer(n.FRAMEBUFFER,_e.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ce,n.RENDERBUFFER,_e.__webglColorRenderbuffer[Ce]);const Q=i.get(_[Ce]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,_e.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+Ce,n.TEXTURE_2D,Q,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,_e.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.resolveDepthBuffer===!1&&l){const _=T.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT;n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[_])}}}function P(T){return Math.min(r.maxSamples,T.samples)}function at(T){const _=i.get(T);return T.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&_.__useRenderToTexture!==!1}function De(T){const _=a.render.frame;d.get(T)!==_&&(d.set(T,_),T.update())}function Oe(T,_){const N=T.colorSpace,$=T.format,J=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||N!==kn&&N!==bn&&(Xe.getTransfer(N)===Qe?($!==zt||J!==It)&&Ie("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):qe("WebGLTextures: Unsupported texture color space:",N)),_}function ge(T){return typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement?(c.width=T.naturalWidth||T.width,c.height=T.naturalHeight||T.height):typeof VideoFrame<"u"&&T instanceof VideoFrame?(c.width=T.displayWidth,c.height=T.displayHeight):(c.width=T.width,c.height=T.height),c}this.allocateTextureUnit=B,this.resetTextureUnits=F,this.setTexture2D=G,this.setTexture2DArray=V,this.setTexture3D=U,this.setTextureCube=K,this.rebindTextures=ot,this.setupRenderTarget=ke,this.updateRenderTargetMipmap=$e,this.updateMultisampleRenderTarget=st,this.setupDepthRenderbuffer=Re,this.setupFrameBufferTexture=re,this.useMultisampledRTT=at,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function tm(n,e){function t(i,r=bn){let s;const a=Xe.getTransfer(r);if(i===It)return n.UNSIGNED_BYTE;if(i===sa)return n.UNSIGNED_SHORT_4_4_4_4;if(i===aa)return n.UNSIGNED_SHORT_5_5_5_1;if(i===sl)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===al)return n.UNSIGNED_INT_10F_11F_11F_REV;if(i===il)return n.BYTE;if(i===rl)return n.SHORT;if(i===Ci)return n.UNSIGNED_SHORT;if(i===ra)return n.INT;if(i===Kt)return n.UNSIGNED_INT;if(i===qt)return n.FLOAT;if(i===pn)return n.HALF_FLOAT;if(i===ol)return n.ALPHA;if(i===ll)return n.RGB;if(i===zt)return n.RGBA;if(i===mn)return n.DEPTH_COMPONENT;if(i===zn)return n.DEPTH_STENCIL;if(i===cl)return n.RED;if(i===oa)return n.RED_INTEGER;if(i===di)return n.RG;if(i===la)return n.RG_INTEGER;if(i===ca)return n.RGBA_INTEGER;if(i===lr||i===cr||i===hr||i===dr)if(a===Qe)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===lr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===cr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===hr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===dr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===lr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===cr)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===hr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===dr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===vs||i===Ms||i===Ss||i===Es)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===vs)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Ms)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Ss)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===Es)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===ys||i===bs||i===Ts||i===As||i===ws||i===Rs||i===Cs)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===ys||i===bs)return a===Qe?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===Ts)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(i===As)return s.COMPRESSED_R11_EAC;if(i===ws)return s.COMPRESSED_SIGNED_R11_EAC;if(i===Rs)return s.COMPRESSED_RG11_EAC;if(i===Cs)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===Ps||i===Ds||i===Ls||i===Is||i===Ns||i===Fs||i===Us||i===Os||i===Bs||i===zs||i===Gs||i===Vs||i===ks||i===Hs)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===Ps)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Ds)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Ls)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Is)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Ns)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Fs)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Us)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Os)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Bs)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===zs)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Gs)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Vs)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===ks)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Hs)return a===Qe?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Ws||i===Xs||i===js)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Ws)return a===Qe?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Xs)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===js)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===qs||i===Ys||i===$s||i===Zs)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===qs)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Ys)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===$s)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Zs)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Pi?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}const nm=`
4026
4026
  void main() {
4027
4027
 
4028
4028
  gl_Position = vec4( position, 1.0 );
4029
4029
 
4030
- }`,Jp=`
4030
+ }`,im=`
4031
4031
  uniform sampler2DArray depthColor;
4032
4032
  uniform float depthWidth;
4033
4033
  uniform float depthHeight;
@@ -4046,13 +4046,13 @@ void main() {
4046
4046
 
4047
4047
  }
4048
4048
 
4049
- }`;class Qp{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const i=new ml(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new Qt({vertexShader:Kp,fragmentShader:Jp,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Jt(new Mr(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class em extends fi{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,p=null,h=null,f=null,g=null;const v=typeof XRWebGLBinding<"u",m=new Qp,d={},S=t.getContextAttributes();let b=null,E=null;const R=[],A=[],C=new Ke;let x=null;const y=new Bt;y.viewport=new ct;const z=new Bt;z.viewport=new ct;const w=[y,z],F=new hh;let B=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let te=R[Z];return te===void 0&&(te=new Fr,R[Z]=te),te.getTargetRaySpace()},this.getControllerGrip=function(Z){let te=R[Z];return te===void 0&&(te=new Fr,R[Z]=te),te.getGripSpace()},this.getHand=function(Z){let te=R[Z];return te===void 0&&(te=new Fr,R[Z]=te),te.getHandSpace()};function G(Z){const te=A.indexOf(Z.inputSource);if(te===-1)return;const re=R[te];re!==void 0&&(re.update(Z.inputSource,Z.frame,c||a),re.dispatchEvent({type:Z.type,data:Z.inputSource}))}function V(){r.removeEventListener("select",G),r.removeEventListener("selectstart",G),r.removeEventListener("selectend",G),r.removeEventListener("squeeze",G),r.removeEventListener("squeezestart",G),r.removeEventListener("squeezeend",G),r.removeEventListener("end",V),r.removeEventListener("inputsourceschange",U);for(let Z=0;Z<R.length;Z++){const te=A[Z];te!==null&&(A[Z]=null,R[Z].disconnect(te))}B=null,I=null,m.reset();for(const Z in d)delete d[Z];e.setRenderTarget(b),f=null,h=null,p=null,r=null,E=null,He.stop(),i.isPresenting=!1,e.setPixelRatio(x),e.setSize(C.width,C.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Z){s=Z,i.isPresenting===!0&&Ie("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Z){o=Z,i.isPresenting===!0&&Ie("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(Z){c=Z},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return p===null&&v&&(p=new XRWebGLBinding(r,t)),p},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(Z){if(r=Z,r!==null){if(b=e.getRenderTarget(),r.addEventListener("select",G),r.addEventListener("selectstart",G),r.addEventListener("selectend",G),r.addEventListener("squeeze",G),r.addEventListener("squeezestart",G),r.addEventListener("squeezeend",G),r.addEventListener("end",V),r.addEventListener("inputsourceschange",U),S.xrCompatible!==!0&&await t.makeXRCompatible(),x=e.getPixelRatio(),e.getSize(C),v&&"createProjectionLayer"in XRWebGLBinding.prototype){let re=null,Le=null,Ae=null;S.depth&&(Ae=S.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,re=S.stencil?zn:mn,Le=S.stencil?Pi:Kt);const Re={colorFormat:t.RGBA8,depthFormat:Ae,scaleFactor:s};p=this.getBinding(),h=p.createProjectionLayer(Re),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),E=new Zt(h.textureWidth,h.textureHeight,{format:zt,type:It,depthTexture:new Di(h.textureWidth,h.textureHeight,Le,void 0,void 0,void 0,void 0,void 0,void 0,re),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:S.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const re={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(r,t,re),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),E=new Zt(f.framebufferWidth,f.framebufferHeight,{format:zt,type:It,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}E.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),He.setContext(r),He.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function U(Z){for(let te=0;te<Z.removed.length;te++){const re=Z.removed[te],Le=A.indexOf(re);Le>=0&&(A[Le]=null,R[Le].disconnect(re))}for(let te=0;te<Z.added.length;te++){const re=Z.added[te];let Le=A.indexOf(re);if(Le===-1){for(let Re=0;Re<R.length;Re++)if(Re>=A.length){A.push(re),Le=Re;break}else if(A[Re]===null){A[Re]=re,Le=Re;break}if(Le===-1)break}const Ae=R[Le];Ae&&Ae.connect(re)}}const K=new W,Y=new W;function se(Z,te,re){K.setFromMatrixPosition(te.matrixWorld),Y.setFromMatrixPosition(re.matrixWorld);const Le=K.distanceTo(Y),Ae=te.projectionMatrix.elements,Re=re.projectionMatrix.elements,ot=Ae[14]/(Ae[10]-1),ke=Ae[14]/(Ae[10]+1),$e=(Ae[9]+1)/Ae[5],Ze=(Ae[9]-1)/Ae[5],Ne=(Ae[8]-1)/Ae[0],st=(Re[8]+1)/Re[0],P=ot*Ne,at=ot*st,Pe=Le/(-Ne+st),Oe=Pe*-Ne;if(te.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(Oe),Z.translateZ(Pe),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert(),Ae[10]===-1)Z.projectionMatrix.copy(te.projectionMatrix),Z.projectionMatrixInverse.copy(te.projectionMatrixInverse);else{const ge=ot+Pe,T=ke+Pe,_=P-Oe,N=at+(Le-Oe),$=$e*ke/T*ge,J=Ze*ke/T*ge;Z.projectionMatrix.makePerspective(_,N,$,J,ge,T),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}}function ce(Z,te){te===null?Z.matrixWorld.copy(Z.matrix):Z.matrixWorld.multiplyMatrices(te.matrixWorld,Z.matrix),Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(r===null)return;let te=Z.near,re=Z.far;m.texture!==null&&(m.depthNear>0&&(te=m.depthNear),m.depthFar>0&&(re=m.depthFar)),F.near=z.near=y.near=te,F.far=z.far=y.far=re,(B!==F.near||I!==F.far)&&(r.updateRenderState({depthNear:F.near,depthFar:F.far}),B=F.near,I=F.far),F.layers.mask=Z.layers.mask|6,y.layers.mask=F.layers.mask&-5,z.layers.mask=F.layers.mask&-3;const Le=Z.parent,Ae=F.cameras;ce(F,Le);for(let Re=0;Re<Ae.length;Re++)ce(Ae[Re],Le);Ae.length===2?se(F,y,z):F.projectionMatrix.copy(y.projectionMatrix),le(Z,F,Le)};function le(Z,te,re){re===null?Z.matrix.copy(te.matrixWorld):(Z.matrix.copy(re.matrixWorld),Z.matrix.invert(),Z.matrix.multiply(te.matrixWorld)),Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.updateMatrixWorld(!0),Z.projectionMatrix.copy(te.projectionMatrix),Z.projectionMatrixInverse.copy(te.projectionMatrixInverse),Z.isPerspectiveCamera&&(Z.fov=Ks*2*Math.atan(1/Z.projectionMatrix.elements[5]),Z.zoom=1)}this.getCamera=function(){return F},this.getFoveation=function(){if(!(h===null&&f===null))return l},this.setFoveation=function(Z){l=Z,h!==null&&(h.fixedFoveation=Z),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Z)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(F)},this.getCameraTexture=function(Z){return d[Z]};let we=null;function Ye(Z,te){if(u=te.getViewerPose(c||a),g=te,u!==null){const re=u.views;f!==null&&(e.setRenderTargetFramebuffer(E,f.framebuffer),e.setRenderTarget(E));let Le=!1;re.length!==F.cameras.length&&(F.cameras.length=0,Le=!0);for(let ke=0;ke<re.length;ke++){const $e=re[ke];let Ze=null;if(f!==null)Ze=f.getViewport($e);else{const st=p.getViewSubImage(h,$e);Ze=st.viewport,ke===0&&(e.setRenderTargetTextures(E,st.colorTexture,st.depthStencilTexture),e.setRenderTarget(E))}let Ne=w[ke];Ne===void 0&&(Ne=new Bt,Ne.layers.enable(ke),Ne.viewport=new ct,w[ke]=Ne),Ne.matrix.fromArray($e.transform.matrix),Ne.matrix.decompose(Ne.position,Ne.quaternion,Ne.scale),Ne.projectionMatrix.fromArray($e.projectionMatrix),Ne.projectionMatrixInverse.copy(Ne.projectionMatrix).invert(),Ne.viewport.set(Ze.x,Ze.y,Ze.width,Ze.height),ke===0&&(F.matrix.copy(Ne.matrix),F.matrix.decompose(F.position,F.quaternion,F.scale)),Le===!0&&F.cameras.push(Ne)}const Ae=r.enabledFeatures;if(Ae&&Ae.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&v){p=i.getBinding();const ke=p.getDepthInformation(re[0]);ke&&ke.isValid&&ke.texture&&m.init(ke,r.renderState)}if(Ae&&Ae.includes("camera-access")&&v){e.state.unbindTexture(),p=i.getBinding();for(let ke=0;ke<re.length;ke++){const $e=re[ke].camera;if($e){let Ze=d[$e];Ze||(Ze=new ml,d[$e]=Ze);const Ne=p.getCameraImage($e);Ze.sourceTexture=Ne}}}}for(let re=0;re<R.length;re++){const Le=A[re],Ae=R[re];Le!==null&&Ae!==void 0&&Ae.update(Le,te,c||a)}we&&we(Z,te),te.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:te}),g=null}const He=new vl;He.setAnimationLoop(Ye),this.setAnimationLoop=function(Z){we=Z},this.dispose=function(){}}}const Nn=new Hn,tm=new dt;function nm(n,e){function t(m,d){m.matrixAutoUpdate===!0&&m.updateMatrix(),d.value.copy(m.matrix)}function i(m,d){d.color.getRGB(m.fogColor.value,gl(n)),d.isFog?(m.fogNear.value=d.near,m.fogFar.value=d.far):d.isFogExp2&&(m.fogDensity.value=d.density)}function r(m,d,S,b,E){d.isMeshBasicMaterial?s(m,d):d.isMeshLambertMaterial?(s(m,d),d.envMap&&(m.envMapIntensity.value=d.envMapIntensity)):d.isMeshToonMaterial?(s(m,d),p(m,d)):d.isMeshPhongMaterial?(s(m,d),u(m,d),d.envMap&&(m.envMapIntensity.value=d.envMapIntensity)):d.isMeshStandardMaterial?(s(m,d),h(m,d),d.isMeshPhysicalMaterial&&f(m,d,E)):d.isMeshMatcapMaterial?(s(m,d),g(m,d)):d.isMeshDepthMaterial?s(m,d):d.isMeshDistanceMaterial?(s(m,d),v(m,d)):d.isMeshNormalMaterial?s(m,d):d.isLineBasicMaterial?(a(m,d),d.isLineDashedMaterial&&o(m,d)):d.isPointsMaterial?l(m,d,S,b):d.isSpriteMaterial?c(m,d):d.isShadowMaterial?(m.color.value.copy(d.color),m.opacity.value=d.opacity):d.isShaderMaterial&&(d.uniformsNeedUpdate=!1)}function s(m,d){m.opacity.value=d.opacity,d.color&&m.diffuse.value.copy(d.color),d.emissive&&m.emissive.value.copy(d.emissive).multiplyScalar(d.emissiveIntensity),d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.bumpMap&&(m.bumpMap.value=d.bumpMap,t(d.bumpMap,m.bumpMapTransform),m.bumpScale.value=d.bumpScale,d.side===At&&(m.bumpScale.value*=-1)),d.normalMap&&(m.normalMap.value=d.normalMap,t(d.normalMap,m.normalMapTransform),m.normalScale.value.copy(d.normalScale),d.side===At&&m.normalScale.value.negate()),d.displacementMap&&(m.displacementMap.value=d.displacementMap,t(d.displacementMap,m.displacementMapTransform),m.displacementScale.value=d.displacementScale,m.displacementBias.value=d.displacementBias),d.emissiveMap&&(m.emissiveMap.value=d.emissiveMap,t(d.emissiveMap,m.emissiveMapTransform)),d.specularMap&&(m.specularMap.value=d.specularMap,t(d.specularMap,m.specularMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest);const S=e.get(d),b=S.envMap,E=S.envMapRotation;b&&(m.envMap.value=b,Nn.copy(E),Nn.x*=-1,Nn.y*=-1,Nn.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(Nn.y*=-1,Nn.z*=-1),m.envMapRotation.value.setFromMatrix4(tm.makeRotationFromEuler(Nn)),m.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=d.reflectivity,m.ior.value=d.ior,m.refractionRatio.value=d.refractionRatio),d.lightMap&&(m.lightMap.value=d.lightMap,m.lightMapIntensity.value=d.lightMapIntensity,t(d.lightMap,m.lightMapTransform)),d.aoMap&&(m.aoMap.value=d.aoMap,m.aoMapIntensity.value=d.aoMapIntensity,t(d.aoMap,m.aoMapTransform))}function a(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform))}function o(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function l(m,d,S,b){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*S,m.scale.value=b*.5,d.map&&(m.map.value=d.map,t(d.map,m.uvTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function c(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.rotation.value=d.rotation,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function u(m,d){m.specular.value.copy(d.specular),m.shininess.value=Math.max(d.shininess,1e-4)}function p(m,d){d.gradientMap&&(m.gradientMap.value=d.gradientMap)}function h(m,d){m.metalness.value=d.metalness,d.metalnessMap&&(m.metalnessMap.value=d.metalnessMap,t(d.metalnessMap,m.metalnessMapTransform)),m.roughness.value=d.roughness,d.roughnessMap&&(m.roughnessMap.value=d.roughnessMap,t(d.roughnessMap,m.roughnessMapTransform)),d.envMap&&(m.envMapIntensity.value=d.envMapIntensity)}function f(m,d,S){m.ior.value=d.ior,d.sheen>0&&(m.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),m.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(m.sheenColorMap.value=d.sheenColorMap,t(d.sheenColorMap,m.sheenColorMapTransform)),d.sheenRoughnessMap&&(m.sheenRoughnessMap.value=d.sheenRoughnessMap,t(d.sheenRoughnessMap,m.sheenRoughnessMapTransform))),d.clearcoat>0&&(m.clearcoat.value=d.clearcoat,m.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(m.clearcoatMap.value=d.clearcoatMap,t(d.clearcoatMap,m.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,t(d.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(m.clearcoatNormalMap.value=d.clearcoatNormalMap,t(d.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===At&&m.clearcoatNormalScale.value.negate())),d.dispersion>0&&(m.dispersion.value=d.dispersion),d.iridescence>0&&(m.iridescence.value=d.iridescence,m.iridescenceIOR.value=d.iridescenceIOR,m.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(m.iridescenceMap.value=d.iridescenceMap,t(d.iridescenceMap,m.iridescenceMapTransform)),d.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=d.iridescenceThicknessMap,t(d.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),d.transmission>0&&(m.transmission.value=d.transmission,m.transmissionSamplerMap.value=S.texture,m.transmissionSamplerSize.value.set(S.width,S.height),d.transmissionMap&&(m.transmissionMap.value=d.transmissionMap,t(d.transmissionMap,m.transmissionMapTransform)),m.thickness.value=d.thickness,d.thicknessMap&&(m.thicknessMap.value=d.thicknessMap,t(d.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=d.attenuationDistance,m.attenuationColor.value.copy(d.attenuationColor)),d.anisotropy>0&&(m.anisotropyVector.value.set(d.anisotropy*Math.cos(d.anisotropyRotation),d.anisotropy*Math.sin(d.anisotropyRotation)),d.anisotropyMap&&(m.anisotropyMap.value=d.anisotropyMap,t(d.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=d.specularIntensity,m.specularColor.value.copy(d.specularColor),d.specularColorMap&&(m.specularColorMap.value=d.specularColorMap,t(d.specularColorMap,m.specularColorMapTransform)),d.specularIntensityMap&&(m.specularIntensityMap.value=d.specularIntensityMap,t(d.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,d){d.matcap&&(m.matcap.value=d.matcap)}function v(m,d){const S=e.get(d).light;m.referencePosition.value.setFromMatrixPosition(S.matrixWorld),m.nearDistance.value=S.shadow.camera.near,m.farDistance.value=S.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function im(n,e,t,i){let r={},s={},a=[];const o=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(S,b){const E=b.program;i.uniformBlockBinding(S,E)}function c(S,b){let E=r[S.id];E===void 0&&(g(S),E=u(S),r[S.id]=E,S.addEventListener("dispose",m));const R=b.program;i.updateUBOMapping(S,R);const A=e.render.frame;s[S.id]!==A&&(h(S),s[S.id]=A)}function u(S){const b=p();S.__bindingPointIndex=b;const E=n.createBuffer(),R=S.__size,A=S.usage;return n.bindBuffer(n.UNIFORM_BUFFER,E),n.bufferData(n.UNIFORM_BUFFER,R,A),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,b,E),E}function p(){for(let S=0;S<o;S++)if(a.indexOf(S)===-1)return a.push(S),S;return je("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(S){const b=r[S.id],E=S.uniforms,R=S.__cache;n.bindBuffer(n.UNIFORM_BUFFER,b);for(let A=0,C=E.length;A<C;A++){const x=Array.isArray(E[A])?E[A]:[E[A]];for(let y=0,z=x.length;y<z;y++){const w=x[y];if(f(w,A,y,R)===!0){const F=w.__offset,B=Array.isArray(w.value)?w.value:[w.value];let I=0;for(let G=0;G<B.length;G++){const V=B[G],U=v(V);typeof V=="number"||typeof V=="boolean"?(w.__data[0]=V,n.bufferSubData(n.UNIFORM_BUFFER,F+I,w.__data)):V.isMatrix3?(w.__data[0]=V.elements[0],w.__data[1]=V.elements[1],w.__data[2]=V.elements[2],w.__data[3]=0,w.__data[4]=V.elements[3],w.__data[5]=V.elements[4],w.__data[6]=V.elements[5],w.__data[7]=0,w.__data[8]=V.elements[6],w.__data[9]=V.elements[7],w.__data[10]=V.elements[8],w.__data[11]=0):(V.toArray(w.__data,I),I+=U.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,F,w.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function f(S,b,E,R){const A=S.value,C=b+"_"+E;if(R[C]===void 0)return typeof A=="number"||typeof A=="boolean"?R[C]=A:R[C]=A.clone(),!0;{const x=R[C];if(typeof A=="number"||typeof A=="boolean"){if(x!==A)return R[C]=A,!0}else if(x.equals(A)===!1)return x.copy(A),!0}return!1}function g(S){const b=S.uniforms;let E=0;const R=16;for(let C=0,x=b.length;C<x;C++){const y=Array.isArray(b[C])?b[C]:[b[C]];for(let z=0,w=y.length;z<w;z++){const F=y[z],B=Array.isArray(F.value)?F.value:[F.value];for(let I=0,G=B.length;I<G;I++){const V=B[I],U=v(V),K=E%R,Y=K%U.boundary,se=K+Y;E+=Y,se!==0&&R-se<U.storage&&(E+=R-se),F.__data=new Float32Array(U.storage/Float32Array.BYTES_PER_ELEMENT),F.__offset=E,E+=U.storage}}}const A=E%R;return A>0&&(E+=R-A),S.__size=E,S.__cache={},this}function v(S){const b={boundary:0,storage:0};return typeof S=="number"||typeof S=="boolean"?(b.boundary=4,b.storage=4):S.isVector2?(b.boundary=8,b.storage=8):S.isVector3||S.isColor?(b.boundary=16,b.storage=12):S.isVector4?(b.boundary=16,b.storage=16):S.isMatrix3?(b.boundary=48,b.storage=48):S.isMatrix4?(b.boundary=64,b.storage=64):S.isTexture?Ie("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Ie("WebGLRenderer: Unsupported uniform value type.",S),b}function m(S){const b=S.target;b.removeEventListener("dispose",m);const E=a.indexOf(b.__bindingPointIndex);a.splice(E,1),n.deleteBuffer(r[b.id]),delete r[b.id],delete s[b.id]}function d(){for(const S in r)n.deleteBuffer(r[S]);a=[],r={},s={}}return{bind:l,update:c,dispose:d}}const rm=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]);let Xt=null;function sm(){return Xt===null&&(Xt=new Jc(rm,16,16,ui,pn),Xt.name="DFG_LUT",Xt.minFilter=Et,Xt.magFilter=Et,Xt.wrapS=hn,Xt.wrapT=hn,Xt.generateMipmaps=!1,Xt.needsUpdate=!0),Xt}class am{constructor(e={}){const{canvas:t=Rc(),context:i=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:p=!1,reversedDepthBuffer:h=!1,outputBufferType:f=It}=e;this.isWebGLRenderer=!0;let g;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=i.getContextAttributes().alpha}else g=a;const v=f,m=new Set([ca,la,oa]),d=new Set([It,Kt,Ci,Pi,sa,aa]),S=new Uint32Array(4),b=new Int32Array(4);let E=null,R=null;const A=[],C=[];let x=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=$t,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const y=this;let z=!1;this._outputColorSpace=Lt;let w=0,F=0,B=null,I=-1,G=null;const V=new ct,U=new ct;let K=null;const Y=new nt(0);let se=0,ce=t.width,le=t.height,we=1,Ye=null,He=null;const Z=new ct(0,0,ce,le),te=new ct(0,0,ce,le);let re=!1;const Le=new fl;let Ae=!1,Re=!1;const ot=new dt,ke=new W,$e=new ct,Ze={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ne=!1;function st(){return B===null?we:1}let P=i;function at(M,O){return t.getContext(M,O)}try{const M={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:p};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${ia}`),t.addEventListener("webglcontextlost",ve,!1),t.addEventListener("webglcontextrestored",Fe,!1),t.addEventListener("webglcontextcreationerror",rt,!1),P===null){const O="webgl2";if(P=at(O,M),P===null)throw at(O)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(M){throw je("WebGLRenderer: "+M.message),M}let Pe,Oe,ge,T,_,N,$,J,j,_e,ae,Te,Ce,Q,ne,xe,Me,fe,Ge,D,oe,ie,me;function ee(){Pe=new af(P),Pe.init(),oe=new Zp(P,Pe),Oe=new Kd(P,Pe,e,oe),ge=new Yp(P,Pe),Oe.reversedDepthBuffer&&h&&ge.buffers.depth.setReversed(!0),T=new cf(P),_=new Np,N=new $p(P,Pe,ge,_,Oe,oe,T),$=new sf(y),J=new fh(P),ie=new $d(P,J),j=new of(P,J,T,ie),_e=new uf(P,j,J,ie,T),fe=new hf(P,Oe,N),ne=new Jd(_),ae=new Ip(y,$,Pe,Oe,ie,ne),Te=new nm(y,_),Ce=new Up,Q=new kp(Pe),Me=new Yd(y,$,ge,_e,g,l),xe=new jp(y,_e,Oe),me=new im(P,T,Oe,ge),Ge=new Zd(P,Pe,T),D=new lf(P,Pe,T),T.programs=ae.programs,y.capabilities=Oe,y.extensions=Pe,y.properties=_,y.renderLists=Ce,y.shadowMap=xe,y.state=ge,y.info=T}ee(),v!==It&&(x=new ff(v,t.width,t.height,r,s));const q=new em(y,P);this.xr=q,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const M=Pe.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){const M=Pe.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return we},this.setPixelRatio=function(M){M!==void 0&&(we=M,this.setSize(ce,le,!1))},this.getSize=function(M){return M.set(ce,le)},this.setSize=function(M,O,X=!0){if(q.isPresenting){Ie("WebGLRenderer: Can't change size while VR device is presenting.");return}ce=M,le=O,t.width=Math.floor(M*we),t.height=Math.floor(O*we),X===!0&&(t.style.width=M+"px",t.style.height=O+"px"),x!==null&&x.setSize(t.width,t.height),this.setViewport(0,0,M,O)},this.getDrawingBufferSize=function(M){return M.set(ce*we,le*we).floor()},this.setDrawingBufferSize=function(M,O,X){ce=M,le=O,we=X,t.width=Math.floor(M*X),t.height=Math.floor(O*X),this.setViewport(0,0,M,O)},this.setEffects=function(M){if(v===It){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(M){for(let O=0;O<M.length;O++)if(M[O].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}x.setEffects(M||[])},this.getCurrentViewport=function(M){return M.copy(V)},this.getViewport=function(M){return M.copy(Z)},this.setViewport=function(M,O,X,H){M.isVector4?Z.set(M.x,M.y,M.z,M.w):Z.set(M,O,X,H),ge.viewport(V.copy(Z).multiplyScalar(we).round())},this.getScissor=function(M){return M.copy(te)},this.setScissor=function(M,O,X,H){M.isVector4?te.set(M.x,M.y,M.z,M.w):te.set(M,O,X,H),ge.scissor(U.copy(te).multiplyScalar(we).round())},this.getScissorTest=function(){return re},this.setScissorTest=function(M){ge.setScissorTest(re=M)},this.setOpaqueSort=function(M){Ye=M},this.setTransparentSort=function(M){He=M},this.getClearColor=function(M){return M.copy(Me.getClearColor())},this.setClearColor=function(){Me.setClearColor(...arguments)},this.getClearAlpha=function(){return Me.getClearAlpha()},this.setClearAlpha=function(){Me.setClearAlpha(...arguments)},this.clear=function(M=!0,O=!0,X=!0){let H=0;if(M){let k=!1;if(B!==null){const ue=B.texture.format;k=m.has(ue)}if(k){const ue=B.texture.type,pe=d.has(ue),de=Me.getClearColor(),Se=Me.getClearAlpha(),ye=de.r,Ue=de.g,Ve=de.b;pe?(S[0]=ye,S[1]=Ue,S[2]=Ve,S[3]=Se,P.clearBufferuiv(P.COLOR,0,S)):(b[0]=ye,b[1]=Ue,b[2]=Ve,b[3]=Se,P.clearBufferiv(P.COLOR,0,b))}else H|=P.COLOR_BUFFER_BIT}O&&(H|=P.DEPTH_BUFFER_BIT),X&&(H|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H!==0&&P.clear(H)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",ve,!1),t.removeEventListener("webglcontextrestored",Fe,!1),t.removeEventListener("webglcontextcreationerror",rt,!1),Me.dispose(),Ce.dispose(),Q.dispose(),_.dispose(),$.dispose(),_e.dispose(),ie.dispose(),me.dispose(),ae.dispose(),q.dispose(),q.removeEventListener("sessionstart",ga),q.removeEventListener("sessionend",_a),wn.stop()};function ve(M){M.preventDefault(),Fa("WebGLRenderer: Context Lost."),z=!0}function Fe(){Fa("WebGLRenderer: Context Restored."),z=!1;const M=T.autoReset,O=xe.enabled,X=xe.autoUpdate,H=xe.needsUpdate,k=xe.type;ee(),T.autoReset=M,xe.enabled=O,xe.autoUpdate=X,xe.needsUpdate=H,xe.type=k}function rt(M){je("WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function Je(M){const O=M.target;O.removeEventListener("dispose",Je),tn(O)}function tn(M){nn(M),_.remove(M)}function nn(M){const O=_.get(M).programs;O!==void 0&&(O.forEach(function(X){ae.releaseProgram(X)}),M.isShaderMaterial&&ae.releaseShaderCache(M))}this.renderBufferDirect=function(M,O,X,H,k,ue){O===null&&(O=Ze);const pe=k.isMesh&&k.matrixWorld.determinant()<0,de=Dl(M,O,X,H,k);ge.setMaterial(H,pe);let Se=X.index,ye=1;if(H.wireframe===!0){if(Se=j.getWireframeAttribute(X),Se===void 0)return;ye=2}const Ue=X.drawRange,Ve=X.attributes.position;let be=Ue.start*ye,et=(Ue.start+Ue.count)*ye;ue!==null&&(be=Math.max(be,ue.start*ye),et=Math.min(et,(ue.start+ue.count)*ye)),Se!==null?(be=Math.max(be,0),et=Math.min(et,Se.count)):Ve!=null&&(be=Math.max(be,0),et=Math.min(et,Ve.count));const ht=et-be;if(ht<0||ht===1/0)return;ie.setup(k,H,de,X,Se);let lt,tt=Ge;if(Se!==null&&(lt=J.get(Se),tt=D,tt.setIndex(lt)),k.isMesh)H.wireframe===!0?(ge.setLineWidth(H.wireframeLinewidth*st()),tt.setMode(P.LINES)):tt.setMode(P.TRIANGLES);else if(k.isLine){let vt=H.linewidth;vt===void 0&&(vt=1),ge.setLineWidth(vt*st()),k.isLineSegments?tt.setMode(P.LINES):k.isLineLoop?tt.setMode(P.LINE_LOOP):tt.setMode(P.LINE_STRIP)}else k.isPoints?tt.setMode(P.POINTS):k.isSprite&&tt.setMode(P.TRIANGLES);if(k.isBatchedMesh)if(k._multiDrawInstances!==null)gr("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),tt.renderMultiDrawInstances(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount,k._multiDrawInstances);else if(Pe.get("WEBGL_multi_draw"))tt.renderMultiDraw(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount);else{const vt=k._multiDrawStarts,Ee=k._multiDrawCounts,wt=k._multiDrawCount,qe=Se?J.get(Se).bytesPerElement:1,Nt=_.get(H).currentProgram.getUniforms();for(let kt=0;kt<wt;kt++)Nt.setValue(P,"_gl_DrawID",kt),tt.render(vt[kt]/qe,Ee[kt])}else if(k.isInstancedMesh)tt.renderInstances(be,ht,k.count);else if(X.isInstancedBufferGeometry){const vt=X._maxInstanceCount!==void 0?X._maxInstanceCount:1/0,Ee=Math.min(X.instanceCount,vt);tt.renderInstances(be,ht,Ee)}else tt.render(be,ht)};function ma(M,O,X){M.transparent===!0&&M.side===cn&&M.forceSinglePass===!1?(M.side=At,M.needsUpdate=!0,Ui(M,O,X),M.side=An,M.needsUpdate=!0,Ui(M,O,X),M.side=cn):Ui(M,O,X)}this.compile=function(M,O,X=null){X===null&&(X=M),R=Q.get(X),R.init(O),C.push(R),X.traverseVisible(function(k){k.isLight&&k.layers.test(O.layers)&&(R.pushLight(k),k.castShadow&&R.pushShadow(k))}),M!==X&&M.traverseVisible(function(k){k.isLight&&k.layers.test(O.layers)&&(R.pushLight(k),k.castShadow&&R.pushShadow(k))}),R.setupLights();const H=new Set;return M.traverse(function(k){if(!(k.isMesh||k.isPoints||k.isLine||k.isSprite))return;const ue=k.material;if(ue)if(Array.isArray(ue))for(let pe=0;pe<ue.length;pe++){const de=ue[pe];ma(de,X,k),H.add(de)}else ma(ue,X,k),H.add(ue)}),R=C.pop(),H},this.compileAsync=function(M,O,X=null){const H=this.compile(M,O,X);return new Promise(k=>{function ue(){if(H.forEach(function(pe){_.get(pe).currentProgram.isReady()&&H.delete(pe)}),H.size===0){k(M);return}setTimeout(ue,10)}Pe.get("KHR_parallel_shader_compile")!==null?ue():setTimeout(ue,10)})};let yr=null;function Pl(M){yr&&yr(M)}function ga(){wn.stop()}function _a(){wn.start()}const wn=new vl;wn.setAnimationLoop(Pl),typeof self<"u"&&wn.setContext(self),this.setAnimationLoop=function(M){yr=M,q.setAnimationLoop(M),M===null?wn.stop():wn.start()},q.addEventListener("sessionstart",ga),q.addEventListener("sessionend",_a),this.render=function(M,O){if(O!==void 0&&O.isCamera!==!0){je("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const X=q.enabled===!0&&q.isPresenting===!0,H=x!==null&&(B===null||X)&&x.begin(y,B);if(M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),O.parent===null&&O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),q.enabled===!0&&q.isPresenting===!0&&(x===null||x.isCompositing()===!1)&&(q.cameraAutoUpdate===!0&&q.updateCamera(O),O=q.getCamera()),M.isScene===!0&&M.onBeforeRender(y,M,O,B),R=Q.get(M,C.length),R.init(O),C.push(R),ot.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),Le.setFromProjectionMatrix(ot,Yt,O.reversedDepth),Re=this.localClippingEnabled,Ae=ne.init(this.clippingPlanes,Re),E=Ce.get(M,A.length),E.init(),A.push(E),q.enabled===!0&&q.isPresenting===!0){const pe=y.xr.getDepthSensingMesh();pe!==null&&br(pe,O,-1/0,y.sortObjects)}br(M,O,0,y.sortObjects),E.finish(),y.sortObjects===!0&&E.sort(Ye,He),Ne=q.enabled===!1||q.isPresenting===!1||q.hasDepthSensing()===!1,Ne&&Me.addToRenderList(E,M),this.info.render.frame++,Ae===!0&&ne.beginShadows();const k=R.state.shadowsArray;if(xe.render(k,M,O),Ae===!0&&ne.endShadows(),this.info.autoReset===!0&&this.info.reset(),(H&&x.hasRenderPass())===!1){const pe=E.opaque,de=E.transmissive;if(R.setupLights(),O.isArrayCamera){const Se=O.cameras;if(de.length>0)for(let ye=0,Ue=Se.length;ye<Ue;ye++){const Ve=Se[ye];va(pe,de,M,Ve)}Ne&&Me.render(M);for(let ye=0,Ue=Se.length;ye<Ue;ye++){const Ve=Se[ye];xa(E,M,Ve,Ve.viewport)}}else de.length>0&&va(pe,de,M,O),Ne&&Me.render(M),xa(E,M,O)}B!==null&&F===0&&(N.updateMultisampleRenderTarget(B),N.updateRenderTargetMipmap(B)),H&&x.end(y),M.isScene===!0&&M.onAfterRender(y,M,O),ie.resetDefaultState(),I=-1,G=null,C.pop(),C.length>0?(R=C[C.length-1],Ae===!0&&ne.setGlobalState(y.clippingPlanes,R.state.camera)):R=null,A.pop(),A.length>0?E=A[A.length-1]:E=null};function br(M,O,X,H){if(M.visible===!1)return;if(M.layers.test(O.layers)){if(M.isGroup)X=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(O);else if(M.isLight)R.pushLight(M),M.castShadow&&R.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Le.intersectsSprite(M)){H&&$e.setFromMatrixPosition(M.matrixWorld).applyMatrix4(ot);const pe=_e.update(M),de=M.material;de.visible&&E.push(M,pe,de,X,$e.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Le.intersectsObject(M))){const pe=_e.update(M),de=M.material;if(H&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),$e.copy(M.boundingSphere.center)):(pe.boundingSphere===null&&pe.computeBoundingSphere(),$e.copy(pe.boundingSphere.center)),$e.applyMatrix4(M.matrixWorld).applyMatrix4(ot)),Array.isArray(de)){const Se=pe.groups;for(let ye=0,Ue=Se.length;ye<Ue;ye++){const Ve=Se[ye],be=de[Ve.materialIndex];be&&be.visible&&E.push(M,pe,be,X,$e.z,Ve)}}else de.visible&&E.push(M,pe,de,X,$e.z,null)}}const ue=M.children;for(let pe=0,de=ue.length;pe<de;pe++)br(ue[pe],O,X,H)}function xa(M,O,X,H){const{opaque:k,transmissive:ue,transparent:pe}=M;R.setupLightsView(X),Ae===!0&&ne.setGlobalState(y.clippingPlanes,X),H&&ge.viewport(V.copy(H)),k.length>0&&Fi(k,O,X),ue.length>0&&Fi(ue,O,X),pe.length>0&&Fi(pe,O,X),ge.buffers.depth.setTest(!0),ge.buffers.depth.setMask(!0),ge.buffers.color.setMask(!0),ge.setPolygonOffset(!1)}function va(M,O,X,H){if((X.isScene===!0?X.overrideMaterial:null)!==null)return;if(R.state.transmissionRenderTarget[H.id]===void 0){const be=Pe.has("EXT_color_buffer_half_float")||Pe.has("EXT_color_buffer_float");R.state.transmissionRenderTarget[H.id]=new Zt(1,1,{generateMipmaps:!0,type:be?pn:It,minFilter:Bn,samples:Math.max(4,Oe.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Xe.workingColorSpace})}const ue=R.state.transmissionRenderTarget[H.id],pe=H.viewport||V;ue.setSize(pe.z*y.transmissionResolutionScale,pe.w*y.transmissionResolutionScale);const de=y.getRenderTarget(),Se=y.getActiveCubeFace(),ye=y.getActiveMipmapLevel();y.setRenderTarget(ue),y.getClearColor(Y),se=y.getClearAlpha(),se<1&&y.setClearColor(16777215,.5),y.clear(),Ne&&Me.render(X);const Ue=y.toneMapping;y.toneMapping=$t;const Ve=H.viewport;if(H.viewport!==void 0&&(H.viewport=void 0),R.setupLightsView(H),Ae===!0&&ne.setGlobalState(y.clippingPlanes,H),Fi(M,X,H),N.updateMultisampleRenderTarget(ue),N.updateRenderTargetMipmap(ue),Pe.has("WEBGL_multisampled_render_to_texture")===!1){let be=!1;for(let et=0,ht=O.length;et<ht;et++){const lt=O[et],{object:tt,geometry:vt,material:Ee,group:wt}=lt;if(Ee.side===cn&&tt.layers.test(H.layers)){const qe=Ee.side;Ee.side=At,Ee.needsUpdate=!0,Ma(tt,X,H,vt,Ee,wt),Ee.side=qe,Ee.needsUpdate=!0,be=!0}}be===!0&&(N.updateMultisampleRenderTarget(ue),N.updateRenderTargetMipmap(ue))}y.setRenderTarget(de,Se,ye),y.setClearColor(Y,se),Ve!==void 0&&(H.viewport=Ve),y.toneMapping=Ue}function Fi(M,O,X){const H=O.isScene===!0?O.overrideMaterial:null;for(let k=0,ue=M.length;k<ue;k++){const pe=M[k],{object:de,geometry:Se,group:ye}=pe;let Ue=pe.material;Ue.allowOverride===!0&&H!==null&&(Ue=H),de.layers.test(X.layers)&&Ma(de,O,X,Se,Ue,ye)}}function Ma(M,O,X,H,k,ue){M.onBeforeRender(y,O,X,H,k,ue),M.modelViewMatrix.multiplyMatrices(X.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),k.onBeforeRender(y,O,X,H,M,ue),k.transparent===!0&&k.side===cn&&k.forceSinglePass===!1?(k.side=At,k.needsUpdate=!0,y.renderBufferDirect(X,O,H,k,M,ue),k.side=An,k.needsUpdate=!0,y.renderBufferDirect(X,O,H,k,M,ue),k.side=cn):y.renderBufferDirect(X,O,H,k,M,ue),M.onAfterRender(y,O,X,H,k,ue)}function Ui(M,O,X){O.isScene!==!0&&(O=Ze);const H=_.get(M),k=R.state.lights,ue=R.state.shadowsArray,pe=k.state.version,de=ae.getParameters(M,k.state,ue,O,X),Se=ae.getProgramCacheKey(de);let ye=H.programs;H.environment=M.isMeshStandardMaterial||M.isMeshLambertMaterial||M.isMeshPhongMaterial?O.environment:null,H.fog=O.fog;const Ue=M.isMeshStandardMaterial||M.isMeshLambertMaterial&&!M.envMap||M.isMeshPhongMaterial&&!M.envMap;H.envMap=$.get(M.envMap||H.environment,Ue),H.envMapRotation=H.environment!==null&&M.envMap===null?O.environmentRotation:M.envMapRotation,ye===void 0&&(M.addEventListener("dispose",Je),ye=new Map,H.programs=ye);let Ve=ye.get(Se);if(Ve!==void 0){if(H.currentProgram===Ve&&H.lightsStateVersion===pe)return Ea(M,de),Ve}else de.uniforms=ae.getUniforms(M),M.onBeforeCompile(de,y),Ve=ae.acquireProgram(de,Se),ye.set(Se,Ve),H.uniforms=de.uniforms;const be=H.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(be.clippingPlanes=ne.uniform),Ea(M,de),H.needsLights=Il(M),H.lightsStateVersion=pe,H.needsLights&&(be.ambientLightColor.value=k.state.ambient,be.lightProbe.value=k.state.probe,be.directionalLights.value=k.state.directional,be.directionalLightShadows.value=k.state.directionalShadow,be.spotLights.value=k.state.spot,be.spotLightShadows.value=k.state.spotShadow,be.rectAreaLights.value=k.state.rectArea,be.ltc_1.value=k.state.rectAreaLTC1,be.ltc_2.value=k.state.rectAreaLTC2,be.pointLights.value=k.state.point,be.pointLightShadows.value=k.state.pointShadow,be.hemisphereLights.value=k.state.hemi,be.directionalShadowMatrix.value=k.state.directionalShadowMatrix,be.spotLightMatrix.value=k.state.spotLightMatrix,be.spotLightMap.value=k.state.spotLightMap,be.pointShadowMatrix.value=k.state.pointShadowMatrix),H.currentProgram=Ve,H.uniformsList=null,Ve}function Sa(M){if(M.uniformsList===null){const O=M.currentProgram.getUniforms();M.uniformsList=dr.seqWithValue(O.seq,M.uniforms)}return M.uniformsList}function Ea(M,O){const X=_.get(M);X.outputColorSpace=O.outputColorSpace,X.batching=O.batching,X.batchingColor=O.batchingColor,X.instancing=O.instancing,X.instancingColor=O.instancingColor,X.instancingMorph=O.instancingMorph,X.skinning=O.skinning,X.morphTargets=O.morphTargets,X.morphNormals=O.morphNormals,X.morphColors=O.morphColors,X.morphTargetsCount=O.morphTargetsCount,X.numClippingPlanes=O.numClippingPlanes,X.numIntersection=O.numClipIntersection,X.vertexAlphas=O.vertexAlphas,X.vertexTangents=O.vertexTangents,X.toneMapping=O.toneMapping}function Dl(M,O,X,H,k){O.isScene!==!0&&(O=Ze),N.resetTextureUnits();const ue=O.fog,pe=H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial?O.environment:null,de=B===null?y.outputColorSpace:B.isXRRenderTarget===!0?B.texture.colorSpace:kn,Se=H.isMeshStandardMaterial||H.isMeshLambertMaterial&&!H.envMap||H.isMeshPhongMaterial&&!H.envMap,ye=$.get(H.envMap||pe,Se),Ue=H.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,Ve=!!X.attributes.tangent&&(!!H.normalMap||H.anisotropy>0),be=!!X.morphAttributes.position,et=!!X.morphAttributes.normal,ht=!!X.morphAttributes.color;let lt=$t;H.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(lt=y.toneMapping);const tt=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,vt=tt!==void 0?tt.length:0,Ee=_.get(H),wt=R.state.lights;if(Ae===!0&&(Re===!0||M!==G)){const mt=M===G&&H.id===I;ne.setState(H,M,mt)}let qe=!1;H.version===Ee.__version?(Ee.needsLights&&Ee.lightsStateVersion!==wt.state.version||Ee.outputColorSpace!==de||k.isBatchedMesh&&Ee.batching===!1||!k.isBatchedMesh&&Ee.batching===!0||k.isBatchedMesh&&Ee.batchingColor===!0&&k.colorTexture===null||k.isBatchedMesh&&Ee.batchingColor===!1&&k.colorTexture!==null||k.isInstancedMesh&&Ee.instancing===!1||!k.isInstancedMesh&&Ee.instancing===!0||k.isSkinnedMesh&&Ee.skinning===!1||!k.isSkinnedMesh&&Ee.skinning===!0||k.isInstancedMesh&&Ee.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&Ee.instancingColor===!1&&k.instanceColor!==null||k.isInstancedMesh&&Ee.instancingMorph===!0&&k.morphTexture===null||k.isInstancedMesh&&Ee.instancingMorph===!1&&k.morphTexture!==null||Ee.envMap!==ye||H.fog===!0&&Ee.fog!==ue||Ee.numClippingPlanes!==void 0&&(Ee.numClippingPlanes!==ne.numPlanes||Ee.numIntersection!==ne.numIntersection)||Ee.vertexAlphas!==Ue||Ee.vertexTangents!==Ve||Ee.morphTargets!==be||Ee.morphNormals!==et||Ee.morphColors!==ht||Ee.toneMapping!==lt||Ee.morphTargetsCount!==vt)&&(qe=!0):(qe=!0,Ee.__version=H.version);let Nt=Ee.currentProgram;qe===!0&&(Nt=Ui(H,O,k));let kt=!1,Rn=!1,Wn=!1;const it=Nt.getUniforms(),_t=Ee.uniforms;if(ge.useProgram(Nt.program)&&(kt=!0,Rn=!0,Wn=!0),H.id!==I&&(I=H.id,Rn=!0),kt||G!==M){ge.buffers.depth.getReversed()&&M.reversedDepth!==!0&&(M._reversedDepth=!0,M.updateProjectionMatrix()),it.setValue(P,"projectionMatrix",M.projectionMatrix),it.setValue(P,"viewMatrix",M.matrixWorldInverse);const _n=it.map.cameraPosition;_n!==void 0&&_n.setValue(P,ke.setFromMatrixPosition(M.matrixWorld)),Oe.logarithmicDepthBuffer&&it.setValue(P,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&it.setValue(P,"isOrthographic",M.isOrthographicCamera===!0),G!==M&&(G=M,Rn=!0,Wn=!0)}if(Ee.needsLights&&(wt.state.directionalShadowMap.length>0&&it.setValue(P,"directionalShadowMap",wt.state.directionalShadowMap,N),wt.state.spotShadowMap.length>0&&it.setValue(P,"spotShadowMap",wt.state.spotShadowMap,N),wt.state.pointShadowMap.length>0&&it.setValue(P,"pointShadowMap",wt.state.pointShadowMap,N)),k.isSkinnedMesh){it.setOptional(P,k,"bindMatrix"),it.setOptional(P,k,"bindMatrixInverse");const mt=k.skeleton;mt&&(mt.boneTexture===null&&mt.computeBoneTexture(),it.setValue(P,"boneTexture",mt.boneTexture,N))}k.isBatchedMesh&&(it.setOptional(P,k,"batchingTexture"),it.setValue(P,"batchingTexture",k._matricesTexture,N),it.setOptional(P,k,"batchingIdTexture"),it.setValue(P,"batchingIdTexture",k._indirectTexture,N),it.setOptional(P,k,"batchingColorTexture"),k._colorsTexture!==null&&it.setValue(P,"batchingColorTexture",k._colorsTexture,N));const gn=X.morphAttributes;if((gn.position!==void 0||gn.normal!==void 0||gn.color!==void 0)&&fe.update(k,X,Nt),(Rn||Ee.receiveShadow!==k.receiveShadow)&&(Ee.receiveShadow=k.receiveShadow,it.setValue(P,"receiveShadow",k.receiveShadow)),(H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial)&&H.envMap===null&&O.environment!==null&&(_t.envMapIntensity.value=O.environmentIntensity),_t.dfgLUT!==void 0&&(_t.dfgLUT.value=sm()),Rn&&(it.setValue(P,"toneMappingExposure",y.toneMappingExposure),Ee.needsLights&&Ll(_t,Wn),ue&&H.fog===!0&&Te.refreshFogUniforms(_t,ue),Te.refreshMaterialUniforms(_t,H,we,le,R.state.transmissionRenderTarget[M.id]),dr.upload(P,Sa(Ee),_t,N)),H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(dr.upload(P,Sa(Ee),_t,N),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&it.setValue(P,"center",k.center),it.setValue(P,"modelViewMatrix",k.modelViewMatrix),it.setValue(P,"normalMatrix",k.normalMatrix),it.setValue(P,"modelMatrix",k.matrixWorld),H.isShaderMaterial||H.isRawShaderMaterial){const mt=H.uniformsGroups;for(let _n=0,Xn=mt.length;_n<Xn;_n++){const ya=mt[_n];me.update(ya,Nt),me.bind(ya,Nt)}}return Nt}function Ll(M,O){M.ambientLightColor.needsUpdate=O,M.lightProbe.needsUpdate=O,M.directionalLights.needsUpdate=O,M.directionalLightShadows.needsUpdate=O,M.pointLights.needsUpdate=O,M.pointLightShadows.needsUpdate=O,M.spotLights.needsUpdate=O,M.spotLightShadows.needsUpdate=O,M.rectAreaLights.needsUpdate=O,M.hemisphereLights.needsUpdate=O}function Il(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return F},this.getRenderTarget=function(){return B},this.setRenderTargetTextures=function(M,O,X){const H=_.get(M);H.__autoAllocateDepthBuffer=M.resolveDepthBuffer===!1,H.__autoAllocateDepthBuffer===!1&&(H.__useRenderToTexture=!1),_.get(M.texture).__webglTexture=O,_.get(M.depthTexture).__webglTexture=H.__autoAllocateDepthBuffer?void 0:X,H.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(M,O){const X=_.get(M);X.__webglFramebuffer=O,X.__useDefaultFramebuffer=O===void 0};const Nl=P.createFramebuffer();this.setRenderTarget=function(M,O=0,X=0){B=M,w=O,F=X;let H=null,k=!1,ue=!1;if(M){const de=_.get(M);if(de.__useDefaultFramebuffer!==void 0){ge.bindFramebuffer(P.FRAMEBUFFER,de.__webglFramebuffer),V.copy(M.viewport),U.copy(M.scissor),K=M.scissorTest,ge.viewport(V),ge.scissor(U),ge.setScissorTest(K),I=-1;return}else if(de.__webglFramebuffer===void 0)N.setupRenderTarget(M);else if(de.__hasExternalTextures)N.rebindTextures(M,_.get(M.texture).__webglTexture,_.get(M.depthTexture).__webglTexture);else if(M.depthBuffer){const Ue=M.depthTexture;if(de.__boundDepthTexture!==Ue){if(Ue!==null&&_.has(Ue)&&(M.width!==Ue.image.width||M.height!==Ue.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");N.setupDepthRenderbuffer(M)}}const Se=M.texture;(Se.isData3DTexture||Se.isDataArrayTexture||Se.isCompressedArrayTexture)&&(ue=!0);const ye=_.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(ye[O])?H=ye[O][X]:H=ye[O],k=!0):M.samples>0&&N.useMultisampledRTT(M)===!1?H=_.get(M).__webglMultisampledFramebuffer:Array.isArray(ye)?H=ye[X]:H=ye,V.copy(M.viewport),U.copy(M.scissor),K=M.scissorTest}else V.copy(Z).multiplyScalar(we).floor(),U.copy(te).multiplyScalar(we).floor(),K=re;if(X!==0&&(H=Nl),ge.bindFramebuffer(P.FRAMEBUFFER,H)&&ge.drawBuffers(M,H),ge.viewport(V),ge.scissor(U),ge.setScissorTest(K),k){const de=_.get(M.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+O,de.__webglTexture,X)}else if(ue){const de=O;for(let Se=0;Se<M.textures.length;Se++){const ye=_.get(M.textures[Se]);P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0+Se,ye.__webglTexture,X,de)}}else if(M!==null&&X!==0){const de=_.get(M.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,de.__webglTexture,X)}I=-1},this.readRenderTargetPixels=function(M,O,X,H,k,ue,pe,de=0){if(!(M&&M.isWebGLRenderTarget)){je("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Se=_.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&pe!==void 0&&(Se=Se[pe]),Se){ge.bindFramebuffer(P.FRAMEBUFFER,Se);try{const ye=M.textures[de],Ue=ye.format,Ve=ye.type;if(M.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+de),!Oe.textureFormatReadable(Ue)){je("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Oe.textureTypeReadable(Ve)){je("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}O>=0&&O<=M.width-H&&X>=0&&X<=M.height-k&&P.readPixels(O,X,H,k,oe.convert(Ue),oe.convert(Ve),ue)}finally{const ye=B!==null?_.get(B).__webglFramebuffer:null;ge.bindFramebuffer(P.FRAMEBUFFER,ye)}}},this.readRenderTargetPixelsAsync=async function(M,O,X,H,k,ue,pe,de=0){if(!(M&&M.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Se=_.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&pe!==void 0&&(Se=Se[pe]),Se)if(O>=0&&O<=M.width-H&&X>=0&&X<=M.height-k){ge.bindFramebuffer(P.FRAMEBUFFER,Se);const ye=M.textures[de],Ue=ye.format,Ve=ye.type;if(M.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+de),!Oe.textureFormatReadable(Ue))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Oe.textureTypeReadable(Ve))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const be=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,be),P.bufferData(P.PIXEL_PACK_BUFFER,ue.byteLength,P.STREAM_READ),P.readPixels(O,X,H,k,oe.convert(Ue),oe.convert(Ve),0);const et=B!==null?_.get(B).__webglFramebuffer:null;ge.bindFramebuffer(P.FRAMEBUFFER,et);const ht=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await Cc(P,ht,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,be),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,ue),P.deleteBuffer(be),P.deleteSync(ht),ue}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(M,O=null,X=0){const H=Math.pow(2,-X),k=Math.floor(M.image.width*H),ue=Math.floor(M.image.height*H),pe=O!==null?O.x:0,de=O!==null?O.y:0;N.setTexture2D(M,0),P.copyTexSubImage2D(P.TEXTURE_2D,X,0,0,pe,de,k,ue),ge.unbindTexture()};const Fl=P.createFramebuffer(),Ul=P.createFramebuffer();this.copyTextureToTexture=function(M,O,X=null,H=null,k=0,ue=0){let pe,de,Se,ye,Ue,Ve,be,et,ht;const lt=M.isCompressedTexture?M.mipmaps[ue]:M.image;if(X!==null)pe=X.max.x-X.min.x,de=X.max.y-X.min.y,Se=X.isBox3?X.max.z-X.min.z:1,ye=X.min.x,Ue=X.min.y,Ve=X.isBox3?X.min.z:0;else{const _t=Math.pow(2,-k);pe=Math.floor(lt.width*_t),de=Math.floor(lt.height*_t),M.isDataArrayTexture?Se=lt.depth:M.isData3DTexture?Se=Math.floor(lt.depth*_t):Se=1,ye=0,Ue=0,Ve=0}H!==null?(be=H.x,et=H.y,ht=H.z):(be=0,et=0,ht=0);const tt=oe.convert(O.format),vt=oe.convert(O.type);let Ee;O.isData3DTexture?(N.setTexture3D(O,0),Ee=P.TEXTURE_3D):O.isDataArrayTexture||O.isCompressedArrayTexture?(N.setTexture2DArray(O,0),Ee=P.TEXTURE_2D_ARRAY):(N.setTexture2D(O,0),Ee=P.TEXTURE_2D),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,O.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,O.unpackAlignment);const wt=P.getParameter(P.UNPACK_ROW_LENGTH),qe=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Nt=P.getParameter(P.UNPACK_SKIP_PIXELS),kt=P.getParameter(P.UNPACK_SKIP_ROWS),Rn=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,lt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,lt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,ye),P.pixelStorei(P.UNPACK_SKIP_ROWS,Ue),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Ve);const Wn=M.isDataArrayTexture||M.isData3DTexture,it=O.isDataArrayTexture||O.isData3DTexture;if(M.isDepthTexture){const _t=_.get(M),gn=_.get(O),mt=_.get(_t.__renderTarget),_n=_.get(gn.__renderTarget);ge.bindFramebuffer(P.READ_FRAMEBUFFER,mt.__webglFramebuffer),ge.bindFramebuffer(P.DRAW_FRAMEBUFFER,_n.__webglFramebuffer);for(let Xn=0;Xn<Se;Xn++)Wn&&(P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,_.get(M).__webglTexture,k,Ve+Xn),P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,_.get(O).__webglTexture,ue,ht+Xn)),P.blitFramebuffer(ye,Ue,pe,de,be,et,pe,de,P.DEPTH_BUFFER_BIT,P.NEAREST);ge.bindFramebuffer(P.READ_FRAMEBUFFER,null),ge.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else if(k!==0||M.isRenderTargetTexture||_.has(M)){const _t=_.get(M),gn=_.get(O);ge.bindFramebuffer(P.READ_FRAMEBUFFER,Fl),ge.bindFramebuffer(P.DRAW_FRAMEBUFFER,Ul);for(let mt=0;mt<Se;mt++)Wn?P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,_t.__webglTexture,k,Ve+mt):P.framebufferTexture2D(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,_t.__webglTexture,k),it?P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,gn.__webglTexture,ue,ht+mt):P.framebufferTexture2D(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,gn.__webglTexture,ue),k!==0?P.blitFramebuffer(ye,Ue,pe,de,be,et,pe,de,P.COLOR_BUFFER_BIT,P.NEAREST):it?P.copyTexSubImage3D(Ee,ue,be,et,ht+mt,ye,Ue,pe,de):P.copyTexSubImage2D(Ee,ue,be,et,ye,Ue,pe,de);ge.bindFramebuffer(P.READ_FRAMEBUFFER,null),ge.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else it?M.isDataTexture||M.isData3DTexture?P.texSubImage3D(Ee,ue,be,et,ht,pe,de,Se,tt,vt,lt.data):O.isCompressedArrayTexture?P.compressedTexSubImage3D(Ee,ue,be,et,ht,pe,de,Se,tt,lt.data):P.texSubImage3D(Ee,ue,be,et,ht,pe,de,Se,tt,vt,lt):M.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,ue,be,et,pe,de,tt,vt,lt.data):M.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,ue,be,et,lt.width,lt.height,tt,lt.data):P.texSubImage2D(P.TEXTURE_2D,ue,be,et,pe,de,tt,vt,lt);P.pixelStorei(P.UNPACK_ROW_LENGTH,wt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,qe),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Nt),P.pixelStorei(P.UNPACK_SKIP_ROWS,kt),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Rn),ue===0&&O.generateMipmaps&&P.generateMipmap(Ee),ge.unbindTexture()},this.initRenderTarget=function(M){_.get(M).__webglFramebuffer===void 0&&N.setupRenderTarget(M)},this.initTexture=function(M){M.isCubeTexture?N.setTextureCube(M,0):M.isData3DTexture?N.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?N.setTexture2DArray(M,0):N.setTexture2D(M,0),ge.unbindTexture()},this.resetState=function(){w=0,F=0,B=null,ge.reset(),ie.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Yt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Xe._getDrawingBufferColorSpace(e),t.unpackColorSpace=Xe._getUnpackColorSpace()}}const om=`
4049
+ }`;class rm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const i=new Ml(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new Qt({vertexShader:nm,fragmentShader:im,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Jt(new Mr(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class sm extends fi{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,d=null,p=null,h=null,f=null,g=null;const v=typeof XRWebGLBinding<"u",m=new rm,u={},S=t.getContextAttributes();let b=null,E=null;const R=[],A=[],C=new Ke;let x=null;const y=new Bt;y.viewport=new ct;const z=new Bt;z.viewport=new ct;const w=[y,z],F=new mh;let B=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Z){let te=R[Z];return te===void 0&&(te=new Fr,R[Z]=te),te.getTargetRaySpace()},this.getControllerGrip=function(Z){let te=R[Z];return te===void 0&&(te=new Fr,R[Z]=te),te.getGripSpace()},this.getHand=function(Z){let te=R[Z];return te===void 0&&(te=new Fr,R[Z]=te),te.getHandSpace()};function G(Z){const te=A.indexOf(Z.inputSource);if(te===-1)return;const re=R[te];re!==void 0&&(re.update(Z.inputSource,Z.frame,c||a),re.dispatchEvent({type:Z.type,data:Z.inputSource}))}function V(){r.removeEventListener("select",G),r.removeEventListener("selectstart",G),r.removeEventListener("selectend",G),r.removeEventListener("squeeze",G),r.removeEventListener("squeezestart",G),r.removeEventListener("squeezeend",G),r.removeEventListener("end",V),r.removeEventListener("inputsourceschange",U);for(let Z=0;Z<R.length;Z++){const te=A[Z];te!==null&&(A[Z]=null,R[Z].disconnect(te))}B=null,I=null,m.reset();for(const Z in u)delete u[Z];e.setRenderTarget(b),f=null,h=null,p=null,r=null,E=null,He.stop(),i.isPresenting=!1,e.setPixelRatio(x),e.setSize(C.width,C.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Z){s=Z,i.isPresenting===!0&&Ie("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Z){o=Z,i.isPresenting===!0&&Ie("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(Z){c=Z},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return p===null&&v&&(p=new XRWebGLBinding(r,t)),p},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(Z){if(r=Z,r!==null){if(b=e.getRenderTarget(),r.addEventListener("select",G),r.addEventListener("selectstart",G),r.addEventListener("selectend",G),r.addEventListener("squeeze",G),r.addEventListener("squeezestart",G),r.addEventListener("squeezeend",G),r.addEventListener("end",V),r.addEventListener("inputsourceschange",U),S.xrCompatible!==!0&&await t.makeXRCompatible(),x=e.getPixelRatio(),e.getSize(C),v&&"createProjectionLayer"in XRWebGLBinding.prototype){let re=null,Le=null,Ae=null;S.depth&&(Ae=S.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,re=S.stencil?zn:mn,Le=S.stencil?Pi:Kt);const Re={colorFormat:t.RGBA8,depthFormat:Ae,scaleFactor:s};p=this.getBinding(),h=p.createProjectionLayer(Re),r.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),E=new Zt(h.textureWidth,h.textureHeight,{format:zt,type:It,depthTexture:new Di(h.textureWidth,h.textureHeight,Le,void 0,void 0,void 0,void 0,void 0,void 0,re),stencilBuffer:S.stencil,colorSpace:e.outputColorSpace,samples:S.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const re={antialias:S.antialias,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(r,t,re),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),E=new Zt(f.framebufferWidth,f.framebufferHeight,{format:zt,type:It,colorSpace:e.outputColorSpace,stencilBuffer:S.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}E.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),He.setContext(r),He.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function U(Z){for(let te=0;te<Z.removed.length;te++){const re=Z.removed[te],Le=A.indexOf(re);Le>=0&&(A[Le]=null,R[Le].disconnect(re))}for(let te=0;te<Z.added.length;te++){const re=Z.added[te];let Le=A.indexOf(re);if(Le===-1){for(let Re=0;Re<R.length;Re++)if(Re>=A.length){A.push(re),Le=Re;break}else if(A[Re]===null){A[Re]=re,Le=Re;break}if(Le===-1)break}const Ae=R[Le];Ae&&Ae.connect(re)}}const K=new W,Y=new W;function se(Z,te,re){K.setFromMatrixPosition(te.matrixWorld),Y.setFromMatrixPosition(re.matrixWorld);const Le=K.distanceTo(Y),Ae=te.projectionMatrix.elements,Re=re.projectionMatrix.elements,ot=Ae[14]/(Ae[10]-1),ke=Ae[14]/(Ae[10]+1),$e=(Ae[9]+1)/Ae[5],Ze=(Ae[9]-1)/Ae[5],Ne=(Ae[8]-1)/Ae[0],st=(Re[8]+1)/Re[0],P=ot*Ne,at=ot*st,De=Le/(-Ne+st),Oe=De*-Ne;if(te.matrixWorld.decompose(Z.position,Z.quaternion,Z.scale),Z.translateX(Oe),Z.translateZ(De),Z.matrixWorld.compose(Z.position,Z.quaternion,Z.scale),Z.matrixWorldInverse.copy(Z.matrixWorld).invert(),Ae[10]===-1)Z.projectionMatrix.copy(te.projectionMatrix),Z.projectionMatrixInverse.copy(te.projectionMatrixInverse);else{const ge=ot+De,T=ke+De,_=P-Oe,N=at+(Le-Oe),$=$e*ke/T*ge,J=Ze*ke/T*ge;Z.projectionMatrix.makePerspective(_,N,$,J,ge,T),Z.projectionMatrixInverse.copy(Z.projectionMatrix).invert()}}function ce(Z,te){te===null?Z.matrixWorld.copy(Z.matrix):Z.matrixWorld.multiplyMatrices(te.matrixWorld,Z.matrix),Z.matrixWorldInverse.copy(Z.matrixWorld).invert()}this.updateCamera=function(Z){if(r===null)return;let te=Z.near,re=Z.far;m.texture!==null&&(m.depthNear>0&&(te=m.depthNear),m.depthFar>0&&(re=m.depthFar)),F.near=z.near=y.near=te,F.far=z.far=y.far=re,(B!==F.near||I!==F.far)&&(r.updateRenderState({depthNear:F.near,depthFar:F.far}),B=F.near,I=F.far),F.layers.mask=Z.layers.mask|6,y.layers.mask=F.layers.mask&-5,z.layers.mask=F.layers.mask&-3;const Le=Z.parent,Ae=F.cameras;ce(F,Le);for(let Re=0;Re<Ae.length;Re++)ce(Ae[Re],Le);Ae.length===2?se(F,y,z):F.projectionMatrix.copy(y.projectionMatrix),le(Z,F,Le)};function le(Z,te,re){re===null?Z.matrix.copy(te.matrixWorld):(Z.matrix.copy(re.matrixWorld),Z.matrix.invert(),Z.matrix.multiply(te.matrixWorld)),Z.matrix.decompose(Z.position,Z.quaternion,Z.scale),Z.updateMatrixWorld(!0),Z.projectionMatrix.copy(te.projectionMatrix),Z.projectionMatrixInverse.copy(te.projectionMatrixInverse),Z.isPerspectiveCamera&&(Z.fov=Ks*2*Math.atan(1/Z.projectionMatrix.elements[5]),Z.zoom=1)}this.getCamera=function(){return F},this.getFoveation=function(){if(!(h===null&&f===null))return l},this.setFoveation=function(Z){l=Z,h!==null&&(h.fixedFoveation=Z),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=Z)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(F)},this.getCameraTexture=function(Z){return u[Z]};let we=null;function Ye(Z,te){if(d=te.getViewerPose(c||a),g=te,d!==null){const re=d.views;f!==null&&(e.setRenderTargetFramebuffer(E,f.framebuffer),e.setRenderTarget(E));let Le=!1;re.length!==F.cameras.length&&(F.cameras.length=0,Le=!0);for(let ke=0;ke<re.length;ke++){const $e=re[ke];let Ze=null;if(f!==null)Ze=f.getViewport($e);else{const st=p.getViewSubImage(h,$e);Ze=st.viewport,ke===0&&(e.setRenderTargetTextures(E,st.colorTexture,st.depthStencilTexture),e.setRenderTarget(E))}let Ne=w[ke];Ne===void 0&&(Ne=new Bt,Ne.layers.enable(ke),Ne.viewport=new ct,w[ke]=Ne),Ne.matrix.fromArray($e.transform.matrix),Ne.matrix.decompose(Ne.position,Ne.quaternion,Ne.scale),Ne.projectionMatrix.fromArray($e.projectionMatrix),Ne.projectionMatrixInverse.copy(Ne.projectionMatrix).invert(),Ne.viewport.set(Ze.x,Ze.y,Ze.width,Ze.height),ke===0&&(F.matrix.copy(Ne.matrix),F.matrix.decompose(F.position,F.quaternion,F.scale)),Le===!0&&F.cameras.push(Ne)}const Ae=r.enabledFeatures;if(Ae&&Ae.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&v){p=i.getBinding();const ke=p.getDepthInformation(re[0]);ke&&ke.isValid&&ke.texture&&m.init(ke,r.renderState)}if(Ae&&Ae.includes("camera-access")&&v){e.state.unbindTexture(),p=i.getBinding();for(let ke=0;ke<re.length;ke++){const $e=re[ke].camera;if($e){let Ze=u[$e];Ze||(Ze=new Ml,u[$e]=Ze);const Ne=p.getCameraImage($e);Ze.sourceTexture=Ne}}}}for(let re=0;re<R.length;re++){const Le=A[re],Ae=R[re];Le!==null&&Ae!==void 0&&Ae.update(Le,te,c||a)}we&&we(Z,te),te.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:te}),g=null}const He=new bl;He.setAnimationLoop(Ye),this.setAnimationLoop=function(Z){we=Z},this.dispose=function(){}}}const Nn=new Hn,am=new ut;function om(n,e){function t(m,u){m.matrixAutoUpdate===!0&&m.updateMatrix(),u.value.copy(m.matrix)}function i(m,u){u.color.getRGB(m.fogColor.value,Sl(n)),u.isFog?(m.fogNear.value=u.near,m.fogFar.value=u.far):u.isFogExp2&&(m.fogDensity.value=u.density)}function r(m,u,S,b,E){u.isMeshBasicMaterial?s(m,u):u.isMeshLambertMaterial?(s(m,u),u.envMap&&(m.envMapIntensity.value=u.envMapIntensity)):u.isMeshToonMaterial?(s(m,u),p(m,u)):u.isMeshPhongMaterial?(s(m,u),d(m,u),u.envMap&&(m.envMapIntensity.value=u.envMapIntensity)):u.isMeshStandardMaterial?(s(m,u),h(m,u),u.isMeshPhysicalMaterial&&f(m,u,E)):u.isMeshMatcapMaterial?(s(m,u),g(m,u)):u.isMeshDepthMaterial?s(m,u):u.isMeshDistanceMaterial?(s(m,u),v(m,u)):u.isMeshNormalMaterial?s(m,u):u.isLineBasicMaterial?(a(m,u),u.isLineDashedMaterial&&o(m,u)):u.isPointsMaterial?l(m,u,S,b):u.isSpriteMaterial?c(m,u):u.isShadowMaterial?(m.color.value.copy(u.color),m.opacity.value=u.opacity):u.isShaderMaterial&&(u.uniformsNeedUpdate=!1)}function s(m,u){m.opacity.value=u.opacity,u.color&&m.diffuse.value.copy(u.color),u.emissive&&m.emissive.value.copy(u.emissive).multiplyScalar(u.emissiveIntensity),u.map&&(m.map.value=u.map,t(u.map,m.mapTransform)),u.alphaMap&&(m.alphaMap.value=u.alphaMap,t(u.alphaMap,m.alphaMapTransform)),u.bumpMap&&(m.bumpMap.value=u.bumpMap,t(u.bumpMap,m.bumpMapTransform),m.bumpScale.value=u.bumpScale,u.side===At&&(m.bumpScale.value*=-1)),u.normalMap&&(m.normalMap.value=u.normalMap,t(u.normalMap,m.normalMapTransform),m.normalScale.value.copy(u.normalScale),u.side===At&&m.normalScale.value.negate()),u.displacementMap&&(m.displacementMap.value=u.displacementMap,t(u.displacementMap,m.displacementMapTransform),m.displacementScale.value=u.displacementScale,m.displacementBias.value=u.displacementBias),u.emissiveMap&&(m.emissiveMap.value=u.emissiveMap,t(u.emissiveMap,m.emissiveMapTransform)),u.specularMap&&(m.specularMap.value=u.specularMap,t(u.specularMap,m.specularMapTransform)),u.alphaTest>0&&(m.alphaTest.value=u.alphaTest);const S=e.get(u),b=S.envMap,E=S.envMapRotation;b&&(m.envMap.value=b,Nn.copy(E),Nn.x*=-1,Nn.y*=-1,Nn.z*=-1,b.isCubeTexture&&b.isRenderTargetTexture===!1&&(Nn.y*=-1,Nn.z*=-1),m.envMapRotation.value.setFromMatrix4(am.makeRotationFromEuler(Nn)),m.flipEnvMap.value=b.isCubeTexture&&b.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=u.reflectivity,m.ior.value=u.ior,m.refractionRatio.value=u.refractionRatio),u.lightMap&&(m.lightMap.value=u.lightMap,m.lightMapIntensity.value=u.lightMapIntensity,t(u.lightMap,m.lightMapTransform)),u.aoMap&&(m.aoMap.value=u.aoMap,m.aoMapIntensity.value=u.aoMapIntensity,t(u.aoMap,m.aoMapTransform))}function a(m,u){m.diffuse.value.copy(u.color),m.opacity.value=u.opacity,u.map&&(m.map.value=u.map,t(u.map,m.mapTransform))}function o(m,u){m.dashSize.value=u.dashSize,m.totalSize.value=u.dashSize+u.gapSize,m.scale.value=u.scale}function l(m,u,S,b){m.diffuse.value.copy(u.color),m.opacity.value=u.opacity,m.size.value=u.size*S,m.scale.value=b*.5,u.map&&(m.map.value=u.map,t(u.map,m.uvTransform)),u.alphaMap&&(m.alphaMap.value=u.alphaMap,t(u.alphaMap,m.alphaMapTransform)),u.alphaTest>0&&(m.alphaTest.value=u.alphaTest)}function c(m,u){m.diffuse.value.copy(u.color),m.opacity.value=u.opacity,m.rotation.value=u.rotation,u.map&&(m.map.value=u.map,t(u.map,m.mapTransform)),u.alphaMap&&(m.alphaMap.value=u.alphaMap,t(u.alphaMap,m.alphaMapTransform)),u.alphaTest>0&&(m.alphaTest.value=u.alphaTest)}function d(m,u){m.specular.value.copy(u.specular),m.shininess.value=Math.max(u.shininess,1e-4)}function p(m,u){u.gradientMap&&(m.gradientMap.value=u.gradientMap)}function h(m,u){m.metalness.value=u.metalness,u.metalnessMap&&(m.metalnessMap.value=u.metalnessMap,t(u.metalnessMap,m.metalnessMapTransform)),m.roughness.value=u.roughness,u.roughnessMap&&(m.roughnessMap.value=u.roughnessMap,t(u.roughnessMap,m.roughnessMapTransform)),u.envMap&&(m.envMapIntensity.value=u.envMapIntensity)}function f(m,u,S){m.ior.value=u.ior,u.sheen>0&&(m.sheenColor.value.copy(u.sheenColor).multiplyScalar(u.sheen),m.sheenRoughness.value=u.sheenRoughness,u.sheenColorMap&&(m.sheenColorMap.value=u.sheenColorMap,t(u.sheenColorMap,m.sheenColorMapTransform)),u.sheenRoughnessMap&&(m.sheenRoughnessMap.value=u.sheenRoughnessMap,t(u.sheenRoughnessMap,m.sheenRoughnessMapTransform))),u.clearcoat>0&&(m.clearcoat.value=u.clearcoat,m.clearcoatRoughness.value=u.clearcoatRoughness,u.clearcoatMap&&(m.clearcoatMap.value=u.clearcoatMap,t(u.clearcoatMap,m.clearcoatMapTransform)),u.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=u.clearcoatRoughnessMap,t(u.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),u.clearcoatNormalMap&&(m.clearcoatNormalMap.value=u.clearcoatNormalMap,t(u.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(u.clearcoatNormalScale),u.side===At&&m.clearcoatNormalScale.value.negate())),u.dispersion>0&&(m.dispersion.value=u.dispersion),u.iridescence>0&&(m.iridescence.value=u.iridescence,m.iridescenceIOR.value=u.iridescenceIOR,m.iridescenceThicknessMinimum.value=u.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=u.iridescenceThicknessRange[1],u.iridescenceMap&&(m.iridescenceMap.value=u.iridescenceMap,t(u.iridescenceMap,m.iridescenceMapTransform)),u.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=u.iridescenceThicknessMap,t(u.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),u.transmission>0&&(m.transmission.value=u.transmission,m.transmissionSamplerMap.value=S.texture,m.transmissionSamplerSize.value.set(S.width,S.height),u.transmissionMap&&(m.transmissionMap.value=u.transmissionMap,t(u.transmissionMap,m.transmissionMapTransform)),m.thickness.value=u.thickness,u.thicknessMap&&(m.thicknessMap.value=u.thicknessMap,t(u.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=u.attenuationDistance,m.attenuationColor.value.copy(u.attenuationColor)),u.anisotropy>0&&(m.anisotropyVector.value.set(u.anisotropy*Math.cos(u.anisotropyRotation),u.anisotropy*Math.sin(u.anisotropyRotation)),u.anisotropyMap&&(m.anisotropyMap.value=u.anisotropyMap,t(u.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=u.specularIntensity,m.specularColor.value.copy(u.specularColor),u.specularColorMap&&(m.specularColorMap.value=u.specularColorMap,t(u.specularColorMap,m.specularColorMapTransform)),u.specularIntensityMap&&(m.specularIntensityMap.value=u.specularIntensityMap,t(u.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,u){u.matcap&&(m.matcap.value=u.matcap)}function v(m,u){const S=e.get(u).light;m.referencePosition.value.setFromMatrixPosition(S.matrixWorld),m.nearDistance.value=S.shadow.camera.near,m.farDistance.value=S.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function lm(n,e,t,i){let r={},s={},a=[];const o=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(S,b){const E=b.program;i.uniformBlockBinding(S,E)}function c(S,b){let E=r[S.id];E===void 0&&(g(S),E=d(S),r[S.id]=E,S.addEventListener("dispose",m));const R=b.program;i.updateUBOMapping(S,R);const A=e.render.frame;s[S.id]!==A&&(h(S),s[S.id]=A)}function d(S){const b=p();S.__bindingPointIndex=b;const E=n.createBuffer(),R=S.__size,A=S.usage;return n.bindBuffer(n.UNIFORM_BUFFER,E),n.bufferData(n.UNIFORM_BUFFER,R,A),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,b,E),E}function p(){for(let S=0;S<o;S++)if(a.indexOf(S)===-1)return a.push(S),S;return qe("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(S){const b=r[S.id],E=S.uniforms,R=S.__cache;n.bindBuffer(n.UNIFORM_BUFFER,b);for(let A=0,C=E.length;A<C;A++){const x=Array.isArray(E[A])?E[A]:[E[A]];for(let y=0,z=x.length;y<z;y++){const w=x[y];if(f(w,A,y,R)===!0){const F=w.__offset,B=Array.isArray(w.value)?w.value:[w.value];let I=0;for(let G=0;G<B.length;G++){const V=B[G],U=v(V);typeof V=="number"||typeof V=="boolean"?(w.__data[0]=V,n.bufferSubData(n.UNIFORM_BUFFER,F+I,w.__data)):V.isMatrix3?(w.__data[0]=V.elements[0],w.__data[1]=V.elements[1],w.__data[2]=V.elements[2],w.__data[3]=0,w.__data[4]=V.elements[3],w.__data[5]=V.elements[4],w.__data[6]=V.elements[5],w.__data[7]=0,w.__data[8]=V.elements[6],w.__data[9]=V.elements[7],w.__data[10]=V.elements[8],w.__data[11]=0):(V.toArray(w.__data,I),I+=U.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,F,w.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function f(S,b,E,R){const A=S.value,C=b+"_"+E;if(R[C]===void 0)return typeof A=="number"||typeof A=="boolean"?R[C]=A:R[C]=A.clone(),!0;{const x=R[C];if(typeof A=="number"||typeof A=="boolean"){if(x!==A)return R[C]=A,!0}else if(x.equals(A)===!1)return x.copy(A),!0}return!1}function g(S){const b=S.uniforms;let E=0;const R=16;for(let C=0,x=b.length;C<x;C++){const y=Array.isArray(b[C])?b[C]:[b[C]];for(let z=0,w=y.length;z<w;z++){const F=y[z],B=Array.isArray(F.value)?F.value:[F.value];for(let I=0,G=B.length;I<G;I++){const V=B[I],U=v(V),K=E%R,Y=K%U.boundary,se=K+Y;E+=Y,se!==0&&R-se<U.storage&&(E+=R-se),F.__data=new Float32Array(U.storage/Float32Array.BYTES_PER_ELEMENT),F.__offset=E,E+=U.storage}}}const A=E%R;return A>0&&(E+=R-A),S.__size=E,S.__cache={},this}function v(S){const b={boundary:0,storage:0};return typeof S=="number"||typeof S=="boolean"?(b.boundary=4,b.storage=4):S.isVector2?(b.boundary=8,b.storage=8):S.isVector3||S.isColor?(b.boundary=16,b.storage=12):S.isVector4?(b.boundary=16,b.storage=16):S.isMatrix3?(b.boundary=48,b.storage=48):S.isMatrix4?(b.boundary=64,b.storage=64):S.isTexture?Ie("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Ie("WebGLRenderer: Unsupported uniform value type.",S),b}function m(S){const b=S.target;b.removeEventListener("dispose",m);const E=a.indexOf(b.__bindingPointIndex);a.splice(E,1),n.deleteBuffer(r[b.id]),delete r[b.id],delete s[b.id]}function u(){for(const S in r)n.deleteBuffer(r[S]);a=[],r={},s={}}return{bind:l,update:c,dispose:u}}const cm=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]);let Xt=null;function hm(){return Xt===null&&(Xt=new ih(cm,16,16,di,pn),Xt.name="DFG_LUT",Xt.minFilter=Et,Xt.magFilter=Et,Xt.wrapS=hn,Xt.wrapT=hn,Xt.generateMipmaps=!1,Xt.needsUpdate=!0),Xt}class dm{constructor(e={}){const{canvas:t=Ic(),context:i=null,depth:r=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:p=!1,reversedDepthBuffer:h=!1,outputBufferType:f=It}=e;this.isWebGLRenderer=!0;let g;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=i.getContextAttributes().alpha}else g=a;const v=f,m=new Set([ca,la,oa]),u=new Set([It,Kt,Ci,Pi,sa,aa]),S=new Uint32Array(4),b=new Int32Array(4);let E=null,R=null;const A=[],C=[];let x=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=$t,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const y=this;let z=!1;this._outputColorSpace=Lt;let w=0,F=0,B=null,I=-1,G=null;const V=new ct,U=new ct;let K=null;const Y=new nt(0);let se=0,ce=t.width,le=t.height,we=1,Ye=null,He=null;const Z=new ct(0,0,ce,le),te=new ct(0,0,ce,le);let re=!1;const Le=new xl;let Ae=!1,Re=!1;const ot=new ut,ke=new W,$e=new ct,Ze={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ne=!1;function st(){return B===null?we:1}let P=i;function at(M,O){return t.getContext(M,O)}try{const M={alpha:!0,depth:r,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:p};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${ia}`),t.addEventListener("webglcontextlost",ve,!1),t.addEventListener("webglcontextrestored",Fe,!1),t.addEventListener("webglcontextcreationerror",rt,!1),P===null){const O="webgl2";if(P=at(O,M),P===null)throw at(O)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(M){throw qe("WebGLRenderer: "+M.message),M}let De,Oe,ge,T,_,N,$,J,q,_e,ae,Te,Ce,Q,ne,xe,Me,fe,Ge,L,oe,ie,me;function ee(){De=new df(P),De.init(),oe=new tm(P,De),Oe=new nf(P,De,e,oe),ge=new Qp(P,De),Oe.reversedDepthBuffer&&h&&ge.buffers.depth.setReversed(!0),T=new pf(P),_=new zp,N=new em(P,De,ge,_,Oe,oe,T),$=new hf(y),J=new xh(P),ie=new ef(P,J),q=new uf(P,J,T,ie),_e=new gf(P,q,J,ie,T),fe=new mf(P,Oe,N),ne=new rf(_),ae=new Bp(y,$,De,Oe,ie,ne),Te=new om(y,_),Ce=new Vp,Q=new qp(De),Me=new Qu(y,$,ge,_e,g,l),xe=new Jp(y,_e,Oe),me=new lm(P,T,Oe,ge),Ge=new tf(P,De,T),L=new ff(P,De,T),T.programs=ae.programs,y.capabilities=Oe,y.extensions=De,y.properties=_,y.renderLists=Ce,y.shadowMap=xe,y.state=ge,y.info=T}ee(),v!==It&&(x=new xf(v,t.width,t.height,r,s));const j=new sm(y,P);this.xr=j,this.getContext=function(){return P},this.getContextAttributes=function(){return P.getContextAttributes()},this.forceContextLoss=function(){const M=De.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){const M=De.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return we},this.setPixelRatio=function(M){M!==void 0&&(we=M,this.setSize(ce,le,!1))},this.getSize=function(M){return M.set(ce,le)},this.setSize=function(M,O,X=!0){if(j.isPresenting){Ie("WebGLRenderer: Can't change size while VR device is presenting.");return}ce=M,le=O,t.width=Math.floor(M*we),t.height=Math.floor(O*we),X===!0&&(t.style.width=M+"px",t.style.height=O+"px"),x!==null&&x.setSize(t.width,t.height),this.setViewport(0,0,M,O)},this.getDrawingBufferSize=function(M){return M.set(ce*we,le*we).floor()},this.setDrawingBufferSize=function(M,O,X){ce=M,le=O,we=X,t.width=Math.floor(M*X),t.height=Math.floor(O*X),this.setViewport(0,0,M,O)},this.setEffects=function(M){if(v===It){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(M){for(let O=0;O<M.length;O++)if(M[O].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}x.setEffects(M||[])},this.getCurrentViewport=function(M){return M.copy(V)},this.getViewport=function(M){return M.copy(Z)},this.setViewport=function(M,O,X,H){M.isVector4?Z.set(M.x,M.y,M.z,M.w):Z.set(M,O,X,H),ge.viewport(V.copy(Z).multiplyScalar(we).round())},this.getScissor=function(M){return M.copy(te)},this.setScissor=function(M,O,X,H){M.isVector4?te.set(M.x,M.y,M.z,M.w):te.set(M,O,X,H),ge.scissor(U.copy(te).multiplyScalar(we).round())},this.getScissorTest=function(){return re},this.setScissorTest=function(M){ge.setScissorTest(re=M)},this.setOpaqueSort=function(M){Ye=M},this.setTransparentSort=function(M){He=M},this.getClearColor=function(M){return M.copy(Me.getClearColor())},this.setClearColor=function(){Me.setClearColor(...arguments)},this.getClearAlpha=function(){return Me.getClearAlpha()},this.setClearAlpha=function(){Me.setClearAlpha(...arguments)},this.clear=function(M=!0,O=!0,X=!0){let H=0;if(M){let k=!1;if(B!==null){const de=B.texture.format;k=m.has(de)}if(k){const de=B.texture.type,pe=u.has(de),ue=Me.getClearColor(),Se=Me.getClearAlpha(),ye=ue.r,Ue=ue.g,Ve=ue.b;pe?(S[0]=ye,S[1]=Ue,S[2]=Ve,S[3]=Se,P.clearBufferuiv(P.COLOR,0,S)):(b[0]=ye,b[1]=Ue,b[2]=Ve,b[3]=Se,P.clearBufferiv(P.COLOR,0,b))}else H|=P.COLOR_BUFFER_BIT}O&&(H|=P.DEPTH_BUFFER_BIT),X&&(H|=P.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H!==0&&P.clear(H)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",ve,!1),t.removeEventListener("webglcontextrestored",Fe,!1),t.removeEventListener("webglcontextcreationerror",rt,!1),Me.dispose(),Ce.dispose(),Q.dispose(),_.dispose(),$.dispose(),_e.dispose(),ie.dispose(),me.dispose(),ae.dispose(),j.dispose(),j.removeEventListener("sessionstart",_a),j.removeEventListener("sessionend",xa),wn.stop()};function ve(M){M.preventDefault(),Ua("WebGLRenderer: Context Lost."),z=!0}function Fe(){Ua("WebGLRenderer: Context Restored."),z=!1;const M=T.autoReset,O=xe.enabled,X=xe.autoUpdate,H=xe.needsUpdate,k=xe.type;ee(),T.autoReset=M,xe.enabled=O,xe.autoUpdate=X,xe.needsUpdate=H,xe.type=k}function rt(M){qe("WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function Je(M){const O=M.target;O.removeEventListener("dispose",Je),tn(O)}function tn(M){nn(M),_.remove(M)}function nn(M){const O=_.get(M).programs;O!==void 0&&(O.forEach(function(X){ae.releaseProgram(X)}),M.isShaderMaterial&&ae.releaseShaderCache(M))}this.renderBufferDirect=function(M,O,X,H,k,de){O===null&&(O=Ze);const pe=k.isMesh&&k.matrixWorld.determinant()<0,ue=Ul(M,O,X,H,k);ge.setMaterial(H,pe);let Se=X.index,ye=1;if(H.wireframe===!0){if(Se=q.getWireframeAttribute(X),Se===void 0)return;ye=2}const Ue=X.drawRange,Ve=X.attributes.position;let be=Ue.start*ye,et=(Ue.start+Ue.count)*ye;de!==null&&(be=Math.max(be,de.start*ye),et=Math.min(et,(de.start+de.count)*ye)),Se!==null?(be=Math.max(be,0),et=Math.min(et,Se.count)):Ve!=null&&(be=Math.max(be,0),et=Math.min(et,Ve.count));const ht=et-be;if(ht<0||ht===1/0)return;ie.setup(k,H,ue,X,Se);let lt,tt=Ge;if(Se!==null&&(lt=J.get(Se),tt=L,tt.setIndex(lt)),k.isMesh)H.wireframe===!0?(ge.setLineWidth(H.wireframeLinewidth*st()),tt.setMode(P.LINES)):tt.setMode(P.TRIANGLES);else if(k.isLine){let vt=H.linewidth;vt===void 0&&(vt=1),ge.setLineWidth(vt*st()),k.isLineSegments?tt.setMode(P.LINES):k.isLineLoop?tt.setMode(P.LINE_LOOP):tt.setMode(P.LINE_STRIP)}else k.isPoints?tt.setMode(P.POINTS):k.isSprite&&tt.setMode(P.TRIANGLES);if(k.isBatchedMesh)if(k._multiDrawInstances!==null)gr("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),tt.renderMultiDrawInstances(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount,k._multiDrawInstances);else if(De.get("WEBGL_multi_draw"))tt.renderMultiDraw(k._multiDrawStarts,k._multiDrawCounts,k._multiDrawCount);else{const vt=k._multiDrawStarts,Ee=k._multiDrawCounts,wt=k._multiDrawCount,je=Se?J.get(Se).bytesPerElement:1,Nt=_.get(H).currentProgram.getUniforms();for(let kt=0;kt<wt;kt++)Nt.setValue(P,"_gl_DrawID",kt),tt.render(vt[kt]/je,Ee[kt])}else if(k.isInstancedMesh)tt.renderInstances(be,ht,k.count);else if(X.isInstancedBufferGeometry){const vt=X._maxInstanceCount!==void 0?X._maxInstanceCount:1/0,Ee=Math.min(X.instanceCount,vt);tt.renderInstances(be,ht,Ee)}else tt.render(be,ht)};function ga(M,O,X){M.transparent===!0&&M.side===cn&&M.forceSinglePass===!1?(M.side=At,M.needsUpdate=!0,Ui(M,O,X),M.side=An,M.needsUpdate=!0,Ui(M,O,X),M.side=cn):Ui(M,O,X)}this.compile=function(M,O,X=null){X===null&&(X=M),R=Q.get(X),R.init(O),C.push(R),X.traverseVisible(function(k){k.isLight&&k.layers.test(O.layers)&&(R.pushLight(k),k.castShadow&&R.pushShadow(k))}),M!==X&&M.traverseVisible(function(k){k.isLight&&k.layers.test(O.layers)&&(R.pushLight(k),k.castShadow&&R.pushShadow(k))}),R.setupLights();const H=new Set;return M.traverse(function(k){if(!(k.isMesh||k.isPoints||k.isLine||k.isSprite))return;const de=k.material;if(de)if(Array.isArray(de))for(let pe=0;pe<de.length;pe++){const ue=de[pe];ga(ue,X,k),H.add(ue)}else ga(de,X,k),H.add(de)}),R=C.pop(),H},this.compileAsync=function(M,O,X=null){const H=this.compile(M,O,X);return new Promise(k=>{function de(){if(H.forEach(function(pe){_.get(pe).currentProgram.isReady()&&H.delete(pe)}),H.size===0){k(M);return}setTimeout(de,10)}De.get("KHR_parallel_shader_compile")!==null?de():setTimeout(de,10)})};let yr=null;function Fl(M){yr&&yr(M)}function _a(){wn.stop()}function xa(){wn.start()}const wn=new bl;wn.setAnimationLoop(Fl),typeof self<"u"&&wn.setContext(self),this.setAnimationLoop=function(M){yr=M,j.setAnimationLoop(M),M===null?wn.stop():wn.start()},j.addEventListener("sessionstart",_a),j.addEventListener("sessionend",xa),this.render=function(M,O){if(O!==void 0&&O.isCamera!==!0){qe("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(z===!0)return;const X=j.enabled===!0&&j.isPresenting===!0,H=x!==null&&(B===null||X)&&x.begin(y,B);if(M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),O.parent===null&&O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),j.enabled===!0&&j.isPresenting===!0&&(x===null||x.isCompositing()===!1)&&(j.cameraAutoUpdate===!0&&j.updateCamera(O),O=j.getCamera()),M.isScene===!0&&M.onBeforeRender(y,M,O,B),R=Q.get(M,C.length),R.init(O),C.push(R),ot.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),Le.setFromProjectionMatrix(ot,Yt,O.reversedDepth),Re=this.localClippingEnabled,Ae=ne.init(this.clippingPlanes,Re),E=Ce.get(M,A.length),E.init(),A.push(E),j.enabled===!0&&j.isPresenting===!0){const pe=y.xr.getDepthSensingMesh();pe!==null&&br(pe,O,-1/0,y.sortObjects)}br(M,O,0,y.sortObjects),E.finish(),y.sortObjects===!0&&E.sort(Ye,He),Ne=j.enabled===!1||j.isPresenting===!1||j.hasDepthSensing()===!1,Ne&&Me.addToRenderList(E,M),this.info.render.frame++,Ae===!0&&ne.beginShadows();const k=R.state.shadowsArray;if(xe.render(k,M,O),Ae===!0&&ne.endShadows(),this.info.autoReset===!0&&this.info.reset(),(H&&x.hasRenderPass())===!1){const pe=E.opaque,ue=E.transmissive;if(R.setupLights(),O.isArrayCamera){const Se=O.cameras;if(ue.length>0)for(let ye=0,Ue=Se.length;ye<Ue;ye++){const Ve=Se[ye];Ma(pe,ue,M,Ve)}Ne&&Me.render(M);for(let ye=0,Ue=Se.length;ye<Ue;ye++){const Ve=Se[ye];va(E,M,Ve,Ve.viewport)}}else ue.length>0&&Ma(pe,ue,M,O),Ne&&Me.render(M),va(E,M,O)}B!==null&&F===0&&(N.updateMultisampleRenderTarget(B),N.updateRenderTargetMipmap(B)),H&&x.end(y),M.isScene===!0&&M.onAfterRender(y,M,O),ie.resetDefaultState(),I=-1,G=null,C.pop(),C.length>0?(R=C[C.length-1],Ae===!0&&ne.setGlobalState(y.clippingPlanes,R.state.camera)):R=null,A.pop(),A.length>0?E=A[A.length-1]:E=null};function br(M,O,X,H){if(M.visible===!1)return;if(M.layers.test(O.layers)){if(M.isGroup)X=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(O);else if(M.isLight)R.pushLight(M),M.castShadow&&R.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Le.intersectsSprite(M)){H&&$e.setFromMatrixPosition(M.matrixWorld).applyMatrix4(ot);const pe=_e.update(M),ue=M.material;ue.visible&&E.push(M,pe,ue,X,$e.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Le.intersectsObject(M))){const pe=_e.update(M),ue=M.material;if(H&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),$e.copy(M.boundingSphere.center)):(pe.boundingSphere===null&&pe.computeBoundingSphere(),$e.copy(pe.boundingSphere.center)),$e.applyMatrix4(M.matrixWorld).applyMatrix4(ot)),Array.isArray(ue)){const Se=pe.groups;for(let ye=0,Ue=Se.length;ye<Ue;ye++){const Ve=Se[ye],be=ue[Ve.materialIndex];be&&be.visible&&E.push(M,pe,be,X,$e.z,Ve)}}else ue.visible&&E.push(M,pe,ue,X,$e.z,null)}}const de=M.children;for(let pe=0,ue=de.length;pe<ue;pe++)br(de[pe],O,X,H)}function va(M,O,X,H){const{opaque:k,transmissive:de,transparent:pe}=M;R.setupLightsView(X),Ae===!0&&ne.setGlobalState(y.clippingPlanes,X),H&&ge.viewport(V.copy(H)),k.length>0&&Fi(k,O,X),de.length>0&&Fi(de,O,X),pe.length>0&&Fi(pe,O,X),ge.buffers.depth.setTest(!0),ge.buffers.depth.setMask(!0),ge.buffers.color.setMask(!0),ge.setPolygonOffset(!1)}function Ma(M,O,X,H){if((X.isScene===!0?X.overrideMaterial:null)!==null)return;if(R.state.transmissionRenderTarget[H.id]===void 0){const be=De.has("EXT_color_buffer_half_float")||De.has("EXT_color_buffer_float");R.state.transmissionRenderTarget[H.id]=new Zt(1,1,{generateMipmaps:!0,type:be?pn:It,minFilter:Bn,samples:Math.max(4,Oe.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Xe.workingColorSpace})}const de=R.state.transmissionRenderTarget[H.id],pe=H.viewport||V;de.setSize(pe.z*y.transmissionResolutionScale,pe.w*y.transmissionResolutionScale);const ue=y.getRenderTarget(),Se=y.getActiveCubeFace(),ye=y.getActiveMipmapLevel();y.setRenderTarget(de),y.getClearColor(Y),se=y.getClearAlpha(),se<1&&y.setClearColor(16777215,.5),y.clear(),Ne&&Me.render(X);const Ue=y.toneMapping;y.toneMapping=$t;const Ve=H.viewport;if(H.viewport!==void 0&&(H.viewport=void 0),R.setupLightsView(H),Ae===!0&&ne.setGlobalState(y.clippingPlanes,H),Fi(M,X,H),N.updateMultisampleRenderTarget(de),N.updateRenderTargetMipmap(de),De.has("WEBGL_multisampled_render_to_texture")===!1){let be=!1;for(let et=0,ht=O.length;et<ht;et++){const lt=O[et],{object:tt,geometry:vt,material:Ee,group:wt}=lt;if(Ee.side===cn&&tt.layers.test(H.layers)){const je=Ee.side;Ee.side=At,Ee.needsUpdate=!0,Sa(tt,X,H,vt,Ee,wt),Ee.side=je,Ee.needsUpdate=!0,be=!0}}be===!0&&(N.updateMultisampleRenderTarget(de),N.updateRenderTargetMipmap(de))}y.setRenderTarget(ue,Se,ye),y.setClearColor(Y,se),Ve!==void 0&&(H.viewport=Ve),y.toneMapping=Ue}function Fi(M,O,X){const H=O.isScene===!0?O.overrideMaterial:null;for(let k=0,de=M.length;k<de;k++){const pe=M[k],{object:ue,geometry:Se,group:ye}=pe;let Ue=pe.material;Ue.allowOverride===!0&&H!==null&&(Ue=H),ue.layers.test(X.layers)&&Sa(ue,O,X,Se,Ue,ye)}}function Sa(M,O,X,H,k,de){M.onBeforeRender(y,O,X,H,k,de),M.modelViewMatrix.multiplyMatrices(X.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),k.onBeforeRender(y,O,X,H,M,de),k.transparent===!0&&k.side===cn&&k.forceSinglePass===!1?(k.side=At,k.needsUpdate=!0,y.renderBufferDirect(X,O,H,k,M,de),k.side=An,k.needsUpdate=!0,y.renderBufferDirect(X,O,H,k,M,de),k.side=cn):y.renderBufferDirect(X,O,H,k,M,de),M.onAfterRender(y,O,X,H,k,de)}function Ui(M,O,X){O.isScene!==!0&&(O=Ze);const H=_.get(M),k=R.state.lights,de=R.state.shadowsArray,pe=k.state.version,ue=ae.getParameters(M,k.state,de,O,X),Se=ae.getProgramCacheKey(ue);let ye=H.programs;H.environment=M.isMeshStandardMaterial||M.isMeshLambertMaterial||M.isMeshPhongMaterial?O.environment:null,H.fog=O.fog;const Ue=M.isMeshStandardMaterial||M.isMeshLambertMaterial&&!M.envMap||M.isMeshPhongMaterial&&!M.envMap;H.envMap=$.get(M.envMap||H.environment,Ue),H.envMapRotation=H.environment!==null&&M.envMap===null?O.environmentRotation:M.envMapRotation,ye===void 0&&(M.addEventListener("dispose",Je),ye=new Map,H.programs=ye);let Ve=ye.get(Se);if(Ve!==void 0){if(H.currentProgram===Ve&&H.lightsStateVersion===pe)return ya(M,ue),Ve}else ue.uniforms=ae.getUniforms(M),M.onBeforeCompile(ue,y),Ve=ae.acquireProgram(ue,Se),ye.set(Se,Ve),H.uniforms=ue.uniforms;const be=H.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(be.clippingPlanes=ne.uniform),ya(M,ue),H.needsLights=Bl(M),H.lightsStateVersion=pe,H.needsLights&&(be.ambientLightColor.value=k.state.ambient,be.lightProbe.value=k.state.probe,be.directionalLights.value=k.state.directional,be.directionalLightShadows.value=k.state.directionalShadow,be.spotLights.value=k.state.spot,be.spotLightShadows.value=k.state.spotShadow,be.rectAreaLights.value=k.state.rectArea,be.ltc_1.value=k.state.rectAreaLTC1,be.ltc_2.value=k.state.rectAreaLTC2,be.pointLights.value=k.state.point,be.pointLightShadows.value=k.state.pointShadow,be.hemisphereLights.value=k.state.hemi,be.directionalShadowMatrix.value=k.state.directionalShadowMatrix,be.spotLightMatrix.value=k.state.spotLightMatrix,be.spotLightMap.value=k.state.spotLightMap,be.pointShadowMatrix.value=k.state.pointShadowMatrix),H.currentProgram=Ve,H.uniformsList=null,Ve}function Ea(M){if(M.uniformsList===null){const O=M.currentProgram.getUniforms();M.uniformsList=ur.seqWithValue(O.seq,M.uniforms)}return M.uniformsList}function ya(M,O){const X=_.get(M);X.outputColorSpace=O.outputColorSpace,X.batching=O.batching,X.batchingColor=O.batchingColor,X.instancing=O.instancing,X.instancingColor=O.instancingColor,X.instancingMorph=O.instancingMorph,X.skinning=O.skinning,X.morphTargets=O.morphTargets,X.morphNormals=O.morphNormals,X.morphColors=O.morphColors,X.morphTargetsCount=O.morphTargetsCount,X.numClippingPlanes=O.numClippingPlanes,X.numIntersection=O.numClipIntersection,X.vertexAlphas=O.vertexAlphas,X.vertexTangents=O.vertexTangents,X.toneMapping=O.toneMapping}function Ul(M,O,X,H,k){O.isScene!==!0&&(O=Ze),N.resetTextureUnits();const de=O.fog,pe=H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial?O.environment:null,ue=B===null?y.outputColorSpace:B.isXRRenderTarget===!0?B.texture.colorSpace:kn,Se=H.isMeshStandardMaterial||H.isMeshLambertMaterial&&!H.envMap||H.isMeshPhongMaterial&&!H.envMap,ye=$.get(H.envMap||pe,Se),Ue=H.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,Ve=!!X.attributes.tangent&&(!!H.normalMap||H.anisotropy>0),be=!!X.morphAttributes.position,et=!!X.morphAttributes.normal,ht=!!X.morphAttributes.color;let lt=$t;H.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(lt=y.toneMapping);const tt=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,vt=tt!==void 0?tt.length:0,Ee=_.get(H),wt=R.state.lights;if(Ae===!0&&(Re===!0||M!==G)){const mt=M===G&&H.id===I;ne.setState(H,M,mt)}let je=!1;H.version===Ee.__version?(Ee.needsLights&&Ee.lightsStateVersion!==wt.state.version||Ee.outputColorSpace!==ue||k.isBatchedMesh&&Ee.batching===!1||!k.isBatchedMesh&&Ee.batching===!0||k.isBatchedMesh&&Ee.batchingColor===!0&&k.colorTexture===null||k.isBatchedMesh&&Ee.batchingColor===!1&&k.colorTexture!==null||k.isInstancedMesh&&Ee.instancing===!1||!k.isInstancedMesh&&Ee.instancing===!0||k.isSkinnedMesh&&Ee.skinning===!1||!k.isSkinnedMesh&&Ee.skinning===!0||k.isInstancedMesh&&Ee.instancingColor===!0&&k.instanceColor===null||k.isInstancedMesh&&Ee.instancingColor===!1&&k.instanceColor!==null||k.isInstancedMesh&&Ee.instancingMorph===!0&&k.morphTexture===null||k.isInstancedMesh&&Ee.instancingMorph===!1&&k.morphTexture!==null||Ee.envMap!==ye||H.fog===!0&&Ee.fog!==de||Ee.numClippingPlanes!==void 0&&(Ee.numClippingPlanes!==ne.numPlanes||Ee.numIntersection!==ne.numIntersection)||Ee.vertexAlphas!==Ue||Ee.vertexTangents!==Ve||Ee.morphTargets!==be||Ee.morphNormals!==et||Ee.morphColors!==ht||Ee.toneMapping!==lt||Ee.morphTargetsCount!==vt)&&(je=!0):(je=!0,Ee.__version=H.version);let Nt=Ee.currentProgram;je===!0&&(Nt=Ui(H,O,k));let kt=!1,Rn=!1,Wn=!1;const it=Nt.getUniforms(),_t=Ee.uniforms;if(ge.useProgram(Nt.program)&&(kt=!0,Rn=!0,Wn=!0),H.id!==I&&(I=H.id,Rn=!0),kt||G!==M){ge.buffers.depth.getReversed()&&M.reversedDepth!==!0&&(M._reversedDepth=!0,M.updateProjectionMatrix()),it.setValue(P,"projectionMatrix",M.projectionMatrix),it.setValue(P,"viewMatrix",M.matrixWorldInverse);const _n=it.map.cameraPosition;_n!==void 0&&_n.setValue(P,ke.setFromMatrixPosition(M.matrixWorld)),Oe.logarithmicDepthBuffer&&it.setValue(P,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&it.setValue(P,"isOrthographic",M.isOrthographicCamera===!0),G!==M&&(G=M,Rn=!0,Wn=!0)}if(Ee.needsLights&&(wt.state.directionalShadowMap.length>0&&it.setValue(P,"directionalShadowMap",wt.state.directionalShadowMap,N),wt.state.spotShadowMap.length>0&&it.setValue(P,"spotShadowMap",wt.state.spotShadowMap,N),wt.state.pointShadowMap.length>0&&it.setValue(P,"pointShadowMap",wt.state.pointShadowMap,N)),k.isSkinnedMesh){it.setOptional(P,k,"bindMatrix"),it.setOptional(P,k,"bindMatrixInverse");const mt=k.skeleton;mt&&(mt.boneTexture===null&&mt.computeBoneTexture(),it.setValue(P,"boneTexture",mt.boneTexture,N))}k.isBatchedMesh&&(it.setOptional(P,k,"batchingTexture"),it.setValue(P,"batchingTexture",k._matricesTexture,N),it.setOptional(P,k,"batchingIdTexture"),it.setValue(P,"batchingIdTexture",k._indirectTexture,N),it.setOptional(P,k,"batchingColorTexture"),k._colorsTexture!==null&&it.setValue(P,"batchingColorTexture",k._colorsTexture,N));const gn=X.morphAttributes;if((gn.position!==void 0||gn.normal!==void 0||gn.color!==void 0)&&fe.update(k,X,Nt),(Rn||Ee.receiveShadow!==k.receiveShadow)&&(Ee.receiveShadow=k.receiveShadow,it.setValue(P,"receiveShadow",k.receiveShadow)),(H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial)&&H.envMap===null&&O.environment!==null&&(_t.envMapIntensity.value=O.environmentIntensity),_t.dfgLUT!==void 0&&(_t.dfgLUT.value=hm()),Rn&&(it.setValue(P,"toneMappingExposure",y.toneMappingExposure),Ee.needsLights&&Ol(_t,Wn),de&&H.fog===!0&&Te.refreshFogUniforms(_t,de),Te.refreshMaterialUniforms(_t,H,we,le,R.state.transmissionRenderTarget[M.id]),ur.upload(P,Ea(Ee),_t,N)),H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(ur.upload(P,Ea(Ee),_t,N),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&it.setValue(P,"center",k.center),it.setValue(P,"modelViewMatrix",k.modelViewMatrix),it.setValue(P,"normalMatrix",k.normalMatrix),it.setValue(P,"modelMatrix",k.matrixWorld),H.isShaderMaterial||H.isRawShaderMaterial){const mt=H.uniformsGroups;for(let _n=0,Xn=mt.length;_n<Xn;_n++){const ba=mt[_n];me.update(ba,Nt),me.bind(ba,Nt)}}return Nt}function Ol(M,O){M.ambientLightColor.needsUpdate=O,M.lightProbe.needsUpdate=O,M.directionalLights.needsUpdate=O,M.directionalLightShadows.needsUpdate=O,M.pointLights.needsUpdate=O,M.pointLightShadows.needsUpdate=O,M.spotLights.needsUpdate=O,M.spotLightShadows.needsUpdate=O,M.rectAreaLights.needsUpdate=O,M.hemisphereLights.needsUpdate=O}function Bl(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return F},this.getRenderTarget=function(){return B},this.setRenderTargetTextures=function(M,O,X){const H=_.get(M);H.__autoAllocateDepthBuffer=M.resolveDepthBuffer===!1,H.__autoAllocateDepthBuffer===!1&&(H.__useRenderToTexture=!1),_.get(M.texture).__webglTexture=O,_.get(M.depthTexture).__webglTexture=H.__autoAllocateDepthBuffer?void 0:X,H.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(M,O){const X=_.get(M);X.__webglFramebuffer=O,X.__useDefaultFramebuffer=O===void 0};const zl=P.createFramebuffer();this.setRenderTarget=function(M,O=0,X=0){B=M,w=O,F=X;let H=null,k=!1,de=!1;if(M){const ue=_.get(M);if(ue.__useDefaultFramebuffer!==void 0){ge.bindFramebuffer(P.FRAMEBUFFER,ue.__webglFramebuffer),V.copy(M.viewport),U.copy(M.scissor),K=M.scissorTest,ge.viewport(V),ge.scissor(U),ge.setScissorTest(K),I=-1;return}else if(ue.__webglFramebuffer===void 0)N.setupRenderTarget(M);else if(ue.__hasExternalTextures)N.rebindTextures(M,_.get(M.texture).__webglTexture,_.get(M.depthTexture).__webglTexture);else if(M.depthBuffer){const Ue=M.depthTexture;if(ue.__boundDepthTexture!==Ue){if(Ue!==null&&_.has(Ue)&&(M.width!==Ue.image.width||M.height!==Ue.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");N.setupDepthRenderbuffer(M)}}const Se=M.texture;(Se.isData3DTexture||Se.isDataArrayTexture||Se.isCompressedArrayTexture)&&(de=!0);const ye=_.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(ye[O])?H=ye[O][X]:H=ye[O],k=!0):M.samples>0&&N.useMultisampledRTT(M)===!1?H=_.get(M).__webglMultisampledFramebuffer:Array.isArray(ye)?H=ye[X]:H=ye,V.copy(M.viewport),U.copy(M.scissor),K=M.scissorTest}else V.copy(Z).multiplyScalar(we).floor(),U.copy(te).multiplyScalar(we).floor(),K=re;if(X!==0&&(H=zl),ge.bindFramebuffer(P.FRAMEBUFFER,H)&&ge.drawBuffers(M,H),ge.viewport(V),ge.scissor(U),ge.setScissorTest(K),k){const ue=_.get(M.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_CUBE_MAP_POSITIVE_X+O,ue.__webglTexture,X)}else if(de){const ue=O;for(let Se=0;Se<M.textures.length;Se++){const ye=_.get(M.textures[Se]);P.framebufferTextureLayer(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0+Se,ye.__webglTexture,X,ue)}}else if(M!==null&&X!==0){const ue=_.get(M.texture);P.framebufferTexture2D(P.FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,ue.__webglTexture,X)}I=-1},this.readRenderTargetPixels=function(M,O,X,H,k,de,pe,ue=0){if(!(M&&M.isWebGLRenderTarget)){qe("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Se=_.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&pe!==void 0&&(Se=Se[pe]),Se){ge.bindFramebuffer(P.FRAMEBUFFER,Se);try{const ye=M.textures[ue],Ue=ye.format,Ve=ye.type;if(M.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+ue),!Oe.textureFormatReadable(Ue)){qe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Oe.textureTypeReadable(Ve)){qe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}O>=0&&O<=M.width-H&&X>=0&&X<=M.height-k&&P.readPixels(O,X,H,k,oe.convert(Ue),oe.convert(Ve),de)}finally{const ye=B!==null?_.get(B).__webglFramebuffer:null;ge.bindFramebuffer(P.FRAMEBUFFER,ye)}}},this.readRenderTargetPixelsAsync=async function(M,O,X,H,k,de,pe,ue=0){if(!(M&&M.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Se=_.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&pe!==void 0&&(Se=Se[pe]),Se)if(O>=0&&O<=M.width-H&&X>=0&&X<=M.height-k){ge.bindFramebuffer(P.FRAMEBUFFER,Se);const ye=M.textures[ue],Ue=ye.format,Ve=ye.type;if(M.textures.length>1&&P.readBuffer(P.COLOR_ATTACHMENT0+ue),!Oe.textureFormatReadable(Ue))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Oe.textureTypeReadable(Ve))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const be=P.createBuffer();P.bindBuffer(P.PIXEL_PACK_BUFFER,be),P.bufferData(P.PIXEL_PACK_BUFFER,de.byteLength,P.STREAM_READ),P.readPixels(O,X,H,k,oe.convert(Ue),oe.convert(Ve),0);const et=B!==null?_.get(B).__webglFramebuffer:null;ge.bindFramebuffer(P.FRAMEBUFFER,et);const ht=P.fenceSync(P.SYNC_GPU_COMMANDS_COMPLETE,0);return P.flush(),await Nc(P,ht,4),P.bindBuffer(P.PIXEL_PACK_BUFFER,be),P.getBufferSubData(P.PIXEL_PACK_BUFFER,0,de),P.deleteBuffer(be),P.deleteSync(ht),de}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(M,O=null,X=0){const H=Math.pow(2,-X),k=Math.floor(M.image.width*H),de=Math.floor(M.image.height*H),pe=O!==null?O.x:0,ue=O!==null?O.y:0;N.setTexture2D(M,0),P.copyTexSubImage2D(P.TEXTURE_2D,X,0,0,pe,ue,k,de),ge.unbindTexture()};const Gl=P.createFramebuffer(),Vl=P.createFramebuffer();this.copyTextureToTexture=function(M,O,X=null,H=null,k=0,de=0){let pe,ue,Se,ye,Ue,Ve,be,et,ht;const lt=M.isCompressedTexture?M.mipmaps[de]:M.image;if(X!==null)pe=X.max.x-X.min.x,ue=X.max.y-X.min.y,Se=X.isBox3?X.max.z-X.min.z:1,ye=X.min.x,Ue=X.min.y,Ve=X.isBox3?X.min.z:0;else{const _t=Math.pow(2,-k);pe=Math.floor(lt.width*_t),ue=Math.floor(lt.height*_t),M.isDataArrayTexture?Se=lt.depth:M.isData3DTexture?Se=Math.floor(lt.depth*_t):Se=1,ye=0,Ue=0,Ve=0}H!==null?(be=H.x,et=H.y,ht=H.z):(be=0,et=0,ht=0);const tt=oe.convert(O.format),vt=oe.convert(O.type);let Ee;O.isData3DTexture?(N.setTexture3D(O,0),Ee=P.TEXTURE_3D):O.isDataArrayTexture||O.isCompressedArrayTexture?(N.setTexture2DArray(O,0),Ee=P.TEXTURE_2D_ARRAY):(N.setTexture2D(O,0),Ee=P.TEXTURE_2D),P.pixelStorei(P.UNPACK_FLIP_Y_WEBGL,O.flipY),P.pixelStorei(P.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),P.pixelStorei(P.UNPACK_ALIGNMENT,O.unpackAlignment);const wt=P.getParameter(P.UNPACK_ROW_LENGTH),je=P.getParameter(P.UNPACK_IMAGE_HEIGHT),Nt=P.getParameter(P.UNPACK_SKIP_PIXELS),kt=P.getParameter(P.UNPACK_SKIP_ROWS),Rn=P.getParameter(P.UNPACK_SKIP_IMAGES);P.pixelStorei(P.UNPACK_ROW_LENGTH,lt.width),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,lt.height),P.pixelStorei(P.UNPACK_SKIP_PIXELS,ye),P.pixelStorei(P.UNPACK_SKIP_ROWS,Ue),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Ve);const Wn=M.isDataArrayTexture||M.isData3DTexture,it=O.isDataArrayTexture||O.isData3DTexture;if(M.isDepthTexture){const _t=_.get(M),gn=_.get(O),mt=_.get(_t.__renderTarget),_n=_.get(gn.__renderTarget);ge.bindFramebuffer(P.READ_FRAMEBUFFER,mt.__webglFramebuffer),ge.bindFramebuffer(P.DRAW_FRAMEBUFFER,_n.__webglFramebuffer);for(let Xn=0;Xn<Se;Xn++)Wn&&(P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,_.get(M).__webglTexture,k,Ve+Xn),P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,_.get(O).__webglTexture,de,ht+Xn)),P.blitFramebuffer(ye,Ue,pe,ue,be,et,pe,ue,P.DEPTH_BUFFER_BIT,P.NEAREST);ge.bindFramebuffer(P.READ_FRAMEBUFFER,null),ge.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else if(k!==0||M.isRenderTargetTexture||_.has(M)){const _t=_.get(M),gn=_.get(O);ge.bindFramebuffer(P.READ_FRAMEBUFFER,Gl),ge.bindFramebuffer(P.DRAW_FRAMEBUFFER,Vl);for(let mt=0;mt<Se;mt++)Wn?P.framebufferTextureLayer(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,_t.__webglTexture,k,Ve+mt):P.framebufferTexture2D(P.READ_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,_t.__webglTexture,k),it?P.framebufferTextureLayer(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,gn.__webglTexture,de,ht+mt):P.framebufferTexture2D(P.DRAW_FRAMEBUFFER,P.COLOR_ATTACHMENT0,P.TEXTURE_2D,gn.__webglTexture,de),k!==0?P.blitFramebuffer(ye,Ue,pe,ue,be,et,pe,ue,P.COLOR_BUFFER_BIT,P.NEAREST):it?P.copyTexSubImage3D(Ee,de,be,et,ht+mt,ye,Ue,pe,ue):P.copyTexSubImage2D(Ee,de,be,et,ye,Ue,pe,ue);ge.bindFramebuffer(P.READ_FRAMEBUFFER,null),ge.bindFramebuffer(P.DRAW_FRAMEBUFFER,null)}else it?M.isDataTexture||M.isData3DTexture?P.texSubImage3D(Ee,de,be,et,ht,pe,ue,Se,tt,vt,lt.data):O.isCompressedArrayTexture?P.compressedTexSubImage3D(Ee,de,be,et,ht,pe,ue,Se,tt,lt.data):P.texSubImage3D(Ee,de,be,et,ht,pe,ue,Se,tt,vt,lt):M.isDataTexture?P.texSubImage2D(P.TEXTURE_2D,de,be,et,pe,ue,tt,vt,lt.data):M.isCompressedTexture?P.compressedTexSubImage2D(P.TEXTURE_2D,de,be,et,lt.width,lt.height,tt,lt.data):P.texSubImage2D(P.TEXTURE_2D,de,be,et,pe,ue,tt,vt,lt);P.pixelStorei(P.UNPACK_ROW_LENGTH,wt),P.pixelStorei(P.UNPACK_IMAGE_HEIGHT,je),P.pixelStorei(P.UNPACK_SKIP_PIXELS,Nt),P.pixelStorei(P.UNPACK_SKIP_ROWS,kt),P.pixelStorei(P.UNPACK_SKIP_IMAGES,Rn),de===0&&O.generateMipmaps&&P.generateMipmap(Ee),ge.unbindTexture()},this.initRenderTarget=function(M){_.get(M).__webglFramebuffer===void 0&&N.setupRenderTarget(M)},this.initTexture=function(M){M.isCubeTexture?N.setTextureCube(M,0):M.isData3DTexture?N.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?N.setTexture2DArray(M,0):N.setTexture2D(M,0),ge.unbindTexture()},this.resetState=function(){w=0,F=0,B=null,ge.reset(),ie.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Yt}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Xe._getDrawingBufferColorSpace(e),t.unpackColorSpace=Xe._getUnpackColorSpace()}}const um=`
4050
4050
  precision highp float;
4051
4051
  attribute vec3 position;
4052
4052
  void main(){
4053
4053
  gl_Position = vec4(position, 1.0);
4054
4054
  }
4055
- `,lm=`
4055
+ `,fm=`
4056
4056
  #ifdef GL_ES
4057
4057
  #extension GL_OES_standard_derivatives : enable
4058
4058
  #endif
@@ -4249,19 +4249,19 @@ void main(){
4249
4249
  // straight (non-premultiplied) alpha output
4250
4250
  gl_FragColor=vec4(col,alpha);
4251
4251
  }
4252
- `;function yo(n){let e=n.trim().replace("#","");e.length===3&&(e=e.split("").map(i=>i+i).join(""));const t=parseInt(e,16)||16777215;return{r:(t>>16&255)/255,g:(t>>8&255)/255,b:(t&255)/255}}function cm({className:n,style:e,wispDensity:t=1,dpr:i,mouseSmoothTime:r=.06,mouseTiltStrength:s=.01,horizontalBeamOffset:a=0,verticalBeamOffset:o=-.5,flowSpeed:l=.35,verticalSizing:c=2,horizontalSizing:u=.5,fogIntensity:p=.45,fogScale:h=.3,wispSpeed:f=15,wispIntensity:g=5,flowStrength:v=.25,decay:m=1.1,falloffStart:d=1.2,fogFallSpeed:S=.6,color:b="#8a7aff"}){const E=De.useRef(null),R=De.useRef(null),A=De.useRef(!1),C=De.useRef(null),x=De.useRef(!0),y=De.useRef(!1),z=De.useRef(r);return De.useEffect(()=>{z.current=r},[r]),De.useEffect(()=>{const w=E.current;let F;try{F=new am({antialias:!1,alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,powerPreference:"high-performance"})}catch(Pe){console.warn("LaserFlow: WebGL not supported or context creation failed.",Pe);return}let I=Math.min(i??(window.devicePixelRatio||1),2);F.setPixelRatio(I),F.outputColorSpace=kn,F.setClearColor(0,0);const G=F.domElement;G.style.cssText="position:absolute;inset:0;width:100%;height:100%;display:block;",w.appendChild(G);const V=new Xc,U=new pa(-1,1,1,-1,0,1),K=new en;K.setAttribute("position",new Vt(new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),3));const Y={iTime:{value:0},iResolution:{value:new W(1,1,1)},iMouse:{value:new ct(0,0,0,0)},uWispDensity:{value:t},uTiltScale:{value:s},uFlowTime:{value:0},uFogTime:{value:0},uBeamXFrac:{value:a},uBeamYFrac:{value:o},uFlowSpeed:{value:l},uVLenFactor:{value:c},uHLenFactor:{value:u},uFogIntensity:{value:p},uFogScale:{value:h},uWSpeed:{value:f},uWIntensity:{value:g},uFlowStrength:{value:v},uDecay:{value:m},uFalloffStart:{value:d},uFogFallSpeed:{value:S},uColor:{value:new W(1,1,1)},uFade:{value:A.current?1:0}};R.current=Y;const{r:se,g:ce,b:le}=yo(b);Y.uColor.value.set(se,ce,le);const we=new _l({vertexShader:om,fragmentShader:lm,uniforms:Y,transparent:!0,depthTest:!1,depthWrite:!1,blending:Gn}),Ye=new Jt(K,we);Ye.frustumCulled=!1,V.add(Ye);let He=0,Z=0,te=0;function re(){const Pe=w.clientWidth||1,Oe=w.clientHeight||1;Math.abs(Pe-He)<1&&Math.abs(Oe-Z)<1&&Math.abs(I-te)<.01||(He=Pe,Z=Oe,te=I,F.setPixelRatio(I),F.setSize(Pe,Oe,!1),Y.iResolution.value.set(Pe*I,Oe*I,I),C.current=G.getBoundingClientRect())}let Le=0;const Ae=new ResizeObserver(()=>{cancelAnimationFrame(Le),Le=requestAnimationFrame(re)});Ae.observe(w),re();const Re=new IntersectionObserver(Pe=>{x.current=Pe[0]?.isIntersecting??!0},{threshold:0});Re.observe(w),document.addEventListener("visibilitychange",()=>{y.current=document.hidden},{passive:!0});const ot=new Ke(0,0),ke=new Ke(0,0);function $e(Pe){const Oe=C.current;Oe&&ot.set((Pe.clientX-Oe.left)*I,(Oe.height-(Pe.clientY-Oe.top))*I)}G.addEventListener("pointermove",$e,{passive:!0}),G.addEventListener("pointerleave",()=>ot.set(0,0),{passive:!0});let Ze=0,Ne=A.current?1:0;const st=new uh;let P=0;function at(){if(P=requestAnimationFrame(at),y.current||!x.current)return;const Pe=st.getElapsedTime(),Oe=Math.min(Math.max(Pe-Ze,.001),.033);Ze=Pe,Y.iTime.value=Pe,Y.uFlowTime.value+=Oe,Y.uFogTime.value+=Oe,A.current||(Ne=Math.min(1,Ne+Oe/1),Y.uFade.value=Ne,Ne>=1&&(A.current=!0));const ge=Math.max(.001,z.current);ke.lerp(ot,1-Math.exp(-Oe/ge)),Y.iMouse.value.set(ke.x,ke.y,0,0),F.render(V,U)}return at(),()=>{cancelAnimationFrame(P),cancelAnimationFrame(Le),Ae.disconnect(),Re.disconnect(),V.clear(),K.dispose(),we.dispose(),F.dispose(),F.forceContextLoss(),w.contains(G)&&w.removeChild(G)}},[i]),De.useEffect(()=>{const w=R.current;if(!w)return;w.uWispDensity.value=t,w.uTiltScale.value=s,w.uBeamXFrac.value=a,w.uBeamYFrac.value=o,w.uFlowSpeed.value=l,w.uVLenFactor.value=c,w.uHLenFactor.value=u,w.uFogIntensity.value=p,w.uFogScale.value=h,w.uWSpeed.value=f,w.uWIntensity.value=g,w.uFlowStrength.value=v,w.uDecay.value=m,w.uFalloffStart.value=d,w.uFogFallSpeed.value=S;const{r:F,g:B,b:I}=yo(b);w.uColor.value.set(F,B,I)},[t,s,a,o,l,c,u,p,h,f,g,v,m,d,S,b]),L.jsx("div",{ref:E,className:n,style:{position:"relative",overflow:"hidden",...e}})}function Ri(n){let e=n[0],t=n[1],i=n[2];return Math.sqrt(e*e+t*t+i*i)}function ea(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n}function hm(n,e,t,i){return n[0]=e,n[1]=t,n[2]=i,n}function bo(n,e,t){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n}function To(n,e,t){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n}function um(n,e,t){return n[0]=e[0]*t[0],n[1]=e[1]*t[1],n[2]=e[2]*t[2],n}function dm(n,e,t){return n[0]=e[0]/t[0],n[1]=e[1]/t[1],n[2]=e[2]/t[2],n}function rs(n,e,t){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n}function fm(n,e){let t=e[0]-n[0],i=e[1]-n[1],r=e[2]-n[2];return Math.sqrt(t*t+i*i+r*r)}function pm(n,e){let t=e[0]-n[0],i=e[1]-n[1],r=e[2]-n[2];return t*t+i*i+r*r}function Ao(n){let e=n[0],t=n[1],i=n[2];return e*e+t*t+i*i}function mm(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n}function gm(n,e){return n[0]=1/e[0],n[1]=1/e[1],n[2]=1/e[2],n}function ta(n,e){let t=e[0],i=e[1],r=e[2],s=t*t+i*i+r*r;return s>0&&(s=1/Math.sqrt(s)),n[0]=e[0]*s,n[1]=e[1]*s,n[2]=e[2]*s,n}function Tl(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]}function wo(n,e,t){let i=e[0],r=e[1],s=e[2],a=t[0],o=t[1],l=t[2];return n[0]=r*l-s*o,n[1]=s*a-i*l,n[2]=i*o-r*a,n}function _m(n,e,t,i){let r=e[0],s=e[1],a=e[2];return n[0]=r+i*(t[0]-r),n[1]=s+i*(t[1]-s),n[2]=a+i*(t[2]-a),n}function xm(n,e,t,i,r){const s=Math.exp(-i*r);let a=e[0],o=e[1],l=e[2];return n[0]=t[0]+(a-t[0])*s,n[1]=t[1]+(o-t[1])*s,n[2]=t[2]+(l-t[2])*s,n}function vm(n,e,t){let i=e[0],r=e[1],s=e[2],a=t[3]*i+t[7]*r+t[11]*s+t[15];return a=a||1,n[0]=(t[0]*i+t[4]*r+t[8]*s+t[12])/a,n[1]=(t[1]*i+t[5]*r+t[9]*s+t[13])/a,n[2]=(t[2]*i+t[6]*r+t[10]*s+t[14])/a,n}function Mm(n,e,t){let i=e[0],r=e[1],s=e[2],a=t[3]*i+t[7]*r+t[11]*s+t[15];return a=a||1,n[0]=(t[0]*i+t[4]*r+t[8]*s)/a,n[1]=(t[1]*i+t[5]*r+t[9]*s)/a,n[2]=(t[2]*i+t[6]*r+t[10]*s)/a,n}function Sm(n,e,t){let i=e[0],r=e[1],s=e[2];return n[0]=i*t[0]+r*t[3]+s*t[6],n[1]=i*t[1]+r*t[4]+s*t[7],n[2]=i*t[2]+r*t[5]+s*t[8],n}function Em(n,e,t){let i=e[0],r=e[1],s=e[2],a=t[0],o=t[1],l=t[2],c=t[3],u=o*s-l*r,p=l*i-a*s,h=a*r-o*i,f=o*h-l*p,g=l*u-a*h,v=a*p-o*u,m=c*2;return u*=m,p*=m,h*=m,f*=2,g*=2,v*=2,n[0]=i+u+f,n[1]=r+p+g,n[2]=s+h+v,n}const ym=(function(){const n=[0,0,0],e=[0,0,0];return function(t,i){ea(n,t),ea(e,i),ta(n,n),ta(e,e);let r=Tl(n,e);return r>1?0:r<-1?Math.PI:Math.acos(r)}})();function bm(n,e){return n[0]===e[0]&&n[1]===e[1]&&n[2]===e[2]}class Gt extends Array{constructor(e=0,t=e,i=e){return super(e,t,i),this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this[0]=e}set y(e){this[1]=e}set z(e){this[2]=e}set(e,t=e,i=e){return e.length?this.copy(e):(hm(this,e,t,i),this)}copy(e){return ea(this,e),this}add(e,t){return t?bo(this,e,t):bo(this,this,e),this}sub(e,t){return t?To(this,e,t):To(this,this,e),this}multiply(e){return e.length?um(this,this,e):rs(this,this,e),this}divide(e){return e.length?dm(this,this,e):rs(this,this,1/e),this}inverse(e=this){return gm(this,e),this}len(){return Ri(this)}distance(e){return e?fm(this,e):Ri(this)}squaredLen(){return Ao(this)}squaredDistance(e){return e?pm(this,e):Ao(this)}negate(e=this){return mm(this,e),this}cross(e,t){return t?wo(this,e,t):wo(this,this,e),this}scale(e){return rs(this,this,e),this}normalize(){return ta(this,this),this}dot(e){return Tl(this,e)}equals(e){return bm(this,e)}applyMatrix3(e){return Sm(this,this,e),this}applyMatrix4(e){return vm(this,this,e),this}scaleRotateMatrix4(e){return Mm(this,this,e),this}applyQuaternion(e){return Em(this,this,e),this}angle(e){return ym(this,e)}lerp(e,t){return _m(this,this,e,t),this}smoothLerp(e,t,i){return xm(this,this,e,t,i),this}clone(){return new Gt(this[0],this[1],this[2])}fromArray(e,t=0){return this[0]=e[t],this[1]=e[t+1],this[2]=e[t+2],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e}transformDirection(e){const t=this[0],i=this[1],r=this[2];return this[0]=e[0]*t+e[4]*i+e[8]*r,this[1]=e[1]*t+e[5]*i+e[9]*r,this[2]=e[2]*t+e[6]*i+e[10]*r,this.normalize()}}const Ro=new Gt;let Tm=1,Am=1,Co=!1;class wm{constructor(e,t={}){e.canvas||console.error("gl not passed as first argument to Geometry"),this.gl=e,this.attributes=t,this.id=Tm++,this.VAOs={},this.drawRange={start:0,count:0},this.instancedCount=0,this.gl.renderer.bindVertexArray(null),this.gl.renderer.currentGeometry=null,this.glState=this.gl.renderer.state;for(let i in t)this.addAttribute(i,t[i])}addAttribute(e,t){if(this.attributes[e]=t,t.id=Am++,t.size=t.size||1,t.type=t.type||(t.data.constructor===Float32Array?this.gl.FLOAT:t.data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT),t.target=e==="index"?this.gl.ELEMENT_ARRAY_BUFFER:this.gl.ARRAY_BUFFER,t.normalized=t.normalized||!1,t.stride=t.stride||0,t.offset=t.offset||0,t.count=t.count||(t.stride?t.data.byteLength/t.stride:t.data.length/t.size),t.divisor=t.instanced||0,t.needsUpdate=!1,t.usage=t.usage||this.gl.STATIC_DRAW,t.buffer||this.updateAttribute(t),t.divisor){if(this.isInstanced=!0,this.instancedCount&&this.instancedCount!==t.count*t.divisor)return console.warn("geometry has multiple instanced buffers of different length"),this.instancedCount=Math.min(this.instancedCount,t.count*t.divisor);this.instancedCount=t.count*t.divisor}else e==="index"?this.drawRange.count=t.count:this.attributes.index||(this.drawRange.count=Math.max(this.drawRange.count,t.count))}updateAttribute(e){const t=!e.buffer;t&&(e.buffer=this.gl.createBuffer()),this.glState.boundBuffer!==e.buffer&&(this.gl.bindBuffer(e.target,e.buffer),this.glState.boundBuffer=e.buffer),t?this.gl.bufferData(e.target,e.data,e.usage):this.gl.bufferSubData(e.target,0,e.data),e.needsUpdate=!1}setIndex(e){this.addAttribute("index",e)}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}setInstancedCount(e){this.instancedCount=e}createVAO(e){this.VAOs[e.attributeOrder]=this.gl.renderer.createVertexArray(),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.bindAttributes(e)}bindAttributes(e){e.attributeLocations.forEach((t,{name:i,type:r})=>{if(!this.attributes[i]){console.warn(`active attribute ${i} not being supplied`);return}const s=this.attributes[i];this.gl.bindBuffer(s.target,s.buffer),this.glState.boundBuffer=s.buffer;let a=1;r===35674&&(a=2),r===35675&&(a=3),r===35676&&(a=4);const o=s.size/a,l=a===1?0:a*a*4,c=a===1?0:a*4;for(let u=0;u<a;u++)this.gl.vertexAttribPointer(t+u,o,s.type,s.normalized,s.stride+l,s.offset+u*c),this.gl.enableVertexAttribArray(t+u),this.gl.renderer.vertexAttribDivisor(t+u,s.divisor)}),this.attributes.index&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.attributes.index.buffer)}draw({program:e,mode:t=this.gl.TRIANGLES}){this.gl.renderer.currentGeometry!==`${this.id}_${e.attributeOrder}`&&(this.VAOs[e.attributeOrder]||this.createVAO(e),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.gl.renderer.currentGeometry=`${this.id}_${e.attributeOrder}`),e.attributeLocations.forEach((r,{name:s})=>{const a=this.attributes[s];a.needsUpdate&&this.updateAttribute(a)});let i=2;this.attributes.index?.type===this.gl.UNSIGNED_INT&&(i=4),this.isInstanced?this.attributes.index?this.gl.renderer.drawElementsInstanced(t,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*i,this.instancedCount):this.gl.renderer.drawArraysInstanced(t,this.drawRange.start,this.drawRange.count,this.instancedCount):this.attributes.index?this.gl.drawElements(t,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*i):this.gl.drawArrays(t,this.drawRange.start,this.drawRange.count)}getPosition(){const e=this.attributes.position;if(e.data)return e;if(!Co)return console.warn("No position buffer data found to compute bounds"),Co=!0}computeBoundingBox(e){e||(e=this.getPosition());const t=e.data,i=e.size;this.bounds||(this.bounds={min:new Gt,max:new Gt,center:new Gt,scale:new Gt,radius:1/0});const r=this.bounds.min,s=this.bounds.max,a=this.bounds.center,o=this.bounds.scale;r.set(1/0),s.set(-1/0);for(let l=0,c=t.length;l<c;l+=i){const u=t[l],p=t[l+1],h=t[l+2];r.x=Math.min(u,r.x),r.y=Math.min(p,r.y),r.z=Math.min(h,r.z),s.x=Math.max(u,s.x),s.y=Math.max(p,s.y),s.z=Math.max(h,s.z)}o.sub(s,r),a.add(r,s).divide(2)}computeBoundingSphere(e){e||(e=this.getPosition());const t=e.data,i=e.size;this.bounds||this.computeBoundingBox(e);let r=0;for(let s=0,a=t.length;s<a;s+=i)Ro.fromArray(t,s),r=Math.max(r,this.bounds.center.squaredDistance(Ro));this.bounds.radius=Math.sqrt(r)}remove(){for(let e in this.VAOs)this.gl.renderer.deleteVertexArray(this.VAOs[e]),delete this.VAOs[e];for(let e in this.attributes)this.gl.deleteBuffer(this.attributes[e].buffer),delete this.attributes[e]}}let Rm=1;const Po={};class Cm{constructor(e,{vertex:t,fragment:i,uniforms:r={},transparent:s=!1,cullFace:a=e.BACK,frontFace:o=e.CCW,depthTest:l=!0,depthWrite:c=!0,depthFunc:u=e.LEQUAL}={}){e.canvas||console.error("gl not passed as first argument to Program"),this.gl=e,this.uniforms=r,this.id=Rm++,t||console.warn("vertex shader not supplied"),i||console.warn("fragment shader not supplied"),this.transparent=s,this.cullFace=a,this.frontFace=o,this.depthTest=l,this.depthWrite=c,this.depthFunc=u,this.blendFunc={},this.blendEquation={},this.stencilFunc={},this.stencilOp={},this.transparent&&!this.blendFunc.src&&(this.gl.renderer.premultipliedAlpha?this.setBlendFunc(this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA):this.setBlendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA)),this.vertexShader=e.createShader(e.VERTEX_SHADER),this.fragmentShader=e.createShader(e.FRAGMENT_SHADER),this.program=e.createProgram(),e.attachShader(this.program,this.vertexShader),e.attachShader(this.program,this.fragmentShader),this.setShaders({vertex:t,fragment:i})}setShaders({vertex:e,fragment:t}){if(e&&(this.gl.shaderSource(this.vertexShader,e),this.gl.compileShader(this.vertexShader),this.gl.getShaderInfoLog(this.vertexShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.vertexShader)}
4252
+ `;function bo(n){let e=n.trim().replace("#","");e.length===3&&(e=e.split("").map(i=>i+i).join(""));const t=parseInt(e,16)||16777215;return{r:(t>>16&255)/255,g:(t>>8&255)/255,b:(t&255)/255}}function pm({className:n,style:e,wispDensity:t=1,dpr:i,mouseSmoothTime:r=.06,mouseTiltStrength:s=.01,horizontalBeamOffset:a=0,verticalBeamOffset:o=-.5,flowSpeed:l=.35,verticalSizing:c=2,horizontalSizing:d=.5,fogIntensity:p=.45,fogScale:h=.3,wispSpeed:f=15,wispIntensity:g=5,flowStrength:v=.25,decay:m=1.1,falloffStart:u=1.2,fogFallSpeed:S=.6,color:b="#8a7aff"}){const E=Pe.useRef(null),R=Pe.useRef(null),A=Pe.useRef(!1),C=Pe.useRef(null),x=Pe.useRef(!0),y=Pe.useRef(!1),z=Pe.useRef(r);return Pe.useEffect(()=>{z.current=r},[r]),Pe.useEffect(()=>{const w=E.current;let F;try{F=new dm({antialias:!1,alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,powerPreference:"high-performance"})}catch(De){console.warn("LaserFlow: WebGL not supported or context creation failed.",De);return}let I=Math.min(i??(window.devicePixelRatio||1),2);F.setPixelRatio(I),F.outputColorSpace=kn,F.setClearColor(0,0);const G=F.domElement;G.style.cssText="position:absolute;inset:0;width:100%;height:100%;display:block;",w.appendChild(G);const V=new Zc,U=new pa(-1,1,1,-1,0,1),K=new en;K.setAttribute("position",new Vt(new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),3));const Y={iTime:{value:0},iResolution:{value:new W(1,1,1)},iMouse:{value:new ct(0,0,0,0)},uWispDensity:{value:t},uTiltScale:{value:s},uFlowTime:{value:0},uFogTime:{value:0},uBeamXFrac:{value:a},uBeamYFrac:{value:o},uFlowSpeed:{value:l},uVLenFactor:{value:c},uHLenFactor:{value:d},uFogIntensity:{value:p},uFogScale:{value:h},uWSpeed:{value:f},uWIntensity:{value:g},uFlowStrength:{value:v},uDecay:{value:m},uFalloffStart:{value:u},uFogFallSpeed:{value:S},uColor:{value:new W(1,1,1)},uFade:{value:A.current?1:0}};R.current=Y;const{r:se,g:ce,b:le}=bo(b);Y.uColor.value.set(se,ce,le);const we=new El({vertexShader:um,fragmentShader:fm,uniforms:Y,transparent:!0,depthTest:!1,depthWrite:!1,blending:Gn}),Ye=new Jt(K,we);Ye.frustumCulled=!1,V.add(Ye);let He=0,Z=0,te=0;function re(){const De=w.clientWidth||1,Oe=w.clientHeight||1;Math.abs(De-He)<1&&Math.abs(Oe-Z)<1&&Math.abs(I-te)<.01||(He=De,Z=Oe,te=I,F.setPixelRatio(I),F.setSize(De,Oe,!1),Y.iResolution.value.set(De*I,Oe*I,I),C.current=G.getBoundingClientRect())}let Le=0;const Ae=new ResizeObserver(()=>{cancelAnimationFrame(Le),Le=requestAnimationFrame(re)});Ae.observe(w),re();const Re=new IntersectionObserver(De=>{x.current=De[0]?.isIntersecting??!0},{threshold:0});Re.observe(w),document.addEventListener("visibilitychange",()=>{y.current=document.hidden},{passive:!0});const ot=new Ke(0,0),ke=new Ke(0,0);function $e(De){const Oe=C.current;Oe&&ot.set((De.clientX-Oe.left)*I,(Oe.height-(De.clientY-Oe.top))*I)}G.addEventListener("pointermove",$e,{passive:!0}),G.addEventListener("pointerleave",()=>ot.set(0,0),{passive:!0});let Ze=0,Ne=A.current?1:0;const st=new gh;let P=0;function at(){if(P=requestAnimationFrame(at),y.current||!x.current)return;const De=st.getElapsedTime(),Oe=Math.min(Math.max(De-Ze,.001),.033);Ze=De,Y.iTime.value=De,Y.uFlowTime.value+=Oe,Y.uFogTime.value+=Oe,A.current||(Ne=Math.min(1,Ne+Oe/1),Y.uFade.value=Ne,Ne>=1&&(A.current=!0));const ge=Math.max(.001,z.current);ke.lerp(ot,1-Math.exp(-Oe/ge)),Y.iMouse.value.set(ke.x,ke.y,0,0),F.render(V,U)}return at(),()=>{cancelAnimationFrame(P),cancelAnimationFrame(Le),Ae.disconnect(),Re.disconnect(),V.clear(),K.dispose(),we.dispose(),F.dispose(),F.forceContextLoss(),w.contains(G)&&w.removeChild(G)}},[i]),Pe.useEffect(()=>{const w=R.current;if(!w)return;w.uWispDensity.value=t,w.uTiltScale.value=s,w.uBeamXFrac.value=a,w.uBeamYFrac.value=o,w.uFlowSpeed.value=l,w.uVLenFactor.value=c,w.uHLenFactor.value=d,w.uFogIntensity.value=p,w.uFogScale.value=h,w.uWSpeed.value=f,w.uWIntensity.value=g,w.uFlowStrength.value=v,w.uDecay.value=m,w.uFalloffStart.value=u,w.uFogFallSpeed.value=S;const{r:F,g:B,b:I}=bo(b);w.uColor.value.set(F,B,I)},[t,s,a,o,l,c,d,p,h,f,g,v,m,u,S,b]),D.jsx("div",{ref:E,className:n,style:{position:"relative",overflow:"hidden",...e}})}function Ri(n){let e=n[0],t=n[1],i=n[2];return Math.sqrt(e*e+t*t+i*i)}function ea(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n}function mm(n,e,t,i){return n[0]=e,n[1]=t,n[2]=i,n}function To(n,e,t){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n}function Ao(n,e,t){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n}function gm(n,e,t){return n[0]=e[0]*t[0],n[1]=e[1]*t[1],n[2]=e[2]*t[2],n}function _m(n,e,t){return n[0]=e[0]/t[0],n[1]=e[1]/t[1],n[2]=e[2]/t[2],n}function rs(n,e,t){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n}function xm(n,e){let t=e[0]-n[0],i=e[1]-n[1],r=e[2]-n[2];return Math.sqrt(t*t+i*i+r*r)}function vm(n,e){let t=e[0]-n[0],i=e[1]-n[1],r=e[2]-n[2];return t*t+i*i+r*r}function wo(n){let e=n[0],t=n[1],i=n[2];return e*e+t*t+i*i}function Mm(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n}function Sm(n,e){return n[0]=1/e[0],n[1]=1/e[1],n[2]=1/e[2],n}function ta(n,e){let t=e[0],i=e[1],r=e[2],s=t*t+i*i+r*r;return s>0&&(s=1/Math.sqrt(s)),n[0]=e[0]*s,n[1]=e[1]*s,n[2]=e[2]*s,n}function Pl(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]}function Ro(n,e,t){let i=e[0],r=e[1],s=e[2],a=t[0],o=t[1],l=t[2];return n[0]=r*l-s*o,n[1]=s*a-i*l,n[2]=i*o-r*a,n}function Em(n,e,t,i){let r=e[0],s=e[1],a=e[2];return n[0]=r+i*(t[0]-r),n[1]=s+i*(t[1]-s),n[2]=a+i*(t[2]-a),n}function ym(n,e,t,i,r){const s=Math.exp(-i*r);let a=e[0],o=e[1],l=e[2];return n[0]=t[0]+(a-t[0])*s,n[1]=t[1]+(o-t[1])*s,n[2]=t[2]+(l-t[2])*s,n}function bm(n,e,t){let i=e[0],r=e[1],s=e[2],a=t[3]*i+t[7]*r+t[11]*s+t[15];return a=a||1,n[0]=(t[0]*i+t[4]*r+t[8]*s+t[12])/a,n[1]=(t[1]*i+t[5]*r+t[9]*s+t[13])/a,n[2]=(t[2]*i+t[6]*r+t[10]*s+t[14])/a,n}function Tm(n,e,t){let i=e[0],r=e[1],s=e[2],a=t[3]*i+t[7]*r+t[11]*s+t[15];return a=a||1,n[0]=(t[0]*i+t[4]*r+t[8]*s)/a,n[1]=(t[1]*i+t[5]*r+t[9]*s)/a,n[2]=(t[2]*i+t[6]*r+t[10]*s)/a,n}function Am(n,e,t){let i=e[0],r=e[1],s=e[2];return n[0]=i*t[0]+r*t[3]+s*t[6],n[1]=i*t[1]+r*t[4]+s*t[7],n[2]=i*t[2]+r*t[5]+s*t[8],n}function wm(n,e,t){let i=e[0],r=e[1],s=e[2],a=t[0],o=t[1],l=t[2],c=t[3],d=o*s-l*r,p=l*i-a*s,h=a*r-o*i,f=o*h-l*p,g=l*d-a*h,v=a*p-o*d,m=c*2;return d*=m,p*=m,h*=m,f*=2,g*=2,v*=2,n[0]=i+d+f,n[1]=r+p+g,n[2]=s+h+v,n}const Rm=(function(){const n=[0,0,0],e=[0,0,0];return function(t,i){ea(n,t),ea(e,i),ta(n,n),ta(e,e);let r=Pl(n,e);return r>1?0:r<-1?Math.PI:Math.acos(r)}})();function Cm(n,e){return n[0]===e[0]&&n[1]===e[1]&&n[2]===e[2]}class Gt extends Array{constructor(e=0,t=e,i=e){return super(e,t,i),this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this[0]=e}set y(e){this[1]=e}set z(e){this[2]=e}set(e,t=e,i=e){return e.length?this.copy(e):(mm(this,e,t,i),this)}copy(e){return ea(this,e),this}add(e,t){return t?To(this,e,t):To(this,this,e),this}sub(e,t){return t?Ao(this,e,t):Ao(this,this,e),this}multiply(e){return e.length?gm(this,this,e):rs(this,this,e),this}divide(e){return e.length?_m(this,this,e):rs(this,this,1/e),this}inverse(e=this){return Sm(this,e),this}len(){return Ri(this)}distance(e){return e?xm(this,e):Ri(this)}squaredLen(){return wo(this)}squaredDistance(e){return e?vm(this,e):wo(this)}negate(e=this){return Mm(this,e),this}cross(e,t){return t?Ro(this,e,t):Ro(this,this,e),this}scale(e){return rs(this,this,e),this}normalize(){return ta(this,this),this}dot(e){return Pl(this,e)}equals(e){return Cm(this,e)}applyMatrix3(e){return Am(this,this,e),this}applyMatrix4(e){return bm(this,this,e),this}scaleRotateMatrix4(e){return Tm(this,this,e),this}applyQuaternion(e){return wm(this,this,e),this}angle(e){return Rm(this,e)}lerp(e,t){return Em(this,this,e,t),this}smoothLerp(e,t,i){return ym(this,this,e,t,i),this}clone(){return new Gt(this[0],this[1],this[2])}fromArray(e,t=0){return this[0]=e[t],this[1]=e[t+1],this[2]=e[t+2],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e}transformDirection(e){const t=this[0],i=this[1],r=this[2];return this[0]=e[0]*t+e[4]*i+e[8]*r,this[1]=e[1]*t+e[5]*i+e[9]*r,this[2]=e[2]*t+e[6]*i+e[10]*r,this.normalize()}}const Co=new Gt;let Pm=1,Dm=1,Po=!1;class Lm{constructor(e,t={}){e.canvas||console.error("gl not passed as first argument to Geometry"),this.gl=e,this.attributes=t,this.id=Pm++,this.VAOs={},this.drawRange={start:0,count:0},this.instancedCount=0,this.gl.renderer.bindVertexArray(null),this.gl.renderer.currentGeometry=null,this.glState=this.gl.renderer.state;for(let i in t)this.addAttribute(i,t[i])}addAttribute(e,t){if(this.attributes[e]=t,t.id=Dm++,t.size=t.size||1,t.type=t.type||(t.data.constructor===Float32Array?this.gl.FLOAT:t.data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT),t.target=e==="index"?this.gl.ELEMENT_ARRAY_BUFFER:this.gl.ARRAY_BUFFER,t.normalized=t.normalized||!1,t.stride=t.stride||0,t.offset=t.offset||0,t.count=t.count||(t.stride?t.data.byteLength/t.stride:t.data.length/t.size),t.divisor=t.instanced||0,t.needsUpdate=!1,t.usage=t.usage||this.gl.STATIC_DRAW,t.buffer||this.updateAttribute(t),t.divisor){if(this.isInstanced=!0,this.instancedCount&&this.instancedCount!==t.count*t.divisor)return console.warn("geometry has multiple instanced buffers of different length"),this.instancedCount=Math.min(this.instancedCount,t.count*t.divisor);this.instancedCount=t.count*t.divisor}else e==="index"?this.drawRange.count=t.count:this.attributes.index||(this.drawRange.count=Math.max(this.drawRange.count,t.count))}updateAttribute(e){const t=!e.buffer;t&&(e.buffer=this.gl.createBuffer()),this.glState.boundBuffer!==e.buffer&&(this.gl.bindBuffer(e.target,e.buffer),this.glState.boundBuffer=e.buffer),t?this.gl.bufferData(e.target,e.data,e.usage):this.gl.bufferSubData(e.target,0,e.data),e.needsUpdate=!1}setIndex(e){this.addAttribute("index",e)}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}setInstancedCount(e){this.instancedCount=e}createVAO(e){this.VAOs[e.attributeOrder]=this.gl.renderer.createVertexArray(),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.bindAttributes(e)}bindAttributes(e){e.attributeLocations.forEach((t,{name:i,type:r})=>{if(!this.attributes[i]){console.warn(`active attribute ${i} not being supplied`);return}const s=this.attributes[i];this.gl.bindBuffer(s.target,s.buffer),this.glState.boundBuffer=s.buffer;let a=1;r===35674&&(a=2),r===35675&&(a=3),r===35676&&(a=4);const o=s.size/a,l=a===1?0:a*a*4,c=a===1?0:a*4;for(let d=0;d<a;d++)this.gl.vertexAttribPointer(t+d,o,s.type,s.normalized,s.stride+l,s.offset+d*c),this.gl.enableVertexAttribArray(t+d),this.gl.renderer.vertexAttribDivisor(t+d,s.divisor)}),this.attributes.index&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.attributes.index.buffer)}draw({program:e,mode:t=this.gl.TRIANGLES}){this.gl.renderer.currentGeometry!==`${this.id}_${e.attributeOrder}`&&(this.VAOs[e.attributeOrder]||this.createVAO(e),this.gl.renderer.bindVertexArray(this.VAOs[e.attributeOrder]),this.gl.renderer.currentGeometry=`${this.id}_${e.attributeOrder}`),e.attributeLocations.forEach((r,{name:s})=>{const a=this.attributes[s];a.needsUpdate&&this.updateAttribute(a)});let i=2;this.attributes.index?.type===this.gl.UNSIGNED_INT&&(i=4),this.isInstanced?this.attributes.index?this.gl.renderer.drawElementsInstanced(t,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*i,this.instancedCount):this.gl.renderer.drawArraysInstanced(t,this.drawRange.start,this.drawRange.count,this.instancedCount):this.attributes.index?this.gl.drawElements(t,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*i):this.gl.drawArrays(t,this.drawRange.start,this.drawRange.count)}getPosition(){const e=this.attributes.position;if(e.data)return e;if(!Po)return console.warn("No position buffer data found to compute bounds"),Po=!0}computeBoundingBox(e){e||(e=this.getPosition());const t=e.data,i=e.size;this.bounds||(this.bounds={min:new Gt,max:new Gt,center:new Gt,scale:new Gt,radius:1/0});const r=this.bounds.min,s=this.bounds.max,a=this.bounds.center,o=this.bounds.scale;r.set(1/0),s.set(-1/0);for(let l=0,c=t.length;l<c;l+=i){const d=t[l],p=t[l+1],h=t[l+2];r.x=Math.min(d,r.x),r.y=Math.min(p,r.y),r.z=Math.min(h,r.z),s.x=Math.max(d,s.x),s.y=Math.max(p,s.y),s.z=Math.max(h,s.z)}o.sub(s,r),a.add(r,s).divide(2)}computeBoundingSphere(e){e||(e=this.getPosition());const t=e.data,i=e.size;this.bounds||this.computeBoundingBox(e);let r=0;for(let s=0,a=t.length;s<a;s+=i)Co.fromArray(t,s),r=Math.max(r,this.bounds.center.squaredDistance(Co));this.bounds.radius=Math.sqrt(r)}remove(){for(let e in this.VAOs)this.gl.renderer.deleteVertexArray(this.VAOs[e]),delete this.VAOs[e];for(let e in this.attributes)this.gl.deleteBuffer(this.attributes[e].buffer),delete this.attributes[e]}}let Im=1;const Do={};class Nm{constructor(e,{vertex:t,fragment:i,uniforms:r={},transparent:s=!1,cullFace:a=e.BACK,frontFace:o=e.CCW,depthTest:l=!0,depthWrite:c=!0,depthFunc:d=e.LEQUAL}={}){e.canvas||console.error("gl not passed as first argument to Program"),this.gl=e,this.uniforms=r,this.id=Im++,t||console.warn("vertex shader not supplied"),i||console.warn("fragment shader not supplied"),this.transparent=s,this.cullFace=a,this.frontFace=o,this.depthTest=l,this.depthWrite=c,this.depthFunc=d,this.blendFunc={},this.blendEquation={},this.stencilFunc={},this.stencilOp={},this.transparent&&!this.blendFunc.src&&(this.gl.renderer.premultipliedAlpha?this.setBlendFunc(this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA):this.setBlendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA)),this.vertexShader=e.createShader(e.VERTEX_SHADER),this.fragmentShader=e.createShader(e.FRAGMENT_SHADER),this.program=e.createProgram(),e.attachShader(this.program,this.vertexShader),e.attachShader(this.program,this.fragmentShader),this.setShaders({vertex:t,fragment:i})}setShaders({vertex:e,fragment:t}){if(e&&(this.gl.shaderSource(this.vertexShader,e),this.gl.compileShader(this.vertexShader),this.gl.getShaderInfoLog(this.vertexShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.vertexShader)}
4253
4253
  Vertex Shader
4254
- ${Do(e)}`)),t&&(this.gl.shaderSource(this.fragmentShader,t),this.gl.compileShader(this.fragmentShader),this.gl.getShaderInfoLog(this.fragmentShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.fragmentShader)}
4254
+ ${Lo(e)}`)),t&&(this.gl.shaderSource(this.fragmentShader,t),this.gl.compileShader(this.fragmentShader),this.gl.getShaderInfoLog(this.fragmentShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.fragmentShader)}
4255
4255
  Fragment Shader
4256
- ${Do(t)}`)),this.gl.linkProgram(this.program),!this.gl.getProgramParameter(this.program,this.gl.LINK_STATUS))return console.warn(this.gl.getProgramInfoLog(this.program));this.uniformLocations=new Map;let i=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_UNIFORMS);for(let a=0;a<i;a++){let o=this.gl.getActiveUniform(this.program,a);this.uniformLocations.set(o,this.gl.getUniformLocation(this.program,o.name));const l=o.name.match(/(\w+)/g);o.uniformName=l[0],o.nameComponents=l.slice(1)}this.attributeLocations=new Map;const r=[],s=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES);for(let a=0;a<s;a++){const o=this.gl.getActiveAttrib(this.program,a),l=this.gl.getAttribLocation(this.program,o.name);l!==-1&&(r[l]=o.name,this.attributeLocations.set(o,l))}this.attributeOrder=r.join("")}setBlendFunc(e,t,i,r){this.blendFunc.src=e,this.blendFunc.dst=t,this.blendFunc.srcAlpha=i,this.blendFunc.dstAlpha=r,e&&(this.transparent=!0)}setBlendEquation(e,t){this.blendEquation.modeRGB=e,this.blendEquation.modeAlpha=t}setStencilFunc(e,t,i){this.stencilRef=t,this.stencilFunc.func=e,this.stencilFunc.ref=t,this.stencilFunc.mask=i}setStencilOp(e,t,i){this.stencilOp.stencilFail=e,this.stencilOp.depthFail=t,this.stencilOp.depthPass=i}applyState(){this.depthTest?this.gl.renderer.enable(this.gl.DEPTH_TEST):this.gl.renderer.disable(this.gl.DEPTH_TEST),this.cullFace?this.gl.renderer.enable(this.gl.CULL_FACE):this.gl.renderer.disable(this.gl.CULL_FACE),this.blendFunc.src?this.gl.renderer.enable(this.gl.BLEND):this.gl.renderer.disable(this.gl.BLEND),this.cullFace&&this.gl.renderer.setCullFace(this.cullFace),this.gl.renderer.setFrontFace(this.frontFace),this.gl.renderer.setDepthMask(this.depthWrite),this.gl.renderer.setDepthFunc(this.depthFunc),this.blendFunc.src&&this.gl.renderer.setBlendFunc(this.blendFunc.src,this.blendFunc.dst,this.blendFunc.srcAlpha,this.blendFunc.dstAlpha),this.gl.renderer.setBlendEquation(this.blendEquation.modeRGB,this.blendEquation.modeAlpha),this.stencilFunc.func||this.stencilOp.stencilFail?this.gl.renderer.enable(this.gl.STENCIL_TEST):this.gl.renderer.disable(this.gl.STENCIL_TEST),this.gl.renderer.setStencilFunc(this.stencilFunc.func,this.stencilFunc.ref,this.stencilFunc.mask),this.gl.renderer.setStencilOp(this.stencilOp.stencilFail,this.stencilOp.depthFail,this.stencilOp.depthPass)}use({flipFaces:e=!1}={}){let t=-1;this.gl.renderer.state.currentProgram===this.id||(this.gl.useProgram(this.program),this.gl.renderer.state.currentProgram=this.id),this.uniformLocations.forEach((r,s)=>{let a=this.uniforms[s.uniformName];for(const o of s.nameComponents){if(!a)break;if(o in a)a=a[o];else{if(Array.isArray(a.value))break;a=void 0;break}}if(!a)return Lo(`Active uniform ${s.name} has not been supplied`);if(a&&a.value===void 0)return Lo(`${s.name} uniform is missing a value parameter`);if(a.value.texture)return t=t+1,a.value.update(t),ss(this.gl,s.type,r,t);if(a.value.length&&a.value[0].texture){const o=[];return a.value.forEach(l=>{t=t+1,l.update(t),o.push(t)}),ss(this.gl,s.type,r,o)}ss(this.gl,s.type,r,a.value)}),this.applyState(),e&&this.gl.renderer.setFrontFace(this.frontFace===this.gl.CCW?this.gl.CW:this.gl.CCW)}remove(){this.gl.deleteProgram(this.program)}}function ss(n,e,t,i){i=i.length?Pm(i):i;const r=n.renderer.state.uniformLocations.get(t);if(i.length)if(r===void 0||r.length!==i.length)n.renderer.state.uniformLocations.set(t,i.slice(0));else{if(Dm(r,i))return;r.set?r.set(i):Lm(r,i),n.renderer.state.uniformLocations.set(t,r)}else{if(r===i)return;n.renderer.state.uniformLocations.set(t,i)}switch(e){case 5126:return i.length?n.uniform1fv(t,i):n.uniform1f(t,i);case 35664:return n.uniform2fv(t,i);case 35665:return n.uniform3fv(t,i);case 35666:return n.uniform4fv(t,i);case 35670:case 5124:case 35678:case 36306:case 35680:case 36289:return i.length?n.uniform1iv(t,i):n.uniform1i(t,i);case 35671:case 35667:return n.uniform2iv(t,i);case 35672:case 35668:return n.uniform3iv(t,i);case 35673:case 35669:return n.uniform4iv(t,i);case 35674:return n.uniformMatrix2fv(t,!1,i);case 35675:return n.uniformMatrix3fv(t,!1,i);case 35676:return n.uniformMatrix4fv(t,!1,i)}}function Do(n){let e=n.split(`
4256
+ ${Lo(t)}`)),this.gl.linkProgram(this.program),!this.gl.getProgramParameter(this.program,this.gl.LINK_STATUS))return console.warn(this.gl.getProgramInfoLog(this.program));this.uniformLocations=new Map;let i=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_UNIFORMS);for(let a=0;a<i;a++){let o=this.gl.getActiveUniform(this.program,a);this.uniformLocations.set(o,this.gl.getUniformLocation(this.program,o.name));const l=o.name.match(/(\w+)/g);o.uniformName=l[0],o.nameComponents=l.slice(1)}this.attributeLocations=new Map;const r=[],s=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES);for(let a=0;a<s;a++){const o=this.gl.getActiveAttrib(this.program,a),l=this.gl.getAttribLocation(this.program,o.name);l!==-1&&(r[l]=o.name,this.attributeLocations.set(o,l))}this.attributeOrder=r.join("")}setBlendFunc(e,t,i,r){this.blendFunc.src=e,this.blendFunc.dst=t,this.blendFunc.srcAlpha=i,this.blendFunc.dstAlpha=r,e&&(this.transparent=!0)}setBlendEquation(e,t){this.blendEquation.modeRGB=e,this.blendEquation.modeAlpha=t}setStencilFunc(e,t,i){this.stencilRef=t,this.stencilFunc.func=e,this.stencilFunc.ref=t,this.stencilFunc.mask=i}setStencilOp(e,t,i){this.stencilOp.stencilFail=e,this.stencilOp.depthFail=t,this.stencilOp.depthPass=i}applyState(){this.depthTest?this.gl.renderer.enable(this.gl.DEPTH_TEST):this.gl.renderer.disable(this.gl.DEPTH_TEST),this.cullFace?this.gl.renderer.enable(this.gl.CULL_FACE):this.gl.renderer.disable(this.gl.CULL_FACE),this.blendFunc.src?this.gl.renderer.enable(this.gl.BLEND):this.gl.renderer.disable(this.gl.BLEND),this.cullFace&&this.gl.renderer.setCullFace(this.cullFace),this.gl.renderer.setFrontFace(this.frontFace),this.gl.renderer.setDepthMask(this.depthWrite),this.gl.renderer.setDepthFunc(this.depthFunc),this.blendFunc.src&&this.gl.renderer.setBlendFunc(this.blendFunc.src,this.blendFunc.dst,this.blendFunc.srcAlpha,this.blendFunc.dstAlpha),this.gl.renderer.setBlendEquation(this.blendEquation.modeRGB,this.blendEquation.modeAlpha),this.stencilFunc.func||this.stencilOp.stencilFail?this.gl.renderer.enable(this.gl.STENCIL_TEST):this.gl.renderer.disable(this.gl.STENCIL_TEST),this.gl.renderer.setStencilFunc(this.stencilFunc.func,this.stencilFunc.ref,this.stencilFunc.mask),this.gl.renderer.setStencilOp(this.stencilOp.stencilFail,this.stencilOp.depthFail,this.stencilOp.depthPass)}use({flipFaces:e=!1}={}){let t=-1;this.gl.renderer.state.currentProgram===this.id||(this.gl.useProgram(this.program),this.gl.renderer.state.currentProgram=this.id),this.uniformLocations.forEach((r,s)=>{let a=this.uniforms[s.uniformName];for(const o of s.nameComponents){if(!a)break;if(o in a)a=a[o];else{if(Array.isArray(a.value))break;a=void 0;break}}if(!a)return Io(`Active uniform ${s.name} has not been supplied`);if(a&&a.value===void 0)return Io(`${s.name} uniform is missing a value parameter`);if(a.value.texture)return t=t+1,a.value.update(t),ss(this.gl,s.type,r,t);if(a.value.length&&a.value[0].texture){const o=[];return a.value.forEach(l=>{t=t+1,l.update(t),o.push(t)}),ss(this.gl,s.type,r,o)}ss(this.gl,s.type,r,a.value)}),this.applyState(),e&&this.gl.renderer.setFrontFace(this.frontFace===this.gl.CCW?this.gl.CW:this.gl.CCW)}remove(){this.gl.deleteProgram(this.program)}}function ss(n,e,t,i){i=i.length?Fm(i):i;const r=n.renderer.state.uniformLocations.get(t);if(i.length)if(r===void 0||r.length!==i.length)n.renderer.state.uniformLocations.set(t,i.slice(0));else{if(Um(r,i))return;r.set?r.set(i):Om(r,i),n.renderer.state.uniformLocations.set(t,r)}else{if(r===i)return;n.renderer.state.uniformLocations.set(t,i)}switch(e){case 5126:return i.length?n.uniform1fv(t,i):n.uniform1f(t,i);case 35664:return n.uniform2fv(t,i);case 35665:return n.uniform3fv(t,i);case 35666:return n.uniform4fv(t,i);case 35670:case 5124:case 35678:case 36306:case 35680:case 36289:return i.length?n.uniform1iv(t,i):n.uniform1i(t,i);case 35671:case 35667:return n.uniform2iv(t,i);case 35672:case 35668:return n.uniform3iv(t,i);case 35673:case 35669:return n.uniform4iv(t,i);case 35674:return n.uniformMatrix2fv(t,!1,i);case 35675:return n.uniformMatrix3fv(t,!1,i);case 35676:return n.uniformMatrix4fv(t,!1,i)}}function Lo(n){let e=n.split(`
4257
4257
  `);for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
4258
- `)}function Pm(n){const e=n.length,t=n[0].length;if(t===void 0)return n;const i=e*t;let r=Po[i];r||(Po[i]=r=new Float32Array(i));for(let s=0;s<e;s++)r.set(n[s],s*t);return r}function Dm(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function Lm(n,e){for(let t=0,i=n.length;t<i;t++)n[t]=e[t]}let as=0;function Lo(n){as>100||(console.warn(n),as++,as>100&&console.warn("More than 100 program warnings - stopping logs."))}const os=new Gt;let Im=1;class Nm{constructor({canvas:e=document.createElement("canvas"),width:t=300,height:i=150,dpr:r=1,alpha:s=!1,depth:a=!0,stencil:o=!1,antialias:l=!1,premultipliedAlpha:c=!1,preserveDrawingBuffer:u=!1,powerPreference:p="default",autoClear:h=!0,webgl:f=2}={}){const g={alpha:s,depth:a,stencil:o,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:u,powerPreference:p};this.dpr=r,this.alpha=s,this.color=!0,this.depth=a,this.stencil=o,this.premultipliedAlpha=c,this.autoClear=h,this.id=Im++,f===2&&(this.gl=e.getContext("webgl2",g)),this.isWebgl2=!!this.gl,this.gl||(this.gl=e.getContext("webgl",g)),this.gl||console.error("unable to create webgl context"),this.gl.renderer=this,this.setSize(t,i),this.state={},this.state.blendFunc={src:this.gl.ONE,dst:this.gl.ZERO},this.state.blendEquation={modeRGB:this.gl.FUNC_ADD},this.state.cullFace=!1,this.state.frontFace=this.gl.CCW,this.state.depthMask=!0,this.state.depthFunc=this.gl.LEQUAL,this.state.premultiplyAlpha=!1,this.state.flipY=!1,this.state.unpackAlignment=4,this.state.framebuffer=null,this.state.viewport={x:0,y:0,width:null,height:null},this.state.textureUnits=[],this.state.activeTextureUnit=0,this.state.boundBuffer=null,this.state.uniformLocations=new Map,this.state.currentProgram=null,this.extensions={},this.isWebgl2?(this.getExtension("EXT_color_buffer_float"),this.getExtension("OES_texture_float_linear")):(this.getExtension("OES_texture_float"),this.getExtension("OES_texture_float_linear"),this.getExtension("OES_texture_half_float"),this.getExtension("OES_texture_half_float_linear"),this.getExtension("OES_element_index_uint"),this.getExtension("OES_standard_derivatives"),this.getExtension("EXT_sRGB"),this.getExtension("WEBGL_depth_texture"),this.getExtension("WEBGL_draw_buffers")),this.getExtension("WEBGL_compressed_texture_astc"),this.getExtension("EXT_texture_compression_bptc"),this.getExtension("WEBGL_compressed_texture_s3tc"),this.getExtension("WEBGL_compressed_texture_etc1"),this.getExtension("WEBGL_compressed_texture_pvrtc"),this.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),this.vertexAttribDivisor=this.getExtension("ANGLE_instanced_arrays","vertexAttribDivisor","vertexAttribDivisorANGLE"),this.drawArraysInstanced=this.getExtension("ANGLE_instanced_arrays","drawArraysInstanced","drawArraysInstancedANGLE"),this.drawElementsInstanced=this.getExtension("ANGLE_instanced_arrays","drawElementsInstanced","drawElementsInstancedANGLE"),this.createVertexArray=this.getExtension("OES_vertex_array_object","createVertexArray","createVertexArrayOES"),this.bindVertexArray=this.getExtension("OES_vertex_array_object","bindVertexArray","bindVertexArrayOES"),this.deleteVertexArray=this.getExtension("OES_vertex_array_object","deleteVertexArray","deleteVertexArrayOES"),this.drawBuffers=this.getExtension("WEBGL_draw_buffers","drawBuffers","drawBuffersWEBGL"),this.parameters={},this.parameters.maxTextureUnits=this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this.parameters.maxAnisotropy=this.getExtension("EXT_texture_filter_anisotropic")?this.gl.getParameter(this.getExtension("EXT_texture_filter_anisotropic").MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}setSize(e,t){this.width=e,this.height=t,this.gl.canvas.width=e*this.dpr,this.gl.canvas.height=t*this.dpr,this.gl.canvas.style&&Object.assign(this.gl.canvas.style,{width:e+"px",height:t+"px"})}setViewport(e,t,i=0,r=0){this.state.viewport.width===e&&this.state.viewport.height===t||(this.state.viewport.width=e,this.state.viewport.height=t,this.state.viewport.x=i,this.state.viewport.y=r,this.gl.viewport(i,r,e,t))}setScissor(e,t,i=0,r=0){this.gl.scissor(i,r,e,t)}enable(e){this.state[e]!==!0&&(this.gl.enable(e),this.state[e]=!0)}disable(e){this.state[e]!==!1&&(this.gl.disable(e),this.state[e]=!1)}setBlendFunc(e,t,i,r){this.state.blendFunc.src===e&&this.state.blendFunc.dst===t&&this.state.blendFunc.srcAlpha===i&&this.state.blendFunc.dstAlpha===r||(this.state.blendFunc.src=e,this.state.blendFunc.dst=t,this.state.blendFunc.srcAlpha=i,this.state.blendFunc.dstAlpha=r,i!==void 0?this.gl.blendFuncSeparate(e,t,i,r):this.gl.blendFunc(e,t))}setBlendEquation(e,t){e=e||this.gl.FUNC_ADD,!(this.state.blendEquation.modeRGB===e&&this.state.blendEquation.modeAlpha===t)&&(this.state.blendEquation.modeRGB=e,this.state.blendEquation.modeAlpha=t,t!==void 0?this.gl.blendEquationSeparate(e,t):this.gl.blendEquation(e))}setCullFace(e){this.state.cullFace!==e&&(this.state.cullFace=e,this.gl.cullFace(e))}setFrontFace(e){this.state.frontFace!==e&&(this.state.frontFace=e,this.gl.frontFace(e))}setDepthMask(e){this.state.depthMask!==e&&(this.state.depthMask=e,this.gl.depthMask(e))}setDepthFunc(e){this.state.depthFunc!==e&&(this.state.depthFunc=e,this.gl.depthFunc(e))}setStencilMask(e){this.state.stencilMask!==e&&(this.state.stencilMask=e,this.gl.stencilMask(e))}setStencilFunc(e,t,i){this.state.stencilFunc===e&&this.state.stencilRef===t&&this.state.stencilFuncMask===i||(this.state.stencilFunc=e||this.gl.ALWAYS,this.state.stencilRef=t||0,this.state.stencilFuncMask=i||0,this.gl.stencilFunc(e||this.gl.ALWAYS,t||0,i||0))}setStencilOp(e,t,i){this.state.stencilFail===e&&this.state.stencilDepthFail===t&&this.state.stencilDepthPass===i||(this.state.stencilFail=e,this.state.stencilDepthFail=t,this.state.stencilDepthPass=i,this.gl.stencilOp(e,t,i))}activeTexture(e){this.state.activeTextureUnit!==e&&(this.state.activeTextureUnit=e,this.gl.activeTexture(this.gl.TEXTURE0+e))}bindFramebuffer({target:e=this.gl.FRAMEBUFFER,buffer:t=null}={}){this.state.framebuffer!==t&&(this.state.framebuffer=t,this.gl.bindFramebuffer(e,t))}getExtension(e,t,i){return t&&this.gl[t]?this.gl[t].bind(this.gl):(this.extensions[e]||(this.extensions[e]=this.gl.getExtension(e)),t?this.extensions[e]?this.extensions[e][i].bind(this.extensions[e]):null:this.extensions[e])}sortOpaque(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program.id!==t.program.id?e.program.id-t.program.id:e.zDepth!==t.zDepth?e.zDepth-t.zDepth:t.id-e.id}sortTransparent(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.zDepth!==t.zDepth?t.zDepth-e.zDepth:t.id-e.id}sortUI(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program.id!==t.program.id?e.program.id-t.program.id:t.id-e.id}getRenderList({scene:e,camera:t,frustumCull:i,sort:r}){let s=[];if(t&&i&&t.updateFrustum(),e.traverse(a=>{if(!a.visible)return!0;a.draw&&(i&&a.frustumCulled&&t&&!t.frustumIntersectsMesh(a)||s.push(a))}),r){const a=[],o=[],l=[];s.forEach(c=>{c.program.transparent?c.program.depthTest?o.push(c):l.push(c):a.push(c),c.zDepth=0,!(c.renderOrder!==0||!c.program.depthTest||!t)&&(c.worldMatrix.getTranslation(os),os.applyMatrix4(t.projectionViewMatrix),c.zDepth=os.z)}),a.sort(this.sortOpaque),o.sort(this.sortTransparent),l.sort(this.sortUI),s=a.concat(o,l)}return s}render({scene:e,camera:t,target:i=null,update:r=!0,sort:s=!0,frustumCull:a=!0,clear:o}){i===null?(this.bindFramebuffer(),this.setViewport(this.width*this.dpr,this.height*this.dpr)):(this.bindFramebuffer(i),this.setViewport(i.width,i.height)),(o||this.autoClear&&o!==!1)&&(this.depth&&(!i||i.depth)&&(this.enable(this.gl.DEPTH_TEST),this.setDepthMask(!0)),(this.stencil||!i||i.stencil)&&(this.enable(this.gl.STENCIL_TEST),this.setStencilMask(255)),this.gl.clear((this.color?this.gl.COLOR_BUFFER_BIT:0)|(this.depth?this.gl.DEPTH_BUFFER_BIT:0)|(this.stencil?this.gl.STENCIL_BUFFER_BIT:0))),r&&e.updateMatrixWorld(),t&&t.updateMatrixWorld(),this.getRenderList({scene:e,camera:t,frustumCull:a,sort:s}).forEach(c=>{c.draw({camera:t})})}}function Fm(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n}function Um(n,e,t,i,r){return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n}function Om(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=t*t+i*i+r*r+s*s;return a>0&&(a=1/Math.sqrt(a)),n[0]=t*a,n[1]=i*a,n[2]=r*a,n[3]=s*a,n}function Bm(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]*e[3]}function zm(n){return n[0]=0,n[1]=0,n[2]=0,n[3]=1,n}function Gm(n,e,t){t=t*.5;let i=Math.sin(t);return n[0]=i*e[0],n[1]=i*e[1],n[2]=i*e[2],n[3]=Math.cos(t),n}function Io(n,e,t){let i=e[0],r=e[1],s=e[2],a=e[3],o=t[0],l=t[1],c=t[2],u=t[3];return n[0]=i*u+a*o+r*c-s*l,n[1]=r*u+a*l+s*o-i*c,n[2]=s*u+a*c+i*l-r*o,n[3]=a*u-i*o-r*l-s*c,n}function Vm(n,e,t){t*=.5;let i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return n[0]=i*l+a*o,n[1]=r*l+s*o,n[2]=s*l-r*o,n[3]=a*l-i*o,n}function km(n,e,t){t*=.5;let i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return n[0]=i*l-s*o,n[1]=r*l+a*o,n[2]=s*l+i*o,n[3]=a*l-r*o,n}function Hm(n,e,t){t*=.5;let i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return n[0]=i*l+r*o,n[1]=r*l-i*o,n[2]=s*l+a*o,n[3]=a*l-s*o,n}function Wm(n,e,t,i){let r=e[0],s=e[1],a=e[2],o=e[3],l=t[0],c=t[1],u=t[2],p=t[3],h,f,g,v,m;return f=r*l+s*c+a*u+o*p,f<0&&(f=-f,l=-l,c=-c,u=-u,p=-p),1-f>1e-6?(h=Math.acos(f),g=Math.sin(h),v=Math.sin((1-i)*h)/g,m=Math.sin(i*h)/g):(v=1-i,m=i),n[0]=v*r+m*l,n[1]=v*s+m*c,n[2]=v*a+m*u,n[3]=v*o+m*p,n}function Xm(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=t*t+i*i+r*r+s*s,o=a?1/a:0;return n[0]=-t*o,n[1]=-i*o,n[2]=-r*o,n[3]=s*o,n}function qm(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n[3]=e[3],n}function jm(n,e){let t=e[0]+e[4]+e[8],i;if(t>0)i=Math.sqrt(t+1),n[3]=.5*i,i=.5/i,n[0]=(e[5]-e[7])*i,n[1]=(e[6]-e[2])*i,n[2]=(e[1]-e[3])*i;else{let r=0;e[4]>e[0]&&(r=1),e[8]>e[r*3+r]&&(r=2);let s=(r+1)%3,a=(r+2)%3;i=Math.sqrt(e[r*3+r]-e[s*3+s]-e[a*3+a]+1),n[r]=.5*i,i=.5/i,n[3]=(e[s*3+a]-e[a*3+s])*i,n[s]=(e[s*3+r]+e[r*3+s])*i,n[a]=(e[a*3+r]+e[r*3+a])*i}return n}function Ym(n,e,t="YXZ"){let i=Math.sin(e[0]*.5),r=Math.cos(e[0]*.5),s=Math.sin(e[1]*.5),a=Math.cos(e[1]*.5),o=Math.sin(e[2]*.5),l=Math.cos(e[2]*.5);return t==="XYZ"?(n[0]=i*a*l+r*s*o,n[1]=r*s*l-i*a*o,n[2]=r*a*o+i*s*l,n[3]=r*a*l-i*s*o):t==="YXZ"?(n[0]=i*a*l+r*s*o,n[1]=r*s*l-i*a*o,n[2]=r*a*o-i*s*l,n[3]=r*a*l+i*s*o):t==="ZXY"?(n[0]=i*a*l-r*s*o,n[1]=r*s*l+i*a*o,n[2]=r*a*o+i*s*l,n[3]=r*a*l-i*s*o):t==="ZYX"?(n[0]=i*a*l-r*s*o,n[1]=r*s*l+i*a*o,n[2]=r*a*o-i*s*l,n[3]=r*a*l+i*s*o):t==="YZX"?(n[0]=i*a*l+r*s*o,n[1]=r*s*l+i*a*o,n[2]=r*a*o-i*s*l,n[3]=r*a*l-i*s*o):t==="XZY"&&(n[0]=i*a*l-r*s*o,n[1]=r*s*l-i*a*o,n[2]=r*a*o+i*s*l,n[3]=r*a*l+i*s*o),n}const $m=Fm,Zm=Um,Km=Bm,Jm=Om;class Qm extends Array{constructor(e=0,t=0,i=0,r=1){super(e,t,i,r),this.onChange=()=>{},this._target=this;const s=["0","1","2","3"];return new Proxy(this,{set(a,o){const l=Reflect.set(...arguments);return l&&s.includes(o)&&a.onChange(),l}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}get w(){return this[3]}set x(e){this._target[0]=e,this.onChange()}set y(e){this._target[1]=e,this.onChange()}set z(e){this._target[2]=e,this.onChange()}set w(e){this._target[3]=e,this.onChange()}identity(){return zm(this._target),this.onChange(),this}set(e,t,i,r){return e.length?this.copy(e):(Zm(this._target,e,t,i,r),this.onChange(),this)}rotateX(e){return Vm(this._target,this._target,e),this.onChange(),this}rotateY(e){return km(this._target,this._target,e),this.onChange(),this}rotateZ(e){return Hm(this._target,this._target,e),this.onChange(),this}inverse(e=this._target){return Xm(this._target,e),this.onChange(),this}conjugate(e=this._target){return qm(this._target,e),this.onChange(),this}copy(e){return $m(this._target,e),this.onChange(),this}normalize(e=this._target){return Jm(this._target,e),this.onChange(),this}multiply(e,t){return t?Io(this._target,e,t):Io(this._target,this._target,e),this.onChange(),this}dot(e){return Km(this._target,e)}fromMatrix3(e){return jm(this._target,e),this.onChange(),this}fromEuler(e,t){return Ym(this._target,e,e.order),t||this.onChange(),this}fromAxisAngle(e,t){return Gm(this._target,e,t),this.onChange(),this}slerp(e,t){return Wm(this._target,this._target,e,t),this.onChange(),this}fromArray(e,t=0){return this._target[0]=e[t],this._target[1]=e[t+1],this._target[2]=e[t+2],this._target[3]=e[t+3],this.onChange(),this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e[t+3]=this[3],e}}const e0=1e-6;function t0(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}function n0(n,e,t,i,r,s,a,o,l,c,u,p,h,f,g,v,m){return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n[4]=s,n[5]=a,n[6]=o,n[7]=l,n[8]=c,n[9]=u,n[10]=p,n[11]=h,n[12]=f,n[13]=g,n[14]=v,n[15]=m,n}function i0(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function r0(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],p=e[9],h=e[10],f=e[11],g=e[12],v=e[13],m=e[14],d=e[15],S=t*o-i*a,b=t*l-r*a,E=t*c-s*a,R=i*l-r*o,A=i*c-s*o,C=r*c-s*l,x=u*v-p*g,y=u*m-h*g,z=u*d-f*g,w=p*m-h*v,F=p*d-f*v,B=h*d-f*m,I=S*B-b*F+E*w+R*z-A*y+C*x;return I?(I=1/I,n[0]=(o*B-l*F+c*w)*I,n[1]=(r*F-i*B-s*w)*I,n[2]=(v*C-m*A+d*R)*I,n[3]=(h*A-p*C-f*R)*I,n[4]=(l*z-a*B-c*y)*I,n[5]=(t*B-r*z+s*y)*I,n[6]=(m*E-g*C-d*b)*I,n[7]=(u*C-h*E+f*b)*I,n[8]=(a*F-o*z+c*x)*I,n[9]=(i*z-t*F-s*x)*I,n[10]=(g*A-v*E+d*S)*I,n[11]=(p*E-u*A-f*S)*I,n[12]=(o*y-a*w-l*x)*I,n[13]=(t*w-i*y+r*x)*I,n[14]=(v*b-g*R-m*S)*I,n[15]=(u*R-p*b+h*S)*I,n):null}function Al(n){let e=n[0],t=n[1],i=n[2],r=n[3],s=n[4],a=n[5],o=n[6],l=n[7],c=n[8],u=n[9],p=n[10],h=n[11],f=n[12],g=n[13],v=n[14],m=n[15],d=e*a-t*s,S=e*o-i*s,b=e*l-r*s,E=t*o-i*a,R=t*l-r*a,A=i*l-r*o,C=c*g-u*f,x=c*v-p*f,y=c*m-h*f,z=u*v-p*g,w=u*m-h*g,F=p*m-h*v;return d*F-S*w+b*z+E*y-R*x+A*C}function No(n,e,t){let i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],p=e[8],h=e[9],f=e[10],g=e[11],v=e[12],m=e[13],d=e[14],S=e[15],b=t[0],E=t[1],R=t[2],A=t[3];return n[0]=b*i+E*o+R*p+A*v,n[1]=b*r+E*l+R*h+A*m,n[2]=b*s+E*c+R*f+A*d,n[3]=b*a+E*u+R*g+A*S,b=t[4],E=t[5],R=t[6],A=t[7],n[4]=b*i+E*o+R*p+A*v,n[5]=b*r+E*l+R*h+A*m,n[6]=b*s+E*c+R*f+A*d,n[7]=b*a+E*u+R*g+A*S,b=t[8],E=t[9],R=t[10],A=t[11],n[8]=b*i+E*o+R*p+A*v,n[9]=b*r+E*l+R*h+A*m,n[10]=b*s+E*c+R*f+A*d,n[11]=b*a+E*u+R*g+A*S,b=t[12],E=t[13],R=t[14],A=t[15],n[12]=b*i+E*o+R*p+A*v,n[13]=b*r+E*l+R*h+A*m,n[14]=b*s+E*c+R*f+A*d,n[15]=b*a+E*u+R*g+A*S,n}function s0(n,e,t){let i=t[0],r=t[1],s=t[2],a,o,l,c,u,p,h,f,g,v,m,d;return e===n?(n[12]=e[0]*i+e[4]*r+e[8]*s+e[12],n[13]=e[1]*i+e[5]*r+e[9]*s+e[13],n[14]=e[2]*i+e[6]*r+e[10]*s+e[14],n[15]=e[3]*i+e[7]*r+e[11]*s+e[15]):(a=e[0],o=e[1],l=e[2],c=e[3],u=e[4],p=e[5],h=e[6],f=e[7],g=e[8],v=e[9],m=e[10],d=e[11],n[0]=a,n[1]=o,n[2]=l,n[3]=c,n[4]=u,n[5]=p,n[6]=h,n[7]=f,n[8]=g,n[9]=v,n[10]=m,n[11]=d,n[12]=a*i+u*r+g*s+e[12],n[13]=o*i+p*r+v*s+e[13],n[14]=l*i+h*r+m*s+e[14],n[15]=c*i+f*r+d*s+e[15]),n}function a0(n,e,t){let i=t[0],r=t[1],s=t[2];return n[0]=e[0]*i,n[1]=e[1]*i,n[2]=e[2]*i,n[3]=e[3]*i,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7]*r,n[8]=e[8]*s,n[9]=e[9]*s,n[10]=e[10]*s,n[11]=e[11]*s,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}function o0(n,e,t,i){let r=i[0],s=i[1],a=i[2],o=Math.hypot(r,s,a),l,c,u,p,h,f,g,v,m,d,S,b,E,R,A,C,x,y,z,w,F,B,I,G;return Math.abs(o)<e0?null:(o=1/o,r*=o,s*=o,a*=o,l=Math.sin(t),c=Math.cos(t),u=1-c,p=e[0],h=e[1],f=e[2],g=e[3],v=e[4],m=e[5],d=e[6],S=e[7],b=e[8],E=e[9],R=e[10],A=e[11],C=r*r*u+c,x=s*r*u+a*l,y=a*r*u-s*l,z=r*s*u-a*l,w=s*s*u+c,F=a*s*u+r*l,B=r*a*u+s*l,I=s*a*u-r*l,G=a*a*u+c,n[0]=p*C+v*x+b*y,n[1]=h*C+m*x+E*y,n[2]=f*C+d*x+R*y,n[3]=g*C+S*x+A*y,n[4]=p*z+v*w+b*F,n[5]=h*z+m*w+E*F,n[6]=f*z+d*w+R*F,n[7]=g*z+S*w+A*F,n[8]=p*B+v*I+b*G,n[9]=h*B+m*I+E*G,n[10]=f*B+d*I+R*G,n[11]=g*B+S*I+A*G,e!==n&&(n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n)}function l0(n,e){return n[0]=e[12],n[1]=e[13],n[2]=e[14],n}function wl(n,e){let t=e[0],i=e[1],r=e[2],s=e[4],a=e[5],o=e[6],l=e[8],c=e[9],u=e[10];return n[0]=Math.hypot(t,i,r),n[1]=Math.hypot(s,a,o),n[2]=Math.hypot(l,c,u),n}function c0(n){let e=n[0],t=n[1],i=n[2],r=n[4],s=n[5],a=n[6],o=n[8],l=n[9],c=n[10];const u=e*e+t*t+i*i,p=r*r+s*s+a*a,h=o*o+l*l+c*c;return Math.sqrt(Math.max(u,p,h))}const Rl=(function(){const n=[1,1,1];return function(e,t){let i=n;wl(i,t);let r=1/i[0],s=1/i[1],a=1/i[2],o=t[0]*r,l=t[1]*s,c=t[2]*a,u=t[4]*r,p=t[5]*s,h=t[6]*a,f=t[8]*r,g=t[9]*s,v=t[10]*a,m=o+p+v,d=0;return m>0?(d=Math.sqrt(m+1)*2,e[3]=.25*d,e[0]=(h-g)/d,e[1]=(f-c)/d,e[2]=(l-u)/d):o>p&&o>v?(d=Math.sqrt(1+o-p-v)*2,e[3]=(h-g)/d,e[0]=.25*d,e[1]=(l+u)/d,e[2]=(f+c)/d):p>v?(d=Math.sqrt(1+p-o-v)*2,e[3]=(f-c)/d,e[0]=(l+u)/d,e[1]=.25*d,e[2]=(h+g)/d):(d=Math.sqrt(1+v-o-p)*2,e[3]=(l-u)/d,e[0]=(f+c)/d,e[1]=(h+g)/d,e[2]=.25*d),e}})();function h0(n,e,t,i){let r=Ri([n[0],n[1],n[2]]);const s=Ri([n[4],n[5],n[6]]),a=Ri([n[8],n[9],n[10]]);Al(n)<0&&(r=-r),t[0]=n[12],t[1]=n[13],t[2]=n[14];const l=n.slice(),c=1/r,u=1/s,p=1/a;l[0]*=c,l[1]*=c,l[2]*=c,l[4]*=u,l[5]*=u,l[6]*=u,l[8]*=p,l[9]*=p,l[10]*=p,Rl(e,l),i[0]=r,i[1]=s,i[2]=a}function u0(n,e,t,i){const r=n,s=e[0],a=e[1],o=e[2],l=e[3],c=s+s,u=a+a,p=o+o,h=s*c,f=s*u,g=s*p,v=a*u,m=a*p,d=o*p,S=l*c,b=l*u,E=l*p,R=i[0],A=i[1],C=i[2];return r[0]=(1-(v+d))*R,r[1]=(f+E)*R,r[2]=(g-b)*R,r[3]=0,r[4]=(f-E)*A,r[5]=(1-(h+d))*A,r[6]=(m+S)*A,r[7]=0,r[8]=(g+b)*C,r[9]=(m-S)*C,r[10]=(1-(h+v))*C,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function d0(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=t+t,o=i+i,l=r+r,c=t*a,u=i*a,p=i*o,h=r*a,f=r*o,g=r*l,v=s*a,m=s*o,d=s*l;return n[0]=1-p-g,n[1]=u+d,n[2]=h-m,n[3]=0,n[4]=u-d,n[5]=1-c-g,n[6]=f+v,n[7]=0,n[8]=h+m,n[9]=f-v,n[10]=1-c-p,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function f0(n,e,t,i,r){let s=1/Math.tan(e/2),a=1/(i-r);return n[0]=s/t,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=s,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=(r+i)*a,n[11]=-1,n[12]=0,n[13]=0,n[14]=2*r*i*a,n[15]=0,n}function p0(n,e,t,i,r,s,a){let o=1/(e-t),l=1/(i-r),c=1/(s-a);return n[0]=-2*o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*l,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*c,n[11]=0,n[12]=(e+t)*o,n[13]=(r+i)*l,n[14]=(a+s)*c,n[15]=1,n}function m0(n,e,t,i){let r=e[0],s=e[1],a=e[2],o=i[0],l=i[1],c=i[2],u=r-t[0],p=s-t[1],h=a-t[2],f=u*u+p*p+h*h;f===0?h=1:(f=1/Math.sqrt(f),u*=f,p*=f,h*=f);let g=l*h-c*p,v=c*u-o*h,m=o*p-l*u;return f=g*g+v*v+m*m,f===0&&(c?o+=1e-6:l?c+=1e-6:l+=1e-6,g=l*h-c*p,v=c*u-o*h,m=o*p-l*u,f=g*g+v*v+m*m),f=1/Math.sqrt(f),g*=f,v*=f,m*=f,n[0]=g,n[1]=v,n[2]=m,n[3]=0,n[4]=p*m-h*v,n[5]=h*g-u*m,n[6]=u*v-p*g,n[7]=0,n[8]=u,n[9]=p,n[10]=h,n[11]=0,n[12]=r,n[13]=s,n[14]=a,n[15]=1,n}function Fo(n,e,t){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n}function Uo(n,e,t){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n}function g0(n,e,t){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n}class _r extends Array{constructor(e=1,t=0,i=0,r=0,s=0,a=1,o=0,l=0,c=0,u=0,p=1,h=0,f=0,g=0,v=0,m=1){return super(e,t,i,r,s,a,o,l,c,u,p,h,f,g,v,m),this}get x(){return this[12]}get y(){return this[13]}get z(){return this[14]}get w(){return this[15]}set x(e){this[12]=e}set y(e){this[13]=e}set z(e){this[14]=e}set w(e){this[15]=e}set(e,t,i,r,s,a,o,l,c,u,p,h,f,g,v,m){return e.length?this.copy(e):(n0(this,e,t,i,r,s,a,o,l,c,u,p,h,f,g,v,m),this)}translate(e,t=this){return s0(this,t,e),this}rotate(e,t,i=this){return o0(this,i,e,t),this}scale(e,t=this){return a0(this,t,typeof e=="number"?[e,e,e]:e),this}add(e,t){return t?Fo(this,e,t):Fo(this,this,e),this}sub(e,t){return t?Uo(this,e,t):Uo(this,this,e),this}multiply(e,t){return e.length?t?No(this,e,t):No(this,this,e):g0(this,this,e),this}identity(){return i0(this),this}copy(e){return t0(this,e),this}fromPerspective({fov:e,aspect:t,near:i,far:r}={}){return f0(this,e,t,i,r),this}fromOrthogonal({left:e,right:t,bottom:i,top:r,near:s,far:a}){return p0(this,e,t,i,r,s,a),this}fromQuaternion(e){return d0(this,e),this}setPosition(e){return this.x=e[0],this.y=e[1],this.z=e[2],this}inverse(e=this){return r0(this,e),this}compose(e,t,i){return u0(this,e,t,i),this}decompose(e,t,i){return h0(this,e,t,i),this}getRotation(e){return Rl(e,this),this}getTranslation(e){return l0(e,this),this}getScaling(e){return wl(e,this),this}getMaxScaleOnAxis(){return c0(this)}lookAt(e,t,i){return m0(this,e,t,i),this}determinant(){return Al(this)}fromArray(e,t=0){return this[0]=e[t],this[1]=e[t+1],this[2]=e[t+2],this[3]=e[t+3],this[4]=e[t+4],this[5]=e[t+5],this[6]=e[t+6],this[7]=e[t+7],this[8]=e[t+8],this[9]=e[t+9],this[10]=e[t+10],this[11]=e[t+11],this[12]=e[t+12],this[13]=e[t+13],this[14]=e[t+14],this[15]=e[t+15],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e[t+3]=this[3],e[t+4]=this[4],e[t+5]=this[5],e[t+6]=this[6],e[t+7]=this[7],e[t+8]=this[8],e[t+9]=this[9],e[t+10]=this[10],e[t+11]=this[11],e[t+12]=this[12],e[t+13]=this[13],e[t+14]=this[14],e[t+15]=this[15],e}}function _0(n,e,t="YXZ"){return t==="XYZ"?(n[1]=Math.asin(Math.min(Math.max(e[8],-1),1)),Math.abs(e[8])<.99999?(n[0]=Math.atan2(-e[9],e[10]),n[2]=Math.atan2(-e[4],e[0])):(n[0]=Math.atan2(e[6],e[5]),n[2]=0)):t==="YXZ"?(n[0]=Math.asin(-Math.min(Math.max(e[9],-1),1)),Math.abs(e[9])<.99999?(n[1]=Math.atan2(e[8],e[10]),n[2]=Math.atan2(e[1],e[5])):(n[1]=Math.atan2(-e[2],e[0]),n[2]=0)):t==="ZXY"?(n[0]=Math.asin(Math.min(Math.max(e[6],-1),1)),Math.abs(e[6])<.99999?(n[1]=Math.atan2(-e[2],e[10]),n[2]=Math.atan2(-e[4],e[5])):(n[1]=0,n[2]=Math.atan2(e[1],e[0]))):t==="ZYX"?(n[1]=Math.asin(-Math.min(Math.max(e[2],-1),1)),Math.abs(e[2])<.99999?(n[0]=Math.atan2(e[6],e[10]),n[2]=Math.atan2(e[1],e[0])):(n[0]=0,n[2]=Math.atan2(-e[4],e[5]))):t==="YZX"?(n[2]=Math.asin(Math.min(Math.max(e[1],-1),1)),Math.abs(e[1])<.99999?(n[0]=Math.atan2(-e[9],e[5]),n[1]=Math.atan2(-e[2],e[0])):(n[0]=0,n[1]=Math.atan2(e[8],e[10]))):t==="XZY"&&(n[2]=Math.asin(-Math.min(Math.max(e[4],-1),1)),Math.abs(e[4])<.99999?(n[0]=Math.atan2(e[6],e[5]),n[1]=Math.atan2(e[8],e[0])):(n[0]=Math.atan2(-e[9],e[10]),n[1]=0)),n}const Oo=new _r;class x0 extends Array{constructor(e=0,t=e,i=e,r="YXZ"){super(e,t,i),this.order=r,this.onChange=()=>{},this._target=this;const s=["0","1","2"];return new Proxy(this,{set(a,o){const l=Reflect.set(...arguments);return l&&s.includes(o)&&a.onChange(),l}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this._target[0]=e,this.onChange()}set y(e){this._target[1]=e,this.onChange()}set z(e){this._target[2]=e,this.onChange()}set(e,t=e,i=e){return e.length?this.copy(e):(this._target[0]=e,this._target[1]=t,this._target[2]=i,this.onChange(),this)}copy(e){return this._target[0]=e[0],this._target[1]=e[1],this._target[2]=e[2],this.onChange(),this}reorder(e){return this._target.order=e,this.onChange(),this}fromRotationMatrix(e,t=this.order){return _0(this._target,e,t),this.onChange(),this}fromQuaternion(e,t=this.order,i){return Oo.fromQuaternion(e),this._target.fromRotationMatrix(Oo,t),i||this.onChange(),this}fromArray(e,t=0){return this._target[0]=e[t],this._target[1]=e[t+1],this._target[2]=e[t+2],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e}}class v0{constructor(){this.parent=null,this.children=[],this.visible=!0,this.matrix=new _r,this.worldMatrix=new _r,this.matrixAutoUpdate=!0,this.worldMatrixNeedsUpdate=!1,this.position=new Gt,this.quaternion=new Qm,this.scale=new Gt(1),this.rotation=new x0,this.up=new Gt(0,1,0),this.rotation._target.onChange=()=>this.quaternion.fromEuler(this.rotation,!0),this.quaternion._target.onChange=()=>this.rotation.fromQuaternion(this.quaternion,void 0,!0)}setParent(e,t=!0){this.parent&&e!==this.parent&&this.parent.removeChild(this,!1),this.parent=e,t&&e&&e.addChild(this,!1)}addChild(e,t=!0){~this.children.indexOf(e)||this.children.push(e),t&&e.setParent(this,!1)}removeChild(e,t=!0){~this.children.indexOf(e)&&this.children.splice(this.children.indexOf(e),1),t&&e.setParent(null,!1)}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.worldMatrixNeedsUpdate||e)&&(this.parent===null?this.worldMatrix.copy(this.matrix):this.worldMatrix.multiply(this.parent.worldMatrix,this.matrix),this.worldMatrixNeedsUpdate=!1,e=!0);for(let t=0,i=this.children.length;t<i;t++)this.children[t].updateMatrixWorld(e)}updateMatrix(){this.matrix.compose(this.quaternion,this.position,this.scale),this.worldMatrixNeedsUpdate=!0}traverse(e){if(!e(this))for(let t=0,i=this.children.length;t<i;t++)this.children[t].traverse(e)}decompose(){this.matrix.decompose(this.quaternion._target,this.position,this.scale),this.rotation.fromQuaternion(this.quaternion)}lookAt(e,t=!1){t?this.matrix.lookAt(this.position,e,this.up):this.matrix.lookAt(e,this.position,this.up),this.matrix.getRotation(this.quaternion._target),this.rotation.fromQuaternion(this.quaternion)}}function M0(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[4],n[4]=e[5],n[5]=e[6],n[6]=e[8],n[7]=e[9],n[8]=e[10],n}function S0(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=t+t,o=i+i,l=r+r,c=t*a,u=i*a,p=i*o,h=r*a,f=r*o,g=r*l,v=s*a,m=s*o,d=s*l;return n[0]=1-p-g,n[3]=u-d,n[6]=h+m,n[1]=u+d,n[4]=1-c-g,n[7]=f-v,n[2]=h-m,n[5]=f+v,n[8]=1-c-p,n}function E0(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n}function y0(n,e,t,i,r,s,a,o,l,c){return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n[4]=s,n[5]=a,n[6]=o,n[7]=l,n[8]=c,n}function b0(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=1,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n}function T0(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],p=u*a-o*c,h=-u*s+o*l,f=c*s-a*l,g=t*p+i*h+r*f;return g?(g=1/g,n[0]=p*g,n[1]=(-u*i+r*c)*g,n[2]=(o*i-r*a)*g,n[3]=h*g,n[4]=(u*t-r*l)*g,n[5]=(-o*t+r*s)*g,n[6]=f*g,n[7]=(-c*t+i*l)*g,n[8]=(a*t-i*s)*g,n):null}function Bo(n,e,t){let i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],p=e[8],h=t[0],f=t[1],g=t[2],v=t[3],m=t[4],d=t[5],S=t[6],b=t[7],E=t[8];return n[0]=h*i+f*a+g*c,n[1]=h*r+f*o+g*u,n[2]=h*s+f*l+g*p,n[3]=v*i+m*a+d*c,n[4]=v*r+m*o+d*u,n[5]=v*s+m*l+d*p,n[6]=S*i+b*a+E*c,n[7]=S*r+b*o+E*u,n[8]=S*s+b*l+E*p,n}function A0(n,e,t){let i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],p=e[8],h=t[0],f=t[1];return n[0]=i,n[1]=r,n[2]=s,n[3]=a,n[4]=o,n[5]=l,n[6]=h*i+f*a+c,n[7]=h*r+f*o+u,n[8]=h*s+f*l+p,n}function w0(n,e,t){let i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],u=e[7],p=e[8],h=Math.sin(t),f=Math.cos(t);return n[0]=f*i+h*a,n[1]=f*r+h*o,n[2]=f*s+h*l,n[3]=f*a-h*i,n[4]=f*o-h*r,n[5]=f*l-h*s,n[6]=c,n[7]=u,n[8]=p,n}function R0(n,e,t){let i=t[0],r=t[1];return n[0]=i*e[0],n[1]=i*e[1],n[2]=i*e[2],n[3]=r*e[3],n[4]=r*e[4],n[5]=r*e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n}function C0(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],p=e[9],h=e[10],f=e[11],g=e[12],v=e[13],m=e[14],d=e[15],S=t*o-i*a,b=t*l-r*a,E=t*c-s*a,R=i*l-r*o,A=i*c-s*o,C=r*c-s*l,x=u*v-p*g,y=u*m-h*g,z=u*d-f*g,w=p*m-h*v,F=p*d-f*v,B=h*d-f*m,I=S*B-b*F+E*w+R*z-A*y+C*x;return I?(I=1/I,n[0]=(o*B-l*F+c*w)*I,n[1]=(l*z-a*B-c*y)*I,n[2]=(a*F-o*z+c*x)*I,n[3]=(r*F-i*B-s*w)*I,n[4]=(t*B-r*z+s*y)*I,n[5]=(i*z-t*F-s*x)*I,n[6]=(v*C-m*A+d*R)*I,n[7]=(m*E-g*C-d*b)*I,n[8]=(g*A-v*E+d*S)*I,n):null}class P0 extends Array{constructor(e=1,t=0,i=0,r=0,s=1,a=0,o=0,l=0,c=1){return super(e,t,i,r,s,a,o,l,c),this}set(e,t,i,r,s,a,o,l,c){return e.length?this.copy(e):(y0(this,e,t,i,r,s,a,o,l,c),this)}translate(e,t=this){return A0(this,t,e),this}rotate(e,t=this){return w0(this,t,e),this}scale(e,t=this){return R0(this,t,e),this}multiply(e,t){return t?Bo(this,e,t):Bo(this,this,e),this}identity(){return b0(this),this}copy(e){return E0(this,e),this}fromMatrix4(e){return M0(this,e),this}fromQuaternion(e){return S0(this,e),this}fromBasis(e,t,i){return this.set(e[0],e[1],e[2],t[0],t[1],t[2],i[0],i[1],i[2]),this}inverse(e=this){return T0(this,e),this}getNormalMatrix(e){return C0(this,e),this}}let D0=0;class L0 extends v0{constructor(e,{geometry:t,program:i,mode:r=e.TRIANGLES,frustumCulled:s=!0,renderOrder:a=0}={}){super(),e.canvas||console.error("gl not passed as first argument to Mesh"),this.gl=e,this.id=D0++,this.geometry=t,this.program=i,this.mode=r,this.frustumCulled=s,this.renderOrder=a,this.modelViewMatrix=new _r,this.normalMatrix=new P0,this.beforeRenderCallbacks=[],this.afterRenderCallbacks=[]}onBeforeRender(e){return this.beforeRenderCallbacks.push(e),this}onAfterRender(e){return this.afterRenderCallbacks.push(e),this}draw({camera:e}={}){e&&(this.program.uniforms.modelMatrix||Object.assign(this.program.uniforms,{modelMatrix:{value:null},viewMatrix:{value:null},modelViewMatrix:{value:null},normalMatrix:{value:null},projectionMatrix:{value:null},cameraPosition:{value:null}}),this.program.uniforms.projectionMatrix.value=e.projectionMatrix,this.program.uniforms.cameraPosition.value=e.worldPosition,this.program.uniforms.viewMatrix.value=e.viewMatrix,this.modelViewMatrix.multiply(e.viewMatrix,this.worldMatrix),this.normalMatrix.getNormalMatrix(this.modelViewMatrix),this.program.uniforms.modelMatrix.value=this.worldMatrix,this.program.uniforms.modelViewMatrix.value=this.modelViewMatrix,this.program.uniforms.normalMatrix.value=this.normalMatrix),this.beforeRenderCallbacks.forEach(i=>i&&i({mesh:this,camera:e}));let t=this.program.cullFace&&this.worldMatrix.determinant()<0;this.program.use({flipFaces:t}),this.geometry.draw({mode:this.mode,program:this.program}),this.afterRenderCallbacks.forEach(i=>i&&i({mesh:this,camera:e}))}}class I0 extends wm{constructor(e,{attributes:t={}}={}){Object.assign(t,{position:{size:2,data:new Float32Array([-1,-1,3,-1,-1,3])},uv:{size:2,data:new Float32Array([0,0,2,0,0,2])}}),super(e,t)}}const zo=n=>{const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return e?[parseInt(e[1],16)/255,parseInt(e[2],16)/255,parseInt(e[3],16)/255]:[1,1,1]},Go=(n,e,t)=>{switch(n){case"top-left":return{anchor:[0,-.2*t],dir:[0,1]};case"top-right":return{anchor:[e,-.2*t],dir:[0,1]};case"left":return{anchor:[-.2*e,.5*t],dir:[1,0]};case"right":return{anchor:[(1+.2)*e,.5*t],dir:[-1,0]};case"bottom-left":return{anchor:[0,(1+.2)*t],dir:[0,-1]};case"bottom-center":return{anchor:[.5*e,(1+.2)*t],dir:[0,-1]};case"bottom-right":return{anchor:[e,(1+.2)*t],dir:[0,-1]};default:return{anchor:[.5*e,-.2*t],dir:[0,1]}}},N0=`
4258
+ `)}function Fm(n){const e=n.length,t=n[0].length;if(t===void 0)return n;const i=e*t;let r=Do[i];r||(Do[i]=r=new Float32Array(i));for(let s=0;s<e;s++)r.set(n[s],s*t);return r}function Um(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function Om(n,e){for(let t=0,i=n.length;t<i;t++)n[t]=e[t]}let as=0;function Io(n){as>100||(console.warn(n),as++,as>100&&console.warn("More than 100 program warnings - stopping logs."))}const os=new Gt;let Bm=1;class zm{constructor({canvas:e=document.createElement("canvas"),width:t=300,height:i=150,dpr:r=1,alpha:s=!1,depth:a=!0,stencil:o=!1,antialias:l=!1,premultipliedAlpha:c=!1,preserveDrawingBuffer:d=!1,powerPreference:p="default",autoClear:h=!0,webgl:f=2}={}){const g={alpha:s,depth:a,stencil:o,antialias:l,premultipliedAlpha:c,preserveDrawingBuffer:d,powerPreference:p};this.dpr=r,this.alpha=s,this.color=!0,this.depth=a,this.stencil=o,this.premultipliedAlpha=c,this.autoClear=h,this.id=Bm++,f===2&&(this.gl=e.getContext("webgl2",g)),this.isWebgl2=!!this.gl,this.gl||(this.gl=e.getContext("webgl",g)),this.gl||console.error("unable to create webgl context"),this.gl.renderer=this,this.setSize(t,i),this.state={},this.state.blendFunc={src:this.gl.ONE,dst:this.gl.ZERO},this.state.blendEquation={modeRGB:this.gl.FUNC_ADD},this.state.cullFace=!1,this.state.frontFace=this.gl.CCW,this.state.depthMask=!0,this.state.depthFunc=this.gl.LEQUAL,this.state.premultiplyAlpha=!1,this.state.flipY=!1,this.state.unpackAlignment=4,this.state.framebuffer=null,this.state.viewport={x:0,y:0,width:null,height:null},this.state.textureUnits=[],this.state.activeTextureUnit=0,this.state.boundBuffer=null,this.state.uniformLocations=new Map,this.state.currentProgram=null,this.extensions={},this.isWebgl2?(this.getExtension("EXT_color_buffer_float"),this.getExtension("OES_texture_float_linear")):(this.getExtension("OES_texture_float"),this.getExtension("OES_texture_float_linear"),this.getExtension("OES_texture_half_float"),this.getExtension("OES_texture_half_float_linear"),this.getExtension("OES_element_index_uint"),this.getExtension("OES_standard_derivatives"),this.getExtension("EXT_sRGB"),this.getExtension("WEBGL_depth_texture"),this.getExtension("WEBGL_draw_buffers")),this.getExtension("WEBGL_compressed_texture_astc"),this.getExtension("EXT_texture_compression_bptc"),this.getExtension("WEBGL_compressed_texture_s3tc"),this.getExtension("WEBGL_compressed_texture_etc1"),this.getExtension("WEBGL_compressed_texture_pvrtc"),this.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),this.vertexAttribDivisor=this.getExtension("ANGLE_instanced_arrays","vertexAttribDivisor","vertexAttribDivisorANGLE"),this.drawArraysInstanced=this.getExtension("ANGLE_instanced_arrays","drawArraysInstanced","drawArraysInstancedANGLE"),this.drawElementsInstanced=this.getExtension("ANGLE_instanced_arrays","drawElementsInstanced","drawElementsInstancedANGLE"),this.createVertexArray=this.getExtension("OES_vertex_array_object","createVertexArray","createVertexArrayOES"),this.bindVertexArray=this.getExtension("OES_vertex_array_object","bindVertexArray","bindVertexArrayOES"),this.deleteVertexArray=this.getExtension("OES_vertex_array_object","deleteVertexArray","deleteVertexArrayOES"),this.drawBuffers=this.getExtension("WEBGL_draw_buffers","drawBuffers","drawBuffersWEBGL"),this.parameters={},this.parameters.maxTextureUnits=this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this.parameters.maxAnisotropy=this.getExtension("EXT_texture_filter_anisotropic")?this.gl.getParameter(this.getExtension("EXT_texture_filter_anisotropic").MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}setSize(e,t){this.width=e,this.height=t,this.gl.canvas.width=e*this.dpr,this.gl.canvas.height=t*this.dpr,this.gl.canvas.style&&Object.assign(this.gl.canvas.style,{width:e+"px",height:t+"px"})}setViewport(e,t,i=0,r=0){this.state.viewport.width===e&&this.state.viewport.height===t||(this.state.viewport.width=e,this.state.viewport.height=t,this.state.viewport.x=i,this.state.viewport.y=r,this.gl.viewport(i,r,e,t))}setScissor(e,t,i=0,r=0){this.gl.scissor(i,r,e,t)}enable(e){this.state[e]!==!0&&(this.gl.enable(e),this.state[e]=!0)}disable(e){this.state[e]!==!1&&(this.gl.disable(e),this.state[e]=!1)}setBlendFunc(e,t,i,r){this.state.blendFunc.src===e&&this.state.blendFunc.dst===t&&this.state.blendFunc.srcAlpha===i&&this.state.blendFunc.dstAlpha===r||(this.state.blendFunc.src=e,this.state.blendFunc.dst=t,this.state.blendFunc.srcAlpha=i,this.state.blendFunc.dstAlpha=r,i!==void 0?this.gl.blendFuncSeparate(e,t,i,r):this.gl.blendFunc(e,t))}setBlendEquation(e,t){e=e||this.gl.FUNC_ADD,!(this.state.blendEquation.modeRGB===e&&this.state.blendEquation.modeAlpha===t)&&(this.state.blendEquation.modeRGB=e,this.state.blendEquation.modeAlpha=t,t!==void 0?this.gl.blendEquationSeparate(e,t):this.gl.blendEquation(e))}setCullFace(e){this.state.cullFace!==e&&(this.state.cullFace=e,this.gl.cullFace(e))}setFrontFace(e){this.state.frontFace!==e&&(this.state.frontFace=e,this.gl.frontFace(e))}setDepthMask(e){this.state.depthMask!==e&&(this.state.depthMask=e,this.gl.depthMask(e))}setDepthFunc(e){this.state.depthFunc!==e&&(this.state.depthFunc=e,this.gl.depthFunc(e))}setStencilMask(e){this.state.stencilMask!==e&&(this.state.stencilMask=e,this.gl.stencilMask(e))}setStencilFunc(e,t,i){this.state.stencilFunc===e&&this.state.stencilRef===t&&this.state.stencilFuncMask===i||(this.state.stencilFunc=e||this.gl.ALWAYS,this.state.stencilRef=t||0,this.state.stencilFuncMask=i||0,this.gl.stencilFunc(e||this.gl.ALWAYS,t||0,i||0))}setStencilOp(e,t,i){this.state.stencilFail===e&&this.state.stencilDepthFail===t&&this.state.stencilDepthPass===i||(this.state.stencilFail=e,this.state.stencilDepthFail=t,this.state.stencilDepthPass=i,this.gl.stencilOp(e,t,i))}activeTexture(e){this.state.activeTextureUnit!==e&&(this.state.activeTextureUnit=e,this.gl.activeTexture(this.gl.TEXTURE0+e))}bindFramebuffer({target:e=this.gl.FRAMEBUFFER,buffer:t=null}={}){this.state.framebuffer!==t&&(this.state.framebuffer=t,this.gl.bindFramebuffer(e,t))}getExtension(e,t,i){return t&&this.gl[t]?this.gl[t].bind(this.gl):(this.extensions[e]||(this.extensions[e]=this.gl.getExtension(e)),t?this.extensions[e]?this.extensions[e][i].bind(this.extensions[e]):null:this.extensions[e])}sortOpaque(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program.id!==t.program.id?e.program.id-t.program.id:e.zDepth!==t.zDepth?e.zDepth-t.zDepth:t.id-e.id}sortTransparent(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.zDepth!==t.zDepth?t.zDepth-e.zDepth:t.id-e.id}sortUI(e,t){return e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program.id!==t.program.id?e.program.id-t.program.id:t.id-e.id}getRenderList({scene:e,camera:t,frustumCull:i,sort:r}){let s=[];if(t&&i&&t.updateFrustum(),e.traverse(a=>{if(!a.visible)return!0;a.draw&&(i&&a.frustumCulled&&t&&!t.frustumIntersectsMesh(a)||s.push(a))}),r){const a=[],o=[],l=[];s.forEach(c=>{c.program.transparent?c.program.depthTest?o.push(c):l.push(c):a.push(c),c.zDepth=0,!(c.renderOrder!==0||!c.program.depthTest||!t)&&(c.worldMatrix.getTranslation(os),os.applyMatrix4(t.projectionViewMatrix),c.zDepth=os.z)}),a.sort(this.sortOpaque),o.sort(this.sortTransparent),l.sort(this.sortUI),s=a.concat(o,l)}return s}render({scene:e,camera:t,target:i=null,update:r=!0,sort:s=!0,frustumCull:a=!0,clear:o}){i===null?(this.bindFramebuffer(),this.setViewport(this.width*this.dpr,this.height*this.dpr)):(this.bindFramebuffer(i),this.setViewport(i.width,i.height)),(o||this.autoClear&&o!==!1)&&(this.depth&&(!i||i.depth)&&(this.enable(this.gl.DEPTH_TEST),this.setDepthMask(!0)),(this.stencil||!i||i.stencil)&&(this.enable(this.gl.STENCIL_TEST),this.setStencilMask(255)),this.gl.clear((this.color?this.gl.COLOR_BUFFER_BIT:0)|(this.depth?this.gl.DEPTH_BUFFER_BIT:0)|(this.stencil?this.gl.STENCIL_BUFFER_BIT:0))),r&&e.updateMatrixWorld(),t&&t.updateMatrixWorld(),this.getRenderList({scene:e,camera:t,frustumCull:a,sort:s}).forEach(c=>{c.draw({camera:t})})}}function Gm(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n}function Vm(n,e,t,i,r){return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n}function km(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=t*t+i*i+r*r+s*s;return a>0&&(a=1/Math.sqrt(a)),n[0]=t*a,n[1]=i*a,n[2]=r*a,n[3]=s*a,n}function Hm(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]*e[3]}function Wm(n){return n[0]=0,n[1]=0,n[2]=0,n[3]=1,n}function Xm(n,e,t){t=t*.5;let i=Math.sin(t);return n[0]=i*e[0],n[1]=i*e[1],n[2]=i*e[2],n[3]=Math.cos(t),n}function No(n,e,t){let i=e[0],r=e[1],s=e[2],a=e[3],o=t[0],l=t[1],c=t[2],d=t[3];return n[0]=i*d+a*o+r*c-s*l,n[1]=r*d+a*l+s*o-i*c,n[2]=s*d+a*c+i*l-r*o,n[3]=a*d-i*o-r*l-s*c,n}function jm(n,e,t){t*=.5;let i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return n[0]=i*l+a*o,n[1]=r*l+s*o,n[2]=s*l-r*o,n[3]=a*l-i*o,n}function qm(n,e,t){t*=.5;let i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return n[0]=i*l-s*o,n[1]=r*l+a*o,n[2]=s*l+i*o,n[3]=a*l-r*o,n}function Ym(n,e,t){t*=.5;let i=e[0],r=e[1],s=e[2],a=e[3],o=Math.sin(t),l=Math.cos(t);return n[0]=i*l+r*o,n[1]=r*l-i*o,n[2]=s*l+a*o,n[3]=a*l-s*o,n}function $m(n,e,t,i){let r=e[0],s=e[1],a=e[2],o=e[3],l=t[0],c=t[1],d=t[2],p=t[3],h,f,g,v,m;return f=r*l+s*c+a*d+o*p,f<0&&(f=-f,l=-l,c=-c,d=-d,p=-p),1-f>1e-6?(h=Math.acos(f),g=Math.sin(h),v=Math.sin((1-i)*h)/g,m=Math.sin(i*h)/g):(v=1-i,m=i),n[0]=v*r+m*l,n[1]=v*s+m*c,n[2]=v*a+m*d,n[3]=v*o+m*p,n}function Zm(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=t*t+i*i+r*r+s*s,o=a?1/a:0;return n[0]=-t*o,n[1]=-i*o,n[2]=-r*o,n[3]=s*o,n}function Km(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n[3]=e[3],n}function Jm(n,e){let t=e[0]+e[4]+e[8],i;if(t>0)i=Math.sqrt(t+1),n[3]=.5*i,i=.5/i,n[0]=(e[5]-e[7])*i,n[1]=(e[6]-e[2])*i,n[2]=(e[1]-e[3])*i;else{let r=0;e[4]>e[0]&&(r=1),e[8]>e[r*3+r]&&(r=2);let s=(r+1)%3,a=(r+2)%3;i=Math.sqrt(e[r*3+r]-e[s*3+s]-e[a*3+a]+1),n[r]=.5*i,i=.5/i,n[3]=(e[s*3+a]-e[a*3+s])*i,n[s]=(e[s*3+r]+e[r*3+s])*i,n[a]=(e[a*3+r]+e[r*3+a])*i}return n}function Qm(n,e,t="YXZ"){let i=Math.sin(e[0]*.5),r=Math.cos(e[0]*.5),s=Math.sin(e[1]*.5),a=Math.cos(e[1]*.5),o=Math.sin(e[2]*.5),l=Math.cos(e[2]*.5);return t==="XYZ"?(n[0]=i*a*l+r*s*o,n[1]=r*s*l-i*a*o,n[2]=r*a*o+i*s*l,n[3]=r*a*l-i*s*o):t==="YXZ"?(n[0]=i*a*l+r*s*o,n[1]=r*s*l-i*a*o,n[2]=r*a*o-i*s*l,n[3]=r*a*l+i*s*o):t==="ZXY"?(n[0]=i*a*l-r*s*o,n[1]=r*s*l+i*a*o,n[2]=r*a*o+i*s*l,n[3]=r*a*l-i*s*o):t==="ZYX"?(n[0]=i*a*l-r*s*o,n[1]=r*s*l+i*a*o,n[2]=r*a*o-i*s*l,n[3]=r*a*l+i*s*o):t==="YZX"?(n[0]=i*a*l+r*s*o,n[1]=r*s*l+i*a*o,n[2]=r*a*o-i*s*l,n[3]=r*a*l-i*s*o):t==="XZY"&&(n[0]=i*a*l-r*s*o,n[1]=r*s*l-i*a*o,n[2]=r*a*o+i*s*l,n[3]=r*a*l+i*s*o),n}const e0=Gm,t0=Vm,n0=Hm,i0=km;class r0 extends Array{constructor(e=0,t=0,i=0,r=1){super(e,t,i,r),this.onChange=()=>{},this._target=this;const s=["0","1","2","3"];return new Proxy(this,{set(a,o){const l=Reflect.set(...arguments);return l&&s.includes(o)&&a.onChange(),l}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}get w(){return this[3]}set x(e){this._target[0]=e,this.onChange()}set y(e){this._target[1]=e,this.onChange()}set z(e){this._target[2]=e,this.onChange()}set w(e){this._target[3]=e,this.onChange()}identity(){return Wm(this._target),this.onChange(),this}set(e,t,i,r){return e.length?this.copy(e):(t0(this._target,e,t,i,r),this.onChange(),this)}rotateX(e){return jm(this._target,this._target,e),this.onChange(),this}rotateY(e){return qm(this._target,this._target,e),this.onChange(),this}rotateZ(e){return Ym(this._target,this._target,e),this.onChange(),this}inverse(e=this._target){return Zm(this._target,e),this.onChange(),this}conjugate(e=this._target){return Km(this._target,e),this.onChange(),this}copy(e){return e0(this._target,e),this.onChange(),this}normalize(e=this._target){return i0(this._target,e),this.onChange(),this}multiply(e,t){return t?No(this._target,e,t):No(this._target,this._target,e),this.onChange(),this}dot(e){return n0(this._target,e)}fromMatrix3(e){return Jm(this._target,e),this.onChange(),this}fromEuler(e,t){return Qm(this._target,e,e.order),t||this.onChange(),this}fromAxisAngle(e,t){return Xm(this._target,e,t),this.onChange(),this}slerp(e,t){return $m(this._target,this._target,e,t),this.onChange(),this}fromArray(e,t=0){return this._target[0]=e[t],this._target[1]=e[t+1],this._target[2]=e[t+2],this._target[3]=e[t+3],this.onChange(),this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e[t+3]=this[3],e}}const s0=1e-6;function a0(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}function o0(n,e,t,i,r,s,a,o,l,c,d,p,h,f,g,v,m){return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n[4]=s,n[5]=a,n[6]=o,n[7]=l,n[8]=c,n[9]=d,n[10]=p,n[11]=h,n[12]=f,n[13]=g,n[14]=v,n[15]=m,n}function l0(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function c0(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],p=e[9],h=e[10],f=e[11],g=e[12],v=e[13],m=e[14],u=e[15],S=t*o-i*a,b=t*l-r*a,E=t*c-s*a,R=i*l-r*o,A=i*c-s*o,C=r*c-s*l,x=d*v-p*g,y=d*m-h*g,z=d*u-f*g,w=p*m-h*v,F=p*u-f*v,B=h*u-f*m,I=S*B-b*F+E*w+R*z-A*y+C*x;return I?(I=1/I,n[0]=(o*B-l*F+c*w)*I,n[1]=(r*F-i*B-s*w)*I,n[2]=(v*C-m*A+u*R)*I,n[3]=(h*A-p*C-f*R)*I,n[4]=(l*z-a*B-c*y)*I,n[5]=(t*B-r*z+s*y)*I,n[6]=(m*E-g*C-u*b)*I,n[7]=(d*C-h*E+f*b)*I,n[8]=(a*F-o*z+c*x)*I,n[9]=(i*z-t*F-s*x)*I,n[10]=(g*A-v*E+u*S)*I,n[11]=(p*E-d*A-f*S)*I,n[12]=(o*y-a*w-l*x)*I,n[13]=(t*w-i*y+r*x)*I,n[14]=(v*b-g*R-m*S)*I,n[15]=(d*R-p*b+h*S)*I,n):null}function Dl(n){let e=n[0],t=n[1],i=n[2],r=n[3],s=n[4],a=n[5],o=n[6],l=n[7],c=n[8],d=n[9],p=n[10],h=n[11],f=n[12],g=n[13],v=n[14],m=n[15],u=e*a-t*s,S=e*o-i*s,b=e*l-r*s,E=t*o-i*a,R=t*l-r*a,A=i*l-r*o,C=c*g-d*f,x=c*v-p*f,y=c*m-h*f,z=d*v-p*g,w=d*m-h*g,F=p*m-h*v;return u*F-S*w+b*z+E*y-R*x+A*C}function Fo(n,e,t){let i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],d=e[7],p=e[8],h=e[9],f=e[10],g=e[11],v=e[12],m=e[13],u=e[14],S=e[15],b=t[0],E=t[1],R=t[2],A=t[3];return n[0]=b*i+E*o+R*p+A*v,n[1]=b*r+E*l+R*h+A*m,n[2]=b*s+E*c+R*f+A*u,n[3]=b*a+E*d+R*g+A*S,b=t[4],E=t[5],R=t[6],A=t[7],n[4]=b*i+E*o+R*p+A*v,n[5]=b*r+E*l+R*h+A*m,n[6]=b*s+E*c+R*f+A*u,n[7]=b*a+E*d+R*g+A*S,b=t[8],E=t[9],R=t[10],A=t[11],n[8]=b*i+E*o+R*p+A*v,n[9]=b*r+E*l+R*h+A*m,n[10]=b*s+E*c+R*f+A*u,n[11]=b*a+E*d+R*g+A*S,b=t[12],E=t[13],R=t[14],A=t[15],n[12]=b*i+E*o+R*p+A*v,n[13]=b*r+E*l+R*h+A*m,n[14]=b*s+E*c+R*f+A*u,n[15]=b*a+E*d+R*g+A*S,n}function h0(n,e,t){let i=t[0],r=t[1],s=t[2],a,o,l,c,d,p,h,f,g,v,m,u;return e===n?(n[12]=e[0]*i+e[4]*r+e[8]*s+e[12],n[13]=e[1]*i+e[5]*r+e[9]*s+e[13],n[14]=e[2]*i+e[6]*r+e[10]*s+e[14],n[15]=e[3]*i+e[7]*r+e[11]*s+e[15]):(a=e[0],o=e[1],l=e[2],c=e[3],d=e[4],p=e[5],h=e[6],f=e[7],g=e[8],v=e[9],m=e[10],u=e[11],n[0]=a,n[1]=o,n[2]=l,n[3]=c,n[4]=d,n[5]=p,n[6]=h,n[7]=f,n[8]=g,n[9]=v,n[10]=m,n[11]=u,n[12]=a*i+d*r+g*s+e[12],n[13]=o*i+p*r+v*s+e[13],n[14]=l*i+h*r+m*s+e[14],n[15]=c*i+f*r+u*s+e[15]),n}function d0(n,e,t){let i=t[0],r=t[1],s=t[2];return n[0]=e[0]*i,n[1]=e[1]*i,n[2]=e[2]*i,n[3]=e[3]*i,n[4]=e[4]*r,n[5]=e[5]*r,n[6]=e[6]*r,n[7]=e[7]*r,n[8]=e[8]*s,n[9]=e[9]*s,n[10]=e[10]*s,n[11]=e[11]*s,n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15],n}function u0(n,e,t,i){let r=i[0],s=i[1],a=i[2],o=Math.hypot(r,s,a),l,c,d,p,h,f,g,v,m,u,S,b,E,R,A,C,x,y,z,w,F,B,I,G;return Math.abs(o)<s0?null:(o=1/o,r*=o,s*=o,a*=o,l=Math.sin(t),c=Math.cos(t),d=1-c,p=e[0],h=e[1],f=e[2],g=e[3],v=e[4],m=e[5],u=e[6],S=e[7],b=e[8],E=e[9],R=e[10],A=e[11],C=r*r*d+c,x=s*r*d+a*l,y=a*r*d-s*l,z=r*s*d-a*l,w=s*s*d+c,F=a*s*d+r*l,B=r*a*d+s*l,I=s*a*d-r*l,G=a*a*d+c,n[0]=p*C+v*x+b*y,n[1]=h*C+m*x+E*y,n[2]=f*C+u*x+R*y,n[3]=g*C+S*x+A*y,n[4]=p*z+v*w+b*F,n[5]=h*z+m*w+E*F,n[6]=f*z+u*w+R*F,n[7]=g*z+S*w+A*F,n[8]=p*B+v*I+b*G,n[9]=h*B+m*I+E*G,n[10]=f*B+u*I+R*G,n[11]=g*B+S*I+A*G,e!==n&&(n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n)}function f0(n,e){return n[0]=e[12],n[1]=e[13],n[2]=e[14],n}function Ll(n,e){let t=e[0],i=e[1],r=e[2],s=e[4],a=e[5],o=e[6],l=e[8],c=e[9],d=e[10];return n[0]=Math.hypot(t,i,r),n[1]=Math.hypot(s,a,o),n[2]=Math.hypot(l,c,d),n}function p0(n){let e=n[0],t=n[1],i=n[2],r=n[4],s=n[5],a=n[6],o=n[8],l=n[9],c=n[10];const d=e*e+t*t+i*i,p=r*r+s*s+a*a,h=o*o+l*l+c*c;return Math.sqrt(Math.max(d,p,h))}const Il=(function(){const n=[1,1,1];return function(e,t){let i=n;Ll(i,t);let r=1/i[0],s=1/i[1],a=1/i[2],o=t[0]*r,l=t[1]*s,c=t[2]*a,d=t[4]*r,p=t[5]*s,h=t[6]*a,f=t[8]*r,g=t[9]*s,v=t[10]*a,m=o+p+v,u=0;return m>0?(u=Math.sqrt(m+1)*2,e[3]=.25*u,e[0]=(h-g)/u,e[1]=(f-c)/u,e[2]=(l-d)/u):o>p&&o>v?(u=Math.sqrt(1+o-p-v)*2,e[3]=(h-g)/u,e[0]=.25*u,e[1]=(l+d)/u,e[2]=(f+c)/u):p>v?(u=Math.sqrt(1+p-o-v)*2,e[3]=(f-c)/u,e[0]=(l+d)/u,e[1]=.25*u,e[2]=(h+g)/u):(u=Math.sqrt(1+v-o-p)*2,e[3]=(l-d)/u,e[0]=(f+c)/u,e[1]=(h+g)/u,e[2]=.25*u),e}})();function m0(n,e,t,i){let r=Ri([n[0],n[1],n[2]]);const s=Ri([n[4],n[5],n[6]]),a=Ri([n[8],n[9],n[10]]);Dl(n)<0&&(r=-r),t[0]=n[12],t[1]=n[13],t[2]=n[14];const l=n.slice(),c=1/r,d=1/s,p=1/a;l[0]*=c,l[1]*=c,l[2]*=c,l[4]*=d,l[5]*=d,l[6]*=d,l[8]*=p,l[9]*=p,l[10]*=p,Il(e,l),i[0]=r,i[1]=s,i[2]=a}function g0(n,e,t,i){const r=n,s=e[0],a=e[1],o=e[2],l=e[3],c=s+s,d=a+a,p=o+o,h=s*c,f=s*d,g=s*p,v=a*d,m=a*p,u=o*p,S=l*c,b=l*d,E=l*p,R=i[0],A=i[1],C=i[2];return r[0]=(1-(v+u))*R,r[1]=(f+E)*R,r[2]=(g-b)*R,r[3]=0,r[4]=(f-E)*A,r[5]=(1-(h+u))*A,r[6]=(m+S)*A,r[7]=0,r[8]=(g+b)*C,r[9]=(m-S)*C,r[10]=(1-(h+v))*C,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function _0(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=t+t,o=i+i,l=r+r,c=t*a,d=i*a,p=i*o,h=r*a,f=r*o,g=r*l,v=s*a,m=s*o,u=s*l;return n[0]=1-p-g,n[1]=d+u,n[2]=h-m,n[3]=0,n[4]=d-u,n[5]=1-c-g,n[6]=f+v,n[7]=0,n[8]=h+m,n[9]=f-v,n[10]=1-c-p,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function x0(n,e,t,i,r){let s=1/Math.tan(e/2),a=1/(i-r);return n[0]=s/t,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=s,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=(r+i)*a,n[11]=-1,n[12]=0,n[13]=0,n[14]=2*r*i*a,n[15]=0,n}function v0(n,e,t,i,r,s,a){let o=1/(e-t),l=1/(i-r),c=1/(s-a);return n[0]=-2*o,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*l,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*c,n[11]=0,n[12]=(e+t)*o,n[13]=(r+i)*l,n[14]=(a+s)*c,n[15]=1,n}function M0(n,e,t,i){let r=e[0],s=e[1],a=e[2],o=i[0],l=i[1],c=i[2],d=r-t[0],p=s-t[1],h=a-t[2],f=d*d+p*p+h*h;f===0?h=1:(f=1/Math.sqrt(f),d*=f,p*=f,h*=f);let g=l*h-c*p,v=c*d-o*h,m=o*p-l*d;return f=g*g+v*v+m*m,f===0&&(c?o+=1e-6:l?c+=1e-6:l+=1e-6,g=l*h-c*p,v=c*d-o*h,m=o*p-l*d,f=g*g+v*v+m*m),f=1/Math.sqrt(f),g*=f,v*=f,m*=f,n[0]=g,n[1]=v,n[2]=m,n[3]=0,n[4]=p*m-h*v,n[5]=h*g-d*m,n[6]=d*v-p*g,n[7]=0,n[8]=d,n[9]=p,n[10]=h,n[11]=0,n[12]=r,n[13]=s,n[14]=a,n[15]=1,n}function Uo(n,e,t){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n[3]=e[3]+t[3],n[4]=e[4]+t[4],n[5]=e[5]+t[5],n[6]=e[6]+t[6],n[7]=e[7]+t[7],n[8]=e[8]+t[8],n[9]=e[9]+t[9],n[10]=e[10]+t[10],n[11]=e[11]+t[11],n[12]=e[12]+t[12],n[13]=e[13]+t[13],n[14]=e[14]+t[14],n[15]=e[15]+t[15],n}function Oo(n,e,t){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n[3]=e[3]-t[3],n[4]=e[4]-t[4],n[5]=e[5]-t[5],n[6]=e[6]-t[6],n[7]=e[7]-t[7],n[8]=e[8]-t[8],n[9]=e[9]-t[9],n[10]=e[10]-t[10],n[11]=e[11]-t[11],n[12]=e[12]-t[12],n[13]=e[13]-t[13],n[14]=e[14]-t[14],n[15]=e[15]-t[15],n}function S0(n,e,t){return n[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n[3]=e[3]*t,n[4]=e[4]*t,n[5]=e[5]*t,n[6]=e[6]*t,n[7]=e[7]*t,n[8]=e[8]*t,n[9]=e[9]*t,n[10]=e[10]*t,n[11]=e[11]*t,n[12]=e[12]*t,n[13]=e[13]*t,n[14]=e[14]*t,n[15]=e[15]*t,n}class _r extends Array{constructor(e=1,t=0,i=0,r=0,s=0,a=1,o=0,l=0,c=0,d=0,p=1,h=0,f=0,g=0,v=0,m=1){return super(e,t,i,r,s,a,o,l,c,d,p,h,f,g,v,m),this}get x(){return this[12]}get y(){return this[13]}get z(){return this[14]}get w(){return this[15]}set x(e){this[12]=e}set y(e){this[13]=e}set z(e){this[14]=e}set w(e){this[15]=e}set(e,t,i,r,s,a,o,l,c,d,p,h,f,g,v,m){return e.length?this.copy(e):(o0(this,e,t,i,r,s,a,o,l,c,d,p,h,f,g,v,m),this)}translate(e,t=this){return h0(this,t,e),this}rotate(e,t,i=this){return u0(this,i,e,t),this}scale(e,t=this){return d0(this,t,typeof e=="number"?[e,e,e]:e),this}add(e,t){return t?Uo(this,e,t):Uo(this,this,e),this}sub(e,t){return t?Oo(this,e,t):Oo(this,this,e),this}multiply(e,t){return e.length?t?Fo(this,e,t):Fo(this,this,e):S0(this,this,e),this}identity(){return l0(this),this}copy(e){return a0(this,e),this}fromPerspective({fov:e,aspect:t,near:i,far:r}={}){return x0(this,e,t,i,r),this}fromOrthogonal({left:e,right:t,bottom:i,top:r,near:s,far:a}){return v0(this,e,t,i,r,s,a),this}fromQuaternion(e){return _0(this,e),this}setPosition(e){return this.x=e[0],this.y=e[1],this.z=e[2],this}inverse(e=this){return c0(this,e),this}compose(e,t,i){return g0(this,e,t,i),this}decompose(e,t,i){return m0(this,e,t,i),this}getRotation(e){return Il(e,this),this}getTranslation(e){return f0(e,this),this}getScaling(e){return Ll(e,this),this}getMaxScaleOnAxis(){return p0(this)}lookAt(e,t,i){return M0(this,e,t,i),this}determinant(){return Dl(this)}fromArray(e,t=0){return this[0]=e[t],this[1]=e[t+1],this[2]=e[t+2],this[3]=e[t+3],this[4]=e[t+4],this[5]=e[t+5],this[6]=e[t+6],this[7]=e[t+7],this[8]=e[t+8],this[9]=e[t+9],this[10]=e[t+10],this[11]=e[t+11],this[12]=e[t+12],this[13]=e[t+13],this[14]=e[t+14],this[15]=e[t+15],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e[t+3]=this[3],e[t+4]=this[4],e[t+5]=this[5],e[t+6]=this[6],e[t+7]=this[7],e[t+8]=this[8],e[t+9]=this[9],e[t+10]=this[10],e[t+11]=this[11],e[t+12]=this[12],e[t+13]=this[13],e[t+14]=this[14],e[t+15]=this[15],e}}function E0(n,e,t="YXZ"){return t==="XYZ"?(n[1]=Math.asin(Math.min(Math.max(e[8],-1),1)),Math.abs(e[8])<.99999?(n[0]=Math.atan2(-e[9],e[10]),n[2]=Math.atan2(-e[4],e[0])):(n[0]=Math.atan2(e[6],e[5]),n[2]=0)):t==="YXZ"?(n[0]=Math.asin(-Math.min(Math.max(e[9],-1),1)),Math.abs(e[9])<.99999?(n[1]=Math.atan2(e[8],e[10]),n[2]=Math.atan2(e[1],e[5])):(n[1]=Math.atan2(-e[2],e[0]),n[2]=0)):t==="ZXY"?(n[0]=Math.asin(Math.min(Math.max(e[6],-1),1)),Math.abs(e[6])<.99999?(n[1]=Math.atan2(-e[2],e[10]),n[2]=Math.atan2(-e[4],e[5])):(n[1]=0,n[2]=Math.atan2(e[1],e[0]))):t==="ZYX"?(n[1]=Math.asin(-Math.min(Math.max(e[2],-1),1)),Math.abs(e[2])<.99999?(n[0]=Math.atan2(e[6],e[10]),n[2]=Math.atan2(e[1],e[0])):(n[0]=0,n[2]=Math.atan2(-e[4],e[5]))):t==="YZX"?(n[2]=Math.asin(Math.min(Math.max(e[1],-1),1)),Math.abs(e[1])<.99999?(n[0]=Math.atan2(-e[9],e[5]),n[1]=Math.atan2(-e[2],e[0])):(n[0]=0,n[1]=Math.atan2(e[8],e[10]))):t==="XZY"&&(n[2]=Math.asin(-Math.min(Math.max(e[4],-1),1)),Math.abs(e[4])<.99999?(n[0]=Math.atan2(e[6],e[5]),n[1]=Math.atan2(e[8],e[0])):(n[0]=Math.atan2(-e[9],e[10]),n[1]=0)),n}const Bo=new _r;class y0 extends Array{constructor(e=0,t=e,i=e,r="YXZ"){super(e,t,i),this.order=r,this.onChange=()=>{},this._target=this;const s=["0","1","2"];return new Proxy(this,{set(a,o){const l=Reflect.set(...arguments);return l&&s.includes(o)&&a.onChange(),l}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(e){this._target[0]=e,this.onChange()}set y(e){this._target[1]=e,this.onChange()}set z(e){this._target[2]=e,this.onChange()}set(e,t=e,i=e){return e.length?this.copy(e):(this._target[0]=e,this._target[1]=t,this._target[2]=i,this.onChange(),this)}copy(e){return this._target[0]=e[0],this._target[1]=e[1],this._target[2]=e[2],this.onChange(),this}reorder(e){return this._target.order=e,this.onChange(),this}fromRotationMatrix(e,t=this.order){return E0(this._target,e,t),this.onChange(),this}fromQuaternion(e,t=this.order,i){return Bo.fromQuaternion(e),this._target.fromRotationMatrix(Bo,t),i||this.onChange(),this}fromArray(e,t=0){return this._target[0]=e[t],this._target[1]=e[t+1],this._target[2]=e[t+2],this}toArray(e=[],t=0){return e[t]=this[0],e[t+1]=this[1],e[t+2]=this[2],e}}class b0{constructor(){this.parent=null,this.children=[],this.visible=!0,this.matrix=new _r,this.worldMatrix=new _r,this.matrixAutoUpdate=!0,this.worldMatrixNeedsUpdate=!1,this.position=new Gt,this.quaternion=new r0,this.scale=new Gt(1),this.rotation=new y0,this.up=new Gt(0,1,0),this.rotation._target.onChange=()=>this.quaternion.fromEuler(this.rotation,!0),this.quaternion._target.onChange=()=>this.rotation.fromQuaternion(this.quaternion,void 0,!0)}setParent(e,t=!0){this.parent&&e!==this.parent&&this.parent.removeChild(this,!1),this.parent=e,t&&e&&e.addChild(this,!1)}addChild(e,t=!0){~this.children.indexOf(e)||this.children.push(e),t&&e.setParent(this,!1)}removeChild(e,t=!0){~this.children.indexOf(e)&&this.children.splice(this.children.indexOf(e),1),t&&e.setParent(null,!1)}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.worldMatrixNeedsUpdate||e)&&(this.parent===null?this.worldMatrix.copy(this.matrix):this.worldMatrix.multiply(this.parent.worldMatrix,this.matrix),this.worldMatrixNeedsUpdate=!1,e=!0);for(let t=0,i=this.children.length;t<i;t++)this.children[t].updateMatrixWorld(e)}updateMatrix(){this.matrix.compose(this.quaternion,this.position,this.scale),this.worldMatrixNeedsUpdate=!0}traverse(e){if(!e(this))for(let t=0,i=this.children.length;t<i;t++)this.children[t].traverse(e)}decompose(){this.matrix.decompose(this.quaternion._target,this.position,this.scale),this.rotation.fromQuaternion(this.quaternion)}lookAt(e,t=!1){t?this.matrix.lookAt(this.position,e,this.up):this.matrix.lookAt(e,this.position,this.up),this.matrix.getRotation(this.quaternion._target),this.rotation.fromQuaternion(this.quaternion)}}function T0(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[4],n[4]=e[5],n[5]=e[6],n[6]=e[8],n[7]=e[9],n[8]=e[10],n}function A0(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=t+t,o=i+i,l=r+r,c=t*a,d=i*a,p=i*o,h=r*a,f=r*o,g=r*l,v=s*a,m=s*o,u=s*l;return n[0]=1-p-g,n[3]=d-u,n[6]=h+m,n[1]=d+u,n[4]=1-c-g,n[7]=f-v,n[2]=h-m,n[5]=f+v,n[8]=1-c-p,n}function w0(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n}function R0(n,e,t,i,r,s,a,o,l,c){return n[0]=e,n[1]=t,n[2]=i,n[3]=r,n[4]=s,n[5]=a,n[6]=o,n[7]=l,n[8]=c,n}function C0(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=1,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n}function P0(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],p=d*a-o*c,h=-d*s+o*l,f=c*s-a*l,g=t*p+i*h+r*f;return g?(g=1/g,n[0]=p*g,n[1]=(-d*i+r*c)*g,n[2]=(o*i-r*a)*g,n[3]=h*g,n[4]=(d*t-r*l)*g,n[5]=(-o*t+r*s)*g,n[6]=f*g,n[7]=(-c*t+i*l)*g,n[8]=(a*t-i*s)*g,n):null}function zo(n,e,t){let i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],d=e[7],p=e[8],h=t[0],f=t[1],g=t[2],v=t[3],m=t[4],u=t[5],S=t[6],b=t[7],E=t[8];return n[0]=h*i+f*a+g*c,n[1]=h*r+f*o+g*d,n[2]=h*s+f*l+g*p,n[3]=v*i+m*a+u*c,n[4]=v*r+m*o+u*d,n[5]=v*s+m*l+u*p,n[6]=S*i+b*a+E*c,n[7]=S*r+b*o+E*d,n[8]=S*s+b*l+E*p,n}function D0(n,e,t){let i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],d=e[7],p=e[8],h=t[0],f=t[1];return n[0]=i,n[1]=r,n[2]=s,n[3]=a,n[4]=o,n[5]=l,n[6]=h*i+f*a+c,n[7]=h*r+f*o+d,n[8]=h*s+f*l+p,n}function L0(n,e,t){let i=e[0],r=e[1],s=e[2],a=e[3],o=e[4],l=e[5],c=e[6],d=e[7],p=e[8],h=Math.sin(t),f=Math.cos(t);return n[0]=f*i+h*a,n[1]=f*r+h*o,n[2]=f*s+h*l,n[3]=f*a-h*i,n[4]=f*o-h*r,n[5]=f*l-h*s,n[6]=c,n[7]=d,n[8]=p,n}function I0(n,e,t){let i=t[0],r=t[1];return n[0]=i*e[0],n[1]=i*e[1],n[2]=i*e[2],n[3]=r*e[3],n[4]=r*e[4],n[5]=r*e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n}function N0(n,e){let t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],p=e[9],h=e[10],f=e[11],g=e[12],v=e[13],m=e[14],u=e[15],S=t*o-i*a,b=t*l-r*a,E=t*c-s*a,R=i*l-r*o,A=i*c-s*o,C=r*c-s*l,x=d*v-p*g,y=d*m-h*g,z=d*u-f*g,w=p*m-h*v,F=p*u-f*v,B=h*u-f*m,I=S*B-b*F+E*w+R*z-A*y+C*x;return I?(I=1/I,n[0]=(o*B-l*F+c*w)*I,n[1]=(l*z-a*B-c*y)*I,n[2]=(a*F-o*z+c*x)*I,n[3]=(r*F-i*B-s*w)*I,n[4]=(t*B-r*z+s*y)*I,n[5]=(i*z-t*F-s*x)*I,n[6]=(v*C-m*A+u*R)*I,n[7]=(m*E-g*C-u*b)*I,n[8]=(g*A-v*E+u*S)*I,n):null}class F0 extends Array{constructor(e=1,t=0,i=0,r=0,s=1,a=0,o=0,l=0,c=1){return super(e,t,i,r,s,a,o,l,c),this}set(e,t,i,r,s,a,o,l,c){return e.length?this.copy(e):(R0(this,e,t,i,r,s,a,o,l,c),this)}translate(e,t=this){return D0(this,t,e),this}rotate(e,t=this){return L0(this,t,e),this}scale(e,t=this){return I0(this,t,e),this}multiply(e,t){return t?zo(this,e,t):zo(this,this,e),this}identity(){return C0(this),this}copy(e){return w0(this,e),this}fromMatrix4(e){return T0(this,e),this}fromQuaternion(e){return A0(this,e),this}fromBasis(e,t,i){return this.set(e[0],e[1],e[2],t[0],t[1],t[2],i[0],i[1],i[2]),this}inverse(e=this){return P0(this,e),this}getNormalMatrix(e){return N0(this,e),this}}let U0=0;class O0 extends b0{constructor(e,{geometry:t,program:i,mode:r=e.TRIANGLES,frustumCulled:s=!0,renderOrder:a=0}={}){super(),e.canvas||console.error("gl not passed as first argument to Mesh"),this.gl=e,this.id=U0++,this.geometry=t,this.program=i,this.mode=r,this.frustumCulled=s,this.renderOrder=a,this.modelViewMatrix=new _r,this.normalMatrix=new F0,this.beforeRenderCallbacks=[],this.afterRenderCallbacks=[]}onBeforeRender(e){return this.beforeRenderCallbacks.push(e),this}onAfterRender(e){return this.afterRenderCallbacks.push(e),this}draw({camera:e}={}){e&&(this.program.uniforms.modelMatrix||Object.assign(this.program.uniforms,{modelMatrix:{value:null},viewMatrix:{value:null},modelViewMatrix:{value:null},normalMatrix:{value:null},projectionMatrix:{value:null},cameraPosition:{value:null}}),this.program.uniforms.projectionMatrix.value=e.projectionMatrix,this.program.uniforms.cameraPosition.value=e.worldPosition,this.program.uniforms.viewMatrix.value=e.viewMatrix,this.modelViewMatrix.multiply(e.viewMatrix,this.worldMatrix),this.normalMatrix.getNormalMatrix(this.modelViewMatrix),this.program.uniforms.modelMatrix.value=this.worldMatrix,this.program.uniforms.modelViewMatrix.value=this.modelViewMatrix,this.program.uniforms.normalMatrix.value=this.normalMatrix),this.beforeRenderCallbacks.forEach(i=>i&&i({mesh:this,camera:e}));let t=this.program.cullFace&&this.worldMatrix.determinant()<0;this.program.use({flipFaces:t}),this.geometry.draw({mode:this.mode,program:this.program}),this.afterRenderCallbacks.forEach(i=>i&&i({mesh:this,camera:e}))}}class B0 extends Lm{constructor(e,{attributes:t={}}={}){Object.assign(t,{position:{size:2,data:new Float32Array([-1,-1,3,-1,-1,3])},uv:{size:2,data:new Float32Array([0,0,2,0,0,2])}}),super(e,t)}}const Go=n=>{const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return e?[parseInt(e[1],16)/255,parseInt(e[2],16)/255,parseInt(e[3],16)/255]:[1,1,1]},Vo=(n,e,t)=>{switch(n){case"top-left":return{anchor:[0,-.2*t],dir:[0,1]};case"top-right":return{anchor:[e,-.2*t],dir:[0,1]};case"left":return{anchor:[-.2*e,.5*t],dir:[1,0]};case"right":return{anchor:[(1+.2)*e,.5*t],dir:[-1,0]};case"bottom-left":return{anchor:[0,(1+.2)*t],dir:[0,-1]};case"bottom-center":return{anchor:[.5*e,(1+.2)*t],dir:[0,-1]};case"bottom-right":return{anchor:[e,(1+.2)*t],dir:[0,-1]};default:return{anchor:[.5*e,-.2*t],dir:[0,1]}}},z0=`
4259
4259
  attribute vec2 position;
4260
4260
  varying vec2 vUv;
4261
4261
  void main() {
4262
4262
  vUv = position * 0.5 + 0.5;
4263
4263
  gl_Position = vec4(position, 0.0, 1.0);
4264
- }`,F0=`precision highp float;
4264
+ }`,G0=`precision highp float;
4265
4265
 
4266
4266
  uniform float iTime;
4267
4267
  uniform vec2 iResolution;
@@ -4353,4 +4353,4 @@ void main() {
4353
4353
  vec4 color;
4354
4354
  mainImage(color, gl_FragCoord.xy);
4355
4355
  gl_FragColor = color;
4356
- }`;function U0({raysOrigin:n="top-center",raysColor:e="#ffffff",raysSpeed:t=1,lightSpread:i=1,rayLength:r=2,pulsating:s=!1,fadeDistance:a=1,saturation:o=1,followMouse:l=!0,mouseInfluence:c=.1,noiseAmount:u=0,distortion:p=0,className:h=""}){const f=De.useRef(null),g=De.useRef(null),v=De.useRef(null),m=De.useRef({x:.5,y:.5}),d=De.useRef({x:.5,y:.5}),S=De.useRef(null),b=De.useRef(null),E=De.useRef(null),[R,A]=De.useState(!1),C=De.useRef(null);return De.useEffect(()=>{if(f.current)return C.current=new IntersectionObserver(x=>{A(x[0].isIntersecting)},{threshold:.1}),C.current.observe(f.current),()=>{C.current&&(C.current.disconnect(),C.current=null)}},[]),De.useEffect(()=>!R||!f.current?void 0:(E.current&&(E.current(),E.current=null),(async()=>{if(!f.current||(await new Promise(U=>setTimeout(U,10)),!f.current))return;const y=new Nm({dpr:Math.min(window.devicePixelRatio,2),alpha:!0});v.current=y;const z=y.gl;for(z.canvas.style.width="100%",z.canvas.style.height="100%";f.current.firstChild;)f.current.removeChild(f.current.firstChild);f.current.appendChild(z.canvas);const w={iTime:{value:0},iResolution:{value:[1,1]},rayPos:{value:[0,0]},rayDir:{value:[0,1]},raysColor:{value:zo(e)},raysSpeed:{value:t},lightSpread:{value:i},rayLength:{value:r},pulsating:{value:s?1:0},fadeDistance:{value:a},saturation:{value:o},mousePos:{value:[.5,.5]},mouseInfluence:{value:c},noiseAmount:{value:u},distortion:{value:p}};g.current=w;const F=new I0(z),B=new Cm(z,{vertex:N0,fragment:F0,uniforms:w}),I=new L0(z,{geometry:F,program:B});b.current=I;const G=()=>{if(!f.current||!y)return;y.dpr=Math.min(window.devicePixelRatio,2);const{clientWidth:U,clientHeight:K}=f.current;y.setSize(U,K);const Y=y.dpr,se=U*Y,ce=K*Y;w.iResolution.value=[se,ce];const{anchor:le,dir:we}=Go(n,se,ce);w.rayPos.value=le,w.rayDir.value=we},V=U=>{if(!(!v.current||!g.current||!b.current)){w.iTime.value=U*.001,l&&c>0&&(d.current.x=d.current.x*.92+m.current.x*(1-.92),d.current.y=d.current.y*.92+m.current.y*(1-.92),w.mousePos.value=[d.current.x,d.current.y]);try{y.render({scene:I}),S.current=requestAnimationFrame(V)}catch(K){console.warn("WebGL rendering error:",K)}}};window.addEventListener("resize",G),G(),S.current=requestAnimationFrame(V),E.current=()=>{if(S.current&&(cancelAnimationFrame(S.current),S.current=null),window.removeEventListener("resize",G),y)try{const U=y.gl.getExtension("WEBGL_lose_context");U&&U.loseContext();const K=y.gl.canvas;K&&K.parentNode&&K.parentNode.removeChild(K)}catch(U){console.warn("Error during WebGL cleanup:",U)}v.current=null,g.current=null,b.current=null}})(),()=>{E.current&&(E.current(),E.current=null)}),[R,n,e,t,i,r,s,a,o,l,c,u,p]),De.useEffect(()=>{if(!g.current||!f.current||!v.current)return;const x=g.current,y=v.current;x.raysColor.value=zo(e),x.raysSpeed.value=t,x.lightSpread.value=i,x.rayLength.value=r,x.pulsating.value=s?1:0,x.fadeDistance.value=a,x.saturation.value=o,x.mouseInfluence.value=c,x.noiseAmount.value=u,x.distortion.value=p;const{clientWidth:z,clientHeight:w}=f.current,F=y.dpr,{anchor:B,dir:I}=Go(n,z*F,w*F);x.rayPos.value=B,x.rayDir.value=I},[e,t,i,n,r,s,a,o,c,u,p]),De.useEffect(()=>{if(!l)return;const x=y=>{if(!f.current)return;const z=f.current.getBoundingClientRect();m.current={x:(y.clientX-z.left)/z.width,y:(y.clientY-z.top)/z.height}};return window.addEventListener("mousemove",x),()=>window.removeEventListener("mousemove",x)},[l]),L.jsx("div",{ref:f,className:`w-full h-full pointer-events-none z-[3] overflow-hidden relative ${h}`.trim()})}function O0({children:n,className:e="",rotateMax:t=10,glareColor:i="rgba(255, 255, 255, 0.05)",...r}){const s=De.useRef(null),a=ba(.5),o=ba(.5),l=Ta(a,{stiffness:220,damping:22}),c=Ta(o,{stiffness:220,damping:22}),u=gi(c,[0,1],[t,-t]),p=gi(l,[0,1],[-t,t]),h=gi(l,[0,.5,1],[.4,0,.4]),f=gi(l,[0,1],["0%","100%"]),g=gi(c,[0,1],["0%","100%"]),v=d=>{if(!s.current)return;const S=s.current.getBoundingClientRect(),b=S.width,E=S.height,R=d.clientX-S.left,A=d.clientY-S.top;a.set(R/b),o.set(A/E)},m=()=>{a.set(.5),o.set(.5)};return L.jsx("div",{ref:s,onPointerMove:v,onPointerLeave:m,className:"w-full h-full select-none",style:{perspective:"1000px"},...r,children:L.jsxs(wi.div,{style:{rotateX:u,rotateY:p,transformStyle:"preserve-3d"},className:na("relative w-full h-full rounded-2xl border border-oai-gray-800 bg-[#080808] p-6 shadow-2xl transition-all duration-200 ease-out",e),children:[L.jsx(wi.div,{className:"pointer-events-none absolute inset-0 rounded-2xl z-20",style:{opacity:h,background:`radial-gradient(circle at ${f} ${g}, ${i}, transparent 65%)`}}),L.jsx("div",{className:"relative z-10 w-full h-full",style:{transform:"translateZ(35px)",transformStyle:"preserve-3d"},children:n})]})})}function B0(n){const e=n.match(/([\d.]+)\s*([\d.]+)%?\s*([\d.]+)%?/);return e?{h:parseFloat(e[1]),s:parseFloat(e[2]),l:parseFloat(e[3])}:{h:247,s:100,l:74}}function z0(n,e){const{h:t,s:i,l:r}=B0(n),s=`${t}deg ${i}% ${r}%`;return[[0,0,0,1,100,!0],[0,0,1,0,60,!0],[0,0,3,0,50,!0],[0,0,6,0,40,!0],[0,0,15,0,30,!0],[0,0,25,2,20,!0],[0,0,50,2,10,!0],[0,0,1,0,60,!1],[0,0,3,0,50,!1],[0,0,6,0,40,!1],[0,0,15,0,30,!1],[0,0,25,2,20,!1],[0,0,50,2,10,!1]].map(([o,l,c,u,p,h])=>{const f=Math.min(p*e,100);return`${h?"inset ":""}${o}px ${l}px ${c}px ${u}px hsl(${s} / ${f}%)`}).join(", ")}function Cl(n){return 1-Math.pow(1-n,3)}function Vo(n){return n*n*n}function ar({start:n=0,end:e=100,duration:t=1e3,delay:i=0,ease:r=Cl,onUpdate:s,onEnd:a}){const o=performance.now()+i;function l(){const c=performance.now()-o,u=Math.min(c/t,1);s(n+(e-n)*r(u)),u<1?requestAnimationFrame(l):a&&a()}setTimeout(()=>requestAnimationFrame(l),i)}const G0=["80% 55%","69% 34%","8% 6%","41% 38%","86% 85%","82% 18%","51% 4%"],V0=[0,1,2,0,1,2,1];function k0(n){const e=[];for(let t=0;t<7;t++){const i=n[Math.min(V0[t],n.length-1)];e.push(`radial-gradient(at ${G0[t]}, ${i} 0px, transparent 50%)`)}return e.push(`linear-gradient(${n[0]} 0 100%)`),e}const H0=({children:n,className:e="",edgeSensitivity:t=30,glowColor:i="247 100 74",backgroundColor:r="#09090b",borderRadius:s=16,glowRadius:a=35,glowIntensity:o=1,coneSpread:l=25,animated:c=!1,colors:u=["#8a7aff","#f472b6","#38bdf8"],fillOpacity:p=.45})=>{const h=De.useRef(null),[f,g]=De.useState(!1),[v,m]=De.useState(45),[d,S]=De.useState(0),[b,E]=De.useState(!1),R=De.useCallback(U=>{const{width:K,height:Y}=U.getBoundingClientRect();return[K/2,Y/2]},[]),A=De.useCallback((U,K,Y)=>{const[se,ce]=R(U),le=K-se,we=Y-ce;let Ye=1/0,He=1/0;return le!==0&&(Ye=se/Math.abs(le)),we!==0&&(He=ce/Math.abs(we)),Math.min(Math.max(1/Math.min(Ye,He),0),1)},[R]),C=De.useCallback((U,K,Y)=>{const[se,ce]=R(U),le=K-se,we=Y-ce;if(le===0&&we===0)return 0;let He=Math.atan2(we,le)*(180/Math.PI)+90;return He<0&&(He+=360),He},[R]),x=De.useCallback(U=>{const K=h.current;if(!K)return;const Y=K.getBoundingClientRect(),se=U.clientX-Y.left,ce=U.clientY-Y.top;S(A(K,se,ce)),m(C(K,se,ce))},[A,C]);De.useEffect(()=>{if(!c)return;const U=110,K=465;E(!0),m(U),ar({duration:500,onUpdate:Y=>S(Y/100)}),ar({ease:Vo,duration:1500,end:50,onUpdate:Y=>{m((K-U)*(Y/100)+U)}}),ar({ease:Cl,delay:1500,duration:2250,start:50,end:100,onUpdate:Y=>{m((K-U)*(Y/100)+U)}}),ar({ease:Vo,delay:2500,duration:1500,start:100,end:0,onUpdate:Y=>S(Y/100),onEnd:()=>E(!1)})},[c]);const y=t+20,z=f||b,w=z?Math.max(0,(d*100-y)/(100-y)):0,F=z?Math.max(0,(d*100-t)/(100-t)):0,B=k0(u),I=B.map(U=>`${U} border-box`),G=B.map(U=>`${U} padding-box`),V=`${v.toFixed(3)}deg`;return L.jsxs("div",{ref:h,onPointerMove:x,onPointerEnter:()=>g(!0),onPointerLeave:()=>g(!1),className:na("relative grid isolate border border-white/10",e),style:{background:r,borderRadius:`${s}px`,transform:"translate3d(0, 0, 0.01px)",boxShadow:"rgba(0,0,0,0.2) 0 4px 12px, rgba(0,0,0,0.3) 0 16px 48px"},children:[L.jsx("div",{className:"absolute inset-0 rounded-[inherit] -z-[1]",style:{border:"1px solid transparent",background:[`linear-gradient(${r} 0 100%) padding-box`,"linear-gradient(rgb(255 255 255 / 0%) 0% 100%) border-box",...I].join(", "),opacity:w,maskImage:`conic-gradient(from ${V} at center, black ${l}%, transparent ${l+15}%, transparent ${100-l-15}%, black ${100-l}%)`,WebkitMaskImage:`conic-gradient(from ${V} at center, black ${l}%, transparent ${l+15}%, transparent ${100-l-15}%, black ${100-l}%)`,transition:z?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"}}),L.jsx("div",{className:"absolute inset-0 rounded-[inherit] -z-[1]",style:{border:"1px solid transparent",background:G.join(", "),maskImage:["linear-gradient(to bottom, black, black)","radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%)","radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%)",`conic-gradient(from ${V} at center, transparent 5%, black 15%, black 85%, transparent 95%)`].join(", "),WebkitMaskImage:["linear-gradient(to bottom, black, black)","radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%)","radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%)",`conic-gradient(from ${V} at center, transparent 5%, black 15%, black 85%, transparent 95%)`].join(", "),maskComposite:"subtract, add, add, add, add, add",WebkitMaskComposite:"source-out, source-over, source-over, source-over, source-over, source-over",opacity:w*p,mixBlendMode:"soft-light",transition:z?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"}}),L.jsx("span",{className:"absolute pointer-events-none z-[1] rounded-[inherit]",style:{inset:`${-a}px`,maskImage:`conic-gradient(from ${V} at center, black 2.5%, transparent 10%, transparent 90%, black 97.5%)`,WebkitMaskImage:`conic-gradient(from ${V} at center, black 2.5%, transparent 10%, transparent 90%, black 97.5%)`,opacity:F,mixBlendMode:"plus-lighter",transition:z?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"},children:L.jsx("span",{className:"absolute rounded-[inherit]",style:{inset:`${a}px`,boxShadow:z0(i,o)}})}),L.jsx("div",{className:"flex flex-col relative overflow-hidden z-[1] w-full h-full",style:{borderRadius:`${Math.max(0,s-1)}px`},children:n})]})};function W0({className:n}){return L.jsx("svg",{viewBox:"0 0 384 512",className:n,fill:"currentColor",children:L.jsx("path",{d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"})})}function X0({className:n}){return L.jsx("svg",{viewBox:"0 0 16 16",className:n,fill:"currentColor",children:L.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})})}function q0({className:n}){return L.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[L.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),L.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function j0({className:n}){return L.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:n,children:L.jsx("polyline",{points:"20 6 9 17 4 12"})})}const ko="https://github.com/mm7894215/TokenTracker",Y0="https://github.com/mm7894215/TokenTracker/releases/latest";function $0({copy:n,signInUrl:e,signUpUrl:t,installCommand:i,installCopied:r,onCopyInstallCommand:s}){const a=Ol(),[o,l]=De.useState(!1);De.useEffect(()=>{const g=()=>l(window.scrollY>10);return window.addEventListener("scroll",g,{passive:!0}),()=>window.removeEventListener("scroll",g)},[]);const c=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),{signedIn:u,loading:p}=Bl(),{openLoginModal:h}=zl(),f=a?{duration:0}:void 0;return L.jsxs("div",{className:"relative min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark",children:[L.jsx("div",{className:"absolute inset-0 z-0 pointer-events-none",style:{height:"100vh"},children:L.jsx(U0,{raysOrigin:"top-center",raysColor:"#b8b3ff",raysSpeed:1,lightSpread:.5,rayLength:3,pulsating:!1,fadeDistance:1,saturation:1,followMouse:!0,mouseInfluence:.1,noiseAmount:0,distortion:0})}),L.jsx("header",{className:na("sticky top-0 z-50 transition-all duration-300",o?"bg-oai-gray-950/80 backdrop-blur-md border-b border-oai-gray-900":"bg-transparent border-b border-transparent"),children:L.jsxs("div",{className:"mx-auto flex h-14 max-w-7xl items-center justify-between px-4 sm:px-6",children:[L.jsxs("div",{className:"flex items-center gap-3 sm:gap-5",children:[L.jsxs(qn,{to:t||"/",className:"flex items-center gap-3 no-underline outline-none rounded focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:ring-offset-oai-gray-950 transition-opacity hover:opacity-80",children:[L.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),L.jsx("span",{className:"text-sm font-semibold tracking-wide text-white uppercase whitespace-nowrap",children:"Token Tracker"})]}),L.jsx("div",{className:"hidden sm:block",children:L.jsx(Wl,{})})]}),L.jsxs("div",{className:"flex items-center justify-end gap-3 sm:gap-5 md:gap-6",children:[L.jsx(qn,{to:"/leaderboard",className:"hidden sm:inline text-sm font-medium text-oai-gray-400 hover:text-white transition-colors duration-200 select-none outline-none focus-visible:underline",children:n("nav.leaderboard")}),!u&&!p&&L.jsx(qn,{to:Aa(),className:"hidden sm:inline text-sm font-medium text-oai-gray-400 hover:text-white transition-colors duration-200 select-none outline-none focus-visible:underline",children:n("landing.v2.cta.primary")}),L.jsx("div",{className:"flex items-center gap-2.5 sm:gap-3.5",children:p?L.jsx("div",{className:"h-8 w-16 animate-pulse rounded-[8px] bg-white/10","aria-hidden":!0}):u?L.jsxs(L.Fragment,{children:[L.jsx(qn,{to:Aa(),className:"inline-flex h-8 items-center justify-center rounded-[8px] bg-white px-3.5 text-xs font-bold text-oai-gray-950 hover:bg-oai-gray-100 transition-all duration-200 active:scale-[0.98] shadow-sm select-none",children:n("landing.v2.cta.primary")}),L.jsx(Gl,{})]}):L.jsx("button",{type:"button",onClick:h,className:"inline-flex h-8 min-w-[80px] items-center justify-center rounded-[8px] bg-white px-3.5 text-xs font-bold text-oai-gray-950 hover:bg-oai-gray-100 transition-all duration-200 active:scale-[0.98] shadow-sm select-none",children:n("header.auth.sign_in_aria")})})]})]})}),L.jsxs("main",{children:[L.jsx("section",{className:"relative py-16 sm:py-24 lg:py-32 overflow-hidden",children:L.jsxs("div",{className:"relative z-10 mx-auto max-w-7xl px-4 sm:px-6 flex flex-col items-center text-center gap-12 sm:gap-20 lg:gap-36",children:[L.jsxs(wi.div,{initial:a?!1:{opacity:0,y:20},animate:{opacity:1,y:0},transition:f||{duration:.5},className:"w-full max-w-3xl relative z-20",children:[L.jsxs("h1",{className:"text-balance text-4xl font-semibold tracking-tight text-white sm:text-6xl lg:text-[4rem] leading-[1.1] sm:leading-tight lg:leading-[1.05]",children:[n("landing.v2.hero.title_line1"),L.jsx("br",{}),L.jsx("span",{className:"bg-gradient-to-b from-white via-oai-gray-200 to-oai-gray-500 bg-clip-text text-transparent font-bold tracking-tight",style:{WebkitTextStroke:"1px rgba(255, 255, 255, 0.15)"},children:n("landing.v2.hero.title_line2")})]}),L.jsx("p",{className:"mt-5 sm:mt-6 text-base sm:text-lg leading-relaxed text-oai-gray-400",children:n("landing.v2.hero.subtagline")}),L.jsxs("div",{className:"mt-8 w-full max-w-lg mx-auto",children:[L.jsxs(wi.div,{whileHover:{scale:1.01,y:-1},transition:{type:"spring",stiffness:400,damping:25},className:"group relative inline-block w-full overflow-hidden rounded-2xl",style:{padding:"1.5px 0"},children:[L.jsx("div",{className:"absolute w-[300%] h-[50%] opacity-70 bottom-[-11px] right-[-250%] rounded-full animate-star-movement-bottom z-0",style:{background:"radial-gradient(circle, #fbdfff, transparent 10%)",animationDuration:"6s"}}),L.jsx("div",{className:"absolute w-[300%] h-[50%] opacity-70 top-[-10px] left-[-250%] rounded-full animate-star-movement-top z-0",style:{background:"radial-gradient(circle, #fbdfff, transparent 10%)",animationDuration:"6s"}}),L.jsxs("div",{className:"relative z-[1] flex items-center justify-between w-full bg-[#0a0a0a] border border-oai-gray-800 rounded-2xl p-1.5 pl-5 shadow-2xl shadow-black/50",children:[L.jsxs("div",{className:"flex items-center gap-3 overflow-hidden",children:[L.jsx("span",{className:"text-oai-gray-600 font-mono select-none","aria-hidden":"true",children:"›"}),L.jsx("code",{className:"font-mono text-sm text-oai-gray-200 overflow-x-auto whitespace-nowrap py-2 [scrollbar-width:none]",children:i?i.split(" ").map((g,v)=>L.jsxs("span",{className:g==="npx"||g==="tokentracker-cli"?"text-white font-medium":g==="--yes"?"text-oai-gray-500":"text-oai-brand-400",children:[g," "]},v)):null})]}),L.jsx("button",{type:"button",onClick:s,"aria-label":n(r?"landing.install.action.copied":"landing.install.action.copy"),className:"shrink-0 flex h-9 w-9 items-center justify-center text-oai-gray-200 bg-oai-gray-900 border border-oai-gray-700 rounded-lg hover:bg-oai-gray-800 hover:text-white active:scale-95 transition-all duration-200 shadow-sm",children:r?L.jsx(j0,{className:"h-4 w-4 text-green-400","aria-hidden":!0}):L.jsx(q0,{className:"h-4 w-4 opacity-70","aria-hidden":!0})})]})]}),L.jsxs("div",{className:"mt-8 flex flex-wrap items-center justify-center gap-x-6 gap-y-4",children:[L.jsxs("a",{href:Y0,target:"_blank",rel:"noopener noreferrer",className:"group flex items-center gap-2 text-sm font-medium text-oai-gray-400 hover:text-white transition-colors",children:[L.jsx("div",{className:"flex items-center justify-center h-8 w-8 rounded-full bg-oai-gray-800 group-hover:bg-oai-gray-700 transition-colors",children:L.jsx(W0,{className:"h-4 w-4 text-oai-gray-400 group-hover:text-white"})}),n("landing.v2.install.mac_cta")]}),L.jsxs("a",{href:ko,target:"_blank",rel:"noopener noreferrer",className:"group flex items-center gap-2 text-sm font-medium text-oai-gray-400 hover:text-white transition-colors",children:[L.jsx("div",{className:"flex items-center justify-center h-8 w-8 rounded-full bg-oai-gray-800 group-hover:bg-oai-gray-700 transition-colors",children:L.jsx(X0,{className:"h-4 w-4 text-oai-gray-400 group-hover:text-white"})}),n("landing.cta.secondary")]})]}),L.jsx("span",{className:"sr-only","aria-live":"polite",children:r?n("landing.install.action.copied"):""})]})]}),L.jsx("div",{className:"relative group w-full",children:L.jsxs(wi.div,{initial:a?!1:{opacity:0,y:24},animate:{opacity:1,y:0},transition:f||{duration:.6,delay:.1},className:"relative w-full",children:[L.jsx("div",{style:{position:"absolute",top:"-256px",left:0,right:0,height:"510px",zIndex:3,pointerEvents:"none"},children:L.jsx(cm,{color:"#8a7aff",wispDensity:2,flowSpeed:.28,verticalSizing:2.2,horizontalSizing:1,fogIntensity:4,fogScale:.1,wispSpeed:18,wispIntensity:6,flowStrength:.12,decay:1.1,falloffStart:.95,fogFallSpeed:.5,horizontalBeamOffset:.22,verticalBeamOffset:0,style:{width:"100%",height:"100%"}})}),L.jsx("div",{className:"relative rounded-xl p-[1px] shadow-2xl bg-gradient-to-b from-[rgba(138,122,255,0.6)] via-[rgba(138,122,255,0.15)] to-[rgba(138,122,255,0.05)]",style:{position:"relative",zIndex:10,boxShadow:"0 20px 60px -10px rgba(138,122,255,0.15), 0 4px 20px rgba(0,0,0,0.4)"},children:L.jsxs("div",{className:"relative rounded-[11px] overflow-hidden bg-oai-gray-950",children:[L.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"180px",background:"linear-gradient(to bottom, rgba(138,122,255,0.35) 0%, rgba(138,122,255,0.12) 40%, transparent 100%)",mixBlendMode:"screen",zIndex:20,pointerEvents:"none"}}),L.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"1px",background:"linear-gradient(90deg, transparent 0%, rgba(138,122,255,0.9) 30%, rgba(180,168,255,1) 50%, rgba(138,122,255,0.9) 70%, transparent 100%)",zIndex:25,pointerEvents:"none"}}),L.jsx("img",{src:"/dashboard-dark.png",alt:n("landing.screenshot.alt"),className:"block h-auto w-full object-cover",style:{position:"relative",zIndex:10},loading:"eager",decoding:"async"})]})})]})})]})}),L.jsx("section",{className:"border-y border-oai-gray-900 bg-oai-gray-950/50 py-12 lg:py-16",children:L.jsx("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:L.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-10",children:[L.jsx("p",{className:"text-sm font-semibold uppercase tracking-wider text-oai-gray-400 shrink-0 md:max-w-[16rem]",children:n("landing.v2.models.title")}),L.jsx("div",{className:"flex justify-center md:justify-end",children:L.jsx(Xl,{logos:ql,columnCount:6})})]})})}),L.jsx("section",{className:"border-t border-oai-gray-900 py-14 sm:py-20 lg:py-32 relative bg-oai-gray-950",children:L.jsx("div",{className:"mx-auto max-w-6xl px-4 sm:px-6 relative z-10",children:L.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-10 sm:gap-12 lg:gap-8 items-start",children:[L.jsxs("div",{className:"lg:col-span-5 space-y-6 text-left",children:[L.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full border border-oai-gray-800 bg-[#080808] text-[10px] font-bold tracking-widest uppercase text-oai-gray-400",children:[L.jsxs("span",{className:"relative flex h-2 w-2",children:[L.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-oai-brand-500 opacity-75"}),L.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-oai-brand-500"})]}),n("landing.v2.leaderboard.kicker")]}),L.jsx("h2",{className:"text-3xl font-semibold tracking-tight text-white sm:text-4xl text-balance leading-tight",children:n("landing.v2.leaderboard.title")}),L.jsx("p",{className:"text-base leading-relaxed text-oai-gray-400",children:n("landing.v2.leaderboard.subtitle")}),L.jsx("div",{className:"pt-4",children:L.jsx(qn,{to:"/leaderboard",className:"inline-flex h-9 items-center justify-center rounded-[8px] bg-white px-6 text-xs font-bold text-oai-gray-950 hover:bg-oai-gray-100 transition-all duration-200 shadow-sm active:scale-[0.98] select-none whitespace-nowrap",children:n("landing.v2.leaderboard.view_more")})})]}),L.jsx("div",{className:"lg:col-span-7 w-full",children:L.jsx(O0,{rotateMax:4,className:"w-full",children:L.jsxs(H0,{edgeSensitivity:30,glowColor:"247 100 74",backgroundColor:"#09090b",borderRadius:16,glowRadius:35,glowIntensity:1,coneSpread:25,animated:!1,colors:["#8a7aff","#f472b6","#38bdf8"],className:"w-full",children:[L.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 border-b border-oai-gray-800/80 bg-white/[0.025] backdrop-blur-xs text-[10px] tracking-widest text-oai-gray-500 font-bold uppercase select-none",children:[L.jsx("span",{children:"Community Rankings (Global)"}),L.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-oai-brand-400",children:[L.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-oai-brand-500 animate-pulse"}),"Realtime"]})]}),L.jsxs("div",{className:"divide-y divide-oai-gray-800/60",children:[L.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-4 hover:bg-white/[0.02] transition-colors group",children:[L.jsxs("div",{className:"flex items-center gap-3.5 min-w-0",children:[L.jsx("span",{className:"font-mono text-xs font-bold text-yellow-500 w-4",children:"01"}),L.jsx("span",{className:"text-oai-gray-700 font-mono text-xs select-none",children:"›"}),L.jsx("span",{className:"font-bold text-white text-sm tracking-wide truncate",children:"VOLT"}),L.jsx("span",{className:"text-[9px] font-bold tracking-widest px-1.5 py-0.5 rounded border border-oai-gray-800 bg-oai-gray-950 text-oai-gray-500 font-mono scale-90",children:"CHAMP"})]}),L.jsxs("div",{className:"flex items-center gap-6 shrink-0",children:[L.jsx("div",{className:"hidden sm:block w-16 h-[2px] bg-oai-gray-950 rounded-full overflow-hidden",children:L.jsx("div",{className:"h-full bg-yellow-500 w-[98.4%]"})}),L.jsxs("div",{className:"text-right",children:[L.jsx("div",{className:"text-sm font-semibold text-white font-mono leading-none",children:"1,420,850"}),L.jsx("div",{className:"text-[10px] text-yellow-500 font-semibold font-mono mt-1",children:"98.4% Eff."})]})]})]}),L.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-4 hover:bg-white/[0.02] transition-colors group",children:[L.jsxs("div",{className:"flex items-center gap-3.5 min-w-0",children:[L.jsx("span",{className:"font-mono text-xs font-bold text-oai-gray-500 w-4",children:"02"}),L.jsx("span",{className:"text-oai-gray-700 font-mono text-xs select-none",children:"›"}),L.jsx("span",{className:"font-semibold text-oai-gray-200 text-sm tracking-wide truncate",children:"ALEX"})]}),L.jsxs("div",{className:"flex items-center gap-6 shrink-0",children:[L.jsx("div",{className:"hidden sm:block w-16 h-[2px] bg-oai-gray-950 rounded-full overflow-hidden",children:L.jsx("div",{className:"h-full bg-oai-gray-600 w-[92.1%]"})}),L.jsxs("div",{className:"text-right",children:[L.jsx("div",{className:"text-sm font-medium text-oai-gray-300 font-mono leading-none",children:"924,110"}),L.jsx("div",{className:"text-[10px] text-oai-gray-400 font-medium font-mono mt-1",children:"92.1% Eff."})]})]})]}),L.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-4 hover:bg-white/[0.02] transition-colors group",children:[L.jsxs("div",{className:"flex items-center gap-3.5 min-w-0",children:[L.jsx("span",{className:"font-mono text-xs font-bold text-oai-gray-500 w-4",children:"03"}),L.jsx("span",{className:"text-oai-gray-700 font-mono text-xs select-none",children:"›"}),L.jsx("span",{className:"font-semibold text-oai-gray-200 text-sm tracking-wide truncate",children:"CHARLIE"})]}),L.jsxs("div",{className:"flex items-center gap-6 shrink-0",children:[L.jsx("div",{className:"hidden sm:block w-16 h-[2px] bg-oai-gray-950 rounded-full overflow-hidden",children:L.jsx("div",{className:"h-full bg-oai-gray-600 w-[89.5%]"})}),L.jsxs("div",{className:"text-right",children:[L.jsx("div",{className:"text-sm font-medium text-oai-gray-300 font-mono leading-none",children:"740,560"}),L.jsx("div",{className:"text-[10px] text-oai-gray-400 font-medium font-mono mt-1",children:"89.5% Eff."})]})]})]})]}),L.jsxs("div",{className:"px-4 sm:px-5 py-2.5 border-t border-oai-gray-800/80 bg-black/[0.15] flex items-center justify-between text-[9px] font-mono tracking-widest text-oai-gray-600 select-none",children:[L.jsx("span",{children:"SYSTEM: // LEADERBOARD_PREVIEW_FEED"}),L.jsx("span",{children:"42 DAY ACTIVE STREAK"})]})]})})})]})})}),L.jsx("section",{className:"py-14 sm:py-20 lg:py-32 border-t border-oai-gray-900/60 bg-[#0c0c0e]",children:L.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6 grid grid-cols-1 lg:grid-cols-12 gap-10 sm:gap-12 lg:gap-16 items-start",children:[L.jsxs("div",{className:"lg:col-span-5 max-w-md text-left",children:[L.jsx("p",{className:"text-xs font-bold tracking-widest uppercase text-oai-brand-500",children:n("landing.v2.compare.kicker")}),L.jsx("h2",{className:"mt-4 text-3xl font-semibold tracking-tight text-white sm:text-4xl text-balance leading-tight",children:n("landing.v2.compare.title")}),L.jsx("p",{className:"mt-6 text-sm leading-relaxed text-oai-gray-400",children:n("landing.v2.compare.subtitle")})]}),L.jsxs("div",{className:"lg:col-span-7 grid grid-cols-1 sm:grid-cols-2 gap-x-8 sm:gap-x-12 gap-y-8 sm:gap-y-10 w-full",children:[L.jsxs("div",{className:"space-y-5",children:[L.jsx("div",{className:"border-t border-oai-gray-800/80 pt-4",children:L.jsxs("h3",{className:"text-xs font-mono font-bold tracking-widest text-white flex items-center gap-2 select-none",children:[L.jsx("span",{className:"text-oai-brand-400",children:"[+]"}),n("landing.v2.compare.with.title")]})}),L.jsxs("ul",{className:"space-y-4 mt-5 text-xs font-mono text-oai-gray-300",children:[L.jsxs("li",{className:"flex gap-2.5 items-start",children:[L.jsx("span",{className:"text-oai-brand-400 shrink-0 font-bold select-none",children:"+"}),L.jsx("span",{className:"leading-relaxed",children:n("landing.v2.compare.with.p1")})]}),L.jsxs("li",{className:"flex gap-2.5 items-start",children:[L.jsx("span",{className:"text-oai-brand-400 shrink-0 font-bold select-none",children:"+"}),L.jsx("span",{className:"leading-relaxed",children:n("landing.v2.compare.with.p2")})]}),L.jsxs("li",{className:"flex gap-2.5 items-start",children:[L.jsx("span",{className:"text-oai-brand-400 shrink-0 font-bold select-none",children:"+"}),L.jsx("span",{className:"leading-relaxed",children:n("landing.v2.compare.with.p3")})]}),L.jsxs("li",{className:"flex gap-2.5 items-start",children:[L.jsx("span",{className:"text-oai-brand-400 shrink-0 font-bold select-none",children:"+"}),L.jsx("span",{className:"leading-relaxed",children:n("landing.v2.compare.with.p4")})]})]})]}),L.jsxs("div",{className:"space-y-5",children:[L.jsx("div",{className:"border-t border-oai-gray-800/80 pt-4",children:L.jsxs("h3",{className:"text-xs font-mono font-bold tracking-widest text-oai-gray-500 flex items-center gap-2 select-none",children:[L.jsx("span",{className:"text-oai-gray-600",children:"[-]"}),n("landing.v2.compare.without.title")]})}),L.jsxs("ul",{className:"space-y-4 mt-5 text-xs font-mono text-oai-gray-500",children:[L.jsxs("li",{className:"flex gap-2.5 items-start",children:[L.jsx("span",{className:"text-oai-gray-600 shrink-0 font-bold select-none",children:"-"}),L.jsx("span",{className:"leading-relaxed text-oai-gray-400",children:n("landing.v2.compare.without.p1")})]}),L.jsxs("li",{className:"flex gap-2.5 items-start",children:[L.jsx("span",{className:"text-oai-gray-600 shrink-0 font-bold select-none",children:"-"}),L.jsx("span",{className:"leading-relaxed text-oai-gray-400",children:n("landing.v2.compare.without.p2")})]}),L.jsxs("li",{className:"flex gap-2.5 items-start",children:[L.jsx("span",{className:"text-oai-gray-600 shrink-0 font-bold select-none",children:"-"}),L.jsx("span",{className:"leading-relaxed text-oai-gray-400",children:n("landing.v2.compare.without.p3")})]}),L.jsxs("li",{className:"flex gap-2.5 items-start",children:[L.jsx("span",{className:"text-oai-gray-600 shrink-0 font-bold select-none",children:"-"}),L.jsx("span",{className:"leading-relaxed text-oai-gray-400",children:n("landing.v2.compare.without.p4")})]})]})]})]})]})})]}),L.jsx("footer",{className:"border-t border-oai-gray-900 bg-oai-gray-950 py-12",children:L.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col items-center justify-between gap-6 px-4 sm:px-6 text-sm text-oai-gray-400 sm:flex-row",children:[L.jsx("p",{children:n("landing.v2.footer.line")}),L.jsxs("div",{className:"flex items-center gap-6",children:[L.jsx("a",{href:Vl,className:"font-medium text-oai-gray-400 hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:n("landing.v2.nav.status")}),L.jsx("a",{href:ko,className:"font-medium text-oai-gray-400 hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:n("landing.v2.nav.github")}),c&&L.jsxs(qn,{to:e,className:"font-medium text-oai-brand-500 hover:text-oai-brand-400 transition-colors",children:[n("landing.cta.primary")," →"]})]})]})})]})}function Z0({prefersReducedMotion:n,screenshotMode:e}){return!(e||n)}function K0(){return De.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function J0(n=0,e=!0){const[t,i]=De.useState(()=>!e);return De.useEffect(()=>{if(!e){i(!0);return}let r=null,s=null;const a=()=>i(!0);return typeof window<"u"&&"requestIdleCallback"in window?(s=window.requestIdleCallback(a,{timeout:n||200}),()=>{typeof window.cancelIdleCallback=="function"&&s!=null&&window.cancelIdleCallback(s)}):(r=window.setTimeout(a,n),()=>{r!=null&&window.clearTimeout(r)})},[n,e]),t}function ig({signInUrl:n,signUpUrl:e}){const t=Ht("landing.handle.special"),i=Ht("landing.handle.default");Ht("landing.nav.login"),Ht("landing.nav.signup");const[r,s]=De.useState(i),a=K0(),o=De.useMemo(()=>typeof window>"u"?!1:kl(window.location.search),[]),l=Z0({prefersReducedMotion:a,screenshotMode:o});J0(250,l);const c="tokentracker.dashboard.from_landing.v1";De.useEffect(()=>{if(!(typeof window>"u"))try{window.sessionStorage.setItem(c,"1")}catch{}},[c]),De.useMemo(()=>Ht("landing.handle.placeholder",{handle:t}),[t]),De.useMemo(()=>{const g=r===t?Ht("landing.rank.singularity"):Ht("landing.rank.unranked");return Ht("landing.rank.expectation",{rank:g})},[r,t]);const u=Ht("landing.install.command"),[p,h]=De.useState(!1),f=async()=>{await Hl(u)&&(h(!0),window.setTimeout(()=>h(!1),2e3))};return L.jsx($0,{copy:Ht,reduceMotion:a,signInUrl:n,signUpUrl:e,installCommand:u,installCopied:p,onCopyInstallCommand:f})}export{ig as LandingPage};
4356
+ }`;function V0({raysOrigin:n="top-center",raysColor:e="#ffffff",raysSpeed:t=1,lightSpread:i=1,rayLength:r=2,pulsating:s=!1,fadeDistance:a=1,saturation:o=1,followMouse:l=!0,mouseInfluence:c=.1,noiseAmount:d=0,distortion:p=0,className:h=""}){const f=Pe.useRef(null),g=Pe.useRef(null),v=Pe.useRef(null),m=Pe.useRef({x:.5,y:.5}),u=Pe.useRef({x:.5,y:.5}),S=Pe.useRef(null),b=Pe.useRef(null),E=Pe.useRef(null),[R,A]=Pe.useState(!1),C=Pe.useRef(null);return Pe.useEffect(()=>{if(f.current)return C.current=new IntersectionObserver(x=>{A(x[0].isIntersecting)},{threshold:.1}),C.current.observe(f.current),()=>{C.current&&(C.current.disconnect(),C.current=null)}},[]),Pe.useEffect(()=>!R||!f.current?void 0:(E.current&&(E.current(),E.current=null),(async()=>{if(!f.current||(await new Promise(U=>setTimeout(U,10)),!f.current))return;const y=new zm({dpr:Math.min(window.devicePixelRatio,2),alpha:!0});v.current=y;const z=y.gl;for(z.canvas.style.width="100%",z.canvas.style.height="100%";f.current.firstChild;)f.current.removeChild(f.current.firstChild);f.current.appendChild(z.canvas);const w={iTime:{value:0},iResolution:{value:[1,1]},rayPos:{value:[0,0]},rayDir:{value:[0,1]},raysColor:{value:Go(e)},raysSpeed:{value:t},lightSpread:{value:i},rayLength:{value:r},pulsating:{value:s?1:0},fadeDistance:{value:a},saturation:{value:o},mousePos:{value:[.5,.5]},mouseInfluence:{value:c},noiseAmount:{value:d},distortion:{value:p}};g.current=w;const F=new B0(z),B=new Nm(z,{vertex:z0,fragment:G0,uniforms:w}),I=new O0(z,{geometry:F,program:B});b.current=I;const G=()=>{if(!f.current||!y)return;y.dpr=Math.min(window.devicePixelRatio,2);const{clientWidth:U,clientHeight:K}=f.current;y.setSize(U,K);const Y=y.dpr,se=U*Y,ce=K*Y;w.iResolution.value=[se,ce];const{anchor:le,dir:we}=Vo(n,se,ce);w.rayPos.value=le,w.rayDir.value=we},V=U=>{if(!(!v.current||!g.current||!b.current)){w.iTime.value=U*.001,l&&c>0&&(u.current.x=u.current.x*.92+m.current.x*(1-.92),u.current.y=u.current.y*.92+m.current.y*(1-.92),w.mousePos.value=[u.current.x,u.current.y]);try{y.render({scene:I}),S.current=requestAnimationFrame(V)}catch(K){console.warn("WebGL rendering error:",K)}}};window.addEventListener("resize",G),G(),S.current=requestAnimationFrame(V),E.current=()=>{if(S.current&&(cancelAnimationFrame(S.current),S.current=null),window.removeEventListener("resize",G),y)try{const U=y.gl.getExtension("WEBGL_lose_context");U&&U.loseContext();const K=y.gl.canvas;K&&K.parentNode&&K.parentNode.removeChild(K)}catch(U){console.warn("Error during WebGL cleanup:",U)}v.current=null,g.current=null,b.current=null}})(),()=>{E.current&&(E.current(),E.current=null)}),[R,n,e,t,i,r,s,a,o,l,c,d,p]),Pe.useEffect(()=>{if(!g.current||!f.current||!v.current)return;const x=g.current,y=v.current;x.raysColor.value=Go(e),x.raysSpeed.value=t,x.lightSpread.value=i,x.rayLength.value=r,x.pulsating.value=s?1:0,x.fadeDistance.value=a,x.saturation.value=o,x.mouseInfluence.value=c,x.noiseAmount.value=d,x.distortion.value=p;const{clientWidth:z,clientHeight:w}=f.current,F=y.dpr,{anchor:B,dir:I}=Vo(n,z*F,w*F);x.rayPos.value=B,x.rayDir.value=I},[e,t,i,n,r,s,a,o,c,d,p]),Pe.useEffect(()=>{if(!l)return;const x=y=>{if(!f.current)return;const z=f.current.getBoundingClientRect();m.current={x:(y.clientX-z.left)/z.width,y:(y.clientY-z.top)/z.height}};return window.addEventListener("mousemove",x),()=>window.removeEventListener("mousemove",x)},[l]),D.jsx("div",{ref:f,className:`w-full h-full pointer-events-none z-[3] overflow-hidden relative ${h}`.trim()})}function k0({children:n,className:e="",rotateMax:t=10,glareColor:i="rgba(255, 255, 255, 0.05)",...r}){const s=Pe.useRef(null),a=Ta(.5),o=Ta(.5),l=Aa(a,{stiffness:220,damping:22}),c=Aa(o,{stiffness:220,damping:22}),d=gi(c,[0,1],[t,-t]),p=gi(l,[0,1],[-t,t]),h=gi(l,[0,.5,1],[.4,0,.4]),f=gi(l,[0,1],["0%","100%"]),g=gi(c,[0,1],["0%","100%"]),v=u=>{if(!s.current)return;const S=s.current.getBoundingClientRect(),b=S.width,E=S.height,R=u.clientX-S.left,A=u.clientY-S.top;a.set(R/b),o.set(A/E)},m=()=>{a.set(.5),o.set(.5)};return D.jsx("div",{ref:s,onPointerMove:v,onPointerLeave:m,className:"w-full h-full select-none",style:{perspective:"1000px"},...r,children:D.jsxs(wi.div,{style:{rotateX:d,rotateY:p,transformStyle:"preserve-3d"},className:na("relative w-full h-full rounded-2xl border border-oai-gray-800 bg-[#080808] p-6 shadow-2xl transition-all duration-200 ease-out",e),children:[D.jsx(wi.div,{className:"pointer-events-none absolute inset-0 rounded-2xl z-20",style:{opacity:h,background:`radial-gradient(circle at ${f} ${g}, ${i}, transparent 65%)`}}),D.jsx("div",{className:"relative z-10 w-full h-full",style:{transform:"translateZ(35px)",transformStyle:"preserve-3d"},children:n})]})})}function H0(n){const e=n.match(/([\d.]+)\s*([\d.]+)%?\s*([\d.]+)%?/);return e?{h:parseFloat(e[1]),s:parseFloat(e[2]),l:parseFloat(e[3])}:{h:247,s:100,l:74}}function W0(n,e){const{h:t,s:i,l:r}=H0(n),s=`${t}deg ${i}% ${r}%`;return[[0,0,0,1,100,!0],[0,0,1,0,60,!0],[0,0,3,0,50,!0],[0,0,6,0,40,!0],[0,0,15,0,30,!0],[0,0,25,2,20,!0],[0,0,50,2,10,!0],[0,0,1,0,60,!1],[0,0,3,0,50,!1],[0,0,6,0,40,!1],[0,0,15,0,30,!1],[0,0,25,2,20,!1],[0,0,50,2,10,!1]].map(([o,l,c,d,p,h])=>{const f=Math.min(p*e,100);return`${h?"inset ":""}${o}px ${l}px ${c}px ${d}px hsl(${s} / ${f}%)`}).join(", ")}function Nl(n){return 1-Math.pow(1-n,3)}function ko(n){return n*n*n}function ar({start:n=0,end:e=100,duration:t=1e3,delay:i=0,ease:r=Nl,onUpdate:s,onEnd:a}){const o=performance.now()+i;function l(){const c=performance.now()-o,d=Math.min(c/t,1);s(n+(e-n)*r(d)),d<1?requestAnimationFrame(l):a&&a()}setTimeout(()=>requestAnimationFrame(l),i)}const X0=["80% 55%","69% 34%","8% 6%","41% 38%","86% 85%","82% 18%","51% 4%"],j0=[0,1,2,0,1,2,1];function q0(n){const e=[];for(let t=0;t<7;t++){const i=n[Math.min(j0[t],n.length-1)];e.push(`radial-gradient(at ${X0[t]}, ${i} 0px, transparent 50%)`)}return e.push(`linear-gradient(${n[0]} 0 100%)`),e}const Y0=({children:n,className:e="",edgeSensitivity:t=30,glowColor:i="247 100 74",backgroundColor:r="#09090b",borderRadius:s=16,glowRadius:a=35,glowIntensity:o=1,coneSpread:l=25,animated:c=!1,colors:d=["#8a7aff","#f472b6","#38bdf8"],fillOpacity:p=.45})=>{const h=Pe.useRef(null),[f,g]=Pe.useState(!1),[v,m]=Pe.useState(45),[u,S]=Pe.useState(0),[b,E]=Pe.useState(!1),R=Pe.useCallback(U=>{const{width:K,height:Y}=U.getBoundingClientRect();return[K/2,Y/2]},[]),A=Pe.useCallback((U,K,Y)=>{const[se,ce]=R(U),le=K-se,we=Y-ce;let Ye=1/0,He=1/0;return le!==0&&(Ye=se/Math.abs(le)),we!==0&&(He=ce/Math.abs(we)),Math.min(Math.max(1/Math.min(Ye,He),0),1)},[R]),C=Pe.useCallback((U,K,Y)=>{const[se,ce]=R(U),le=K-se,we=Y-ce;if(le===0&&we===0)return 0;let He=Math.atan2(we,le)*(180/Math.PI)+90;return He<0&&(He+=360),He},[R]),x=Pe.useCallback(U=>{const K=h.current;if(!K)return;const Y=K.getBoundingClientRect(),se=U.clientX-Y.left,ce=U.clientY-Y.top;S(A(K,se,ce)),m(C(K,se,ce))},[A,C]);Pe.useEffect(()=>{if(!c)return;const U=110,K=465;E(!0),m(U),ar({duration:500,onUpdate:Y=>S(Y/100)}),ar({ease:ko,duration:1500,end:50,onUpdate:Y=>{m((K-U)*(Y/100)+U)}}),ar({ease:Nl,delay:1500,duration:2250,start:50,end:100,onUpdate:Y=>{m((K-U)*(Y/100)+U)}}),ar({ease:ko,delay:2500,duration:1500,start:100,end:0,onUpdate:Y=>S(Y/100),onEnd:()=>E(!1)})},[c]);const y=t+20,z=f||b,w=z?Math.max(0,(u*100-y)/(100-y)):0,F=z?Math.max(0,(u*100-t)/(100-t)):0,B=q0(d),I=B.map(U=>`${U} border-box`),G=B.map(U=>`${U} padding-box`),V=`${v.toFixed(3)}deg`;return D.jsxs("div",{ref:h,onPointerMove:x,onPointerEnter:()=>g(!0),onPointerLeave:()=>g(!1),className:na("relative grid isolate border border-white/10",e),style:{background:r,borderRadius:`${s}px`,transform:"translate3d(0, 0, 0.01px)",boxShadow:"rgba(0,0,0,0.2) 0 4px 12px, rgba(0,0,0,0.3) 0 16px 48px"},children:[D.jsx("div",{className:"absolute inset-0 rounded-[inherit] -z-[1]",style:{border:"1px solid transparent",background:[`linear-gradient(${r} 0 100%) padding-box`,"linear-gradient(rgb(255 255 255 / 0%) 0% 100%) border-box",...I].join(", "),opacity:w,maskImage:`conic-gradient(from ${V} at center, black ${l}%, transparent ${l+15}%, transparent ${100-l-15}%, black ${100-l}%)`,WebkitMaskImage:`conic-gradient(from ${V} at center, black ${l}%, transparent ${l+15}%, transparent ${100-l-15}%, black ${100-l}%)`,transition:z?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"}}),D.jsx("div",{className:"absolute inset-0 rounded-[inherit] -z-[1]",style:{border:"1px solid transparent",background:G.join(", "),maskImage:["linear-gradient(to bottom, black, black)","radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%)","radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%)",`conic-gradient(from ${V} at center, transparent 5%, black 15%, black 85%, transparent 95%)`].join(", "),WebkitMaskImage:["linear-gradient(to bottom, black, black)","radial-gradient(ellipse at 50% 50%, black 40%, transparent 65%)","radial-gradient(ellipse at 66% 66%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 66% 33%, black 5%, transparent 40%)","radial-gradient(ellipse at 33% 66%, black 5%, transparent 40%)",`conic-gradient(from ${V} at center, transparent 5%, black 15%, black 85%, transparent 95%)`].join(", "),maskComposite:"subtract, add, add, add, add, add",WebkitMaskComposite:"source-out, source-over, source-over, source-over, source-over, source-over",opacity:w*p,mixBlendMode:"soft-light",transition:z?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"}}),D.jsx("span",{className:"absolute pointer-events-none z-[1] rounded-[inherit]",style:{inset:`${-a}px`,maskImage:`conic-gradient(from ${V} at center, black 2.5%, transparent 10%, transparent 90%, black 97.5%)`,WebkitMaskImage:`conic-gradient(from ${V} at center, black 2.5%, transparent 10%, transparent 90%, black 97.5%)`,opacity:F,mixBlendMode:"plus-lighter",transition:z?"opacity 0.25s ease-out":"opacity 0.75s ease-in-out"},children:D.jsx("span",{className:"absolute rounded-[inherit]",style:{inset:`${a}px`,boxShadow:W0(i,o)}})}),D.jsx("div",{className:"flex flex-col relative overflow-hidden z-[1] w-full h-full",style:{borderRadius:`${Math.max(0,s-1)}px`},children:n})]})};function $0(){if(typeof navigator>"u")return"other";const e=`${navigator.userAgentData?.platform??""} ${navigator.userAgent??""} ${navigator.platform??""}`.toLowerCase();return e.includes("win")?"windows":e.includes("mac")&&!e.includes("iphone")&&!e.includes("ipad")?"mac":"other"}function Ho({className:n}){return D.jsx("svg",{viewBox:"0 0 384 512",className:n,fill:"currentColor",children:D.jsx("path",{d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"})})}function Z0({className:n}){return D.jsx("svg",{viewBox:"0 0 16 16",className:n,fill:"currentColor",children:D.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})})}function Wo({className:n}){return D.jsx("svg",{viewBox:"0 0 24 24",className:n,fill:"currentColor","aria-hidden":"true",children:D.jsx("path",{d:"M3 5.46 10.2 4.5v6.92H3V5.46Zm0 13.08 7.2.96v-6.84H3v5.88Zm8.04 1.08L21 21V12.46h-9.96v7.16ZM11.04 4.38 21 3v8.46h-9.96V4.38Z"})})}function K0({className:n}){return D.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:n,"aria-hidden":"true",children:[D.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),D.jsx("polyline",{points:"7 10 12 15 17 10"}),D.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function J0({className:n}){return D.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:n,children:[D.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),D.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})}function Q0({className:n}){return D.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:n,children:D.jsx("polyline",{points:"20 6 9 17 4 12"})})}const Xo="https://github.com/mm7894215/TokenTracker",ma="https://github.com/mm7894215/TokenTracker/releases/latest",jo=`${ma}/download/TokenTrackerBar.dmg`,qo=`${ma}/download/TokenTracker-Setup.exe`;function eg({copy:n,signInUrl:e,signUpUrl:t,installCommand:i,installCopied:r,onCopyInstallCommand:s}){const a=kl(),[o,l]=Pe.useState(!1);Pe.useEffect(()=>{const b=()=>l(window.scrollY>10);return window.addEventListener("scroll",b,{passive:!0}),()=>window.removeEventListener("scroll",b)},[]);const c=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),{signedIn:d,loading:p}=Hl(),{openLoginModal:h}=Wl(),f=Pe.useMemo(()=>$0(),[]),g={href:jo,label:n("landing.v2.install.os_macos"),Icon:Ho},v={href:qo,label:n("landing.v2.install.os_windows"),Icon:Wo},m=f==="windows"?{href:qo,label:n("landing.v2.install.win_cta"),Icon:Wo}:f==="mac"?{href:jo,label:n("landing.v2.install.mac_cta"),Icon:Ho}:{href:ma,label:n("landing.v2.install.desktop_cta"),Icon:K0},u=f==="windows"?[g]:f==="mac"?[v]:[g,v],S=a?{duration:0}:void 0;return D.jsxs("div",{className:"relative min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark",children:[D.jsx("div",{className:"absolute inset-0 z-0 pointer-events-none",style:{height:"100vh"},children:D.jsx(V0,{raysOrigin:"top-center",raysColor:"#b8b3ff",raysSpeed:1,lightSpread:.5,rayLength:3,pulsating:!1,fadeDistance:1,saturation:1,followMouse:!0,mouseInfluence:.1,noiseAmount:0,distortion:0})}),D.jsx("header",{className:na("sticky top-0 z-50 transition-all duration-300",o?"bg-oai-gray-950/80 backdrop-blur-md border-b border-oai-gray-900":"bg-transparent border-b border-transparent"),children:D.jsxs("div",{className:"mx-auto flex h-14 max-w-7xl items-center justify-between px-4 sm:px-6",children:[D.jsxs("div",{className:"flex items-center gap-3 sm:gap-5",children:[D.jsxs(jn,{to:t||"/",className:"flex items-center gap-3 no-underline outline-none rounded focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:ring-offset-oai-gray-950 transition-opacity hover:opacity-80",children:[D.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),D.jsx("span",{className:"text-sm font-semibold tracking-wide text-white uppercase whitespace-nowrap",children:"Token Tracker"})]}),D.jsx("div",{className:"hidden sm:block",children:D.jsx($l,{})})]}),D.jsxs("div",{className:"flex items-center justify-end gap-3 sm:gap-5 md:gap-6",children:[D.jsx(jn,{to:"/leaderboard",className:"hidden sm:inline text-sm font-medium text-oai-gray-400 hover:text-white transition-colors duration-200 select-none outline-none focus-visible:underline",children:n("nav.leaderboard")}),!d&&!p&&D.jsx(jn,{to:wa(),className:"hidden sm:inline text-sm font-medium text-oai-gray-400 hover:text-white transition-colors duration-200 select-none outline-none focus-visible:underline",children:n("landing.v2.cta.primary")}),D.jsx("div",{className:"flex items-center gap-2.5 sm:gap-3.5",children:p?D.jsx("div",{className:"h-8 w-16 animate-pulse rounded-[8px] bg-white/10","aria-hidden":!0}):d?D.jsxs(D.Fragment,{children:[D.jsx(jn,{to:wa(),className:"inline-flex h-8 items-center justify-center rounded-[8px] bg-white px-3.5 text-xs font-bold text-oai-gray-950 hover:bg-oai-gray-100 transition-all duration-200 active:scale-[0.98] shadow-sm select-none",children:n("landing.v2.cta.primary")}),D.jsx(Xl,{})]}):D.jsx("button",{type:"button",onClick:h,className:"inline-flex h-8 min-w-[80px] items-center justify-center rounded-[8px] bg-white px-3.5 text-xs font-bold text-oai-gray-950 hover:bg-oai-gray-100 transition-all duration-200 active:scale-[0.98] shadow-sm select-none",children:n("header.auth.sign_in_aria")})})]})]})}),D.jsxs("main",{children:[D.jsx("section",{className:"relative py-16 sm:py-24 lg:py-32 overflow-hidden",children:D.jsxs("div",{className:"relative z-10 mx-auto max-w-7xl px-4 sm:px-6 flex flex-col items-center text-center gap-12 sm:gap-20 lg:gap-36",children:[D.jsxs(wi.div,{initial:a?!1:{opacity:0,y:20},animate:{opacity:1,y:0},transition:S||{duration:.5},className:"w-full max-w-3xl relative z-20",children:[D.jsxs("h1",{className:"text-balance text-4xl font-semibold tracking-tight text-white sm:text-6xl lg:text-[4rem] leading-[1.1] sm:leading-tight lg:leading-[1.05]",children:[n("landing.v2.hero.title_line1"),D.jsx("br",{}),D.jsx("span",{className:"bg-gradient-to-b from-white via-oai-gray-200 to-oai-gray-500 bg-clip-text text-transparent font-bold tracking-tight",style:{WebkitTextStroke:"1px rgba(255, 255, 255, 0.15)"},children:n("landing.v2.hero.title_line2")})]}),D.jsxs("p",{className:"mt-5 sm:mt-6 text-base sm:text-lg leading-relaxed text-oai-gray-400",children:[n("landing.v2.hero.subtagline")," ",n("landing.v2.install.availability")]}),D.jsxs("div",{className:"mt-8 w-full max-w-lg mx-auto",children:[D.jsxs(wi.div,{whileHover:{scale:1.01,y:-1},transition:{type:"spring",stiffness:400,damping:25},className:"group relative inline-block w-full overflow-hidden rounded-2xl",style:{padding:"1.5px 0"},children:[D.jsx("div",{className:"absolute w-[300%] h-[50%] opacity-70 bottom-[-11px] right-[-250%] rounded-full animate-star-movement-bottom z-0",style:{background:"radial-gradient(circle, #fbdfff, transparent 10%)",animationDuration:"6s"}}),D.jsx("div",{className:"absolute w-[300%] h-[50%] opacity-70 top-[-10px] left-[-250%] rounded-full animate-star-movement-top z-0",style:{background:"radial-gradient(circle, #fbdfff, transparent 10%)",animationDuration:"6s"}}),D.jsxs("div",{className:"relative z-[1] flex items-center justify-between w-full bg-[#0a0a0a] border border-oai-gray-800 rounded-2xl p-1.5 pl-5 shadow-2xl shadow-black/50",children:[D.jsxs("div",{className:"flex items-center gap-3 overflow-hidden",children:[D.jsx("span",{className:"text-oai-gray-600 font-mono select-none","aria-hidden":"true",children:"›"}),D.jsx("code",{className:"font-mono text-sm text-oai-gray-200 overflow-x-auto whitespace-nowrap py-2 [scrollbar-width:none]",children:i?i.split(" ").map((b,E)=>D.jsxs("span",{className:b==="npx"||b==="tokentracker-cli"?"text-white font-medium":b==="--yes"?"text-oai-gray-500":"text-oai-brand-400",children:[b," "]},E)):null})]}),D.jsx("button",{type:"button",onClick:s,"aria-label":n(r?"landing.install.action.copied":"landing.install.action.copy"),className:"shrink-0 flex h-9 w-9 items-center justify-center text-oai-gray-200 bg-oai-gray-900 border border-oai-gray-700 rounded-lg hover:bg-oai-gray-800 hover:text-white active:scale-95 transition-all duration-200 shadow-sm",children:r?D.jsx(Q0,{className:"h-4 w-4 text-green-400","aria-hidden":!0}):D.jsx(J0,{className:"h-4 w-4 opacity-70","aria-hidden":!0})})]})]}),D.jsx("div",{className:"mt-5 flex justify-center",children:D.jsxs("a",{href:m.href,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex h-11 items-center justify-center gap-2 rounded-full bg-white px-7 text-sm font-semibold text-oai-gray-950 shadow-lg shadow-black/30 transition-all duration-200 hover:bg-oai-gray-100 active:scale-[0.98]",children:[D.jsx(m.Icon,{className:"h-4 w-4"}),m.label]})}),D.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-x-6 gap-y-3",children:[u.map(b=>D.jsxs("a",{href:b.href,target:"_blank",rel:"noopener noreferrer",className:"group flex items-center gap-2 text-sm font-medium text-oai-gray-400 hover:text-white transition-colors",children:[D.jsx(b.Icon,{className:"h-4 w-4 text-oai-gray-500 group-hover:text-white"}),b.label]},b.href)),D.jsxs("a",{href:Xo,target:"_blank",rel:"noopener noreferrer",className:"group flex items-center gap-2 text-sm font-medium text-oai-gray-400 hover:text-white transition-colors",children:[D.jsx(Z0,{className:"h-4 w-4 text-oai-gray-500 group-hover:text-white"}),n("landing.cta.secondary")]})]}),D.jsx("span",{className:"sr-only","aria-live":"polite",children:r?n("landing.install.action.copied"):""})]})]}),D.jsx("div",{className:"relative group w-full",children:D.jsxs(wi.div,{initial:a?!1:{opacity:0,y:24},animate:{opacity:1,y:0},transition:S||{duration:.6,delay:.1},className:"relative w-full",children:[D.jsx("div",{style:{position:"absolute",top:"-256px",left:0,right:0,height:"510px",zIndex:3,pointerEvents:"none"},children:D.jsx(pm,{color:"#8a7aff",wispDensity:2,flowSpeed:.28,verticalSizing:2.2,horizontalSizing:1,fogIntensity:4,fogScale:.1,wispSpeed:18,wispIntensity:6,flowStrength:.12,decay:1.1,falloffStart:.95,fogFallSpeed:.5,horizontalBeamOffset:.22,verticalBeamOffset:0,style:{width:"100%",height:"100%"}})}),D.jsx("div",{className:"relative rounded-xl p-[1px] shadow-2xl bg-gradient-to-b from-[rgba(138,122,255,0.6)] via-[rgba(138,122,255,0.15)] to-[rgba(138,122,255,0.05)]",style:{position:"relative",zIndex:10,boxShadow:"0 20px 60px -10px rgba(138,122,255,0.15), 0 4px 20px rgba(0,0,0,0.4)"},children:D.jsxs("div",{className:"relative rounded-[11px] overflow-hidden bg-oai-gray-950",children:[D.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"180px",background:"linear-gradient(to bottom, rgba(138,122,255,0.35) 0%, rgba(138,122,255,0.12) 40%, transparent 100%)",mixBlendMode:"screen",zIndex:20,pointerEvents:"none"}}),D.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"1px",background:"linear-gradient(90deg, transparent 0%, rgba(138,122,255,0.9) 30%, rgba(180,168,255,1) 50%, rgba(138,122,255,0.9) 70%, transparent 100%)",zIndex:25,pointerEvents:"none"}}),D.jsx("img",{src:"/dashboard-dark.png",alt:n("landing.screenshot.alt"),className:"block h-auto w-full object-cover",style:{position:"relative",zIndex:10},loading:"eager",decoding:"async"})]})})]})})]})}),D.jsx("section",{className:"border-y border-oai-gray-900 bg-oai-gray-950/50 py-12 lg:py-16",children:D.jsx("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:D.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between gap-10",children:[D.jsx("p",{className:"text-sm font-semibold uppercase tracking-wider text-oai-gray-400 shrink-0 md:max-w-[16rem]",children:n("landing.v2.models.title")}),D.jsx("div",{className:"flex justify-center md:justify-end",children:D.jsx(Zl,{logos:Kl,columnCount:6})})]})})}),D.jsx("section",{className:"border-t border-oai-gray-900 py-14 sm:py-20 lg:py-32 relative bg-oai-gray-950",children:D.jsx("div",{className:"mx-auto max-w-6xl px-4 sm:px-6 relative z-10",children:D.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-10 sm:gap-12 lg:gap-8 items-start",children:[D.jsxs("div",{className:"lg:col-span-5 space-y-6 text-left",children:[D.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full border border-oai-gray-800 bg-[#080808] text-[10px] font-bold tracking-widest uppercase text-oai-gray-400",children:[D.jsxs("span",{className:"relative flex h-2 w-2",children:[D.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-oai-brand-500 opacity-75"}),D.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-oai-brand-500"})]}),n("landing.v2.leaderboard.kicker")]}),D.jsx("h2",{className:"text-3xl font-semibold tracking-tight text-white sm:text-4xl text-balance leading-tight",children:n("landing.v2.leaderboard.title")}),D.jsx("p",{className:"text-base leading-relaxed text-oai-gray-400",children:n("landing.v2.leaderboard.subtitle")}),D.jsx("div",{className:"pt-4",children:D.jsx(jn,{to:"/leaderboard",className:"inline-flex h-9 items-center justify-center rounded-[8px] bg-white px-6 text-xs font-bold text-oai-gray-950 hover:bg-oai-gray-100 transition-all duration-200 shadow-sm active:scale-[0.98] select-none whitespace-nowrap",children:n("landing.v2.leaderboard.view_more")})})]}),D.jsx("div",{className:"lg:col-span-7 w-full",children:D.jsx(k0,{rotateMax:4,className:"w-full",children:D.jsxs(Y0,{edgeSensitivity:30,glowColor:"247 100 74",backgroundColor:"#09090b",borderRadius:16,glowRadius:35,glowIntensity:1,coneSpread:25,animated:!1,colors:["#8a7aff","#f472b6","#38bdf8"],className:"w-full",children:[D.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 border-b border-oai-gray-800/80 bg-white/[0.025] backdrop-blur-xs text-[10px] tracking-widest text-oai-gray-500 font-bold uppercase select-none",children:[D.jsx("span",{children:"Community Rankings (Global)"}),D.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-oai-brand-400",children:[D.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-oai-brand-500 animate-pulse"}),"Realtime"]})]}),D.jsxs("div",{className:"divide-y divide-oai-gray-800/60",children:[D.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-4 hover:bg-white/[0.02] transition-colors group",children:[D.jsxs("div",{className:"flex items-center gap-3.5 min-w-0",children:[D.jsx("span",{className:"font-mono text-xs font-bold text-yellow-500 w-4",children:"01"}),D.jsx("span",{className:"text-oai-gray-700 font-mono text-xs select-none",children:"›"}),D.jsx("span",{className:"font-bold text-white text-sm tracking-wide truncate",children:"VOLT"}),D.jsx("span",{className:"text-[9px] font-bold tracking-widest px-1.5 py-0.5 rounded border border-oai-gray-800 bg-oai-gray-950 text-oai-gray-500 font-mono scale-90",children:"CHAMP"})]}),D.jsxs("div",{className:"flex items-center gap-6 shrink-0",children:[D.jsx("div",{className:"hidden sm:block w-16 h-[2px] bg-oai-gray-950 rounded-full overflow-hidden",children:D.jsx("div",{className:"h-full bg-yellow-500 w-[98.4%]"})}),D.jsxs("div",{className:"text-right",children:[D.jsx("div",{className:"text-sm font-semibold text-white font-mono leading-none",children:"1,420,850"}),D.jsx("div",{className:"text-[10px] text-yellow-500 font-semibold font-mono mt-1",children:"98.4% Eff."})]})]})]}),D.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-4 hover:bg-white/[0.02] transition-colors group",children:[D.jsxs("div",{className:"flex items-center gap-3.5 min-w-0",children:[D.jsx("span",{className:"font-mono text-xs font-bold text-oai-gray-500 w-4",children:"02"}),D.jsx("span",{className:"text-oai-gray-700 font-mono text-xs select-none",children:"›"}),D.jsx("span",{className:"font-semibold text-oai-gray-200 text-sm tracking-wide truncate",children:"ALEX"})]}),D.jsxs("div",{className:"flex items-center gap-6 shrink-0",children:[D.jsx("div",{className:"hidden sm:block w-16 h-[2px] bg-oai-gray-950 rounded-full overflow-hidden",children:D.jsx("div",{className:"h-full bg-oai-gray-600 w-[92.1%]"})}),D.jsxs("div",{className:"text-right",children:[D.jsx("div",{className:"text-sm font-medium text-oai-gray-300 font-mono leading-none",children:"924,110"}),D.jsx("div",{className:"text-[10px] text-oai-gray-400 font-medium font-mono mt-1",children:"92.1% Eff."})]})]})]}),D.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-4 hover:bg-white/[0.02] transition-colors group",children:[D.jsxs("div",{className:"flex items-center gap-3.5 min-w-0",children:[D.jsx("span",{className:"font-mono text-xs font-bold text-oai-gray-500 w-4",children:"03"}),D.jsx("span",{className:"text-oai-gray-700 font-mono text-xs select-none",children:"›"}),D.jsx("span",{className:"font-semibold text-oai-gray-200 text-sm tracking-wide truncate",children:"CHARLIE"})]}),D.jsxs("div",{className:"flex items-center gap-6 shrink-0",children:[D.jsx("div",{className:"hidden sm:block w-16 h-[2px] bg-oai-gray-950 rounded-full overflow-hidden",children:D.jsx("div",{className:"h-full bg-oai-gray-600 w-[89.5%]"})}),D.jsxs("div",{className:"text-right",children:[D.jsx("div",{className:"text-sm font-medium text-oai-gray-300 font-mono leading-none",children:"740,560"}),D.jsx("div",{className:"text-[10px] text-oai-gray-400 font-medium font-mono mt-1",children:"89.5% Eff."})]})]})]})]}),D.jsxs("div",{className:"px-4 sm:px-5 py-2.5 border-t border-oai-gray-800/80 bg-black/[0.15] flex items-center justify-between text-[9px] font-mono tracking-widest text-oai-gray-600 select-none",children:[D.jsx("span",{children:"SYSTEM: // LEADERBOARD_PREVIEW_FEED"}),D.jsx("span",{children:"42 DAY ACTIVE STREAK"})]})]})})})]})})}),D.jsx("section",{className:"py-14 sm:py-20 lg:py-32 border-t border-oai-gray-900/60 bg-[#0c0c0e]",children:D.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6 grid grid-cols-1 lg:grid-cols-12 gap-10 sm:gap-12 lg:gap-16 items-start",children:[D.jsxs("div",{className:"lg:col-span-5 max-w-md text-left",children:[D.jsx("p",{className:"text-xs font-bold tracking-widest uppercase text-oai-brand-500",children:n("landing.v2.compare.kicker")}),D.jsx("h2",{className:"mt-4 text-3xl font-semibold tracking-tight text-white sm:text-4xl text-balance leading-tight",children:n("landing.v2.compare.title")}),D.jsx("p",{className:"mt-6 text-sm leading-relaxed text-oai-gray-400",children:n("landing.v2.compare.subtitle")})]}),D.jsxs("div",{className:"lg:col-span-7 grid grid-cols-1 sm:grid-cols-2 gap-x-8 sm:gap-x-12 gap-y-8 sm:gap-y-10 w-full",children:[D.jsxs("div",{className:"space-y-5",children:[D.jsx("div",{className:"border-t border-oai-gray-800/80 pt-4",children:D.jsxs("h3",{className:"text-xs font-mono font-bold tracking-widest text-white flex items-center gap-2 select-none",children:[D.jsx("span",{className:"text-oai-brand-400",children:"[+]"}),n("landing.v2.compare.with.title")]})}),D.jsxs("ul",{className:"space-y-4 mt-5 text-xs font-mono text-oai-gray-300",children:[D.jsxs("li",{className:"flex gap-2.5 items-start",children:[D.jsx("span",{className:"text-oai-brand-400 shrink-0 font-bold select-none",children:"+"}),D.jsx("span",{className:"leading-relaxed",children:n("landing.v2.compare.with.p1")})]}),D.jsxs("li",{className:"flex gap-2.5 items-start",children:[D.jsx("span",{className:"text-oai-brand-400 shrink-0 font-bold select-none",children:"+"}),D.jsx("span",{className:"leading-relaxed",children:n("landing.v2.compare.with.p2")})]}),D.jsxs("li",{className:"flex gap-2.5 items-start",children:[D.jsx("span",{className:"text-oai-brand-400 shrink-0 font-bold select-none",children:"+"}),D.jsx("span",{className:"leading-relaxed",children:n("landing.v2.compare.with.p3")})]}),D.jsxs("li",{className:"flex gap-2.5 items-start",children:[D.jsx("span",{className:"text-oai-brand-400 shrink-0 font-bold select-none",children:"+"}),D.jsx("span",{className:"leading-relaxed",children:n("landing.v2.compare.with.p4")})]})]})]}),D.jsxs("div",{className:"space-y-5",children:[D.jsx("div",{className:"border-t border-oai-gray-800/80 pt-4",children:D.jsxs("h3",{className:"text-xs font-mono font-bold tracking-widest text-oai-gray-500 flex items-center gap-2 select-none",children:[D.jsx("span",{className:"text-oai-gray-600",children:"[-]"}),n("landing.v2.compare.without.title")]})}),D.jsxs("ul",{className:"space-y-4 mt-5 text-xs font-mono text-oai-gray-500",children:[D.jsxs("li",{className:"flex gap-2.5 items-start",children:[D.jsx("span",{className:"text-oai-gray-600 shrink-0 font-bold select-none",children:"-"}),D.jsx("span",{className:"leading-relaxed text-oai-gray-400",children:n("landing.v2.compare.without.p1")})]}),D.jsxs("li",{className:"flex gap-2.5 items-start",children:[D.jsx("span",{className:"text-oai-gray-600 shrink-0 font-bold select-none",children:"-"}),D.jsx("span",{className:"leading-relaxed text-oai-gray-400",children:n("landing.v2.compare.without.p2")})]}),D.jsxs("li",{className:"flex gap-2.5 items-start",children:[D.jsx("span",{className:"text-oai-gray-600 shrink-0 font-bold select-none",children:"-"}),D.jsx("span",{className:"leading-relaxed text-oai-gray-400",children:n("landing.v2.compare.without.p3")})]}),D.jsxs("li",{className:"flex gap-2.5 items-start",children:[D.jsx("span",{className:"text-oai-gray-600 shrink-0 font-bold select-none",children:"-"}),D.jsx("span",{className:"leading-relaxed text-oai-gray-400",children:n("landing.v2.compare.without.p4")})]})]})]})]})]})})]}),D.jsx("footer",{className:"border-t border-oai-gray-900 bg-oai-gray-950 py-12",children:D.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col items-center justify-between gap-6 px-4 sm:px-6 text-sm text-oai-gray-400 sm:flex-row",children:[D.jsx("p",{children:n("landing.v2.footer.line")}),D.jsxs("div",{className:"flex items-center gap-6",children:[D.jsx("a",{href:jl,className:"font-medium text-oai-gray-400 hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:n("landing.v2.nav.status")}),D.jsx("a",{href:Xo,className:"font-medium text-oai-gray-400 hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:n("landing.v2.nav.github")}),c&&D.jsxs(jn,{to:e,className:"font-medium text-oai-brand-500 hover:text-oai-brand-400 transition-colors",children:[n("landing.cta.primary")," →"]})]})]})})]})}function tg({prefersReducedMotion:n,screenshotMode:e}){return!(e||n)}function ng(){return Pe.useMemo(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches,[])}function ig(n=0,e=!0){const[t,i]=Pe.useState(()=>!e);return Pe.useEffect(()=>{if(!e){i(!0);return}let r=null,s=null;const a=()=>i(!0);return typeof window<"u"&&"requestIdleCallback"in window?(s=window.requestIdleCallback(a,{timeout:n||200}),()=>{typeof window.cancelIdleCallback=="function"&&s!=null&&window.cancelIdleCallback(s)}):(r=window.setTimeout(a,n),()=>{r!=null&&window.clearTimeout(r)})},[n,e]),t}function lg({signInUrl:n,signUpUrl:e}){const t=Ht("landing.handle.special"),i=Ht("landing.handle.default");Ht("landing.nav.login"),Ht("landing.nav.signup");const[r,s]=Pe.useState(i),a=ng(),o=Pe.useMemo(()=>typeof window>"u"?!1:ql(window.location.search),[]),l=tg({prefersReducedMotion:a,screenshotMode:o});ig(250,l);const c="tokentracker.dashboard.from_landing.v1";Pe.useEffect(()=>{if(!(typeof window>"u"))try{window.sessionStorage.setItem(c,"1")}catch{}},[c]),Pe.useMemo(()=>Ht("landing.handle.placeholder",{handle:t}),[t]),Pe.useMemo(()=>{const g=r===t?Ht("landing.rank.singularity"):Ht("landing.rank.unranked");return Ht("landing.rank.expectation",{rank:g})},[r,t]);const d=Ht("landing.install.command"),[p,h]=Pe.useState(!1),f=async()=>{await Yl(d)&&(h(!0),window.setTimeout(()=>h(!1),2e3))};return D.jsx(eg,{copy:Ht,reduceMotion:a,signInUrl:n,signUpUrl:e,installCommand:d,installCopied:p,onCopyInstallCommand:f})}export{lg as LandingPage};