diff --git a/public/threejs-portal-effect/assets/audio/the_bardos_beyond_christmas.mp3 b/public/threejs-portal-effect/assets/audio/the_bardos_beyond_christmas.mp3 new file mode 100755 index 0000000..d2fa29d Binary files /dev/null and b/public/threejs-portal-effect/assets/audio/the_bardos_beyond_christmas.mp3 differ diff --git a/public/threejs-portal-effect/assets/index-BYuVbkY0.js b/public/threejs-portal-effect/assets/index-BYuVbkY0.js new file mode 100644 index 0000000..0c2d4e1 --- /dev/null +++ b/public/threejs-portal-effect/assets/index-BYuVbkY0.js @@ -0,0 +1,9535 @@ +import wP from"https://unpkg.com/three@0.118.3/examples/jsm/libs/stats.module.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();/** + * @license + * Copyright 2010-2024 Three.js Authors + * SPDX-License-Identifier: MIT + */const Lx="170",Nc={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},hc={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},TP=0,NS=1,AP=2,eT=1,bP=2,Ns=3,Wr=0,Ri=1,fi=2,Yo=0,Uc=1,US=2,OS=3,FS=4,RP=5,qa=100,CP=101,PP=102,LP=103,IP=104,DP=200,NP=201,UP=202,OP=203,D_=204,N_=205,FP=206,kP=207,BP=208,zP=209,HP=210,VP=211,GP=212,WP=213,$P=214,U_=0,O_=1,F_=2,Yc=3,k_=4,B_=5,z_=6,H_=7,tT=0,XP=1,jP=2,Ko=0,qP=1,YP=2,KP=3,ZP=4,QP=5,JP=6,e4=7,kS="attached",t4="detached",nT=300,Kc=301,Zc=302,V_=303,G_=304,$m=306,aa=1e3,Wo=1001,Kp=1002,ni=1003,iT=1004,mf=1005,$i=1006,pp=1007,os=1008,Zs=1009,rT=1010,sT=1011,jf=1012,Ix=1013,pl=1014,Ur=1015,wd=1016,Dx=1017,Nx=1018,Qc=1020,oT=35902,aT=1021,lT=1022,fr=1023,cT=1024,uT=1025,Oc=1026,Jc=1027,Ux=1028,Ox=1029,fT=1030,Fx=1031,kx=1033,mp=33776,gp=33777,_p=33778,vp=33779,W_=35840,$_=35841,X_=35842,j_=35843,q_=36196,Y_=37492,K_=37496,Z_=37808,Q_=37809,J_=37810,ev=37811,tv=37812,nv=37813,iv=37814,rv=37815,sv=37816,ov=37817,av=37818,lv=37819,cv=37820,uv=37821,xp=36492,fv=36494,dv=36495,dT=36283,hv=36284,pv=36285,mv=36286,qf=2300,Yf=2301,D0=2302,BS=2400,zS=2401,HS=2402,n4=2500,i4=0,hT=1,gv=2,r4=3200,s4=3201,pT=0,o4=1,Bo="",En="srgb",pi="srgb-linear",Xm="linear",kt="srgb",Ll=7680,VS=519,a4=512,l4=513,c4=514,mT=515,u4=516,f4=517,d4=518,h4=519,_v=35044,GS="300 es",Gs=2e3,Zp=2001;let Al=class{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){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s>8&255]+$n[n>>16&255]+$n[n>>24&255]+"-"+$n[e&255]+$n[e>>8&255]+"-"+$n[e>>16&15|64]+$n[e>>24&255]+"-"+$n[t&63|128]+$n[t>>8&255]+"-"+$n[t>>16&255]+$n[t>>24&255]+$n[i&255]+$n[i>>8&255]+$n[i>>16&255]+$n[i>>24&255]).toLowerCase()}function Hn(n,e,t){return Math.max(e,Math.min(t,n))}function Bx(n,e){return(n%e+e)%e}function p4(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function m4(n,e,t){return n!==e?(t-n)/(e-n):0}function Cf(n,e,t){return(1-t)*n+t*e}function g4(n,e,t,i){return Cf(n,e,1-Math.exp(-t*i))}function _4(n,e=1){return e-Math.abs(Bx(n,e*2)-e)}function v4(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function x4(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function y4(n,e){return n+Math.floor(Math.random()*(e-n+1))}function S4(n,e){return n+Math.random()*(e-n)}function M4(n){return n*(.5-Math.random())}function E4(n){n!==void 0&&(WS=n);let e=WS+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function w4(n){return n*Rf}function T4(n){return n*eu}function A4(n){return(n&n-1)===0&&n!==0}function b4(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function R4(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function C4(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),u=o((e+i)/2),f=s((e-i)/2),h=o((e-i)/2),p=s((i-e)/2),g=o((i-e)/2);switch(r){case"XYX":n.set(a*u,l*f,l*h,a*c);break;case"YZY":n.set(l*h,a*u,l*f,a*c);break;case"ZXZ":n.set(l*f,l*h,a*u,a*c);break;case"XZX":n.set(a*u,l*g,l*p,a*c);break;case"YXY":n.set(l*p,a*u,l*g,a*c);break;case"ZYZ":n.set(l*g,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Dr(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 Dt(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.")}}const gT={DEG2RAD:Rf,RAD2DEG:eu,generateUUID:Br,clamp:Hn,euclideanModulo:Bx,mapLinear:p4,inverseLerp:m4,lerp:Cf,damp:g4,pingpong:_4,smoothstep:v4,smootherstep:x4,randInt:y4,randFloat:S4,randFloatSpread:M4,seededRandom:E4,degToRad:w4,radToDeg:T4,isPowerOfTwo:A4,ceilPowerOfTwo:b4,floorPowerOfTwo:R4,setQuaternionFromProperEuler:C4,normalize:Dt,denormalize:Dr};let lt=class _T{constructor(e=0,t=0){_T.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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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(Hn(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,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},xt=class vT{constructor(e,t,i,r,s,o,a,l,c){vT.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=o,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,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],f=i[7],h=i[2],p=i[5],g=i[8],_=r[0],m=r[3],d=r[6],x=r[1],v=r[4],y=r[7],b=r[2],w=r[5],T=r[8];return s[0]=o*_+a*x+l*b,s[3]=o*m+a*v+l*w,s[6]=o*d+a*y+l*T,s[1]=c*_+u*x+f*b,s[4]=c*m+u*v+f*w,s[7]=c*d+u*y+f*T,s[2]=h*_+p*x+g*b,s[5]=h*m+p*v+g*w,s[8]=h*d+p*y+g*T,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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*s*u+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,h=a*l-u*s,p=c*s-o*l,g=t*f+i*h+r*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=f*_,e[1]=(r*c-u*i)*_,e[2]=(a*i-r*o)*_,e[3]=h*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-a*t)*_,e[6]=p*_,e[7]=(i*l-c*t)*_,e[8]=(o*t-i*s)*_,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,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(N0.makeScale(e,t)),this}rotate(e){return this.premultiply(N0.makeRotation(-e)),this}translate(e,t){return this.premultiply(N0.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 N0=new xt;function xT(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Kf(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function P4(){const n=Kf("canvas");return n.style.display="block",n}const $S={};function gf(n){n in $S||($S[n]=!0,console.warn(n))}function L4(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)})}function I4(n){const e=n.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function D4(n){const e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const wt={enabled:!0,workingColorSpace:pi,spaces:{},convert:function(n,e,t){return this.enabled===!1||e===t||!e||!t||(this.spaces[e].transfer===kt&&(n.r=Ys(n.r),n.g=Ys(n.g),n.b=Ys(n.b)),this.spaces[e].primaries!==this.spaces[t].primaries&&(n.applyMatrix3(this.spaces[e].toXYZ),n.applyMatrix3(this.spaces[t].fromXYZ)),this.spaces[t].transfer===kt&&(n.r=Fc(n.r),n.g=Fc(n.g),n.b=Fc(n.b))),n},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)},getPrimaries:function(n){return this.spaces[n].primaries},getTransfer:function(n){return n===Bo?Xm:this.spaces[n].transfer},getLuminanceCoefficients:function(n,e=this.workingColorSpace){return n.fromArray(this.spaces[e].luminanceCoefficients)},define:function(n){Object.assign(this.spaces,n)},_getMatrix:function(n,e,t){return n.copy(this.spaces[e].toXYZ).multiply(this.spaces[t].fromXYZ)},_getDrawingBufferColorSpace:function(n){return this.spaces[n].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(n=this.workingColorSpace){return this.spaces[n].workingColorSpaceConfig.unpackColorSpace}};function Ys(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Fc(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const XS=[.64,.33,.3,.6,.15,.06],jS=[.2126,.7152,.0722],qS=[.3127,.329],YS=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),KS=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);wt.define({[pi]:{primaries:XS,whitePoint:qS,transfer:Xm,toXYZ:YS,fromXYZ:KS,luminanceCoefficients:jS,workingColorSpaceConfig:{unpackColorSpace:En},outputColorSpaceConfig:{drawingBufferColorSpace:En}},[En]:{primaries:XS,whitePoint:qS,transfer:kt,toXYZ:YS,fromXYZ:KS,luminanceCoefficients:jS,outputColorSpaceConfig:{drawingBufferColorSpace:En}}});let Il,N4=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Il===void 0&&(Il=Kf("canvas")),Il.width=e.width,Il.height=e.height;const i=Il.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Il}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Kf("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 o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==nT)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case aa:e.x=e.x-Math.floor(e.x);break;case Wo:e.x=e.x<0?0:1;break;case Kp: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 aa:e.y=e.y-Math.floor(e.y);break;case Wo:e.y=e.y<0?0:1;break;case Kp: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++}};mi.DEFAULT_IMAGE=null;mi.DEFAULT_MAPPING=nT;mi.DEFAULT_ANISOTROPY=1;let Ct=class ST{constructor(e=0,t=0,i=0,r=1){ST.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,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[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],f=l[8],h=l[1],p=l[5],g=l[9],_=l[2],m=l[6],d=l[10];if(Math.abs(u-h)<.01&&Math.abs(f-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+p+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const v=(c+1)/2,y=(p+1)/2,b=(d+1)/2,w=(u+h)/4,T=(f+_)/4,C=(g+m)/4;return v>y&&v>b?v<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(v),r=w/i,s=T/i):y>b?y<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(y),i=w/r,s=C/r):b<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(b),i=T/s,r=C/s),this.set(i,r,s,t),this}let x=Math.sqrt((m-g)*(m-g)+(f-_)*(f-_)+(h-u)*(h-u));return Math.abs(x)<.001&&(x=1),this.x=(m-g)/x,this.y=(f-_)/x,this.z=(h-u)/x,this.w=Math.acos((c+p+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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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}},F4=class extends Al{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ct(0,0,e,t),this.scissorTest=!1,this.viewport=new Ct(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:$i,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new mi(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a=0?1:-1,v=1-d*d;if(v>Number.EPSILON){const b=Math.sqrt(v),w=Math.atan2(b,d*x);m=Math.sin(m*w)/b,a=Math.sin(a*w)/b}const y=a*x;if(l=l*m+h*y,c=c*m+p*y,u=u*m+g*y,f=f*m+_*y,m===1-a){const b=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=b,c*=b,u*=b,f*=b}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],f=s[o],h=s[o+1],p=s[o+2],g=s[o+3];return e[t]=a*g+u*f+l*p-c*h,e[t+1]=l*g+u*h+c*f-a*p,e[t+2]=c*g+u*p+a*h-l*f,e[t+3]=u*g-a*f-l*h-c*p,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,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),f=a(s/2),h=l(i/2),p=l(r/2),g=l(s/2);switch(o){case"XYZ":this._x=h*u*f+c*p*g,this._y=c*p*f-h*u*g,this._z=c*u*g+h*p*f,this._w=c*u*f-h*p*g;break;case"YXZ":this._x=h*u*f+c*p*g,this._y=c*p*f-h*u*g,this._z=c*u*g-h*p*f,this._w=c*u*f+h*p*g;break;case"ZXY":this._x=h*u*f-c*p*g,this._y=c*p*f+h*u*g,this._z=c*u*g+h*p*f,this._w=c*u*f-h*p*g;break;case"ZYX":this._x=h*u*f-c*p*g,this._y=c*p*f+h*u*g,this._z=c*u*g-h*p*f,this._w=c*u*f+h*p*g;break;case"YZX":this._x=h*u*f+c*p*g,this._y=c*p*f+h*u*g,this._z=c*u*g-h*p*f,this._w=c*u*f-h*p*g;break;case"XZY":this._x=h*u*f-c*p*g,this._y=c*p*f-h*u*g,this._z=c*u*g+h*p*f,this._w=c*u*f+h*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}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],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],h=i+a+f;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(o-r)*p}else if(i>a&&i>f){const p=2*Math.sqrt(1+i-a-f);this._w=(u-l)/p,this._x=.25*p,this._y=(r+o)/p,this._z=(s+c)/p}else if(a>f){const p=2*Math.sqrt(1+a-i-f);this._w=(s-c)/p,this._x=(r+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+f-i-a);this._w=(o-r)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.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(Hn(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,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),f=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=o*f+this._w*h,this._x=i*f+this._x*h,this._y=r*f+this._y*h,this._z=s*f+this._z*h,this._onChangeCallback(),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}},Y=class ET{constructor(e=0,t=0,i=0){ET.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(ZS.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ZS.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,o=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])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),u=2*(a*t-s*r),f=2*(s*i-o*t);return this.x=t+l*c+o*f-a*u,this.y=i+l*u+a*c-s*f,this.z=r+l*f+s*u-o*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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,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 O0.copy(this).projectOnVector(e),this.sub(O0)}reflect(e){return this.sub(O0.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(Hn(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 O0=new Y,ZS=new mr;let oo=class{constructor(e=new Y(1/0,1/0,1/0),t=new Y(-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=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,Mr),Mr.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(Ou),Wd.subVectors(this.max,Ou),Dl.subVectors(e.a,Ou),Nl.subVectors(e.b,Ou),Ul.subVectors(e.c,Ou),po.subVectors(Nl,Dl),mo.subVectors(Ul,Nl),Sa.subVectors(Dl,Ul);let t=[0,-po.z,po.y,0,-mo.z,mo.y,0,-Sa.z,Sa.y,po.z,0,-po.x,mo.z,0,-mo.x,Sa.z,0,-Sa.x,-po.y,po.x,0,-mo.y,mo.x,0,-Sa.y,Sa.x,0];return!F0(t,Dl,Nl,Ul,Wd)||(t=[1,0,0,0,1,0,0,0,1],!F0(t,Dl,Nl,Ul,Wd))?!1:($d.crossVectors(po,mo),t=[$d.x,$d.y,$d.z],F0(t,Dl,Nl,Ul,Wd))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Mr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Mr).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:(Es[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Es[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Es[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Es[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Es[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Es[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Es[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Es[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Es),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)}};const Es=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],Mr=new Y,Gd=new oo,Dl=new Y,Nl=new Y,Ul=new Y,po=new Y,mo=new Y,Sa=new Y,Ou=new Y,Wd=new Y,$d=new Y,Ma=new Y;function F0(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Ma.fromArray(n,s);const a=r.x*Math.abs(Ma.x)+r.y*Math.abs(Ma.y)+r.z*Math.abs(Ma.z),l=e.dot(Ma),c=t.dot(Ma),u=i.dot(Ma);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const B4=new oo,Fu=new Y,k0=new Y;let gs=class{constructor(e=new Y,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):B4.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;sthis.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;Fu.subVectors(e,this.center);const t=Fu.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Fu,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):(k0.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Fu.copy(e.center).add(k0)),this.expandByPoint(Fu.copy(e.center).sub(k0))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};const ws=new Y,B0=new Y,Xd=new Y,go=new Y,z0=new Y,jd=new Y,H0=new Y;let Td=class{constructor(e=new Y,t=new Y(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,ws)),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=ws.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ws.copy(this.origin).addScaledVector(this.direction,t),ws.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){B0.copy(e).add(t).multiplyScalar(.5),Xd.copy(t).sub(e).normalize(),go.copy(this.origin).sub(B0);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Xd),a=go.dot(this.direction),l=-go.dot(Xd),c=go.lengthSq(),u=Math.abs(1-o*o);let f,h,p,g;if(u>0)if(f=o*l-a,h=o*a-l,g=s*u,f>=0)if(h>=-g)if(h<=g){const _=1/u;f*=_,h*=_,p=f*(f+o*h+2*a)+h*(o*f+h+2*l)+c}else h=s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h=-s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h<=-g?(f=Math.max(0,-(-o*s+a)),h=f>0?-s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c):h<=g?(f=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(f=Math.max(0,-(o*s+a)),h=f>0?s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c);else h=o>0?-s:s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(B0).addScaledVector(Xd,h),p}intersectSphere(e,t){ws.subVectors(e.center,this.origin);const i=ws.dot(this.direction),r=ws.dot(ws)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return 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,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,f=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,o=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o=0?(a=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||a>r)||((a>i||i!==i)&&(i=a),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,ws)!==null}intersectTriangle(e,t,i,r,s){z0.subVectors(t,e),jd.subVectors(i,e),H0.crossVectors(z0,jd);let o=this.direction.dot(H0),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;go.subVectors(this.origin,e);const l=a*this.direction.dot(jd.crossVectors(go,jd));if(l<0)return null;const c=a*this.direction.dot(z0.cross(go));if(c<0||l+c>o)return null;const u=-a*go.dot(H0);return u<0?null:this.at(u/o,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)}},dt=class vv{constructor(e,t,i,r,s,o,a,l,c,u,f,h,p,g,_,m){vv.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,o,a,l,c,u,f,h,p,g,_,m)}set(e,t,i,r,s,o,a,l,c,u,f,h,p,g,_,m){const d=this.elements;return d[0]=e,d[4]=t,d[8]=i,d[12]=r,d[1]=s,d[5]=o,d[9]=a,d[13]=l,d[2]=c,d[6]=u,d[10]=f,d[14]=h,d[3]=p,d[7]=g,d[11]=_,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 vv().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 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){const t=this.elements,i=e.elements,r=1/Ol.setFromMatrixColumn(e,0).length(),s=1/Ol.setFromMatrixColumn(e,1).length(),o=1/Ol.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]*o,t[9]=i[9]*o,t[10]=i[10]*o,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,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=o*u,p=o*f,g=a*u,_=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=p+g*c,t[5]=h-_*c,t[9]=-a*l,t[2]=_-h*c,t[6]=g+p*c,t[10]=o*l}else if(e.order==="YXZ"){const h=l*u,p=l*f,g=c*u,_=c*f;t[0]=h+_*a,t[4]=g*a-p,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=p*a-g,t[6]=_+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*u,p=l*f,g=c*u,_=c*f;t[0]=h-_*a,t[4]=-o*f,t[8]=g+p*a,t[1]=p+g*a,t[5]=o*u,t[9]=_-h*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*u,p=o*f,g=a*u,_=a*f;t[0]=l*u,t[4]=g*c-p,t[8]=h*c+_,t[1]=l*f,t[5]=_*c+h,t[9]=p*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,p=o*c,g=a*l,_=a*c;t[0]=l*u,t[4]=_-h*f,t[8]=g*f+p,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*f+g,t[10]=h-_*f}else if(e.order==="XZY"){const h=o*l,p=o*c,g=a*l,_=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=h*f+_,t[5]=o*u,t[9]=p*f-g,t[2]=g*f-p,t[6]=a*u,t[10]=_*f+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(z4,e,H4)}lookAt(e,t,i){const r=this.elements;return Fi.subVectors(e,t),Fi.lengthSq()===0&&(Fi.z=1),Fi.normalize(),_o.crossVectors(i,Fi),_o.lengthSq()===0&&(Math.abs(i.z)===1?Fi.x+=1e-4:Fi.z+=1e-4,Fi.normalize(),_o.crossVectors(i,Fi)),_o.normalize(),qd.crossVectors(Fi,_o),r[0]=_o.x,r[4]=qd.x,r[8]=Fi.x,r[1]=_o.y,r[5]=qd.y,r[9]=Fi.y,r[2]=_o.z,r[6]=qd.z,r[10]=Fi.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,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],f=i[5],h=i[9],p=i[13],g=i[2],_=i[6],m=i[10],d=i[14],x=i[3],v=i[7],y=i[11],b=i[15],w=r[0],T=r[4],C=r[8],M=r[12],S=r[1],P=r[5],k=r[9],U=r[13],N=r[2],X=r[6],z=r[10],te=r[14],L=r[3],Z=r[7],ae=r[11],fe=r[15];return s[0]=o*w+a*S+l*N+c*L,s[4]=o*T+a*P+l*X+c*Z,s[8]=o*C+a*k+l*z+c*ae,s[12]=o*M+a*U+l*te+c*fe,s[1]=u*w+f*S+h*N+p*L,s[5]=u*T+f*P+h*X+p*Z,s[9]=u*C+f*k+h*z+p*ae,s[13]=u*M+f*U+h*te+p*fe,s[2]=g*w+_*S+m*N+d*L,s[6]=g*T+_*P+m*X+d*Z,s[10]=g*C+_*k+m*z+d*ae,s[14]=g*M+_*U+m*te+d*fe,s[3]=x*w+v*S+y*N+b*L,s[7]=x*T+v*P+y*X+b*Z,s[11]=x*C+v*k+y*z+b*ae,s[15]=x*M+v*U+y*te+b*fe,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],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],h=e[10],p=e[14],g=e[3],_=e[7],m=e[11],d=e[15];return g*(+s*l*f-r*c*f-s*a*h+i*c*h+r*a*p-i*l*p)+_*(+t*l*p-t*c*h+s*o*h-r*o*p+r*c*u-s*l*u)+m*(+t*c*f-t*a*p-s*o*f+i*o*p+s*a*u-i*c*u)+d*(-r*a*u-t*l*f+t*a*h+r*o*f-i*o*h+i*l*u)}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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],h=e[10],p=e[11],g=e[12],_=e[13],m=e[14],d=e[15],x=f*m*c-_*h*c+_*l*p-a*m*p-f*l*d+a*h*d,v=g*h*c-u*m*c-g*l*p+o*m*p+u*l*d-o*h*d,y=u*_*c-g*f*c+g*a*p-o*_*p-u*a*d+o*f*d,b=g*f*l-u*_*l-g*a*h+o*_*h+u*a*m-o*f*m,w=t*x+i*v+r*y+s*b;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/w;return e[0]=x*T,e[1]=(_*h*s-f*m*s-_*r*p+i*m*p+f*r*d-i*h*d)*T,e[2]=(a*m*s-_*l*s+_*r*c-i*m*c-a*r*d+i*l*d)*T,e[3]=(f*l*s-a*h*s-f*r*c+i*h*c+a*r*p-i*l*p)*T,e[4]=v*T,e[5]=(u*m*s-g*h*s+g*r*p-t*m*p-u*r*d+t*h*d)*T,e[6]=(g*l*s-o*m*s-g*r*c+t*m*c+o*r*d-t*l*d)*T,e[7]=(o*h*s-u*l*s+u*r*c-t*h*c-o*r*p+t*l*p)*T,e[8]=y*T,e[9]=(g*f*s-u*_*s-g*i*p+t*_*p+u*i*d-t*f*d)*T,e[10]=(o*_*s-g*a*s+g*i*c-t*_*c-o*i*d+t*a*d)*T,e[11]=(u*a*s-o*f*s-u*i*c+t*f*c+o*i*p-t*a*p)*T,e[12]=b*T,e[13]=(u*_*r-g*f*r+g*i*h-t*_*h-u*i*m+t*f*m)*T,e[14]=(g*a*r-o*_*r-g*i*l+t*_*l+o*i*m-t*a*m)*T,e[15]=(o*f*r-u*a*r+u*i*l-t*f*l-o*i*h+t*a*h)*T,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,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,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,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,h=s*c,p=s*u,g=s*f,_=o*u,m=o*f,d=a*f,x=l*c,v=l*u,y=l*f,b=i.x,w=i.y,T=i.z;return r[0]=(1-(_+d))*b,r[1]=(p+y)*b,r[2]=(g-v)*b,r[3]=0,r[4]=(p-y)*w,r[5]=(1-(h+d))*w,r[6]=(m+x)*w,r[7]=0,r[8]=(g+v)*T,r[9]=(m-x)*T,r[10]=(1-(h+_))*T,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;let s=Ol.set(r[0],r[1],r[2]).length();const o=Ol.set(r[4],r[5],r[6]).length(),a=Ol.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Er.copy(this);const c=1/s,u=1/o,f=1/a;return Er.elements[0]*=c,Er.elements[1]*=c,Er.elements[2]*=c,Er.elements[4]*=u,Er.elements[5]*=u,Er.elements[6]*=u,Er.elements[8]*=f,Er.elements[9]*=f,Er.elements[10]*=f,t.setFromRotationMatrix(Er),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Gs){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),f=(t+e)/(t-e),h=(i+r)/(i-r);let p,g;if(a===Gs)p=-(o+s)/(o-s),g=-2*o*s/(o-s);else if(a===Zp)p=-o/(o-s),g=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Gs){const l=this.elements,c=1/(t-e),u=1/(i-r),f=1/(o-s),h=(t+e)*c,p=(i+r)*u;let g,_;if(a===Gs)g=(o+s)*f,_=-2*f;else if(a===Zp)g=s*f,_=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[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 Ol=new Y,Er=new dt,z4=new Y(0,0,0),H4=new Y(1,1,1),_o=new Y,qd=new Y,Fi=new Y,QS=new dt,JS=new mr;let ca=class wT{constructor(e=0,t=0,i=0,r=wT.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],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],h=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(Hn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Hn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Hn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Hn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Hn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-Hn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return QS.makeRotationFromQuaternion(e),this.setFromRotationMatrix(QS,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return JS.setFromEuler(this),this.setFromQuaternion(JS,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}};ca.DEFAULT_ORDER="XYZ";let TT=class{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),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.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?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 a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),f.length>0&&(i.shapes=f),h.length>0&&(i.skeletons=h),p.length>0&&(i.animations=p),g.length>0&&(i.nodes=g)}return i.object=r,i;function o(a){const l=[];for(const c in a){const u=a[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),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){wr.subVectors(r,t),As.subVectors(i,t),G0.subVectors(e,t);const o=wr.dot(wr),a=wr.dot(As),l=wr.dot(G0),c=As.dot(As),u=As.dot(G0),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const h=1/f,p=(c*l-a*u)*h,g=(o*u-a*l)*h;return s.set(1-p-g,g,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,bs)===null?!1:bs.x>=0&&bs.y>=0&&bs.x+bs.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,bs)===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,bs.x),l.addScaledVector(o,bs.y),l.addScaledVector(a,bs.z),l)}static getInterpolatedAttribute(e,t,i,r,s,o){return j0.setScalar(0),q0.setScalar(0),Y0.setScalar(0),j0.fromBufferAttribute(e,t),q0.fromBufferAttribute(e,i),Y0.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(j0,s.x),o.addScaledVector(q0,s.y),o.addScaledVector(Y0,s.z),o}static isFrontFacing(e,t,i,r){return wr.subVectors(i,t),As.subVectors(e,t),wr.cross(As).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 wr.subVectors(this.c,this.b),As.subVectors(this.a,this.b),wr.cross(As).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return dc.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return dc.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return dc.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return dc.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return dc.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 o,a;Bl.subVectors(r,i),zl.subVectors(s,i),W0.subVectors(e,i);const l=Bl.dot(W0),c=zl.dot(W0);if(l<=0&&c<=0)return t.copy(i);$0.subVectors(e,r);const u=Bl.dot($0),f=zl.dot($0);if(u>=0&&f<=u)return t.copy(r);const h=l*f-u*c;if(h<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(Bl,o);X0.subVectors(e,s);const p=Bl.dot(X0),g=zl.dot(X0);if(g>=0&&p<=g)return t.copy(s);const _=p*c-l*g;if(_<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(i).addScaledVector(zl,a);const m=u*g-p*f;if(m<=0&&f-u>=0&&p-g>=0)return sM.subVectors(s,r),a=(f-u)/(f-u+(p-g)),t.copy(r).addScaledVector(sM,a);const d=1/(m+_+h);return o=_*d,a=h*d,t.copy(i).addScaledVector(Bl,o).addScaledVector(zl,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};const AT={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},vo={h:0,s:0,l:0},Kd={h:0,s:0,l:0};function K0(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}let tt=class{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=En){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,wt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=wt.workingColorSpace){return this.r=e,this.g=t,this.b=i,wt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=wt.workingColorSpace){if(e=Bx(e,1),t=Hn(t,0,1),i=Hn(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=K0(o,s,e+1/3),this.g=K0(o,s,e),this.b=K0(o,s,e-1/3)}return wt.toWorkingColorSpace(this,r),this}setStyle(e,t=En){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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(a))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(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=En){const i=AT[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.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=Ys(e.r),this.g=Ys(e.g),this.b=Ys(e.b),this}copyLinearToSRGB(e){return this.r=Fc(e.r),this.g=Fc(e.g),this.b=Fc(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=En){return wt.fromWorkingColorSpace(Xn.copy(this),e),Math.round(Hn(Xn.r*255,0,255))*65536+Math.round(Hn(Xn.g*255,0,255))*256+Math.round(Hn(Xn.b*255,0,255))}getHexString(e=En){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=wt.workingColorSpace){wt.fromWorkingColorSpace(Xn.copy(this),t);const i=Xn.r,r=Xn.g,s=Xn.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case i:l=(r-s)/f+(r0!=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){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.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.6,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.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!==Uc&&(i.blending=this.blending),this.side!==Wr&&(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!==D_&&(i.blendSrc=this.blendSrc),this.blendDst!==N_&&(i.blendDst=this.blendDst),this.blendEquation!==qa&&(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!==Yc&&(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!==VS&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ll&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Ll&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Ll&&(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.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 o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}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.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++}onBuild(){console.warn("Material: onBuild() has been removed.")}},Or=class extends cs{static get type(){return"MeshBasicMaterial"}constructor(e){super(),this.isMeshBasicMaterial=!0,this.color=new tt(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 ca,this.combine=tT,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 gn=new Y,Zd=new lt;let di=class{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=_v,this.updateRanges=[],this.gpuType=Ur,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;rt.count&&console.warn("THREE.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 oo);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Y(-1/0,-1/0,-1/0),new Y(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i0&&(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 f=0,h=c.length;f0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),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(t));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=[],f=s[c];for(let h=0,p=f.length;h0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(oM.copy(s).invert(),Ea.copy(e.ray).applyMatrix4(oM),!(i.boundingBox!==null&&Ea.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Ea)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,h=s.groups,p=s.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,_=h.length;g<_;g++){const m=h[g],d=o[m.materialIndex],x=Math.max(m.start,p.start),v=Math.min(a.count,Math.min(m.start+m.count,p.start+p.count));for(let y=x,b=v;yt.far?null:{distance:c,point:ih.clone(),object:n}}function rh(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,Jd),n.getVertexPosition(l,eh),n.getVertexPosition(c,th);const u=q4(n,e,t,i,Jd,eh,th,lM);if(u){const f=new Y;Bu.getBarycoord(lM,Jd,eh,th,f),r&&(u.uv=Bu.getInterpolatedAttribute(r,a,l,c,f,new lt)),s&&(u.uv1=Bu.getInterpolatedAttribute(s,a,l,c,f,new lt)),o&&(u.normal=Bu.getInterpolatedAttribute(o,a,l,c,f,new Y),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new Y,materialIndex:0};Bu.getNormal(Jd,eh,th,h.normal),u.face=h,u.barycoord=f}return u}let zx=class PT extends xr{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],f=[];let h=0,p=0;g("z","y","x",-1,-1,i,t,e,o,s,0),g("z","y","x",1,-1,i,t,-e,o,s,1),g("x","z","y",1,1,e,i,t,r,o,2),g("x","z","y",1,-1,e,i,-t,r,o,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(f,2));function g(_,m,d,x,v,y,b,w,T,C,M){const S=y/T,P=b/C,k=y/2,U=b/2,N=w/2,X=T+1,z=C+1;let te=0,L=0;const Z=new Y;for(let ae=0;ae0?1:-1,u.push(Z.x,Z.y,Z.z),f.push(Me/T),f.push(1-ae/C),te+=1}}for(let ae=0;ae0&&(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}},IT=class extends fn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new dt,this.projectionMatrix=new dt,this.projectionMatrixInverse=new dt,this.coordinateSystem=Gs}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.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}};const xo=new Y,cM=new lt,uM=new lt;let Jn=class extends IT{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=eu*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Rf*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return eu*2*Math.atan(Math.tan(Rf*.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){xo.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(xo.x,xo.y).multiplyScalar(-e/xo.z),xo.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(xo.x,xo.y).multiplyScalar(-e/xo.z)}getViewSize(e,t){return this.getViewBounds(e,cM,uM),t.subVectors(uM,cM)}setViewOffset(e,t,i,r,s,o){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=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Rf*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),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}};const Vl=-90,Gl=1;let Q4=class extends fn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Jn(Vl,Gl,e,t);r.layers=this.layers,this.add(r);const s=new Jn(Vl,Gl,e,t);s.layers=this.layers,this.add(s);const o=new Jn(Vl,Gl,e,t);o.layers=this.layers,this.add(o);const a=new Jn(Vl,Gl,e,t);a.layers=this.layers,this.add(a);const l=new Jn(Vl,Gl,e,t);l.layers=this.layers,this.add(l);const c=new Jn(Vl,Gl,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Gs)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),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Zp)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),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.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,o,a,l,c,u]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=_,e.setRenderTarget(i,5,r),e.render(t,u),e.setRenderTarget(f,h,p),e.xr.enabled=g,i.texture.needsPMREMUpdate=!0}},DT=class extends mi{constructor(e,t,i,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Kc,super(e,t,i,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},J4=class extends la{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 DT(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:$i}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:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},r=new zx(5,5,5),s=new Ki({name:"CubemapFromEquirect",uniforms:tu(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ri,blending:Yo});s.uniforms.tEquirect.value=t;const o=new yn(r,s),a=t.minFilter;return t.minFilter===os&&(t.minFilter=$i),new Q4(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}};const J0=new Y,e5=new Y,t5=new xt;let ui=class{constructor(e=new Y(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=J0.subVectors(i,t).cross(e5.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(J0),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||t5.getNormalMatrix(e),r=this.coplanarPoint(J0).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 wa=new gs,sh=new Y;let Hx=class{constructor(e=new ui,t=new ui,i=new ui,r=new ui,s=new ui,o=new ui){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),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=Gs){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],f=r[6],h=r[7],p=r[8],g=r[9],_=r[10],m=r[11],d=r[12],x=r[13],v=r[14],y=r[15];if(i[0].setComponents(l-s,h-c,m-p,y-d).normalize(),i[1].setComponents(l+s,h+c,m+p,y+d).normalize(),i[2].setComponents(l+o,h+u,m+g,y+x).normalize(),i[3].setComponents(l-o,h-u,m-g,y-x).normalize(),i[4].setComponents(l-a,h-f,m-_,y-v).normalize(),t===Gs)i[5].setComponents(l+a,h+f,m+_,y+v).normalize();else if(t===Zp)i[5].setComponents(a,f,_,v).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(),wa.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),wa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(wa)}intersectsSprite(e){return wa.center.set(0,0,0),wa.radius=.7071067811865476,wa.applyMatrix4(e.matrixWorld),this.intersectsSphere(wa)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,sh.y=r.normal.y>0?e.max.y:e.min.y,sh.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(sh)<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)}};function NT(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),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 n5(n){const e=new WeakMap;function t(a,l){const c=a.array,u=a.usage,f=c.byteLength,h=n.createBuffer();n.bindBuffer(l,h),n.bufferData(l,c,u),a.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function i(a,l,c){const u=l.array,f=l.updateRanges;if(n.bindBuffer(c,a),f.length===0)n.bufferSubData(c,0,u);else{f.sort((p,g)=>p.start-g.start);let h=0;for(let p=1;p 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,x5=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,y5=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,S5=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,M5=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,E5=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,w5=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec3 vColor; +#endif`,T5=`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif +#ifdef USE_BATCHING_COLOR + vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); + vColor.xyz *= batchingColor.xyz; +#endif`,A5=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,b5=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,R5=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,C5=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,P5=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,L5=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,I5=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,D5="gl_FragColor = linearToOutputTexel( gl_FragColor );",N5=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + 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 ); +}`,U5=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,O5=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,F5=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,k5=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,B5=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,z5=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,H5=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,V5=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,G5=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,W5=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,$5=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,X5=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,j5=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,q5=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,Y5=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,K5=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,Z5=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Q5=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,J5=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,eL=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,tL=`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return saturate(v); + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); +} +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + vec4 r = roughness * c0 + c1; + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + return fab; +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,nL=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,iL=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,rL=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,sL=`#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,oL=`#if defined( USE_LOGDEPTHBUF ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,aL=`#ifdef USE_LOGDEPTHBUF + varying float vFragDepth; + varying float vIsPerspective; +#endif`,lL=`#ifdef USE_LOGDEPTHBUF + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,cL=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,uL=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,fL=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,dL=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,hL=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,pL=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,mL=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,gL=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,_L=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,vL=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,xL=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,yL=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,SL=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,ML=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,EL=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,wL=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,TL=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,AL=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,bL=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,RL=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,CL=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,PL=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,LL=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + return depth * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * depth - far ); +}`,IL=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,DL=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,NL=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,UL=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,OL=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,FL=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,kL=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + + float lightToPositionLength = length( lightToPosition ); + if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { + float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + shadow = ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } +#endif`,BL=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,zL=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,HL=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,VL=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,GL=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,WL=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,$L=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,XL=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,jL=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,qL=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,YL=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,KL=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,ZL=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + + #else + + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,QL=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,JL=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,eI=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,tI=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const nI=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,iI=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,rI=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,sI=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,oI=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,aI=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,lI=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,cI=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,uI=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,fI=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,dI=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,hI=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,pI=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,mI=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,gI=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,_I=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,vI=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,xI=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,yI=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,SI=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,MI=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,EI=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,wI=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,TI=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,AI=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,bI=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,RI=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,CI=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,PI=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,LI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,II=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,DI=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,NI=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,UI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,pt={alphahash_fragment:i5,alphahash_pars_fragment:r5,alphamap_fragment:s5,alphamap_pars_fragment:o5,alphatest_fragment:a5,alphatest_pars_fragment:l5,aomap_fragment:c5,aomap_pars_fragment:u5,batching_pars_vertex:f5,batching_vertex:d5,begin_vertex:h5,beginnormal_vertex:p5,bsdfs:m5,iridescence_fragment:g5,bumpmap_pars_fragment:_5,clipping_planes_fragment:v5,clipping_planes_pars_fragment:x5,clipping_planes_pars_vertex:y5,clipping_planes_vertex:S5,color_fragment:M5,color_pars_fragment:E5,color_pars_vertex:w5,color_vertex:T5,common:A5,cube_uv_reflection_fragment:b5,defaultnormal_vertex:R5,displacementmap_pars_vertex:C5,displacementmap_vertex:P5,emissivemap_fragment:L5,emissivemap_pars_fragment:I5,colorspace_fragment:D5,colorspace_pars_fragment:N5,envmap_fragment:U5,envmap_common_pars_fragment:O5,envmap_pars_fragment:F5,envmap_pars_vertex:k5,envmap_physical_pars_fragment:Y5,envmap_vertex:B5,fog_vertex:z5,fog_pars_vertex:H5,fog_fragment:V5,fog_pars_fragment:G5,gradientmap_pars_fragment:W5,lightmap_pars_fragment:$5,lights_lambert_fragment:X5,lights_lambert_pars_fragment:j5,lights_pars_begin:q5,lights_toon_fragment:K5,lights_toon_pars_fragment:Z5,lights_phong_fragment:Q5,lights_phong_pars_fragment:J5,lights_physical_fragment:eL,lights_physical_pars_fragment:tL,lights_fragment_begin:nL,lights_fragment_maps:iL,lights_fragment_end:rL,logdepthbuf_fragment:sL,logdepthbuf_pars_fragment:oL,logdepthbuf_pars_vertex:aL,logdepthbuf_vertex:lL,map_fragment:cL,map_pars_fragment:uL,map_particle_fragment:fL,map_particle_pars_fragment:dL,metalnessmap_fragment:hL,metalnessmap_pars_fragment:pL,morphinstance_vertex:mL,morphcolor_vertex:gL,morphnormal_vertex:_L,morphtarget_pars_vertex:vL,morphtarget_vertex:xL,normal_fragment_begin:yL,normal_fragment_maps:SL,normal_pars_fragment:ML,normal_pars_vertex:EL,normal_vertex:wL,normalmap_pars_fragment:TL,clearcoat_normal_fragment_begin:AL,clearcoat_normal_fragment_maps:bL,clearcoat_pars_fragment:RL,iridescence_pars_fragment:CL,opaque_fragment:PL,packing:LL,premultiplied_alpha_fragment:IL,project_vertex:DL,dithering_fragment:NL,dithering_pars_fragment:UL,roughnessmap_fragment:OL,roughnessmap_pars_fragment:FL,shadowmap_pars_fragment:kL,shadowmap_pars_vertex:BL,shadowmap_vertex:zL,shadowmask_pars_fragment:HL,skinbase_vertex:VL,skinning_pars_vertex:GL,skinning_vertex:WL,skinnormal_vertex:$L,specularmap_fragment:XL,specularmap_pars_fragment:jL,tonemapping_fragment:qL,tonemapping_pars_fragment:YL,transmission_fragment:KL,transmission_pars_fragment:ZL,uv_pars_fragment:QL,uv_pars_vertex:JL,uv_vertex:eI,worldpos_vertex:tI,background_vert:nI,background_frag:iI,backgroundCube_vert:rI,backgroundCube_frag:sI,cube_vert:oI,cube_frag:aI,depth_vert:lI,depth_frag:cI,distanceRGBA_vert:uI,distanceRGBA_frag:fI,equirect_vert:dI,equirect_frag:hI,linedashed_vert:pI,linedashed_frag:mI,meshbasic_vert:gI,meshbasic_frag:_I,meshlambert_vert:vI,meshlambert_frag:xI,meshmatcap_vert:yI,meshmatcap_frag:SI,meshnormal_vert:MI,meshnormal_frag:EI,meshphong_vert:wI,meshphong_frag:TI,meshphysical_vert:AI,meshphysical_frag:bI,meshtoon_vert:RI,meshtoon_frag:CI,points_vert:PI,points_frag:LI,shadow_vert:II,shadow_frag:DI,sprite_vert:NI,sprite_frag:UI},ze={common:{diffuse:{value:new tt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new lt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new tt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new tt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new tt(16777215)},opacity:{value:1},center:{value:new lt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},ar={basic:{uniforms:oi([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.fog]),vertexShader:pt.meshbasic_vert,fragmentShader:pt.meshbasic_frag},lambert:{uniforms:oi([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new tt(0)}}]),vertexShader:pt.meshlambert_vert,fragmentShader:pt.meshlambert_frag},phong:{uniforms:oi([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new tt(0)},specular:{value:new tt(1118481)},shininess:{value:30}}]),vertexShader:pt.meshphong_vert,fragmentShader:pt.meshphong_frag},standard:{uniforms:oi([ze.common,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.roughnessmap,ze.metalnessmap,ze.fog,ze.lights,{emissive:{value:new tt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:pt.meshphysical_vert,fragmentShader:pt.meshphysical_frag},toon:{uniforms:oi([ze.common,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.gradientmap,ze.fog,ze.lights,{emissive:{value:new tt(0)}}]),vertexShader:pt.meshtoon_vert,fragmentShader:pt.meshtoon_frag},matcap:{uniforms:oi([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,{matcap:{value:null}}]),vertexShader:pt.meshmatcap_vert,fragmentShader:pt.meshmatcap_frag},points:{uniforms:oi([ze.points,ze.fog]),vertexShader:pt.points_vert,fragmentShader:pt.points_frag},dashed:{uniforms:oi([ze.common,ze.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:pt.linedashed_vert,fragmentShader:pt.linedashed_frag},depth:{uniforms:oi([ze.common,ze.displacementmap]),vertexShader:pt.depth_vert,fragmentShader:pt.depth_frag},normal:{uniforms:oi([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,{opacity:{value:1}}]),vertexShader:pt.meshnormal_vert,fragmentShader:pt.meshnormal_frag},sprite:{uniforms:oi([ze.sprite,ze.fog]),vertexShader:pt.sprite_vert,fragmentShader:pt.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:pt.background_vert,fragmentShader:pt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:pt.backgroundCube_vert,fragmentShader:pt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:pt.cube_vert,fragmentShader:pt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:pt.equirect_vert,fragmentShader:pt.equirect_frag},distanceRGBA:{uniforms:oi([ze.common,ze.displacementmap,{referencePosition:{value:new Y},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:pt.distanceRGBA_vert,fragmentShader:pt.distanceRGBA_frag},shadow:{uniforms:oi([ze.lights,ze.fog,{color:{value:new tt(0)},opacity:{value:1}}]),vertexShader:pt.shadow_vert,fragmentShader:pt.shadow_frag}};ar.physical={uniforms:oi([ar.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new lt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new tt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new lt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new tt(0)},specularColor:{value:new tt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new lt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:pt.meshphysical_vert,fragmentShader:pt.meshphysical_frag};const oh={r:0,b:0,g:0},Ta=new ca,OI=new dt;function FI(n,e,t,i,r,s,o){const a=new tt(0);let l=s===!0?0:1,c,u,f=null,h=0,p=null;function g(x){let v=x.isScene===!0?x.background:null;return v&&v.isTexture&&(v=(x.backgroundBlurriness>0?t:e).get(v)),v}function _(x){let v=!1;const y=g(x);y===null?d(a,l):y&&y.isColor&&(d(y,1),v=!0);const b=n.xr.getEnvironmentBlendMode();b==="additive"?i.buffers.color.setClear(0,0,0,1,o):b==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||v)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function m(x,v){const y=g(v);y&&(y.isCubeTexture||y.mapping===$m)?(u===void 0&&(u=new yn(new zx(1,1,1),new Ki({name:"BackgroundCubeMaterial",uniforms:tu(ar.backgroundCube.uniforms),vertexShader:ar.backgroundCube.vertexShader,fragmentShader:ar.backgroundCube.fragmentShader,side:Ri,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(b,w,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Ta.copy(v.backgroundRotation),Ta.x*=-1,Ta.y*=-1,Ta.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Ta.y*=-1,Ta.z*=-1),u.material.uniforms.envMap.value=y,u.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(OI.makeRotationFromEuler(Ta)),u.material.toneMapped=wt.getTransfer(y.colorSpace)!==kt,(f!==y||h!==y.version||p!==n.toneMapping)&&(u.material.needsUpdate=!0,f=y,h=y.version,p=n.toneMapping),u.layers.enableAll(),x.unshift(u,u.geometry,u.material,0,0,null)):y&&y.isTexture&&(c===void 0&&(c=new yn(new Ad(2,2),new Ki({name:"BackgroundMaterial",uniforms:tu(ar.background.uniforms),vertexShader:ar.background.vertexShader,fragmentShader:ar.background.fragmentShader,side:Wr,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.toneMapped=wt.getTransfer(y.colorSpace)!==kt,y.matrixAutoUpdate===!0&&y.updateMatrix(),c.material.uniforms.uvTransform.value.copy(y.matrix),(f!==y||h!==y.version||p!==n.toneMapping)&&(c.material.needsUpdate=!0,f=y,h=y.version,p=n.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null))}function d(x,v){x.getRGB(oh,LT(n)),i.buffers.color.setClear(oh.r,oh.g,oh.b,v,o)}return{getClearColor:function(){return a},setClearColor:function(x,v=1){a.set(x),l=v,d(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,d(a,l)},render:_,addToRenderList:m}}function kI(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=h(null);let s=r,o=!1;function a(S,P,k,U,N){let X=!1;const z=f(U,k,P);s!==z&&(s=z,c(s.object)),X=p(S,U,k,N),X&&g(S,U,k,N),N!==null&&e.update(N,n.ELEMENT_ARRAY_BUFFER),(X||o)&&(o=!1,y(S,P,k,U),N!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(N).buffer))}function l(){return n.createVertexArray()}function c(S){return n.bindVertexArray(S)}function u(S){return n.deleteVertexArray(S)}function f(S,P,k){const U=k.wireframe===!0;let N=i[S.id];N===void 0&&(N={},i[S.id]=N);let X=N[P.id];X===void 0&&(X={},N[P.id]=X);let z=X[U];return z===void 0&&(z=h(l()),X[U]=z),z}function h(S){const P=[],k=[],U=[];for(let N=0;N=0){const ae=N[L];let fe=X[L];if(fe===void 0&&(L==="instanceMatrix"&&S.instanceMatrix&&(fe=S.instanceMatrix),L==="instanceColor"&&S.instanceColor&&(fe=S.instanceColor)),ae===void 0||ae.attribute!==fe||fe&&ae.data!==fe.data)return!0;z++}return s.attributesNum!==z||s.index!==U}function g(S,P,k,U){const N={},X=P.attributes;let z=0;const te=k.getAttributes();for(const L in te)if(te[L].location>=0){let ae=X[L];ae===void 0&&(L==="instanceMatrix"&&S.instanceMatrix&&(ae=S.instanceMatrix),L==="instanceColor"&&S.instanceColor&&(ae=S.instanceColor));const fe={};fe.attribute=ae,ae&&ae.data&&(fe.data=ae.data),N[L]=fe,z++}s.attributes=N,s.attributesNum=z,s.index=U}function _(){const S=s.newAttributes;for(let P=0,k=S.length;P=0){let Z=N[te];if(Z===void 0&&(te==="instanceMatrix"&&S.instanceMatrix&&(Z=S.instanceMatrix),te==="instanceColor"&&S.instanceColor&&(Z=S.instanceColor)),Z!==void 0){const ae=Z.normalized,fe=Z.itemSize,Me=e.get(Z);if(Me===void 0)continue;const Ve=Me.buffer,$=Me.type,oe=Me.bytesPerElement,me=$===n.INT||$===n.UNSIGNED_INT||Z.gpuType===Ix;if(Z.isInterleavedBufferAttribute){const de=Z.data,be=de.stride,Le=Z.offset;if(de.isInstancedInterleavedBuffer){for(let ke=0;ke0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";T="mediump"}return T==="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&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const f=t.logarithmicDepthBuffer===!0,h=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),p=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),g=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=n.getParameter(n.MAX_TEXTURE_SIZE),m=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),d=n.getParameter(n.MAX_VERTEX_ATTRIBS),x=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),v=n.getParameter(n.MAX_VARYING_VECTORS),y=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),b=g>0,w=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:h,maxTextures:p,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:d,maxVertexUniforms:x,maxVaryings:v,maxFragmentUniforms:y,vertexTextures:b,maxSamples:w}}function HI(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new ui,a=new xt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const p=f.length!==0||h||i!==0||r;return r=h,i=f.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){t=u(f,h,0)},this.setState=function(f,h,p){const g=f.clippingPlanes,_=f.clipIntersection,m=f.clipShadows,d=n.get(f);if(!r||g===null||g.length===0||s&&!m)s?u(null):c();else{const x=s?0:i,v=x*4;let y=d.clippingState||null;l.value=y,y=u(g,h,v,p);for(let b=0;b!==v;++b)y[b]=t[b];d.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=x}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(f,h,p,g){const _=f!==null?f.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const d=p+_*4,x=h.matrixWorldInverse;a.getNormalMatrix(x),(m===null||m.length0){const c=new J4(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}let Vx=class extends IT{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=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=o,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,o){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=o,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,o=i+e,a=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,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),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 pc=4,fM=[.125,.215,.35,.446,.526,.582],Ya=20,eg=new Vx,dM=new tt;let tg=null,ng=0,ig=0,rg=!1;const Ha=(1+Math.sqrt(5))/2,Wl=1/Ha,hM=[new Y(-Ha,Wl,0),new Y(Ha,Wl,0),new Y(-Wl,0,Ha),new Y(Wl,0,Ha),new Y(0,Ha,-Wl),new Y(0,Ha,Wl),new Y(-1,1,-1),new Y(1,1,-1),new Y(-1,1,1),new Y(1,1,1)];let pM=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){tg=this._renderer.getRenderTarget(),ng=this._renderer.getActiveCubeFace(),ig=this._renderer.getActiveMipmapLevel(),rg=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=_M(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=gM(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.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._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?v:0,v,v),u.setRenderTarget(r),_&&u.render(g,a),u.render(e,a)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=h,u.autoClear=f,e.background=m}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Kc||e.mapping===Zc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=_M()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=gM());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new yn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;ah(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,eg)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sYa&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Ya}`);const d=[];let x=0;for(let T=0;Tv-pc?r-v+pc:0),w=4*(this._cubeSize-y);ah(t,b,w,3*y,2*y),l.setRenderTarget(t),l.render(f,eg)}};function GI(n){const e=[],t=[],i=[];let r=n;const s=n-pc+1+fM.length;for(let o=0;on-pc?l=fM[o-n+pc-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,f=1+c,h=[u,u,f,u,f,f,u,u,f,f,u,f],p=6,g=6,_=3,m=2,d=1,x=new Float32Array(_*g*p),v=new Float32Array(m*g*p),y=new Float32Array(d*g*p);for(let w=0;w2?0:-1,M=[T,C,0,T+2/3,C,0,T+2/3,C+1,0,T,C,0,T+2/3,C+1,0,T,C+1,0];x.set(M,_*g*w),v.set(h,m*g*w);const S=[w,w,w,w,w,w];y.set(S,d*g*w)}const b=new xr;b.setAttribute("position",new di(x,_)),b.setAttribute("uv",new di(v,m)),b.setAttribute("faceIndex",new di(y,d)),e.push(b),r>pc&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function mM(n,e,t){const i=new la(n,e,t);return i.texture.mapping=$m,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function ah(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function WI(n,e,t){const i=new Float32Array(Ya),r=new Y(0,1,0);return new Ki({name:"SphericalGaussianBlur",defines:{n:Ya,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:Gx(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:Yo,depthTest:!1,depthWrite:!1})}function gM(){return new Ki({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Gx(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:Yo,depthTest:!1,depthWrite:!1})}function _M(){return new Ki({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Gx(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:Yo,depthTest:!1,depthWrite:!1})}function Gx(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function $I(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===V_||l===G_,u=l===Kc||l===Zc;if(c||u){let f=e.get(a);const h=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==h)return t===null&&(t=new pM(n)),f=c?t.fromEquirectangular(a,f):t.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const p=a.image;return c&&p&&p.height>0||u&&p&&r(p)?(t===null&&(t=new pM(n)),f=c?t.fromEquirectangular(a):t.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(b=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const w=new Float32Array(y*b*4*f),T=new MT(w,y,b,f);T.type=Ur,T.needsUpdate=!0;const C=v*4;for(let S=0;S0)return n;const r=e*t;let s=xM[r];if(s===void 0&&(s=new Float32Array(r),xM[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function An(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` +`)}const AM=new xt;function $D(n){wt._getMatrix(AM,wt.workingColorSpace,n);const e=`mat3( ${AM.elements.map(t=>t.toFixed(4))} )`;switch(wt.getTransfer(n)){case Xm:return[e,"LinearTransferOETF"];case kt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function bM(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` + +`+r+` + +`+WD(n.getShaderSource(e),o)}else return r}function XD(n,e){const t=$D(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}function jD(n,e){let t;switch(e){case qP:t="Linear";break;case YP:t="Reinhard";break;case KP:t="Cineon";break;case ZP:t="ACESFilmic";break;case JP:t="AgX";break;case e4:t="Neutral";break;case QP:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const lh=new Y;function qD(){wt.getLuminanceCoefficients(lh);const n=lh.x.toFixed(4),e=lh.y.toFixed(4),t=lh.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function YD(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(_f).join(` +`)}function KD(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` +`)}function ZD(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function yv(n){return n.replace(QD,e6)}const JD=new Map;function e6(n,e){let t=pt[e];if(t===void 0){const i=JD.get(e);if(i!==void 0)t=pt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return yv(t)}const t6=/#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 PM(n){return n.replace(t6,n6)}function n6(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(m+=` +`),d=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(_f).join(` +`),d.length>0&&(d+=` +`)):(m=[LM(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_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","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",` +`].filter(_f).join(` +`),d=[LM(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 "+f:"",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||t.batchingColor?"#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.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_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ko?"#define TONE_MAPPING":"",t.toneMapping!==Ko?pt.tonemapping_pars_fragment:"",t.toneMapping!==Ko?jD("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",pt.colorspace_pars_fragment,XD("linearToOutputTexel",t.outputColorSpace),qD(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(_f).join(` +`)),o=yv(o),o=RM(o,t),o=CM(o,t),a=yv(a),a=RM(a,t),a=CM(a,t),o=PM(o),a=PM(a),t.isRawShaderMaterial!==!0&&(x=`#version 300 es +`,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+m,d=["#define varying in",t.glslVersion===GS?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===GS?"":"#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(` +`)+` +`+d);const v=x+m+o,y=x+d+a,b=TM(r,r.VERTEX_SHADER,v),w=TM(r,r.FRAGMENT_SHADER,y);r.attachShader(_,b),r.attachShader(_,w),t.index0AttributeName!==void 0?r.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function T(P){if(n.debug.checkShaderErrors){const k=r.getProgramInfoLog(_).trim(),U=r.getShaderInfoLog(b).trim(),N=r.getShaderInfoLog(w).trim();let X=!0,z=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(X=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,_,b,w);else{const te=bM(r,b,"vertex"),L=bM(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+` + +Material Name: `+P.name+` +Material Type: `+P.type+` + +Program Info Log: `+k+` +`+te+` +`+L)}else k!==""?console.warn("THREE.WebGLProgram: Program Info Log:",k):(U===""||N==="")&&(z=!1);z&&(P.diagnostics={runnable:X,programLog:k,vertexShader:{log:U,prefix:m},fragmentShader:{log:N,prefix:d}})}r.deleteShader(b),r.deleteShader(w),C=new Mp(r,_),M=ZD(r,_)}let C;this.getUniforms=function(){return C===void 0&&T(this),C};let M;this.getAttributes=function(){return M===void 0&&T(this),M};let S=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&&(S=r.getProgramParameter(_,VD)),S},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=GD++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=b,this.fragmentShader=w,this}let c6=0,u6=class{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),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.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 f6(e),t.set(e,i)),i}},f6=class{constructor(e){this.id=c6++,this.code=e,this.usedTimes=0}};function d6(n,e,t,i,r,s,o){const a=new TT,l=new u6,c=new Set,u=[],f=r.logarithmicDepthBuffer,h=r.vertexTextures;let p=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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 _(M){return c.add(M),M===0?"uv":`uv${M}`}function m(M,S,P,k,U){const N=k.fog,X=U.geometry,z=M.isMeshStandardMaterial?k.environment:null,te=(M.isMeshStandardMaterial?t:e).get(M.envMap||z),L=te&&te.mapping===$m?te.image.height:null,Z=g[M.type];M.precision!==null&&(p=r.getMaxPrecision(M.precision),p!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",p,"instead."));const ae=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,fe=ae!==void 0?ae.length:0;let Me=0;X.morphAttributes.position!==void 0&&(Me=1),X.morphAttributes.normal!==void 0&&(Me=2),X.morphAttributes.color!==void 0&&(Me=3);let Ve,$,oe,me;if(Z){const ft=ar[Z];Ve=ft.vertexShader,$=ft.fragmentShader}else Ve=M.vertexShader,$=M.fragmentShader,l.update(M),oe=l.getVertexShaderID(M),me=l.getFragmentShaderID(M);const de=n.getRenderTarget(),be=n.state.buffers.depth.getReversed(),Le=U.isInstancedMesh===!0,ke=U.isBatchedMesh===!0,Qe=!!M.map,V=!!M.matcap,ot=!!te,ee=!!M.aoMap,at=!!M.lightMap,Ne=!!M.bumpMap,Ze=!!M.normalMap,Ie=!!M.displacementMap,We=!!M.emissiveMap,B=!!M.metalnessMap,E=!!M.roughnessMap,A=M.anisotropy>0,F=M.clearcoat>0,W=M.dispersion>0,j=M.iridescence>0,le=M.sheen>0,pe=M.transmission>0,ce=A&&!!M.anisotropyMap,Ee=F&&!!M.clearcoatMap,ve=F&&!!M.clearcoatNormalMap,ue=F&&!!M.clearcoatRoughnessMap,Re=j&&!!M.iridescenceMap,Pe=j&&!!M.iridescenceThicknessMap,ye=le&&!!M.sheenColorMap,Se=le&&!!M.sheenRoughnessMap,Be=!!M.specularMap,je=!!M.specularColorMap,J=!!M.specularIntensityMap,H=pe&&!!M.transmissionMap,re=pe&&!!M.thicknessMap,q=!!M.gradientMap,ie=!!M.alphaMap,xe=M.alphaTest>0,we=!!M.alphaHash,Ye=!!M.extensions;let ut=Ko;M.toneMapped&&(de===null||de.isXRRenderTarget===!0)&&(ut=n.toneMapping);const it={shaderID:Z,shaderType:M.type,shaderName:M.name,vertexShader:Ve,fragmentShader:$,defines:M.defines,customVertexShaderID:oe,customFragmentShaderID:me,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:p,batching:ke,batchingColor:ke&&U._colorsTexture!==null,instancing:Le,instancingColor:Le&&U.instanceColor!==null,instancingMorph:Le&&U.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:de===null?n.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:pi,alphaToCoverage:!!M.alphaToCoverage,map:Qe,matcap:V,envMap:ot,envMapMode:ot&&te.mapping,envMapCubeUVHeight:L,aoMap:ee,lightMap:at,bumpMap:Ne,normalMap:Ze,displacementMap:h&&Ie,emissiveMap:We,normalMapObjectSpace:Ze&&M.normalMapType===o4,normalMapTangentSpace:Ze&&M.normalMapType===pT,metalnessMap:B,roughnessMap:E,anisotropy:A,anisotropyMap:ce,clearcoat:F,clearcoatMap:Ee,clearcoatNormalMap:ve,clearcoatRoughnessMap:ue,dispersion:W,iridescence:j,iridescenceMap:Re,iridescenceThicknessMap:Pe,sheen:le,sheenColorMap:ye,sheenRoughnessMap:Se,specularMap:Be,specularColorMap:je,specularIntensityMap:J,transmission:pe,transmissionMap:H,thicknessMap:re,gradientMap:q,opaque:M.transparent===!1&&M.blending===Uc&&M.alphaToCoverage===!1,alphaMap:ie,alphaTest:xe,alphaHash:we,combine:M.combine,mapUv:Qe&&_(M.map.channel),aoMapUv:ee&&_(M.aoMap.channel),lightMapUv:at&&_(M.lightMap.channel),bumpMapUv:Ne&&_(M.bumpMap.channel),normalMapUv:Ze&&_(M.normalMap.channel),displacementMapUv:Ie&&_(M.displacementMap.channel),emissiveMapUv:We&&_(M.emissiveMap.channel),metalnessMapUv:B&&_(M.metalnessMap.channel),roughnessMapUv:E&&_(M.roughnessMap.channel),anisotropyMapUv:ce&&_(M.anisotropyMap.channel),clearcoatMapUv:Ee&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:ve&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ue&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:Re&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:Pe&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:ye&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:Se&&_(M.sheenRoughnessMap.channel),specularMapUv:Be&&_(M.specularMap.channel),specularColorMapUv:je&&_(M.specularColorMap.channel),specularIntensityMapUv:J&&_(M.specularIntensityMap.channel),transmissionMapUv:H&&_(M.transmissionMap.channel),thicknessMapUv:re&&_(M.thicknessMap.channel),alphaMapUv:ie&&_(M.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(Ze||A),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:U.isPoints===!0&&!!X.attributes.uv&&(Qe||ie),fog:!!N,useFog:M.fog===!0,fogExp2:!!N&&N.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:be,skinning:U.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:fe,morphTextureStride:Me,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:M.dithering,shadowMapEnabled:n.shadowMap.enabled&&P.length>0,shadowMapType:n.shadowMap.type,toneMapping:ut,decodeVideoTexture:Qe&&M.map.isVideoTexture===!0&&wt.getTransfer(M.map.colorSpace)===kt,decodeVideoTextureEmissive:We&&M.emissiveMap.isVideoTexture===!0&&wt.getTransfer(M.emissiveMap.colorSpace)===kt,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===fi,flipSided:M.side===Ri,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:Ye&&M.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ye&&M.extensions.multiDraw===!0||ke)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return it.vertexUv1s=c.has(1),it.vertexUv2s=c.has(2),it.vertexUv3s=c.has(3),c.clear(),it}function d(M){const S=[];if(M.shaderID?S.push(M.shaderID):(S.push(M.customVertexShaderID),S.push(M.customFragmentShaderID)),M.defines!==void 0)for(const P in M.defines)S.push(P),S.push(M.defines[P]);return M.isRawShaderMaterial===!1&&(x(S,M),v(S,M),S.push(n.outputColorSpace)),S.push(M.customProgramCacheKey),S.join()}function x(M,S){M.push(S.precision),M.push(S.outputColorSpace),M.push(S.envMapMode),M.push(S.envMapCubeUVHeight),M.push(S.mapUv),M.push(S.alphaMapUv),M.push(S.lightMapUv),M.push(S.aoMapUv),M.push(S.bumpMapUv),M.push(S.normalMapUv),M.push(S.displacementMapUv),M.push(S.emissiveMapUv),M.push(S.metalnessMapUv),M.push(S.roughnessMapUv),M.push(S.anisotropyMapUv),M.push(S.clearcoatMapUv),M.push(S.clearcoatNormalMapUv),M.push(S.clearcoatRoughnessMapUv),M.push(S.iridescenceMapUv),M.push(S.iridescenceThicknessMapUv),M.push(S.sheenColorMapUv),M.push(S.sheenRoughnessMapUv),M.push(S.specularMapUv),M.push(S.specularColorMapUv),M.push(S.specularIntensityMapUv),M.push(S.transmissionMapUv),M.push(S.thicknessMapUv),M.push(S.combine),M.push(S.fogExp2),M.push(S.sizeAttenuation),M.push(S.morphTargetsCount),M.push(S.morphAttributeCount),M.push(S.numDirLights),M.push(S.numPointLights),M.push(S.numSpotLights),M.push(S.numSpotLightMaps),M.push(S.numHemiLights),M.push(S.numRectAreaLights),M.push(S.numDirLightShadows),M.push(S.numPointLightShadows),M.push(S.numSpotLightShadows),M.push(S.numSpotLightShadowsWithMaps),M.push(S.numLightProbes),M.push(S.shadowMapType),M.push(S.toneMapping),M.push(S.numClippingPlanes),M.push(S.numClipIntersection),M.push(S.depthPacking)}function v(M,S){a.disableAll(),S.supportsVertexTextures&&a.enable(0),S.instancing&&a.enable(1),S.instancingColor&&a.enable(2),S.instancingMorph&&a.enable(3),S.matcap&&a.enable(4),S.envMap&&a.enable(5),S.normalMapObjectSpace&&a.enable(6),S.normalMapTangentSpace&&a.enable(7),S.clearcoat&&a.enable(8),S.iridescence&&a.enable(9),S.alphaTest&&a.enable(10),S.vertexColors&&a.enable(11),S.vertexAlphas&&a.enable(12),S.vertexUv1s&&a.enable(13),S.vertexUv2s&&a.enable(14),S.vertexUv3s&&a.enable(15),S.vertexTangents&&a.enable(16),S.anisotropy&&a.enable(17),S.alphaHash&&a.enable(18),S.batching&&a.enable(19),S.dispersion&&a.enable(20),S.batchingColor&&a.enable(21),M.push(a.mask),a.disableAll(),S.fog&&a.enable(0),S.useFog&&a.enable(1),S.flatShading&&a.enable(2),S.logarithmicDepthBuffer&&a.enable(3),S.reverseDepthBuffer&&a.enable(4),S.skinning&&a.enable(5),S.morphTargets&&a.enable(6),S.morphNormals&&a.enable(7),S.morphColors&&a.enable(8),S.premultipliedAlpha&&a.enable(9),S.shadowMapEnabled&&a.enable(10),S.doubleSided&&a.enable(11),S.flipSided&&a.enable(12),S.useDepthPacking&&a.enable(13),S.dithering&&a.enable(14),S.transmission&&a.enable(15),S.sheen&&a.enable(16),S.opaque&&a.enable(17),S.pointsUvs&&a.enable(18),S.decodeVideoTexture&&a.enable(19),S.decodeVideoTextureEmissive&&a.enable(20),S.alphaToCoverage&&a.enable(21),M.push(a.mask)}function y(M){const S=g[M.type];let P;if(S){const k=ar[S];P=xv.clone(k.uniforms)}else P=M.uniforms;return P}function b(M,S){let P;for(let k=0,U=u.length;k0?i.push(d):p.transparent===!0?r.push(d):t.push(d)}function l(f,h,p,g,_,m){const d=o(f,h,p,g,_,m);p.transmission>0?i.unshift(d):p.transparent===!0?r.unshift(d):t.unshift(d)}function c(f,h){t.length>1&&t.sort(f||p6),i.length>1&&i.sort(h||IM),r.length>1&&r.sort(h||IM)}function u(){for(let f=e,h=n.length;f=s.length?(o=new DM,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function g6(){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 Y,color:new tt};break;case"SpotLight":t={position:new Y,direction:new Y,color:new tt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Y,color:new tt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Y,skyColor:new tt,groundColor:new tt};break;case"RectAreaLight":t={color:new tt,position:new Y,halfWidth:new Y,halfHeight:new Y};break}return n[e.id]=t,t}}}function _6(){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 lt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new lt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new lt,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let v6=0;function x6(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function y6(n){const e=new g6,t=_6(),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 Y);const r=new Y,s=new dt,o=new dt;function a(c){let u=0,f=0,h=0;for(let M=0;M<9;M++)i.probe[M].set(0,0,0);let p=0,g=0,_=0,m=0,d=0,x=0,v=0,y=0,b=0,w=0,T=0;c.sort(x6);for(let M=0,S=c.length;M0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ze.LTC_FLOAT_1,i.rectAreaLTC2=ze.LTC_FLOAT_2):(i.rectAreaLTC1=ze.LTC_HALF_1,i.rectAreaLTC2=ze.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=f,i.ambient[2]=h;const C=i.hash;(C.directionalLength!==p||C.pointLength!==g||C.spotLength!==_||C.rectAreaLength!==m||C.hemiLength!==d||C.numDirectionalShadows!==x||C.numPointShadows!==v||C.numSpotShadows!==y||C.numSpotMaps!==b||C.numLightProbes!==T)&&(i.directional.length=p,i.spot.length=_,i.rectArea.length=m,i.point.length=g,i.hemi.length=d,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=v,i.pointShadowMap.length=v,i.spotShadow.length=y,i.spotShadowMap.length=y,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=v,i.spotLightMatrix.length=y+b-w,i.spotLightMap.length=b,i.numSpotLightShadowsWithMaps=w,i.numLightProbes=T,C.directionalLength=p,C.pointLength=g,C.spotLength=_,C.rectAreaLength=m,C.hemiLength=d,C.numDirectionalShadows=x,C.numPointShadows=v,C.numSpotShadows=y,C.numSpotMaps=b,C.numLightProbes=T,i.version=v6++)}function l(c,u){let f=0,h=0,p=0,g=0,_=0;const m=u.matrixWorldInverse;for(let d=0,x=c.length;d=o.length?(a=new NM(n),o.push(a)):a=o[s],a}function i(){e=new WeakMap}return{get:t,dispose:i}}let M6=class extends cs{static get type(){return"MeshDepthMaterial"}constructor(e){super(),this.isMeshDepthMaterial=!0,this.depthPacking=r4,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}},E6=class extends cs{static get type(){return"MeshDistanceMaterial"}constructor(e){super(),this.isMeshDistanceMaterial=!0,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 w6=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,T6=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function A6(n,e,t){let i=new Hx;const r=new lt,s=new lt,o=new Ct,a=new M6({depthPacking:s4}),l=new E6,c={},u=t.maxTextureSize,f={[Wr]:Ri,[Ri]:Wr,[fi]:fi},h=new Ki({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new lt},radius:{value:4}},vertexShader:w6,fragmentShader:T6}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const g=new xr;g.setAttribute("position",new di(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new yn(g,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=eT;let d=this.type;this.render=function(w,T,C){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||w.length===0)return;const M=n.getRenderTarget(),S=n.getActiveCubeFace(),P=n.getActiveMipmapLevel(),k=n.state;k.setBlending(Yo),k.buffers.color.setClear(1,1,1,1),k.buffers.depth.setTest(!0),k.setScissorTest(!1);const U=d!==Ns&&this.type===Ns,N=d===Ns&&this.type!==Ns;for(let X=0,z=w.length;Xu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/Z.x),r.x=s.x*Z.x,L.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/Z.y),r.y=s.y*Z.y,L.mapSize.y=s.y)),L.map===null||U===!0||N===!0){const fe=this.type!==Ns?{minFilter:ni,magFilter:ni}:{};L.map!==null&&L.map.dispose(),L.map=new la(r.x,r.y,fe),L.map.texture.name=te.name+".shadowMap",L.camera.updateProjectionMatrix()}n.setRenderTarget(L.map),n.clear();const ae=L.getViewportCount();for(let fe=0;fe0||T.map&&T.alphaTest>0){const k=S.uuid,U=T.uuid;let N=c[k];N===void 0&&(N={},c[k]=N);let X=N[U];X===void 0&&(X=S.clone(),N[U]=X,T.addEventListener("dispose",b)),S=X}if(S.visible=T.visible,S.wireframe=T.wireframe,M===Ns?S.side=T.shadowSide!==null?T.shadowSide:T.side:S.side=T.shadowSide!==null?T.shadowSide:f[T.side],S.alphaMap=T.alphaMap,S.alphaTest=T.alphaTest,S.map=T.map,S.clipShadows=T.clipShadows,S.clippingPlanes=T.clippingPlanes,S.clipIntersection=T.clipIntersection,S.displacementMap=T.displacementMap,S.displacementScale=T.displacementScale,S.displacementBias=T.displacementBias,S.wireframeLinewidth=T.wireframeLinewidth,S.linewidth=T.linewidth,C.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const k=n.properties.get(S);k.light=C}return S}function y(w,T,C,M,S){if(w.visible===!1)return;if(w.layers.test(T.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&S===Ns)&&(!w.frustumCulled||i.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,w.matrixWorld);const U=e.update(w),N=w.material;if(Array.isArray(N)){const X=U.groups;for(let z=0,te=X.length;z=1):L.indexOf("OpenGL ES")!==-1&&(te=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),z=te>=2);let Z=null,ae={};const fe=n.getParameter(n.SCISSOR_BOX),Me=n.getParameter(n.VIEWPORT),Ve=new Ct().fromArray(fe),$=new Ct().fromArray(Me);function oe(H,re,q,ie){const xe=new Uint8Array(4),we=n.createTexture();n.bindTexture(H,we),n.texParameteri(H,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(H,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ye=0;Ye"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new lt,u=new WeakMap;let f;const h=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(E,A){return p?new OffscreenCanvas(E,A):Kf("canvas")}function _(E,A,F){let W=1;const j=B(E);if((j.width>F||j.height>F)&&(W=F/Math.max(j.width,j.height)),W<1)if(typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&E instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&E instanceof ImageBitmap||typeof VideoFrame<"u"&&E instanceof VideoFrame){const le=Math.floor(W*j.width),pe=Math.floor(W*j.height);f===void 0&&(f=g(le,pe));const ce=A?g(le,pe):f;return ce.width=le,ce.height=pe,ce.getContext("2d").drawImage(E,0,0,le,pe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+j.width+"x"+j.height+") to ("+le+"x"+pe+")."),ce}else return"data"in E&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+j.width+"x"+j.height+")."),E;return E}function m(E){return E.generateMipmaps}function d(E){n.generateMipmap(E)}function x(E){return E.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:E.isWebGL3DRenderTarget?n.TEXTURE_3D:E.isWebGLArrayRenderTarget||E.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function v(E,A,F,W,j=!1){if(E!==null){if(n[E]!==void 0)return n[E];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let le=A;if(A===n.RED&&(F===n.FLOAT&&(le=n.R32F),F===n.HALF_FLOAT&&(le=n.R16F),F===n.UNSIGNED_BYTE&&(le=n.R8)),A===n.RED_INTEGER&&(F===n.UNSIGNED_BYTE&&(le=n.R8UI),F===n.UNSIGNED_SHORT&&(le=n.R16UI),F===n.UNSIGNED_INT&&(le=n.R32UI),F===n.BYTE&&(le=n.R8I),F===n.SHORT&&(le=n.R16I),F===n.INT&&(le=n.R32I)),A===n.RG&&(F===n.FLOAT&&(le=n.RG32F),F===n.HALF_FLOAT&&(le=n.RG16F),F===n.UNSIGNED_BYTE&&(le=n.RG8)),A===n.RG_INTEGER&&(F===n.UNSIGNED_BYTE&&(le=n.RG8UI),F===n.UNSIGNED_SHORT&&(le=n.RG16UI),F===n.UNSIGNED_INT&&(le=n.RG32UI),F===n.BYTE&&(le=n.RG8I),F===n.SHORT&&(le=n.RG16I),F===n.INT&&(le=n.RG32I)),A===n.RGB_INTEGER&&(F===n.UNSIGNED_BYTE&&(le=n.RGB8UI),F===n.UNSIGNED_SHORT&&(le=n.RGB16UI),F===n.UNSIGNED_INT&&(le=n.RGB32UI),F===n.BYTE&&(le=n.RGB8I),F===n.SHORT&&(le=n.RGB16I),F===n.INT&&(le=n.RGB32I)),A===n.RGBA_INTEGER&&(F===n.UNSIGNED_BYTE&&(le=n.RGBA8UI),F===n.UNSIGNED_SHORT&&(le=n.RGBA16UI),F===n.UNSIGNED_INT&&(le=n.RGBA32UI),F===n.BYTE&&(le=n.RGBA8I),F===n.SHORT&&(le=n.RGBA16I),F===n.INT&&(le=n.RGBA32I)),A===n.RGB&&F===n.UNSIGNED_INT_5_9_9_9_REV&&(le=n.RGB9_E5),A===n.RGBA){const pe=j?Xm:wt.getTransfer(W);F===n.FLOAT&&(le=n.RGBA32F),F===n.HALF_FLOAT&&(le=n.RGBA16F),F===n.UNSIGNED_BYTE&&(le=pe===kt?n.SRGB8_ALPHA8:n.RGBA8),F===n.UNSIGNED_SHORT_4_4_4_4&&(le=n.RGBA4),F===n.UNSIGNED_SHORT_5_5_5_1&&(le=n.RGB5_A1)}return(le===n.R16F||le===n.R32F||le===n.RG16F||le===n.RG32F||le===n.RGBA16F||le===n.RGBA32F)&&e.get("EXT_color_buffer_float"),le}function y(E,A){let F;return E?A===null||A===pl||A===Qc?F=n.DEPTH24_STENCIL8:A===Ur?F=n.DEPTH32F_STENCIL8:A===jf&&(F=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):A===null||A===pl||A===Qc?F=n.DEPTH_COMPONENT24:A===Ur?F=n.DEPTH_COMPONENT32F:A===jf&&(F=n.DEPTH_COMPONENT16),F}function b(E,A){return m(E)===!0||E.isFramebufferTexture&&E.minFilter!==ni&&E.minFilter!==$i?Math.log2(Math.max(A.width,A.height))+1:E.mipmaps!==void 0&&E.mipmaps.length>0?E.mipmaps.length:E.isCompressedTexture&&Array.isArray(E.image)?A.mipmaps.length:1}function w(E){const A=E.target;A.removeEventListener("dispose",w),C(A),A.isVideoTexture&&u.delete(A)}function T(E){const A=E.target;A.removeEventListener("dispose",T),S(A)}function C(E){const A=i.get(E);if(A.__webglInit===void 0)return;const F=E.source,W=h.get(F);if(W){const j=W[A.__cacheKey];j.usedTimes--,j.usedTimes===0&&M(E),Object.keys(W).length===0&&h.delete(F)}i.remove(E)}function M(E){const A=i.get(E);n.deleteTexture(A.__webglTexture);const F=E.source,W=h.get(F);delete W[A.__cacheKey],o.memory.textures--}function S(E){const A=i.get(E);if(E.depthTexture&&(E.depthTexture.dispose(),i.remove(E.depthTexture)),E.isWebGLCubeRenderTarget)for(let W=0;W<6;W++){if(Array.isArray(A.__webglFramebuffer[W]))for(let j=0;j=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+r.maxTextures),P+=1,E}function N(E){const A=[];return A.push(E.wrapS),A.push(E.wrapT),A.push(E.wrapR||0),A.push(E.magFilter),A.push(E.minFilter),A.push(E.anisotropy),A.push(E.internalFormat),A.push(E.format),A.push(E.type),A.push(E.generateMipmaps),A.push(E.premultiplyAlpha),A.push(E.flipY),A.push(E.unpackAlignment),A.push(E.colorSpace),A.join()}function X(E,A){const F=i.get(E);if(E.isVideoTexture&&Ie(E),E.isRenderTargetTexture===!1&&E.version>0&&F.__version!==E.version){const W=E.image;if(W===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(W.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{$(F,E,A);return}}t.bindTexture(n.TEXTURE_2D,F.__webglTexture,n.TEXTURE0+A)}function z(E,A){const F=i.get(E);if(E.version>0&&F.__version!==E.version){$(F,E,A);return}t.bindTexture(n.TEXTURE_2D_ARRAY,F.__webglTexture,n.TEXTURE0+A)}function te(E,A){const F=i.get(E);if(E.version>0&&F.__version!==E.version){$(F,E,A);return}t.bindTexture(n.TEXTURE_3D,F.__webglTexture,n.TEXTURE0+A)}function L(E,A){const F=i.get(E);if(E.version>0&&F.__version!==E.version){oe(F,E,A);return}t.bindTexture(n.TEXTURE_CUBE_MAP,F.__webglTexture,n.TEXTURE0+A)}const Z={[aa]:n.REPEAT,[Wo]:n.CLAMP_TO_EDGE,[Kp]:n.MIRRORED_REPEAT},ae={[ni]:n.NEAREST,[iT]:n.NEAREST_MIPMAP_NEAREST,[mf]:n.NEAREST_MIPMAP_LINEAR,[$i]:n.LINEAR,[pp]:n.LINEAR_MIPMAP_NEAREST,[os]:n.LINEAR_MIPMAP_LINEAR},fe={[a4]:n.NEVER,[h4]:n.ALWAYS,[l4]:n.LESS,[mT]:n.LEQUAL,[c4]:n.EQUAL,[d4]:n.GEQUAL,[u4]:n.GREATER,[f4]:n.NOTEQUAL};function Me(E,A){if(A.type===Ur&&e.has("OES_texture_float_linear")===!1&&(A.magFilter===$i||A.magFilter===pp||A.magFilter===mf||A.magFilter===os||A.minFilter===$i||A.minFilter===pp||A.minFilter===mf||A.minFilter===os)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(E,n.TEXTURE_WRAP_S,Z[A.wrapS]),n.texParameteri(E,n.TEXTURE_WRAP_T,Z[A.wrapT]),(E===n.TEXTURE_3D||E===n.TEXTURE_2D_ARRAY)&&n.texParameteri(E,n.TEXTURE_WRAP_R,Z[A.wrapR]),n.texParameteri(E,n.TEXTURE_MAG_FILTER,ae[A.magFilter]),n.texParameteri(E,n.TEXTURE_MIN_FILTER,ae[A.minFilter]),A.compareFunction&&(n.texParameteri(E,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(E,n.TEXTURE_COMPARE_FUNC,fe[A.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(A.magFilter===ni||A.minFilter!==mf&&A.minFilter!==os||A.type===Ur&&e.has("OES_texture_float_linear")===!1)return;if(A.anisotropy>1||i.get(A).__currentAnisotropy){const F=e.get("EXT_texture_filter_anisotropic");n.texParameterf(E,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(A.anisotropy,r.getMaxAnisotropy())),i.get(A).__currentAnisotropy=A.anisotropy}}}function Ve(E,A){let F=!1;E.__webglInit===void 0&&(E.__webglInit=!0,A.addEventListener("dispose",w));const W=A.source;let j=h.get(W);j===void 0&&(j={},h.set(W,j));const le=N(A);if(le!==E.__cacheKey){j[le]===void 0&&(j[le]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,F=!0),j[le].usedTimes++;const pe=j[E.__cacheKey];pe!==void 0&&(j[E.__cacheKey].usedTimes--,pe.usedTimes===0&&M(A)),E.__cacheKey=le,E.__webglTexture=j[le].texture}return F}function $(E,A,F){let W=n.TEXTURE_2D;(A.isDataArrayTexture||A.isCompressedArrayTexture)&&(W=n.TEXTURE_2D_ARRAY),A.isData3DTexture&&(W=n.TEXTURE_3D);const j=Ve(E,A),le=A.source;t.bindTexture(W,E.__webglTexture,n.TEXTURE0+F);const pe=i.get(le);if(le.version!==pe.__version||j===!0){t.activeTexture(n.TEXTURE0+F);const ce=wt.getPrimaries(wt.workingColorSpace),Ee=A.colorSpace===Bo?null:wt.getPrimaries(A.colorSpace),ve=A.colorSpace===Bo||ce===Ee?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,A.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,A.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ve);let ue=_(A.image,!1,r.maxTextureSize);ue=We(A,ue);const Re=s.convert(A.format,A.colorSpace),Pe=s.convert(A.type);let ye=v(A.internalFormat,Re,Pe,A.colorSpace,A.isVideoTexture);Me(W,A);let Se;const Be=A.mipmaps,je=A.isVideoTexture!==!0,J=pe.__version===void 0||j===!0,H=le.dataReady,re=b(A,ue);if(A.isDepthTexture)ye=y(A.format===Jc,A.type),J&&(je?t.texStorage2D(n.TEXTURE_2D,1,ye,ue.width,ue.height):t.texImage2D(n.TEXTURE_2D,0,ye,ue.width,ue.height,0,Re,Pe,null));else if(A.isDataTexture)if(Be.length>0){je&&J&&t.texStorage2D(n.TEXTURE_2D,re,ye,Be[0].width,Be[0].height);for(let q=0,ie=Be.length;q0){const xe=UM(Se.width,Se.height,A.format,A.type);for(const we of A.layerUpdates){const Ye=Se.data.subarray(we*xe/Se.data.BYTES_PER_ELEMENT,(we+1)*xe/Se.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,we,Se.width,Se.height,1,Re,Ye)}A.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,0,Se.width,Se.height,ue.depth,Re,Se.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,q,ye,Se.width,Se.height,ue.depth,0,Se.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else je?H&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,0,Se.width,Se.height,ue.depth,Re,Pe,Se.data):t.texImage3D(n.TEXTURE_2D_ARRAY,q,ye,Se.width,Se.height,ue.depth,0,Re,Pe,Se.data)}else{je&&J&&t.texStorage2D(n.TEXTURE_2D,re,ye,Be[0].width,Be[0].height);for(let q=0,ie=Be.length;q0){const q=UM(ue.width,ue.height,A.format,A.type);for(const ie of A.layerUpdates){const xe=ue.data.subarray(ie*q/ue.data.BYTES_PER_ELEMENT,(ie+1)*q/ue.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,ie,ue.width,ue.height,1,Re,Pe,xe)}A.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ue.width,ue.height,ue.depth,Re,Pe,ue.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,ye,ue.width,ue.height,ue.depth,0,Re,Pe,ue.data);else if(A.isData3DTexture)je?(J&&t.texStorage3D(n.TEXTURE_3D,re,ye,ue.width,ue.height,ue.depth),H&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ue.width,ue.height,ue.depth,Re,Pe,ue.data)):t.texImage3D(n.TEXTURE_3D,0,ye,ue.width,ue.height,ue.depth,0,Re,Pe,ue.data);else if(A.isFramebufferTexture){if(J)if(je)t.texStorage2D(n.TEXTURE_2D,re,ye,ue.width,ue.height);else{let q=ue.width,ie=ue.height;for(let xe=0;xe>=1,ie>>=1}}else if(Be.length>0){if(je&&J){const q=B(Be[0]);t.texStorage2D(n.TEXTURE_2D,re,ye,q.width,q.height)}for(let q=0,ie=Be.length;q0&&re++;const ie=B(Re[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,re,Be,ie.width,ie.height)}for(let ie=0;ie<6;ie++)if(ue){je?H&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,0,0,Re[ie].width,Re[ie].height,ye,Se,Re[ie].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,Be,Re[ie].width,Re[ie].height,0,ye,Se,Re[ie].data);for(let xe=0;xe>le),Pe=Math.max(1,A.height>>le);j===n.TEXTURE_3D||j===n.TEXTURE_2D_ARRAY?t.texImage3D(j,le,Ee,Re,Pe,A.depth,0,pe,ce,null):t.texImage2D(j,le,Ee,Re,Pe,0,pe,ce,null)}t.bindFramebuffer(n.FRAMEBUFFER,E),Ze(A)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,W,j,ue.__webglTexture,0,Ne(A)):(j===n.TEXTURE_2D||j>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&j<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,W,j,ue.__webglTexture,le),t.bindFramebuffer(n.FRAMEBUFFER,null)}function de(E,A,F){if(n.bindRenderbuffer(n.RENDERBUFFER,E),A.depthBuffer){const W=A.depthTexture,j=W&&W.isDepthTexture?W.type:null,le=y(A.stencilBuffer,j),pe=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ce=Ne(A);Ze(A)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ce,le,A.width,A.height):F?n.renderbufferStorageMultisample(n.RENDERBUFFER,ce,le,A.width,A.height):n.renderbufferStorage(n.RENDERBUFFER,le,A.width,A.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,pe,n.RENDERBUFFER,E)}else{const W=A.textures;for(let j=0;j{delete A.__boundDepthTexture,delete A.__depthDisposeCallback,W.removeEventListener("dispose",j)};W.addEventListener("dispose",j),A.__depthDisposeCallback=j}A.__boundDepthTexture=W}if(E.depthTexture&&!A.__autoAllocateDepthBuffer){if(F)throw new Error("target.depthTexture not supported in Cube render targets");be(A.__webglFramebuffer,E)}else if(F){A.__webglDepthbuffer=[];for(let W=0;W<6;W++)if(t.bindFramebuffer(n.FRAMEBUFFER,A.__webglFramebuffer[W]),A.__webglDepthbuffer[W]===void 0)A.__webglDepthbuffer[W]=n.createRenderbuffer(),de(A.__webglDepthbuffer[W],E,!1);else{const j=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,le=A.__webglDepthbuffer[W];n.bindRenderbuffer(n.RENDERBUFFER,le),n.framebufferRenderbuffer(n.FRAMEBUFFER,j,n.RENDERBUFFER,le)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,A.__webglFramebuffer),A.__webglDepthbuffer===void 0)A.__webglDepthbuffer=n.createRenderbuffer(),de(A.__webglDepthbuffer,E,!1);else{const W=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,j=A.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,j),n.framebufferRenderbuffer(n.FRAMEBUFFER,W,n.RENDERBUFFER,j)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function ke(E,A,F){const W=i.get(E);A!==void 0&&me(W.__webglFramebuffer,E,E.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),F!==void 0&&Le(E)}function Qe(E){const A=E.texture,F=i.get(E),W=i.get(A);E.addEventListener("dispose",T);const j=E.textures,le=E.isWebGLCubeRenderTarget===!0,pe=j.length>1;if(pe||(W.__webglTexture===void 0&&(W.__webglTexture=n.createTexture()),W.__version=A.version,o.memory.textures++),le){F.__webglFramebuffer=[];for(let ce=0;ce<6;ce++)if(A.mipmaps&&A.mipmaps.length>0){F.__webglFramebuffer[ce]=[];for(let Ee=0;Ee0){F.__webglFramebuffer=[];for(let ce=0;ce0&&Ze(E)===!1){F.__webglMultisampledFramebuffer=n.createFramebuffer(),F.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let ce=0;ce0)for(let Ee=0;Ee0)for(let Ee=0;Ee0){if(Ze(E)===!1){const A=E.textures,F=E.width,W=E.height;let j=n.COLOR_BUFFER_BIT;const le=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pe=i.get(E),ce=A.length>1;if(ce)for(let Ee=0;Ee0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&A.__useRenderToTexture!==!1}function Ie(E){const A=o.render.frame;u.get(E)!==A&&(u.set(E,A),E.update())}function We(E,A){const F=E.colorSpace,W=E.format,j=E.type;return E.isCompressedTexture===!0||E.isVideoTexture===!0||F!==pi&&F!==Bo&&(wt.getTransfer(F)===kt?(W!==fr||j!==Zs)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",F)),A}function B(E){return typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement?(c.width=E.naturalWidth||E.width,c.height=E.naturalHeight||E.height):typeof VideoFrame<"u"&&E instanceof VideoFrame?(c.width=E.displayWidth,c.height=E.displayHeight):(c.width=E.width,c.height=E.height),c}this.allocateTextureUnit=U,this.resetTextureUnits=k,this.setTexture2D=X,this.setTexture2DArray=z,this.setTexture3D=te,this.setTextureCube=L,this.rebindTextures=ke,this.setupRenderTarget=Qe,this.updateRenderTargetMipmap=V,this.updateMultisampleRenderTarget=at,this.setupDepthRenderbuffer=Le,this.setupFrameBufferTexture=me,this.useMultisampledRTT=Ze}function L6(n,e){function t(i,r=Bo){let s;const o=wt.getTransfer(r);if(i===Zs)return n.UNSIGNED_BYTE;if(i===Dx)return n.UNSIGNED_SHORT_4_4_4_4;if(i===Nx)return n.UNSIGNED_SHORT_5_5_5_1;if(i===oT)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===rT)return n.BYTE;if(i===sT)return n.SHORT;if(i===jf)return n.UNSIGNED_SHORT;if(i===Ix)return n.INT;if(i===pl)return n.UNSIGNED_INT;if(i===Ur)return n.FLOAT;if(i===wd)return n.HALF_FLOAT;if(i===aT)return n.ALPHA;if(i===lT)return n.RGB;if(i===fr)return n.RGBA;if(i===cT)return n.LUMINANCE;if(i===uT)return n.LUMINANCE_ALPHA;if(i===Oc)return n.DEPTH_COMPONENT;if(i===Jc)return n.DEPTH_STENCIL;if(i===Ux)return n.RED;if(i===Ox)return n.RED_INTEGER;if(i===fT)return n.RG;if(i===Fx)return n.RG_INTEGER;if(i===kx)return n.RGBA_INTEGER;if(i===mp||i===gp||i===_p||i===vp)if(o===kt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===mp)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===gp)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===_p)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===vp)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===mp)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===gp)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===_p)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===vp)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===W_||i===$_||i===X_||i===j_)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===W_)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===$_)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===X_)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===j_)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===q_||i===Y_||i===K_)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===q_||i===Y_)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===K_)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===Z_||i===Q_||i===J_||i===ev||i===tv||i===nv||i===iv||i===rv||i===sv||i===ov||i===av||i===lv||i===cv||i===uv)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===Z_)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Q_)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===J_)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===ev)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===tv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===nv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===iv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===rv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===sv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===ov)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===av)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===lv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===cv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===uv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===xp||i===fv||i===dv)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===xp)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===fv)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===dv)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===dT||i===hv||i===pv||i===mv)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===xp)return s.COMPRESSED_RED_RGTC1_EXT;if(i===hv)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===pv)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===mv)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Qc?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}let I6=class extends Jn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},Ws=class extends fn{constructor(){super(),this.isGroup=!0,this.type="Group"}};const D6={type:"move"};let og=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ws,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 Ws,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Y),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ws,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Y),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,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const _ of e.hand.values()){const m=t.getJointPose(_,i),d=this._getHandJoint(c,_);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"],f=c.joints["thumb-tip"],h=u.position.distanceTo(f.position),p=.02,g=.005;c.inputState.pinching&&h>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-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));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(D6)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Ws;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}};const N6=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,U6=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;let O6=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new mi,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new Ki({vertexShader:N6,fragmentShader:U6,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new yn(new Ad(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},F6=class extends Al{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,h=null,p=null,g=null;const _=new O6,m=t.getContextAttributes();let d=null,x=null;const v=[],y=[],b=new lt;let w=null;const T=new Jn;T.viewport=new Ct;const C=new Jn;C.viewport=new Ct;const M=[T,C],S=new I6;let P=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function($){let oe=v[$];return oe===void 0&&(oe=new og,v[$]=oe),oe.getTargetRaySpace()},this.getControllerGrip=function($){let oe=v[$];return oe===void 0&&(oe=new og,v[$]=oe),oe.getGripSpace()},this.getHand=function($){let oe=v[$];return oe===void 0&&(oe=new og,v[$]=oe),oe.getHandSpace()};function U($){const oe=y.indexOf($.inputSource);if(oe===-1)return;const me=v[oe];me!==void 0&&(me.update($.inputSource,$.frame,c||o),me.dispatchEvent({type:$.type,data:$.inputSource}))}function N(){r.removeEventListener("select",U),r.removeEventListener("selectstart",U),r.removeEventListener("selectend",U),r.removeEventListener("squeeze",U),r.removeEventListener("squeezestart",U),r.removeEventListener("squeezeend",U),r.removeEventListener("end",N),r.removeEventListener("inputsourceschange",X);for(let $=0;$=0&&(y[de]=null,v[de].disconnect(me))}for(let oe=0;oe<$.added.length;oe++){const me=$.added[oe];let de=y.indexOf(me);if(de===-1){for(let Le=0;Le=y.length){y.push(me),de=Le;break}else if(y[Le]===null){y[Le]=me,de=Le;break}if(de===-1)break}const be=v[de];be&&be.connect(me)}}const z=new Y,te=new Y;function L($,oe,me){z.setFromMatrixPosition(oe.matrixWorld),te.setFromMatrixPosition(me.matrixWorld);const de=z.distanceTo(te),be=oe.projectionMatrix.elements,Le=me.projectionMatrix.elements,ke=be[14]/(be[10]-1),Qe=be[14]/(be[10]+1),V=(be[9]+1)/be[5],ot=(be[9]-1)/be[5],ee=(be[8]-1)/be[0],at=(Le[8]+1)/Le[0],Ne=ke*ee,Ze=ke*at,Ie=de/(-ee+at),We=Ie*-ee;if(oe.matrixWorld.decompose($.position,$.quaternion,$.scale),$.translateX(We),$.translateZ(Ie),$.matrixWorld.compose($.position,$.quaternion,$.scale),$.matrixWorldInverse.copy($.matrixWorld).invert(),be[10]===-1)$.projectionMatrix.copy(oe.projectionMatrix),$.projectionMatrixInverse.copy(oe.projectionMatrixInverse);else{const B=ke+Ie,E=Qe+Ie,A=Ne-We,F=Ze+(de-We),W=V*Qe/E*B,j=ot*Qe/E*B;$.projectionMatrix.makePerspective(A,F,W,j,B,E),$.projectionMatrixInverse.copy($.projectionMatrix).invert()}}function Z($,oe){oe===null?$.matrixWorld.copy($.matrix):$.matrixWorld.multiplyMatrices(oe.matrixWorld,$.matrix),$.matrixWorldInverse.copy($.matrixWorld).invert()}this.updateCamera=function($){if(r===null)return;let oe=$.near,me=$.far;_.texture!==null&&(_.depthNear>0&&(oe=_.depthNear),_.depthFar>0&&(me=_.depthFar)),S.near=C.near=T.near=oe,S.far=C.far=T.far=me,(P!==S.near||k!==S.far)&&(r.updateRenderState({depthNear:S.near,depthFar:S.far}),P=S.near,k=S.far),T.layers.mask=$.layers.mask|2,C.layers.mask=$.layers.mask|4,S.layers.mask=T.layers.mask|C.layers.mask;const de=$.parent,be=S.cameras;Z(S,de);for(let Le=0;Le0&&(m.alphaTest.value=d.alphaTest);const x=e.get(d),v=x.envMap,y=x.envMapRotation;v&&(m.envMap.value=v,Aa.copy(y),Aa.x*=-1,Aa.y*=-1,Aa.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Aa.y*=-1,Aa.z*=-1),m.envMapRotation.value.setFromMatrix4(k6.makeRotationFromEuler(Aa)),m.flipEnvMap.value=v.isCubeTexture&&v.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 o(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 a(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function l(m,d,x,v){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*x,m.scale.value=v*.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 f(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 p(m,d,x){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===Ri&&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=x.texture,m.transmissionSamplerSize.value.set(x.width,x.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 _(m,d){const x=e.get(d).light;m.referencePosition.value.setFromMatrixPosition(x.matrixWorld),m.nearDistance.value=x.shadow.camera.near,m.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function z6(n,e,t,i){let r={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(x,v){const y=v.program;i.uniformBlockBinding(x,y)}function c(x,v){let y=r[x.id];y===void 0&&(g(x),y=u(x),r[x.id]=y,x.addEventListener("dispose",m));const b=v.program;i.updateUBOMapping(x,b);const w=e.render.frame;s[x.id]!==w&&(h(x),s[x.id]=w)}function u(x){const v=f();x.__bindingPointIndex=v;const y=n.createBuffer(),b=x.__size,w=x.usage;return n.bindBuffer(n.UNIFORM_BUFFER,y),n.bufferData(n.UNIFORM_BUFFER,b,w),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,v,y),y}function f(){for(let x=0;x0&&(y+=b-w),x.__size=y,x.__cache={},this}function _(x){const v={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(v.boundary=4,v.storage=4):x.isVector2?(v.boundary=8,v.storage=8):x.isVector3||x.isColor?(v.boundary=16,v.storage=12):x.isVector4?(v.boundary=16,v.storage=16):x.isMatrix3?(v.boundary=48,v.storage=48):x.isMatrix4?(v.boundary=64,v.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),v}function m(x){const v=x.target;v.removeEventListener("dispose",m);const y=o.indexOf(v.__bindingPointIndex);o.splice(y,1),n.deleteBuffer(r[v.id]),delete r[v.id],delete s[v.id]}function d(){for(const x in r)n.deleteBuffer(r[x]);o=[],r={},s={}}return{bind:l,update:c,dispose:d}}let OM=class{constructor(e={}){const{canvas:t=P4(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reverseDepthBuffer:h=!1}=e;this.isWebGLRenderer=!0;let p;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=o;const g=new Uint32Array(4),_=new Int32Array(4);let m=null,d=null;const x=[],v=[];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._outputColorSpace=En,this.toneMapping=Ko,this.toneMappingExposure=1;const y=this;let b=!1,w=0,T=0,C=null,M=-1,S=null;const P=new Ct,k=new Ct;let U=null;const N=new tt(0);let X=0,z=t.width,te=t.height,L=1,Z=null,ae=null;const fe=new Ct(0,0,z,te),Me=new Ct(0,0,z,te);let Ve=!1;const $=new Hx;let oe=!1,me=!1;const de=new dt,be=new dt,Le=new Y,ke=new Ct,Qe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let V=!1;function ot(){return C===null?L:1}let ee=i;function at(R,D){return t.getContext(R,D)}try{const R={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Lx}`),t.addEventListener("webglcontextlost",ie,!1),t.addEventListener("webglcontextrestored",xe,!1),t.addEventListener("webglcontextcreationerror",we,!1),ee===null){const D="webgl2";if(ee=at(D,R),ee===null)throw at(D)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(R){throw console.error("THREE.WebGLRenderer: "+R.message),R}let Ne,Ze,Ie,We,B,E,A,F,W,j,le,pe,ce,Ee,ve,ue,Re,Pe,ye,Se,Be,je,J,H;function re(){Ne=new XI(ee),Ne.init(),je=new L6(ee,Ne),Ze=new zI(ee,Ne,e,je),Ie=new R6(ee,Ne),Ze.reverseDepthBuffer&&h&&Ie.buffers.depth.setReversed(!0),We=new YI(ee),B=new h6,E=new P6(ee,Ne,Ie,B,Ze,je,We),A=new VI(y),F=new $I(y),W=new n5(ee),J=new kI(ee,W),j=new jI(ee,W,We,J),le=new ZI(ee,j,W,We),ye=new KI(ee,Ze,E),ue=new HI(B),pe=new d6(y,A,F,Ne,Ze,J,ue),ce=new B6(y,B),Ee=new m6,ve=new S6(Ne),Pe=new FI(y,A,F,Ie,le,p,l),Re=new A6(y,le,Ze),H=new z6(ee,We,Ze,Ie),Se=new BI(ee,Ne,We),Be=new qI(ee,Ne,We),We.programs=pe.programs,y.capabilities=Ze,y.extensions=Ne,y.properties=B,y.renderLists=Ee,y.shadowMap=Re,y.state=Ie,y.info=We}re();const q=new F6(y,ee);this.xr=q,this.getContext=function(){return ee},this.getContextAttributes=function(){return ee.getContextAttributes()},this.forceContextLoss=function(){const R=Ne.get("WEBGL_lose_context");R&&R.loseContext()},this.forceContextRestore=function(){const R=Ne.get("WEBGL_lose_context");R&&R.restoreContext()},this.getPixelRatio=function(){return L},this.setPixelRatio=function(R){R!==void 0&&(L=R,this.setSize(z,te,!1))},this.getSize=function(R){return R.set(z,te)},this.setSize=function(R,D,O=!0){if(q.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}z=R,te=D,t.width=Math.floor(R*L),t.height=Math.floor(D*L),O===!0&&(t.style.width=R+"px",t.style.height=D+"px"),this.setViewport(0,0,R,D)},this.getDrawingBufferSize=function(R){return R.set(z*L,te*L).floor()},this.setDrawingBufferSize=function(R,D,O){z=R,te=D,L=O,t.width=Math.floor(R*O),t.height=Math.floor(D*O),this.setViewport(0,0,R,D)},this.getCurrentViewport=function(R){return R.copy(P)},this.getViewport=function(R){return R.copy(fe)},this.setViewport=function(R,D,O,K){R.isVector4?fe.set(R.x,R.y,R.z,R.w):fe.set(R,D,O,K),Ie.viewport(P.copy(fe).multiplyScalar(L).round())},this.getScissor=function(R){return R.copy(Me)},this.setScissor=function(R,D,O,K){R.isVector4?Me.set(R.x,R.y,R.z,R.w):Me.set(R,D,O,K),Ie.scissor(k.copy(Me).multiplyScalar(L).round())},this.getScissorTest=function(){return Ve},this.setScissorTest=function(R){Ie.setScissorTest(Ve=R)},this.setOpaqueSort=function(R){Z=R},this.setTransparentSort=function(R){ae=R},this.getClearColor=function(R){return R.copy(Pe.getClearColor())},this.setClearColor=function(){Pe.setClearColor.apply(Pe,arguments)},this.getClearAlpha=function(){return Pe.getClearAlpha()},this.setClearAlpha=function(){Pe.setClearAlpha.apply(Pe,arguments)},this.clear=function(R=!0,D=!0,O=!0){let K=0;if(R){let G=!1;if(C!==null){const he=C.texture.format;G=he===kx||he===Fx||he===Ox}if(G){const he=C.texture.type,ge=he===Zs||he===pl||he===jf||he===Qc||he===Dx||he===Nx,Te=Pe.getClearColor(),Ae=Pe.getClearAlpha(),Ce=Te.r,Ge=Te.g,Oe=Te.b;ge?(g[0]=Ce,g[1]=Ge,g[2]=Oe,g[3]=Ae,ee.clearBufferuiv(ee.COLOR,0,g)):(_[0]=Ce,_[1]=Ge,_[2]=Oe,_[3]=Ae,ee.clearBufferiv(ee.COLOR,0,_))}else K|=ee.COLOR_BUFFER_BIT}D&&(K|=ee.DEPTH_BUFFER_BIT),O&&(K|=ee.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ee.clear(K)},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",ie,!1),t.removeEventListener("webglcontextrestored",xe,!1),t.removeEventListener("webglcontextcreationerror",we,!1),Ee.dispose(),ve.dispose(),B.dispose(),A.dispose(),F.dispose(),le.dispose(),J.dispose(),H.dispose(),pe.dispose(),q.dispose(),q.removeEventListener("sessionstart",Oi),q.removeEventListener("sessionend",xs),ir.stop()};function ie(R){R.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),b=!0}function xe(){console.log("THREE.WebGLRenderer: Context Restored."),b=!1;const R=We.autoReset,D=Re.enabled,O=Re.autoUpdate,K=Re.needsUpdate,G=Re.type;re(),We.autoReset=R,Re.enabled=D,Re.autoUpdate=O,Re.needsUpdate=K,Re.type=G}function we(R){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",R.statusMessage)}function Ye(R){const D=R.target;D.removeEventListener("dispose",Ye),ut(D)}function ut(R){it(R),B.remove(R)}function it(R){const D=B.get(R).programs;D!==void 0&&(D.forEach(function(O){pe.releaseProgram(O)}),R.isShaderMaterial&&pe.releaseShaderCache(R))}this.renderBufferDirect=function(R,D,O,K,G,he){D===null&&(D=Qe);const ge=G.isMesh&&G.matrixWorld.determinant()<0,Te=fo(R,D,O,K,G);Ie.setMaterial(K,ge);let Ae=O.index,Ce=1;if(K.wireframe===!0){if(Ae=j.getWireframeAttribute(O),Ae===void 0)return;Ce=2}const Ge=O.drawRange,Oe=O.attributes.position;let nt=Ge.start*Ce,ht=(Ge.start+Ge.count)*Ce;he!==null&&(nt=Math.max(nt,he.start*Ce),ht=Math.min(ht,(he.start+he.count)*Ce)),Ae!==null?(nt=Math.max(nt,0),ht=Math.min(ht,Ae.count)):Oe!=null&&(nt=Math.max(nt,0),ht=Math.min(ht,Oe.count));const Je=ht-nt;if(Je<0||Je===1/0)return;J.setup(G,K,Te,O,Ae);let $e,rt=Se;if(Ae!==null&&($e=W.get(Ae),rt=Be,rt.setIndex($e)),G.isMesh)K.wireframe===!0?(Ie.setLineWidth(K.wireframeLinewidth*ot()),rt.setMode(ee.LINES)):rt.setMode(ee.TRIANGLES);else if(G.isLine){let Ue=K.linewidth;Ue===void 0&&(Ue=1),Ie.setLineWidth(Ue*ot()),G.isLineSegments?rt.setMode(ee.LINES):G.isLineLoop?rt.setMode(ee.LINE_LOOP):rt.setMode(ee.LINE_STRIP)}else G.isPoints?rt.setMode(ee.POINTS):G.isSprite&&rt.setMode(ee.TRIANGLES);if(G.isBatchedMesh)if(G._multiDrawInstances!==null)rt.renderMultiDrawInstances(G._multiDrawStarts,G._multiDrawCounts,G._multiDrawCount,G._multiDrawInstances);else if(Ne.get("WEBGL_multi_draw"))rt.renderMultiDraw(G._multiDrawStarts,G._multiDrawCounts,G._multiDrawCount);else{const Ue=G._multiDrawStarts,dn=G._multiDrawCounts,yt=G._multiDrawCount,Vt=Ae?W.get(Ae).bytesPerElement:1,Yr=B.get(K).currentProgram.getUniforms();for(let bt=0;bt{function he(){if(K.forEach(function(ge){B.get(ge).currentProgram.isReady()&&K.delete(ge)}),K.size===0){G(R);return}setTimeout(he,10)}Ne.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let Kt=null;function ri(R){Kt&&Kt(R)}function Oi(){ir.stop()}function xs(){ir.start()}const ir=new NT;ir.setAnimationLoop(ri),typeof self<"u"&&ir.setContext(self),this.setAnimationLoop=function(R){Kt=R,q.setAnimationLoop(R),R===null?ir.stop():ir.start()},q.addEventListener("sessionstart",Oi),q.addEventListener("sessionend",xs),this.render=function(R,D){if(D!==void 0&&D.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;if(R.matrixWorldAutoUpdate===!0&&R.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),q.enabled===!0&&q.isPresenting===!0&&(q.cameraAutoUpdate===!0&&q.updateCamera(D),D=q.getCamera()),R.isScene===!0&&R.onBeforeRender(y,R,D,C),d=ve.get(R,v.length),d.init(D),v.push(d),be.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),$.setFromProjectionMatrix(be),me=this.localClippingEnabled,oe=ue.init(this.clippingPlanes,me),m=Ee.get(R,x.length),m.init(),x.push(m),q.enabled===!0&&q.isPresenting===!0){const he=y.xr.getDepthSensingMesh();he!==null&&ys(he,D,-1/0,y.sortObjects)}ys(R,D,0,y.sortObjects),m.finish(),y.sortObjects===!0&&m.sort(Z,ae),V=q.enabled===!1||q.isPresenting===!1||q.hasDepthSensing()===!1,V&&Pe.addToRenderList(m,R),this.info.render.frame++,oe===!0&&ue.beginShadows();const O=d.state.shadowsArray;Re.render(O,R,D),oe===!0&&ue.endShadows(),this.info.autoReset===!0&&this.info.reset();const K=m.opaque,G=m.transmissive;if(d.setupLights(),D.isArrayCamera){const he=D.cameras;if(G.length>0)for(let ge=0,Te=he.length;ge0&&co(K,G,R,D),V&&Pe.render(R),jr(m,R,D);C!==null&&(E.updateMultisampleRenderTarget(C),E.updateRenderTargetMipmap(C)),R.isScene===!0&&R.onAfterRender(y,R,D),J.resetDefaultState(),M=-1,S=null,v.pop(),v.length>0?(d=v[v.length-1],oe===!0&&ue.setGlobalState(y.clippingPlanes,d.state.camera)):d=null,x.pop(),x.length>0?m=x[x.length-1]:m=null};function ys(R,D,O,K){if(R.visible===!1)return;if(R.layers.test(D.layers)){if(R.isGroup)O=R.renderOrder;else if(R.isLOD)R.autoUpdate===!0&&R.update(D);else if(R.isLight)d.pushLight(R),R.castShadow&&d.pushShadow(R);else if(R.isSprite){if(!R.frustumCulled||$.intersectsSprite(R)){K&&ke.setFromMatrixPosition(R.matrixWorld).applyMatrix4(be);const ge=le.update(R),Te=R.material;Te.visible&&m.push(R,ge,Te,O,ke.z,null)}}else if((R.isMesh||R.isLine||R.isPoints)&&(!R.frustumCulled||$.intersectsObject(R))){const ge=le.update(R),Te=R.material;if(K&&(R.boundingSphere!==void 0?(R.boundingSphere===null&&R.computeBoundingSphere(),ke.copy(R.boundingSphere.center)):(ge.boundingSphere===null&&ge.computeBoundingSphere(),ke.copy(ge.boundingSphere.center)),ke.applyMatrix4(R.matrixWorld).applyMatrix4(be)),Array.isArray(Te)){const Ae=ge.groups;for(let Ce=0,Ge=Ae.length;Ce0&&yr(G,D,O),he.length>0&&yr(he,D,O),ge.length>0&&yr(ge,D,O),Ie.buffers.depth.setTest(!0),Ie.buffers.depth.setMask(!0),Ie.buffers.color.setMask(!0),Ie.setPolygonOffset(!1)}function co(R,D,O,K){if((O.isScene===!0?O.overrideMaterial:null)!==null)return;d.state.transmissionRenderTarget[K.id]===void 0&&(d.state.transmissionRenderTarget[K.id]=new la(1,1,{generateMipmaps:!0,type:Ne.has("EXT_color_buffer_half_float")||Ne.has("EXT_color_buffer_float")?wd:Zs,minFilter:os,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:wt.workingColorSpace}));const he=d.state.transmissionRenderTarget[K.id],ge=K.viewport||P;he.setSize(ge.z,ge.w);const Te=y.getRenderTarget();y.setRenderTarget(he),y.getClearColor(N),X=y.getClearAlpha(),X<1&&y.setClearColor(16777215,.5),y.clear(),V&&Pe.render(O);const Ae=y.toneMapping;y.toneMapping=Ko;const Ce=K.viewport;if(K.viewport!==void 0&&(K.viewport=void 0),d.setupLightsView(K),oe===!0&&ue.setGlobalState(y.clippingPlanes,K),yr(R,O,K),E.updateMultisampleRenderTarget(he),E.updateRenderTargetMipmap(he),Ne.has("WEBGL_multisampled_render_to_texture")===!1){let Ge=!1;for(let Oe=0,nt=D.length;Oe0),Oe=!!O.morphAttributes.position,nt=!!O.morphAttributes.normal,ht=!!O.morphAttributes.color;let Je=Ko;K.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(Je=y.toneMapping);const $e=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,rt=$e!==void 0?$e.length:0,Ue=B.get(K),dn=d.state.lights;if(oe===!0&&(me===!0||R!==S)){const yi=R===S&&K.id===M;ue.setState(K,R,yi)}let yt=!1;K.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==dn.state.version||Ue.outputColorSpace!==Te||G.isBatchedMesh&&Ue.batching===!1||!G.isBatchedMesh&&Ue.batching===!0||G.isBatchedMesh&&Ue.batchingColor===!0&&G.colorTexture===null||G.isBatchedMesh&&Ue.batchingColor===!1&&G.colorTexture!==null||G.isInstancedMesh&&Ue.instancing===!1||!G.isInstancedMesh&&Ue.instancing===!0||G.isSkinnedMesh&&Ue.skinning===!1||!G.isSkinnedMesh&&Ue.skinning===!0||G.isInstancedMesh&&Ue.instancingColor===!0&&G.instanceColor===null||G.isInstancedMesh&&Ue.instancingColor===!1&&G.instanceColor!==null||G.isInstancedMesh&&Ue.instancingMorph===!0&&G.morphTexture===null||G.isInstancedMesh&&Ue.instancingMorph===!1&&G.morphTexture!==null||Ue.envMap!==Ae||K.fog===!0&&Ue.fog!==he||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==ue.numPlanes||Ue.numIntersection!==ue.numIntersection)||Ue.vertexAlphas!==Ce||Ue.vertexTangents!==Ge||Ue.morphTargets!==Oe||Ue.morphNormals!==nt||Ue.morphColors!==ht||Ue.toneMapping!==Je||Ue.morphTargetsCount!==rt)&&(yt=!0):(yt=!0,Ue.__version=K.version);let Vt=Ue.currentProgram;yt===!0&&(Vt=qr(K,D,G));let Yr=!1,bt=!1,xi=!1;const It=Vt.getUniforms(),tn=Ue.uniforms;if(Ie.useProgram(Vt.program)&&(Yr=!0,bt=!0,xi=!0),K.id!==M&&(M=K.id,bt=!0),Yr||S!==R){Ie.buffers.depth.getReversed()?(de.copy(R.projectionMatrix),I4(de),D4(de),It.setValue(ee,"projectionMatrix",de)):It.setValue(ee,"projectionMatrix",R.projectionMatrix),It.setValue(ee,"viewMatrix",R.matrixWorldInverse);const Sr=It.map.cameraPosition;Sr!==void 0&&Sr.setValue(ee,Le.setFromMatrixPosition(R.matrixWorld)),Ze.logarithmicDepthBuffer&&It.setValue(ee,"logDepthBufFC",2/(Math.log(R.far+1)/Math.LN2)),(K.isMeshPhongMaterial||K.isMeshToonMaterial||K.isMeshLambertMaterial||K.isMeshBasicMaterial||K.isMeshStandardMaterial||K.isShaderMaterial)&&It.setValue(ee,"isOrthographic",R.isOrthographicCamera===!0),S!==R&&(S=R,bt=!0,xi=!0)}if(G.isSkinnedMesh){It.setOptional(ee,G,"bindMatrix"),It.setOptional(ee,G,"bindMatrixInverse");const yi=G.skeleton;yi&&(yi.boneTexture===null&&yi.computeBoneTexture(),It.setValue(ee,"boneTexture",yi.boneTexture,E))}G.isBatchedMesh&&(It.setOptional(ee,G,"batchingTexture"),It.setValue(ee,"batchingTexture",G._matricesTexture,E),It.setOptional(ee,G,"batchingIdTexture"),It.setValue(ee,"batchingIdTexture",G._indirectTexture,E),It.setOptional(ee,G,"batchingColorTexture"),G._colorsTexture!==null&&It.setValue(ee,"batchingColorTexture",G._colorsTexture,E));const Ms=O.morphAttributes;if((Ms.position!==void 0||Ms.normal!==void 0||Ms.color!==void 0)&&ye.update(G,O,Vt),(bt||Ue.receiveShadow!==G.receiveShadow)&&(Ue.receiveShadow=G.receiveShadow,It.setValue(ee,"receiveShadow",G.receiveShadow)),K.isMeshGouraudMaterial&&K.envMap!==null&&(tn.envMap.value=Ae,tn.flipEnvMap.value=Ae.isCubeTexture&&Ae.isRenderTargetTexture===!1?-1:1),K.isMeshStandardMaterial&&K.envMap===null&&D.environment!==null&&(tn.envMapIntensity.value=D.environmentIntensity),bt&&(It.setValue(ee,"toneMappingExposure",y.toneMappingExposure),Ue.needsLights&&I(tn,xi),he&&K.fog===!0&&ce.refreshFogUniforms(tn,he),ce.refreshMaterialUniforms(tn,K,L,te,d.state.transmissionRenderTarget[R.id]),Mp.upload(ee,ya(Ue),tn,E)),K.isShaderMaterial&&K.uniformsNeedUpdate===!0&&(Mp.upload(ee,ya(Ue),tn,E),K.uniformsNeedUpdate=!1),K.isSpriteMaterial&&It.setValue(ee,"center",G.center),It.setValue(ee,"modelViewMatrix",G.modelViewMatrix),It.setValue(ee,"normalMatrix",G.normalMatrix),It.setValue(ee,"modelMatrix",G.matrixWorld),K.isShaderMaterial||K.isRawShaderMaterial){const yi=K.uniformsGroups;for(let Sr=0,ho=yi.length;Sr0&&E.useMultisampledRTT(R)===!1?G=B.get(R).__webglMultisampledFramebuffer:Array.isArray(Ge)?G=Ge[O]:G=Ge,P.copy(R.viewport),k.copy(R.scissor),U=R.scissorTest}else P.copy(fe).multiplyScalar(L).floor(),k.copy(Me).multiplyScalar(L).floor(),U=Ve;if(Ie.bindFramebuffer(ee.FRAMEBUFFER,G)&&K&&Ie.drawBuffers(R,G),Ie.viewport(P),Ie.scissor(k),Ie.setScissorTest(U),he){const Ae=B.get(R.texture);ee.framebufferTexture2D(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_CUBE_MAP_POSITIVE_X+D,Ae.__webglTexture,O)}else if(ge){const Ae=B.get(R.texture),Ce=D||0;ee.framebufferTextureLayer(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,Ae.__webglTexture,O||0,Ce)}M=-1},this.readRenderTargetPixels=function(R,D,O,K,G,he,ge){if(!(R&&R.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Te=B.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&ge!==void 0&&(Te=Te[ge]),Te){Ie.bindFramebuffer(ee.FRAMEBUFFER,Te);try{const Ae=R.texture,Ce=Ae.format,Ge=Ae.type;if(!Ze.textureFormatReadable(Ce)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ze.textureTypeReadable(Ge)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=R.width-K&&O>=0&&O<=R.height-G&&ee.readPixels(D,O,K,G,je.convert(Ce),je.convert(Ge),he)}finally{const Ae=C!==null?B.get(C).__webglFramebuffer:null;Ie.bindFramebuffer(ee.FRAMEBUFFER,Ae)}}},this.readRenderTargetPixelsAsync=async function(R,D,O,K,G,he,ge){if(!(R&&R.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Te=B.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&ge!==void 0&&(Te=Te[ge]),Te){const Ae=R.texture,Ce=Ae.format,Ge=Ae.type;if(!Ze.textureFormatReadable(Ce))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ze.textureTypeReadable(Ge))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(D>=0&&D<=R.width-K&&O>=0&&O<=R.height-G){Ie.bindFramebuffer(ee.FRAMEBUFFER,Te);const Oe=ee.createBuffer();ee.bindBuffer(ee.PIXEL_PACK_BUFFER,Oe),ee.bufferData(ee.PIXEL_PACK_BUFFER,he.byteLength,ee.STREAM_READ),ee.readPixels(D,O,K,G,je.convert(Ce),je.convert(Ge),0);const nt=C!==null?B.get(C).__webglFramebuffer:null;Ie.bindFramebuffer(ee.FRAMEBUFFER,nt);const ht=ee.fenceSync(ee.SYNC_GPU_COMMANDS_COMPLETE,0);return ee.flush(),await L4(ee,ht,4),ee.bindBuffer(ee.PIXEL_PACK_BUFFER,Oe),ee.getBufferSubData(ee.PIXEL_PACK_BUFFER,0,he),ee.deleteBuffer(Oe),ee.deleteSync(ht),he}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(R,D=null,O=0){R.isTexture!==!0&&(gf("WebGLRenderer: copyFramebufferToTexture function signature has changed."),D=arguments[0]||null,R=arguments[1]);const K=Math.pow(2,-O),G=Math.floor(R.image.width*K),he=Math.floor(R.image.height*K),ge=D!==null?D.x:0,Te=D!==null?D.y:0;E.setTexture2D(R,0),ee.copyTexSubImage2D(ee.TEXTURE_2D,O,0,0,ge,Te,G,he),Ie.unbindTexture()},this.copyTextureToTexture=function(R,D,O=null,K=null,G=0){R.isTexture!==!0&&(gf("WebGLRenderer: copyTextureToTexture function signature has changed."),K=arguments[0]||null,R=arguments[1],D=arguments[2],G=arguments[3]||0,O=null);let he,ge,Te,Ae,Ce,Ge,Oe,nt,ht;const Je=R.isCompressedTexture?R.mipmaps[G]:R.image;O!==null?(he=O.max.x-O.min.x,ge=O.max.y-O.min.y,Te=O.isBox3?O.max.z-O.min.z:1,Ae=O.min.x,Ce=O.min.y,Ge=O.isBox3?O.min.z:0):(he=Je.width,ge=Je.height,Te=Je.depth||1,Ae=0,Ce=0,Ge=0),K!==null?(Oe=K.x,nt=K.y,ht=K.z):(Oe=0,nt=0,ht=0);const $e=je.convert(D.format),rt=je.convert(D.type);let Ue;D.isData3DTexture?(E.setTexture3D(D,0),Ue=ee.TEXTURE_3D):D.isDataArrayTexture||D.isCompressedArrayTexture?(E.setTexture2DArray(D,0),Ue=ee.TEXTURE_2D_ARRAY):(E.setTexture2D(D,0),Ue=ee.TEXTURE_2D),ee.pixelStorei(ee.UNPACK_FLIP_Y_WEBGL,D.flipY),ee.pixelStorei(ee.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),ee.pixelStorei(ee.UNPACK_ALIGNMENT,D.unpackAlignment);const dn=ee.getParameter(ee.UNPACK_ROW_LENGTH),yt=ee.getParameter(ee.UNPACK_IMAGE_HEIGHT),Vt=ee.getParameter(ee.UNPACK_SKIP_PIXELS),Yr=ee.getParameter(ee.UNPACK_SKIP_ROWS),bt=ee.getParameter(ee.UNPACK_SKIP_IMAGES);ee.pixelStorei(ee.UNPACK_ROW_LENGTH,Je.width),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,Je.height),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,Ae),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,Ce),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,Ge);const xi=R.isDataArrayTexture||R.isData3DTexture,It=D.isDataArrayTexture||D.isData3DTexture;if(R.isRenderTargetTexture||R.isDepthTexture){const tn=B.get(R),Ms=B.get(D),yi=B.get(tn.__renderTarget),Sr=B.get(Ms.__renderTarget);Ie.bindFramebuffer(ee.READ_FRAMEBUFFER,yi.__webglFramebuffer),Ie.bindFramebuffer(ee.DRAW_FRAMEBUFFER,Sr.__webglFramebuffer);for(let ho=0;ho0&&(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}};class V6{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=_v,this.updateRanges=[],this.version=0,this.uuid=Br()}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.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;si)return;cg.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(cg);if(!(le.far))return{distance:l,point:XM.clone().applyMatrix4(n.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:n}}const jM=new Y,qM=new Y;class q6 extends qm{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sr.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class WT extends mi{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}let $T=class XT extends xr{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const u=[],f=new Y,h=new Y,p=[],g=[],_=[],m=[];for(let d=0;d<=i;d++){const x=[],v=d/i;let y=0;d===0&&o===0?y=.5/t:d===i&&l===Math.PI&&(y=-.5/t);for(let b=0;b<=t;b++){const w=b/t;f.x=-e*Math.cos(r+w*s)*Math.sin(o+v*a),f.y=e*Math.cos(o+v*a),f.z=e*Math.sin(r+w*s)*Math.sin(o+v*a),g.push(f.x,f.y,f.z),h.copy(f).normalize(),_.push(h.x,h.y,h.z),m.push(w+y,1-v),x.push(c++)}u.push(x)}for(let d=0;d0)&&p.push(v,y,w),(d!==i-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}function mh(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function Q6(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function J6(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function ZM(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function qT(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}class bd{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e=s)){const a=t[1];e=s)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&Q6(r))for(let a=0,l=r.length;a!==l;++a){const c=r[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===D0,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}vs.prototype.TimeBufferType=Float32Array;vs.prototype.ValueBufferType=Float32Array;vs.prototype.DefaultInterpolation=Yf;class bu extends vs{constructor(e,t,i){super(e,t,i)}}bu.prototype.ValueTypeName="bool";bu.prototype.ValueBufferType=Array;bu.prototype.DefaultInterpolation=qf;bu.prototype.InterpolantFactoryMethodLinear=void 0;bu.prototype.InterpolantFactoryMethodSmooth=void 0;class YT extends vs{}YT.prototype.ValueTypeName="color";class nu extends vs{}nu.prototype.ValueTypeName="number";class i8 extends bd{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let c=e*a;for(let u=c+a;c!==u;c+=4)mr.slerpFlat(s,0,o,c-a,o,c,l);return s}}class iu extends vs{InterpolantFactoryMethodLinear(e){return new i8(this.times,this.values,this.getValueSize(),e)}}iu.prototype.ValueTypeName="quaternion";iu.prototype.InterpolantFactoryMethodSmooth=void 0;class Ru extends vs{constructor(e,t,i){super(e,t,i)}}Ru.prototype.ValueTypeName="string";Ru.prototype.ValueBufferType=Array;Ru.prototype.DefaultInterpolation=qf;Ru.prototype.InterpolantFactoryMethodLinear=void 0;Ru.prototype.InterpolantFactoryMethodSmooth=void 0;class ru extends vs{}ru.prototype.ValueTypeName="vector";class r8{constructor(e="",t=-1,i=[],r=n4){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Br(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(o8(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(vs.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a1){const f=u[1];let h=r[f];h||(r[f]=h=[]),h.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(f,h,p,g,_){if(p.length!==0){const m=[],d=[];qT(p,m,d,g),m.length!==0&&_.push(new f(h,m,d))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f{t&&t(s),this.manager.itemEnd(e)},0),s;if(Rs[e]!==void 0){Rs[e].push({onLoad:t,onProgress:i,onError:r});return}Rs[e]=[],Rs[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=Rs[e],f=c.body.getReader(),h=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=h?parseInt(h):0,g=p!==0;let _=0;const m=new ReadableStream({start(d){x();function x(){f.read().then(({done:v,value:y})=>{if(v)d.close();else{_+=y.byteLength;const b=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:p});for(let w=0,T=u.length;w{d.error(v)})}}});return new Response(m)}else throw new l8(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),h=f&&f[1]?f[1].toLowerCase():void 0,p=new TextDecoder(h);return c.arrayBuffer().then(g=>p.decode(g))}}}).then(c=>{$o.add(e,c);const u=Rs[e];delete Rs[e];for(let f=0,h=u.length;f{const u=Rs[e];if(u===void 0)throw this.manager.itemError(e),c;delete Rs[e];for(let f=0,h=u.length;f{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class c8 extends bl{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$o.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Kf("img");function l(){u(),$o.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class Kx extends bl{constructor(e){super(e)}load(e,t,i,r){const s=new mi,o=new c8(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class Ym extends fn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new tt(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const ug=new dt,QM=new Y,JM=new Y;class Zx{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new lt(512,512),this.map=null,this.mapPass=null,this.matrix=new dt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Hx,this._frameExtents=new lt(1,1),this._viewportCount=1,this._viewports=[new Ct(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;QM.setFromMatrixPosition(e.matrixWorld),t.position.copy(QM),JM.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(JM),t.updateMatrixWorld(),ug.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ug),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(ug)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class u8 extends Zx{constructor(){super(new Jn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=eu*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class f8 extends Ym{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(fn.DEFAULT_UP),this.updateMatrix(),this.target=new fn,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new u8}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const e2=new dt,Wu=new Y,fg=new Y;class d8 extends Zx{constructor(){super(new Jn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new lt(4,2),this._viewportCount=6,this._viewports=[new Ct(2,1,1,1),new Ct(0,1,1,1),new Ct(3,1,1,1),new Ct(1,1,1,1),new Ct(3,0,1,1),new Ct(1,0,1,1)],this._cubeDirections=[new Y(1,0,0),new Y(-1,0,0),new Y(0,0,1),new Y(0,0,-1),new Y(0,1,0),new Y(0,-1,0)],this._cubeUps=[new Y(0,1,0),new Y(0,1,0),new Y(0,1,0),new Y(0,1,0),new Y(0,0,1),new Y(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),Wu.setFromMatrixPosition(e.matrixWorld),i.position.copy(Wu),fg.copy(i.position),fg.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(fg),i.updateMatrixWorld(),r.makeTranslation(-Wu.x,-Wu.y,-Wu.z),e2.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(e2)}}class h8 extends Ym{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new d8}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class p8 extends Zx{constructor(){super(new Vx(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ZT extends Ym{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(fn.DEFAULT_UP),this.updateMatrix(),this.target=new fn,this.shadow=new p8}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class m8 extends Ym{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Pf{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$o.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{r&&r(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return $o.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),$o.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});$o.add(e,l),s.manager.itemStart(e)}}let gh;class QT{static getContext(){return gh===void 0&&(gh=new(window.AudioContext||window.webkitAudioContext)),gh}static setContext(e){gh=e}}class _8 extends bl{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Yx(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);QT.getContext().decodeAudioData(c,function(f){t(f)}).catch(a)}catch(c){a(c)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}class JT{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=t2(),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=t2();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function t2(){return performance.now()}const ba=new Y,n2=new mr,v8=new Y,Ra=new Y;class x8 extends fn{constructor(){super(),this.type="AudioListener",this.context=QT.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new JT}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ba,n2,v8),Ra.set(0,0,-1).applyQuaternion(n2),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ba.x,r),t.positionY.linearRampToValueAtTime(ba.y,r),t.positionZ.linearRampToValueAtTime(ba.z,r),t.forwardX.linearRampToValueAtTime(Ra.x,r),t.forwardY.linearRampToValueAtTime(Ra.y,r),t.forwardZ.linearRampToValueAtTime(Ra.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(ba.x,ba.y,ba.z),t.setOrientation(Ra.x,Ra.y,Ra.z,i.x,i.y,i.z)}}class y8 extends fn{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0?(m=Math.sqrt(_+1)*2,n[3]=.25*m,n[0]=(f-p)/m,n[1]=(h-l)/m,n[2]=(a-c)/m):o>u&&o>g?(m=Math.sqrt(1+o-u-g)*2,n[3]=(f-p)/m,n[0]=.25*m,n[1]=(a+c)/m,n[2]=(h+l)/m):u>g?(m=Math.sqrt(1+u-o-g)*2,n[3]=(h-l)/m,n[0]=(a+c)/m,n[1]=.25*m,n[2]=(f+p)/m):(m=Math.sqrt(1+g-o-u)*2,n[3]=(a-c)/m,n[0]=(h+l)/m,n[1]=(f+p)/m,n[2]=.25*m),n}function F8(n,e,t,i){var r=e[0],s=e[1],o=e[2],a=e[3],l=r+r,c=s+s,u=o+o,f=r*l,h=r*c,p=r*u,g=s*c,_=s*u,m=o*u,d=a*l,x=a*c,v=a*u,y=i[0],b=i[1],w=i[2];return n[0]=(1-(g+m))*y,n[1]=(h+v)*y,n[2]=(p-x)*y,n[3]=0,n[4]=(h-v)*b,n[5]=(1-(f+m))*b,n[6]=(_+d)*b,n[7]=0,n[8]=(p+x)*w,n[9]=(_-d)*w,n[10]=(1-(f+g))*w,n[11]=0,n[12]=t[0],n[13]=t[1],n[14]=t[2],n[15]=1,n}function k8(n,e,t,i,r){var s=1/Math.tan(e/2),o;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[11]=-1,n[12]=0,n[13]=0,n[15]=0,r!=null&&r!==1/0?(o=1/(i-r),n[10]=(r+i)*o,n[14]=2*r*i*o):(n[10]=-1,n[14]=-2*i),n}var s2=k8;function Ji(){var n=new Ui(3);return Ui!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function B8(n){var e=n[0],t=n[1],i=n[2];return Math.hypot(e,t,i)}function Fr(n,e,t){var i=new Ui(3);return i[0]=n,i[1]=e,i[2]=t,i}function dg(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n}function z8(n,e,t,i){return n[0]=e,n[1]=t,n[2]=i,n}function H8(n,e,t){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n}function iA(n,e){var 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 V8(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]}function hg(n,e,t){var i=e[0],r=e[1],s=e[2],o=t[0],a=t[1],l=t[2];return n[0]=r*l-s*a,n[1]=s*o-i*l,n[2]=i*a-r*o,n}function wv(n,e,t,i){var r=e[0],s=e[1],o=e[2];return n[0]=r+i*(t[0]-r),n[1]=s+i*(t[1]-s),n[2]=o+i*(t[2]-o),n}function G8(n,e,t){var i=t[0],r=t[1],s=t[2],o=t[3],a=e[0],l=e[1],c=e[2],u=r*c-s*l,f=s*a-i*c,h=i*l-r*a,p=r*h-s*f,g=s*u-i*h,_=i*f-r*u,m=o*2;return u*=m,f*=m,h*=m,p*=2,g*=2,_*=2,n[0]=a+u+p,n[1]=l+f+g,n[2]=c+h+_,n}var W8=B8;(function(){var n=Ji();return function(e,t,i,r,s,o){var a,l;for(t||(t=3),i||(i=0),r?l=Math.min(r*t+i,e.length):l=e.length,a=i;a0&&(o=1/Math.sqrt(o)),n[0]=t*o,n[1]=i*o,n[2]=r*o,n[3]=s*o,n}(function(){var n=$8();return function(e,t,i,r,s,o){var a,l;for(t||(t=4),i||(i=0),r?l=Math.min(r*t+i,e.length):l=e.length,a=i;aN8?(h=Math.acos(p),g=Math.sin(h),_=Math.sin((1-i)*h)/g,m=Math.sin(i*h)/g):(_=1-i,m=i),n[0]=_*r+m*l,n[1]=_*s+m*c,n[2]=_*o+m*u,n[3]=_*a+m*f,n}function Z8(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n[3]=e[3],n}function Q8(n,e){var 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{var r=0;e[4]>e[0]&&(r=1),e[8]>e[r*3+r]&&(r=2);var s=(r+1)%3,o=(r+2)%3;i=Math.sqrt(e[r*3+r]-e[s*3+s]-e[o*3+o]+1),n[r]=.5*i,i=.5/i,n[3]=(e[s*3+o]-e[o*3+s])*i,n[s]=(e[s*3+r]+e[r*3+s])*i,n[o]=(e[o*3+r]+e[r*3+o])*i}return n}var tm=X8,pg=j8,o2=q8,Km=Y8;(function(){var n=Ji(),e=Fr(1,0,0),t=Fr(0,1,0);return function(i,r,s){var o=V8(r,s);return o<-.999999?(hg(n,e,r),W8(n)<1e-6&&hg(n,t,r),iA(n,n),rA(i,n,Math.PI),i):o>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(hg(n,r,s),i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=1+o,Km(i,i))}})();(function(){var n=zr(),e=zr();return function(t,i,r,s,o,a){return If(n,i,o,a),If(e,r,s,a),If(t,n,e,2*a*(1-a)),t}})();(function(){var n=U8();return function(e,t,i,r){return n[0]=i[0],n[3]=i[1],n[6]=i[2],n[1]=r[0],n[4]=r[1],n[7]=r[2],n[2]=-t[0],n[5]=-t[1],n[8]=-t[2],Km(e,Q8(e,n))}})();const wn=Symbol("@immersive-web-emulation-runtime/xr-space");class ti extends EventTarget{constructor(e,t){super(),this[wn]={parentSpace:e,offsetMatrix:t?O8(t):Ci(),emulated:!0}}}class J8 extends ti{constructor(){super(void 0,Ci())}}class nm{static updateOffsetPosition(e,t){const i=e[wn].offsetMatrix;Zf(i,t)}static updateOffsetQuaternion(e,t){const i=e[wn].offsetMatrix,r=Ji();Qf(r,i),Rd(i,t,r)}static updateOffsetMatrix(e,t){const i=e[wn].offsetMatrix;eA(i,t)}static calculateGlobalOffsetMatrix(e,t=Ci()){const i=e[wn].parentSpace?nm.calculateGlobalOffsetMatrix(e[wn].parentSpace):Ci();return nA(t,i,e[wn].offsetMatrix),t}}let ol=class sA{constructor(e=0,t=0,i=0){this.vec3=Fr(e,t,i),this.tempVec3=Ji()}get x(){return this.vec3[0]}set x(e){this.vec3[0]=e}get y(){return this.vec3[1]}set y(e){this.vec3[1]=e}get z(){return this.vec3[2]}set z(e){this.vec3[2]=e}set(e,t,i){return z8(this.vec3,e,t,i),this}clone(){return new sA(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}normalize(){return dg(this.tempVec3,this.vec3),iA(this.vec3,this.tempVec3),this}add(e){return dg(this.tempVec3,this.vec3),H8(this.vec3,this.tempVec3,e.vec3),this}applyQuaternion(e){return dg(this.tempVec3,this.vec3),G8(this.vec3,this.tempVec3,e.quat),this}},Df=class oA{constructor(e=0,t=0,i=0,r=1){this.quat=tm(e,t,i,r),this.tempQuat=zr()}get x(){return this.quat[0]}set x(e){this.quat[0]=e}get y(){return this.quat[1]}set y(e){this.quat[1]=e}get z(){return this.quat[2]}set z(e){this.quat[2]=e}get w(){return this.quat[3]}set w(e){this.quat[3]=e}set(e,t,i,r){return o2(this.quat,e,t,i,r),this}clone(){return new oA(this.x,this.y,this.z,this.w)}copy(e){return o2(this.quat,e.x,e.y,e.z,e.w),this}normalize(){return pg(this.tempQuat,this.quat),Km(this.quat,this.tempQuat),this}invert(){return pg(this.tempQuat,this.quat),Z8(this.quat,this.tempQuat),this}multiply(e){return pg(this.tempQuat,this.quat),K8(this.quat,this.tempQuat,e.quat),this}setFromAxisAngle(e,t){return rA(this.quat,e.vec3,t),this}};const et=Symbol("@immersive-web-emulation-runtime/gamepad");var Jf;(function(n){n.None="",n.Standard="standard",n.XRStandard="xr-standard"})(Jf||(Jf={}));class aA{constructor(e,t){this[et]={type:e,eventTrigger:t,pressed:!1,touched:!1,value:0,lastFrameValue:0,pendingValue:null}}get pressed(){return this[et].type==="manual"?this[et].pressed:this[et].value>0}get touched(){return this[et].type==="manual"?this[et].touched:this[et].touched||this.pressed}get value(){return this[et].value}}class eN{constructor(){this.pressed=!1,this.touched=!1,this.value=0}}class ey{constructor(e,t="",i=-1){this[et]={id:t,index:i,connected:!1,timestamp:performance.now(),mapping:e.mapping,buttonsMap:{},buttonsSequence:[],axesMap:{},axesSequence:[],hapticActuators:[]},e.buttons.forEach(r=>{var s;r===null?this[et].buttonsSequence.push(null):(this[et].buttonsSequence.push(r.id),this[et].buttonsMap[r.id]=new aA(r.type,(s=r.eventTrigger)!==null&&s!==void 0?s:null))}),e.axes.forEach(r=>{r===null?this[et].axesSequence.push(null):(this[et].axesSequence.push(r.id+r.type),this[et].axesMap[r.id]||(this[et].axesMap[r.id]={x:0,y:0}))})}get id(){return this[et].id}get index(){return this[et].index}get connected(){return this[et].connected}get timestamp(){return this[et].timestamp}get mapping(){return this[et].mapping}get axes(){const e=[];return this[et].axesSequence.forEach(t=>{if(t===null)e.push(null);else{const i=t.substring(0,t.length-6),r=t.substring(t.length-6);e.push(r==="y-axis"?this[et].axesMap[i].y:this[et].axesMap[i].x)}}),e}get buttons(){return this[et].buttonsSequence.map(e=>e===null?new eN:this[et].buttonsMap[e])}get hapticActuators(){return this[et].hapticActuators}get vibrationActuator(){return null}}var Wi;(function(n){n.None="none",n.Left="left",n.Right="right"})(Wi||(Wi={}));var im;(function(n){n.Gaze="gaze",n.TrackedPointer="tracked-pointer",n.Screen="screen",n.TransientPointer="transient-pointer"})(im||(im={}));class tN extends Array{}const yo=Symbol("@immersive-web-emulation-runtime/xr-input-source");class Zm{constructor(e,t,i,r,s,o,a){this[yo]={handedness:e,targetRayMode:t,targetRaySpace:r,gripSpace:o,profiles:i,gamepad:s,hand:a}}get handedness(){return this[yo].handedness}get targetRayMode(){return this[yo].targetRayMode}get targetRaySpace(){return this[yo].targetRaySpace}get gripSpace(){return this[yo].gripSpace}get profiles(){return this[yo].profiles}get gamepad(){return this[yo].gamepad}get hand(){return this[yo].hand}}class Ep extends Event{constructor(e,t){if(super(e,t),!t.frame)throw new Error("XRInputSourceEventInit.frame is required");if(!t.inputSource)throw new Error("XRInputSourceEventInit.inputSource is required");this.frame=t.frame,this.inputSource=t.inputSource}}const nn=Symbol("@immersive-web-emulation-runtime/xr-tracked-input"),a2={[Wi.Left]:{position:new ol(-.25,1.5,-.4),quaternion:new Df},[Wi.Right]:{position:new ol(.25,1.5,-.4),quaternion:new Df},[Wi.None]:{position:new ol(.25,1.5,-.4),quaternion:new Df}};class lA{constructor(e){this[nn]={inputSource:e,position:a2[e.handedness].position.clone(),quaternion:a2[e.handedness].quaternion.clone(),connected:!0,lastFrameConnected:!1,inputSourceChanged:!0}}get position(){return this[nn].position}get quaternion(){return this[nn].quaternion}get inputSource(){return this[nn].inputSource}get connected(){return this[nn].connected}set connected(e){this[nn].connected=e,this[nn].inputSource.gamepad[et].connected=e}onFrameStart(e){const t=this[nn].inputSource.targetRaySpace;Rd(t[wn].offsetMatrix,this[nn].quaternion.quat,this[nn].position.vec3);const i=e.session;this[nn].inputSource.gamepad.buttons.forEach(r=>{r instanceof aA&&(r[et].lastFrameValue=r[et].value,r[et].pendingValue!=null&&(r[et].value=r[et].pendingValue,r[et].pendingValue=null),r[et].eventTrigger!=null&&(r[et].lastFrameValue===0&&r[et].value>0?(i.dispatchEvent(new Ep(r[et].eventTrigger,{frame:e,inputSource:this[nn].inputSource})),i.dispatchEvent(new Ep(r[et].eventTrigger+"start",{frame:e,inputSource:this[nn].inputSource}))):r[et].lastFrameValue>0&&r[et].value===0&&i.dispatchEvent(new Ep(r[et].eventTrigger+"end",{frame:e,inputSource:this[nn].inputSource}))))}),this[nn].inputSourceChanged=this.connected!==this[nn].lastFrameConnected,this[nn].lastFrameConnected=this.connected}}const l2=Symbol("@immersive-web-emulation-runtime/xr-controller");class nN extends lA{constructor(e,t,i){if(!e.layout[t])throw new DOMException("Handedness not supported","InvalidStateError");const r=new ti(i),s=e.layout[t].gripOffsetMatrix?new ti(r,e.layout[t].gripOffsetMatrix):void 0,o=[e.profileId,...e.fallbackProfileIds],a=new Zm(t,im.TrackedPointer,o,r,new ey(e.layout[t].gamepad),s);super(a),this[l2]={gamepadConfig:e.layout[t].gamepad}}get gamepadConfig(){return this[l2].gamepadConfig}updateButtonValue(e,t){if(t>1||t<0){console.warn(`Out-of-range value ${t} provided for button ${e}.`);return}const i=this[nn].inputSource.gamepad[et].buttonsMap[e];if(i){if(i[et].type==="binary"&&t!=1&&t!=0){console.warn(`Non-binary value ${t} provided for binary button ${e}.`);return}i[et].pendingValue=t}else console.warn(`Current controller does not have button ${e}.`)}updateButtonTouch(e,t){const i=this[nn].inputSource.gamepad[et].buttonsMap[e];i?i[et].touched=t:console.warn(`Current controller does not have button ${e}.`)}updateAxis(e,t,i){if(i>1||i<-1){console.warn(`Out-of-range value ${i} provided for ${e} axes.`);return}const r=this[nn].inputSource.gamepad[et].axesMap[e];r?t==="x-axis"?r.x=i:t==="y-axis"&&(r.y=i):console.warn(`Current controller does not have ${e} axes.`)}updateAxes(e,t,i){if(t>1||t<-1||i>1||i<-1){console.warn(`Out-of-range value x:${t}, y:${i} provided for ${e} axes.`);return}const r=this[nn].inputSource.gamepad[et].axesMap[e];r?(r.x=t,r.y=i):console.warn(`Current controller does not have ${e} axes.`)}}const Va=Symbol("@immersive-web-emulation-runtime/xr-view");var Xt;(function(n){n.None="none",n.Left="left",n.Right="right"})(Xt||(Xt={}));class cA{constructor(e,t,i,r){this[Va]={eye:e,projectionMatrix:t,transform:i,recommendedViewportScale:null,requestedViewportScale:1,session:r}}get eye(){return this[Va].eye}get projectionMatrix(){return this[Va].projectionMatrix}get transform(){return this[Va].transform}get recommendedViewportScale(){return this[Va].recommendedViewportScale}requestViewportScale(e){if(e===null||e<=0||e>1){console.warn("Invalid scale value. Scale must be > 0 and <= 1.");return}this[Va].requestedViewportScale=e}}const al=Symbol("@immersive-web-emulation-runtime/xr-joint-space");class ty extends ti{constructor(e,t,i){super(t,i),this[al]={jointName:e,radius:0}}get jointName(){return this[al].jointName}}const $u=Symbol("@immersive-web-emulation-runtime/xr-pose");class Qm{constructor(e,t=!1,i=void 0,r=void 0){this[$u]={transform:e,emulatedPosition:t,linearVelocity:i,angularVelocity:r}}get transform(){return this[$u].transform}get emulatedPosition(){return this[$u].emulatedPosition}get linearVelocity(){return this[$u].linearVelocity}get angularVelocity(){return this[$u].angularVelocity}}const c2=Symbol("@immersive-web-emulation-runtime/xr-joint-pose");class uA extends Qm{constructor(e,t,i=!1,r=void 0,s=void 0){super(e,i,r,s),this[c2]={radius:t}}get radius(){return this[c2].radius}}class rm{constructor(e=0,t=0,i=0,r=1){this.x=e,this.y=t,this.z=i,this.w=r,Object.freeze(this)}static fromPoint(e){return new rm(e.x,e.y,e.z,e.w)}matrixTransform(e){return new rm}toJSON(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const _h=typeof globalThis.DOMPointReadOnly<"u"?globalThis.DOMPointReadOnly:rm,Bi=Symbol("@immersive-web-emulation-runtime/xr-rigid-transform");class Jm{constructor(e,t){const i=Fr(0,0,0),r=zr();this[Bi]={matrix:Ci(),position:e?Fr(e.x,e.y,e.z):i,orientation:t?Km(zr(),tm(t.x,t.y,t.z,t.w)):r,inverse:null},this.updateMatrix()}updateMatrix(){Rd(this[Bi].matrix,this[Bi].orientation,this[Bi].position)}get matrix(){return this[Bi].matrix}get position(){const e=this[Bi].position;return new _h(e[0],e[1],e[2],1)}get orientation(){const e=this[Bi].orientation;return new _h(e[0],e[1],e[2],e[3])}get inverse(){if(!this[Bi].inverse){const e=Ci();if(!tA(e,this[Bi].matrix))throw new Error("Matrix is not invertible.");let t=Ji();Qf(t,e);let i=zr();em(i,e),this[Bi].inverse=new Jm(new _h(t[0],t[1],t[2],1),new _h(i[0],i[1],i[2],i[3])),this[Bi].inverse[Bi].inverse=this}return this[Bi].inverse}}const u2=Symbol("@immersive-web-emulation-runtime/xr-viewer-pose");class fA extends Qm{constructor(e,t,i=!1,r=void 0,s=void 0){super(e,i,r,s),this[u2]={views:Object.freeze(t)}}get views(){return this[u2].views}}const Ei=Symbol("@immersive-web-emulation-runtime/xr-frame"),f2=Ci(),d2=Ci(),h2=Ci(),p2=(n,e,t)=>{nm.calculateGlobalOffsetMatrix(e,f2),nm.calculateGlobalOffsetMatrix(t,d2),tA(h2,d2),nA(n,h2,f2)};class dA{constructor(e,t,i,r,s){this[Ei]={session:e,id:t,active:i,animationFrame:r,predictedDisplayTime:s,tempMat4:Ci()}}get session(){return this[Ei].session}get predictedDisplayTime(){return this[Ei].predictedDisplayTime}getPose(e,t){if(!this[Ei].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");p2(this[Ei].tempMat4,e,t);const i=Ji();Qf(i,this[Ei].tempMat4);const r=zr();return em(r,this[Ei].tempMat4),new Qm(new Jm({x:i[0],y:i[1],z:i[2],w:1},{x:r[0],y:r[1],z:r[2],w:r[3]}),e[wn].emulated)}getViewerPose(e){if(!this[Ei].animationFrame)throw new DOMException("getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.","InvalidStateError");const t=this[Ei].session,i=t[_e].device,r=this.getPose(i.viewerSpace,e),s=t[_e].mode===Ot.Inline?[Xt.None]:[Xt.Left,Xt.Right],o=[];return s.forEach(a=>{const l=i.viewSpaces[a],c=this.getPose(l,e),u=t[_e].getProjectionMatrix(a),f=new cA(a,new Float32Array(u),c.transform,t);o.push(f)}),new fA(r.transform,o,!1)}getJointPose(e,t){const i=this.getPose(e,t),r=e[al].radius;return new uA(i.transform,r,!1)}fillJointRadii(e,t){if(e=Array.from(e),!this[Ei].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");if(e.length>t.length)throw new DOMException("The length of jointSpaces is larger than the number of elements in radii","TypeError");let i=!0;for(let r=0;ri.length)throw new DOMException("The length of spaces multiplied by 16 is larger than the number of elements in transforms","TypeError");return e.forEach((r,s)=>{p2(this[Ei].tempMat4,r,t);for(let o=0;o<16;o++)i[s*16+o]=this[Ei].tempMat4[o]}),!0}}class hA extends Event{constructor(e,t){if(super(e,t),!t.session)throw new Error("XRInputSourcesChangeEventInit.session is required");if(!t.added)throw new Error("XRInputSourcesChangeEventInit.added is required");if(!t.removed)throw new Error("XRInputSourcesChangeEventInit.removed is required");this.session=t.session,this.added=t.added,this.removed=t.removed}}var pA;const Oo=Symbol("@immersive-web-emulation-runtime/xr-reference-space");var In;(function(n){n.Viewer="viewer",n.Local="local",n.LocalFloor="local-floor",n.BoundedFloor="bounded-floor",n.Unbounded="unbounded"})(In||(In={}));class ml extends ti{constructor(e,t,i){super(t,i),this[pA]={type:null,onreset:()=>{}},this[Oo].type=e}get onreset(){var e;return(e=this[Oo].onreset)!==null&&e!==void 0?e:()=>{}}set onreset(e){this[Oo].onreset&&this.removeEventListener("reset",this[Oo].onreset),this[Oo].onreset=e,e&&this.addEventListener("reset",e)}getOffsetReferenceSpace(e){return new ml(this[Oo].type,this,e)}}pA=Oo;const Xu=Symbol("@immersive-web-emulation-runtime/xr-render-state");class Tv{constructor(e={},t){this[Xu]={depthNear:e.depthNear||(t==null?void 0:t.depthNear)||.1,depthFar:e.depthFar||(t==null?void 0:t.depthFar)||1e3,inlineVerticalFieldOfView:e.inlineVerticalFieldOfView||(t==null?void 0:t.inlineVerticalFieldOfView)||null,baseLayer:e.baseLayer||(t==null?void 0:t.baseLayer)||null}}get depthNear(){return this[Xu].depthNear}get depthFar(){return this[Xu].depthFar}get inlineVerticalFieldOfView(){return this[Xu].inlineVerticalFieldOfView}get baseLayer(){return this[Xu].baseLayer}}class sm extends Event{constructor(e,t){if(super(e,t),!t.session)throw new Error("XRSessionEventInit.session is required");this.session=t.session}}class mA extends EventTarget{}const Io=Symbol("@immersive-web-emulation-runtime/XRWebGLLayer"),iN={antialias:!0,depth:!0,stencil:!1,alpha:!0,ignoreDepthValues:!1,framebufferScaleFactor:1};let rN=class extends mA{constructor(e,t,i={}){if(super(),e[_e].ended)throw new DOMException("Session has ended","InvalidStateError");const r={...iN,...i};this[Io]={session:e,context:t,antialias:r.antialias}}get context(){return this[Io].context}get antialias(){return this[Io].antialias}get ignoreDepthValues(){return!0}get framebuffer(){return null}get framebufferWidth(){return this[Io].context.drawingBufferWidth}get framebufferHeight(){return this[Io].context.drawingBufferHeight}getViewport(e){if(e[Va].session!==this[Io].session)throw new DOMException("View's session differs from Layer's session","InvalidStateError");return this[Io].session[_e].device[Fe].getViewport(this,e)}static getNativeFramebufferScaleFactor(e){if(!(e instanceof ny))throw new TypeError("getNativeFramebufferScaleFactor must be passed a session.");return e[_e].ended?0:1}};var mc;(function(n){n.Visible="visible",n.VisibleBlurred="visible-blurred",n.Hidden="hidden"})(mc||(mc={}));var Ot;(function(n){n.Inline="inline",n.ImmersiveVR="immersive-vr",n.ImmersiveAR="immersive-ar"})(Ot||(Ot={}));var $r;(function(n){n.Opaque="opaque",n.AlphaBlend="alpha-blend",n.Additive="additive"})($r||($r={}));var su;(function(n){n.ScreenSpace="screen-space",n.WorldSpace="world-space"})(su||(su={}));const _e=Symbol("@immersive-web-emulation-runtime/xr-session");class ny extends EventTarget{constructor(e,t,i){super(),this[_e]={device:e,mode:t,renderState:new Tv,pendingRenderState:null,enabledFeatures:i,isSystemKeyboardSupported:!1,ended:!1,projectionMatrices:{[Xt.Left]:Ci(),[Xt.Right]:Ci(),[Xt.None]:Ci()},getProjectionMatrix:r=>this[_e].projectionMatrices[r],referenceSpaceIsSupported:r=>{if(!this[_e].enabledFeatures.includes(r))return!1;switch(r){case In.Viewer:return!0;case In.Local:case In.LocalFloor:case In.BoundedFloor:case In.Unbounded:return this[_e].mode!=Ot.Inline}},frameHandle:0,frameCallbacks:[],currentFrameCallbacks:null,onDeviceFrame:()=>{if(this[_e].ended)return;this[_e].deviceFrameHandle=globalThis.requestAnimationFrame(this[_e].onDeviceFrame),this[_e].pendingRenderState!=null&&(this[_e].renderState=this[_e].pendingRenderState,this[_e].pendingRenderState=null,this[_e].device[Fe].onBaseLayerSet(this[_e].renderState.baseLayer));const r=this[_e].renderState.baseLayer;if(r===null)return;const s=r.context,o=s.canvas;if(this[_e].mode!=Ot.Inline){const g=s.getParameter(s.COLOR_CLEAR_VALUE),_=s.getParameter(s.DEPTH_CLEAR_VALUE),m=s.getParameter(s.STENCIL_CLEAR_VALUE);s.clearColor(0,0,0,0),s.clearDepth(1),s.clearStencil(0),s.clear(s.DEPTH_BUFFER_BIT|s.COLOR_BUFFER_BIT|s.STENCIL_BUFFER_BIT),s.clearColor(g[0],g[1],g[2],g[3]),s.clearDepth(_),s.clearStencil(m)}const{depthNear:a,depthFar:l}=this[_e].renderState,{width:c,height:u}=o;if(this[_e].mode!==Ot.Inline){const g=c*(this[_e].device.stereoEnabled?.5:1)/u;s2(this[_e].projectionMatrices[Xt.Left],this[_e].device.fovy,g,a,l),eA(this[_e].projectionMatrices[Xt.Right],this[_e].projectionMatrices[Xt.Left])}else{const g=c/u;s2(this[_e].projectionMatrices[Xt.None],this[_e].renderState.inlineVerticalFieldOfView,g,a,l)}const f=new dA(this,this[_e].frameHandle,!0,!0,performance.now());this[_e].device[Fe].onFrameStart(f),this[_e].updateActiveInputSources();const h=this[_e].currentFrameCallbacks=this[_e].frameCallbacks;this[_e].frameCallbacks=[];const p=performance.now();for(let g=0;g{const r=this[_e].enabledFeatures.includes(ct.HandTracking),s=this[_e].activeInputSources,o=this[_e].device.inputSources.filter(c=>!c.hand||r),a=o.filter(c=>!s.includes(c)),l=s.filter(c=>!o.includes(c));this[_e].activeInputSources=o,(a.length>0||l.length>0)&&this.dispatchEvent(new hA("inputsourceschange",{session:this,added:a,removed:l}))},onend:null,oninputsourceschange:null,onselect:null,onselectstart:null,onselectend:null,onsqueeze:null,onsqueezestart:null,onsqueezeend:null,onvisibilitychange:null,onframeratechange:null},this[_e].onDeviceFrame()}get visibilityState(){return this[_e].device.visibilityState}get frameRate(){return this[_e].nominalFrameRate}get supportedFrameRates(){return new Float32Array(this[_e].device.supportedFrameRates)}get renderState(){return this[_e].renderState}get inputSources(){return this[_e].inputSourceArray.length=0,!this[_e].ended&&this[_e].mode!==Ot.Inline&&this[_e].inputSourceArray.push(...this[_e].activeInputSources),this[_e].inputSourceArray}get enabledFeatures(){return this[_e].enabledFeatures}get isSystemKeyboardSupported(){return this[_e].isSystemKeyboardSupported}get environmentBlendMode(){var e;return(e=this[_e].device[Fe].environmentBlendModes[this[_e].mode])!==null&&e!==void 0?e:$r.Opaque}get interactionMode(){return this[_e].device[Fe].interactionMode}updateRenderState(e={}){var t,i,r,s;if(this[_e].ended)throw new DOMException("XRSession has already ended.","InvalidStateError");if(e.baseLayer&&e.baseLayer[Io].session!==this)throw new DOMException("Base layer was created by a different XRSession","InvalidStateError");if(e.inlineVerticalFieldOfView!=null&&this[_e].mode!==Ot.Inline)throw new DOMException("InlineVerticalFieldOfView must not be set for an immersive session","InvalidStateError");const o={baseLayer:e.baseLayer||((t=this[_e].pendingRenderState)===null||t===void 0?void 0:t.baseLayer)||void 0,depthFar:e.depthFar||((i=this[_e].pendingRenderState)===null||i===void 0?void 0:i.depthFar)||void 0,depthNear:e.depthNear||((r=this[_e].pendingRenderState)===null||r===void 0?void 0:r.depthNear)||void 0,inlineVerticalFieldOfView:e.inlineVerticalFieldOfView||((s=this[_e].pendingRenderState)===null||s===void 0?void 0:s.inlineVerticalFieldOfView)||void 0};this[_e].pendingRenderState=new Tv(o,this[_e].renderState)}async updateTargetFrameRate(e){return new Promise((t,i)=>{this[_e].ended?i(new DOMException("XRSession has already ended.","InvalidStateError")):this[_e].device.supportedFrameRates.includes(e)?(this[_e].nominalFrameRate===e?console.log("Requested frame rate is the same as the current nominal frame rate, no update made"):(this[_e].nominalFrameRate=e,this.dispatchEvent(new sm("frameratechange",{session:this})),console.log(`Nominal frame rate updated to ${e}`)),t()):i(new DOMException("Requested frame rate not supported.","InvalidStateError"))})}async requestReferenceSpace(e){return new Promise((t,i)=>{if(this[_e].ended||!this[_e].referenceSpaceIsSupported(e)){i(new DOMException("The requested reference space type is not supported.","NotSupportedError"));return}let r;switch(e){case In.Viewer:r=this[_e].device.viewerSpace;break;case In.Local:r=new ml(e,this[_e].device[Fe].globalSpace,this[_e].device.viewerSpace[wn].offsetMatrix);break;case In.LocalFloor:case In.BoundedFloor:case In.Unbounded:r=new ml(e,this[_e].device[Fe].globalSpace);break}this[_e].referenceSpaces.push(r),t(r)})}requestAnimationFrame(e){if(this[_e].ended)return 0;const t=++this[_e].frameHandle;return this[_e].frameCallbacks.push({handle:t,callback:e,cancelled:!1}),t}cancelAnimationFrame(e){let t=this[_e].frameCallbacks,i=t.findIndex(r=>r&&r.handle===e);i>-1&&(t[i].cancelled=!0,t.splice(i,1)),t=this[_e].currentFrameCallbacks,t&&(i=t.findIndex(r=>r&&r.handle===e),i>-1&&(t[i].cancelled=!0))}async end(){return new Promise((e,t)=>{this[_e].ended||this[_e].deviceFrameHandle===null?t(new DOMException("XRSession has already ended.","InvalidStateError")):(globalThis.cancelAnimationFrame(this[_e].deviceFrameHandle),this[_e].device[Fe].onSessionEnd(),this.dispatchEvent(new sm("end",{session:this})),e())})}get onend(){var e;return(e=this[_e].onend)!==null&&e!==void 0?e:()=>{}}set onend(e){this[_e].onend&&this.removeEventListener("end",this[_e].onend),this[_e].onend=e,e&&this.addEventListener("end",e)}get oninputsourceschange(){var e;return(e=this[_e].oninputsourceschange)!==null&&e!==void 0?e:()=>{}}set oninputsourceschange(e){this[_e].oninputsourceschange&&this.removeEventListener("inputsourceschange",this[_e].oninputsourceschange),this[_e].oninputsourceschange=e,e&&this.addEventListener("inputsourceschange",e)}get onselect(){var e;return(e=this[_e].onselect)!==null&&e!==void 0?e:()=>{}}set onselect(e){this[_e].onselect&&this.removeEventListener("select",this[_e].onselect),this[_e].onselect=e,e&&this.addEventListener("select",e)}get onselectstart(){var e;return(e=this[_e].onselectstart)!==null&&e!==void 0?e:()=>{}}set onselectstart(e){this[_e].onselectstart&&this.removeEventListener("selectstart",this[_e].onselectstart),this[_e].onselectstart=e,e&&this.addEventListener("selectstart",e)}get onselectend(){var e;return(e=this[_e].onselectend)!==null&&e!==void 0?e:()=>{}}set onselectend(e){this[_e].onselectend&&this.removeEventListener("selectend",this[_e].onselectend),this[_e].onselectend=e,e&&this.addEventListener("selectend",e)}get onsqueeze(){var e;return(e=this[_e].onsqueeze)!==null&&e!==void 0?e:()=>{}}set onsqueeze(e){this[_e].onsqueeze&&this.removeEventListener("squeeze",this[_e].onsqueeze),this[_e].onsqueeze=e,e&&this.addEventListener("squeeze",e)}get onsqueezestart(){var e;return(e=this[_e].onsqueezestart)!==null&&e!==void 0?e:()=>{}}set onsqueezestart(e){this[_e].onsqueezestart&&this.removeEventListener("squeezestart",this[_e].onsqueezestart),this[_e].onsqueezestart=e,e&&this.addEventListener("squeezestart",e)}get onsqueezeend(){var e;return(e=this[_e].onsqueezeend)!==null&&e!==void 0?e:()=>{}}set onsqueezeend(e){this[_e].onsqueezeend&&this.removeEventListener("squeezeend",this[_e].onsqueezeend),this[_e].onsqueezeend=e,e&&this.addEventListener("squeezeend",e)}get onvisibilitychange(){var e;return(e=this[_e].onvisibilitychange)!==null&&e!==void 0?e:()=>{}}set onvisibilitychange(e){this[_e].onvisibilitychange&&this.removeEventListener("visibilitychange",this[_e].onvisibilitychange),this[_e].onvisibilitychange=e,e&&this.addEventListener("visibilitychange",e)}get onframeratechange(){var e;return(e=this[_e].onframeratechange)!==null&&e!==void 0?e:()=>{}}set onframeratechange(e){this[_e].onframeratechange&&this.removeEventListener("frameratechange",this[_e].onframeratechange),this[_e].onframeratechange=e,e&&this.addEventListener("frameratechange",e)}}var ed;(function(n){n.Wrist="wrist",n.ThumbMetacarpal="thumb-metacarpal",n.ThumbPhalanxProximal="thumb-phalanx-proximal",n.ThumbPhalanxDistal="thumb-phalanx-distal",n.ThumbTip="thumb-tip",n.IndexFingerMetacarpal="index-finger-metacarpal",n.IndexFingerPhalanxProximal="index-finger-phalanx-proximal",n.IndexFingerPhalanxIntermediate="index-finger-phalanx-intermediate",n.IndexFingerPhalanxDistal="index-finger-phalanx-distal",n.IndexFingerTip="index-finger-tip",n.MiddleFingerMetacarpal="middle-finger-metacarpal",n.MiddleFingerPhalanxProximal="middle-finger-phalanx-proximal",n.MiddleFingerPhalanxIntermediate="middle-finger-phalanx-intermediate",n.MiddleFingerPhalanxDistal="middle-finger-phalanx-distal",n.MiddleFingerTip="middle-finger-tip",n.RingFingerMetacarpal="ring-finger-metacarpal",n.RingFingerPhalanxProximal="ring-finger-phalanx-proximal",n.RingFingerPhalanxIntermediate="ring-finger-phalanx-intermediate",n.RingFingerPhalanxDistal="ring-finger-phalanx-distal",n.RingFingerTip="ring-finger-tip",n.PinkyFingerMetacarpal="pinky-finger-metacarpal",n.PinkyFingerPhalanxProximal="pinky-finger-phalanx-proximal",n.PinkyFingerPhalanxIntermediate="pinky-finger-phalanx-intermediate",n.PinkyFingerPhalanxDistal="pinky-finger-phalanx-distal",n.PinkyFingerTip="pinky-finger-tip"})(ed||(ed={}));class iy extends Map{}const sN={jointTransforms:{wrist:{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06867414712905884,-.009423808194696903,.10627774149179459,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.5012241005897522,-.8650535345077515,-.0213695727288723,0,.7415963411331177,-.4421543478965759,.5045139193534851,0,-.44587990641593933,.23702676594257355,.8631392121315002,0,-.032122574746608734,-.01196830440312624,.07194234430789948,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[-.3175753057003021,-.9460570216178894,-.06419729441404343,0,.8958902955055237,-.32153913378715515,.30658137798309326,0,-.3106854259967804,.03984907269477844,.9496771097183228,0,-.017625702545046806,-.01967475935816765,.04387917369604111,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,-.007126678712666035,-.021021386608481407,.011786630377173424,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,.0003423091256991029,-.024528030306100845,-.011410919018089771,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.038037415593862534,-.0020236473064869642,.07626739144325256,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.7986818552017212,-.35985732078552246,.48229536414146423,0,.538311243057251,.7854709625244141,-.30537736415863037,0,-.2689369022846222,.5035246014595032,.8210577368736267,0,-.006869405973702669,.033938243985176086,.04206443578004837,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.8285930156707764,-.32672837376594543,.4546217918395996,0,.5577570199966431,.4116027057170868,-.7207564115524292,0,.04836784675717354,.8507823944091797,.5232869386672974,0,.0033306588884443045,.014840902760624886,.010923954658210278,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,.0021551470272243023,-.0058362227864563465,-.0017938464879989624,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,-.00131594471167773,-.025222131982445717,-.012442642822861671,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.05395089089870453,.003063359996303916,.07402937114238739,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9187911748886108,-.1530158370733261,.36387869715690613,0,.038666240870952606,.9522662162780762,.302808940410614,0,-.3928440511226654,-.26414817571640015,.8808513283729553,0,-.02717282809317112,.04162866622209549,.03678669035434723,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9228746294975281,-.12856416404247284,.36300456523895264,0,.14524033665657043,.9892153143882751,-.01890045404434204,0,-.3566599190235138,.07016586512327194,.9315956234931946,0,-.01030921470373869,.05296773463487625,-.0010256498353555799,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,-.0004833847051486373,.05103470757603645,-.026690717786550522,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,.008158999495208263,.05004044249653816,-.050120558589696884,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06732909381389618,.007902119308710098,.07209732383489609,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9391821026802063,-.027994679287075996,.34227466583251953,0,-.18282271921634674,.8029410243034363,.5673282742500305,0,-.2907087206840515,-.5954000353813171,.7489906549453735,0,-.047129884362220764,.03806127607822418,.032147664576768875,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9249380826950073,.03699534013867378,.3783116042613983,0,-.12898847460746765,.9667453765869141,.2208271026611328,0,-.3575615882873535,-.25304901599884033,.8989526629447937,0,-.03579339757561684,.06127955764532089,.002939916681498289,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.026291755959391594,.06800390034914017,-.02094830758869648,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.016345610842108727,.07300511747598648,-.04263874143362045,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.8769711852073669,.31462907791137695,.36322021484375,0,-.4506046175956726,.801031768321991,.39408499002456665,0,-.16696058213710785,-.5092697143554688,.8442559838294983,0,-.07460174709558487,.0062340241856873035,.06756893545389175,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9498357176780701,.1553308218717575,.2714462876319885,0,-.3019258379936218,.6817675232887268,.6663586497306824,0,-.08155745267868042,-.7148879170417786,.694466233253479,0,-.06697750836610794,.029482364654541016,.02902858518064022,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9214097261428833,.27928245067596436,.2701927423477173,0,-.3670244514942169,.8538867831230164,.36901235580444336,0,-.12765564024448395,-.43917882442474365,.8892839550971985,0,-.06447203457355499,.05144399777054787,.0076942890882492065,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.06187915802001953,.060364335775375366,-.010368337854743004,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.056796226650476456,.07042007893323898,-.02921444922685623,1],radius:.005425984505563974}},gripOffsetMatrix:[.08027800917625427,-.8086723685264587,-.5827556252479553,0,-.4154181480407715,-.5585916638374329,.7179154753684998,0,-.9060805439949036,.1844543218612671,-.3807799518108368,0,-.038054611533880234,-.002910431008785963,.03720742464065552,1]},oN={jointTransforms:{wrist:{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05789132043719292,.01670890860259533,.11183350533246994,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[.02145560085773468,-.9978390336036682,.0621047280728817,0,.41311800479888916,.06541631370782852,.9083252549171448,0,-.9104245901107788,.006167683284729719,.4136286973953247,0,-.016488194465637207,.012708572670817375,.08862338215112686,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.21270370483398438,-.966137707233429,.14606566727161407,0,.49890995025634766,.2359165996313095,.8339261412620544,0,-.8401462435722351,-.10450579971075058,.5321959853172302,0,.013112368993461132,.012508046813309193,.07517509907484055,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.04150351136922836,.016039609909057617,.05719054117798805,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.06548332422971725,.01683700829744339,.0516640841960907,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.02592567168176174,.019982583820819855,.08479326963424683,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9063700437545776,-.21756279468536377,.3621589243412018,0,.0970839336514473,.9415287375450134,.3226419687271118,0,-.41117796301841736,-.2572731077671051,.8744958639144897,0,-.0015709538711234927,.043078210204839706,.034657616168260574,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9159826040267944,-.1651475727558136,.36565208435058594,0,.09755707532167435,.9756820797920227,.1962820291519165,0,-.3891757130622864,-.14411886036396027,.9098196625709534,0,.014023927971720695,.052835866808891296,.0014903299743309617,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.023482320830225945,.05633850023150444,-.020621655508875847,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.03096788562834263,.06281610578298569,-.040703095495700836,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.04184452444314957,.022474845871329308,.08177298307418823,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9720265865325928,-.08313076198101044,.21966552734375,0,.20477405190467834,.7580050826072693,-.6192700862884521,0,-.11502730846405029,.6469289064407349,.7538246512413025,0,-.022107340395450592,.05035499855875969,.02970452979207039,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9779140949249268,-.07129573822021484,.19646917283535004,0,.1287083923816681,-.5352076292037964,-.8348574042320251,0,.1646735966205597,.8417060971260071,-.5142109394073486,0,-.017169542610645294,.022584279999136925,-.00265491777099669,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02170622907578945,-.0006043742760084569,.011511396616697311,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02438267692923546,-.0026927536819130182,.03627248480916023,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05944233387708664,.0264605600386858,.07478221505880356,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9842101335525513,.024470895528793335,.1753024309873581,0,.12200043350458145,.6237703561782837,-.7720272541046143,0,-.12824076414108276,.7812241315841675,.610936164855957,0,-.04249368980526924,.0467497780919075,.027722163125872612,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9941774606704712,.05949164181947708,.08983955532312393,0,.10504482686519623,-.7208291888237,-.6851072907447815,0,.024001073092222214,.6905553936958313,-.7228817939758301,0,-.0374927744269371,.016285063698887825,.0038980208337306976,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.038130562752485275,-.0020653479732573032,.02310742810368538,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.0390593595802784,.004176302347332239,.0466572530567646,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9147363901138306,.3458845317363739,.20885537564754486,0,-.3923271894454956,.8839452862739563,.2544005811214447,0,-.09662359952926636,-.3146490156650543,.9442773461341858,0,-.06715242564678192,.024195827543735504,.07137546688318253,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9613109827041626,.22439135611057281,.15977802872657776,0,.01002211682498455,.5511574745178223,-.8343409299850464,0,-.27528178691864014,.8036624789237976,.5275853276252747,0,-.06273911893367767,.038559623062610626,.028268879279494286,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9820972084999084,.18811029195785522,-.00995189044624567,0,.14063723385334015,-.7673450708389282,-.6256227493286133,0,-.12532226741313934,.6130226850509644,-.7800630927085876,0,-.05428232625126839,.013870777562260628,.012061242014169693,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9744614362716675,.20454788208007812,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05173685774207115,.0014194445684552193,.02790539152920246,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9744614362716675,.20454788208007812,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05098633095622063,.008463085629045963,.048688892275094986,1],radius:.005425984505563974}},gripOffsetMatrix:[.005510995630174875,-.9149997234344482,-.40341615676879883,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.9340395331382751,.13936474919319153,-.32885703444480896,0,-.031803809106349945,.007837686687707901,.04313928261399269,1]},aN={jointTransforms:{wrist:{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.04913589730858803,.0021463718730956316,.11701996624469757,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.07536252588033676,-.9959676265716553,-.04867160692811012,0,.5877083539962769,-.08379616588354111,.8047218918800354,0,-.8055551648139954,.032041035592556,.5916536450386047,0,-.010643752291798592,.0006936835707165301,.08736639469861984,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.1374533325433731,-.9904957413673401,.004982374142855406,0,.5534393787384033,.08097179979085922,.8289443850517273,0,-.8214688897132874,-.11118389666080475,.559309184551239,0,.015547193586826324,-.0003480653394944966,.0681300163269043,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.04330715537071228,.003409178927540779,.0492292083799839,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.062003348022699356,.004069602582603693,.03322213143110275,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.02009812369942665,.008770795539021492,.08660387247800827,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9001791477203369,-.2598813474178314,.3494834005832672,0,.06073702871799469,.8695210218429565,.490146666765213,0,-.4312632381916046,-.41999316215515137,.7985095381736755,0,-.00017739279428496957,.03890012577176094,.039073407649993896,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9082008600234985,-.20898112654685974,.36262574791908264,0,.11045389622449875,.9553793668746948,.27395179867744446,0,-.40369608998298645,-.20874978601932526,.8907597661018372,0,.01617925800383091,.05482936650514603,.008788082748651505,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.02599053829908371,.059902746230363846,-.012860597111284733,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.03362493962049484,.06421422213315964,-.033461250364780426,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.03627845644950867,.011579737067222595,.08550142496824265,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9876697659492493,-.06786545366048813,.1410750150680542,0,-.015095947310328484,.855663537979126,.5173118710517883,0,-.15582047402858734,-.5130629539489746,.8440889716148376,0,-.021259509027004242,.04587256908416748,.03659208118915558,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.988391637802124,-.04354291781783104,.14555205404758453,0,.008894841186702251,.9729899168014526,.23067504167556763,0,-.15166506171226501,-.22670257091522217,.9620829224586487,0,-.014570588245987892,.06789684295654297,.0003578895702958107,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.010392282158136368,.07414241135120392,-.026147106662392616,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.0069718430750072,.08024183660745621,-.05014154314994812,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.05402477830648422,.015797706320881844,.08152295649051666,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9940828680992126,.05735103040933609,.09224652498960495,0,-.10022822767496109,.8116500377655029,.5754809379577637,0,-.041867565363645554,-.5813214182853699,.8125960826873779,0,-.041623555123806,.04171867296099663,.03582974523305893,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9843675494194031,.12044742703437805,.12850022315979004,0,-.15629759430885315,.9337108135223389,.3221098482608795,0,-.08118485659360886,-.3371586799621582,.937940776348114,0,-.039990875869989395,.06438793987035751,.004141641780734062,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03783353418111801,.07334739714860916,-.020782606676220894,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03445569798350334,.0802423357963562,-.04392268508672714,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9181402921676636,.35625091195106506,.17350243031978607,0,-.39615097641944885,.8352503180503845,.38134080171585083,0,-.009065053425729275,-.41885748505592346,.9080066680908203,0,-.06191859766840935,.013620133511722088,.07850203663110733,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9714386463165283,.236698180437088,-.016745081171393394,0,-.18462024629116058,.7982627749443054,.5733163952827454,0,.14906984567642212,-.5538501739501953,.8191629648208618,0,-.061502378433942795,.032741155475378036,.03705105185508728,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9337416291236877,.35620439052581787,-.03527557849884033,0,-.33203884959220886,.8987522721290588,.28634607791900635,0,.13370157778263092,-.2556603252887726,.9574766755104065,0,-.06608185172080994,.049755651503801346,.011886020191013813,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.0687975287437439,.054948460310697556,-.007561664097011089,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.06947512179613113,.0613851435482502,-.028543535619974136,1],radius:.005425984505563974}},gripOffsetMatrix:[-.0005348679260350764,-.8648636937141418,-.5020061135292053,0,-.2741127908229828,-.48265108466148376,.8318111896514893,0,-.9616971015930176,.13805119693279266,-.2368120402097702,0,-.02878567762672901,.0017147823236882687,.04536811262369156,1]},m2={profileId:"oculus-hand",fallbackProfileIds:["generic-hand","generic-hand-select","generic-trigger"],poses:{default:aN,pinch:sN,point:oN}},lN={mapping:Jf.None,buttons:[{id:"pinch",type:"analog",eventTrigger:"select"}],axes:[]},g2=Ji(),_2=zr(),v2=Ji(),x2=Ji(),y2=zr(),S2=Ji(),M2=Ji(),E2=zr(),w2=Ji(),T2=(n,e,t,i)=>(Qf(g2,e),em(_2,e),Ev(v2,e),Qf(x2,t),em(y2,t),Ev(S2,t),wv(M2,g2,x2,i),If(E2,_2,y2,i),wv(w2,v2,S2,i),F8(n,E2,M2,w2),n),cN=[1,-1,-1,0,-1,1,1,0,-1,1,1,0,-1,1,1,1],uN=n=>{for(let e=0;e<16;e++)n[e]*=cN[e]},La=Symbol("@immersive-web-emulation-runtime/xr-hand-input");class A2 extends lA{constructor(e,t,i){if(t!==Wi.Left&&t!==Wi.Right)throw new DOMException('handedness for XRHandInput must be either "left" or "right"',"InvalidStateError");if(!e.poses.default||!e.poses.pinch)throw new DOMException('"default" and "pinch" hand pose configs are required',"InvalidStateError");const r=new ti(i),s=new ti(r),o=[e.profileId,...e.fallbackProfileIds],a=new iy;Object.values(ed).forEach(c=>{a.set(c,new ty(c,r))});const l=new Zm(t,im.TrackedPointer,o,r,new ey(lN),s,a);super(l),this[La]={poseId:"default",poses:e.poses},this.updateHandPose()}get poseId(){return this[La].poseId}set poseId(e){if(!this[La].poses[e]){console.warn(`Pose config ${e} not found`);return}this[La].poseId=e}updateHandPose(){const e=this[La].poses[this[La].poseId],t=this[La].poses.pinch;Object.values(ed).forEach(i=>{const r=e.jointTransforms[i].offsetMatrix,s=t.jointTransforms[i].offsetMatrix,o=this.inputSource.hand.get(i);T2(o[wn].offsetMatrix,r,s,this.pinchValue),this.inputSource.handedness===Wi.Right&&uN(o[wn].offsetMatrix),o[al].radius=(1-this.pinchValue)*e.jointTransforms[i].radius+this.pinchValue*t.jointTransforms[i].radius}),e.gripOffsetMatrix&&t.gripOffsetMatrix&&T2(this.inputSource.gripSpace[wn].offsetMatrix,e.gripOffsetMatrix,t.gripOffsetMatrix,this.pinchValue)}get pinchValue(){return this[nn].inputSource.gamepad[et].buttonsMap.pinch.value}updatePinchValue(e){if(e>1||e<0){console.warn(`Out-of-range value ${e} provided for pinch`);return}const t=this[nn].inputSource.gamepad[et].buttonsMap.pinch;t[et].pendingValue=e}onFrameStart(e){super.onFrameStart(e),this.updateHandPose()}}const Do=Symbol("@immersive-web-emulation-runtime/xr-system");class b2 extends EventTarget{constructor(e){super(),this[Do]={device:e}}isSessionSupported(e){return new Promise((t,i)=>{e===Ot.Inline?t(!0):t(this[Do].device.supportedSessionModes.includes(e))})}requestSession(e,t={}){return new Promise((i,r)=>{this.isSessionSupported(e).then(s=>{if(!s){r(new DOMException("The requested XRSession mode is not supported.","NotSupportedError"));return}if(this[Do].activeSession){r(new DOMException("An active XRSession already exists.","InvalidStateError"));return}const{requiredFeatures:o=[],optionalFeatures:a=[]}=t,{supportedFeatures:l}=this[Do].device;if(!o.every(p=>l.includes(p))){r(new Error("One or more required features are not supported by the device."));return}const u=a.filter(p=>l.includes(p)),f=Array.from(new Set([...o,...u,ct.Viewer,ct.Local])),h=new ny(this[Do].device,e,f);this[Do].activeSession=h,h.addEventListener("end",()=>{this[Do].activeSession=void 0}),i(h)}).catch(r)})}}const vt=Symbol("@immersive-web-emulation-runtime/action-player");class fN{constructor(e,t,i){const{schema:r,frames:s}=t;if(!s||!r||s.length===0)throw new DOMException("wrong recording format","NotSupportedError");const o=new ml(In.Viewer,e),a={[Xt.Left]:new ti(o),[Xt.Right]:new ti(o),[Xt.None]:new ti(o)};this[vt]={refSpace:e,inputSources:new Map,inputSchemas:new Map,frames:s,recordedFramePointer:0,startingTimeStamp:s[0][0],endingTimeStamp:s[s.length-1][0],playbackTime:s[0][0],playing:!1,viewerSpace:o,viewSpaces:a,vec3:Ji(),quat:zr()},Zf(this[vt].viewSpaces[Xt.Left][wn].offsetMatrix,Fr(-i/2,0,0)),Zf(this[vt].viewSpaces[Xt.Right][wn].offsetMatrix,Fr(i/2,0,0)),r.forEach(l=>{const c=l[0],u=l[1];let f;if(u.hasGamepad){const _=[];for(let d=0;d{p.set(_,new ty(_,h))}));const g=new Zm(u.handedness,u.targetRayMode,u.profiles,h,f,u.hasGrip?new ti(e):void 0,u.hasHand?p:void 0);this[vt].inputSources.set(c,{active:!1,source:g}),this[vt].inputSchemas.set(c,u)})}play(){this[vt].recordedFramePointer=0,this[vt].playbackTime=this[vt].startingTimeStamp,this[vt].playing=!0,this[vt].actualTimeStamp=performance.now()}stop(){this[vt].playing=!1}get playing(){return this[vt].playing}get viewerSpace(){return this[vt].viewerSpace}get viewSpaces(){return this[vt].viewSpaces}get inputSources(){return Array.from(this[vt].inputSources.values()).filter(e=>e.active).map(e=>e.source)}playFrame(){const e=performance.now(),t=e-this[vt].actualTimeStamp;if(this[vt].actualTimeStamp=e,this[vt].playbackTime+=t,this[vt].playbackTime>this[vt].endingTimeStamp){this.stop();return}for(;this[vt].frames[this[vt].recordedFramePointer+1][0]{l.active=!1}),a.forEach((l,c)=>{this[vt].inputSources.get(c).active=!0;const u=this[vt].inputSources.get(c).source,f=this[vt].inputSchemas.get(c);this.updateInputSource(u,f,o.has(c)?o.get(c):l,l,s)})}updateInputSource(e,t,i,r,s){if(this.updateXRSpaceFromMergedFrames(e.targetRaySpace,i.targetRayTransform,r.targetRayTransform,s),t.hasGrip&&this.updateXRSpaceFromMergedFrames(e.gripSpace,i.gripTransform,r.gripTransform,s),t.hasHand)for(let o=0;o<25;o++){const a=i.handTransforms.slice(o*8,o*8+7),l=r.handTransforms.slice(o*8,o*8+7),c=i.handTransforms[o*8+7],u=r.handTransforms[o*8+7],f=e.hand.get(t.jointSequence[o]);this.updateXRSpaceFromMergedFrames(f,a,l,s),f[al].radius=(u-c)*s+c}if(t.hasGamepad){const o=e.gamepad;r.buttons.forEach((a,l)=>{const c=o.buttons[l];c[et].pressed=a[0]===1,c[et].touched=a[1]===1;const u=i.buttons[l][2],f=a[2];c[et].value=(f-u)*s+u}),r.axes.forEach((a,l)=>{const c=i.axes[l];o[et].axesMap[l.toString()].x=(a-c)*s+c})}}updateXRSpaceFromMergedFrames(e,t,i,r){const s=Fr(t[0],t[1],t[2]),o=tm(t[3],t[4],t[5],t[6]),a=Fr(i[0],i[1],i[2]),l=tm(i[3],i[4],i[5],i[6]);wv(this[vt].vec3,s,a,r),If(this[vt].quat,o,l,r),Rd(e[wn].offsetMatrix,this[vt].quat,this[vt].vec3)}processRawInputData(e){const t=e[0],i=this[vt].inputSchemas.get(t),s={targetRayTransform:e.slice(1,8)};let o=8;if(i.hasGrip&&(s.gripTransform=e[o++]),i.hasHand&&(s.handTransforms=e[o++]),i.hasGamepad){const a=e[o];s.buttons=a.slice(0,i.numButtons),s.axes=a.slice(i.numButtons)}return{index:t,inputData:s}}}const dN="1.0.4";class R2 extends Event{constructor(e,t){if(super(e,t),!t.referenceSpace)throw new Error("XRReferenceSpaceEventInit.referenceSpace is required");this.referenceSpace=t.referenceSpace,this.transform=t.transform}}const ju=Symbol("@immersive-web-emulation-runtime/xr-viewport");class vh{constructor(e,t,i,r){this[ju]={x:e,y:t,width:i,height:r}}get x(){return this[ju].x}get y(){return this[ju].y}get width(){return this[ju].width}get height(){return this[ju].height}}var ct;(function(n){n.Viewer="viewer",n.Local="local",n.LocalFloor="local-floor",n.BoundedFloor="bounded-floor",n.Unbounded="unbounded",n.DomOverlay="dom-overlay",n.Anchors="anchors",n.PlaneDetection="plane-detection",n.MeshDetection="mesh-detection",n.HitTest="hit-test",n.HandTracking="hand-tracking",n.DepthSensing="depth-sensing"})(ct||(ct={}));const Fe=Symbol("@immersive-web-emulation-runtime/xr-device"),qu={ipd:.063,fovy:Math.PI/2,headsetPosition:new ol(0,1.6,0),headsetQuaternion:new Df,stereoEnabled:!1};class hN{constructor(e,t={}){var i,r,s,o,a,l;const c=new J8,u=new ml(In.Viewer,c),f={[Xt.Left]:new ti(u),[Xt.Right]:new ti(u),[Xt.None]:new ti(u)},h=e.controllerConfig,p={};h&&Object.values(Wi).forEach(m=>{h.layout[m]&&(p[m]=new nN(h,m,c))});const g={[Wi.Left]:new A2(m2,Wi.Left,c),[Wi.Right]:new A2(m2,Wi.Right,c)},_=(i=t.canvasContainer)!==null&&i!==void 0?i:document.createElement("div");_.dataset.webxr_runtime=`Immersive Web Emulation Runtime v${dN}`,_.style.position="fixed",_.style.width="100%",_.style.height="100%",_.style.top="0",_.style.left="0",_.style.display="flex",_.style.justifyContent="center",_.style.alignItems="center",_.style.overflow="hidden",_.style.zIndex="999",this[Fe]={name:e.name,supportedSessionModes:e.supportedSessionModes,supportedFeatures:e.supportedFeatures,supportedFrameRates:e.supportedFrameRates,isSystemKeyboardSupported:e.isSystemKeyboardSupported,internalNominalFrameRate:e.internalNominalFrameRate,environmentBlendModes:e.environmentBlendModes,interactionMode:e.interactionMode,userAgent:e.userAgent,position:(r=t.headsetPosition)!==null&&r!==void 0?r:qu.headsetPosition.clone(),quaternion:(s=t.headsetQuaternion)!==null&&s!==void 0?s:qu.headsetQuaternion.clone(),stereoEnabled:(o=t.stereoEnabled)!==null&&o!==void 0?o:qu.stereoEnabled,ipd:(a=t.ipd)!==null&&a!==void 0?a:qu.ipd,fovy:(l=t.fovy)!==null&&l!==void 0?l:qu.fovy,controllers:p,hands:g,primaryInputMode:"controller",pendingReferenceSpaceReset:!1,visibilityState:mc.Visible,pendingVisibilityState:null,xrSystem:null,matrix:Ci(),globalSpace:c,viewerSpace:u,viewSpaces:f,canvasContainer:_,getViewport:(m,d)=>{const x=m.context.canvas,{width:v,height:y}=x;switch(d.eye){case Xt.None:return new vh(0,0,v,y);case Xt.Left:return new vh(0,0,this[Fe].stereoEnabled?v/2:v,y);case Xt.Right:return new vh(v/2,0,this[Fe].stereoEnabled?v/2:0,y)}},updateViews:()=>{const m=this[Fe].viewerSpace;Rd(m[wn].offsetMatrix,this[Fe].quaternion.quat,this[Fe].position.vec3),Zf(this[Fe].viewSpaces[Xt.Left][wn].offsetMatrix,Fr(-this[Fe].ipd/2,0,0)),Zf(this[Fe].viewSpaces[Xt.Right][wn].offsetMatrix,Fr(this[Fe].ipd/2,0,0))},onBaseLayerSet:m=>{if(!m)return;const d=m.context.canvas;d.parentElement!==this[Fe].canvasContainer&&(this[Fe].canvasData={canvas:d,parent:d.parentElement,width:d.width,height:d.height},this[Fe].canvasContainer.appendChild(d),document.body.appendChild(this[Fe].canvasContainer)),d.width=window.innerWidth,d.height=window.innerHeight},onSessionEnd:()=>{if(this[Fe].canvasData){const{canvas:m,parent:d,width:x,height:v}=this[Fe].canvasData;m.width=x,m.height=v,d?d.appendChild(m):this[Fe].canvasContainer.removeChild(m),document.body.removeChild(this[Fe].canvasContainer),window.dispatchEvent(new Event("resize"))}},onFrameStart:m=>{var d;if(!((d=this[Fe].actionPlayer)===null||d===void 0)&&d.playing)this[Fe].actionPlayer.playFrame();else{const x=m.session;this[Fe].updateViews(),this[Fe].pendingVisibilityState&&(this[Fe].visibilityState=this[Fe].pendingVisibilityState,this[Fe].pendingVisibilityState=null,x.dispatchEvent(new sm("visibilitychange",{session:x}))),this[Fe].visibilityState===mc.Visible&&this.activeInputs.forEach(v=>{v.onFrameStart(m)}),this[Fe].pendingReferenceSpaceReset&&(x[_e].referenceSpaces.forEach(v=>{switch(v[Oo].type){case In.Local:case In.LocalFloor:case In.BoundedFloor:case In.Unbounded:v.dispatchEvent(new R2("reset",{referenceSpace:v}));break}}),this[Fe].pendingReferenceSpaceReset=!1)}this[Fe].updateViews()}},this[Fe].updateViews()}installRuntime(e=globalThis){Object.defineProperty(WebGL2RenderingContext.prototype,"makeXRCompatible",{value:function(){return new Promise((t,i)=>{t(!0)})},configurable:!0}),this[Fe].xrSystem=new b2(this),Object.defineProperty(globalThis.navigator,"xr",{value:this[Fe].xrSystem,configurable:!0}),Object.defineProperty(navigator,"userAgent",{value:this[Fe].userAgent,writable:!1,configurable:!1,enumerable:!0}),e.XRSystem=b2,e.XRSession=ny,e.XRRenderState=Tv,e.XRFrame=dA,e.XRSpace=ti,e.XRReferenceSpace=ml,e.XRJointSpace=ty,e.XRView=cA,e.XRViewport=vh,e.XRRigidTransform=Jm,e.XRPose=Qm,e.XRViewerPose=fA,e.XRJointPose=uA,e.XRInputSource=Zm,e.XRInputSourceArray=tN,e.XRHand=iy,e.XRLayer=mA,e.XRWebGLLayer=rN,e.XRSessionEvent=sm,e.XRInputSourceEvent=Ep,e.XRInputSourcesChangeEvent=hA,e.XRReferenceSpaceEvent=R2}get supportedSessionModes(){return this[Fe].supportedSessionModes}get supportedFeatures(){return this[Fe].supportedFeatures}get supportedFrameRates(){return this[Fe].supportedFrameRates}get isSystemKeyboardSupported(){return this[Fe].isSystemKeyboardSupported}get internalNominalFrameRate(){return this[Fe].internalNominalFrameRate}get stereoEnabled(){return this[Fe].stereoEnabled}set stereoEnabled(e){this[Fe].stereoEnabled=e}get ipd(){return this[Fe].ipd}set ipd(e){this[Fe].ipd=e}get fovy(){return this[Fe].fovy}set fovy(e){this[Fe].fovy=e}get position(){return this[Fe].position}get quaternion(){return this[Fe].quaternion}get viewerSpace(){var e;return!((e=this[Fe].actionPlayer)===null||e===void 0)&&e.playing?this[Fe].actionPlayer.viewerSpace:this[Fe].viewerSpace}get viewSpaces(){var e;return!((e=this[Fe].actionPlayer)===null||e===void 0)&&e.playing?this[Fe].actionPlayer.viewSpaces:this[Fe].viewSpaces}get controllers(){return this[Fe].controllers}get hands(){return this[Fe].hands}get primaryInputMode(){return this[Fe].primaryInputMode}set primaryInputMode(e){if(e!=="controller"&&e!=="hand"){console.warn('primary input mode can only be "controller" or "hand"');return}this[Fe].primaryInputMode=e}get activeInputs(){return this[Fe].visibilityState!==mc.Visible?[]:(this[Fe].primaryInputMode==="controller"?Object.values(this[Fe].controllers):Object.values(this[Fe].hands)).filter(t=>t.connected)}get inputSources(){var e;return!((e=this[Fe].actionPlayer)===null||e===void 0)&&e.playing?this[Fe].actionPlayer.inputSources:this.activeInputs.map(t=>t.inputSource)}get canvasContainer(){return this[Fe].canvasContainer}get activeSession(){var e;return(e=this[Fe].xrSystem)===null||e===void 0?void 0:e[Do].activeSession}recenter(){const e=new ol(-this.position.x,0,-this.position.z),t=new ol(0,0,-1).applyQuaternion(this.quaternion);t.y=0,t.normalize();const i=Math.atan2(t.x,-t.z),r=new Df().setFromAxisAngle(new ol(0,1,0),i);this.position.add(e),this.quaternion.multiply(r),[...Object.values(this[Fe].controllers),...Object.values(this[Fe].hands)].forEach(s=>{s.position.add(e),s.quaternion.multiply(r),s.position.applyQuaternion(r)}),this[Fe].pendingReferenceSpaceReset=!0}get visibilityState(){return this[Fe].visibilityState}updateVisibilityState(e){if(!Object.values(mc).includes(e))throw new DOMException("Invalid XRVisibilityState value","NotSupportedError");e!==this[Fe].visibilityState&&(this[Fe].pendingVisibilityState=e)}createActionPlayer(e,t){return this[Fe].actionPlayer=new fN(e,t,this[Fe].ipd),this[Fe].actionPlayer}}const e0={mapping:Jf.XRStandard,buttons:[{id:"trigger",type:"analog",eventTrigger:"select"},{id:"squeeze",type:"analog",eventTrigger:"squeeze"},null,{id:"thumbstick",type:"binary"},{id:"x-button",type:"binary"},{id:"y-button",type:"binary"},{id:"thumbrest",type:"binary"}],axes:[null,null,{id:"thumbstick",type:"x-axis"},{id:"thumbstick",type:"y-axis"}]},t0={mapping:Jf.XRStandard,buttons:[{id:"trigger",type:"analog",eventTrigger:"select"},{id:"squeeze",type:"analog",eventTrigger:"squeeze"},null,{id:"thumbstick",type:"binary"},{id:"a-button",type:"binary"},{id:"b-button",type:"binary"},{id:"thumbrest",type:"binary"}],axes:[null,null,{id:"thumbstick",type:"x-axis"},{id:"thumbstick",type:"y-axis"}]},pN={profileId:"oculus-touch-v2",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:e0,gripOffsetMatrix:[.9925461411476135,4673031295254759e-24,-.12186938524246216,0,.08617470413446426,.7071065306663513,.7018362283706665,0,.0861746296286583,-.70710688829422,.7018358707427979,0,-.003979847766458988,-.01585787907242775,.04964185878634453,1],numHapticActuators:1},right:{gamepad:t0,gripOffsetMatrix:[.9925461411476135,3688163374704345e-23,.12186937034130096,0,-.08617469668388367,.7071066498756409,.7018361687660217,0,-.0861746147274971,-.7071068286895752,.7018359899520874,0,.003979853354394436,-.01585787907242775,.04964182525873184,1],numHapticActuators:1}}},mN={profileId:"oculus-touch-v3",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:e0,gripOffsetMatrix:[.9925461411476135,20823669899527886e-24,-.12186937034130096,0,.08617465198040009,.7071067094802856,.701836109161377,0,.08617466688156128,-.7071067690849304,.7018360495567322,0,-.003979838453233242,-.015857907012104988,.04964181408286095,1],numHapticActuators:1},right:{gamepad:t0,gripOffsetMatrix:[.9925461411476135,-8329467959811154e-23,.12186941504478455,0,-.08617465943098068,.7071066498756409,.7018361687660217,0,-.08617471158504486,-.7071068286895752,.7018359303474426,0,.003979798872023821,-.015857888385653496,.049641866236925125,1],numHapticActuators:1}}},gN={profileId:"meta-quest-touch-pro",fallbackProfileIds:["oculus-touch-v2","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:e0,gripOffsetMatrix:[.9925461411476135,-15779937356796836e-24,-.12186935544013977,0,.08617467433214188,.7071067094802856,.701836109161377,0,.0861746296286583,-.7071067690849304,.7018360495567322,0,-.003979836590588093,-.015857847407460213,.049641840159893036,1],numHapticActuators:3},right:{gamepad:t0,gripOffsetMatrix:[.9925461411476135,9267653311439972e-26,.12186937034130096,0,-.08617467433214188,.7071067094802856,.7018361687660217,0,-.08617464452981949,-.7071067690849304,.7018360495567322,0,.003979847766458988,-.01585782691836357,.04964186251163483,1],numHapticActuators:3}}},_N={profileId:"meta-quest-touch-plus",fallbackProfileIds:["oculus-touch-v3","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:e0,gripOffsetMatrix:[.9925461411476135,10736208366779465e-24,-.12186933308839798,0,.08617459982633591,.70710688829422,.7018360495567322,0,.08617466688156128,-.7071067094802856,.7018362283706665,0,-.003979803062975407,-.015857873484492302,.04964187368750572,1],numHapticActuators:1},right:{gamepad:t0,gripOffsetMatrix:[.9925461411476135,-26238110351073374e-24,.12186934053897858,0,-.0861746147274971,.7071067690849304,.7018360495567322,0,-.08617465943098068,-.7071067094802856,.701836109161377,0,.003979838453233242,-.015857869759202003,.04964182525873184,1],numHapticActuators:1}}};Ot.Inline,Ot.ImmersiveVR,Ot.ImmersiveAR,ct.Viewer,ct.Local,ct.LocalFloor,ct.BoundedFloor,ct.Unbounded,ct.Anchors,ct.PlaneDetection,ct.HandTracking,Ot.ImmersiveVR+"",$r.Opaque,Ot.ImmersiveAR+"",$r.AlphaBlend,su.WorldSpace;Ot.Inline,Ot.ImmersiveVR,Ot.ImmersiveAR,ct.Viewer,ct.Local,ct.LocalFloor,ct.BoundedFloor,ct.Unbounded,ct.Anchors,ct.PlaneDetection,ct.MeshDetection,ct.HitTest,ct.HandTracking,Ot.ImmersiveVR+"",$r.Opaque,Ot.ImmersiveAR+"",$r.AlphaBlend,su.WorldSpace;Ot.Inline,Ot.ImmersiveVR,Ot.ImmersiveAR,ct.Viewer,ct.Local,ct.LocalFloor,ct.BoundedFloor,ct.Unbounded,ct.Anchors,ct.PlaneDetection,ct.MeshDetection,ct.HitTest,ct.HandTracking,Ot.ImmersiveVR+"",$r.Opaque,Ot.ImmersiveAR+"",$r.AlphaBlend,su.WorldSpace;const vN={name:"Meta Quest 3",controllerConfig:_N,supportedSessionModes:[Ot.Inline,Ot.ImmersiveVR,Ot.ImmersiveAR],supportedFeatures:[ct.Viewer,ct.Local,ct.LocalFloor,ct.BoundedFloor,ct.Unbounded,ct.Anchors,ct.PlaneDetection,ct.MeshDetection,ct.HitTest,ct.HandTracking,ct.DepthSensing],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,environmentBlendModes:{[Ot.ImmersiveVR]:$r.Opaque,[Ot.ImmersiveAR]:$r.AlphaBlend},interactionMode:su.WorldSpace,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 3) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"};function gA(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var _A={exports:{}},n0={},vA={exports:{}},Et={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Cd=Symbol.for("react.element"),xN=Symbol.for("react.portal"),yN=Symbol.for("react.fragment"),SN=Symbol.for("react.strict_mode"),MN=Symbol.for("react.profiler"),EN=Symbol.for("react.provider"),wN=Symbol.for("react.context"),TN=Symbol.for("react.forward_ref"),AN=Symbol.for("react.suspense"),bN=Symbol.for("react.memo"),RN=Symbol.for("react.lazy"),C2=Symbol.iterator;function CN(n){return n===null||typeof n!="object"?null:(n=C2&&n[C2]||n["@@iterator"],typeof n=="function"?n:null)}var xA={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},yA=Object.assign,SA={};function Cu(n,e,t){this.props=n,this.context=e,this.refs=SA,this.updater=t||xA}Cu.prototype.isReactComponent={};Cu.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};Cu.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function MA(){}MA.prototype=Cu.prototype;function ry(n,e,t){this.props=n,this.context=e,this.refs=SA,this.updater=t||xA}var sy=ry.prototype=new MA;sy.constructor=ry;yA(sy,Cu.prototype);sy.isPureReactComponent=!0;var P2=Array.isArray,EA=Object.prototype.hasOwnProperty,oy={current:null},wA={key:!0,ref:!0,__self:!0,__source:!0};function TA(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)EA.call(e,i)&&!wA.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1{};let ly={},RA={},CA=null,PA={mark:I2,measure:I2};try{typeof window<"u"&&(ly=window),typeof document<"u"&&(RA=document),typeof MutationObserver<"u"&&(CA=MutationObserver),typeof performance<"u"&&(PA=performance)}catch{}const{userAgent:D2=""}=ly.navigator||{},ua=ly,jt=RA,N2=CA,yh=PA;ua.document;const ao=!!jt.documentElement&&!!jt.head&&typeof jt.addEventListener=="function"&&typeof jt.createElement=="function",LA=~D2.indexOf("MSIE")||~D2.indexOf("Trident/");var en="classic",IA="duotone",ji="sharp",qi="sharp-duotone",zN=[en,IA,ji,qi],HN={classic:{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},sharp:{900:"fass",400:"fasr",300:"fasl",100:"fast"},"sharp-duotone":{900:"fasds"}},U2={kit:{fak:"kit","fa-kit":"kit"},"kit-duotone":{fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"}},VN=["kit"],GN=/fa(s|r|l|t|d|b|k|kd|ss|sr|sl|st|sds)?[\-\ ]/,WN=/Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit)?.*/i,$N={"Font Awesome 5 Free":{900:"fas",400:"far"},"Font Awesome 5 Pro":{900:"fas",400:"far",normal:"far",300:"fal"},"Font Awesome 5 Brands":{400:"fab",normal:"fab"},"Font Awesome 5 Duotone":{900:"fad"}},XN={"Font Awesome 6 Free":{900:"fas",400:"far"},"Font Awesome 6 Pro":{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},"Font Awesome 6 Brands":{400:"fab",normal:"fab"},"Font Awesome 6 Duotone":{900:"fad"},"Font Awesome 6 Sharp":{900:"fass",400:"fasr",normal:"fasr",300:"fasl",100:"fast"},"Font Awesome 6 Sharp Duotone":{900:"fasds"}},jN={classic:{"fa-brands":"fab","fa-duotone":"fad","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"},sharp:{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"},"sharp-duotone":{"fa-solid":"fasds"}},qN={classic:["fas","far","fal","fat"],sharp:["fass","fasr","fasl","fast"],"sharp-duotone":["fasds"]},YN={classic:{fab:"fa-brands",fad:"fa-duotone",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"},sharp:{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"},"sharp-duotone":{fasds:"fa-solid"}},KN={classic:{solid:"fas",regular:"far",light:"fal",thin:"fat",duotone:"fad",brands:"fab"},sharp:{solid:"fass",regular:"fasr",light:"fasl",thin:"fast"},"sharp-duotone":{solid:"fasds"}},DA={classic:{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fad:"duotone","fa-duotone":"duotone",fab:"brands","fa-brands":"brands"},sharp:{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"},"sharp-duotone":{fa:"solid",fasds:"solid","fa-solid":"solid"}},ZN=["solid","regular","light","thin","duotone","brands"],NA=[1,2,3,4,5,6,7,8,9,10],QN=NA.concat([11,12,13,14,15,16,17,18,19,20]),vf={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},JN=[...Object.keys(qN),...ZN,"2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","fw","inverse","layers-counter","layers-text","layers","li","pull-left","pull-right","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul",vf.GROUP,vf.SWAP_OPACITY,vf.PRIMARY,vf.SECONDARY].concat(NA.map(n=>"".concat(n,"x"))).concat(QN.map(n=>"w-".concat(n))),eU={"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}},tU={kit:{"fa-kit":"fak"},"kit-duotone":{"fa-kit-duotone":"fakd"}},nU={kit:{fak:"fa-kit"},"kit-duotone":{fakd:"fa-kit-duotone"}},O2={kit:{kit:"fak"},"kit-duotone":{"kit-duotone":"fakd"}};const Qs="___FONT_AWESOME___",Av=16,UA="fa",OA="svg-inline--fa",_l="data-fa-i2svg",bv="data-fa-pseudo-element",iU="data-fa-pseudo-element-pending",cy="data-prefix",uy="data-icon",F2="fontawesome-i2svg",rU="async",sU=["HTML","HEAD","STYLE","SCRIPT"],FA=(()=>{try{return!0}catch{return!1}})(),kA=[en,ji,qi];function Pd(n){return new Proxy(n,{get(e,t){return t in e?e[t]:e[en]}})}const BA={...DA};BA[en]={...DA[en],...U2.kit,...U2["kit-duotone"]};const ll=Pd(BA),Rv={...KN};Rv[en]={...Rv[en],...O2.kit,...O2["kit-duotone"]};const td=Pd(Rv),Cv={...YN};Cv[en]={...Cv[en],...nU.kit};const cl=Pd(Cv),Pv={...jN};Pv[en]={...Pv[en],...tU.kit};const oU=Pd(Pv),aU=GN,zA="fa-layers-text",lU=WN,cU={...HN};Pd(cU);const uU=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],gg=vf,ou=new Set;Object.keys(td[en]).map(ou.add.bind(ou));Object.keys(td[ji]).map(ou.add.bind(ou));Object.keys(td[qi]).map(ou.add.bind(ou));const fU=[...VN,...JN],Nf=ua.FontAwesomeConfig||{};function dU(n){var e=jt.querySelector("script["+n+"]");if(e)return e.getAttribute(n)}function hU(n){return n===""?!0:n==="false"?!1:n==="true"?!0:n}jt&&typeof jt.querySelector=="function"&&[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-auto-a11y","autoA11y"],["data-search-pseudo-elements","searchPseudoElements"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]].forEach(e=>{let[t,i]=e;const r=hU(dU(t));r!=null&&(Nf[i]=r)});const HA={styleDefault:"solid",familyDefault:"classic",cssPrefix:UA,replacementClass:OA,autoReplaceSvg:!0,autoAddCss:!0,autoA11y:!0,searchPseudoElements:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};Nf.familyPrefix&&(Nf.cssPrefix=Nf.familyPrefix);const au={...HA,...Nf};au.autoReplaceSvg||(au.observeMutations=!1);const Ke={};Object.keys(HA).forEach(n=>{Object.defineProperty(Ke,n,{enumerable:!0,set:function(e){au[n]=e,Uf.forEach(t=>t(Ke))},get:function(){return au[n]}})});Object.defineProperty(Ke,"familyPrefix",{enumerable:!0,set:function(n){au.cssPrefix=n,Uf.forEach(e=>e(Ke))},get:function(){return au.cssPrefix}});ua.FontAwesomeConfig=Ke;const Uf=[];function pU(n){return Uf.push(n),()=>{Uf.splice(Uf.indexOf(n),1)}}const So=Av,as={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function mU(n){if(!n||!ao)return;const e=jt.createElement("style");e.setAttribute("type","text/css"),e.innerHTML=n;const t=jt.head.childNodes;let i=null;for(let r=t.length-1;r>-1;r--){const s=t[r],o=(s.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(o)>-1&&(i=s)}return jt.head.insertBefore(e,i),n}const gU="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function nd(){let n=12,e="";for(;n-- >0;)e+=gU[Math.random()*62|0];return e}function Pu(n){const e=[];for(let t=(n||[]).length>>>0;t--;)e[t]=n[t];return e}function fy(n){return n.classList?Pu(n.classList):(n.getAttribute("class")||"").split(" ").filter(e=>e)}function VA(n){return"".concat(n).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function _U(n){return Object.keys(n||{}).reduce((e,t)=>e+"".concat(t,'="').concat(VA(n[t]),'" '),"").trim()}function i0(n){return Object.keys(n||{}).reduce((e,t)=>e+"".concat(t,": ").concat(n[t].trim(),";"),"")}function dy(n){return n.size!==as.size||n.x!==as.x||n.y!==as.y||n.rotate!==as.rotate||n.flipX||n.flipY}function vU(n){let{transform:e,containerWidth:t,iconWidth:i}=n;const r={transform:"translate(".concat(t/2," 256)")},s="translate(".concat(e.x*32,", ").concat(e.y*32,") "),o="scale(".concat(e.size/16*(e.flipX?-1:1),", ").concat(e.size/16*(e.flipY?-1:1),") "),a="rotate(".concat(e.rotate," 0 0)"),l={transform:"".concat(s," ").concat(o," ").concat(a)},c={transform:"translate(".concat(i/2*-1," -256)")};return{outer:r,inner:l,path:c}}function xU(n){let{transform:e,width:t=Av,height:i=Av,startCentered:r=!1}=n,s="";return r&&LA?s+="translate(".concat(e.x/So-t/2,"em, ").concat(e.y/So-i/2,"em) "):r?s+="translate(calc(-50% + ".concat(e.x/So,"em), calc(-50% + ").concat(e.y/So,"em)) "):s+="translate(".concat(e.x/So,"em, ").concat(e.y/So,"em) "),s+="scale(".concat(e.size/So*(e.flipX?-1:1),", ").concat(e.size/So*(e.flipY?-1:1),") "),s+="rotate(".concat(e.rotate,"deg) "),s}var yU=`:root, :host { + --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Free"; + --fa-font-regular: normal 400 1em/1 "Font Awesome 6 Free"; + --fa-font-light: normal 300 1em/1 "Font Awesome 6 Pro"; + --fa-font-thin: normal 100 1em/1 "Font Awesome 6 Pro"; + --fa-font-duotone: normal 900 1em/1 "Font Awesome 6 Duotone"; + --fa-font-brands: normal 400 1em/1 "Font Awesome 6 Brands"; + --fa-font-sharp-solid: normal 900 1em/1 "Font Awesome 6 Sharp"; + --fa-font-sharp-regular: normal 400 1em/1 "Font Awesome 6 Sharp"; + --fa-font-sharp-light: normal 300 1em/1 "Font Awesome 6 Sharp"; + --fa-font-sharp-thin: normal 100 1em/1 "Font Awesome 6 Sharp"; + --fa-font-sharp-duotone-solid: normal 900 1em/1 "Font Awesome 6 Sharp Duotone"; +} + +svg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa { + overflow: visible; + box-sizing: content-box; +} + +.svg-inline--fa { + display: var(--fa-display, inline-block); + height: 1em; + overflow: visible; + vertical-align: -0.125em; +} +.svg-inline--fa.fa-2xs { + vertical-align: 0.1em; +} +.svg-inline--fa.fa-xs { + vertical-align: 0em; +} +.svg-inline--fa.fa-sm { + vertical-align: -0.0714285705em; +} +.svg-inline--fa.fa-lg { + vertical-align: -0.2em; +} +.svg-inline--fa.fa-xl { + vertical-align: -0.25em; +} +.svg-inline--fa.fa-2xl { + vertical-align: -0.3125em; +} +.svg-inline--fa.fa-pull-left { + margin-right: var(--fa-pull-margin, 0.3em); + width: auto; +} +.svg-inline--fa.fa-pull-right { + margin-left: var(--fa-pull-margin, 0.3em); + width: auto; +} +.svg-inline--fa.fa-li { + width: var(--fa-li-width, 2em); + top: 0.25em; +} +.svg-inline--fa.fa-fw { + width: var(--fa-fw-width, 1.25em); +} + +.fa-layers svg.svg-inline--fa { + bottom: 0; + left: 0; + margin: auto; + position: absolute; + right: 0; + top: 0; +} + +.fa-layers-counter, .fa-layers-text { + display: inline-block; + position: absolute; + text-align: center; +} + +.fa-layers { + display: inline-block; + height: 1em; + position: relative; + text-align: center; + vertical-align: -0.125em; + width: 1em; +} +.fa-layers svg.svg-inline--fa { + transform-origin: center center; +} + +.fa-layers-text { + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + transform-origin: center center; +} + +.fa-layers-counter { + background-color: var(--fa-counter-background-color, #ff253a); + border-radius: var(--fa-counter-border-radius, 1em); + box-sizing: border-box; + color: var(--fa-inverse, #fff); + line-height: var(--fa-counter-line-height, 1); + max-width: var(--fa-counter-max-width, 5em); + min-width: var(--fa-counter-min-width, 1.5em); + overflow: hidden; + padding: var(--fa-counter-padding, 0.25em 0.5em); + right: var(--fa-right, 0); + text-overflow: ellipsis; + top: var(--fa-top, 0); + transform: scale(var(--fa-counter-scale, 0.25)); + transform-origin: top right; +} + +.fa-layers-bottom-right { + bottom: var(--fa-bottom, 0); + right: var(--fa-right, 0); + top: auto; + transform: scale(var(--fa-layers-scale, 0.25)); + transform-origin: bottom right; +} + +.fa-layers-bottom-left { + bottom: var(--fa-bottom, 0); + left: var(--fa-left, 0); + right: auto; + top: auto; + transform: scale(var(--fa-layers-scale, 0.25)); + transform-origin: bottom left; +} + +.fa-layers-top-right { + top: var(--fa-top, 0); + right: var(--fa-right, 0); + transform: scale(var(--fa-layers-scale, 0.25)); + transform-origin: top right; +} + +.fa-layers-top-left { + left: var(--fa-left, 0); + right: auto; + top: var(--fa-top, 0); + transform: scale(var(--fa-layers-scale, 0.25)); + transform-origin: top left; +} + +.fa-1x { + font-size: 1em; +} + +.fa-2x { + font-size: 2em; +} + +.fa-3x { + font-size: 3em; +} + +.fa-4x { + font-size: 4em; +} + +.fa-5x { + font-size: 5em; +} + +.fa-6x { + font-size: 6em; +} + +.fa-7x { + font-size: 7em; +} + +.fa-8x { + font-size: 8em; +} + +.fa-9x { + font-size: 9em; +} + +.fa-10x { + font-size: 10em; +} + +.fa-2xs { + font-size: 0.625em; + line-height: 0.1em; + vertical-align: 0.225em; +} + +.fa-xs { + font-size: 0.75em; + line-height: 0.0833333337em; + vertical-align: 0.125em; +} + +.fa-sm { + font-size: 0.875em; + line-height: 0.0714285718em; + vertical-align: 0.0535714295em; +} + +.fa-lg { + font-size: 1.25em; + line-height: 0.05em; + vertical-align: -0.075em; +} + +.fa-xl { + font-size: 1.5em; + line-height: 0.0416666682em; + vertical-align: -0.125em; +} + +.fa-2xl { + font-size: 2em; + line-height: 0.03125em; + vertical-align: -0.1875em; +} + +.fa-fw { + text-align: center; + width: 1.25em; +} + +.fa-ul { + list-style-type: none; + margin-left: var(--fa-li-margin, 2.5em); + padding-left: 0; +} +.fa-ul > li { + position: relative; +} + +.fa-li { + left: calc(-1 * var(--fa-li-width, 2em)); + position: absolute; + text-align: center; + width: var(--fa-li-width, 2em); + line-height: inherit; +} + +.fa-border { + border-color: var(--fa-border-color, #eee); + border-radius: var(--fa-border-radius, 0.1em); + border-style: var(--fa-border-style, solid); + border-width: var(--fa-border-width, 0.08em); + padding: var(--fa-border-padding, 0.2em 0.25em 0.15em); +} + +.fa-pull-left { + float: left; + margin-right: var(--fa-pull-margin, 0.3em); +} + +.fa-pull-right { + float: right; + margin-left: var(--fa-pull-margin, 0.3em); +} + +.fa-beat { + animation-name: fa-beat; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-in-out); +} + +.fa-bounce { + animation-name: fa-bounce; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1)); +} + +.fa-fade { + animation-name: fa-fade; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1)); +} + +.fa-beat-fade { + animation-name: fa-beat-fade; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1)); +} + +.fa-flip { + animation-name: fa-flip; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-in-out); +} + +.fa-shake { + animation-name: fa-shake; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, linear); +} + +.fa-spin { + animation-name: fa-spin; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 2s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, linear); +} + +.fa-spin-reverse { + --fa-animation-direction: reverse; +} + +.fa-pulse, +.fa-spin-pulse { + animation-name: fa-spin; + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, steps(8)); +} + +@media (prefers-reduced-motion: reduce) { + .fa-beat, +.fa-bounce, +.fa-fade, +.fa-beat-fade, +.fa-flip, +.fa-pulse, +.fa-shake, +.fa-spin, +.fa-spin-pulse { + animation-delay: -1ms; + animation-duration: 1ms; + animation-iteration-count: 1; + transition-delay: 0s; + transition-duration: 0s; + } +} +@keyframes fa-beat { + 0%, 90% { + transform: scale(1); + } + 45% { + transform: scale(var(--fa-beat-scale, 1.25)); + } +} +@keyframes fa-bounce { + 0% { + transform: scale(1, 1) translateY(0); + } + 10% { + transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0); + } + 30% { + transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em)); + } + 50% { + transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0); + } + 57% { + transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em)); + } + 64% { + transform: scale(1, 1) translateY(0); + } + 100% { + transform: scale(1, 1) translateY(0); + } +} +@keyframes fa-fade { + 50% { + opacity: var(--fa-fade-opacity, 0.4); + } +} +@keyframes fa-beat-fade { + 0%, 100% { + opacity: var(--fa-beat-fade-opacity, 0.4); + transform: scale(1); + } + 50% { + opacity: 1; + transform: scale(var(--fa-beat-fade-scale, 1.125)); + } +} +@keyframes fa-flip { + 50% { + transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg)); + } +} +@keyframes fa-shake { + 0% { + transform: rotate(-15deg); + } + 4% { + transform: rotate(15deg); + } + 8%, 24% { + transform: rotate(-18deg); + } + 12%, 28% { + transform: rotate(18deg); + } + 16% { + transform: rotate(-22deg); + } + 20% { + transform: rotate(22deg); + } + 32% { + transform: rotate(-12deg); + } + 36% { + transform: rotate(12deg); + } + 40%, 100% { + transform: rotate(0deg); + } +} +@keyframes fa-spin { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} +.fa-rotate-90 { + transform: rotate(90deg); +} + +.fa-rotate-180 { + transform: rotate(180deg); +} + +.fa-rotate-270 { + transform: rotate(270deg); +} + +.fa-flip-horizontal { + transform: scale(-1, 1); +} + +.fa-flip-vertical { + transform: scale(1, -1); +} + +.fa-flip-both, +.fa-flip-horizontal.fa-flip-vertical { + transform: scale(-1, -1); +} + +.fa-rotate-by { + transform: rotate(var(--fa-rotate-angle, 0)); +} + +.fa-stack { + display: inline-block; + vertical-align: middle; + height: 2em; + position: relative; + width: 2.5em; +} + +.fa-stack-1x, +.fa-stack-2x { + bottom: 0; + left: 0; + margin: auto; + position: absolute; + right: 0; + top: 0; + z-index: var(--fa-stack-z-index, auto); +} + +.svg-inline--fa.fa-stack-1x { + height: 1em; + width: 1.25em; +} +.svg-inline--fa.fa-stack-2x { + height: 2em; + width: 2.5em; +} + +.fa-inverse { + color: var(--fa-inverse, #fff); +} + +.sr-only, +.fa-sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +.sr-only-focusable:not(:focus), +.fa-sr-only-focusable:not(:focus) { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +.svg-inline--fa .fa-primary { + fill: var(--fa-primary-color, currentColor); + opacity: var(--fa-primary-opacity, 1); +} + +.svg-inline--fa .fa-secondary { + fill: var(--fa-secondary-color, currentColor); + opacity: var(--fa-secondary-opacity, 0.4); +} + +.svg-inline--fa.fa-swap-opacity .fa-primary { + opacity: var(--fa-secondary-opacity, 0.4); +} + +.svg-inline--fa.fa-swap-opacity .fa-secondary { + opacity: var(--fa-primary-opacity, 1); +} + +.svg-inline--fa mask .fa-primary, +.svg-inline--fa mask .fa-secondary { + fill: black; +} + +.fad.fa-inverse, +.fa-duotone.fa-inverse { + color: var(--fa-inverse, #fff); +}`;function GA(){const n=UA,e=OA,t=Ke.cssPrefix,i=Ke.replacementClass;let r=yU;if(t!==n||i!==e){const s=new RegExp("\\.".concat(n,"\\-"),"g"),o=new RegExp("\\--".concat(n,"\\-"),"g"),a=new RegExp("\\.".concat(e),"g");r=r.replace(s,".".concat(t,"-")).replace(o,"--".concat(t,"-")).replace(a,".".concat(i))}return r}let k2=!1;function _g(){Ke.autoAddCss&&!k2&&(mU(GA()),k2=!0)}var SU={mixout(){return{dom:{css:GA,insertCss:_g}}},hooks(){return{beforeDOMElementCreation(){_g()},beforeI2svg(){_g()}}}};const Js=ua||{};Js[Qs]||(Js[Qs]={});Js[Qs].styles||(Js[Qs].styles={});Js[Qs].hooks||(Js[Qs].hooks={});Js[Qs].shims||(Js[Qs].shims=[]);var ls=Js[Qs];const WA=[],$A=function(){jt.removeEventListener("DOMContentLoaded",$A),om=1,WA.map(n=>n())};let om=!1;ao&&(om=(jt.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(jt.readyState),om||jt.addEventListener("DOMContentLoaded",$A));function MU(n){ao&&(om?setTimeout(n,0):WA.push(n))}function Ld(n){const{tag:e,attributes:t={},children:i=[]}=n;return typeof n=="string"?VA(n):"<".concat(e," ").concat(_U(t),">").concat(i.map(Ld).join(""),"")}function B2(n,e,t){if(n&&n[e]&&n[e][t])return{prefix:e,iconName:t,icon:n[e][t]}}var vg=function(e,t,i,r){var s=Object.keys(e),o=s.length,a=t,l,c,u;for(i===void 0?(l=1,u=e[s[0]]):(l=0,u=i);l=55296&&r<=56319&&t=55296&&i<=56319&&t>e+1&&(r=n.charCodeAt(e+1),r>=56320&&r<=57343)?(i-55296)*1024+r-56320+65536:i}function z2(n){return Object.keys(n).reduce((e,t)=>{const i=n[t];return!!i.icon?e[i.iconName]=i.icon:e[t]=i,e},{})}function Iv(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{skipHooks:i=!1}=t,r=z2(e);typeof ls.hooks.addPack=="function"&&!i?ls.hooks.addPack(n,z2(e)):ls.styles[n]={...ls.styles[n]||{},...r},n==="fas"&&Iv("fa",e)}const{styles:Ka,shims:TU}=ls,AU={[en]:Object.values(cl[en]),[ji]:Object.values(cl[ji]),[qi]:Object.values(cl[qi])};let hy=null,XA={},jA={},qA={},YA={},KA={};const bU={[en]:Object.keys(ll[en]),[ji]:Object.keys(ll[ji]),[qi]:Object.keys(ll[qi])};function RU(n){return~fU.indexOf(n)}function CU(n,e){const t=e.split("-"),i=t[0],r=t.slice(1).join("-");return i===n&&r!==""&&!RU(r)?r:null}const ZA=()=>{const n=i=>vg(Ka,(r,s,o)=>(r[o]=vg(s,i,{}),r),{});XA=n((i,r,s)=>(r[3]&&(i[r[3]]=s),r[2]&&r[2].filter(a=>typeof a=="number").forEach(a=>{i[a.toString(16)]=s}),i)),jA=n((i,r,s)=>(i[s]=s,r[2]&&r[2].filter(a=>typeof a=="string").forEach(a=>{i[a]=s}),i)),KA=n((i,r,s)=>{const o=r[2];return i[s]=s,o.forEach(a=>{i[a]=s}),i});const e="far"in Ka||Ke.autoFetchSvg,t=vg(TU,(i,r)=>{const s=r[0];let o=r[1];const a=r[2];return o==="far"&&!e&&(o="fas"),typeof s=="string"&&(i.names[s]={prefix:o,iconName:a}),typeof s=="number"&&(i.unicodes[s.toString(16)]={prefix:o,iconName:a}),i},{names:{},unicodes:{}});qA=t.names,YA=t.unicodes,hy=r0(Ke.styleDefault,{family:Ke.familyDefault})};pU(n=>{hy=r0(n.styleDefault,{family:Ke.familyDefault})});ZA();function py(n,e){return(XA[n]||{})[e]}function PU(n,e){return(jA[n]||{})[e]}function Xo(n,e){return(KA[n]||{})[e]}function QA(n){return qA[n]||{prefix:null,iconName:null}}function LU(n){const e=YA[n],t=py("fas",n);return e||(t?{prefix:"fas",iconName:t}:null)||{prefix:null,iconName:null}}function fa(){return hy}const my=()=>({prefix:null,iconName:null,rest:[]});function r0(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{family:t=en}=e,i=ll[t][n],r=td[t][n]||td[t][i],s=n in ls.styles?n:null;return r||s||null}const IU={[en]:Object.keys(cl[en]),[ji]:Object.keys(cl[ji]),[qi]:Object.keys(cl[qi])};function s0(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{skipLookups:t=!1}=e,i={[en]:"".concat(Ke.cssPrefix,"-").concat(en),[ji]:"".concat(Ke.cssPrefix,"-").concat(ji),[qi]:"".concat(Ke.cssPrefix,"-").concat(qi)};let r=null,s=en;const o=zN.filter(l=>l!==IA);o.forEach(l=>{(n.includes(i[l])||n.some(c=>IU[l].includes(c)))&&(s=l)});const a=n.reduce((l,c)=>{const u=CU(Ke.cssPrefix,c);if(Ka[c]?(c=AU[s].includes(c)?oU[s][c]:c,r=c,l.prefix=c):bU[s].indexOf(c)>-1?(r=c,l.prefix=r0(c,{family:s})):u?l.iconName=u:c!==Ke.replacementClass&&!o.some(f=>c===i[f])&&l.rest.push(c),!t&&l.prefix&&l.iconName){const f=r==="fa"?QA(l.iconName):{},h=Xo(l.prefix,l.iconName);f.prefix&&(r=null),l.iconName=f.iconName||h||l.iconName,l.prefix=f.prefix||l.prefix,l.prefix==="far"&&!Ka.far&&Ka.fas&&!Ke.autoFetchSvg&&(l.prefix="fas")}return l},my());return(n.includes("fa-brands")||n.includes("fab"))&&(a.prefix="fab"),(n.includes("fa-duotone")||n.includes("fad"))&&(a.prefix="fad"),!a.prefix&&s===ji&&(Ka.fass||Ke.autoFetchSvg)&&(a.prefix="fass",a.iconName=Xo(a.prefix,a.iconName)||a.iconName),!a.prefix&&s===qi&&(Ka.fasds||Ke.autoFetchSvg)&&(a.prefix="fasds",a.iconName=Xo(a.prefix,a.iconName)||a.iconName),(a.prefix==="fa"||r==="fa")&&(a.prefix=fa()||"fas"),a}class DU{constructor(){this.definitions={}}add(){for(var e=arguments.length,t=new Array(e),i=0;i{this.definitions[s]={...this.definitions[s]||{},...r[s]},Iv(s,r[s]);const o=cl[en][s];o&&Iv(o,r[s]),ZA()})}reset(){this.definitions={}}_pullDefinitions(e,t){const i=t.prefix&&t.iconName&&t.icon?{0:t}:t;return Object.keys(i).map(r=>{const{prefix:s,iconName:o,icon:a}=i[r],l=a[2];e[s]||(e[s]={}),l.length>0&&l.forEach(c=>{typeof c=="string"&&(e[s][c]=a)}),e[s][o]=a}),e}}let H2=[],gc={};const kc={},NU=Object.keys(kc);function UU(n,e){let{mixoutsTo:t}=e;return H2=n,gc={},Object.keys(kc).forEach(i=>{NU.indexOf(i)===-1&&delete kc[i]}),H2.forEach(i=>{const r=i.mixout?i.mixout():{};if(Object.keys(r).forEach(s=>{typeof r[s]=="function"&&(t[s]=r[s]),typeof r[s]=="object"&&Object.keys(r[s]).forEach(o=>{t[s]||(t[s]={}),t[s][o]=r[s][o]})}),i.hooks){const s=i.hooks();Object.keys(s).forEach(o=>{gc[o]||(gc[o]=[]),gc[o].push(s[o])})}i.provides&&i.provides(kc)}),t}function Dv(n,e){for(var t=arguments.length,i=new Array(t>2?t-2:0),r=2;r{e=o.apply(null,[e,...i])}),e}function vl(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i{s.apply(null,t)})}function da(){const n=arguments[0],e=Array.prototype.slice.call(arguments,1);return kc[n]?kc[n].apply(null,e):void 0}function Nv(n){n.prefix==="fa"&&(n.prefix="fas");let{iconName:e}=n;const t=n.prefix||fa();if(e)return e=Xo(t,e)||e,B2(JA.definitions,t,e)||B2(ls.styles,t,e)}const JA=new DU,OU=()=>{Ke.autoReplaceSvg=!1,Ke.observeMutations=!1,vl("noAuto")},FU={i2svg:function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ao?(vl("beforeI2svg",n),da("pseudoElements2svg",n),da("i2svg",n)):Promise.reject(new Error("Operation requires a DOM of some kind."))},watch:function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{autoReplaceSvgRoot:e}=n;Ke.autoReplaceSvg===!1&&(Ke.autoReplaceSvg=!0),Ke.observeMutations=!0,MU(()=>{BU({autoReplaceSvgRoot:e}),vl("watch",n)})}},kU={icon:n=>{if(n===null)return null;if(typeof n=="object"&&n.prefix&&n.iconName)return{prefix:n.prefix,iconName:Xo(n.prefix,n.iconName)||n.iconName};if(Array.isArray(n)&&n.length===2){const e=n[1].indexOf("fa-")===0?n[1].slice(3):n[1],t=r0(n[0]);return{prefix:t,iconName:Xo(t,e)||e}}if(typeof n=="string"&&(n.indexOf("".concat(Ke.cssPrefix,"-"))>-1||n.match(aU))){const e=s0(n.split(" "),{skipLookups:!0});return{prefix:e.prefix||fa(),iconName:Xo(e.prefix,e.iconName)||e.iconName}}if(typeof n=="string"){const e=fa();return{prefix:e,iconName:Xo(e,n)||n}}}},er={noAuto:OU,config:Ke,dom:FU,parse:kU,library:JA,findIconDefinition:Nv,toHtml:Ld},BU=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{autoReplaceSvgRoot:e=jt}=n;(Object.keys(ls.styles).length>0||Ke.autoFetchSvg)&&ao&&Ke.autoReplaceSvg&&er.dom.i2svg({node:e})};function o0(n,e){return Object.defineProperty(n,"abstract",{get:e}),Object.defineProperty(n,"html",{get:function(){return n.abstract.map(t=>Ld(t))}}),Object.defineProperty(n,"node",{get:function(){if(!ao)return;const t=jt.createElement("div");return t.innerHTML=n.html,t.children}}),n}function zU(n){let{children:e,main:t,mask:i,attributes:r,styles:s,transform:o}=n;if(dy(o)&&t.found&&!i.found){const{width:a,height:l}=t,c={x:a/l/2,y:.5};r.style=i0({...s,"transform-origin":"".concat(c.x+o.x/16,"em ").concat(c.y+o.y/16,"em")})}return[{tag:"svg",attributes:r,children:e}]}function HU(n){let{prefix:e,iconName:t,children:i,attributes:r,symbol:s}=n;const o=s===!0?"".concat(e,"-").concat(Ke.cssPrefix,"-").concat(t):s;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:{...r,id:o},children:i}]}]}function gy(n){const{icons:{main:e,mask:t},prefix:i,iconName:r,transform:s,symbol:o,title:a,maskId:l,titleId:c,extra:u,watchable:f=!1}=n,{width:h,height:p}=t.found?t:e,g=i==="fak",_=[Ke.replacementClass,r?"".concat(Ke.cssPrefix,"-").concat(r):""].filter(b=>u.classes.indexOf(b)===-1).filter(b=>b!==""||!!b).concat(u.classes).join(" ");let m={children:[],attributes:{...u.attributes,"data-prefix":i,"data-icon":r,class:_,role:u.attributes.role||"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(h," ").concat(p)}};const d=g&&!~u.classes.indexOf("fa-fw")?{width:"".concat(h/p*16*.0625,"em")}:{};f&&(m.attributes[_l]=""),a&&(m.children.push({tag:"title",attributes:{id:m.attributes["aria-labelledby"]||"title-".concat(c||nd())},children:[a]}),delete m.attributes.title);const x={...m,prefix:i,iconName:r,main:e,mask:t,maskId:l,transform:s,symbol:o,styles:{...d,...u.styles}},{children:v,attributes:y}=t.found&&e.found?da("generateAbstractMask",x)||{children:[],attributes:{}}:da("generateAbstractIcon",x)||{children:[],attributes:{}};return x.children=v,x.attributes=y,o?HU(x):zU(x)}function V2(n){const{content:e,width:t,height:i,transform:r,title:s,extra:o,watchable:a=!1}=n,l={...o.attributes,...s?{title:s}:{},class:o.classes.join(" ")};a&&(l[_l]="");const c={...o.styles};dy(r)&&(c.transform=xU({transform:r,startCentered:!0,width:t,height:i}),c["-webkit-transform"]=c.transform);const u=i0(c);u.length>0&&(l.style=u);const f=[];return f.push({tag:"span",attributes:l,children:[e]}),s&&f.push({tag:"span",attributes:{class:"sr-only"},children:[s]}),f}function VU(n){const{content:e,title:t,extra:i}=n,r={...i.attributes,...t?{title:t}:{},class:i.classes.join(" ")},s=i0(i.styles);s.length>0&&(r.style=s);const o=[];return o.push({tag:"span",attributes:r,children:[e]}),t&&o.push({tag:"span",attributes:{class:"sr-only"},children:[t]}),o}const{styles:xg}=ls;function Uv(n){const e=n[0],t=n[1],[i]=n.slice(4);let r=null;return Array.isArray(i)?r={tag:"g",attributes:{class:"".concat(Ke.cssPrefix,"-").concat(gg.GROUP)},children:[{tag:"path",attributes:{class:"".concat(Ke.cssPrefix,"-").concat(gg.SECONDARY),fill:"currentColor",d:i[0]}},{tag:"path",attributes:{class:"".concat(Ke.cssPrefix,"-").concat(gg.PRIMARY),fill:"currentColor",d:i[1]}}]}:r={tag:"path",attributes:{fill:"currentColor",d:i}},{found:!0,width:e,height:t,icon:r}}const GU={found:!1,width:512,height:512};function WU(n,e){!FA&&!Ke.showMissingIcons&&n&&console.error('Icon with name "'.concat(n,'" and prefix "').concat(e,'" is missing.'))}function Ov(n,e){let t=e;return e==="fa"&&Ke.styleDefault!==null&&(e=fa()),new Promise((i,r)=>{if(t==="fa"){const s=QA(n)||{};n=s.iconName||n,e=s.prefix||e}if(n&&e&&xg[e]&&xg[e][n]){const s=xg[e][n];return i(Uv(s))}WU(n,e),i({...GU,icon:Ke.showMissingIcons&&n?da("missingIconAbstract")||{}:{}})})}const G2=()=>{},Fv=Ke.measurePerformance&&yh&&yh.mark&&yh.measure?yh:{mark:G2,measure:G2},xf='FA "6.6.0"',$U=n=>(Fv.mark("".concat(xf," ").concat(n," begins")),()=>eb(n)),eb=n=>{Fv.mark("".concat(xf," ").concat(n," ends")),Fv.measure("".concat(xf," ").concat(n),"".concat(xf," ").concat(n," begins"),"".concat(xf," ").concat(n," ends"))};var _y={begin:$U,end:eb};const Ap=()=>{};function W2(n){return typeof(n.getAttribute?n.getAttribute(_l):null)=="string"}function XU(n){const e=n.getAttribute?n.getAttribute(cy):null,t=n.getAttribute?n.getAttribute(uy):null;return e&&t}function jU(n){return n&&n.classList&&n.classList.contains&&n.classList.contains(Ke.replacementClass)}function qU(){return Ke.autoReplaceSvg===!0?bp.replace:bp[Ke.autoReplaceSvg]||bp.replace}function YU(n){return jt.createElementNS("http://www.w3.org/2000/svg",n)}function KU(n){return jt.createElement(n)}function tb(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{ceFn:t=n.tag==="svg"?YU:KU}=e;if(typeof n=="string")return jt.createTextNode(n);const i=t(n.tag);return Object.keys(n.attributes||[]).forEach(function(s){i.setAttribute(s,n.attributes[s])}),(n.children||[]).forEach(function(s){i.appendChild(tb(s,{ceFn:t}))}),i}function ZU(n){let e=" ".concat(n.outerHTML," ");return e="".concat(e,"Font Awesome fontawesome.com "),e}const bp={replace:function(n){const e=n[0];if(e.parentNode)if(n[1].forEach(t=>{e.parentNode.insertBefore(tb(t),e)}),e.getAttribute(_l)===null&&Ke.keepOriginalSource){let t=jt.createComment(ZU(e));e.parentNode.replaceChild(t,e)}else e.remove()},nest:function(n){const e=n[0],t=n[1];if(~fy(e).indexOf(Ke.replacementClass))return bp.replace(n);const i=new RegExp("".concat(Ke.cssPrefix,"-.*"));if(delete t[0].attributes.id,t[0].attributes.class){const s=t[0].attributes.class.split(" ").reduce((o,a)=>(a===Ke.replacementClass||a.match(i)?o.toSvg.push(a):o.toNode.push(a),o),{toNode:[],toSvg:[]});t[0].attributes.class=s.toSvg.join(" "),s.toNode.length===0?e.removeAttribute("class"):e.setAttribute("class",s.toNode.join(" "))}const r=t.map(s=>Ld(s)).join(` +`);e.setAttribute(_l,""),e.innerHTML=r}};function $2(n){n()}function nb(n,e){const t=typeof e=="function"?e:Ap;if(n.length===0)t();else{let i=$2;Ke.mutateApproach===rU&&(i=ua.requestAnimationFrame||$2),i(()=>{const r=qU(),s=_y.begin("mutate");n.map(r),s(),t()})}}let vy=!1;function ib(){vy=!0}function kv(){vy=!1}let am=null;function X2(n){if(!N2||!Ke.observeMutations)return;const{treeCallback:e=Ap,nodeCallback:t=Ap,pseudoElementsCallback:i=Ap,observeMutationsRoot:r=jt}=n;am=new N2(s=>{if(vy)return;const o=fa();Pu(s).forEach(a=>{if(a.type==="childList"&&a.addedNodes.length>0&&!W2(a.addedNodes[0])&&(Ke.searchPseudoElements&&i(a.target),e(a.target)),a.type==="attributes"&&a.target.parentNode&&Ke.searchPseudoElements&&i(a.target.parentNode),a.type==="attributes"&&W2(a.target)&&~uU.indexOf(a.attributeName))if(a.attributeName==="class"&&XU(a.target)){const{prefix:l,iconName:c}=s0(fy(a.target));a.target.setAttribute(cy,l||o),c&&a.target.setAttribute(uy,c)}else jU(a.target)&&t(a.target)})}),ao&&am.observe(r,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}function QU(){am&&am.disconnect()}function JU(n){const e=n.getAttribute("style");let t=[];return e&&(t=e.split(";").reduce((i,r)=>{const s=r.split(":"),o=s[0],a=s.slice(1);return o&&a.length>0&&(i[o]=a.join(":").trim()),i},{})),t}function e9(n){const e=n.getAttribute("data-prefix"),t=n.getAttribute("data-icon"),i=n.innerText!==void 0?n.innerText.trim():"";let r=s0(fy(n));return r.prefix||(r.prefix=fa()),e&&t&&(r.prefix=e,r.iconName=t),r.iconName&&r.prefix||(r.prefix&&i.length>0&&(r.iconName=PU(r.prefix,n.innerText)||py(r.prefix,Lv(n.innerText))),!r.iconName&&Ke.autoFetchSvg&&n.firstChild&&n.firstChild.nodeType===Node.TEXT_NODE&&(r.iconName=n.firstChild.data)),r}function t9(n){const e=Pu(n.attributes).reduce((r,s)=>(r.name!=="class"&&r.name!=="style"&&(r[s.name]=s.value),r),{}),t=n.getAttribute("title"),i=n.getAttribute("data-fa-title-id");return Ke.autoA11y&&(t?e["aria-labelledby"]="".concat(Ke.replacementClass,"-title-").concat(i||nd()):(e["aria-hidden"]="true",e.focusable="false")),e}function n9(){return{iconName:null,title:null,titleId:null,prefix:null,transform:as,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}}}function j2(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{styleParser:!0};const{iconName:t,prefix:i,rest:r}=e9(n),s=t9(n),o=Dv("parseNodeAttributes",{},n);let a=e.styleParser?JU(n):[];return{iconName:t,title:n.getAttribute("title"),titleId:n.getAttribute("data-fa-title-id"),prefix:i,transform:as,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:r,styles:a,attributes:s},...o}}const{styles:i9}=ls;function rb(n){const e=Ke.autoReplaceSvg==="nest"?j2(n,{styleParser:!1}):j2(n);return~e.extra.classes.indexOf(zA)?da("generateLayersText",n,e):da("generateSvgReplacementMutation",n,e)}let hs=new Set;kA.map(n=>{hs.add("fa-".concat(n))});Object.keys(ll[en]).map(hs.add.bind(hs));Object.keys(ll[ji]).map(hs.add.bind(hs));Object.keys(ll[qi]).map(hs.add.bind(hs));hs=[...hs];function q2(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!ao)return Promise.resolve();const t=jt.documentElement.classList,i=u=>t.add("".concat(F2,"-").concat(u)),r=u=>t.remove("".concat(F2,"-").concat(u)),s=Ke.autoFetchSvg?hs:kA.map(u=>"fa-".concat(u)).concat(Object.keys(i9));s.includes("fa")||s.push("fa");const o=[".".concat(zA,":not([").concat(_l,"])")].concat(s.map(u=>".".concat(u,":not([").concat(_l,"])"))).join(", ");if(o.length===0)return Promise.resolve();let a=[];try{a=Pu(n.querySelectorAll(o))}catch{}if(a.length>0)i("pending"),r("complete");else return Promise.resolve();const l=_y.begin("onTree"),c=a.reduce((u,f)=>{try{const h=rb(f);h&&u.push(h)}catch(h){FA||h.name==="MissingIcon"&&console.error(h)}return u},[]);return new Promise((u,f)=>{Promise.all(c).then(h=>{nb(h,()=>{i("active"),i("complete"),r("pending"),typeof e=="function"&&e(),l(),u()})}).catch(h=>{l(),f(h)})})}function r9(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;rb(n).then(t=>{t&&nb([t],e)})}function s9(n){return function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=(e||{}).icon?e:Nv(e||{});let{mask:r}=t;return r&&(r=(r||{}).icon?r:Nv(r||{})),n(i,{...t,mask:r})}}const o9=function(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{transform:t=as,symbol:i=!1,mask:r=null,maskId:s=null,title:o=null,titleId:a=null,classes:l=[],attributes:c={},styles:u={}}=e;if(!n)return;const{prefix:f,iconName:h,icon:p}=n;return o0({type:"icon",...n},()=>(vl("beforeDOMElementCreation",{iconDefinition:n,params:e}),Ke.autoA11y&&(o?c["aria-labelledby"]="".concat(Ke.replacementClass,"-title-").concat(a||nd()):(c["aria-hidden"]="true",c.focusable="false")),gy({icons:{main:Uv(p),mask:r?Uv(r.icon):{found:!1,width:null,height:null,icon:{}}},prefix:f,iconName:h,transform:{...as,...t},symbol:i,title:o,maskId:s,titleId:a,extra:{attributes:c,styles:u,classes:l}})))};var a9={mixout(){return{icon:s9(o9)}},hooks(){return{mutationObserverCallbacks(n){return n.treeCallback=q2,n.nodeCallback=r9,n}}},provides(n){n.i2svg=function(e){const{node:t=jt,callback:i=()=>{}}=e;return q2(t,i)},n.generateSvgReplacementMutation=function(e,t){const{iconName:i,title:r,titleId:s,prefix:o,transform:a,symbol:l,mask:c,maskId:u,extra:f}=t;return new Promise((h,p)=>{Promise.all([Ov(i,o),c.iconName?Ov(c.iconName,c.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(g=>{let[_,m]=g;h([e,gy({icons:{main:_,mask:m},prefix:o,iconName:i,transform:a,symbol:l,maskId:u,title:r,titleId:s,extra:f,watchable:!0})])}).catch(p)})},n.generateAbstractIcon=function(e){let{children:t,attributes:i,main:r,transform:s,styles:o}=e;const a=i0(o);a.length>0&&(i.style=a);let l;return dy(s)&&(l=da("generateAbstractTransformGrouping",{main:r,transform:s,containerWidth:r.width,iconWidth:r.width})),t.push(l||r.icon),{children:t,attributes:i}}}},l9={mixout(){return{layer(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{classes:t=[]}=e;return o0({type:"layer"},()=>{vl("beforeDOMElementCreation",{assembler:n,params:e});let i=[];return n(r=>{Array.isArray(r)?r.map(s=>{i=i.concat(s.abstract)}):i=i.concat(r.abstract)}),[{tag:"span",attributes:{class:["".concat(Ke.cssPrefix,"-layers"),...t].join(" ")},children:i}]})}}}},c9={mixout(){return{counter(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{title:t=null,classes:i=[],attributes:r={},styles:s={}}=e;return o0({type:"counter",content:n},()=>(vl("beforeDOMElementCreation",{content:n,params:e}),VU({content:n.toString(),title:t,extra:{attributes:r,styles:s,classes:["".concat(Ke.cssPrefix,"-layers-counter"),...i]}})))}}}},u9={mixout(){return{text(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{transform:t=as,title:i=null,classes:r=[],attributes:s={},styles:o={}}=e;return o0({type:"text",content:n},()=>(vl("beforeDOMElementCreation",{content:n,params:e}),V2({content:n,transform:{...as,...t},title:i,extra:{attributes:s,styles:o,classes:["".concat(Ke.cssPrefix,"-layers-text"),...r]}})))}}},provides(n){n.generateLayersText=function(e,t){const{title:i,transform:r,extra:s}=t;let o=null,a=null;if(LA){const l=parseInt(getComputedStyle(e).fontSize,10),c=e.getBoundingClientRect();o=c.width/l,a=c.height/l}return Ke.autoA11y&&!i&&(s.attributes["aria-hidden"]="true"),Promise.resolve([e,V2({content:e.innerHTML,width:o,height:a,transform:r,title:i,extra:s,watchable:!0})])}}};const f9=new RegExp('"',"ug"),Y2=[1105920,1112319],K2={FontAwesome:{normal:"fas",400:"fas"},...XN,...$N,...eU},Bv=Object.keys(K2).reduce((n,e)=>(n[e.toLowerCase()]=K2[e],n),{}),d9=Object.keys(Bv).reduce((n,e)=>{const t=Bv[e];return n[e]=t[900]||[...Object.entries(t)][0][1],n},{});function h9(n){const e=n.replace(f9,""),t=wU(e,0),i=t>=Y2[0]&&t<=Y2[1],r=e.length===2?e[0]===e[1]:!1;return{value:Lv(r?e[0]:e),isSecondary:i||r}}function p9(n,e){const t=n.replace(/^['"]|['"]$/g,"").toLowerCase(),i=parseInt(e),r=isNaN(i)?"normal":i;return(Bv[t]||{})[r]||d9[t]}function Z2(n,e){const t="".concat(iU).concat(e.replace(":","-"));return new Promise((i,r)=>{if(n.getAttribute(t)!==null)return i();const o=Pu(n.children).filter(h=>h.getAttribute(bv)===e)[0],a=ua.getComputedStyle(n,e),l=a.getPropertyValue("font-family"),c=l.match(lU),u=a.getPropertyValue("font-weight"),f=a.getPropertyValue("content");if(o&&!c)return n.removeChild(o),i();if(c&&f!=="none"&&f!==""){const h=a.getPropertyValue("content");let p=p9(l,u);const{value:g,isSecondary:_}=h9(h),m=c[0].startsWith("FontAwesome");let d=py(p,g),x=d;if(m){const v=LU(g);v.iconName&&v.prefix&&(d=v.iconName,p=v.prefix)}if(d&&!_&&(!o||o.getAttribute(cy)!==p||o.getAttribute(uy)!==x)){n.setAttribute(t,x),o&&n.removeChild(o);const v=n9(),{extra:y}=v;y.attributes[bv]=e,Ov(d,p).then(b=>{const w=gy({...v,icons:{main:b,mask:my()},prefix:p,iconName:x,extra:y,watchable:!0}),T=jt.createElementNS("http://www.w3.org/2000/svg","svg");e==="::before"?n.insertBefore(T,n.firstChild):n.appendChild(T),T.outerHTML=w.map(C=>Ld(C)).join(` +`),n.removeAttribute(t),i()}).catch(r)}else i()}else i()})}function m9(n){return Promise.all([Z2(n,"::before"),Z2(n,"::after")])}function g9(n){return n.parentNode!==document.head&&!~sU.indexOf(n.tagName.toUpperCase())&&!n.getAttribute(bv)&&(!n.parentNode||n.parentNode.tagName!=="svg")}function Q2(n){if(ao)return new Promise((e,t)=>{const i=Pu(n.querySelectorAll("*")).filter(g9).map(m9),r=_y.begin("searchPseudoElements");ib(),Promise.all(i).then(()=>{r(),kv(),e()}).catch(()=>{r(),kv(),t()})})}var _9={hooks(){return{mutationObserverCallbacks(n){return n.pseudoElementsCallback=Q2,n}}},provides(n){n.pseudoElements2svg=function(e){const{node:t=jt}=e;Ke.searchPseudoElements&&Q2(t)}}};let J2=!1;var v9={mixout(){return{dom:{unwatch(){ib(),J2=!0}}}},hooks(){return{bootstrap(){X2(Dv("mutationObserverCallbacks",{}))},noAuto(){QU()},watch(n){const{observeMutationsRoot:e}=n;J2?kv():X2(Dv("mutationObserverCallbacks",{observeMutationsRoot:e}))}}}};const eE=n=>{let e={size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0};return n.toLowerCase().split(" ").reduce((t,i)=>{const r=i.toLowerCase().split("-"),s=r[0];let o=r.slice(1).join("-");if(s&&o==="h")return t.flipX=!0,t;if(s&&o==="v")return t.flipY=!0,t;if(o=parseFloat(o),isNaN(o))return t;switch(s){case"grow":t.size=t.size+o;break;case"shrink":t.size=t.size-o;break;case"left":t.x=t.x-o;break;case"right":t.x=t.x+o;break;case"up":t.y=t.y-o;break;case"down":t.y=t.y+o;break;case"rotate":t.rotate=t.rotate+o;break}return t},e)};var x9={mixout(){return{parse:{transform:n=>eE(n)}}},hooks(){return{parseNodeAttributes(n,e){const t=e.getAttribute("data-fa-transform");return t&&(n.transform=eE(t)),n}}},provides(n){n.generateAbstractTransformGrouping=function(e){let{main:t,transform:i,containerWidth:r,iconWidth:s}=e;const o={transform:"translate(".concat(r/2," 256)")},a="translate(".concat(i.x*32,", ").concat(i.y*32,") "),l="scale(".concat(i.size/16*(i.flipX?-1:1),", ").concat(i.size/16*(i.flipY?-1:1),") "),c="rotate(".concat(i.rotate," 0 0)"),u={transform:"".concat(a," ").concat(l," ").concat(c)},f={transform:"translate(".concat(s/2*-1," -256)")},h={outer:o,inner:u,path:f};return{tag:"g",attributes:{...h.outer},children:[{tag:"g",attributes:{...h.inner},children:[{tag:t.icon.tag,children:t.icon.children,attributes:{...t.icon.attributes,...h.path}}]}]}}}};const yg={x:0,y:0,width:"100%",height:"100%"};function tE(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return n.attributes&&(n.attributes.fill||e)&&(n.attributes.fill="black"),n}function y9(n){return n.tag==="g"?n.children:[n]}var S9={hooks(){return{parseNodeAttributes(n,e){const t=e.getAttribute("data-fa-mask"),i=t?s0(t.split(" ").map(r=>r.trim())):my();return i.prefix||(i.prefix=fa()),n.mask=i,n.maskId=e.getAttribute("data-fa-mask-id"),n}}},provides(n){n.generateAbstractMask=function(e){let{children:t,attributes:i,main:r,mask:s,maskId:o,transform:a}=e;const{width:l,icon:c}=r,{width:u,icon:f}=s,h=vU({transform:a,containerWidth:u,iconWidth:l}),p={tag:"rect",attributes:{...yg,fill:"white"}},g=c.children?{children:c.children.map(tE)}:{},_={tag:"g",attributes:{...h.inner},children:[tE({tag:c.tag,attributes:{...c.attributes,...h.path},...g})]},m={tag:"g",attributes:{...h.outer},children:[_]},d="mask-".concat(o||nd()),x="clip-".concat(o||nd()),v={tag:"mask",attributes:{...yg,id:d,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"},children:[p,m]},y={tag:"defs",children:[{tag:"clipPath",attributes:{id:x},children:y9(f)},v]};return t.push(y,{tag:"rect",attributes:{fill:"currentColor","clip-path":"url(#".concat(x,")"),mask:"url(#".concat(d,")"),...yg}}),{children:t,attributes:i}}}},M9={provides(n){let e=!1;ua.matchMedia&&(e=ua.matchMedia("(prefers-reduced-motion: reduce)").matches),n.missingIconAbstract=function(){const t=[],i={fill:"currentColor"},r={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};t.push({tag:"path",attributes:{...i,d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"}});const s={...r,attributeName:"opacity"},o={tag:"circle",attributes:{...i,cx:"256",cy:"364",r:"28"},children:[]};return e||o.children.push({tag:"animate",attributes:{...r,attributeName:"r",values:"28;14;28;28;14;28;"}},{tag:"animate",attributes:{...s,values:"1;0;1;1;0;1;"}}),t.push(o),t.push({tag:"path",attributes:{...i,opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"},children:e?[]:[{tag:"animate",attributes:{...s,values:"1;0;0;0;0;1;"}}]}),e||t.push({tag:"path",attributes:{...i,opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"},children:[{tag:"animate",attributes:{...s,values:"0;0;1;1;0;0;"}}]}),{tag:"g",attributes:{class:"missing"},children:t}}}},E9={hooks(){return{parseNodeAttributes(n,e){const t=e.getAttribute("data-fa-symbol"),i=t===null?!1:t===""?!0:t;return n.symbol=i,n}}}},w9=[SU,a9,l9,c9,u9,_9,v9,x9,S9,M9,E9];UU(w9,{mixoutsTo:er});er.noAuto;er.config;er.library;er.dom;const zv=er.parse;er.findIconDefinition;er.toHtml;const T9=er.icon;er.layer;er.text;er.counter;var sb={exports:{}},A9="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",b9=A9,R9=b9;function ob(){}function ab(){}ab.resetWarningCache=ob;var C9=function(){function n(i,r,s,o,a,l){if(l!==R9){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}n.isRequired=n;function e(){return n}var t={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:e,element:n,elementType:n,instanceOf:e,node:n,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:ab,resetWarningCache:ob};return t.PropTypes=t,t};sb.exports=C9();var P9=sb.exports;const St=gA(P9);function nE(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function es(n){for(var e=1;e=0)&&(t[r]=n[r]);return t}function I9(n,e){if(n==null)return{};var t=L9(n,e),i,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function Hv(n){return D9(n)||N9(n)||U9(n)||O9()}function D9(n){if(Array.isArray(n))return Vv(n)}function N9(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function U9(n,e){if(n){if(typeof n=="string")return Vv(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Vv(n,e)}}function Vv(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t2&&arguments[2]!==void 0?arguments[2]:{};if(typeof e=="string")return e;var i=(e.children||[]).map(function(l){return cb(n,l)}),r=Object.keys(e.attributes||{}).reduce(function(l,c){var u=e.attributes[c];switch(c){case"class":l.attrs.className=u,delete e.attributes.class;break;case"style":l.attrs.style=H9(u);break;default:c.indexOf("aria-")===0||c.indexOf("data-")===0?l.attrs[c.toLowerCase()]=u:l.attrs[lb(c)]=u}return l},{attrs:{}}),s=t.style,o=s===void 0?{}:s,a=I9(t,B9);return r.attrs.style=es(es({},r.attrs.style),o),n.apply(void 0,[e.tag,es(es({},r.attrs),a)].concat(Hv(i)))}var ub=!1;try{ub=!0}catch{}function V9(){if(!ub&&console&&typeof console.error=="function"){var n;(n=console).error.apply(n,arguments)}}function iE(n){if(n&&lm(n)==="object"&&n.prefix&&n.iconName&&n.icon)return n;if(zv.icon)return zv.icon(n);if(n===null)return null;if(n&&lm(n)==="object"&&n.prefix&&n.iconName)return n;if(Array.isArray(n)&&n.length===2)return{prefix:n[0],iconName:n[1]};if(typeof n=="string")return{prefix:"fas",iconName:n}}function Sg(n,e){return Array.isArray(e)&&e.length>0||!Array.isArray(e)&&e?_c({},n,e):{}}var rE={border:!1,className:"",mask:null,maskId:null,fixedWidth:!1,inverse:!1,flip:!1,icon:null,listItem:!1,pull:null,pulse:!1,rotation:null,size:null,spin:!1,spinPulse:!1,spinReverse:!1,beat:!1,fade:!1,beatFade:!1,bounce:!1,shake:!1,symbol:!1,title:"",titleId:null,transform:null,swapOpacity:!1},id=gl.forwardRef(function(n,e){var t=es(es({},rE),n),i=t.icon,r=t.mask,s=t.symbol,o=t.className,a=t.title,l=t.titleId,c=t.maskId,u=iE(i),f=Sg("classes",[].concat(Hv(F9(t)),Hv((o||"").split(" ")))),h=Sg("transform",typeof t.transform=="string"?zv.transform(t.transform):t.transform),p=Sg("mask",iE(r)),g=T9(u,es(es(es(es({},f),h),p),{},{symbol:s,title:a,titleId:l,maskId:c}));if(!g)return V9("Could not find icon",u),null;var _=g.abstract,m={ref:e};return Object.keys(t).forEach(function(d){rE.hasOwnProperty(d)||(m[d]=t[d])}),G9(_[0],m)});id.displayName="FontAwesomeIcon";id.propTypes={beat:St.bool,border:St.bool,beatFade:St.bool,bounce:St.bool,className:St.string,fade:St.bool,flash:St.bool,mask:St.oneOfType([St.object,St.array,St.string]),maskId:St.string,fixedWidth:St.bool,inverse:St.bool,flip:St.oneOf([!0,!1,"horizontal","vertical","both"]),icon:St.oneOfType([St.object,St.array,St.string]),listItem:St.bool,pull:St.oneOf(["right","left"]),pulse:St.bool,rotation:St.oneOf([0,90,180,270]),shake:St.bool,size:St.oneOf(["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"]),spin:St.bool,spinPulse:St.bool,spinReverse:St.bool,symbol:St.oneOfType([St.bool,St.string]),title:St.string,titleId:St.string,transform:St.oneOfType([St.string,St.object]),swapOpacity:St.bool};var G9=cb.bind(null,gl.createElement),Ai=function(){return Ai=Object.assign||function(e){for(var t,i=1,r=arguments.length;i0?Dn(Lu,--gr):0,cu--,vn===10&&(cu=1,l0--),vn}function Hr(){return vn=gr2||Wv(vn)>3?"":" "}function J9(n,e){for(;--e&&Hr()&&!(vn<48||vn>102||vn>57&&vn<65||vn>70&&vn<97););return u0(n,Cp()+(e<6&&ul()==32&&Hr()==32))}function $v(n){for(;Hr();)switch(vn){case n:return gr;case 34:case 39:n!==34&&n!==39&&$v(vn);break;case 40:n===41&&$v(n);break;case 92:Hr();break}return gr}function e7(n,e){for(;Hr()&&n+vn!==57;)if(n+vn===84&&ul()===47)break;return"/*"+u0(e,gr-1)+"*"+yy(n===47?n:Hr())}function t7(n){for(;!Wv(ul());)Hr();return u0(n,gr)}function n7(n){return Z9(Pp("",null,null,null,[""],n=K9(n),0,[0],n))}function Pp(n,e,t,i,r,s,o,a,l){for(var c=0,u=0,f=o,h=0,p=0,g=0,_=1,m=1,d=1,x=0,v="",y=r,b=s,w=i,T=v;m;)switch(g=x,x=Hr()){case 40:if(g!=108&&Dn(T,f-1)==58){Rp(T+=gt(Mg(x),"&","&\f"),"&\f",hb(c?a[c-1]:0))!=-1&&(d=-1);break}case 34:case 39:case 91:T+=Mg(x);break;case 9:case 10:case 13:case 32:T+=Q9(g);break;case 92:T+=J9(Cp()-1,7);continue;case 47:switch(ul()){case 42:case 47:yf(i7(e7(Hr(),Cp()),e,t,l),l);break;default:T+="/"}break;case 123*_:a[c++]=ts(T)*d;case 125*_:case 59:case 0:switch(x){case 0:case 125:m=0;case 59+u:d==-1&&(T=gt(T,/\f/g,"")),p>0&&ts(T)-f&&yf(p>32?aE(T+";",i,t,f-1,l):aE(gt(T," ","")+";",i,t,f-2,l),l);break;case 59:T+=";";default:if(yf(w=oE(T,e,t,c,u,r,a,v,y=[],b=[],f,s),s),x===123)if(u===0)Pp(T,e,w,w,y,s,f,a,b);else switch(h===99&&Dn(T,3)===110?100:h){case 100:case 108:case 109:case 115:Pp(n,w,w,i&&yf(oE(n,w,w,0,0,r,a,v,r,y=[],f,b),b),r,b,f,a,i?y:b);break;default:Pp(T,w,w,w,[""],b,0,a,b)}}c=u=p=0,_=d=1,v=T="",f=o;break;case 58:f=1+ts(T),p=g;default:if(_<1){if(x==123)--_;else if(x==125&&_++==0&&Y9()==125)continue}switch(T+=yy(x),x*_){case 38:d=u>0?1:(T+="\f",-1);break;case 44:a[c++]=(ts(T)-1)*d,d=1;break;case 64:ul()===45&&(T+=Mg(Hr())),h=ul(),u=f=ts(v=T+=t7(Cp())),x++;break;case 45:g===45&&ts(T)==2&&(_=0)}}return s}function oE(n,e,t,i,r,s,o,a,l,c,u,f){for(var h=r-1,p=r===0?s:[""],g=mb(p),_=0,m=0,d=0;_0?p[x]+" "+v:gt(v,/&\f/g,p[x])))&&(l[d++]=y);return c0(n,e,t,r===0?a0:a,l,c,u,f)}function i7(n,e,t,i){return c0(n,e,t,fb,yy(q9()),lu(n,2,-2),0,i)}function aE(n,e,t,i,r){return c0(n,e,t,xy,lu(n,0,i),lu(n,i+1,-1),i,r)}function _b(n,e,t){switch(X9(n,e)){case 5103:return Pt+"print-"+n+n;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Pt+n+n;case 4789:return Of+n+n;case 5349:case 4246:case 4810:case 6968:case 2756:return Pt+n+Of+n+Gt+n+n;case 5936:switch(Dn(n,e+11)){case 114:return Pt+n+Gt+gt(n,/[svh]\w+-[tblr]{2}/,"tb")+n;case 108:return Pt+n+Gt+gt(n,/[svh]\w+-[tblr]{2}/,"tb-rl")+n;case 45:return Pt+n+Gt+gt(n,/[svh]\w+-[tblr]{2}/,"lr")+n}case 6828:case 4268:case 2903:return Pt+n+Gt+n+n;case 6165:return Pt+n+Gt+"flex-"+n+n;case 5187:return Pt+n+gt(n,/(\w+).+(:[^]+)/,Pt+"box-$1$2"+Gt+"flex-$1$2")+n;case 5443:return Pt+n+Gt+"flex-item-"+gt(n,/flex-|-self/g,"")+(Fs(n,/flex-|baseline/)?"":Gt+"grid-row-"+gt(n,/flex-|-self/g,""))+n;case 4675:return Pt+n+Gt+"flex-line-pack"+gt(n,/align-content|flex-|-self/g,"")+n;case 5548:return Pt+n+Gt+gt(n,"shrink","negative")+n;case 5292:return Pt+n+Gt+gt(n,"basis","preferred-size")+n;case 6060:return Pt+"box-"+gt(n,"-grow","")+Pt+n+Gt+gt(n,"grow","positive")+n;case 4554:return Pt+gt(n,/([^-])(transform)/g,"$1"+Pt+"$2")+n;case 6187:return gt(gt(gt(n,/(zoom-|grab)/,Pt+"$1"),/(image-set)/,Pt+"$1"),n,"")+n;case 5495:case 3959:return gt(n,/(image-set\([^]*)/,Pt+"$1$`$1");case 4968:return gt(gt(n,/(.+:)(flex-)?(.*)/,Pt+"box-pack:$3"+Gt+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Pt+n+n;case 4200:if(!Fs(n,/flex-|baseline/))return Gt+"grid-column-align"+lu(n,e)+n;break;case 2592:case 3360:return Gt+gt(n,"template-","")+n;case 4384:case 3616:return t&&t.some(function(i,r){return e=r,Fs(i.props,/grid-\w+-end/)})?~Rp(n+(t=t[e].value),"span",0)?n:Gt+gt(n,"-start","")+n+Gt+"grid-row-span:"+(~Rp(t,"span",0)?Fs(t,/\d+/):+Fs(t,/\d+/)-+Fs(n,/\d+/))+";":Gt+gt(n,"-start","")+n;case 4896:case 4128:return t&&t.some(function(i){return Fs(i.props,/grid-\w+-start/)})?n:Gt+gt(gt(n,"-end","-span"),"span ","")+n;case 4095:case 3583:case 4068:case 2532:return gt(n,/(.+)-inline(.+)/,Pt+"$1$2")+n;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ts(n)-1-e>6)switch(Dn(n,e+1)){case 109:if(Dn(n,e+4)!==45)break;case 102:return gt(n,/(.+:)(.+)-([^]+)/,"$1"+Pt+"$2-$3$1"+Of+(Dn(n,e+3)==108?"$3":"$2-$3"))+n;case 115:return~Rp(n,"stretch",0)?_b(gt(n,"stretch","fill-available"),e,t)+n:n}break;case 5152:case 5920:return gt(n,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(i,r,s,o,a,l,c){return Gt+r+":"+s+c+(o?Gt+r+"-span:"+(a?l:+l-+s)+c:"")+n});case 4949:if(Dn(n,e+6)===121)return gt(n,":",":"+Pt)+n;break;case 6444:switch(Dn(n,Dn(n,14)===45?18:11)){case 120:return gt(n,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Pt+(Dn(n,14)===45?"inline-":"")+"box$3$1"+Pt+"$2$3$1"+Gt+"$2box$3")+n;case 100:return gt(n,":",":"+Gt)+n}break;case 5719:case 2647:case 2135:case 3927:case 2391:return gt(n,"scroll-","scroll-snap-")+n}return n}function um(n,e){for(var t="",i=0;i-1&&!n.return)switch(n.type){case xy:n.return=_b(n.value,n.length,t);return;case db:return um([No(n,{value:gt(n.value,"@","@"+Pt)})],i);case a0:if(n.length)return j9(t=n.props,function(r){switch(Fs(r,i=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":Xl(No(n,{props:[gt(r,/:(read-\w+)/,":"+Of+"$1")]})),Xl(No(n,{props:[r]})),Gv(n,{props:sE(t,i)});break;case"::placeholder":Xl(No(n,{props:[gt(r,/:(plac\w+)/,":"+Pt+"input-$1")]})),Xl(No(n,{props:[gt(r,/:(plac\w+)/,":"+Of+"$1")]})),Xl(No(n,{props:[gt(r,/:(plac\w+)/,Gt+"input-$1")]})),Xl(No(n,{props:[r]})),Gv(n,{props:sE(t,i)});break}return""})}}var l7={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Vi={},uu=typeof process<"u"&&Vi!==void 0&&(Vi.REACT_APP_SC_ATTR||Vi.SC_ATTR)||"data-styled",vb="active",xb="data-styled-version",f0="6.1.13",Sy=`/*!sc*/ +`,fm=typeof window<"u"&&"HTMLElement"in window,c7=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&Vi!==void 0&&Vi.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&Vi.REACT_APP_SC_DISABLE_SPEEDY!==""?Vi.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&Vi.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&Vi!==void 0&&Vi.SC_DISABLE_SPEEDY!==void 0&&Vi.SC_DISABLE_SPEEDY!==""&&Vi.SC_DISABLE_SPEEDY!=="false"&&Vi.SC_DISABLE_SPEEDY),d0=Object.freeze([]),fu=Object.freeze({});function u7(n,e,t){return t===void 0&&(t=fu),n.theme!==t.theme&&n.theme||e||t.theme}var yb=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),f7=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,d7=/(^-|-$)/g;function lE(n){return n.replace(f7,"-").replace(d7,"")}var h7=/(a)(d)/gi,Sh=52,cE=function(n){return String.fromCharCode(n+(n>25?39:97))};function Xv(n){var e,t="";for(e=Math.abs(n);e>Sh;e=e/Sh|0)t=cE(e%Sh)+t;return(cE(e%Sh)+t).replace(h7,"$1-$2")}var Eg,Sb=5381,vc=function(n,e){for(var t=e.length;t;)n=33*n^e.charCodeAt(--t);return n},Mb=function(n){return vc(Sb,n)};function p7(n){return Xv(Mb(n)>>>0)}function m7(n){return n.displayName||n.name||"Component"}function wg(n){return typeof n=="string"&&!0}var Eb=typeof Symbol=="function"&&Symbol.for,wb=Eb?Symbol.for("react.memo"):60115,g7=Eb?Symbol.for("react.forward_ref"):60112,_7={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},v7={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Tb={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},x7=((Eg={})[g7]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Eg[wb]=Tb,Eg);function uE(n){return("type"in(e=n)&&e.type.$$typeof)===wb?Tb:"$$typeof"in n?x7[n.$$typeof]:_7;var e}var y7=Object.defineProperty,S7=Object.getOwnPropertyNames,fE=Object.getOwnPropertySymbols,M7=Object.getOwnPropertyDescriptor,E7=Object.getPrototypeOf,dE=Object.prototype;function Ab(n,e,t){if(typeof e!="string"){if(dE){var i=E7(e);i&&i!==dE&&Ab(n,i,t)}var r=S7(e);fE&&(r=r.concat(fE(e)));for(var s=uE(n),o=uE(e),a=0;a0?" Args: ".concat(e.join(", ")):""))}var w7=function(){function n(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return n.prototype.indexOfGroup=function(e){for(var t=0,i=0;i=this.groupSizes.length){for(var i=this.groupSizes,r=i.length,s=r;e>=s;)if((s<<=1)<0)throw Id(16,"".concat(e));this.groupSizes=new Uint32Array(s),this.groupSizes.set(i),this.length=s;for(var o=r;o=this.length||this.groupSizes[e]===0)return t;for(var i=this.groupSizes[e],r=this.indexOfGroup(e),s=r+i,o=r;o=0){var i=document.createTextNode(t);return this.element.insertBefore(i,this.nodes[e]||null),this.length++,!0}return!1},n.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},n.prototype.getRule=function(e){return e0&&(m+="".concat(d,","))}),l+="".concat(g).concat(_,'{content:"').concat(m,'"}').concat(Sy)},u=0;u0?".".concat(e):h},u=l.slice();u.push(function(h){h.type===a0&&h.value.includes("&")&&(h.props[0]=h.props[0].replace(U7,t).replace(i,c))}),o.prefix&&u.push(a7),u.push(r7);var f=function(h,p,g,_){p===void 0&&(p=""),g===void 0&&(g=""),_===void 0&&(_="&"),e=_,t=p,i=new RegExp("\\".concat(t,"\\b"),"g");var m=h.replace(O7,""),d=n7(g||p?"".concat(g," ").concat(p," { ").concat(m," }"):m);o.namespace&&(d=Cb(d,o.namespace));var x=[];return um(d,s7(u.concat(o7(function(v){return x.push(v)})))),x};return f.hash=l.length?l.reduce(function(h,p){return p.name||Id(15),vc(h,p.name)},Sb).toString():"",f}var k7=new Rb,qv=F7(),Pb=gl.createContext({shouldForwardProp:void 0,styleSheet:k7,stylis:qv});Pb.Consumer;gl.createContext(void 0);function gE(){return Tt.useContext(Pb)}var B7=function(){function n(e,t){var i=this;this.inject=function(r,s){s===void 0&&(s=qv);var o=i.name+s.hash;r.hasNameForId(i.id,o)||r.insertRules(i.id,o,s(i.rules,o,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,Ey(this,function(){throw Id(12,String(i.name))})}return n.prototype.getName=function(e){return e===void 0&&(e=qv),this.name+e.hash},n}(),z7=function(n){return n>="A"&&n<="Z"};function _E(n){for(var e="",t=0;t>>0);if(!t.hasNameForId(this.componentId,o)){var a=i(s,".".concat(o),void 0,this.componentId);t.insertRules(this.componentId,o,a)}r=el(r,o),this.staticRulesId=o}else{for(var l=vc(this.baseHash,i.hash),c="",u=0;u>>0);t.hasNameForId(this.componentId,p)||t.insertRules(this.componentId,p,i(c,".".concat(p),void 0,this.componentId)),r=el(r,p)}}return r},n}(),Db=gl.createContext(void 0);Db.Consumer;var Tg={};function W7(n,e,t){var i=My(n),r=n,s=!wg(n),o=e.attrs,a=o===void 0?d0:o,l=e.componentId,c=l===void 0?function(y,b){var w=typeof y!="string"?"sc":lE(y);Tg[w]=(Tg[w]||0)+1;var T="".concat(w,"-").concat(p7(f0+w+Tg[w]));return b?"".concat(b,"-").concat(T):T}(e.displayName,e.parentComponentId):l,u=e.displayName,f=u===void 0?function(y){return wg(y)?"styled.".concat(y):"Styled(".concat(m7(y),")")}(n):u,h=e.displayName&&e.componentId?"".concat(lE(e.displayName),"-").concat(e.componentId):e.componentId||c,p=i&&r.attrs?r.attrs.concat(a).filter(Boolean):a,g=e.shouldForwardProp;if(i&&r.shouldForwardProp){var _=r.shouldForwardProp;if(e.shouldForwardProp){var m=e.shouldForwardProp;g=function(y,b){return _(y,b)&&m(y,b)}}else g=_}var d=new G7(t,h,i?r.componentStyle:void 0);function x(y,b){return function(w,T,C){var M=w.attrs,S=w.componentStyle,P=w.defaultProps,k=w.foldedComponentIds,U=w.styledComponentId,N=w.target,X=gl.useContext(Db),z=gE(),te=w.shouldForwardProp||z.shouldForwardProp,L=u7(T,X,P)||fu,Z=function(oe,me,de){for(var be,Le=Ai(Ai({},me),{className:void 0,theme:de}),ke=0;ken?"2px 8px 8px 2px":"8px 2px 2px 8px"}; + } + + &:last-child { + border-radius: ${({$reverse:n})=>n?"8px 2px 2px 8px":"2px 8px 8px 2px"}; + } +`,ci=ln.div` + background-color: ${({$pressed:n})=>n?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)"}; + border: none; + display: flex; + align-items: center; + justify-content: center; + color: white; + border-radius: 5px; + font-size: 14px; + font-family: Arial, sans-serif; + height: 20px; + width: 20px; + transition: all 0.2s ease-in-out; +`,Ub=ln.div` + display: flex; + align-items: center; + height: 24px; + margin-bottom: 2px; + justify-content: flex-start; + flex-direction: ${({$reverse:n})=>n?"row-reverse":"row"}; +`,hu=ln.div` + display: flex; + flex-direction: ${({$reverse:n})=>n?"row-reverse":"row"}; + height: 100%; + justify-content: space-between; + align-items: center; +`;ln.button` + background-color: rgba(255, 255, 255, 0.3); + border: none; + display: flex; + justify-content: center; + align-items: center; + padding: 0; + pointer-events: none; + width: 50px; + height: 50px; + border-radius: 50%; + position: relative; + margin: 0 5px; + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); +`;ln.div` + position: absolute; + background-color: white; + border-radius: 50%; + width: 36px; + height: 36px; + cursor: pointer; + pointer-events: auto; +`;const Ob=ln.input.attrs({type:"range"})` + -webkit-appearance: none; + appearance: none; + background-color: rgba(255, 255, 255, 0.3); + border: none; + height: 100%; + width: 49px; + cursor: pointer; + margin: 0 1px; + transition: all 0.2s ease-in-out; + border-radius: ${({$reverse:n})=>n?"8px 2px 2px 8px":"2px 8px 8px 2px"}; + + &::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + width: 8px; + height: 24px; + background-color: white; + border-radius: 3px; + } + + &::-moz-range-thumb { + width: 8px; + height: 24px; + background-color: white; + border-radius: 3px; + } + + &::-ms-thumb { + width: 8px; + height: 24px; + background-color: white; + border-radius: 3px; + } +`,X7=ln.div` + display: flex; + flex-direction: column; + align-items: ${({$reverse:n})=>n?"flex-start":"flex-end"}; + justify-content: center; + margin: ${({$reverse:n})=>n?"2px -26px 0 0":"2px 0 0 -26px"}; +`,yE=ln.div` + display: flex; + flex-direction: ${({$reverse:n})=>n?"row-reverse":"row"}; + align-items: center; + justify-content: center; +`;ln.div` + display: flex; + flex-direction: column; + height: 50px; + justify-content: space-between; +`;const pn=ln(id)` + height: 14px; + min-height: 14px; + max-height: 14px; + width: 14px; + min-width: 14px; + max-width: 14px; +`,j7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M7 13.125a7 7 0 1 0 14 0v1.75a7 7 0 0 1-14 0v-1.75Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.55,d:"M14 19.863a6.738 6.738 0 1 0 0-13.476 6.738 6.738 0 0 0 0 13.476Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M16.529 16.1h-.893l-1.653-2.713-1.68 2.713h-.832l2.074-3.255-1.942-2.992h.875l1.531 2.45 1.54-2.45h.831l-1.933 2.975 2.082 3.272Z",style:{fill:"#fff",fillOpacity:1}})]}),q7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M7 13.125a7 7 0 1 0 14 0v1.75a7 7 0 0 1-14 0v-1.75Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.55,d:"M14 19.863a6.738 6.738 0 1 0 0-13.476 6.738 6.738 0 0 0 0 13.476Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"m14.086 12.924 1.627-3.071h.849l-2.083 3.823V16.1h-.787v-2.389L11.61 9.853h.857l1.619 3.07Z",style:{fill:"#fff",fillOpacity:1}})]}),Y7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M7 13.125a7 7 0 1 0 14 0v1.75a7 7 0 0 1-14 0v-1.75Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.55,d:"M14 19.863a6.738 6.738 0 1 0 0-13.476 6.738 6.738 0 0 0 0 13.476Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"m15.975 16.1-.753-1.934h-2.476l-.744 1.934h-.796l2.441-6.274h.709l2.432 6.274h-.813Zm-1.69-4.524a29.052 29.052 0 0 1-.21-.63 5.175 5.175 0 0 0-.087-.306c-.029.117-.06.236-.096.359-.03.116-.061.224-.096.323-.03.1-.056.184-.079.254l-.709 1.89h1.978l-.7-1.89Z",style:{fill:"#fff",fillOpacity:1}})]}),K7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M7 13.125a7 7 0 1 0 14 0v1.75a7 7 0 0 1-14 0v-1.75Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.55,d:"M14 19.863a6.738 6.738 0 1 0 0-13.476 6.738 6.738 0 0 0 0 13.476Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M13.876 9.853c.519 0 .954.05 1.304.148.355.1.62.263.796.49.18.228.271.531.271.91 0 .245-.047.464-.14.656a1.198 1.198 0 0 1-.402.473 1.62 1.62 0 0 1-.648.254v.043c.262.041.499.117.709.228.216.11.385.268.507.473.123.204.184.47.184.796 0 .379-.088.703-.262.971a1.663 1.663 0 0 1-.753.604c-.32.134-.706.201-1.155.201h-2.196V9.853h1.785Zm.157 2.66c.537 0 .905-.085 1.103-.254.198-.175.297-.432.297-.77 0-.344-.122-.59-.367-.735-.24-.152-.624-.228-1.155-.228h-1.033v1.986h1.155Zm-1.155.656v2.266h1.26c.555 0 .94-.108 1.155-.324.216-.216.324-.498.324-.849 0-.221-.05-.414-.149-.577-.093-.163-.254-.289-.481-.376-.222-.093-.525-.14-.91-.14h-1.199Z",style:{fill:"#fff",fillOpacity:1}})]}),Z7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:.5,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M12.642 17.325v-6.247h.787v5.547h2.73v.7h-3.517ZM14.479 6.389a.525.525 0 0 1-.782 0l-2.235-2.495a.525.525 0 0 1 .39-.875h4.47c.454 0 .694.537.391.875L14.478 6.39Z",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"m13.045 6.711-1.093-1.22a8.75 8.75 0 1 0 4.24.036L15.11 6.733A7.352 7.352 0 0 1 14 21.35a7.35 7.35 0 0 1-.955-14.639Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),Q7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:.7,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM14.479 6.389a.525.525 0 0 1-.782 0l-2.235-2.495a.525.525 0 0 1 .39-.875h4.47c.454 0 .694.537.391.875L14.478 6.39Z",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"m13.045 6.711-1.093-1.22a8.75 8.75 0 1 0 4.24.036L15.11 6.733A7.352 7.352 0 0 1 14 21.35a7.35 7.35 0 0 1-.955-14.639Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),J7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M12.642 17.325v-6.248h.787v5.548h2.73v.7h-3.517ZM13.697.611a.525.525 0 0 1 .782 0l2.234 2.495a.525.525 0 0 1-.39.875h-4.47a.525.525 0 0 1-.391-.875L13.697.61Z",style:{fill:"#fff",fillOpacity:1}})]}),eO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M12.642 17.325v-6.248h.787v5.548h2.73v.7h-3.517ZM14.479 27.389a.525.525 0 0 1-.782 0l-2.235-2.495a.525.525 0 0 1 .39-.875h4.47c.454 0 .694.537.391.875l-2.235 2.495Z",style:{fill:"#fff",fillOpacity:1}})]}),tO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M12.642 17.325v-6.248h.787v5.548h2.73v.7h-3.517ZM.611 14.303a.525.525 0 0 1 0-.782l2.495-2.234a.525.525 0 0 1 .875.39v4.47a.525.525 0 0 1-.875.391L.61 14.303Z",style:{fill:"#fff",fillOpacity:1}})]}),nO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M12.642 17.325v-6.248h.787v5.548h2.73v.7h-3.517ZM27.389 13.521a.525.525 0 0 1 0 .782l-2.495 2.235a.525.525 0 0 1-.875-.39v-4.47c0-.454.537-.694.875-.391l2.495 2.234Z",style:{fill:"#fff",fillOpacity:1}})]}),iO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM13.697.611a.525.525 0 0 1 .782 0l2.234 2.495a.525.525 0 0 1-.39.875h-4.47a.525.525 0 0 1-.391-.875L13.697.61Z",style:{fill:"#fff",fillOpacity:1}})]}),rO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM14.479 27.389a.525.525 0 0 1-.782 0l-2.235-2.495a.525.525 0 0 1 .39-.875h4.47c.454 0 .694.537.391.875l-2.235 2.495Z",style:{fill:"#fff",fillOpacity:1}})]}),sO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM.611 14.303a.525.525 0 0 1 0-.782l2.495-2.234a.525.525 0 0 1 .875.39v4.47a.525.525 0 0 1-.875.391L.61 14.303Z",style:{fill:"#fff",fillOpacity:1}})]}),oO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM27.389 13.521a.525.525 0 0 1 0 .782l-2.495 2.235a.525.525 0 0 1-.875-.39v-4.47c0-.454.537-.694.875-.391l2.495 2.234Z",style:{fill:"#fff",fillOpacity:1}})]}),aO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M7.525 7.875c-2.283 1.22-3.82 3.507-3.82 6.125s1.537 4.904 3.82 6.125C4.405 19.425 2.1 16.948 2.1 14s2.306-5.425 5.425-6.125Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.7,d:"M24.702 10.954a2.187 2.187 0 0 0-2.095-2.817H11.025a5.863 5.863 0 0 0 0 11.726h9.377c.966 0 1.818-.634 2.095-1.56l2.205-7.35Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M10.594 17.15v-6.248h.788v5.548h2.73v.7h-3.518Zm7.13-3.299h2.162v3.063c-.338.11-.68.192-1.024.245a7.837 7.837 0 0 1-1.172.078c-.648 0-1.193-.128-1.637-.385a2.567 2.567 0 0 1-1.015-1.11c-.227-.485-.34-1.057-.34-1.716 0-.653.127-1.219.384-1.697a2.699 2.699 0 0 1 1.103-1.112c.484-.268 1.067-.402 1.75-.402.35 0 .68.032.988.096.315.064.607.155.875.271l-.297.683a4.55 4.55 0 0 0-.753-.254 3.453 3.453 0 0 0-.857-.105c-.496 0-.922.102-1.278.306a2.004 2.004 0 0 0-.813.875c-.187.374-.28.82-.28 1.34 0 .495.078.935.236 1.32.163.38.417.677.761.893.344.21.796.315 1.356.315.187 0 .35-.006.49-.018.146-.017.277-.037.394-.06.123-.024.236-.047.341-.07V14.55h-1.373v-.7Z",style:{fill:"#fff",fillOpacity:1}})]}),lO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M20.441 7.875c2.283 1.22 3.82 3.507 3.82 6.125s-1.537 4.904-3.82 6.125c3.12-.7 5.425-3.177 5.425-6.125s-2.305-5.425-5.425-6.125Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.7,d:"M3.264 10.954a2.187 2.187 0 0 1 2.095-2.817h11.582a5.862 5.862 0 0 1 0 11.726H7.564a2.188 2.188 0 0 1-2.095-1.56l-2.205-7.35Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M9.497 10.902c.519 0 .945.068 1.277.202.339.128.59.323.753.586.163.262.245.592.245.989 0 .332-.062.61-.184.83-.122.223-.28.4-.472.535-.187.128-.386.23-.595.306l1.714 2.8h-.918l-1.514-2.581H8.56v2.58h-.787v-6.247h1.724Zm-.044.683H8.56v2.319h.937c.338 0 .615-.044.831-.132a.956.956 0 0 0 .473-.402c.104-.175.157-.394.157-.656 0-.274-.055-.493-.166-.657a.905.905 0 0 0-.49-.358c-.222-.076-.505-.114-.849-.114Zm6.476 2.266h2.16v3.063c-.337.11-.679.192-1.023.245a7.837 7.837 0 0 1-1.172.078c-.648 0-1.193-.128-1.637-.385a2.568 2.568 0 0 1-1.015-1.11c-.227-.485-.34-1.057-.34-1.716 0-.653.127-1.219.384-1.697a2.699 2.699 0 0 1 1.103-1.112c.484-.268 1.067-.402 1.75-.402.35 0 .68.032.988.096.315.064.607.155.875.271l-.297.683a4.551 4.551 0 0 0-.753-.254 3.453 3.453 0 0 0-.857-.105c-.496 0-.922.102-1.278.306a2.004 2.004 0 0 0-.813.875c-.187.374-.28.82-.28 1.34 0 .495.078.935.236 1.32.163.38.417.677.761.893.344.21.796.315 1.356.315.187 0 .35-.006.49-.018a5.17 5.17 0 0 0 .394-.06c.123-.024.236-.047.341-.07V14.55H15.93v-.7Z",style:{fill:"#fff",fillOpacity:1}})]}),cO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:.7,d:"M14 20.212a7.612 7.612 0 1 0 0-15.224 7.612 7.612 0 0 0 0 15.224Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M10.209 15.662V9.415h.787v5.548h2.73v.7H10.21Zm6.395 0h-.787v-5.556h-1.952v-.691h4.682v.691h-1.943v5.556Z",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M21.235 17.5a8.31 8.31 0 0 1-7.205 4.165A8.31 8.31 0 0 1 6.825 17.5c.823 3.4 3.737 5.915 7.205 5.915 3.469 0 6.382-2.514 7.205-5.915Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),uO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:.7,d:"M14 20.212a7.612 7.612 0 1 0 0-15.224 7.612 7.612 0 0 0 0 15.224Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M11.42 9.415c.52 0 .945.067 1.277.201.339.129.59.324.753.587.163.262.245.592.245.988 0 .333-.061.61-.184.832-.122.221-.28.4-.472.533-.187.129-.385.23-.595.307l1.715 2.8h-.92l-1.513-2.582h-1.242v2.582h-.788V9.415h1.724Zm-.044.683h-.892v2.318h.936c.338 0 .615-.043.831-.131a.956.956 0 0 0 .473-.402c.105-.175.157-.394.157-.657 0-.274-.055-.493-.166-.656a.905.905 0 0 0-.49-.359c-.222-.075-.505-.114-.849-.114Zm5.74 5.564h-.787v-5.556h-1.951v-.691h4.681v.691h-1.942v5.556Z",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M21.235 17.5a8.31 8.31 0 0 1-7.205 4.165A8.31 8.31 0 0 1 6.825 17.5c.823 3.4 3.737 5.915 7.205 5.915 3.469 0 6.382-2.514 7.205-5.915Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),fO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",d:"m20.01 15.768-4.242 4.242a5.5 5.5 0 1 1-7.778-7.778l4.242-4.242a5.5 5.5 0 1 1 7.778 7.778Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M11.172 16.828a1 1 0 0 0 1.414 0L15.414 14l.707.707-2.828 2.828a2 2 0 1 1-2.829-2.828l.708.707a1 1 0 0 0 0 1.414ZM12.586 14l2.828-2.829a1 1 0 1 1 1.414 1.415l.708.707a2 2 0 0 0-2.829-2.829l-2.828 2.829.707.707Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M15.414 16.828 18.243 14a3 3 0 0 0-2.289-5.117l-.869-.869a4 4 0 0 1 3.864 6.693l-2.828 2.828-.707-.707Zm-.707 2.122a4 4 0 1 1-5.657-5.657l4.243-4.243.707.707L9.757 14A3 3 0 1 0 14 18.242l.707.708Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),dO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",d:"m15.768 7.99 4.242 4.242a5.5 5.5 0 1 1-7.778 7.778L7.99 15.768a5.5 5.5 0 1 1 7.778-7.778Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M16.828 16.828a1 1 0 0 0 0-1.414L14 12.586l.707-.707 2.828 2.828a2 2 0 1 1-2.828 2.828l.707-.707a1 1 0 0 0 1.414 0ZM14 15.414l-2.828-2.828a1 1 0 0 1 1.414-1.414l.707-.708a2 2 0 0 0-2.829 2.829l2.829 2.828.707-.707Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M16.828 12.586 14 9.757a3 3 0 0 0-5.117 2.289l-.869.869a4 4 0 0 1 6.693-3.864l2.828 2.828-.707.707Zm2.122.707a4 4 0 1 1-5.657 5.657L9.05 14.707 9.757 14 14 18.243A3 3 0 1 0 18.243 14l.707-.707Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),hO={"x-button-left":j7,"y-button-left":q7,"a-button-right":Y7,"b-button-right":K7,"thumbstick-left":Z7,"thumbstick-up-left":J7,"thumbstick-down-left":eO,"thumbstick-right-left":nO,"thumbstick-left-left":tO,"thumbstick-right":Q7,"thumbstick-up-right":iO,"thumbstick-down-right":rO,"thumbstick-right-right":oO,"thumbstick-left-right":sO,"trigger-left":cO,"trigger-right":uO,"squeeze-left":aO,"squeeze-right":lO,"thumbrest-left":fO,"thumbrest-right":dO},sd=({buttonName:n,handedness:e})=>{const t=`${n}-${e}`,i=hO[t];return i?Q.jsx(i,{}):Q.jsx("div",{style:{width:"28px",height:"28px"}})},pO=()=>Q.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M1 11.2A5.2 5.2 0 0 1 6.2 6h15.6a5.2 5.2 0 0 1 5.2 5.2v5.2a5.2 5.2 0 0 1-5.2 5.2h-3.109c-1.149 0-2.199-.65-2.713-1.677l-.199-.398a1.733 1.733 0 0 0-1.55-.958h-.458c-.656 0-1.257.37-1.55.958l-.2.398A3.033 3.033 0 0 1 9.31 21.6H6.2A5.2 5.2 0 0 1 1 16.4v-5.2Zm9.1 2.167a2.6 2.6 0 1 1-5.2 0 2.6 2.6 0 0 1 5.2 0Zm15.538-1.426a.498.498 0 0 0 .141-.542l.002-.002a5.456 5.456 0 0 0-.347-.755l-.104-.178a5.586 5.586 0 0 0-.486-.686.502.502 0 0 0-.54-.15l-1.225.39a4.234 4.234 0 0 0-.968-.56l-.275-1.256a.497.497 0 0 0-.4-.392 5.686 5.686 0 0 0-1.871.003.497.497 0 0 0-.4.391l-.276 1.257a4.234 4.234 0 0 0-.968.559l-1.226-.39a.498.498 0 0 0-.539.15 5.586 5.586 0 0 0-.486.686l-.104.179c-.134.242-.25.492-.347.754a.498.498 0 0 0 .14.542l.953.867a4.26 4.26 0 0 0 0 1.12l-.952.867a.498.498 0 0 0-.141.541c.097.262.213.513.347.755l.104.178c.145.242.308.471.486.687.13.156.346.211.54.15l1.223-.392c.295.226.62.416.968.559l.275 1.256c.044.2.198.359.4.392a5.686 5.686 0 0 0 1.871 0 .497.497 0 0 0 .4-.392l.276-1.256c.347-.143.673-.333.968-.56l1.225.39c.194.062.41.009.54-.15a5.59 5.59 0 0 0 .486-.686l.103-.178a5.45 5.45 0 0 0 .348-.755.498.498 0 0 0-.14-.541l-.954-.867a4.258 4.258 0 0 0 0-1.118l.953-.867ZM20.5 15.967a2.6 2.6 0 1 0 0-5.2 2.6 2.6 0 0 0 0 5.2Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})}),mO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:16,fill:"none",children:[Q.jsx("g",{clipPath:"url(#a)",children:Q.jsx("path",{stroke:"#fff",d:"M.5 6.5H6m-5.5 0V5C.5 2.237 2.237.5 5 .5h1m-5.5 6V11c0 2.762 1.737 4.5 4.5 4.5h2c2.762 0 4.5-1.738 4.5-4.5V6.5M6 6.5v-6m0 6h5.5M6 .5h1c2.762 0 4.5 1.737 4.5 4.5v1.5",style:{stroke:"#fff",strokeOpacity:1}})}),Q.jsx("path",{fill:"#fff",d:"M.5 6.5H6v-6H5C2.237.5.5 2.237.5 5v1.5Z",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("defs",{children:Q.jsx("clipPath",{id:"a",children:Q.jsx("path",{fill:"#fff",d:"M0 0h12v16H0z",style:{fill:"#fff",fillOpacity:1}})})})]}),gO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:16,fill:"none",children:[Q.jsx("g",{clipPath:"url(#a)",children:Q.jsx("path",{stroke:"#fff",d:"M.5 6.5H6m-5.5 0V5C.5 2.237 2.237.5 5 .5h1m-5.5 6V11c0 2.762 1.737 4.5 4.5 4.5h2c2.762 0 4.5-1.738 4.5-4.5V6.5M6 6.5v-6m0 6h5.5M6 .5h1c2.762 0 4.5 1.737 4.5 4.5v1.5",style:{stroke:"#fff",strokeOpacity:1}})}),Q.jsx("path",{fill:"#fff",d:"M11.5 6.5H6v-6h1c2.762 0 4.5 1.737 4.5 4.5v1.5Z",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("defs",{children:Q.jsx("clipPath",{id:"a",children:Q.jsx("path",{fill:"#fff",d:"M0 0h12v16H0z",style:{fill:"#fff",fillOpacity:1}})})})]}),_O={prefix:"fas",iconName:"right-from-bracket",icon:[512,512,["sign-out-alt"],"f2f5","M377.9 105.9L500.7 228.7c7.2 7.2 11.3 17.1 11.3 27.3s-4.1 20.1-11.3 27.3L377.9 406.1c-6.4 6.4-15 9.9-24 9.9c-18.7 0-33.9-15.2-33.9-33.9l0-62.1-128 0c-17.7 0-32-14.3-32-32l0-64c0-17.7 14.3-32 32-32l128 0 0-62.1c0-18.7 15.2-33.9 33.9-33.9c9 0 17.6 3.6 24 9.9zM160 96L96 96c-17.7 0-32 14.3-32 32l0 256c0 17.7 14.3 32 32 32l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-64 0c-53 0-96-43-96-96L0 128C0 75 43 32 96 32l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32z"]},wy={prefix:"fas",iconName:"fingerprint",icon:[512,512,[],"f577","M48 256C48 141.1 141.1 48 256 48c63.1 0 119.6 28.1 157.8 72.5c8.6 10.1 23.8 11.2 33.8 2.6s11.2-23.8 2.6-33.8C403.3 34.6 333.7 0 256 0C114.6 0 0 114.6 0 256l0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40zm458.5-52.9c-2.7-13-15.5-21.3-28.4-18.5s-21.3 15.5-18.5 28.4c2.9 13.9 4.5 28.3 4.5 43.1l0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40c0-18.1-1.9-35.8-5.5-52.9zM256 80c-19 0-37.4 3-54.5 8.6c-15.2 5-18.7 23.7-8.3 35.9c7.1 8.3 18.8 10.8 29.4 7.9c10.6-2.9 21.8-4.4 33.4-4.4c70.7 0 128 57.3 128 128l0 24.9c0 25.2-1.5 50.3-4.4 75.3c-1.7 14.6 9.4 27.8 24.2 27.8c11.8 0 21.9-8.6 23.3-20.3c3.3-27.4 5-55 5-82.7l0-24.9c0-97.2-78.8-176-176-176zM150.7 148.7c-9.1-10.6-25.3-11.4-33.9-.4C93.7 178 80 215.4 80 256l0 24.9c0 24.2-2.6 48.4-7.8 71.9C68.8 368.4 80.1 384 96.1 384c10.5 0 19.9-7 22.2-17.3c6.4-28.1 9.7-56.8 9.7-85.8l0-24.9c0-27.2 8.5-52.4 22.9-73.1c7.2-10.4 8-24.6-.2-34.2zM256 160c-53 0-96 43-96 96l0 24.9c0 35.9-4.6 71.5-13.8 106.1c-3.8 14.3 6.7 29 21.5 29c9.5 0 17.9-6.2 20.4-15.4c10.5-39 15.9-79.2 15.9-119.7l0-24.9c0-28.7 23.3-52 52-52s52 23.3 52 52l0 24.9c0 36.3-3.5 72.4-10.4 107.9c-2.7 13.9 7.7 27.2 21.8 27.2c10.2 0 19-7 21-17c7.7-38.8 11.6-78.3 11.6-118.1l0-24.9c0-53-43-96-96-96zm24 96c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 24.9c0 59.9-11 119.3-32.5 175.2l-5.9 15.3c-4.8 12.4 1.4 26.3 13.8 31s26.3-1.4 31-13.8l5.9-15.3C267.9 411.9 280 346.7 280 280.9l0-24.9z"]},vO={prefix:"fas",iconName:"caret-right",icon:[256,512,[],"f0da","M246.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-9.2-9.2-22.9-11.9-34.9-6.9s-19.8 16.6-19.8 29.6l0 256c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l128-128z"]},xO={prefix:"fas",iconName:"caret-left",icon:[256,512,[],"f0d9","M9.4 278.6c-12.5-12.5-12.5-32.8 0-45.3l128-128c9.2-9.2 22.9-11.9 34.9-6.9s19.8 16.6 19.8 29.6l0 256c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-128-128z"]},SE={prefix:"fas",iconName:"ban",icon:[512,512,[128683,"cancel"],"f05e","M367.2 412.5L99.5 144.8C77.1 176.1 64 214.5 64 256c0 106 86 192 192 192c41.5 0 79.9-13.1 111.2-35.5zm45.3-45.3C434.9 335.9 448 297.5 448 256c0-106-86-192-192-192c-41.5 0-79.9 13.1-111.2 35.5L412.5 367.2zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256z"]},yO={prefix:"fas",iconName:"arrow-right-to-bracket",icon:[512,512,["sign-in"],"f090","M352 96l64 0c17.7 0 32 14.3 32 32l0 256c0 17.7-14.3 32-32 32l-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0c53 0 96-43 96-96l0-256c0-53-43-96-96-96l-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32zm-9.4 182.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L242.7 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l210.7 0-73.4 73.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l128-128z"]},Fb={prefix:"fas",iconName:"caret-up",icon:[320,512,[],"f0d8","M182.6 137.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8l256 0c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-128-128z"]},SO={prefix:"fas",iconName:"rotate-left",icon:[512,512,["rotate-back","rotate-backward","undo-alt"],"f2ea","M48.5 224L40 224c-13.3 0-24-10.7-24-24L16 72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2L98.6 96.6c87.6-86.5 228.7-86.2 315.8 1c87.5 87.5 87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3c-62.2-62.2-162.7-62.5-225.3-1L185 183c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8L48.5 224z"]},MO={prefix:"fas",iconName:"circle-play",icon:[512,512,[61469,"play-circle"],"f144","M0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM188.3 147.1c-7.6 4.2-12.3 12.3-12.3 20.9l0 176c0 8.7 4.7 16.7 12.3 20.9s16.8 4.1 24.3-.5l144-88c7.1-4.4 11.5-12.1 11.5-20.5s-4.4-16.1-11.5-20.5l-144-88c-7.4-4.5-16.7-4.7-24.3-.5z"]},EO={prefix:"fas",iconName:"square-arrow-up-right",icon:[448,512,["external-link-square"],"f14c","M384 32c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96C0 60.7 28.7 32 64 32l320 0zM160 144c-13.3 0-24 10.7-24 24s10.7 24 24 24l94.1 0L119 327c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l135-135L288 328c0 13.3 10.7 24 24 24s24-10.7 24-24l0-160c0-13.3-10.7-24-24-24l-152 0z"]},wO={prefix:"fas",iconName:"keyboard",icon:[576,512,[9e3],"f11c","M64 64C28.7 64 0 92.7 0 128L0 384c0 35.3 28.7 64 64 64l448 0c35.3 0 64-28.7 64-64l0-256c0-35.3-28.7-64-64-64L64 64zm16 64l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16zM64 240c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zm16 80l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16zm80-176c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zm16 80l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16zM160 336c0-8.8 7.2-16 16-16l224 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-224 0c-8.8 0-16-7.2-16-16l0-32zM272 128l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16zM256 240c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zM368 128l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16zM352 240c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zM464 128l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16zM448 240c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zm16 80l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16z"]},kb={prefix:"fas",iconName:"caret-down",icon:[320,512,[],"f0d7","M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z"]},TO={prefix:"fas",iconName:"delete-left",icon:[576,512,[9003,"backspace"],"f55a","M576 128c0-35.3-28.7-64-64-64L205.3 64c-17 0-33.3 6.7-45.3 18.7L9.4 233.4c-6 6-9.4 14.1-9.4 22.6s3.4 16.6 9.4 22.6L160 429.3c12 12 28.3 18.7 45.3 18.7L512 448c35.3 0 64-28.7 64-64l0-256zM271 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"]},ME={prefix:"fas",iconName:"angle-up",icon:[448,512,[8963],"f106","M201.4 137.4c12.5-12.5 32.8-12.5 45.3 0l160 160c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L224 205.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l160-160z"]},AO={prefix:"fas",iconName:"arrow-turn-down",icon:[384,512,["level-down"],"f149","M32 64C14.3 64 0 49.7 0 32S14.3 0 32 0l96 0c53 0 96 43 96 96l0 306.7 73.4-73.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3l-128 128c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 402.7 160 96c0-17.7-14.3-32-32-32L32 64z"]},bO={prefix:"fas",iconName:"arrows-up-down",icon:[320,512,["arrows-v"],"f07d","M182.6 9.4c-12.5-12.5-32.8-12.5-45.3 0l-96 96c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L128 109.3l0 293.5L86.6 361.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l96 96c12.5 12.5 32.8 12.5 45.3 0l96-96c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 402.7l0-293.5 41.4 41.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-96-96z"]},RO={prefix:"fas",iconName:"video",icon:[576,512,["video-camera"],"f03d","M0 128C0 92.7 28.7 64 64 64l256 0c35.3 0 64 28.7 64 64l0 256c0 35.3-28.7 64-64 64L64 448c-35.3 0-64-28.7-64-64L0 128zM559.1 99.8c10.4 5.6 16.9 16.4 16.9 28.2l0 256c0 11.8-6.5 22.6-16.9 28.2s-23 5-32.9-1.6l-96-64L416 337.1l0-17.1 0-128 0-17.1 14.2-9.5 96-64c9.8-6.5 22.4-7.2 32.9-1.6z"]},Hs={KeyA:"A",KeyB:"B",KeyC:"C",KeyD:"D",KeyE:"E",KeyF:"F",KeyG:"G",KeyH:"H",KeyI:"I",KeyJ:"J",KeyK:"K",KeyL:"L",KeyM:"M",KeyN:"N",KeyO:"O",KeyP:"P",KeyQ:"Q",KeyR:"R",KeyS:"S",KeyT:"T",KeyU:"U",KeyV:"V",KeyW:"W",KeyX:"X",KeyY:"Y",KeyZ:"Z",Digit0:"0",Digit1:"1",Digit2:"2",Digit3:"3",Digit4:"4",Digit5:"5",Digit6:"6",Digit7:"7",Digit8:"8",Digit9:"9",Tab:Q.jsx(pn,{icon:yO}),Backspace:Q.jsx(pn,{icon:TO}),Enter:Q.jsx(pn,{style:{transform:"rotate(90deg)"},icon:AO}),ShiftLeft:Q.jsx(pn,{icon:ME}),ShiftRight:Q.jsx(pn,{icon:ME}),Space:" ",ArrowUp:Q.jsx(pn,{icon:Fb}),ArrowDown:Q.jsx(pn,{icon:kb}),ArrowLeft:Q.jsx(pn,{icon:xO}),ArrowRight:Q.jsx(pn,{icon:vO}),Semicolon:";",Equal:"=",Comma:",",Minus:"-",Period:".",Slash:"/",Backquote:"`",BracketLeft:"[",Backslash:"\\",BracketRight:"]",Quote:"'",MouseLeft:Q.jsx(mO,{}),MouseRight:Q.jsx(gO,{})},CO={left:{"thumbstick-up":"KeyW","thumbstick-down":"KeyS","thumbstick-left":"KeyA","thumbstick-right":"KeyD",thumbstick:"KeyR","x-button":"KeyX","y-button":"KeyZ",trigger:"KeyQ",squeeze:"KeyE"},right:{"thumbstick-up":"ArrowUp","thumbstick-down":"ArrowDown","thumbstick-left":"ArrowLeft","thumbstick-right":"ArrowRight",thumbstick:"Slash","a-button":"Enter","b-button":"ShiftRight",trigger:"MouseLeft",squeeze:"MouseRight"}},PO=ln.div` + display: flex; + justify-content: space-between; + pointer-events: all; + position: fixed; + display: flex; + top: 40px; + left: calc(50vw - 156px); + width: 312px; +`,EE=ln.div` + display: flex; + flex-direction: column; + width: 50%; +`,wE=ln.div` + display: flex; + height: 24px; + align-items: center; + margin-bottom: 2px; +`,LO=({keyMap:n,setKeyMap:e})=>{const[t,i]=Tt.useState(null),r=(o,a)=>{i({controller:o,action:a})},s=(o,a)=>{e(l=>({...l,[o]:{...l[o],[a]:"Unmapped"}}))};return Tt.useEffect(()=>{const o=c=>{t&&Hs[c.code]&&(e(u=>({...u,[t.controller]:{...u[t.controller],[t.action]:c.code}})),i(null))},a=c=>{if(t){const u=c.button===0?"MouseLeft":c.button===2?"MouseRight":null;u&&Hs[u]&&(e(f=>({...f,[t.controller]:{...f[t.controller],[t.action]:u}})),i(null))}},l=c=>{c.preventDefault()};return window.addEventListener("keydown",o),window.addEventListener("mousedown",a),window.addEventListener("contextmenu",l),()=>{window.removeEventListener("keydown",o),window.removeEventListener("mousedown",a),window.removeEventListener("contextmenu",l)}},[t,e]),Q.jsxs(PO,{children:[Q.jsx(EE,{children:Object.keys(n.left).map(o=>Q.jsxs(wE,{children:[Q.jsx(sd,{buttonName:o==="up"?"thumbstick":o,handedness:"left"}),Q.jsxs(hu,{$reverse:!1,children:[Q.jsx(Un,{$reverse:!1,style:{width:"100px",backgroundColor:t&&t.controller==="left"&&t.action===o?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)"},onClick:()=>r("left",o),onContextMenu:a=>a.preventDefault(),children:n.left[o]}),Q.jsx(Un,{style:{width:"24px"},$reverse:!1,onClick:()=>s("left",o),onContextMenu:a=>a.preventDefault(),children:Q.jsx(id,{icon:SE})})]})]},o))}),Q.jsx(EE,{children:Object.keys(n.right).map(o=>Q.jsxs(wE,{children:[Q.jsx(sd,{buttonName:o==="up"?"thumbstick":o,handedness:"right"}),Q.jsxs(hu,{$reverse:!1,children:[Q.jsx(Un,{$reverse:!1,style:{width:"100px",backgroundColor:t&&t.controller==="right"&&t.action===o?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)"},onClick:()=>r("right",o),onContextMenu:a=>a.preventDefault(),children:n.right[o]}),Q.jsx(Un,{$reverse:!1,style:{width:"24px"},onClick:()=>s("right",o),onContextMenu:a=>a.preventDefault(),children:Q.jsx(id,{icon:SE})})]})]},o))})]})},IO=({xrController:n,buttonId:e,pointerLocked:t,mappedKey:i})=>{const r=CS(),[s,o]=Tt.useState(!1),[a,l]=Tt.useState(!1),[c,u]=Tt.useState(!1),[f,h]=Tt.useState(0),p=n.inputSource.handedness;return Tt.useEffect(()=>{const g=x=>{x.code===i&&(n.updateButtonValue(e,1),u(!0))},_=x=>{x.code===i&&(n.updateButtonValue(e,0),u(!1))},m=x=>{(i==="MouseLeft"&&x.button===0||i==="MouseRight"&&x.button===2)&&(n.updateButtonValue(e,1),u(!0))},d=x=>{(i==="MouseLeft"&&x.button===0||i==="MouseRight"&&x.button===2)&&(n.updateButtonValue(e,0),u(!1))};return t?i==="MouseLeft"||i==="MouseRight"?(window.addEventListener("mousedown",m),window.addEventListener("mouseup",d)):(window.addEventListener("keydown",g),window.addEventListener("keyup",_)):i==="MouseLeft"||i==="MouseRight"?(window.removeEventListener("mousedown",m),window.removeEventListener("mouseup",d)):(window.removeEventListener("keydown",g),window.removeEventListener("keyup",_)),()=>{i==="MouseLeft"||i==="MouseRight"?(window.removeEventListener("mousedown",m),window.removeEventListener("mouseup",d)):(window.removeEventListener("keydown",g),window.removeEventListener("keyup",_))}},[i,t,e,n]),Q.jsxs(Ub,{$reverse:p==="right",children:[Q.jsx(sd,{buttonName:e,handedness:p}),Q.jsx(hu,{$reverse:p==="right",children:t?Q.jsx(ci,{$pressed:c,children:Hs[i]}):Q.jsxs(Q.Fragment,{children:[Q.jsx(Un,{$reverse:p==="right",style:{backgroundColor:a?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"50px"},onClick:()=>{l(!0),n.updateButtonValue(e,1),setTimeout(()=>{l(!1),n.updateButtonValue(e,0)},r.buttonPressDuration)},children:"Press"}),Q.jsx(Un,{$reverse:p==="right",style:{backgroundColor:s?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"29px"},onClick:()=>{o(!s),n.updateButtonTouch(e,!s)},children:Q.jsx(pn,{icon:wy})}),Q.jsx(Ob,{$reverse:p==="right",value:f,onChange:g=>{const _=Number(g.target.value);h(_),n.updateButtonValue(e,_/100)},min:"0",max:"100"})]})})]})},DO=({xrController:n,buttonId:e,pointerLocked:t,mappedKey:i})=>{const r=CS(),[s,o]=Tt.useState(!1),[a,l]=Tt.useState(!1),[c,u]=Tt.useState(!1),[f,h]=Tt.useState(!1),p=n.inputSource.handedness;return Tt.useEffect(()=>{const g=m=>{m.code===i&&(n.updateButtonValue(e,1),h(!0))},_=m=>{m.code===i&&(n.updateButtonValue(e,0),h(!1))};return t?(window.addEventListener("keydown",g),window.addEventListener("keyup",_)):(window.removeEventListener("keydown",g),window.removeEventListener("keyup",_)),()=>{window.removeEventListener("keydown",g),window.removeEventListener("keyup",_)}},[i,t,e,n]),Q.jsxs(Ub,{$reverse:p==="right",children:[Q.jsx(sd,{buttonName:e,handedness:p}),Q.jsx(hu,{$reverse:p==="right",children:t?Q.jsx(ci,{$pressed:f,children:Hs[i]}):Q.jsxs(Q.Fragment,{children:[Q.jsx(Un,{$reverse:p==="right",style:{backgroundColor:c?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"50px"},onClick:()=>{u(!0),n.updateButtonValue(e,1),setTimeout(()=>{u(!1),n.updateButtonValue(e,0)},r.buttonPressDuration)},children:"Press"}),Q.jsx(Un,{$reverse:p==="right",style:{backgroundColor:s?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"29px"},onClick:()=>{o(!s),n.updateButtonTouch(e,!s)},children:Q.jsx(pn,{icon:wy})}),Q.jsx(Un,{$reverse:p==="right",style:{backgroundColor:a?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"49px"},onClick:()=>{l(!a),n.updateButtonValue(e,a?0:1)},children:"Hold"})]})})]})},NO=ln.div` + display: flex; + align-items: center; + margin-bottom: 2px; +`,UO=ln.button` + background-color: rgba(255, 255, 255, 0.3); + border: none; + display: flex; + justify-content: center; + align-items: center; + padding: 0; + pointer-events: none; + width: 50px; + height: 50px; + border-radius: 50%; + position: relative; + margin: 0 5px; + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); +`,OO=ln.div` + position: absolute; + background-color: white; + border-radius: 50%; + width: 36px; + height: 36px; + cursor: pointer; + pointer-events: auto; +`,TE=ln(Un)` + width: 49px; + font-size: 14px; + + ${({$reverse:n})=>n?` + &:first-child { + margin-left: 1px; + border-radius: 2px 8px 8px 2px; + } + + &:last-child { + margin-right: 1px; + border-radius: 8px 2px 2px 8px; + } + `:` + &:first-child { + margin-right: 1px; + border-radius: 8px 2px 2px 8px; + } + + &:last-child { + margin-left: 1px; + border-radius: 2px 8px 8px 2px; + } + `} +`,FO=({xrController:n,pointerLocked:e,buttonId:t,mappedKeyUp:i,mappedKeyDown:r,mappedKeyLeft:s,mappedKeyRight:o,mappedKeyPressed:a})=>{const l=CS(),c=Tt.useRef(null),[u,f]=Tt.useState(!1),[h,p]=Tt.useState(!1),[g,_]=Tt.useState(!1),[m,d]=Tt.useState(!1),[x,v]=Tt.useState({x:0,y:0}),[y,b]=Tt.useState({up:!1,down:!1,left:!1,right:!1,pressed:!1}),w=n.inputSource.handedness,T=()=>{if(c.current){const S=c.current.getBoundingClientRect();v({x:S.left+S.width/2,y:S.top+S.height/2}),f(!0)}},C=S=>{if(u&&c.current){const P=S.clientX-x.x,k=S.clientY-x.y,U=Math.sqrt(P*P+k*k),N=12;let X,z;if(U{f(!1),c.current&&(c.current.style.transform="translate(0, 0)",n.updateAxes(t,0,0))};return Tt.useEffect(()=>{const S=U=>{const N={...y};U.code===i&&(N.up=!0),U.code===r&&(N.down=!0),U.code===s&&(N.left=!0),U.code===o&&(N.right=!0),U.code===a&&(N.pressed=!0,n.updateButtonValue(t,1)),b(N),k(N)},P=U=>{const N={...y};U.code===i&&(N.up=!1),U.code===r&&(N.down=!1),U.code===s&&(N.left=!1),U.code===o&&(N.right=!1),U.code===a&&(N.pressed=!1,n.updateButtonValue(t,0)),b(N),k(N)},k=U=>{const N=(U.right?1:0)-(U.left?1:0),X=(U.down?1:0)-(U.up?1:0),z=Math.sqrt(N*N+X*X);if(z===0){n.updateAxes(t,0,0);return}const te=N/z,L=X/z;n.updateAxes(t,te,L)};return e?(window.addEventListener("keydown",S),window.addEventListener("keyup",P)):(window.removeEventListener("keydown",S),window.removeEventListener("keyup",P)),()=>{window.removeEventListener("keydown",S),window.removeEventListener("keyup",P)}},[i,r,s,o,e,y]),Tt.useEffect(()=>(document.addEventListener("mousemove",C),document.addEventListener("mouseup",M),()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",M)}),[u,x]),Q.jsxs(NO,{style:{flexDirection:n.inputSource.handedness==="left"?"row":"row-reverse",alignItems:"flex-start"},children:[Q.jsx(sd,{buttonName:"thumbstick",handedness:n.inputSource.handedness}),e?Q.jsxs(X7,{$reverse:w==="right",children:[Q.jsxs(yE,{$reverse:w==="right",children:[Q.jsx(ci,{$pressed:y.up,style:{margin:"2px"},children:Hs[i]}),Q.jsx(ci,{$pressed:y.pressed,style:{margin:"2px"},children:Hs[a]})]}),Q.jsxs(yE,{$reverse:!1,children:[Q.jsx(ci,{$pressed:y.left,style:{margin:"2px"},children:Hs[s]}),Q.jsx(ci,{$pressed:y.down,style:{margin:"2px"},children:Hs[r]}),Q.jsx(ci,{$pressed:y.right,style:{margin:"2px"},children:Hs[o]})]})]}):Q.jsxs(Q.Fragment,{children:[Q.jsx(UO,{style:{margin:n.inputSource.handedness==="left"?"0 5px 0 -3px":"0 -3px 0 5px"},children:Q.jsx(OO,{ref:c,onMouseDown:T})}),Q.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[Q.jsx(Un,{$reverse:w==="right",style:{backgroundColor:m?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"80px",marginBottom:"2px",borderRadius:"8px"},onClick:()=>{d(!0),n.updateButtonValue(t,1),setTimeout(()=>{d(!1),n.updateButtonValue(t,0)},l.buttonPressDuration)},children:"Press"}),Q.jsxs(hu,{$reverse:w==="right",children:[Q.jsx(TE,{$reverse:n.inputSource.handedness!=="left",style:{backgroundColor:h?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"29px"},onClick:()=>{p(!h),n.updateButtonTouch(t,!h)},children:Q.jsx(pn,{icon:wy})}),Q.jsx(TE,{$reverse:n.inputSource.handedness!=="left",style:{backgroundColor:g?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"49px"},onClick:()=>{_(!g),n.updateButtonValue(t,g?0:1)},children:"Hold"})]})]})]})]})},kO=ln.div` + padding: ${({$reverse:n})=>n?"6px 2px 3px 5px":"6px 5px 3px 2px"}; + pointer-events: all; + background-color: rgba(43, 43, 43, 0.5); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + border-radius: ${({$reverse:n})=>n?"12px 0 0 0":"0 12px 0 0"}; +`;function BO(n){const e=new Set;for(const i of n.axes)i&&i.id&&e.add(i.id);const t=n.buttons.filter(i=>i!==null).map(i=>({id:i.id,type:i.type,hasAxes:e.has(i.id)}));return t.sort((i,r)=>i.hasAxes&&!r.hasAxes?-1:!i.hasAxes&&r.hasAxes?1:0),t}const zO=({xrDevice:n,keyMap:e,pointerLocked:t})=>Q.jsx("div",{style:{display:"flex",justifyContent:"space-between",flexDirection:"row"},children:Object.entries(n.controllers).map(([i,r])=>Q.jsx(kO,{$reverse:i!=="left",children:BO(r.gamepadConfig).map(s=>{const o=e[i];return s.hasAxes?Q.jsx(FO,{xrController:r,pointerLocked:t,buttonId:s.id,mappedKeyUp:e[i][`${s.id}-up`],mappedKeyDown:o[`${s.id}-down`],mappedKeyLeft:o[`${s.id}-left`],mappedKeyRight:o[`${s.id}-right`],mappedKeyPressed:o[s.id]},s.id):s.type==="analog"?Q.jsx(IO,{xrController:r,buttonId:s.id,mappedKey:o[s.id],pointerLocked:t},s.id):Q.jsx(DO,{xrController:r,buttonId:s.id,mappedKey:o[s.id],pointerLocked:t},s.id)})},i))}),HO=ln.div` + display: flex; + justify-content: center; + pointer-events: all; + position: fixed; + display: flex; + top: 40px; + left: calc(50vw - 156px); + width: 312px; +`,VO=({xrDevice:n,inputLayer:e})=>{const[t,i]=Tt.useState(n.fovy);return Q.jsx(HO,{children:Q.jsxs(hu,{$reverse:!1,children:[Q.jsx(Un,{$reverse:!1,disabled:!0,children:"FOV-Y"}),Q.jsx(Ob,{$reverse:!1,value:t,style:{width:"100px",borderRadius:"2px"},onChange:r=>{const s=Number(r.target.value);i(s),n.fovy=s,e.syncFovy(),e.renderScene()},min:Math.PI/6,max:Math.PI/1.5,step:Math.PI/48}),Q.jsxs(Un,{$reverse:!1,disabled:!0,children:[(t/Math.PI*180).toFixed(2),"°"]})]})})},GO=ln.div` + padding: 6px 5px; + display: flex; + background-color: rgba(43, 43, 43, 0.5); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + justify-content: center; + pointer-events: all; + border-radius: 0 0 12px 12px; + align-items: center; + height: 24px; +`,AE=ln.div` + background-color: rgba(43, 43, 43, 0.5); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + border: none; + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: center; + cursor: pointer; + color: white; + white-space: nowrap; + font-size: 14px; + text-transform: none; + box-shadow: none; + font-family: Arial, sans-serif; + border-radius: ${({$reverse:n})=>n?"0 0 0 12px":"0 0 12px 0"}; + padding: 5px; + + > div { + display: flex; + flex-direction: row; + align-items: center; + gap: 2px; + margin: 2px; + } +`,WO=({xrDevice:n,inputLayer:e,keyMapOpen:t,setKeyMapOpen:i,fovSettingOpen:r,setFovSettingOpen:s})=>Q.jsxs("div",{style:{display:"flex",justifyContent:"center"},children:[Q.jsxs(GO,{children:[Q.jsx(pO,{}),Q.jsxs("div",{style:{display:"flex",flexDirection:"row",marginLeft:"4px"},children:[Q.jsx(Un,{$reverse:!1,onClick:()=>{e.resetDeviceTransforms()},children:Q.jsx(pn,{icon:SO})}),Q.jsx(Un,{$reverse:!1,onClick:()=>{e.lockPointer(),i(!1),s(!1)},children:Q.jsx(pn,{icon:MO})}),Q.jsx(Un,{$reverse:!1,onClick:()=>{i(!t),s(!1)},children:Q.jsx(pn,{icon:wO})}),Q.jsx(Un,{$reverse:!1,onClick:()=>{s(!r),i(!1)},children:Q.jsx(pn,{icon:RO})}),Q.jsx(Un,{$reverse:!1,onClick:()=>{const o=n.activeSession;o==null||o.end()},children:Q.jsx(pn,{icon:_O})})]})]}),Q.jsxs(AE,{$reverse:!1,style:{position:"fixed",left:"0",top:"0"},children:[Q.jsxs("div",{children:[Q.jsx(pn,{icon:EO,style:{marginRight:"4px"}})," ","Roomscale Movement"]}),Q.jsxs("div",{children:[Q.jsx(ci,{$pressed:!1,style:{width:"50px"},children:"L Shift"}),Q.jsx("span",{style:{margin:"0 4px"},children:"+"}),Q.jsx(ci,{$pressed:!1,children:"W"}),Q.jsx(ci,{$pressed:!1,children:"A"}),Q.jsx(ci,{$pressed:!1,children:"S"}),Q.jsx(ci,{$pressed:!1,children:"D"})]})]}),Q.jsxs(AE,{$reverse:!0,style:{position:"fixed",right:"0",top:"0"},children:[Q.jsxs("div",{children:[Q.jsx(pn,{icon:bO,style:{marginRight:"4px"}})," Camera Height"]}),Q.jsxs("div",{children:[Q.jsx(ci,{$pressed:!1,style:{width:"50px"},children:"L Shift"}),Q.jsx("span",{style:{margin:"0 4px"},children:"+"}),Q.jsx(ci,{$pressed:!1,children:Q.jsx(pn,{icon:Fb})}),Q.jsx(ci,{$pressed:!1,children:Q.jsx(pn,{icon:kb})})]})]})]});/** + * @license + * Copyright 2010-2024 Three.js Authors + * SPDX-License-Identifier: MIT + */const Ty="168",$O=0,bE=1,XO=2,Bb=1,jO=2,Us=3,eo=0,Pi=1,is=2,Zo=0,Bc=1,RE=2,CE=3,PE=4,qO=5,Za=100,YO=101,KO=102,ZO=103,QO=104,JO=200,eF=201,tF=202,nF=203,Kv=204,Zv=205,iF=206,rF=207,sF=208,oF=209,aF=210,lF=211,cF=212,uF=213,fF=214,dF=0,hF=1,pF=2,hm=3,mF=4,gF=5,_F=6,vF=7,zb=0,xF=1,yF=2,Qo=0,SF=1,MF=2,EF=3,wF=4,TF=5,AF=6,bF=7,Hb=300,pu=301,mu=302,Qv=303,Jv=304,h0=306,e1=1e3,tl=1001,t1=1002,dr=1003,RF=1004,Eh=1005,Nr=1006,Ag=1007,nl=1008,to=1009,Vb=1010,Gb=1011,od=1012,Ay=1013,xl=1014,$s=1015,Dd=1016,by=1017,Ry=1018,gu=1020,Wb=35902,$b=1021,Xb=1022,kr=1023,jb=1024,qb=1025,zc=1026,_u=1027,Yb=1028,Cy=1029,Kb=1030,Py=1031,Ly=1033,Dp=33776,Np=33777,Up=33778,Op=33779,n1=35840,i1=35841,r1=35842,s1=35843,o1=36196,a1=37492,l1=37496,c1=37808,u1=37809,f1=37810,d1=37811,h1=37812,p1=37813,m1=37814,g1=37815,_1=37816,v1=37817,x1=37818,y1=37819,S1=37820,M1=37821,Fp=36492,E1=36494,w1=36495,Zb=36283,T1=36284,A1=36285,b1=36286,CF=3200,PF=3201,LF=0,IF=1,zo="",Jr="srgb",ga="srgb-linear",Iy="display-p3",p0="display-p3-linear",pm="linear",$t="srgb",mm="rec709",gm="p3",jl=7680,LE=519,DF=512,NF=513,UF=514,Qb=515,OF=516,FF=517,kF=518,BF=519,IE=35044,DE="300 es",Xs=2e3,_m=2001;class Iu{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){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s>8&255]+jn[n>>16&255]+jn[n>>24&255]+"-"+jn[e&255]+jn[e>>8&255]+"-"+jn[e>>16&15|64]+jn[e>>24&255]+"-"+jn[t&63|128]+jn[t>>8&255]+"-"+jn[t>>16&255]+jn[t>>24&255]+jn[i&255]+jn[i>>8&255]+jn[i>>16&255]+jn[i>>24&255]).toLowerCase()}function wi(n,e,t){return Math.max(e,Math.min(t,n))}function zF(n,e){return(n%e+e)%e}function Rg(n,e,t){return(1-t)*n+t*e}function Yu(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 Si(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 At{constructor(e=0,t=0){At.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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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(wi(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,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class _t{constructor(e,t,i,r,s,o,a,l,c){_t.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=o,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,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],f=i[7],h=i[2],p=i[5],g=i[8],_=r[0],m=r[3],d=r[6],x=r[1],v=r[4],y=r[7],b=r[2],w=r[5],T=r[8];return s[0]=o*_+a*x+l*b,s[3]=o*m+a*v+l*w,s[6]=o*d+a*y+l*T,s[1]=c*_+u*x+f*b,s[4]=c*m+u*v+f*w,s[7]=c*d+u*y+f*T,s[2]=h*_+p*x+g*b,s[5]=h*m+p*v+g*w,s[8]=h*d+p*y+g*T,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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*s*u+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,h=a*l-u*s,p=c*s-o*l,g=t*f+i*h+r*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=f*_,e[1]=(r*c-u*i)*_,e[2]=(a*i-r*o)*_,e[3]=h*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-a*t)*_,e[6]=p*_,e[7]=(i*l-c*t)*_,e[8]=(o*t-i*s)*_,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,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Cg.makeScale(e,t)),this}rotate(e){return this.premultiply(Cg.makeRotation(-e)),this}translate(e,t){return this.premultiply(Cg.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 Cg=new _t;function Jb(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function vm(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function HF(){const n=vm("canvas");return n.style.display="block",n}const NE={};function Ff(n){n in NE||(NE[n]=!0,console.warn(n))}function VF(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 UE=new _t().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),OE=new _t().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ku={[ga]:{transfer:pm,primaries:mm,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n,fromReference:n=>n},[Jr]:{transfer:$t,primaries:mm,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[p0]:{transfer:pm,primaries:gm,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.applyMatrix3(OE),fromReference:n=>n.applyMatrix3(UE)},[Iy]:{transfer:$t,primaries:gm,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.convertSRGBToLinear().applyMatrix3(OE),fromReference:n=>n.applyMatrix3(UE).convertLinearToSRGB()}},GF=new Set([ga,p0]),Lt={enabled:!0,_workingColorSpace:ga,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!GF.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=Ku[e].toReference,r=Ku[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Ku[n].primaries},getTransfer:function(n){return n===zo?pm:Ku[n].transfer},getLuminanceCoefficients:function(n,e=this._workingColorSpace){return n.fromArray(Ku[e].luminanceCoefficients)}};function Hc(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Pg(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let ql;class WF{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ql===void 0&&(ql=vm("canvas")),ql.width=e.width,ql.height=e.height;const i=ql.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=ql}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=vm("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 o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Hb)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case e1:e.x=e.x-Math.floor(e.x);break;case tl:e.x=e.x<0?0:1;break;case t1: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 e1:e.y=e.y-Math.floor(e.y);break;case tl:e.y=e.y<0?0:1;break;case t1: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++}}Li.DEFAULT_IMAGE=null;Li.DEFAULT_MAPPING=Hb;Li.DEFAULT_ANISOTROPY=1;class On{constructor(e=0,t=0,i=0,r=1){On.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,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,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],f=l[8],h=l[1],p=l[5],g=l[9],_=l[2],m=l[6],d=l[10];if(Math.abs(u-h)<.01&&Math.abs(f-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+p+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const v=(c+1)/2,y=(p+1)/2,b=(d+1)/2,w=(u+h)/4,T=(f+_)/4,C=(g+m)/4;return v>y&&v>b?v<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(v),r=w/i,s=T/i):y>b?y<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(y),i=w/r,s=C/r):b<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(b),i=T/s,r=C/s),this.set(i,r,s,t),this}let x=Math.sqrt((m-g)*(m-g)+(f-_)*(f-_)+(h-u)*(h-u));return Math.abs(x)<.001&&(x=1),this.x=(m-g)/x,this.y=(f-_)/x,this.z=(h-u)/x,this.w=Math.acos((c+p+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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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 jF extends Iu{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new On(0,0,e,t),this.scissorTest=!1,this.viewport=new On(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Nr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new Li(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a=0?1:-1,v=1-d*d;if(v>Number.EPSILON){const b=Math.sqrt(v),w=Math.atan2(b,d*x);m=Math.sin(m*w)/b,a=Math.sin(a*w)/b}const y=a*x;if(l=l*m+h*y,c=c*m+p*y,u=u*m+g*y,f=f*m+_*y,m===1-a){const b=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=b,c*=b,u*=b,f*=b}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],f=s[o],h=s[o+1],p=s[o+2],g=s[o+3];return e[t]=a*g+u*f+l*p-c*h,e[t+1]=l*g+u*h+c*f-a*p,e[t+2]=c*g+u*p+a*h-l*f,e[t+3]=u*g-a*f-l*h-c*p,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,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),f=a(s/2),h=l(i/2),p=l(r/2),g=l(s/2);switch(o){case"XYZ":this._x=h*u*f+c*p*g,this._y=c*p*f-h*u*g,this._z=c*u*g+h*p*f,this._w=c*u*f-h*p*g;break;case"YXZ":this._x=h*u*f+c*p*g,this._y=c*p*f-h*u*g,this._z=c*u*g-h*p*f,this._w=c*u*f+h*p*g;break;case"ZXY":this._x=h*u*f-c*p*g,this._y=c*p*f+h*u*g,this._z=c*u*g+h*p*f,this._w=c*u*f-h*p*g;break;case"ZYX":this._x=h*u*f-c*p*g,this._y=c*p*f+h*u*g,this._z=c*u*g-h*p*f,this._w=c*u*f+h*p*g;break;case"YZX":this._x=h*u*f+c*p*g,this._y=c*p*f+h*u*g,this._z=c*u*g-h*p*f,this._w=c*u*f-h*p*g;break;case"XZY":this._x=h*u*f-c*p*g,this._y=c*p*f-h*u*g,this._z=c*u*g+h*p*f,this._w=c*u*f+h*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}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],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],h=i+a+f;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(o-r)*p}else if(i>a&&i>f){const p=2*Math.sqrt(1+i-a-f);this._w=(u-l)/p,this._x=.25*p,this._y=(r+o)/p,this._z=(s+c)/p}else if(a>f){const p=2*Math.sqrt(1+a-i-f);this._w=(s-c)/p,this._x=(r+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+f-i-a);this._w=(o-r)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.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(wi(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,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),f=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=o*f+this._w*h,this._x=i*f+this._x*h,this._y=r*f+this._y*h,this._z=s*f+this._z*h,this._onChangeCallback(),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 ne{constructor(e=0,t=0,i=0){ne.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(FE.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(FE.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,o=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])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),u=2*(a*t-s*r),f=2*(s*i-o*t);return this.x=t+l*c+o*f-a*u,this.y=i+l*u+a*c-s*f,this.z=r+l*f+s*u-o*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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,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 Ig.copy(this).projectOnVector(e),this.sub(Ig)}reflect(e){return this.sub(Ig.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(wi(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 Ig=new ne,FE=new zn;class Ud{constructor(e=new ne(1/0,1/0,1/0),t=new ne(-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=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,Tr),Tr.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(Zu),Th.subVectors(this.max,Zu),Yl.subVectors(e.a,Zu),Kl.subVectors(e.b,Zu),Zl.subVectors(e.c,Zu),Mo.subVectors(Kl,Yl),Eo.subVectors(Zl,Kl),Ia.subVectors(Yl,Zl);let t=[0,-Mo.z,Mo.y,0,-Eo.z,Eo.y,0,-Ia.z,Ia.y,Mo.z,0,-Mo.x,Eo.z,0,-Eo.x,Ia.z,0,-Ia.x,-Mo.y,Mo.x,0,-Eo.y,Eo.x,0,-Ia.y,Ia.x,0];return!Dg(t,Yl,Kl,Zl,Th)||(t=[1,0,0,0,1,0,0,0,1],!Dg(t,Yl,Kl,Zl,Th))?!1:(Ah.crossVectors(Mo,Eo),t=[Ah.x,Ah.y,Ah.z],Dg(t,Yl,Kl,Zl,Th))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Tr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Tr).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:(Cs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Cs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Cs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Cs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Cs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Cs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Cs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Cs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Cs),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)}}const Cs=[new ne,new ne,new ne,new ne,new ne,new ne,new ne,new ne],Tr=new ne,wh=new Ud,Yl=new ne,Kl=new ne,Zl=new ne,Mo=new ne,Eo=new ne,Ia=new ne,Zu=new ne,Th=new ne,Ah=new ne,Da=new ne;function Dg(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Da.fromArray(n,s);const a=r.x*Math.abs(Da.x)+r.y*Math.abs(Da.y)+r.z*Math.abs(Da.z),l=e.dot(Da),c=t.dot(Da),u=i.dot(Da);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const YF=new Ud,Qu=new ne,Ng=new ne;class m0{constructor(e=new ne,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):YF.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;sthis.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;Qu.subVectors(e,this.center);const t=Qu.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Qu,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):(Ng.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Qu.copy(e.center).add(Ng)),this.expandByPoint(Qu.copy(e.center).sub(Ng))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ps=new ne,Ug=new ne,bh=new ne,wo=new ne,Og=new ne,Rh=new ne,Fg=new ne;class Dy{constructor(e=new ne,t=new ne(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,Ps)),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=Ps.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ps.copy(this.origin).addScaledVector(this.direction,t),Ps.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Ug.copy(e).add(t).multiplyScalar(.5),bh.copy(t).sub(e).normalize(),wo.copy(this.origin).sub(Ug);const s=e.distanceTo(t)*.5,o=-this.direction.dot(bh),a=wo.dot(this.direction),l=-wo.dot(bh),c=wo.lengthSq(),u=Math.abs(1-o*o);let f,h,p,g;if(u>0)if(f=o*l-a,h=o*a-l,g=s*u,f>=0)if(h>=-g)if(h<=g){const _=1/u;f*=_,h*=_,p=f*(f+o*h+2*a)+h*(o*f+h+2*l)+c}else h=s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h=-s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h<=-g?(f=Math.max(0,-(-o*s+a)),h=f>0?-s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c):h<=g?(f=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(f=Math.max(0,-(o*s+a)),h=f>0?s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c);else h=o>0?-s:s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(Ug).addScaledVector(bh,h),p}intersectSphere(e,t){Ps.subVectors(e.center,this.origin);const i=Ps.dot(this.direction),r=Ps.dot(Ps)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return 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,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,f=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,o=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o=0?(a=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||a>r)||((a>i||i!==i)&&(i=a),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Ps)!==null}intersectTriangle(e,t,i,r,s){Og.subVectors(t,e),Rh.subVectors(i,e),Fg.crossVectors(Og,Rh);let o=this.direction.dot(Fg),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;wo.subVectors(this.origin,e);const l=a*this.direction.dot(Rh.crossVectors(wo,Rh));if(l<0)return null;const c=a*this.direction.dot(Og.cross(wo));if(c<0||l+c>o)return null;const u=-a*wo.dot(Fg);return u<0?null:this.at(u/o,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 sn{constructor(e,t,i,r,s,o,a,l,c,u,f,h,p,g,_,m){sn.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,o,a,l,c,u,f,h,p,g,_,m)}set(e,t,i,r,s,o,a,l,c,u,f,h,p,g,_,m){const d=this.elements;return d[0]=e,d[4]=t,d[8]=i,d[12]=r,d[1]=s,d[5]=o,d[9]=a,d[13]=l,d[2]=c,d[6]=u,d[10]=f,d[14]=h,d[3]=p,d[7]=g,d[11]=_,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 sn().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 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){const t=this.elements,i=e.elements,r=1/Ql.setFromMatrixColumn(e,0).length(),s=1/Ql.setFromMatrixColumn(e,1).length(),o=1/Ql.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]*o,t[9]=i[9]*o,t[10]=i[10]*o,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,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=o*u,p=o*f,g=a*u,_=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=p+g*c,t[5]=h-_*c,t[9]=-a*l,t[2]=_-h*c,t[6]=g+p*c,t[10]=o*l}else if(e.order==="YXZ"){const h=l*u,p=l*f,g=c*u,_=c*f;t[0]=h+_*a,t[4]=g*a-p,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=p*a-g,t[6]=_+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*u,p=l*f,g=c*u,_=c*f;t[0]=h-_*a,t[4]=-o*f,t[8]=g+p*a,t[1]=p+g*a,t[5]=o*u,t[9]=_-h*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*u,p=o*f,g=a*u,_=a*f;t[0]=l*u,t[4]=g*c-p,t[8]=h*c+_,t[1]=l*f,t[5]=_*c+h,t[9]=p*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,p=o*c,g=a*l,_=a*c;t[0]=l*u,t[4]=_-h*f,t[8]=g*f+p,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*f+g,t[10]=h-_*f}else if(e.order==="XZY"){const h=o*l,p=o*c,g=a*l,_=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=h*f+_,t[5]=o*u,t[9]=p*f-g,t[2]=g*f-p,t[6]=a*u,t[10]=_*f+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(KF,e,ZF)}lookAt(e,t,i){const r=this.elements;return zi.subVectors(e,t),zi.lengthSq()===0&&(zi.z=1),zi.normalize(),To.crossVectors(i,zi),To.lengthSq()===0&&(Math.abs(i.z)===1?zi.x+=1e-4:zi.z+=1e-4,zi.normalize(),To.crossVectors(i,zi)),To.normalize(),Ch.crossVectors(zi,To),r[0]=To.x,r[4]=Ch.x,r[8]=zi.x,r[1]=To.y,r[5]=Ch.y,r[9]=zi.y,r[2]=To.z,r[6]=Ch.z,r[10]=zi.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,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],f=i[5],h=i[9],p=i[13],g=i[2],_=i[6],m=i[10],d=i[14],x=i[3],v=i[7],y=i[11],b=i[15],w=r[0],T=r[4],C=r[8],M=r[12],S=r[1],P=r[5],k=r[9],U=r[13],N=r[2],X=r[6],z=r[10],te=r[14],L=r[3],Z=r[7],ae=r[11],fe=r[15];return s[0]=o*w+a*S+l*N+c*L,s[4]=o*T+a*P+l*X+c*Z,s[8]=o*C+a*k+l*z+c*ae,s[12]=o*M+a*U+l*te+c*fe,s[1]=u*w+f*S+h*N+p*L,s[5]=u*T+f*P+h*X+p*Z,s[9]=u*C+f*k+h*z+p*ae,s[13]=u*M+f*U+h*te+p*fe,s[2]=g*w+_*S+m*N+d*L,s[6]=g*T+_*P+m*X+d*Z,s[10]=g*C+_*k+m*z+d*ae,s[14]=g*M+_*U+m*te+d*fe,s[3]=x*w+v*S+y*N+b*L,s[7]=x*T+v*P+y*X+b*Z,s[11]=x*C+v*k+y*z+b*ae,s[15]=x*M+v*U+y*te+b*fe,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],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],h=e[10],p=e[14],g=e[3],_=e[7],m=e[11],d=e[15];return g*(+s*l*f-r*c*f-s*a*h+i*c*h+r*a*p-i*l*p)+_*(+t*l*p-t*c*h+s*o*h-r*o*p+r*c*u-s*l*u)+m*(+t*c*f-t*a*p-s*o*f+i*o*p+s*a*u-i*c*u)+d*(-r*a*u-t*l*f+t*a*h+r*o*f-i*o*h+i*l*u)}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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],h=e[10],p=e[11],g=e[12],_=e[13],m=e[14],d=e[15],x=f*m*c-_*h*c+_*l*p-a*m*p-f*l*d+a*h*d,v=g*h*c-u*m*c-g*l*p+o*m*p+u*l*d-o*h*d,y=u*_*c-g*f*c+g*a*p-o*_*p-u*a*d+o*f*d,b=g*f*l-u*_*l-g*a*h+o*_*h+u*a*m-o*f*m,w=t*x+i*v+r*y+s*b;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/w;return e[0]=x*T,e[1]=(_*h*s-f*m*s-_*r*p+i*m*p+f*r*d-i*h*d)*T,e[2]=(a*m*s-_*l*s+_*r*c-i*m*c-a*r*d+i*l*d)*T,e[3]=(f*l*s-a*h*s-f*r*c+i*h*c+a*r*p-i*l*p)*T,e[4]=v*T,e[5]=(u*m*s-g*h*s+g*r*p-t*m*p-u*r*d+t*h*d)*T,e[6]=(g*l*s-o*m*s-g*r*c+t*m*c+o*r*d-t*l*d)*T,e[7]=(o*h*s-u*l*s+u*r*c-t*h*c-o*r*p+t*l*p)*T,e[8]=y*T,e[9]=(g*f*s-u*_*s-g*i*p+t*_*p+u*i*d-t*f*d)*T,e[10]=(o*_*s-g*a*s+g*i*c-t*_*c-o*i*d+t*a*d)*T,e[11]=(u*a*s-o*f*s-u*i*c+t*f*c+o*i*p-t*a*p)*T,e[12]=b*T,e[13]=(u*_*r-g*f*r+g*i*h-t*_*h-u*i*m+t*f*m)*T,e[14]=(g*a*r-o*_*r-g*i*l+t*_*l+o*i*m-t*a*m)*T,e[15]=(o*f*r-u*a*r+u*i*l-t*f*l-o*i*h+t*a*h)*T,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,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,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,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,h=s*c,p=s*u,g=s*f,_=o*u,m=o*f,d=a*f,x=l*c,v=l*u,y=l*f,b=i.x,w=i.y,T=i.z;return r[0]=(1-(_+d))*b,r[1]=(p+y)*b,r[2]=(g-v)*b,r[3]=0,r[4]=(p-y)*w,r[5]=(1-(h+d))*w,r[6]=(m+x)*w,r[7]=0,r[8]=(g+v)*T,r[9]=(m-x)*T,r[10]=(1-(h+_))*T,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;let s=Ql.set(r[0],r[1],r[2]).length();const o=Ql.set(r[4],r[5],r[6]).length(),a=Ql.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Ar.copy(this);const c=1/s,u=1/o,f=1/a;return Ar.elements[0]*=c,Ar.elements[1]*=c,Ar.elements[2]*=c,Ar.elements[4]*=u,Ar.elements[5]*=u,Ar.elements[6]*=u,Ar.elements[8]*=f,Ar.elements[9]*=f,Ar.elements[10]*=f,t.setFromRotationMatrix(Ar),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Xs){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),f=(t+e)/(t-e),h=(i+r)/(i-r);let p,g;if(a===Xs)p=-(o+s)/(o-s),g=-2*o*s/(o-s);else if(a===_m)p=-o/(o-s),g=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Xs){const l=this.elements,c=1/(t-e),u=1/(i-r),f=1/(o-s),h=(t+e)*c,p=(i+r)*u;let g,_;if(a===Xs)g=(o+s)*f,_=-2*f;else if(a===_m)g=s*f,_=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[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 Ql=new ne,Ar=new sn,KF=new ne(0,0,0),ZF=new ne(1,1,1),To=new ne,Ch=new ne,zi=new ne,kE=new sn,BE=new zn;class ps{constructor(e=0,t=0,i=0,r=ps.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],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],h=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(wi(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-wi(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(wi(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-wi(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(wi(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-wi(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return kE.makeRotationFromQuaternion(e),this.setFromRotationMatrix(kE,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return BE.setFromEuler(this),this.setFromQuaternion(BE,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}}ps.DEFAULT_ORDER="XYZ";class Ny{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),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.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?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 a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),f.length>0&&(i.shapes=f),h.length>0&&(i.skeletons=h),p.length>0&&(i.animations=p),g.length>0&&(i.nodes=g)}return i.object=r,i;function o(a){const l=[];for(const c in a){const u=a[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),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){br.subVectors(r,t),Is.subVectors(i,t),Bg.subVectors(e,t);const o=br.dot(br),a=br.dot(Is),l=br.dot(Bg),c=Is.dot(Is),u=Is.dot(Bg),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const h=1/f,p=(c*l-a*u)*h,g=(o*u-a*l)*h;return s.set(1-p-g,g,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Ds)===null?!1:Ds.x>=0&&Ds.y>=0&&Ds.x+Ds.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,Ds)===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,Ds.x),l.addScaledVector(o,Ds.y),l.addScaledVector(a,Ds.z),l)}static isFrontFacing(e,t,i,r){return br.subVectors(i,t),Is.subVectors(e,t),br.cross(Is).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 br.subVectors(this.c,this.b),Is.subVectors(this.a,this.b),br.cross(Is).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return rs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return rs.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return rs.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return rs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return rs.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 o,a;tc.subVectors(r,i),nc.subVectors(s,i),zg.subVectors(e,i);const l=tc.dot(zg),c=nc.dot(zg);if(l<=0&&c<=0)return t.copy(i);Hg.subVectors(e,r);const u=tc.dot(Hg),f=nc.dot(Hg);if(u>=0&&f<=u)return t.copy(r);const h=l*f-u*c;if(h<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(tc,o);Vg.subVectors(e,s);const p=tc.dot(Vg),g=nc.dot(Vg);if(g>=0&&p<=g)return t.copy(s);const _=p*c-l*g;if(_<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(i).addScaledVector(nc,a);const m=u*g-p*f;if(m<=0&&f-u>=0&&p-g>=0)return $E.subVectors(s,r),a=(f-u)/(f-u+(p-g)),t.copy(r).addScaledVector($E,a);const d=1/(m+_+h);return o=_*d,a=h*d,t.copy(i).addScaledVector(tc,o).addScaledVector(nc,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const nR={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},Ao={h:0,s:0,l:0},Lh={h:0,s:0,l:0};function Gg(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 Ut{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=Jr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Lt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Lt.workingColorSpace){return this.r=e,this.g=t,this.b=i,Lt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Lt.workingColorSpace){if(e=zF(e,1),t=wi(t,0,1),i=wi(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=Gg(o,s,e+1/3),this.g=Gg(o,s,e),this.b=Gg(o,s,e-1/3)}return Lt.toWorkingColorSpace(this,r),this}setStyle(e,t=Jr){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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(a))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(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Jr){const i=nR[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.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=Hc(e.r),this.g=Hc(e.g),this.b=Hc(e.b),this}copyLinearToSRGB(e){return this.r=Pg(e.r),this.g=Pg(e.g),this.b=Pg(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Jr){return Lt.fromWorkingColorSpace(qn.copy(this),e),Math.round(wi(qn.r*255,0,255))*65536+Math.round(wi(qn.g*255,0,255))*256+Math.round(wi(qn.b*255,0,255))}getHexString(e=Jr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Lt.workingColorSpace){Lt.fromWorkingColorSpace(qn.copy(this),t);const i=qn.r,r=qn.g,s=qn.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case i:l=(r-s)/f+(r0!=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){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.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.6,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.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!==Bc&&(i.blending=this.blending),this.side!==eo&&(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!==Kv&&(i.blendSrc=this.blendSrc),this.blendDst!==Zv&&(i.blendDst=this.blendDst),this.blendEquation!==Za&&(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!==hm&&(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!==LE&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==jl&&(i.stencilFail=this.stencilFail),this.stencilZFail!==jl&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==jl&&(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.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 o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}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.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++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Fd extends Od{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ut(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 ps,this.combine=zb,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 _n=new ne,Ih=new At;class us{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=IE,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=$s,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return Ff("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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;r0&&(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 f=0,h=c.length;f0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),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(t));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=[],f=s[c];for(let h=0,p=f.length;h0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(XE.copy(s).invert(),Na.copy(e.ray).applyMatrix4(XE),!(i.boundingBox!==null&&Na.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Na)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,h=s.groups,p=s.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,_=h.length;g<_;g++){const m=h[g],d=o[m.materialIndex],x=Math.max(m.start,p.start),v=Math.min(a.count,Math.min(m.start+m.count,p.start+p.count));for(let y=x,b=v;yt.far?null:{distance:c,point:Bh.clone(),object:n}}function zh(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,rc),n.getVertexPosition(l,sc),n.getVertexPosition(c,oc);const u=rk(n,e,t,i,rc,sc,oc,kh);if(u){r&&(Uh.fromBufferAttribute(r,a),Oh.fromBufferAttribute(r,l),Fh.fromBufferAttribute(r,c),u.uv=rs.getInterpolation(kh,rc,sc,oc,Uh,Oh,Fh,new At)),s&&(Uh.fromBufferAttribute(s,a),Oh.fromBufferAttribute(s,l),Fh.fromBufferAttribute(s,c),u.uv1=rs.getInterpolation(kh,rc,sc,oc,Uh,Oh,Fh,new At)),o&&(qE.fromBufferAttribute(o,a),YE.fromBufferAttribute(o,l),KE.fromBufferAttribute(o,c),u.normal=rs.getInterpolation(kh,rc,sc,oc,qE,YE,KE,new ne),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const f={a,b:l,c,normal:new ne,materialIndex:0};rs.getNormal(rc,sc,oc,f.normal),u.face=f}return u}class hn extends gi{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],f=[];let h=0,p=0;g("z","y","x",-1,-1,i,t,e,o,s,0),g("z","y","x",1,-1,i,t,-e,o,s,1),g("x","z","y",1,1,e,i,t,r,o,2),g("x","z","y",1,-1,e,i,-t,r,o,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 Yt(c,3)),this.setAttribute("normal",new Yt(u,3)),this.setAttribute("uv",new Yt(f,2));function g(_,m,d,x,v,y,b,w,T,C,M){const S=y/T,P=b/C,k=y/2,U=b/2,N=w/2,X=T+1,z=C+1;let te=0,L=0;const Z=new ne;for(let ae=0;ae0?1:-1,u.push(Z.x,Z.y,Z.z),f.push(Me/T),f.push(1-ae/C),te+=1}}for(let ae=0;ae0&&(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 oR extends Vn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new sn,this.projectionMatrix=new sn,this.projectionMatrixInverse=new sn,this.coordinateSystem=Xs}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.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const bo=new ne,ZE=new At,QE=new At;class lr extends oR{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=R1*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(bg*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return R1*2*Math.atan(Math.tan(bg*.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){bo.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(bo.x,bo.y).multiplyScalar(-e/bo.z),bo.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(bo.x,bo.y).multiplyScalar(-e/bo.z)}getViewSize(e,t){return this.getViewBounds(e,ZE,QE),t.subVectors(QE,ZE)}setViewOffset(e,t,i,r,s,o){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=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(bg*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),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}}const ac=-90,lc=1;class ck extends Vn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new lr(ac,lc,e,t);r.layers=this.layers,this.add(r);const s=new lr(ac,lc,e,t);s.layers=this.layers,this.add(s);const o=new lr(ac,lc,e,t);o.layers=this.layers,this.add(o);const a=new lr(ac,lc,e,t);a.layers=this.layers,this.add(a);const l=new lr(ac,lc,e,t);l.layers=this.layers,this.add(l);const c=new lr(ac,lc,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Xs)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),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===_m)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),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.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,o,a,l,c,u]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=_,e.setRenderTarget(i,5,r),e.render(t,u),e.setRenderTarget(f,h,p),e.xr.enabled=g,i.texture.needsPMREMUpdate=!0}}class aR extends Li{constructor(e,t,i,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:pu,super(e,t,i,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class uk extends yl{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 aR(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Nr}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:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},r=new hn(5,5,5),s=new ha({name:"CubemapFromEquirect",uniforms:vu(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Pi,blending:Zo});s.uniforms.tEquirect.value=t;const o=new Xe(r,s),a=t.minFilter;return t.minFilter===nl&&(t.minFilter=Nr),new ck(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const Xg=new ne,fk=new ne,dk=new _t;class Ga{constructor(e=new ne(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=Xg.subVectors(i,t).cross(fk.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(Xg),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||dk.getNormalMatrix(e),r=this.coplanarPoint(Xg).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 Ua=new m0,Hh=new ne;class lR{constructor(e=new Ga,t=new Ga,i=new Ga,r=new Ga,s=new Ga,o=new Ga){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),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=Xs){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],f=r[6],h=r[7],p=r[8],g=r[9],_=r[10],m=r[11],d=r[12],x=r[13],v=r[14],y=r[15];if(i[0].setComponents(l-s,h-c,m-p,y-d).normalize(),i[1].setComponents(l+s,h+c,m+p,y+d).normalize(),i[2].setComponents(l+o,h+u,m+g,y+x).normalize(),i[3].setComponents(l-o,h-u,m-g,y-x).normalize(),i[4].setComponents(l-a,h-f,m-_,y-v).normalize(),t===Xs)i[5].setComponents(l+a,h+f,m+_,y+v).normalize();else if(t===_m)i[5].setComponents(a,f,_,v).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(),Ua.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ua.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ua)}intersectsSprite(e){return Ua.center.set(0,0,0),Ua.radius=.7071067811865476,Ua.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ua)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,Hh.y=r.normal.y>0?e.max.y:e.min.y,Hh.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Hh)<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)}}function cR(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),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 hk(n){const e=new WeakMap;function t(a,l){const c=a.array,u=a.usage,f=c.byteLength,h=n.createBuffer();n.bindBuffer(l,h),n.bufferData(l,c,u),a.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function i(a,l,c){const u=l.array,f=l._updateRange,h=l.updateRanges;if(n.bindBuffer(c,a),f.count===-1&&h.length===0&&n.bufferSubData(c,0,u),h.length!==0){for(let p=0,g=h.length;p 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,Pk=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,Lk=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,Ik=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,Dk=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,Nk=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,Uk=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec3 vColor; +#endif`,Ok=`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif +#ifdef USE_BATCHING_COLOR + vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); + vColor.xyz *= batchingColor.xyz; +#endif`,Fk=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,kk=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,Bk=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,zk=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,Hk=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,Vk=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,Gk=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,Wk="gl_FragColor = linearToOutputTexel( gl_FragColor );",$k=` +const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( + vec3( 0.8224621, 0.177538, 0.0 ), + vec3( 0.0331941, 0.9668058, 0.0 ), + vec3( 0.0170827, 0.0723974, 0.9105199 ) +); +const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( + vec3( 1.2249401, - 0.2249404, 0.0 ), + vec3( - 0.0420569, 1.0420571, 0.0 ), + vec3( - 0.0196376, - 0.0786361, 1.0982735 ) +); +vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { + return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); +} +vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { + return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); +} +vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferOETF( in vec4 value ) { + 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 ); +}`,Xk=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,jk=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,qk=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,Yk=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,Kk=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,Zk=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,Qk=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,Jk=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,eB=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,tB=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,nB=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,iB=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,rB=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,sB=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,oB=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,aB=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,lB=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,cB=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,uB=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,fB=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,dB=`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return saturate(v); + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); +} +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + vec4 r = roughness * c0 + c1; + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + return fab; +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,hB=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,pB=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,mB=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,gB=`#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,_B=`#if defined( USE_LOGDEPTHBUF ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,vB=`#ifdef USE_LOGDEPTHBUF + varying float vFragDepth; + varying float vIsPerspective; +#endif`,xB=`#ifdef USE_LOGDEPTHBUF + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,yB=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); + + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,SB=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,MB=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,EB=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,wB=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,TB=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,AB=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,bB=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,RB=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,CB=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,PB=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,LB=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,IB=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,DB=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,NB=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,UB=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,OB=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,FB=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,kB=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,BB=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,zB=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,HB=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,VB=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + return depth * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * depth - far ); +}`,GB=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,WB=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,$B=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,XB=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,jB=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,qB=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,YB=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + + float lightToPositionLength = length( lightToPosition ); + if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { + float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + shadow = ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } +#endif`,KB=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,ZB=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,QB=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,JB=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,ez=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,tz=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,nz=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,iz=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,rz=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,sz=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,oz=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,az=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,lz=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + + #else + + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,cz=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,uz=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,fz=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,dz=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const hz=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,pz=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,mz=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,gz=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,_z=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,vz=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,xz=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,yz=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,Sz=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,Mz=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,Ez=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,wz=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,Tz=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,Az=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,bz=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,Rz=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,Cz=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,Pz=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,Lz=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,Iz=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,Dz=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,Nz=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,Uz=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,Oz=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,Fz=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,kz=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,Bz=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,zz=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,Hz=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,Vz=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,Gz=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,Wz=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,$z=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,Xz=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,mt={alphahash_fragment:pk,alphahash_pars_fragment:mk,alphamap_fragment:gk,alphamap_pars_fragment:_k,alphatest_fragment:vk,alphatest_pars_fragment:xk,aomap_fragment:yk,aomap_pars_fragment:Sk,batching_pars_vertex:Mk,batching_vertex:Ek,begin_vertex:wk,beginnormal_vertex:Tk,bsdfs:Ak,iridescence_fragment:bk,bumpmap_pars_fragment:Rk,clipping_planes_fragment:Ck,clipping_planes_pars_fragment:Pk,clipping_planes_pars_vertex:Lk,clipping_planes_vertex:Ik,color_fragment:Dk,color_pars_fragment:Nk,color_pars_vertex:Uk,color_vertex:Ok,common:Fk,cube_uv_reflection_fragment:kk,defaultnormal_vertex:Bk,displacementmap_pars_vertex:zk,displacementmap_vertex:Hk,emissivemap_fragment:Vk,emissivemap_pars_fragment:Gk,colorspace_fragment:Wk,colorspace_pars_fragment:$k,envmap_fragment:Xk,envmap_common_pars_fragment:jk,envmap_pars_fragment:qk,envmap_pars_vertex:Yk,envmap_physical_pars_fragment:oB,envmap_vertex:Kk,fog_vertex:Zk,fog_pars_vertex:Qk,fog_fragment:Jk,fog_pars_fragment:eB,gradientmap_pars_fragment:tB,lightmap_pars_fragment:nB,lights_lambert_fragment:iB,lights_lambert_pars_fragment:rB,lights_pars_begin:sB,lights_toon_fragment:aB,lights_toon_pars_fragment:lB,lights_phong_fragment:cB,lights_phong_pars_fragment:uB,lights_physical_fragment:fB,lights_physical_pars_fragment:dB,lights_fragment_begin:hB,lights_fragment_maps:pB,lights_fragment_end:mB,logdepthbuf_fragment:gB,logdepthbuf_pars_fragment:_B,logdepthbuf_pars_vertex:vB,logdepthbuf_vertex:xB,map_fragment:yB,map_pars_fragment:SB,map_particle_fragment:MB,map_particle_pars_fragment:EB,metalnessmap_fragment:wB,metalnessmap_pars_fragment:TB,morphinstance_vertex:AB,morphcolor_vertex:bB,morphnormal_vertex:RB,morphtarget_pars_vertex:CB,morphtarget_vertex:PB,normal_fragment_begin:LB,normal_fragment_maps:IB,normal_pars_fragment:DB,normal_pars_vertex:NB,normal_vertex:UB,normalmap_pars_fragment:OB,clearcoat_normal_fragment_begin:FB,clearcoat_normal_fragment_maps:kB,clearcoat_pars_fragment:BB,iridescence_pars_fragment:zB,opaque_fragment:HB,packing:VB,premultiplied_alpha_fragment:GB,project_vertex:WB,dithering_fragment:$B,dithering_pars_fragment:XB,roughnessmap_fragment:jB,roughnessmap_pars_fragment:qB,shadowmap_pars_fragment:YB,shadowmap_pars_vertex:KB,shadowmap_vertex:ZB,shadowmask_pars_fragment:QB,skinbase_vertex:JB,skinning_pars_vertex:ez,skinning_vertex:tz,skinnormal_vertex:nz,specularmap_fragment:iz,specularmap_pars_fragment:rz,tonemapping_fragment:sz,tonemapping_pars_fragment:oz,transmission_fragment:az,transmission_pars_fragment:lz,uv_pars_fragment:cz,uv_pars_vertex:uz,uv_vertex:fz,worldpos_vertex:dz,background_vert:hz,background_frag:pz,backgroundCube_vert:mz,backgroundCube_frag:gz,cube_vert:_z,cube_frag:vz,depth_vert:xz,depth_frag:yz,distanceRGBA_vert:Sz,distanceRGBA_frag:Mz,equirect_vert:Ez,equirect_frag:wz,linedashed_vert:Tz,linedashed_frag:Az,meshbasic_vert:bz,meshbasic_frag:Rz,meshlambert_vert:Cz,meshlambert_frag:Pz,meshmatcap_vert:Lz,meshmatcap_frag:Iz,meshnormal_vert:Dz,meshnormal_frag:Nz,meshphong_vert:Uz,meshphong_frag:Oz,meshphysical_vert:Fz,meshphysical_frag:kz,meshtoon_vert:Bz,meshtoon_frag:zz,points_vert:Hz,points_frag:Vz,shadow_vert:Gz,shadow_frag:Wz,sprite_vert:$z,sprite_frag:Xz},He={common:{diffuse:{value:new Ut(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new _t},alphaMap:{value:null},alphaMapTransform:{value:new _t},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new _t}},envmap:{envMap:{value:null},envMapRotation:{value:new _t},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new _t}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new _t}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new _t},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new _t},normalScale:{value:new At(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new _t},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new _t}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new _t}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new _t}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ut(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ut(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new _t},alphaTest:{value:0},uvTransform:{value:new _t}},sprite:{diffuse:{value:new Ut(16777215)},opacity:{value:1},center:{value:new At(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new _t},alphaMap:{value:null},alphaMapTransform:{value:new _t},alphaTest:{value:0}}},ns={basic:{uniforms:ai([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.fog]),vertexShader:mt.meshbasic_vert,fragmentShader:mt.meshbasic_frag},lambert:{uniforms:ai([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 Ut(0)}}]),vertexShader:mt.meshlambert_vert,fragmentShader:mt.meshlambert_frag},phong:{uniforms:ai([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 Ut(0)},specular:{value:new Ut(1118481)},shininess:{value:30}}]),vertexShader:mt.meshphong_vert,fragmentShader:mt.meshphong_frag},standard:{uniforms:ai([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 Ut(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:mt.meshphysical_vert,fragmentShader:mt.meshphysical_frag},toon:{uniforms:ai([He.common,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.gradientmap,He.fog,He.lights,{emissive:{value:new Ut(0)}}]),vertexShader:mt.meshtoon_vert,fragmentShader:mt.meshtoon_frag},matcap:{uniforms:ai([He.common,He.bumpmap,He.normalmap,He.displacementmap,He.fog,{matcap:{value:null}}]),vertexShader:mt.meshmatcap_vert,fragmentShader:mt.meshmatcap_frag},points:{uniforms:ai([He.points,He.fog]),vertexShader:mt.points_vert,fragmentShader:mt.points_frag},dashed:{uniforms:ai([He.common,He.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:mt.linedashed_vert,fragmentShader:mt.linedashed_frag},depth:{uniforms:ai([He.common,He.displacementmap]),vertexShader:mt.depth_vert,fragmentShader:mt.depth_frag},normal:{uniforms:ai([He.common,He.bumpmap,He.normalmap,He.displacementmap,{opacity:{value:1}}]),vertexShader:mt.meshnormal_vert,fragmentShader:mt.meshnormal_frag},sprite:{uniforms:ai([He.sprite,He.fog]),vertexShader:mt.sprite_vert,fragmentShader:mt.sprite_frag},background:{uniforms:{uvTransform:{value:new _t},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:mt.background_vert,fragmentShader:mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new _t}},vertexShader:mt.backgroundCube_vert,fragmentShader:mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:mt.cube_vert,fragmentShader:mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:mt.equirect_vert,fragmentShader:mt.equirect_frag},distanceRGBA:{uniforms:ai([He.common,He.displacementmap,{referencePosition:{value:new ne},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:mt.distanceRGBA_vert,fragmentShader:mt.distanceRGBA_frag},shadow:{uniforms:ai([He.lights,He.fog,{color:{value:new Ut(0)},opacity:{value:1}}]),vertexShader:mt.shadow_vert,fragmentShader:mt.shadow_frag}};ns.physical={uniforms:ai([ns.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new _t},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new _t},clearcoatNormalScale:{value:new At(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new _t},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new _t},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new _t},sheen:{value:0},sheenColor:{value:new Ut(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new _t},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new _t},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new _t},transmissionSamplerSize:{value:new At},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new _t},attenuationDistance:{value:0},attenuationColor:{value:new Ut(0)},specularColor:{value:new Ut(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new _t},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new _t},anisotropyVector:{value:new At},anisotropyMap:{value:null},anisotropyMapTransform:{value:new _t}}]),vertexShader:mt.meshphysical_vert,fragmentShader:mt.meshphysical_frag};const Vh={r:0,b:0,g:0},Oa=new ps,jz=new sn;function qz(n,e,t,i,r,s,o){const a=new Ut(0);let l=s===!0?0:1,c,u,f=null,h=0,p=null;function g(x){let v=x.isScene===!0?x.background:null;return v&&v.isTexture&&(v=(x.backgroundBlurriness>0?t:e).get(v)),v}function _(x){let v=!1;const y=g(x);y===null?d(a,l):y&&y.isColor&&(d(y,1),v=!0);const b=n.xr.getEnvironmentBlendMode();b==="additive"?i.buffers.color.setClear(0,0,0,1,o):b==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||v)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function m(x,v){const y=g(v);y&&(y.isCubeTexture||y.mapping===h0)?(u===void 0&&(u=new Xe(new hn(1,1,1),new ha({name:"BackgroundCubeMaterial",uniforms:vu(ns.backgroundCube.uniforms),vertexShader:ns.backgroundCube.vertexShader,fragmentShader:ns.backgroundCube.fragmentShader,side:Pi,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(b,w,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Oa.copy(v.backgroundRotation),Oa.x*=-1,Oa.y*=-1,Oa.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Oa.y*=-1,Oa.z*=-1),u.material.uniforms.envMap.value=y,u.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(jz.makeRotationFromEuler(Oa)),u.material.toneMapped=Lt.getTransfer(y.colorSpace)!==$t,(f!==y||h!==y.version||p!==n.toneMapping)&&(u.material.needsUpdate=!0,f=y,h=y.version,p=n.toneMapping),u.layers.enableAll(),x.unshift(u,u.geometry,u.material,0,0,null)):y&&y.isTexture&&(c===void 0&&(c=new Xe(new kd(2,2),new ha({name:"BackgroundMaterial",uniforms:vu(ns.background.uniforms),vertexShader:ns.background.vertexShader,fragmentShader:ns.background.fragmentShader,side:eo,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.toneMapped=Lt.getTransfer(y.colorSpace)!==$t,y.matrixAutoUpdate===!0&&y.updateMatrix(),c.material.uniforms.uvTransform.value.copy(y.matrix),(f!==y||h!==y.version||p!==n.toneMapping)&&(c.material.needsUpdate=!0,f=y,h=y.version,p=n.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null))}function d(x,v){x.getRGB(Vh,sR(n)),i.buffers.color.setClear(Vh.r,Vh.g,Vh.b,v,o)}return{getClearColor:function(){return a},setClearColor:function(x,v=1){a.set(x),l=v,d(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,d(a,l)},render:_,addToRenderList:m}}function Yz(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=h(null);let s=r,o=!1;function a(S,P,k,U,N){let X=!1;const z=f(U,k,P);s!==z&&(s=z,c(s.object)),X=p(S,U,k,N),X&&g(S,U,k,N),N!==null&&e.update(N,n.ELEMENT_ARRAY_BUFFER),(X||o)&&(o=!1,y(S,P,k,U),N!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(N).buffer))}function l(){return n.createVertexArray()}function c(S){return n.bindVertexArray(S)}function u(S){return n.deleteVertexArray(S)}function f(S,P,k){const U=k.wireframe===!0;let N=i[S.id];N===void 0&&(N={},i[S.id]=N);let X=N[P.id];X===void 0&&(X={},N[P.id]=X);let z=X[U];return z===void 0&&(z=h(l()),X[U]=z),z}function h(S){const P=[],k=[],U=[];for(let N=0;N=0){const ae=N[L];let fe=X[L];if(fe===void 0&&(L==="instanceMatrix"&&S.instanceMatrix&&(fe=S.instanceMatrix),L==="instanceColor"&&S.instanceColor&&(fe=S.instanceColor)),ae===void 0||ae.attribute!==fe||fe&&ae.data!==fe.data)return!0;z++}return s.attributesNum!==z||s.index!==U}function g(S,P,k,U){const N={},X=P.attributes;let z=0;const te=k.getAttributes();for(const L in te)if(te[L].location>=0){let ae=X[L];ae===void 0&&(L==="instanceMatrix"&&S.instanceMatrix&&(ae=S.instanceMatrix),L==="instanceColor"&&S.instanceColor&&(ae=S.instanceColor));const fe={};fe.attribute=ae,ae&&ae.data&&(fe.data=ae.data),N[L]=fe,z++}s.attributes=N,s.attributesNum=z,s.index=U}function _(){const S=s.newAttributes;for(let P=0,k=S.length;P=0){let Z=N[te];if(Z===void 0&&(te==="instanceMatrix"&&S.instanceMatrix&&(Z=S.instanceMatrix),te==="instanceColor"&&S.instanceColor&&(Z=S.instanceColor)),Z!==void 0){const ae=Z.normalized,fe=Z.itemSize,Me=e.get(Z);if(Me===void 0)continue;const Ve=Me.buffer,$=Me.type,oe=Me.bytesPerElement,me=$===n.INT||$===n.UNSIGNED_INT||Z.gpuType===Ay;if(Z.isInterleavedBufferAttribute){const de=Z.data,be=de.stride,Le=Z.offset;if(de.isInstancedInterleavedBuffer){for(let ke=0;ke0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="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&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const f=t.logarithmicDepthBuffer===!0,h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=n.getParameter(n.MAX_TEXTURE_SIZE),_=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),m=n.getParameter(n.MAX_VERTEX_ATTRIBS),d=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),x=n.getParameter(n.MAX_VARYING_VECTORS),v=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),y=p>0,b=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,maxTextures:h,maxVertexTextures:p,maxTextureSize:g,maxCubemapSize:_,maxAttributes:m,maxVertexUniforms:d,maxVaryings:x,maxFragmentUniforms:v,vertexTextures:y,maxSamples:b}}function Qz(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new Ga,a=new _t,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const p=f.length!==0||h||i!==0||r;return r=h,i=f.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){t=u(f,h,0)},this.setState=function(f,h,p){const g=f.clippingPlanes,_=f.clipIntersection,m=f.clipShadows,d=n.get(f);if(!r||g===null||g.length===0||s&&!m)s?u(null):c();else{const x=s?0:i,v=x*4;let y=d.clippingState||null;l.value=y,y=u(g,h,v,p);for(let b=0;b!==v;++b)y[b]=t[b];d.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=x}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(f,h,p,g){const _=f!==null?f.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const d=p+_*4,x=h.matrixWorldInverse;a.getNormalMatrix(x),(m===null||m.length0){const c=new uk(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class eH extends oR{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=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=o,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,o){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=o,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,o=i+e,a=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,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),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 xc=4,JE=[.125,.215,.35,.446,.526,.582],Qa=20,jg=new eH,e3=new Ut;let qg=null,Yg=0,Kg=0,Zg=!1;const Wa=(1+Math.sqrt(5))/2,cc=1/Wa,t3=[new ne(-Wa,cc,0),new ne(Wa,cc,0),new ne(-cc,0,Wa),new ne(cc,0,Wa),new ne(0,Wa,-cc),new ne(0,Wa,cc),new ne(-1,1,-1),new ne(1,1,-1),new ne(-1,1,1),new ne(1,1,1)];class n3{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){qg=this._renderer.getRenderTarget(),Yg=this._renderer.getActiveCubeFace(),Kg=this._renderer.getActiveMipmapLevel(),Zg=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=s3(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=r3(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.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._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?v:0,v,v),u.setRenderTarget(r),_&&u.render(g,a),u.render(e,a)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=h,u.autoClear=f,e.background=m}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===pu||e.mapping===mu;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=s3()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=r3());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Xe(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Gh(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,jg)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sQa&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Qa}`);const d=[];let x=0;for(let T=0;Tv-xc?r-v+xc:0),w=4*(this._cubeSize-y);Gh(t,b,w,3*y,2*y),l.setRenderTarget(t),l.render(f,jg)}}function tH(n){const e=[],t=[],i=[];let r=n;const s=n-xc+1+JE.length;for(let o=0;on-xc?l=JE[o-n+xc-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,f=1+c,h=[u,u,f,u,f,f,u,u,f,f,u,f],p=6,g=6,_=3,m=2,d=1,x=new Float32Array(_*g*p),v=new Float32Array(m*g*p),y=new Float32Array(d*g*p);for(let w=0;w2?0:-1,M=[T,C,0,T+2/3,C,0,T+2/3,C+1,0,T,C,0,T+2/3,C+1,0,T,C+1,0];x.set(M,_*g*w),v.set(h,m*g*w);const S=[w,w,w,w,w,w];y.set(S,d*g*w)}const b=new gi;b.setAttribute("position",new us(x,_)),b.setAttribute("uv",new us(v,m)),b.setAttribute("faceIndex",new us(y,d)),e.push(b),r>xc&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function i3(n,e,t){const i=new yl(n,e,t);return i.texture.mapping=h0,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Gh(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function nH(n,e,t){const i=new Float32Array(Qa),r=new ne(0,1,0);return new ha({name:"SphericalGaussianBlur",defines:{n:Qa,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:Uy(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:Zo,depthTest:!1,depthWrite:!1})}function r3(){return new ha({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Uy(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:Zo,depthTest:!1,depthWrite:!1})}function s3(){return new ha({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Uy(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:Zo,depthTest:!1,depthWrite:!1})}function Uy(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function iH(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===Qv||l===Jv,u=l===pu||l===mu;if(c||u){let f=e.get(a);const h=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==h)return t===null&&(t=new n3(n)),f=c?t.fromEquirectangular(a,f):t.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const p=a.image;return c&&p&&p.height>0||u&&p&&r(p)?(t===null&&(t=new n3(n)),f=c?t.fromEquirectangular(a):t.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(b=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const w=new Float32Array(y*b*4*f),T=new tR(w,y,b,f);T.type=$s,T.needsUpdate=!0;const C=v*4;for(let S=0;S0)return n;const r=e*t;let s=a3[r];if(s===void 0&&(s=new Float32Array(r),a3[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Rn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` +`)}function iV(n){const e=Lt.getPrimaries(Lt.workingColorSpace),t=Lt.getPrimaries(n);let i;switch(e===t?i="":e===gm&&t===mm?i="LinearDisplayP3ToLinearSRGB":e===mm&&t===gm&&(i="LinearSRGBToLinearDisplayP3"),n){case ga:case p0:return[i,"LinearTransferOETF"];case Jr:case Iy:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function p3(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` + +`+r+` + +`+nV(n.getShaderSource(e),o)}else return r}function rV(n,e){const t=iV(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function sV(n,e){let t;switch(e){case SF:t="Linear";break;case MF:t="Reinhard";break;case EF:t="Cineon";break;case wF:t="ACESFilmic";break;case AF:t="AgX";break;case bF:t="Neutral";break;case TF:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Wh=new ne;function oV(){Lt.getLuminanceCoefficients(Wh);const n=Wh.x.toFixed(4),e=Wh.y.toFixed(4),t=Wh.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function aV(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Sf).join(` +`)}function lV(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` +`)}function cV(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function C1(n){return n.replace(uV,dV)}const fV=new Map;function dV(n,e){let t=mt[e];if(t===void 0){const i=fV.get(e);if(i!==void 0)t=mt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return C1(t)}const hV=/#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 _3(n){return n.replace(hV,pV)}function pV(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(m+=` +`),d=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Sf).join(` +`),d.length>0&&(d+=` +`)):(m=[v3(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_LOGDEPTHBUF":"","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",` +`].filter(Sf).join(` +`),d=[v3(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 "+f:"",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||t.batchingColor?"#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.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.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Qo?"#define TONE_MAPPING":"",t.toneMapping!==Qo?mt.tonemapping_pars_fragment:"",t.toneMapping!==Qo?sV("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",mt.colorspace_pars_fragment,rV("linearToOutputTexel",t.outputColorSpace),oV(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Sf).join(` +`)),o=C1(o),o=m3(o,t),o=g3(o,t),a=C1(a),a=m3(a,t),a=g3(a,t),o=_3(o),a=_3(a),t.isRawShaderMaterial!==!0&&(x=`#version 300 es +`,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+m,d=["#define varying in",t.glslVersion===DE?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===DE?"":"#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(` +`)+` +`+d);const v=x+m+o,y=x+d+a,b=h3(r,r.VERTEX_SHADER,v),w=h3(r,r.FRAGMENT_SHADER,y);r.attachShader(_,b),r.attachShader(_,w),t.index0AttributeName!==void 0?r.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function T(P){if(n.debug.checkShaderErrors){const k=r.getProgramInfoLog(_).trim(),U=r.getShaderInfoLog(b).trim(),N=r.getShaderInfoLog(w).trim();let X=!0,z=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(X=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,_,b,w);else{const te=p3(r,b,"vertex"),L=p3(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+` + +Material Name: `+P.name+` +Material Type: `+P.type+` + +Program Info Log: `+k+` +`+te+` +`+L)}else k!==""?console.warn("THREE.WebGLProgram: Program Info Log:",k):(U===""||N==="")&&(z=!1);z&&(P.diagnostics={runnable:X,programLog:k,vertexShader:{log:U,prefix:m},fragmentShader:{log:N,prefix:d}})}r.deleteShader(b),r.deleteShader(w),C=new kp(r,_),M=cV(r,_)}let C;this.getUniforms=function(){return C===void 0&&T(this),C};let M;this.getAttributes=function(){return M===void 0&&T(this),M};let S=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&&(S=r.getProgramParameter(_,eV)),S},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=tV++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=b,this.fragmentShader=w,this}let SV=0;class MV{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),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.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 EV(e),t.set(e,i)),i}}class EV{constructor(e){this.id=SV++,this.code=e,this.usedTimes=0}}function wV(n,e,t,i,r,s,o){const a=new Ny,l=new MV,c=new Set,u=[],f=r.logarithmicDepthBuffer,h=r.vertexTextures;let p=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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 _(M){return c.add(M),M===0?"uv":`uv${M}`}function m(M,S,P,k,U){const N=k.fog,X=U.geometry,z=M.isMeshStandardMaterial?k.environment:null,te=(M.isMeshStandardMaterial?t:e).get(M.envMap||z),L=te&&te.mapping===h0?te.image.height:null,Z=g[M.type];M.precision!==null&&(p=r.getMaxPrecision(M.precision),p!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",p,"instead."));const ae=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,fe=ae!==void 0?ae.length:0;let Me=0;X.morphAttributes.position!==void 0&&(Me=1),X.morphAttributes.normal!==void 0&&(Me=2),X.morphAttributes.color!==void 0&&(Me=3);let Ve,$,oe,me;if(Z){const it=ns[Z];Ve=it.vertexShader,$=it.fragmentShader}else Ve=M.vertexShader,$=M.fragmentShader,l.update(M),oe=l.getVertexShaderID(M),me=l.getFragmentShaderID(M);const de=n.getRenderTarget(),be=U.isInstancedMesh===!0,Le=U.isBatchedMesh===!0,ke=!!M.map,Qe=!!M.matcap,V=!!te,ot=!!M.aoMap,ee=!!M.lightMap,at=!!M.bumpMap,Ne=!!M.normalMap,Ze=!!M.displacementMap,Ie=!!M.emissiveMap,We=!!M.metalnessMap,B=!!M.roughnessMap,E=M.anisotropy>0,A=M.clearcoat>0,F=M.dispersion>0,W=M.iridescence>0,j=M.sheen>0,le=M.transmission>0,pe=E&&!!M.anisotropyMap,ce=A&&!!M.clearcoatMap,Ee=A&&!!M.clearcoatNormalMap,ve=A&&!!M.clearcoatRoughnessMap,ue=W&&!!M.iridescenceMap,Re=W&&!!M.iridescenceThicknessMap,Pe=j&&!!M.sheenColorMap,ye=j&&!!M.sheenRoughnessMap,Se=!!M.specularMap,Be=!!M.specularColorMap,je=!!M.specularIntensityMap,J=le&&!!M.transmissionMap,H=le&&!!M.thicknessMap,re=!!M.gradientMap,q=!!M.alphaMap,ie=M.alphaTest>0,xe=!!M.alphaHash,we=!!M.extensions;let Ye=Qo;M.toneMapped&&(de===null||de.isXRRenderTarget===!0)&&(Ye=n.toneMapping);const ut={shaderID:Z,shaderType:M.type,shaderName:M.name,vertexShader:Ve,fragmentShader:$,defines:M.defines,customVertexShaderID:oe,customFragmentShaderID:me,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:p,batching:Le,batchingColor:Le&&U._colorsTexture!==null,instancing:be,instancingColor:be&&U.instanceColor!==null,instancingMorph:be&&U.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:de===null?n.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:ga,alphaToCoverage:!!M.alphaToCoverage,map:ke,matcap:Qe,envMap:V,envMapMode:V&&te.mapping,envMapCubeUVHeight:L,aoMap:ot,lightMap:ee,bumpMap:at,normalMap:Ne,displacementMap:h&&Ze,emissiveMap:Ie,normalMapObjectSpace:Ne&&M.normalMapType===IF,normalMapTangentSpace:Ne&&M.normalMapType===LF,metalnessMap:We,roughnessMap:B,anisotropy:E,anisotropyMap:pe,clearcoat:A,clearcoatMap:ce,clearcoatNormalMap:Ee,clearcoatRoughnessMap:ve,dispersion:F,iridescence:W,iridescenceMap:ue,iridescenceThicknessMap:Re,sheen:j,sheenColorMap:Pe,sheenRoughnessMap:ye,specularMap:Se,specularColorMap:Be,specularIntensityMap:je,transmission:le,transmissionMap:J,thicknessMap:H,gradientMap:re,opaque:M.transparent===!1&&M.blending===Bc&&M.alphaToCoverage===!1,alphaMap:q,alphaTest:ie,alphaHash:xe,combine:M.combine,mapUv:ke&&_(M.map.channel),aoMapUv:ot&&_(M.aoMap.channel),lightMapUv:ee&&_(M.lightMap.channel),bumpMapUv:at&&_(M.bumpMap.channel),normalMapUv:Ne&&_(M.normalMap.channel),displacementMapUv:Ze&&_(M.displacementMap.channel),emissiveMapUv:Ie&&_(M.emissiveMap.channel),metalnessMapUv:We&&_(M.metalnessMap.channel),roughnessMapUv:B&&_(M.roughnessMap.channel),anisotropyMapUv:pe&&_(M.anisotropyMap.channel),clearcoatMapUv:ce&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:Ee&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ve&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:ue&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:Re&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:Pe&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:ye&&_(M.sheenRoughnessMap.channel),specularMapUv:Se&&_(M.specularMap.channel),specularColorMapUv:Be&&_(M.specularColorMap.channel),specularIntensityMapUv:je&&_(M.specularIntensityMap.channel),transmissionMapUv:J&&_(M.transmissionMap.channel),thicknessMapUv:H&&_(M.thicknessMap.channel),alphaMapUv:q&&_(M.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(Ne||E),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:U.isPoints===!0&&!!X.attributes.uv&&(ke||q),fog:!!N,useFog:M.fog===!0,fogExp2:!!N&&N.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:U.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:fe,morphTextureStride:Me,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:M.dithering,shadowMapEnabled:n.shadowMap.enabled&&P.length>0,shadowMapType:n.shadowMap.type,toneMapping:Ye,decodeVideoTexture:ke&&M.map.isVideoTexture===!0&&Lt.getTransfer(M.map.colorSpace)===$t,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===is,flipSided:M.side===Pi,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:we&&M.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(we&&M.extensions.multiDraw===!0||Le)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return ut.vertexUv1s=c.has(1),ut.vertexUv2s=c.has(2),ut.vertexUv3s=c.has(3),c.clear(),ut}function d(M){const S=[];if(M.shaderID?S.push(M.shaderID):(S.push(M.customVertexShaderID),S.push(M.customFragmentShaderID)),M.defines!==void 0)for(const P in M.defines)S.push(P),S.push(M.defines[P]);return M.isRawShaderMaterial===!1&&(x(S,M),v(S,M),S.push(n.outputColorSpace)),S.push(M.customProgramCacheKey),S.join()}function x(M,S){M.push(S.precision),M.push(S.outputColorSpace),M.push(S.envMapMode),M.push(S.envMapCubeUVHeight),M.push(S.mapUv),M.push(S.alphaMapUv),M.push(S.lightMapUv),M.push(S.aoMapUv),M.push(S.bumpMapUv),M.push(S.normalMapUv),M.push(S.displacementMapUv),M.push(S.emissiveMapUv),M.push(S.metalnessMapUv),M.push(S.roughnessMapUv),M.push(S.anisotropyMapUv),M.push(S.clearcoatMapUv),M.push(S.clearcoatNormalMapUv),M.push(S.clearcoatRoughnessMapUv),M.push(S.iridescenceMapUv),M.push(S.iridescenceThicknessMapUv),M.push(S.sheenColorMapUv),M.push(S.sheenRoughnessMapUv),M.push(S.specularMapUv),M.push(S.specularColorMapUv),M.push(S.specularIntensityMapUv),M.push(S.transmissionMapUv),M.push(S.thicknessMapUv),M.push(S.combine),M.push(S.fogExp2),M.push(S.sizeAttenuation),M.push(S.morphTargetsCount),M.push(S.morphAttributeCount),M.push(S.numDirLights),M.push(S.numPointLights),M.push(S.numSpotLights),M.push(S.numSpotLightMaps),M.push(S.numHemiLights),M.push(S.numRectAreaLights),M.push(S.numDirLightShadows),M.push(S.numPointLightShadows),M.push(S.numSpotLightShadows),M.push(S.numSpotLightShadowsWithMaps),M.push(S.numLightProbes),M.push(S.shadowMapType),M.push(S.toneMapping),M.push(S.numClippingPlanes),M.push(S.numClipIntersection),M.push(S.depthPacking)}function v(M,S){a.disableAll(),S.supportsVertexTextures&&a.enable(0),S.instancing&&a.enable(1),S.instancingColor&&a.enable(2),S.instancingMorph&&a.enable(3),S.matcap&&a.enable(4),S.envMap&&a.enable(5),S.normalMapObjectSpace&&a.enable(6),S.normalMapTangentSpace&&a.enable(7),S.clearcoat&&a.enable(8),S.iridescence&&a.enable(9),S.alphaTest&&a.enable(10),S.vertexColors&&a.enable(11),S.vertexAlphas&&a.enable(12),S.vertexUv1s&&a.enable(13),S.vertexUv2s&&a.enable(14),S.vertexUv3s&&a.enable(15),S.vertexTangents&&a.enable(16),S.anisotropy&&a.enable(17),S.alphaHash&&a.enable(18),S.batching&&a.enable(19),S.dispersion&&a.enable(20),S.batchingColor&&a.enable(21),M.push(a.mask),a.disableAll(),S.fog&&a.enable(0),S.useFog&&a.enable(1),S.flatShading&&a.enable(2),S.logarithmicDepthBuffer&&a.enable(3),S.skinning&&a.enable(4),S.morphTargets&&a.enable(5),S.morphNormals&&a.enable(6),S.morphColors&&a.enable(7),S.premultipliedAlpha&&a.enable(8),S.shadowMapEnabled&&a.enable(9),S.doubleSided&&a.enable(10),S.flipSided&&a.enable(11),S.useDepthPacking&&a.enable(12),S.dithering&&a.enable(13),S.transmission&&a.enable(14),S.sheen&&a.enable(15),S.opaque&&a.enable(16),S.pointsUvs&&a.enable(17),S.decodeVideoTexture&&a.enable(18),S.alphaToCoverage&&a.enable(19),M.push(a.mask)}function y(M){const S=g[M.type];let P;if(S){const k=ns[S];P=ok.clone(k.uniforms)}else P=M.uniforms;return P}function b(M,S){let P;for(let k=0,U=u.length;k0?i.push(d):p.transparent===!0?r.push(d):t.push(d)}function l(f,h,p,g,_,m){const d=o(f,h,p,g,_,m);p.transmission>0?i.unshift(d):p.transparent===!0?r.unshift(d):t.unshift(d)}function c(f,h){t.length>1&&t.sort(f||AV),i.length>1&&i.sort(h||x3),r.length>1&&r.sort(h||x3)}function u(){for(let f=e,h=n.length;f=s.length?(o=new y3,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function RV(){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 ne,color:new Ut};break;case"SpotLight":t={position:new ne,direction:new ne,color:new Ut,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ne,color:new Ut,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ne,skyColor:new Ut,groundColor:new Ut};break;case"RectAreaLight":t={color:new Ut,position:new ne,halfWidth:new ne,halfHeight:new ne};break}return n[e.id]=t,t}}}function CV(){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 At};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new At};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new At,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let PV=0;function LV(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function IV(n){const e=new RV,t=CV(),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 ne);const r=new ne,s=new sn,o=new sn;function a(c){let u=0,f=0,h=0;for(let M=0;M<9;M++)i.probe[M].set(0,0,0);let p=0,g=0,_=0,m=0,d=0,x=0,v=0,y=0,b=0,w=0,T=0;c.sort(LV);for(let M=0,S=c.length;M0&&(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]=f,i.ambient[2]=h;const C=i.hash;(C.directionalLength!==p||C.pointLength!==g||C.spotLength!==_||C.rectAreaLength!==m||C.hemiLength!==d||C.numDirectionalShadows!==x||C.numPointShadows!==v||C.numSpotShadows!==y||C.numSpotMaps!==b||C.numLightProbes!==T)&&(i.directional.length=p,i.spot.length=_,i.rectArea.length=m,i.point.length=g,i.hemi.length=d,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=v,i.pointShadowMap.length=v,i.spotShadow.length=y,i.spotShadowMap.length=y,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=v,i.spotLightMatrix.length=y+b-w,i.spotLightMap.length=b,i.numSpotLightShadowsWithMaps=w,i.numLightProbes=T,C.directionalLength=p,C.pointLength=g,C.spotLength=_,C.rectAreaLength=m,C.hemiLength=d,C.numDirectionalShadows=x,C.numPointShadows=v,C.numSpotShadows=y,C.numSpotMaps=b,C.numLightProbes=T,i.version=PV++)}function l(c,u){let f=0,h=0,p=0,g=0,_=0;const m=u.matrixWorldInverse;for(let d=0,x=c.length;d=o.length?(a=new S3(n),o.push(a)):a=o[s],a}function i(){e=new WeakMap}return{get:t,dispose:i}}class NV extends Od{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=CF,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 UV extends Od{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 OV=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,FV=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function kV(n,e,t){let i=new lR;const r=new At,s=new At,o=new On,a=new NV({depthPacking:PF}),l=new UV,c={},u=t.maxTextureSize,f={[eo]:Pi,[Pi]:eo,[is]:is},h=new ha({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new At},radius:{value:4}},vertexShader:OV,fragmentShader:FV}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const g=new gi;g.setAttribute("position",new us(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Xe(g,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Bb;let d=this.type;this.render=function(w,T,C){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||w.length===0)return;const M=n.getRenderTarget(),S=n.getActiveCubeFace(),P=n.getActiveMipmapLevel(),k=n.state;k.setBlending(Zo),k.buffers.color.setClear(1,1,1,1),k.buffers.depth.setTest(!0),k.setScissorTest(!1);const U=d!==Us&&this.type===Us,N=d===Us&&this.type!==Us;for(let X=0,z=w.length;Xu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/Z.x),r.x=s.x*Z.x,L.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/Z.y),r.y=s.y*Z.y,L.mapSize.y=s.y)),L.map===null||U===!0||N===!0){const fe=this.type!==Us?{minFilter:dr,magFilter:dr}:{};L.map!==null&&L.map.dispose(),L.map=new yl(r.x,r.y,fe),L.map.texture.name=te.name+".shadowMap",L.camera.updateProjectionMatrix()}n.setRenderTarget(L.map),n.clear();const ae=L.getViewportCount();for(let fe=0;fe0||T.map&&T.alphaTest>0){const k=S.uuid,U=T.uuid;let N=c[k];N===void 0&&(N={},c[k]=N);let X=N[U];X===void 0&&(X=S.clone(),N[U]=X,T.addEventListener("dispose",b)),S=X}if(S.visible=T.visible,S.wireframe=T.wireframe,M===Us?S.side=T.shadowSide!==null?T.shadowSide:T.side:S.side=T.shadowSide!==null?T.shadowSide:f[T.side],S.alphaMap=T.alphaMap,S.alphaTest=T.alphaTest,S.map=T.map,S.clipShadows=T.clipShadows,S.clippingPlanes=T.clippingPlanes,S.clipIntersection=T.clipIntersection,S.displacementMap=T.displacementMap,S.displacementScale=T.displacementScale,S.displacementBias=T.displacementBias,S.wireframeLinewidth=T.wireframeLinewidth,S.linewidth=T.linewidth,C.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const k=n.properties.get(S);k.light=C}return S}function y(w,T,C,M,S){if(w.visible===!1)return;if(w.layers.test(T.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&S===Us)&&(!w.frustumCulled||i.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,w.matrixWorld);const U=e.update(w),N=w.material;if(Array.isArray(N)){const X=U.groups;for(let z=0,te=X.length;z=1):te.indexOf("OpenGL ES")!==-1&&(z=parseFloat(/^OpenGL ES (\d)/.exec(te)[1]),X=z>=2);let L=null,Z={};const ae=n.getParameter(n.SCISSOR_BOX),fe=n.getParameter(n.VIEWPORT),Me=new On().fromArray(ae),Ve=new On().fromArray(fe);function $(J,H,re,q){const ie=new Uint8Array(4),xe=n.createTexture();n.bindTexture(J,xe),n.texParameteri(J,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(J,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let we=0;we"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new At,u=new WeakMap;let f;const h=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(B,E){return p?new OffscreenCanvas(B,E):vm("canvas")}function _(B,E,A){let F=1;const W=We(B);if((W.width>A||W.height>A)&&(F=A/Math.max(W.width,W.height)),F<1)if(typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&B instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&B instanceof ImageBitmap||typeof VideoFrame<"u"&&B instanceof VideoFrame){const j=Math.floor(F*W.width),le=Math.floor(F*W.height);f===void 0&&(f=g(j,le));const pe=E?g(j,le):f;return pe.width=j,pe.height=le,pe.getContext("2d").drawImage(B,0,0,j,le),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+W.width+"x"+W.height+") to ("+j+"x"+le+")."),pe}else return"data"in B&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+W.width+"x"+W.height+")."),B;return B}function m(B){return B.generateMipmaps&&B.minFilter!==dr&&B.minFilter!==Nr}function d(B){n.generateMipmap(B)}function x(B,E,A,F,W=!1){if(B!==null){if(n[B]!==void 0)return n[B];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+B+"'")}let j=E;if(E===n.RED&&(A===n.FLOAT&&(j=n.R32F),A===n.HALF_FLOAT&&(j=n.R16F),A===n.UNSIGNED_BYTE&&(j=n.R8)),E===n.RED_INTEGER&&(A===n.UNSIGNED_BYTE&&(j=n.R8UI),A===n.UNSIGNED_SHORT&&(j=n.R16UI),A===n.UNSIGNED_INT&&(j=n.R32UI),A===n.BYTE&&(j=n.R8I),A===n.SHORT&&(j=n.R16I),A===n.INT&&(j=n.R32I)),E===n.RG&&(A===n.FLOAT&&(j=n.RG32F),A===n.HALF_FLOAT&&(j=n.RG16F),A===n.UNSIGNED_BYTE&&(j=n.RG8)),E===n.RG_INTEGER&&(A===n.UNSIGNED_BYTE&&(j=n.RG8UI),A===n.UNSIGNED_SHORT&&(j=n.RG16UI),A===n.UNSIGNED_INT&&(j=n.RG32UI),A===n.BYTE&&(j=n.RG8I),A===n.SHORT&&(j=n.RG16I),A===n.INT&&(j=n.RG32I)),E===n.RGB&&A===n.UNSIGNED_INT_5_9_9_9_REV&&(j=n.RGB9_E5),E===n.RGBA){const le=W?pm:Lt.getTransfer(F);A===n.FLOAT&&(j=n.RGBA32F),A===n.HALF_FLOAT&&(j=n.RGBA16F),A===n.UNSIGNED_BYTE&&(j=le===$t?n.SRGB8_ALPHA8:n.RGBA8),A===n.UNSIGNED_SHORT_4_4_4_4&&(j=n.RGBA4),A===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 v(B,E){let A;return B?E===null||E===xl||E===gu?A=n.DEPTH24_STENCIL8:E===$s?A=n.DEPTH32F_STENCIL8:E===od&&(A=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):E===null||E===xl||E===gu?A=n.DEPTH_COMPONENT24:E===$s?A=n.DEPTH_COMPONENT32F:E===od&&(A=n.DEPTH_COMPONENT16),A}function y(B,E){return m(B)===!0||B.isFramebufferTexture&&B.minFilter!==dr&&B.minFilter!==Nr?Math.log2(Math.max(E.width,E.height))+1:B.mipmaps!==void 0&&B.mipmaps.length>0?B.mipmaps.length:B.isCompressedTexture&&Array.isArray(B.image)?E.mipmaps.length:1}function b(B){const E=B.target;E.removeEventListener("dispose",b),T(E),E.isVideoTexture&&u.delete(E)}function w(B){const E=B.target;E.removeEventListener("dispose",w),M(E)}function T(B){const E=i.get(B);if(E.__webglInit===void 0)return;const A=B.source,F=h.get(A);if(F){const W=F[E.__cacheKey];W.usedTimes--,W.usedTimes===0&&C(B),Object.keys(F).length===0&&h.delete(A)}i.remove(B)}function C(B){const E=i.get(B);n.deleteTexture(E.__webglTexture);const A=B.source,F=h.get(A);delete F[E.__cacheKey],o.memory.textures--}function M(B){const E=i.get(B);if(B.depthTexture&&B.depthTexture.dispose(),B.isWebGLCubeRenderTarget)for(let F=0;F<6;F++){if(Array.isArray(E.__webglFramebuffer[F]))for(let W=0;W=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+B+" texture units while this GPU supports only "+r.maxTextures),S+=1,B}function U(B){const E=[];return E.push(B.wrapS),E.push(B.wrapT),E.push(B.wrapR||0),E.push(B.magFilter),E.push(B.minFilter),E.push(B.anisotropy),E.push(B.internalFormat),E.push(B.format),E.push(B.type),E.push(B.generateMipmaps),E.push(B.premultiplyAlpha),E.push(B.flipY),E.push(B.unpackAlignment),E.push(B.colorSpace),E.join()}function N(B,E){const A=i.get(B);if(B.isVideoTexture&&Ze(B),B.isRenderTargetTexture===!1&&B.version>0&&A.__version!==B.version){const F=B.image;if(F===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(F.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ve(A,B,E);return}}t.bindTexture(n.TEXTURE_2D,A.__webglTexture,n.TEXTURE0+E)}function X(B,E){const A=i.get(B);if(B.version>0&&A.__version!==B.version){Ve(A,B,E);return}t.bindTexture(n.TEXTURE_2D_ARRAY,A.__webglTexture,n.TEXTURE0+E)}function z(B,E){const A=i.get(B);if(B.version>0&&A.__version!==B.version){Ve(A,B,E);return}t.bindTexture(n.TEXTURE_3D,A.__webglTexture,n.TEXTURE0+E)}function te(B,E){const A=i.get(B);if(B.version>0&&A.__version!==B.version){$(A,B,E);return}t.bindTexture(n.TEXTURE_CUBE_MAP,A.__webglTexture,n.TEXTURE0+E)}const L={[e1]:n.REPEAT,[tl]:n.CLAMP_TO_EDGE,[t1]:n.MIRRORED_REPEAT},Z={[dr]:n.NEAREST,[RF]:n.NEAREST_MIPMAP_NEAREST,[Eh]:n.NEAREST_MIPMAP_LINEAR,[Nr]:n.LINEAR,[Ag]:n.LINEAR_MIPMAP_NEAREST,[nl]:n.LINEAR_MIPMAP_LINEAR},ae={[DF]:n.NEVER,[BF]:n.ALWAYS,[NF]:n.LESS,[Qb]:n.LEQUAL,[UF]:n.EQUAL,[kF]:n.GEQUAL,[OF]:n.GREATER,[FF]:n.NOTEQUAL};function fe(B,E){if(E.type===$s&&e.has("OES_texture_float_linear")===!1&&(E.magFilter===Nr||E.magFilter===Ag||E.magFilter===Eh||E.magFilter===nl||E.minFilter===Nr||E.minFilter===Ag||E.minFilter===Eh||E.minFilter===nl)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(B,n.TEXTURE_WRAP_S,L[E.wrapS]),n.texParameteri(B,n.TEXTURE_WRAP_T,L[E.wrapT]),(B===n.TEXTURE_3D||B===n.TEXTURE_2D_ARRAY)&&n.texParameteri(B,n.TEXTURE_WRAP_R,L[E.wrapR]),n.texParameteri(B,n.TEXTURE_MAG_FILTER,Z[E.magFilter]),n.texParameteri(B,n.TEXTURE_MIN_FILTER,Z[E.minFilter]),E.compareFunction&&(n.texParameteri(B,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(B,n.TEXTURE_COMPARE_FUNC,ae[E.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(E.magFilter===dr||E.minFilter!==Eh&&E.minFilter!==nl||E.type===$s&&e.has("OES_texture_float_linear")===!1)return;if(E.anisotropy>1||i.get(E).__currentAnisotropy){const A=e.get("EXT_texture_filter_anisotropic");n.texParameterf(B,A.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(E.anisotropy,r.getMaxAnisotropy())),i.get(E).__currentAnisotropy=E.anisotropy}}}function Me(B,E){let A=!1;B.__webglInit===void 0&&(B.__webglInit=!0,E.addEventListener("dispose",b));const F=E.source;let W=h.get(F);W===void 0&&(W={},h.set(F,W));const j=U(E);if(j!==B.__cacheKey){W[j]===void 0&&(W[j]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,A=!0),W[j].usedTimes++;const le=W[B.__cacheKey];le!==void 0&&(W[B.__cacheKey].usedTimes--,le.usedTimes===0&&C(E)),B.__cacheKey=j,B.__webglTexture=W[j].texture}return A}function Ve(B,E,A){let F=n.TEXTURE_2D;(E.isDataArrayTexture||E.isCompressedArrayTexture)&&(F=n.TEXTURE_2D_ARRAY),E.isData3DTexture&&(F=n.TEXTURE_3D);const W=Me(B,E),j=E.source;t.bindTexture(F,B.__webglTexture,n.TEXTURE0+A);const le=i.get(j);if(j.version!==le.__version||W===!0){t.activeTexture(n.TEXTURE0+A);const pe=Lt.getPrimaries(Lt.workingColorSpace),ce=E.colorSpace===zo?null:Lt.getPrimaries(E.colorSpace),Ee=E.colorSpace===zo||pe===ce?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,E.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,E.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,E.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ee);let ve=_(E.image,!1,r.maxTextureSize);ve=Ie(E,ve);const ue=s.convert(E.format,E.colorSpace),Re=s.convert(E.type);let Pe=x(E.internalFormat,ue,Re,E.colorSpace,E.isVideoTexture);fe(F,E);let ye;const Se=E.mipmaps,Be=E.isVideoTexture!==!0,je=le.__version===void 0||W===!0,J=j.dataReady,H=y(E,ve);if(E.isDepthTexture)Pe=v(E.format===_u,E.type),je&&(Be?t.texStorage2D(n.TEXTURE_2D,1,Pe,ve.width,ve.height):t.texImage2D(n.TEXTURE_2D,0,Pe,ve.width,ve.height,0,ue,Re,null));else if(E.isDataTexture)if(Se.length>0){Be&&je&&t.texStorage2D(n.TEXTURE_2D,H,Pe,Se[0].width,Se[0].height);for(let re=0,q=Se.length;re0){const ie=M3(ye.width,ye.height,E.format,E.type);for(const xe of E.layerUpdates){const we=ye.data.subarray(xe*ie/ye.data.BYTES_PER_ELEMENT,(xe+1)*ie/ye.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,re,0,0,xe,ye.width,ye.height,1,ue,we,0,0)}E.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,re,0,0,0,ye.width,ye.height,ve.depth,ue,ye.data,0,0)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,re,Pe,ye.width,ye.height,ve.depth,0,ye.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Be?J&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,re,0,0,0,ye.width,ye.height,ve.depth,ue,Re,ye.data):t.texImage3D(n.TEXTURE_2D_ARRAY,re,Pe,ye.width,ye.height,ve.depth,0,ue,Re,ye.data)}else{Be&&je&&t.texStorage2D(n.TEXTURE_2D,H,Pe,Se[0].width,Se[0].height);for(let re=0,q=Se.length;re0){const re=M3(ve.width,ve.height,E.format,E.type);for(const q of E.layerUpdates){const ie=ve.data.subarray(q*re/ve.data.BYTES_PER_ELEMENT,(q+1)*re/ve.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,q,ve.width,ve.height,1,ue,Re,ie)}E.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ve.width,ve.height,ve.depth,ue,Re,ve.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Pe,ve.width,ve.height,ve.depth,0,ue,Re,ve.data);else if(E.isData3DTexture)Be?(je&&t.texStorage3D(n.TEXTURE_3D,H,Pe,ve.width,ve.height,ve.depth),J&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ve.width,ve.height,ve.depth,ue,Re,ve.data)):t.texImage3D(n.TEXTURE_3D,0,Pe,ve.width,ve.height,ve.depth,0,ue,Re,ve.data);else if(E.isFramebufferTexture){if(je)if(Be)t.texStorage2D(n.TEXTURE_2D,H,Pe,ve.width,ve.height);else{let re=ve.width,q=ve.height;for(let ie=0;ie>=1,q>>=1}}else if(Se.length>0){if(Be&&je){const re=We(Se[0]);t.texStorage2D(n.TEXTURE_2D,H,Pe,re.width,re.height)}for(let re=0,q=Se.length;re0&&H++;const q=We(ue[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,H,Se,q.width,q.height)}for(let q=0;q<6;q++)if(ve){Be?J&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,0,0,ue[q].width,ue[q].height,Pe,ye,ue[q].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,Se,ue[q].width,ue[q].height,0,Pe,ye,ue[q].data);for(let ie=0;ie>j),ue=Math.max(1,E.height>>j);W===n.TEXTURE_3D||W===n.TEXTURE_2D_ARRAY?t.texImage3D(W,j,ce,ve,ue,E.depth,0,le,pe,null):t.texImage2D(W,j,ce,ve,ue,0,le,pe,null)}t.bindFramebuffer(n.FRAMEBUFFER,B),Ne(E)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,F,W,i.get(A).__webglTexture,0,at(E)):(W===n.TEXTURE_2D||W>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&W<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,F,W,i.get(A).__webglTexture,j),t.bindFramebuffer(n.FRAMEBUFFER,null)}function me(B,E,A){if(n.bindRenderbuffer(n.RENDERBUFFER,B),E.depthBuffer){const F=E.depthTexture,W=F&&F.isDepthTexture?F.type:null,j=v(E.stencilBuffer,W),le=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pe=at(E);Ne(E)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,pe,j,E.width,E.height):A?n.renderbufferStorageMultisample(n.RENDERBUFFER,pe,j,E.width,E.height):n.renderbufferStorage(n.RENDERBUFFER,j,E.width,E.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,le,n.RENDERBUFFER,B)}else{const F=E.textures;for(let W=0;W{delete E.__boundDepthTexture,delete E.__depthDisposeCallback,F.removeEventListener("dispose",W)};F.addEventListener("dispose",W),E.__depthDisposeCallback=W}E.__boundDepthTexture=F}if(B.depthTexture&&!E.__autoAllocateDepthBuffer){if(A)throw new Error("target.depthTexture not supported in Cube render targets");de(E.__webglFramebuffer,B)}else if(A){E.__webglDepthbuffer=[];for(let F=0;F<6;F++)if(t.bindFramebuffer(n.FRAMEBUFFER,E.__webglFramebuffer[F]),E.__webglDepthbuffer[F]===void 0)E.__webglDepthbuffer[F]=n.createRenderbuffer(),me(E.__webglDepthbuffer[F],B,!1);else{const W=B.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,j=E.__webglDepthbuffer[F];n.bindRenderbuffer(n.RENDERBUFFER,j),n.framebufferRenderbuffer(n.FRAMEBUFFER,W,n.RENDERBUFFER,j)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,E.__webglFramebuffer),E.__webglDepthbuffer===void 0)E.__webglDepthbuffer=n.createRenderbuffer(),me(E.__webglDepthbuffer,B,!1);else{const F=B.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,W=E.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,W),n.framebufferRenderbuffer(n.FRAMEBUFFER,F,n.RENDERBUFFER,W)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function Le(B,E,A){const F=i.get(B);E!==void 0&&oe(F.__webglFramebuffer,B,B.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),A!==void 0&&be(B)}function ke(B){const E=B.texture,A=i.get(B),F=i.get(E);B.addEventListener("dispose",w);const W=B.textures,j=B.isWebGLCubeRenderTarget===!0,le=W.length>1;if(le||(F.__webglTexture===void 0&&(F.__webglTexture=n.createTexture()),F.__version=E.version,o.memory.textures++),j){A.__webglFramebuffer=[];for(let pe=0;pe<6;pe++)if(E.mipmaps&&E.mipmaps.length>0){A.__webglFramebuffer[pe]=[];for(let ce=0;ce0){A.__webglFramebuffer=[];for(let pe=0;pe0&&Ne(B)===!1){A.__webglMultisampledFramebuffer=n.createFramebuffer(),A.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,A.__webglMultisampledFramebuffer);for(let pe=0;pe0)for(let ce=0;ce0)for(let ce=0;ce0){if(Ne(B)===!1){const E=B.textures,A=B.width,F=B.height;let W=n.COLOR_BUFFER_BIT;const j=B.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,le=i.get(B),pe=E.length>1;if(pe)for(let ce=0;ce0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&E.__useRenderToTexture!==!1}function Ze(B){const E=o.render.frame;u.get(B)!==E&&(u.set(B,E),B.update())}function Ie(B,E){const A=B.colorSpace,F=B.format,W=B.type;return B.isCompressedTexture===!0||B.isVideoTexture===!0||A!==ga&&A!==zo&&(Lt.getTransfer(A)===$t?(F!==kr||W!==to)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",A)),E}function We(B){return typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement?(c.width=B.naturalWidth||B.width,c.height=B.naturalHeight||B.height):typeof VideoFrame<"u"&&B instanceof VideoFrame?(c.width=B.displayWidth,c.height=B.displayHeight):(c.width=B.width,c.height=B.height),c}this.allocateTextureUnit=k,this.resetTextureUnits=P,this.setTexture2D=N,this.setTexture2DArray=X,this.setTexture3D=z,this.setTextureCube=te,this.rebindTextures=Le,this.setupRenderTarget=ke,this.updateRenderTargetMipmap=Qe,this.updateMultisampleRenderTarget=ee,this.setupDepthRenderbuffer=be,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=Ne}function VV(n,e){function t(i,r=zo){let s;const o=Lt.getTransfer(r);if(i===to)return n.UNSIGNED_BYTE;if(i===by)return n.UNSIGNED_SHORT_4_4_4_4;if(i===Ry)return n.UNSIGNED_SHORT_5_5_5_1;if(i===Wb)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===Vb)return n.BYTE;if(i===Gb)return n.SHORT;if(i===od)return n.UNSIGNED_SHORT;if(i===Ay)return n.INT;if(i===xl)return n.UNSIGNED_INT;if(i===$s)return n.FLOAT;if(i===Dd)return n.HALF_FLOAT;if(i===$b)return n.ALPHA;if(i===Xb)return n.RGB;if(i===kr)return n.RGBA;if(i===jb)return n.LUMINANCE;if(i===qb)return n.LUMINANCE_ALPHA;if(i===zc)return n.DEPTH_COMPONENT;if(i===_u)return n.DEPTH_STENCIL;if(i===Yb)return n.RED;if(i===Cy)return n.RED_INTEGER;if(i===Kb)return n.RG;if(i===Py)return n.RG_INTEGER;if(i===Ly)return n.RGBA_INTEGER;if(i===Dp||i===Np||i===Up||i===Op)if(o===$t)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Dp)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Np)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Up)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Op)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Dp)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Np)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Up)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Op)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===n1||i===i1||i===r1||i===s1)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===n1)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===i1)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===r1)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===s1)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===o1||i===a1||i===l1)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===o1||i===a1)return o===$t?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===l1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===c1||i===u1||i===f1||i===d1||i===h1||i===p1||i===m1||i===g1||i===_1||i===v1||i===x1||i===y1||i===S1||i===M1)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===c1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===u1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===f1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===d1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===h1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===p1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===m1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===g1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===_1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===v1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===x1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===y1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===S1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===M1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Fp||i===E1||i===w1)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Fp)return o===$t?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===E1)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===w1)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Zb||i===T1||i===A1||i===b1)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Fp)return s.COMPRESSED_RED_RGTC1_EXT;if(i===T1)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===A1)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===b1)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===gu?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}class GV extends lr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class yc extends Vn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const WV={type:"move"};class Jg{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new yc,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 yc,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ne,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ne),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new yc,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ne,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ne),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,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const _ of e.hand.values()){const m=t.getJointPose(_,i),d=this._getHandJoint(c,_);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"],f=c.joints["thumb-tip"],h=u.position.distanceTo(f.position),p=.02,g=.005;c.inputState.pinching&&h>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-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));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(WV)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new yc;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const $V=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,XV=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class jV{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new Li,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new ha({vertexShader:$V,fragmentShader:XV,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Xe(new kd(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class qV extends Iu{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,h=null,p=null,g=null;const _=new jV,m=t.getContextAttributes();let d=null,x=null;const v=[],y=[],b=new At;let w=null;const T=new lr;T.layers.enable(1),T.viewport=new On;const C=new lr;C.layers.enable(2),C.viewport=new On;const M=[T,C],S=new GV;S.layers.enable(1),S.layers.enable(2);let P=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function($){let oe=v[$];return oe===void 0&&(oe=new Jg,v[$]=oe),oe.getTargetRaySpace()},this.getControllerGrip=function($){let oe=v[$];return oe===void 0&&(oe=new Jg,v[$]=oe),oe.getGripSpace()},this.getHand=function($){let oe=v[$];return oe===void 0&&(oe=new Jg,v[$]=oe),oe.getHandSpace()};function U($){const oe=y.indexOf($.inputSource);if(oe===-1)return;const me=v[oe];me!==void 0&&(me.update($.inputSource,$.frame,c||o),me.dispatchEvent({type:$.type,data:$.inputSource}))}function N(){r.removeEventListener("select",U),r.removeEventListener("selectstart",U),r.removeEventListener("selectend",U),r.removeEventListener("squeeze",U),r.removeEventListener("squeezestart",U),r.removeEventListener("squeezeend",U),r.removeEventListener("end",N),r.removeEventListener("inputsourceschange",X);for(let $=0;$=0&&(y[de]=null,v[de].disconnect(me))}for(let oe=0;oe<$.added.length;oe++){const me=$.added[oe];let de=y.indexOf(me);if(de===-1){for(let Le=0;Le=y.length){y.push(me),de=Le;break}else if(y[Le]===null){y[Le]=me,de=Le;break}if(de===-1)break}const be=v[de];be&&be.connect(me)}}const z=new ne,te=new ne;function L($,oe,me){z.setFromMatrixPosition(oe.matrixWorld),te.setFromMatrixPosition(me.matrixWorld);const de=z.distanceTo(te),be=oe.projectionMatrix.elements,Le=me.projectionMatrix.elements,ke=be[14]/(be[10]-1),Qe=be[14]/(be[10]+1),V=(be[9]+1)/be[5],ot=(be[9]-1)/be[5],ee=(be[8]-1)/be[0],at=(Le[8]+1)/Le[0],Ne=ke*ee,Ze=ke*at,Ie=de/(-ee+at),We=Ie*-ee;if(oe.matrixWorld.decompose($.position,$.quaternion,$.scale),$.translateX(We),$.translateZ(Ie),$.matrixWorld.compose($.position,$.quaternion,$.scale),$.matrixWorldInverse.copy($.matrixWorld).invert(),be[10]===-1)$.projectionMatrix.copy(oe.projectionMatrix),$.projectionMatrixInverse.copy(oe.projectionMatrixInverse);else{const B=ke+Ie,E=Qe+Ie,A=Ne-We,F=Ze+(de-We),W=V*Qe/E*B,j=ot*Qe/E*B;$.projectionMatrix.makePerspective(A,F,W,j,B,E),$.projectionMatrixInverse.copy($.projectionMatrix).invert()}}function Z($,oe){oe===null?$.matrixWorld.copy($.matrix):$.matrixWorld.multiplyMatrices(oe.matrixWorld,$.matrix),$.matrixWorldInverse.copy($.matrixWorld).invert()}this.updateCamera=function($){if(r===null)return;let oe=$.near,me=$.far;_.texture!==null&&(_.depthNear>0&&(oe=_.depthNear),_.depthFar>0&&(me=_.depthFar)),S.near=C.near=T.near=oe,S.far=C.far=T.far=me,(P!==S.near||k!==S.far)&&(r.updateRenderState({depthNear:S.near,depthFar:S.far}),P=S.near,k=S.far);const de=$.parent,be=S.cameras;Z(S,de);for(let Le=0;Le0&&(m.alphaTest.value=d.alphaTest);const x=e.get(d),v=x.envMap,y=x.envMapRotation;v&&(m.envMap.value=v,Fa.copy(y),Fa.x*=-1,Fa.y*=-1,Fa.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Fa.y*=-1,Fa.z*=-1),m.envMapRotation.value.setFromMatrix4(YV.makeRotationFromEuler(Fa)),m.flipEnvMap.value=v.isCubeTexture&&v.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 o(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 a(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function l(m,d,x,v){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*x,m.scale.value=v*.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 f(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 p(m,d,x){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===Pi&&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=x.texture,m.transmissionSamplerSize.value.set(x.width,x.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 _(m,d){const x=e.get(d).light;m.referencePosition.value.setFromMatrixPosition(x.matrixWorld),m.nearDistance.value=x.shadow.camera.near,m.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function ZV(n,e,t,i){let r={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(x,v){const y=v.program;i.uniformBlockBinding(x,y)}function c(x,v){let y=r[x.id];y===void 0&&(g(x),y=u(x),r[x.id]=y,x.addEventListener("dispose",m));const b=v.program;i.updateUBOMapping(x,b);const w=e.render.frame;s[x.id]!==w&&(h(x),s[x.id]=w)}function u(x){const v=f();x.__bindingPointIndex=v;const y=n.createBuffer(),b=x.__size,w=x.usage;return n.bindBuffer(n.UNIFORM_BUFFER,y),n.bufferData(n.UNIFORM_BUFFER,b,w),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,v,y),y}function f(){for(let x=0;x0&&(y+=b-w),x.__size=y,x.__cache={},this}function _(x){const v={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(v.boundary=4,v.storage=4):x.isVector2?(v.boundary=8,v.storage=8):x.isVector3||x.isColor?(v.boundary=16,v.storage=12):x.isVector4?(v.boundary=16,v.storage=16):x.isMatrix3?(v.boundary=48,v.storage=48):x.isMatrix4?(v.boundary=64,v.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),v}function m(x){const v=x.target;v.removeEventListener("dispose",m);const y=o.indexOf(v.__bindingPointIndex);o.splice(y,1),n.deleteBuffer(r[v.id]),delete r[v.id],delete s[v.id]}function d(){for(const x in r)n.deleteBuffer(r[x]);o=[],r={},s={}}return{bind:l,update:c,dispose:d}}class QV{constructor(e={}){const{canvas:t=HF(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let h;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");h=i.getContextAttributes().alpha}else h=o;const p=new Uint32Array(4),g=new Int32Array(4);let _=null,m=null;const d=[],x=[];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._outputColorSpace=Jr,this.toneMapping=Qo,this.toneMappingExposure=1;const v=this;let y=!1,b=0,w=0,T=null,C=-1,M=null;const S=new On,P=new On;let k=null;const U=new Ut(0);let N=0,X=t.width,z=t.height,te=1,L=null,Z=null;const ae=new On(0,0,X,z),fe=new On(0,0,X,z);let Me=!1;const Ve=new lR;let $=!1,oe=!1;const me=new sn,de=new ne,be=new On,Le={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ke=!1;function Qe(){return T===null?te:1}let V=i;function ot(I,se){return t.getContext(I,se)}try{const I={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ty}`),t.addEventListener("webglcontextlost",re,!1),t.addEventListener("webglcontextrestored",q,!1),t.addEventListener("webglcontextcreationerror",ie,!1),V===null){const se="webgl2";if(V=ot(se,I),V===null)throw ot(se)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(I){throw console.error("THREE.WebGLRenderer: "+I.message),I}let ee,at,Ne,Ze,Ie,We,B,E,A,F,W,j,le,pe,ce,Ee,ve,ue,Re,Pe,ye,Se,Be,je;function J(){ee=new rH(V),ee.init(),Se=new VV(V,ee),at=new Zz(V,ee,e,Se),Ne=new BV(V),Ze=new aH(V),Ie=new TV,We=new HV(V,ee,Ne,Ie,at,Se,Ze),B=new Jz(v),E=new iH(v),A=new hk(V),Be=new Yz(V,A),F=new sH(V,A,Ze,Be),W=new cH(V,F,A,Ze),Re=new lH(V,at,We),Ee=new Qz(Ie),j=new wV(v,B,E,ee,at,Be,Ee),le=new KV(v,Ie),pe=new bV,ce=new DV(ee),ue=new qz(v,B,E,Ne,W,h,l),ve=new kV(v,W,at),je=new ZV(V,Ze,at,Ne),Pe=new Kz(V,ee,Ze),ye=new oH(V,ee,Ze),Ze.programs=j.programs,v.capabilities=at,v.extensions=ee,v.properties=Ie,v.renderLists=pe,v.shadowMap=ve,v.state=Ne,v.info=Ze}J();const H=new qV(v,V);this.xr=H,this.getContext=function(){return V},this.getContextAttributes=function(){return V.getContextAttributes()},this.forceContextLoss=function(){const I=ee.get("WEBGL_lose_context");I&&I.loseContext()},this.forceContextRestore=function(){const I=ee.get("WEBGL_lose_context");I&&I.restoreContext()},this.getPixelRatio=function(){return te},this.setPixelRatio=function(I){I!==void 0&&(te=I,this.setSize(X,z,!1))},this.getSize=function(I){return I.set(X,z)},this.setSize=function(I,se,R=!0){if(H.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}X=I,z=se,t.width=Math.floor(I*te),t.height=Math.floor(se*te),R===!0&&(t.style.width=I+"px",t.style.height=se+"px"),this.setViewport(0,0,I,se)},this.getDrawingBufferSize=function(I){return I.set(X*te,z*te).floor()},this.setDrawingBufferSize=function(I,se,R){X=I,z=se,te=R,t.width=Math.floor(I*R),t.height=Math.floor(se*R),this.setViewport(0,0,I,se)},this.getCurrentViewport=function(I){return I.copy(S)},this.getViewport=function(I){return I.copy(ae)},this.setViewport=function(I,se,R,D){I.isVector4?ae.set(I.x,I.y,I.z,I.w):ae.set(I,se,R,D),Ne.viewport(S.copy(ae).multiplyScalar(te).round())},this.getScissor=function(I){return I.copy(fe)},this.setScissor=function(I,se,R,D){I.isVector4?fe.set(I.x,I.y,I.z,I.w):fe.set(I,se,R,D),Ne.scissor(P.copy(fe).multiplyScalar(te).round())},this.getScissorTest=function(){return Me},this.setScissorTest=function(I){Ne.setScissorTest(Me=I)},this.setOpaqueSort=function(I){L=I},this.setTransparentSort=function(I){Z=I},this.getClearColor=function(I){return I.copy(ue.getClearColor())},this.setClearColor=function(){ue.setClearColor.apply(ue,arguments)},this.getClearAlpha=function(){return ue.getClearAlpha()},this.setClearAlpha=function(){ue.setClearAlpha.apply(ue,arguments)},this.clear=function(I=!0,se=!0,R=!0){let D=0;if(I){let O=!1;if(T!==null){const K=T.texture.format;O=K===Ly||K===Py||K===Cy}if(O){const K=T.texture.type,G=K===to||K===xl||K===od||K===gu||K===by||K===Ry,he=ue.getClearColor(),ge=ue.getClearAlpha(),Te=he.r,Ae=he.g,Ce=he.b;G?(p[0]=Te,p[1]=Ae,p[2]=Ce,p[3]=ge,V.clearBufferuiv(V.COLOR,0,p)):(g[0]=Te,g[1]=Ae,g[2]=Ce,g[3]=ge,V.clearBufferiv(V.COLOR,0,g))}else D|=V.COLOR_BUFFER_BIT}se&&(D|=V.DEPTH_BUFFER_BIT),R&&(D|=V.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),V.clear(D)},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",re,!1),t.removeEventListener("webglcontextrestored",q,!1),t.removeEventListener("webglcontextcreationerror",ie,!1),pe.dispose(),ce.dispose(),Ie.dispose(),B.dispose(),E.dispose(),W.dispose(),Be.dispose(),je.dispose(),j.dispose(),H.dispose(),H.removeEventListener("sessionstart",Kt),H.removeEventListener("sessionend",ri),Oi.stop()};function re(I){I.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function q(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const I=Ze.autoReset,se=ve.enabled,R=ve.autoUpdate,D=ve.needsUpdate,O=ve.type;J(),Ze.autoReset=I,ve.enabled=se,ve.autoUpdate=R,ve.needsUpdate=D,ve.type=O}function ie(I){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",I.statusMessage)}function xe(I){const se=I.target;se.removeEventListener("dispose",xe),we(se)}function we(I){Ye(I),Ie.remove(I)}function Ye(I){const se=Ie.get(I).programs;se!==void 0&&(se.forEach(function(R){j.releaseProgram(R)}),I.isShaderMaterial&&j.releaseShaderCache(I))}this.renderBufferDirect=function(I,se,R,D,O,K){se===null&&(se=Le);const G=O.isMesh&&O.matrixWorld.determinant()<0,he=ya(I,se,R,D,O);Ne.setMaterial(D,G);let ge=R.index,Te=1;if(D.wireframe===!0){if(ge=F.getWireframeAttribute(R),ge===void 0)return;Te=2}const Ae=R.drawRange,Ce=R.attributes.position;let Ge=Ae.start*Te,Oe=(Ae.start+Ae.count)*Te;K!==null&&(Ge=Math.max(Ge,K.start*Te),Oe=Math.min(Oe,(K.start+K.count)*Te)),ge!==null?(Ge=Math.max(Ge,0),Oe=Math.min(Oe,ge.count)):Ce!=null&&(Ge=Math.max(Ge,0),Oe=Math.min(Oe,Ce.count));const nt=Oe-Ge;if(nt<0||nt===1/0)return;Be.setup(O,D,he,R,ge);let ht,Je=Pe;if(ge!==null&&(ht=A.get(ge),Je=ye,Je.setIndex(ht)),O.isMesh)D.wireframe===!0?(Ne.setLineWidth(D.wireframeLinewidth*Qe()),Je.setMode(V.LINES)):Je.setMode(V.TRIANGLES);else if(O.isLine){let $e=D.linewidth;$e===void 0&&($e=1),Ne.setLineWidth($e*Qe()),O.isLineSegments?Je.setMode(V.LINES):O.isLineLoop?Je.setMode(V.LINE_LOOP):Je.setMode(V.LINE_STRIP)}else O.isPoints?Je.setMode(V.POINTS):O.isSprite&&Je.setMode(V.TRIANGLES);if(O.isBatchedMesh)if(O._multiDrawInstances!==null)Je.renderMultiDrawInstances(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount,O._multiDrawInstances);else if(ee.get("WEBGL_multi_draw"))Je.renderMultiDraw(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount);else{const $e=O._multiDrawStarts,rt=O._multiDrawCounts,Ue=O._multiDrawCount,dn=ge?A.get(ge).bytesPerElement:1,yt=Ie.get(D).currentProgram.getUniforms();for(let Vt=0;Vt{function K(){if(D.forEach(function(G){Ie.get(G).currentProgram.isReady()&&D.delete(G)}),D.size===0){O(I);return}setTimeout(K,10)}ee.get("KHR_parallel_shader_compile")!==null?K():setTimeout(K,10)})};let it=null;function ft(I){it&&it(I)}function Kt(){Oi.stop()}function ri(){Oi.start()}const Oi=new cR;Oi.setAnimationLoop(ft),typeof self<"u"&&Oi.setContext(self),this.setAnimationLoop=function(I){it=I,H.setAnimationLoop(I),I===null?Oi.stop():Oi.start()},H.addEventListener("sessionstart",Kt),H.addEventListener("sessionend",ri),this.render=function(I,se){if(se!==void 0&&se.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(y===!0)return;if(I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),se.parent===null&&se.matrixWorldAutoUpdate===!0&&se.updateMatrixWorld(),H.enabled===!0&&H.isPresenting===!0&&(H.cameraAutoUpdate===!0&&H.updateCamera(se),se=H.getCamera()),I.isScene===!0&&I.onBeforeRender(v,I,se,T),m=ce.get(I,x.length),m.init(se),x.push(m),me.multiplyMatrices(se.projectionMatrix,se.matrixWorldInverse),Ve.setFromProjectionMatrix(me),oe=this.localClippingEnabled,$=Ee.init(this.clippingPlanes,oe),_=pe.get(I,d.length),_.init(),d.push(_),H.enabled===!0&&H.isPresenting===!0){const K=v.xr.getDepthSensingMesh();K!==null&&xs(K,se,-1/0,v.sortObjects)}xs(I,se,0,v.sortObjects),_.finish(),v.sortObjects===!0&&_.sort(L,Z),ke=H.enabled===!1||H.isPresenting===!1||H.hasDepthSensing()===!1,ke&&ue.addToRenderList(_,I),this.info.render.frame++,$===!0&&Ee.beginShadows();const R=m.state.shadowsArray;ve.render(R,I,se),$===!0&&Ee.endShadows(),this.info.autoReset===!0&&this.info.reset();const D=_.opaque,O=_.transmissive;if(m.setupLights(),se.isArrayCamera){const K=se.cameras;if(O.length>0)for(let G=0,he=K.length;G0&&ys(D,O,I,se),ke&&ue.render(I),ir(_,I,se);T!==null&&(We.updateMultisampleRenderTarget(T),We.updateRenderTargetMipmap(T)),I.isScene===!0&&I.onAfterRender(v,I,se),Be.resetDefaultState(),C=-1,M=null,x.pop(),x.length>0?(m=x[x.length-1],$===!0&&Ee.setGlobalState(v.clippingPlanes,m.state.camera)):m=null,d.pop(),d.length>0?_=d[d.length-1]:_=null};function xs(I,se,R,D){if(I.visible===!1)return;if(I.layers.test(se.layers)){if(I.isGroup)R=I.renderOrder;else if(I.isLOD)I.autoUpdate===!0&&I.update(se);else if(I.isLight)m.pushLight(I),I.castShadow&&m.pushShadow(I);else if(I.isSprite){if(!I.frustumCulled||Ve.intersectsSprite(I)){D&&be.setFromMatrixPosition(I.matrixWorld).applyMatrix4(me);const G=W.update(I),he=I.material;he.visible&&_.push(I,G,he,R,be.z,null)}}else if((I.isMesh||I.isLine||I.isPoints)&&(!I.frustumCulled||Ve.intersectsObject(I))){const G=W.update(I),he=I.material;if(D&&(I.boundingSphere!==void 0?(I.boundingSphere===null&&I.computeBoundingSphere(),be.copy(I.boundingSphere.center)):(G.boundingSphere===null&&G.computeBoundingSphere(),be.copy(G.boundingSphere.center)),be.applyMatrix4(I.matrixWorld).applyMatrix4(me)),Array.isArray(he)){const ge=G.groups;for(let Te=0,Ae=ge.length;Te0&&jr(O,se,R),K.length>0&&jr(K,se,R),G.length>0&&jr(G,se,R),Ne.buffers.depth.setTest(!0),Ne.buffers.depth.setMask(!0),Ne.buffers.color.setMask(!0),Ne.setPolygonOffset(!1)}function ys(I,se,R,D){if((R.isScene===!0?R.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[D.id]===void 0&&(m.state.transmissionRenderTarget[D.id]=new yl(1,1,{generateMipmaps:!0,type:ee.has("EXT_color_buffer_half_float")||ee.has("EXT_color_buffer_float")?Dd:to,minFilter:nl,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Lt.workingColorSpace}));const K=m.state.transmissionRenderTarget[D.id],G=D.viewport||S;K.setSize(G.z,G.w);const he=v.getRenderTarget();v.setRenderTarget(K),v.getClearColor(U),N=v.getClearAlpha(),N<1&&v.setClearColor(16777215,.5),v.clear(),ke&&ue.render(R);const ge=v.toneMapping;v.toneMapping=Qo;const Te=D.viewport;if(D.viewport!==void 0&&(D.viewport=void 0),m.setupLightsView(D),$===!0&&Ee.setGlobalState(v.clippingPlanes,D),jr(I,R,D),We.updateMultisampleRenderTarget(K),We.updateRenderTargetMipmap(K),ee.has("WEBGL_multisampled_render_to_texture")===!1){let Ae=!1;for(let Ce=0,Ge=se.length;Ce0),Ce=!!R.morphAttributes.position,Ge=!!R.morphAttributes.normal,Oe=!!R.morphAttributes.color;let nt=Qo;D.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(nt=v.toneMapping);const ht=R.morphAttributes.position||R.morphAttributes.normal||R.morphAttributes.color,Je=ht!==void 0?ht.length:0,$e=Ie.get(D),rt=m.state.lights;if($===!0&&(oe===!0||I!==M)){const tn=I===M&&D.id===C;Ee.setState(D,I,tn)}let Ue=!1;D.version===$e.__version?($e.needsLights&&$e.lightsStateVersion!==rt.state.version||$e.outputColorSpace!==he||O.isBatchedMesh&&$e.batching===!1||!O.isBatchedMesh&&$e.batching===!0||O.isBatchedMesh&&$e.batchingColor===!0&&O.colorTexture===null||O.isBatchedMesh&&$e.batchingColor===!1&&O.colorTexture!==null||O.isInstancedMesh&&$e.instancing===!1||!O.isInstancedMesh&&$e.instancing===!0||O.isSkinnedMesh&&$e.skinning===!1||!O.isSkinnedMesh&&$e.skinning===!0||O.isInstancedMesh&&$e.instancingColor===!0&&O.instanceColor===null||O.isInstancedMesh&&$e.instancingColor===!1&&O.instanceColor!==null||O.isInstancedMesh&&$e.instancingMorph===!0&&O.morphTexture===null||O.isInstancedMesh&&$e.instancingMorph===!1&&O.morphTexture!==null||$e.envMap!==ge||D.fog===!0&&$e.fog!==K||$e.numClippingPlanes!==void 0&&($e.numClippingPlanes!==Ee.numPlanes||$e.numIntersection!==Ee.numIntersection)||$e.vertexAlphas!==Te||$e.vertexTangents!==Ae||$e.morphTargets!==Ce||$e.morphNormals!==Ge||$e.morphColors!==Oe||$e.toneMapping!==nt||$e.morphTargetsCount!==Je)&&(Ue=!0):(Ue=!0,$e.__version=D.version);let dn=$e.currentProgram;Ue===!0&&(dn=yr(D,se,O));let yt=!1,Vt=!1,Yr=!1;const bt=dn.getUniforms(),xi=$e.uniforms;if(Ne.useProgram(dn.program)&&(yt=!0,Vt=!0,Yr=!0),D.id!==C&&(C=D.id,Vt=!0),yt||M!==I){bt.setValue(V,"projectionMatrix",I.projectionMatrix),bt.setValue(V,"viewMatrix",I.matrixWorldInverse);const tn=bt.map.cameraPosition;tn!==void 0&&tn.setValue(V,de.setFromMatrixPosition(I.matrixWorld)),at.logarithmicDepthBuffer&&bt.setValue(V,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2)),(D.isMeshPhongMaterial||D.isMeshToonMaterial||D.isMeshLambertMaterial||D.isMeshBasicMaterial||D.isMeshStandardMaterial||D.isShaderMaterial)&&bt.setValue(V,"isOrthographic",I.isOrthographicCamera===!0),M!==I&&(M=I,Vt=!0,Yr=!0)}if(O.isSkinnedMesh){bt.setOptional(V,O,"bindMatrix"),bt.setOptional(V,O,"bindMatrixInverse");const tn=O.skeleton;tn&&(tn.boneTexture===null&&tn.computeBoneTexture(),bt.setValue(V,"boneTexture",tn.boneTexture,We))}O.isBatchedMesh&&(bt.setOptional(V,O,"batchingTexture"),bt.setValue(V,"batchingTexture",O._matricesTexture,We),bt.setOptional(V,O,"batchingIdTexture"),bt.setValue(V,"batchingIdTexture",O._indirectTexture,We),bt.setOptional(V,O,"batchingColorTexture"),O._colorsTexture!==null&&bt.setValue(V,"batchingColorTexture",O._colorsTexture,We));const It=R.morphAttributes;if((It.position!==void 0||It.normal!==void 0||It.color!==void 0)&&Re.update(O,R,dn),(Vt||$e.receiveShadow!==O.receiveShadow)&&($e.receiveShadow=O.receiveShadow,bt.setValue(V,"receiveShadow",O.receiveShadow)),D.isMeshGouraudMaterial&&D.envMap!==null&&(xi.envMap.value=ge,xi.flipEnvMap.value=ge.isCubeTexture&&ge.isRenderTargetTexture===!1?-1:1),D.isMeshStandardMaterial&&D.envMap===null&&se.environment!==null&&(xi.envMapIntensity.value=se.environmentIntensity),Vt&&(bt.setValue(V,"toneMappingExposure",v.toneMappingExposure),$e.needsLights&&Ss(xi,Yr),K&&D.fog===!0&&le.refreshFogUniforms(xi,K),le.refreshMaterialUniforms(xi,D,te,z,m.state.transmissionRenderTarget[I.id]),kp.upload(V,uo($e),xi,We)),D.isShaderMaterial&&D.uniformsNeedUpdate===!0&&(kp.upload(V,uo($e),xi,We),D.uniformsNeedUpdate=!1),D.isSpriteMaterial&&bt.setValue(V,"center",O.center),bt.setValue(V,"modelViewMatrix",O.modelViewMatrix),bt.setValue(V,"normalMatrix",O.normalMatrix),bt.setValue(V,"modelMatrix",O.matrixWorld),D.isShaderMaterial||D.isRawShaderMaterial){const tn=D.uniformsGroups;for(let Ms=0,yi=tn.length;Ms0&&We.useMultisampledRTT(I)===!1?O=Ie.get(I).__webglMultisampledFramebuffer:Array.isArray(Ae)?O=Ae[R]:O=Ae,S.copy(I.viewport),P.copy(I.scissor),k=I.scissorTest}else S.copy(ae).multiplyScalar(te).floor(),P.copy(fe).multiplyScalar(te).floor(),k=Me;if(Ne.bindFramebuffer(V.FRAMEBUFFER,O)&&D&&Ne.drawBuffers(I,O),Ne.viewport(S),Ne.scissor(P),Ne.setScissorTest(k),K){const ge=Ie.get(I.texture);V.framebufferTexture2D(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_CUBE_MAP_POSITIVE_X+se,ge.__webglTexture,R)}else if(G){const ge=Ie.get(I.texture),Te=se||0;V.framebufferTextureLayer(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,ge.__webglTexture,R||0,Te)}C=-1},this.readRenderTargetPixels=function(I,se,R,D,O,K,G){if(!(I&&I.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let he=Ie.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&G!==void 0&&(he=he[G]),he){Ne.bindFramebuffer(V.FRAMEBUFFER,he);try{const ge=I.texture,Te=ge.format,Ae=ge.type;if(!at.textureFormatReadable(Te)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!at.textureTypeReadable(Ae)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}se>=0&&se<=I.width-D&&R>=0&&R<=I.height-O&&V.readPixels(se,R,D,O,Se.convert(Te),Se.convert(Ae),K)}finally{const ge=T!==null?Ie.get(T).__webglFramebuffer:null;Ne.bindFramebuffer(V.FRAMEBUFFER,ge)}}},this.readRenderTargetPixelsAsync=async function(I,se,R,D,O,K,G){if(!(I&&I.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let he=Ie.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&G!==void 0&&(he=he[G]),he){Ne.bindFramebuffer(V.FRAMEBUFFER,he);try{const ge=I.texture,Te=ge.format,Ae=ge.type;if(!at.textureFormatReadable(Te))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!at.textureTypeReadable(Ae))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(se>=0&&se<=I.width-D&&R>=0&&R<=I.height-O){const Ce=V.createBuffer();V.bindBuffer(V.PIXEL_PACK_BUFFER,Ce),V.bufferData(V.PIXEL_PACK_BUFFER,K.byteLength,V.STREAM_READ),V.readPixels(se,R,D,O,Se.convert(Te),Se.convert(Ae),0),V.flush();const Ge=V.fenceSync(V.SYNC_GPU_COMMANDS_COMPLETE,0);await VF(V,Ge,4);try{V.bindBuffer(V.PIXEL_PACK_BUFFER,Ce),V.getBufferSubData(V.PIXEL_PACK_BUFFER,0,K)}finally{V.deleteBuffer(Ce),V.deleteSync(Ge)}return K}}finally{const ge=T!==null?Ie.get(T).__webglFramebuffer:null;Ne.bindFramebuffer(V.FRAMEBUFFER,ge)}}},this.copyFramebufferToTexture=function(I,se=null,R=0){I.isTexture!==!0&&(Ff("WebGLRenderer: copyFramebufferToTexture function signature has changed."),se=arguments[0]||null,I=arguments[1]);const D=Math.pow(2,-R),O=Math.floor(I.image.width*D),K=Math.floor(I.image.height*D),G=se!==null?se.x:0,he=se!==null?se.y:0;We.setTexture2D(I,0),V.copyTexSubImage2D(V.TEXTURE_2D,R,0,0,G,he,O,K),Ne.unbindTexture()},this.copyTextureToTexture=function(I,se,R=null,D=null,O=0){I.isTexture!==!0&&(Ff("WebGLRenderer: copyTextureToTexture function signature has changed."),D=arguments[0]||null,I=arguments[1],se=arguments[2],O=arguments[3]||0,R=null);let K,G,he,ge,Te,Ae;R!==null?(K=R.max.x-R.min.x,G=R.max.y-R.min.y,he=R.min.x,ge=R.min.y):(K=I.image.width,G=I.image.height,he=0,ge=0),D!==null?(Te=D.x,Ae=D.y):(Te=0,Ae=0);const Ce=Se.convert(se.format),Ge=Se.convert(se.type);We.setTexture2D(se,0),V.pixelStorei(V.UNPACK_FLIP_Y_WEBGL,se.flipY),V.pixelStorei(V.UNPACK_PREMULTIPLY_ALPHA_WEBGL,se.premultiplyAlpha),V.pixelStorei(V.UNPACK_ALIGNMENT,se.unpackAlignment);const Oe=V.getParameter(V.UNPACK_ROW_LENGTH),nt=V.getParameter(V.UNPACK_IMAGE_HEIGHT),ht=V.getParameter(V.UNPACK_SKIP_PIXELS),Je=V.getParameter(V.UNPACK_SKIP_ROWS),$e=V.getParameter(V.UNPACK_SKIP_IMAGES),rt=I.isCompressedTexture?I.mipmaps[O]:I.image;V.pixelStorei(V.UNPACK_ROW_LENGTH,rt.width),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,rt.height),V.pixelStorei(V.UNPACK_SKIP_PIXELS,he),V.pixelStorei(V.UNPACK_SKIP_ROWS,ge),I.isDataTexture?V.texSubImage2D(V.TEXTURE_2D,O,Te,Ae,K,G,Ce,Ge,rt.data):I.isCompressedTexture?V.compressedTexSubImage2D(V.TEXTURE_2D,O,Te,Ae,rt.width,rt.height,Ce,rt.data):V.texSubImage2D(V.TEXTURE_2D,O,Te,Ae,K,G,Ce,Ge,rt),V.pixelStorei(V.UNPACK_ROW_LENGTH,Oe),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,nt),V.pixelStorei(V.UNPACK_SKIP_PIXELS,ht),V.pixelStorei(V.UNPACK_SKIP_ROWS,Je),V.pixelStorei(V.UNPACK_SKIP_IMAGES,$e),O===0&&se.generateMipmaps&&V.generateMipmap(V.TEXTURE_2D),Ne.unbindTexture()},this.copyTextureToTexture3D=function(I,se,R=null,D=null,O=0){I.isTexture!==!0&&(Ff("WebGLRenderer: copyTextureToTexture3D function signature has changed."),R=arguments[0]||null,D=arguments[1]||null,I=arguments[2],se=arguments[3],O=arguments[4]||0);let K,G,he,ge,Te,Ae,Ce,Ge,Oe;const nt=I.isCompressedTexture?I.mipmaps[O]:I.image;R!==null?(K=R.max.x-R.min.x,G=R.max.y-R.min.y,he=R.max.z-R.min.z,ge=R.min.x,Te=R.min.y,Ae=R.min.z):(K=nt.width,G=nt.height,he=nt.depth,ge=0,Te=0,Ae=0),D!==null?(Ce=D.x,Ge=D.y,Oe=D.z):(Ce=0,Ge=0,Oe=0);const ht=Se.convert(se.format),Je=Se.convert(se.type);let $e;if(se.isData3DTexture)We.setTexture3D(se,0),$e=V.TEXTURE_3D;else if(se.isDataArrayTexture||se.isCompressedArrayTexture)We.setTexture2DArray(se,0),$e=V.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}V.pixelStorei(V.UNPACK_FLIP_Y_WEBGL,se.flipY),V.pixelStorei(V.UNPACK_PREMULTIPLY_ALPHA_WEBGL,se.premultiplyAlpha),V.pixelStorei(V.UNPACK_ALIGNMENT,se.unpackAlignment);const rt=V.getParameter(V.UNPACK_ROW_LENGTH),Ue=V.getParameter(V.UNPACK_IMAGE_HEIGHT),dn=V.getParameter(V.UNPACK_SKIP_PIXELS),yt=V.getParameter(V.UNPACK_SKIP_ROWS),Vt=V.getParameter(V.UNPACK_SKIP_IMAGES);V.pixelStorei(V.UNPACK_ROW_LENGTH,nt.width),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,nt.height),V.pixelStorei(V.UNPACK_SKIP_PIXELS,ge),V.pixelStorei(V.UNPACK_SKIP_ROWS,Te),V.pixelStorei(V.UNPACK_SKIP_IMAGES,Ae),I.isDataTexture||I.isData3DTexture?V.texSubImage3D($e,O,Ce,Ge,Oe,K,G,he,ht,Je,nt.data):se.isCompressedArrayTexture?V.compressedTexSubImage3D($e,O,Ce,Ge,Oe,K,G,he,ht,nt.data):V.texSubImage3D($e,O,Ce,Ge,Oe,K,G,he,ht,Je,nt),V.pixelStorei(V.UNPACK_ROW_LENGTH,rt),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,Ue),V.pixelStorei(V.UNPACK_SKIP_PIXELS,dn),V.pixelStorei(V.UNPACK_SKIP_ROWS,yt),V.pixelStorei(V.UNPACK_SKIP_IMAGES,Vt),O===0&&se.generateMipmaps&&V.generateMipmap($e),Ne.unbindTexture()},this.initRenderTarget=function(I){Ie.get(I).__webglFramebuffer===void 0&&We.setupRenderTarget(I)},this.initTexture=function(I){I.isCubeTexture?We.setTextureCube(I,0):I.isData3DTexture?We.setTexture3D(I,0):I.isDataArrayTexture||I.isCompressedArrayTexture?We.setTexture2DArray(I,0):We.setTexture2D(I,0),Ne.unbindTexture()},this.resetState=function(){b=0,w=0,T=null,Ne.reset(),Be.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Xs}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Iy?"display-p3":"srgb",t.unpackColorSpace=Lt.workingColorSpace===p0?"display-p3":"srgb"}}class JV extends Vn{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 ps,this.environmentIntensity=1,this.environmentRotation=new ps,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}}class mR extends Od{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ut(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const xm=new ne,ym=new ne,E3=new sn,tf=new Dy,$h=new m0,e_=new ne,w3=new ne;class Ro extends Vn{constructor(e=new gi,t=new mR){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;si)return;e_.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(e_);if(!(le.far))return{distance:l,point:w3.clone().applyMatrix4(n.matrixWorld),index:r,face:null,faceIndex:null,object:n}}class Zn extends gi{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],f=[],h=[],p=[];let g=0;const _=[],m=i/2;let d=0;x(),o===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(u),this.setAttribute("position",new Yt(f,3)),this.setAttribute("normal",new Yt(h,3)),this.setAttribute("uv",new Yt(p,2));function x(){const y=new ne,b=new ne;let w=0;const T=(t-e)/i;for(let C=0;C<=s;C++){const M=[],S=C/s,P=S*(t-e)+e;for(let k=0;k<=r;k++){const U=k/r,N=U*l+a,X=Math.sin(N),z=Math.cos(N);b.x=P*X,b.y=-S*i+m,b.z=P*z,f.push(b.x,b.y,b.z),y.set(X,T,z).normalize(),h.push(y.x,y.y,y.z),p.push(U,1-S),M.push(g++)}_.push(M)}for(let C=0;C.9&&T<.1&&(v<.2&&(o[x+0]+=1),y<.2&&(o[x+2]+=1),b<.2&&(o[x+4]+=1))}}function h(x){s.push(x.x,x.y,x.z)}function p(x,v){const y=x*3;v.x=e[y+0],v.y=e[y+1],v.z=e[y+2]}function g(){const x=new ne,v=new ne,y=new ne,b=new ne,w=new At,T=new At,C=new At;for(let M=0,S=0;M0)&&p.push(v,y,w),(d!==i-1||l.9&&(o.visible=!1)),this.axis==="Y"&&(Zt.setFromEuler(jh.set(0,0,Math.PI/2)),o.quaternion.copy(i).multiply(Zt),Math.abs(zt.copy($a).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Z"&&(Zt.setFromEuler(jh.set(0,Math.PI/2,0)),o.quaternion.copy(i).multiply(Zt),Math.abs(zt.copy(Ef).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="XYZE"&&(Zt.setFromEuler(jh.set(0,Math.PI/2,0)),zt.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(D3.lookAt(I3,zt,$a)),o.quaternion.multiply(Zt),o.visible=this.dragging),this.axis==="E"&&(o.visible=!1)):o.name==="START"?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):o.name==="END"?(o.position.copy(this.worldPosition),o.visible=this.dragging):o.name==="DELTA"?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),Qn.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Qn.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(Qn),o.visible=this.dragging):(o.quaternion.copy(i),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=this.axis.search(o.name)!==-1));continue}o.quaternion.copy(i),this.mode==="translate"||this.mode==="scale"?(o.name==="X"&&Math.abs(zt.copy(Mf).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Y"&&Math.abs(zt.copy($a).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Z"&&Math.abs(zt.copy(Ef).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XY"&&Math.abs(zt.copy(Ef).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="YZ"&&Math.abs(zt.copy(Mf).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XZ"&&Math.abs(zt.copy($a).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)):this.mode==="rotate"&&(qh.copy(i),zt.copy(this.eye).applyQuaternion(Zt.copy(i).invert()),o.name.search("E")!==-1&&o.quaternion.setFromRotationMatrix(D3.lookAt(this.eye,I3,$a)),o.name==="X"&&(Zt.setFromAxisAngle(Mf,Math.atan2(-zt.y,zt.z)),Zt.multiplyQuaternions(qh,Zt),o.quaternion.copy(Zt)),o.name==="Y"&&(Zt.setFromAxisAngle($a,Math.atan2(zt.x,zt.z)),Zt.multiplyQuaternions(qh,Zt),o.quaternion.copy(Zt)),o.name==="Z"&&(Zt.setFromAxisAngle(Ef,Math.atan2(zt.y,zt.x)),Zt.multiplyQuaternions(qh,Zt),o.quaternion.copy(Zt))),o.visible=o.visible&&(o.name.indexOf("X")===-1||this.showX),o.visible=o.visible&&(o.name.indexOf("Y")===-1||this.showY),o.visible=o.visible&&(o.name.indexOf("Z")===-1||this.showZ),o.visible=o.visible&&(o.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),o.material._color=o.material._color||o.material.color.clone(),o.material._opacity=o.material._opacity||o.material.opacity,o.material.color.copy(o.material._color),o.material.opacity=o.material._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(l){return o.name===l}))&&(o.material.color.setHex(16776960),o.material.opacity=1)}super.updateMatrixWorld(e)}}class aG extends Xe{constructor(){super(new kd(1e5,1e5,2,2),new Fd({visible:!1,wireframe:!0,side:is,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),Yh.copy(Mf).applyQuaternion(t==="local"?this.worldQuaternion:Bp),nf.copy($a).applyQuaternion(t==="local"?this.worldQuaternion:Bp),rf.copy(Ef).applyQuaternion(t==="local"?this.worldQuaternion:Bp),zt.copy(nf),this.mode){case"translate":case"scale":switch(this.axis){case"X":zt.copy(this.eye).cross(Yh),Kr.copy(Yh).cross(zt);break;case"Y":zt.copy(this.eye).cross(nf),Kr.copy(nf).cross(zt);break;case"Z":zt.copy(this.eye).cross(rf),Kr.copy(rf).cross(zt);break;case"XY":Kr.copy(rf);break;case"YZ":Kr.copy(Yh);break;case"XZ":zt.copy(rf),Kr.copy(nf);break;case"XYZ":case"E":Kr.set(0,0,0);break}break;case"rotate":default:Kr.set(0,0,0)}Kr.length()===0?this.quaternion.copy(this.cameraQuaternion):(N3.lookAt(Qn.set(0,0,0),Kr,zt),this.quaternion.setFromRotationMatrix(N3)),super.updateMatrixWorld(e)}}const st=Symbol("@@iwer/devui/input-scene"),lG=.016;class cG{constructor(e){const t=e.canvasContainer,i=new JV,r=new lr(e.fovy/Math.PI*180,t.offsetWidth/t.offsetHeight,.1,1e3),s=new yc,o=new yc;i.add(s),s.add(o),o.position.fromArray(e.position.vec3),o.quaternion.fromArray(e.quaternion.quat),o.add(r),r.position.x-=e.ipd/2;const a=new Xe(new hn(.1,.1,.1)),l=a.clone();a.position.fromArray(e.controllers.left.position.vec3),a.quaternion.fromArray(e.controllers.left.quaternion.quat),l.position.fromArray(e.controllers.right.position.vec3),l.quaternion.fromArray(e.controllers.right.quaternion.quat),o.attach(a),o.attach(l),a.visible=!1,l.visible=!1;const c=new Xe(new Fy(.25,.27,32),new Fd({color:16777215,side:eo}));c.rotateX(-Math.PI/2),i.add(c);const u=new QV({alpha:!0});u.setSize(t.offsetWidth,t.offsetHeight),u.setClearColor(0,0),t.appendChild(u.domElement);const f=new L3(r,u.domElement);f.attach(a),i.add(f);const h=new L3(r,u.domElement);h.attach(l),i.add(h);const p=new ResizeObserver(()=>{this.resize()});p.observe(t);const g=m=>{m.addEventListener("mouseDown",()=>{m.userData.pressStart=performance.now()}),m.addEventListener("mouseUp",()=>{const d=performance.now()-m.userData.pressStart;m.userData.pressStart=null,d<200&&(m.mode==="rotate"?m.setMode("translate"):m.setMode("rotate"))}),m.addEventListener("change",()=>{this.renderScene()})};g(f),g(h);const _=m=>{if(!this[st].isPointerLocked)return;const d=m.movementX||m.mozMovementX||m.webkitMovementX||0,x=m.movementY||m.mozMovementY||m.webkitMovementY||0;s.rotation.y-=d*.002,o.rotation.x-=x*.002,e.quaternion.copy(o.getWorldQuaternion(new zn)),this.renderScene()};this[st]={canvasContainer:t,renderer:u,scene:i,camera:r,playerRig:s,cameraRig:o,xrDevice:e,controllerIndicators:{left:a,right:l},transformControls:{left:f,right:h},headsetDefaultPosition:o.position.clone(),headsetDefaultQuaternion:o.quaternion.clone(),controllerDefaultPositions:{left:a.position.clone(),right:l.position.clone()},controllerDefaultQuaternions:{left:a.quaternion.clone(),right:l.quaternion.clone()},resizeObserver:p,isPointerLocked:!1,vec3:new ne,quat:new zn,mouseMoveHandler:_,keyState:{ShiftLeft:!1,KeyW:!1,KeyA:!1,KeyS:!1,KeyD:!1,ArrowUp:!1,ArrowDown:!1},movePlayerRig:()=>this.movePlayerRig(),moveInterval:null},document.addEventListener("pointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.addEventListener("mozpointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.addEventListener("webkitpointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.addEventListener("keydown",this.keyDownHandler.bind(this),!1),document.addEventListener("keyup",this.keyUpHandler.bind(this),!1)}lockPointer(){this[st].renderer.domElement.requestPointerLock=this[st].renderer.domElement.requestPointerLock||this[st].renderer.domElement.mozRequestPointerLock||this[st].renderer.domElement.webkitRequestPointerLock,this[st].renderer.domElement.requestPointerLock()}pointerLockChangeHandler(){this[st].isPointerLocked=document.pointerLockElement===this[st].renderer.domElement||document.mozPointerLockElement===this[st].renderer.domElement||document.webkitPointerLockElement===this[st].renderer.domElement,this[st].isPointerLocked?(document.addEventListener("mousemove",this[st].mouseMoveHandler,!1),Object.values(this[st].transformControls).forEach(e=>{e.enabled=!1,e.visible=!1})):(document.removeEventListener("mousemove",this[st].mouseMoveHandler,!1),Object.values(this[st].transformControls).forEach(e=>{e.enabled=!0,e.visible=!0}))}keyDownHandler(e){const{keyState:t,movePlayerRig:i,moveInterval:r}=this[st];e.code in t&&(t[e.code]=!0),t.ShiftLeft&&(t.KeyW||t.KeyA||t.KeyS||t.KeyD)&&(r||(this[st].moveInterval=window.setInterval(i,16))),t.ShiftLeft&&t.ArrowUp&&(this[st].cameraRig.position.y+=.05,this.renderScene()),t.ShiftLeft&&t.ArrowDown&&(this[st].cameraRig.position.y-=.05,this.renderScene())}keyUpHandler(e){const{keyState:t,moveInterval:i}=this[st];e.code in t&&(t[e.code]=!1),(!t.ShiftLeft||!(t.KeyW||t.KeyA||t.KeyS||t.KeyD))&&i&&(window.clearInterval(i),this[st].moveInterval=null)}movePlayerRig(){const{playerRig:e,keyState:t,vec3:i}=this[st];i.set((t.KeyD?1:0)-(t.KeyA?1:0),0,(t.KeyS?1:0)-(t.KeyW?1:0)),i.lengthSq()>0&&(i.normalize().multiplyScalar(lG).applyQuaternion(e.quaternion),e.position.add(i),this.renderScene())}syncFovy(){this[st].camera.fov=this[st].xrDevice.fovy/Math.PI*180,this[st].camera.updateProjectionMatrix()}resetDeviceTransforms(){const{playerRig:e,cameraRig:t,controllerIndicators:i}=this[st];t.position.copy(this[st].headsetDefaultPosition),t.quaternion.set(0,0,0,1),e.position.set(0,0,0),e.quaternion.set(0,0,0,1),Object.entries(i).forEach(([r,s])=>{s.position.copy(this[st].controllerDefaultPositions[r]),s.quaternion.copy(this[st].controllerDefaultQuaternions[r])}),this.syncDeviceTransforms(),this.renderScene()}syncDeviceTransforms(){const{xrDevice:e,cameraRig:t,controllerIndicators:i}=this[st];e.position.copy(t.getWorldPosition(this[st].vec3)),e.quaternion.copy(t.getWorldQuaternion(this[st].quat)),Object.entries(i).forEach(([r,s])=>{e.controllers[r].position.copy(s.getWorldPosition(this[st].vec3)),e.controllers[r].quaternion.copy(s.getWorldQuaternion(this[st].quat))})}renderScene(){this.syncDeviceTransforms(),this[st].renderer.render(this[st].scene,this[st].camera)}get domElement(){return this[st].renderer.domElement}resize(){const e=this[st].canvasContainer.offsetWidth,t=this[st].canvasContainer.offsetHeight;this[st].renderer.setSize(e,t),this[st].camera.aspect=e/t,this[st].camera.updateProjectionMatrix(),this.renderScene()}dispose(){this[st].resizeObserver.disconnect(),this[st].renderer.dispose(),document.removeEventListener("pointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.removeEventListener("mozpointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.removeEventListener("webkitpointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.removeEventListener("mousemove",this[st].mouseMoveHandler,!1),document.removeEventListener("keydown",this.keyDownHandler.bind(this),!1),document.removeEventListener("keyup",this.keyUpHandler.bind(this),!1)}}var gR={exports:{}},tr={},_R={exports:{}},vR={};/** + * @license React + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */(function(n){function e(L,Z){var ae=L.length;L.push(Z);e:for(;0>>1,Me=L[fe];if(0>>1;fer(oe,ae))mer(de,oe)?(L[fe]=de,L[me]=ae,fe=me):(L[fe]=oe,L[$]=ae,fe=$);else if(mer(de,ae))L[fe]=de,L[me]=ae,fe=me;else break e}}return Z}function r(L,Z){var ae=L.sortIndex-Z.sortIndex;return ae!==0?ae:L.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,f=null,h=3,p=!1,g=!1,_=!1,m=typeof setTimeout=="function"?setTimeout:null,d=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(L){for(var Z=t(c);Z!==null;){if(Z.callback===null)i(c);else if(Z.startTime<=L)i(c),Z.sortIndex=Z.expirationTime,e(l,Z);else break;Z=t(c)}}function y(L){if(_=!1,v(L),!g)if(t(l)!==null)g=!0,z(b);else{var Z=t(c);Z!==null&&te(y,Z.startTime-L)}}function b(L,Z){g=!1,_&&(_=!1,d(C),C=-1),p=!0;var ae=h;try{for(v(Z),f=t(l);f!==null&&(!(f.expirationTime>Z)||L&&!P());){var fe=f.callback;if(typeof fe=="function"){f.callback=null,h=f.priorityLevel;var Me=fe(f.expirationTime<=Z);Z=n.unstable_now(),typeof Me=="function"?f.callback=Me:f===t(l)&&i(l),v(Z)}else i(l);f=t(l)}if(f!==null)var Ve=!0;else{var $=t(c);$!==null&&te(y,$.startTime-Z),Ve=!1}return Ve}finally{f=null,h=ae,p=!1}}var w=!1,T=null,C=-1,M=5,S=-1;function P(){return!(n.unstable_now()-SL||125fe?(L.sortIndex=ae,e(c,L),t(l)===null&&L===t(c)&&(_?(d(C),C=-1):_=!0,te(y,ae-fe))):(L.sortIndex=Me,e(l,L),g||p||(g=!0,z(b))),L},n.unstable_shouldYield=P,n.unstable_wrapCallback=function(L){var Z=h;return function(){var ae=h;h=Z;try{return L.apply(this,arguments)}finally{h=ae}}}})(vR);_R.exports=vR;var uG=_R.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var fG=Tt,Zi=uG;function De(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),L1=Object.prototype.hasOwnProperty,dG=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,U3={},O3={};function hG(n){return L1.call(O3,n)?!0:L1.call(U3,n)?!1:dG.test(n)?O3[n]=!0:(U3[n]=!0,!1)}function pG(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function mG(n,e,t,i){if(e===null||typeof e>"u"||pG(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function vi(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Wn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Wn[n]=new vi(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Wn[e]=new vi(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Wn[n]=new vi(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Wn[n]=new vi(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){Wn[n]=new vi(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Wn[n]=new vi(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Wn[n]=new vi(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Wn[n]=new vi(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Wn[n]=new vi(n,5,!1,n.toLowerCase(),null,!1,!1)});var By=/[\-:]([a-z])/g;function zy(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(By,zy);Wn[e]=new vi(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(By,zy);Wn[e]=new vi(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(By,zy);Wn[e]=new vi(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Wn[n]=new vi(n,1,!1,n.toLowerCase(),null,!1,!1)});Wn.xlinkHref=new vi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Wn[n]=new vi(n,1,!1,n.toLowerCase(),null,!0,!0)});function Hy(n,e,t,i){var r=Wn.hasOwnProperty(e)?Wn[e]:null;(r!==null?r.type!==0:i||!(2a||r[o]!==s[a]){var l=` +`+r[o].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{r_=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?wf(n):""}function gG(n){switch(n.tag){case 5:return wf(n.type);case 16:return wf("Lazy");case 13:return wf("Suspense");case 19:return wf("SuspenseList");case 0:case 2:case 15:return n=s_(n.type,!1),n;case 11:return n=s_(n.type.render,!1),n;case 1:return n=s_(n.type,!0),n;default:return""}}function U1(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case Ec:return"Fragment";case Mc:return"Portal";case I1:return"Profiler";case Vy:return"StrictMode";case D1:return"Suspense";case N1:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case SR:return(n.displayName||"Context")+".Consumer";case yR:return(n._context.displayName||"Context")+".Provider";case Gy:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Wy:return e=n.displayName||null,e!==null?e:U1(n.type)||"Memo";case Fo:e=n._payload,n=n._init;try{return U1(n(e))}catch{}}return null}function _G(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return U1(e);case 8:return e===Vy?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function pa(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function ER(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function vG(n){var e=ER(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Zh(n){n._valueTracker||(n._valueTracker=vG(n))}function wR(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=ER(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function Sm(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function O1(n,e){var t=e.checked;return an({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function k3(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=pa(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function TR(n,e){e=e.checked,e!=null&&Hy(n,"checked",e,!1)}function F1(n,e){TR(n,e);var t=pa(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?k1(n,e.type,t):e.hasOwnProperty("defaultValue")&&k1(n,e.type,pa(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function B3(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function k1(n,e,t){(e!=="number"||Sm(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var Tf=Array.isArray;function Vc(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=Qh.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function ld(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var kf={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},xG=["Webkit","ms","Moz","O"];Object.keys(kf).forEach(function(n){xG.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),kf[e]=kf[n]})});function CR(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||kf.hasOwnProperty(n)&&kf[n]?(""+e).trim():e+"px"}function PR(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=CR(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var yG=an({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function H1(n,e){if(e){if(yG[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(De(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(De(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(De(61))}if(e.style!=null&&typeof e.style!="object")throw Error(De(62))}}function V1(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var G1=null;function $y(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var W1=null,Gc=null,Wc=null;function V3(n){if(n=Hd(n)){if(typeof W1!="function")throw Error(De(280));var e=n.stateNode;e&&(e=S0(e),W1(n.stateNode,n.type,e))}}function LR(n){Gc?Wc?Wc.push(n):Wc=[n]:Gc=n}function IR(){if(Gc){var n=Gc,e=Wc;if(Wc=Gc=null,V3(n),e)for(n=0;n>>=0,n===0?32:31-(LG(n)/IG|0)|0}var Jh=64,ep=4194304;function Af(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Tm(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=Af(a):(s&=o,s!==0&&(i=Af(s)))}else o=t&~r,o!==0?i=Af(o):s!==0&&(i=Af(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0t;t++)e.push(n);return e}function Bd(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-Vr(e),n[e]=t}function OG(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0=zf),Z3=" ",Q3=!1;function QR(n,e){switch(n){case"keyup":return uW.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function JR(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var wc=!1;function dW(n,e){switch(n){case"compositionend":return JR(e);case"keypress":return e.which!==32?null:(Q3=!0,Z3);case"textInput":return n=e.data,n===Z3&&Q3?null:n;default:return null}}function hW(n,e){if(wc)return n==="compositionend"||!Jy&&QR(n,e)?(n=KR(),Hp=Ky=jo=null,wc=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=nw(t)}}function iC(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?iC(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function rC(){for(var n=window,e=Sm();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Sm(n.document)}return e}function eS(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function MW(n){var e=rC(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&iC(t.ownerDocument.documentElement,t)){if(i!==null&&eS(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=iw(t,s);var o=iw(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,Tc=null,K1=null,Vf=null,Z1=!1;function rw(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;Z1||Tc==null||Tc!==Sm(i)||(i=Tc,"selectionStart"in i&&eS(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Vf&&pd(Vf,i)||(Vf=i,i=Rm(K1,"onSelect"),0Rc||(n.current=ix[Rc],ix[Rc]=null,Rc--)}function Ht(n,e){Rc++,ix[Rc]=n.current,n.current=e}var ma={},ii=va(ma),Ii=va(!1),Sl=ma;function yu(n,e){var t=n.type.contextTypes;if(!t)return ma;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function Di(n){return n=n.childContextTypes,n!=null}function Pm(){qt(Ii),qt(ii)}function fw(n,e,t){if(ii.current!==ma)throw Error(De(168));Ht(ii,e),Ht(Ii,t)}function hC(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(De(108,_G(n)||"Unknown",r));return an({},t,i)}function Lm(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||ma,Sl=ii.current,Ht(ii,n),Ht(Ii,Ii.current),!0}function dw(n,e,t){var i=n.stateNode;if(!i)throw Error(De(169));t?(n=hC(n,e,Sl),i.__reactInternalMemoizedMergedChildContext=n,qt(Ii),qt(ii),Ht(ii,n)):qt(Ii),Ht(Ii,t)}var zs=null,M0=!1,x_=!1;function pC(n){zs===null?zs=[n]:zs.push(n)}function NW(n){M0=!0,pC(n)}function xa(){if(!x_&&zs!==null){x_=!0;var n=0,e=Ft;try{var t=zs;for(Ft=1;n>=o,r-=o,js=1<<32-Vr(e)+r|t<C?(M=T,T=null):M=T.sibling;var S=h(d,T,v[C],y);if(S===null){T===null&&(T=M);break}n&&T&&S.alternate===null&&e(d,T),x=s(S,x,C),w===null?b=S:w.sibling=S,w=S,T=M}if(C===v.length)return t(d,T),Jt&&Xa(d,C),b;if(T===null){for(;CC?(M=T,T=null):M=T.sibling;var P=h(d,T,S.value,y);if(P===null){T===null&&(T=M);break}n&&T&&P.alternate===null&&e(d,T),x=s(P,x,C),w===null?b=P:w.sibling=P,w=P,T=M}if(S.done)return t(d,T),Jt&&Xa(d,C),b;if(T===null){for(;!S.done;C++,S=v.next())S=f(d,S.value,y),S!==null&&(x=s(S,x,C),w===null?b=S:w.sibling=S,w=S);return Jt&&Xa(d,C),b}for(T=i(d,T);!S.done;C++,S=v.next())S=p(T,d,C,S.value,y),S!==null&&(n&&S.alternate!==null&&T.delete(S.key===null?C:S.key),x=s(S,x,C),w===null?b=S:w.sibling=S,w=S);return n&&T.forEach(function(k){return e(d,k)}),Jt&&Xa(d,C),b}function m(d,x,v,y){if(typeof v=="object"&&v!==null&&v.type===Ec&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Kh:e:{for(var b=v.key,w=x;w!==null;){if(w.key===b){if(b=v.type,b===Ec){if(w.tag===7){t(d,w.sibling),x=r(w,v.props.children),x.return=d,d=x;break e}}else if(w.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Fo&&mw(b)===w.type){t(d,w.sibling),x=r(w,v.props),x.ref=uf(d,w,v),x.return=d,d=x;break e}t(d,w);break}else e(d,w);w=w.sibling}v.type===Ec?(x=hl(v.props.children,d.mode,y,v.key),x.return=d,d=x):(y=Yp(v.type,v.key,v.props,null,d.mode,y),y.ref=uf(d,x,v),y.return=d,d=y)}return o(d);case Mc:e:{for(w=v.key;x!==null;){if(x.key===w)if(x.tag===4&&x.stateNode.containerInfo===v.containerInfo&&x.stateNode.implementation===v.implementation){t(d,x.sibling),x=r(x,v.children||[]),x.return=d,d=x;break e}else{t(d,x);break}else e(d,x);x=x.sibling}x=b_(v,d.mode,y),x.return=d,d=x}return o(d);case Fo:return w=v._init,m(d,x,w(v._payload),y)}if(Tf(v))return g(d,x,v,y);if(sf(v))return _(d,x,v,y);ap(d,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,x!==null&&x.tag===6?(t(d,x.sibling),x=r(x,v),x.return=d,d=x):(t(d,x),x=A_(v,d.mode,y),x.return=d,d=x),o(d)):t(d,x)}return m}var Mu=vC(!0),xC=vC(!1),Nm=va(null),Um=null,Lc=null,rS=null;function sS(){rS=Lc=Um=null}function oS(n){var e=Nm.current;qt(Nm),n._currentValue=e}function ox(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function Xc(n,e){Um=n,rS=Lc=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(bi=!0),n.firstContext=null)}function _r(n){var e=n._currentValue;if(rS!==n)if(n={context:n,memoizedValue:e,next:null},Lc===null){if(Um===null)throw Error(De(308));Lc=n,Um.dependencies={lanes:0,firstContext:n}}else Lc=Lc.next=n;return e}var rl=null;function aS(n){rl===null?rl=[n]:rl.push(n)}function yC(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,aS(e)):(t.next=r.next,r.next=t),e.interleaved=t,ro(n,i)}function ro(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var ko=!1;function lS(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function SC(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Ks(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function ia(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,Rt&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,ro(n,t)}return r=i.interleaved,r===null?(e.next=e,aS(i)):(e.next=r.next,r.next=e),i.interleaved=e,ro(n,t)}function Gp(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,jy(n,t)}}function gw(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function Om(n,e,t,i){var r=n.updateQueue;ko=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=n.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var f=r.baseState;o=0,u=c=l=null,a=s;do{var h=a.lane,p=a.eventTime;if((i&h)===h){u!==null&&(u=u.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=n,_=a;switch(h=e,p=t,_.tag){case 1:if(g=_.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=_.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=an({},f,h);break e;case 2:ko=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,h=r.effects,h===null?r.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=p,l=f):u=u.next=p,o|=h;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;h=a,a=h.next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}}while(!0);if(u===null&&(l=f),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);wl|=o,n.lanes=o,n.memoizedState=f}}function _w(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;et?t:4,n(!0);var i=S_.transition;S_.transition={};try{n(!1),e()}finally{Ft=t,S_.transition=i}}function kC(){return vr().memoizedState}function kW(n,e,t){var i=sa(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},BC(n))zC(e,t);else if(t=yC(n,e,t,i),t!==null){var r=hi();Gr(t,n,i,r),HC(t,e,i)}}function BW(n,e,t){var i=sa(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(BC(n))zC(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,Xr(a,o)){var l=e.interleaved;l===null?(r.next=r,aS(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=yC(n,e,r,i),t!==null&&(r=hi(),Gr(t,n,i,r),HC(t,e,i))}}function BC(n){var e=n.alternate;return n===on||e!==null&&e===on}function zC(n,e){Gf=km=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function HC(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,jy(n,t)}}var Bm={readContext:_r,useCallback:Yn,useContext:Yn,useEffect:Yn,useImperativeHandle:Yn,useInsertionEffect:Yn,useLayoutEffect:Yn,useMemo:Yn,useReducer:Yn,useRef:Yn,useState:Yn,useDebugValue:Yn,useDeferredValue:Yn,useTransition:Yn,useMutableSource:Yn,useSyncExternalStore:Yn,useId:Yn,unstable_isNewReconciler:!1},zW={readContext:_r,useCallback:function(n,e){return Qr().memoizedState=[n,e===void 0?null:e],n},useContext:_r,useEffect:xw,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,$p(4194308,4,DC.bind(null,e,n),t)},useLayoutEffect:function(n,e){return $p(4194308,4,n,e)},useInsertionEffect:function(n,e){return $p(4,2,n,e)},useMemo:function(n,e){var t=Qr();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=Qr();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=kW.bind(null,on,n),[i.memoizedState,n]},useRef:function(n){var e=Qr();return n={current:n},e.memoizedState=n},useState:vw,useDebugValue:gS,useDeferredValue:function(n){return Qr().memoizedState=n},useTransition:function(){var n=vw(!1),e=n[0];return n=FW.bind(null,n[1]),Qr().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=on,r=Qr();if(Jt){if(t===void 0)throw Error(De(407));t=t()}else{if(t=e(),kn===null)throw Error(De(349));El&30||TC(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,xw(bC.bind(null,i,s,n),[n]),i.flags|=2048,Md(9,AC.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=Qr(),e=kn.identifierPrefix;if(Jt){var t=qs,i=js;t=(i&~(1<<32-Vr(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=yd++,0<\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[ss]=e,n[_d]=i,ZC(n,e,!1,!1),e.stateNode=n;e:{switch(o=V1(t,i),t){case"dialog":Wt("cancel",n),Wt("close",n),r=i;break;case"iframe":case"object":case"embed":Wt("load",n),r=i;break;case"video":case"audio":for(r=0;rTu&&(e.flags|=128,i=!0,ff(s,!1),e.lanes=4194304)}else{if(!i)if(n=Fm(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),ff(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Jt)return Kn(e),null}else 2*mn()-s.renderingStartTime>Tu&&t!==1073741824&&(e.flags|=128,i=!0,ff(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=mn(),e.sibling=null,t=rn.current,Ht(rn,i?t&1|2:t&1),e):(Kn(e),null);case 22:case 23:return MS(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Gi&1073741824&&(Kn(e),e.subtreeFlags&6&&(e.flags|=8192)):Kn(e),null;case 24:return null;case 25:return null}throw Error(De(156,e.tag))}function qW(n,e){switch(nS(e),e.tag){case 1:return Di(e.type)&&Pm(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Eu(),qt(Ii),qt(ii),fS(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return uS(e),null;case 13:if(qt(rn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(De(340));Su()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return qt(rn),null;case 4:return Eu(),null;case 10:return oS(e.type._context),null;case 22:case 23:return MS(),null;case 24:return null;default:return null}}var cp=!1,ei=!1,YW=typeof WeakSet=="function"?WeakSet:Set,qe=null;function Ic(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){un(n,e,i)}else t.current=null}function mx(n,e,t){try{t()}catch(i){un(n,e,i)}}var Pw=!1;function KW(n,e){if(Q1=Am,n=rC(),eS(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,f=n,h=null;t:for(;;){for(var p;f!==t||r!==0&&f.nodeType!==3||(a=o+r),f!==s||i!==0&&f.nodeType!==3||(l=o+i),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===n)break t;if(h===t&&++c===r&&(a=o),h===s&&++u===i&&(l=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(J1={focusedElem:n,selectionRange:t},Am=!1,qe=e;qe!==null;)if(e=qe,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,qe=n;else for(;qe!==null;){e=qe;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var _=g.memoizedProps,m=g.memoizedState,d=e.stateNode,x=d.getSnapshotBeforeUpdate(e.elementType===e.type?_:Cr(e.type,_),m);d.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var v=e.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(De(163))}}catch(y){un(e,e.return,y)}if(n=e.sibling,n!==null){n.return=e.return,qe=n;break}qe=e.return}return g=Pw,Pw=!1,g}function Wf(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&mx(e,t,s)}r=r.next}while(r!==i)}}function T0(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function gx(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function eP(n){var e=n.alternate;e!==null&&(n.alternate=null,eP(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[ss],delete e[_d],delete e[nx],delete e[IW],delete e[DW])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function tP(n){return n.tag===5||n.tag===3||n.tag===4}function Lw(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||tP(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function _x(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Cm));else if(i!==4&&(n=n.child,n!==null))for(_x(n,e,t),n=n.sibling;n!==null;)_x(n,e,t),n=n.sibling}function vx(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(vx(n,e,t),n=n.sibling;n!==null;)vx(n,e,t),n=n.sibling}var Bn=null,Lr=!1;function Po(n,e,t){for(t=t.child;t!==null;)nP(n,e,t),t=t.sibling}function nP(n,e,t){if(fs&&typeof fs.onCommitFiberUnmount=="function")try{fs.onCommitFiberUnmount(_0,t)}catch{}switch(t.tag){case 5:ei||Ic(t,e);case 6:var i=Bn,r=Lr;Bn=null,Po(n,e,t),Bn=i,Lr=r,Bn!==null&&(Lr?(n=Bn,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Bn.removeChild(t.stateNode));break;case 18:Bn!==null&&(Lr?(n=Bn,t=t.stateNode,n.nodeType===8?v_(n.parentNode,t):n.nodeType===1&&v_(n,t),dd(n)):v_(Bn,t.stateNode));break;case 4:i=Bn,r=Lr,Bn=t.stateNode.containerInfo,Lr=!0,Po(n,e,t),Bn=i,Lr=r;break;case 0:case 11:case 14:case 15:if(!ei&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&mx(t,e,o),r=r.next}while(r!==i)}Po(n,e,t);break;case 1:if(!ei&&(Ic(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){un(t,e,a)}Po(n,e,t);break;case 21:Po(n,e,t);break;case 22:t.mode&1?(ei=(i=ei)||t.memoizedState!==null,Po(n,e,t),ei=i):Po(n,e,t);break;default:Po(n,e,t)}}function Iw(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new YW),e.forEach(function(i){var r=s$.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function Rr(n,e){var t=e.deletions;if(t!==null)for(var i=0;ir&&(r=o),i&=~s}if(i=r,i=mn()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*QW(i/1960))-i,10n?16:n,qo===null)var i=!1;else{if(n=qo,qo=null,Vm=0,Rt&6)throw Error(De(331));var r=Rt;for(Rt|=4,qe=n.current;qe!==null;){var s=qe,o=s.child;if(qe.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lmn()-yS?dl(n,0):xS|=t),Ni(n,e)}function uP(n,e){e===0&&(n.mode&1?(e=ep,ep<<=1,!(ep&130023424)&&(ep=4194304)):e=1);var t=hi();n=ro(n,e),n!==null&&(Bd(n,e,t),Ni(n,t))}function r$(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),uP(n,t)}function s$(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(De(314))}i!==null&&i.delete(e),uP(n,t)}var fP;fP=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Ii.current)bi=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return bi=!1,XW(n,e,t);bi=!!(n.flags&131072)}else bi=!1,Jt&&e.flags&1048576&&mC(e,Dm,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;Xp(n,e),n=e.pendingProps;var r=yu(e,ii.current);Xc(e,t),r=hS(null,e,i,n,r,t);var s=pS();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Di(i)?(s=!0,Lm(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,lS(e),r.updater=w0,e.stateNode=r,r._reactInternals=e,lx(e,i,n,t),e=fx(null,e,i,!0,s,t)):(e.tag=0,Jt&&s&&tS(e),li(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(Xp(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=a$(i),n=Cr(i,n),r){case 0:e=ux(null,e,i,n,t);break e;case 1:e=bw(null,e,i,n,t);break e;case 11:e=Tw(null,e,i,n,t);break e;case 14:e=Aw(null,e,i,Cr(i.type,n),t);break e}throw Error(De(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Cr(i,r),ux(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Cr(i,r),bw(n,e,i,r,t);case 3:e:{if(qC(e),n===null)throw Error(De(387));i=e.pendingProps,s=e.memoizedState,r=s.element,SC(n,e),Om(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=wu(Error(De(423)),e),e=Rw(n,e,i,t,r);break e}else if(i!==r){r=wu(Error(De(424)),e),e=Rw(n,e,i,t,r);break e}else for(Xi=na(e.stateNode.containerInfo.firstChild),Yi=e,Jt=!0,Ir=null,t=xC(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Su(),i===r){e=so(n,e,t);break e}li(n,e,i,t)}e=e.child}return e;case 5:return MC(e),n===null&&sx(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,ex(i,r)?o=null:s!==null&&ex(i,s)&&(e.flags|=32),jC(n,e),li(n,e,o,t),e.child;case 6:return n===null&&sx(e),null;case 13:return YC(n,e,t);case 4:return cS(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Mu(e,null,i,t):li(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Cr(i,r),Tw(n,e,i,r,t);case 7:return li(n,e,e.pendingProps,t),e.child;case 8:return li(n,e,e.pendingProps.children,t),e.child;case 12:return li(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,Ht(Nm,i._currentValue),i._currentValue=o,s!==null)if(Xr(s.value,o)){if(s.children===r.children&&!Ii.current){e=so(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=Ks(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),ox(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(De(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),ox(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}li(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Xc(e,t),r=_r(r),i=i(r),e.flags|=1,li(n,e,i,t),e.child;case 14:return i=e.type,r=Cr(i,e.pendingProps),r=Cr(i.type,r),Aw(n,e,i,r,t);case 15:return $C(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Cr(i,r),Xp(n,e),e.tag=1,Di(i)?(n=!0,Lm(e)):n=!1,Xc(e,t),VC(e,i,r),lx(e,i,r,t),fx(null,e,i,!0,n,t);case 19:return KC(n,e,t);case 22:return XC(n,e,t)}throw Error(De(156,e.tag))};function dP(n,e){return BR(n,e)}function o$(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function hr(n,e,t,i){return new o$(n,e,t,i)}function wS(n){return n=n.prototype,!(!n||!n.isReactComponent)}function a$(n){if(typeof n=="function")return wS(n)?1:0;if(n!=null){if(n=n.$$typeof,n===Gy)return 11;if(n===Wy)return 14}return 2}function oa(n,e){var t=n.alternate;return t===null?(t=hr(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function Yp(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")wS(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case Ec:return hl(t.children,r,s,e);case Vy:o=8,r|=8;break;case I1:return n=hr(12,t,e,r|2),n.elementType=I1,n.lanes=s,n;case D1:return n=hr(13,t,e,r),n.elementType=D1,n.lanes=s,n;case N1:return n=hr(19,t,e,r),n.elementType=N1,n.lanes=s,n;case MR:return b0(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case yR:o=10;break e;case SR:o=9;break e;case Gy:o=11;break e;case Wy:o=14;break e;case Fo:o=16,i=null;break e}throw Error(De(130,n==null?n:typeof n,""))}return e=hr(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function hl(n,e,t,i){return n=hr(7,n,i,e),n.lanes=t,n}function b0(n,e,t,i){return n=hr(22,n,i,e),n.elementType=MR,n.lanes=t,n.stateNode={isHidden:!1},n}function A_(n,e,t){return n=hr(6,n,null,e),n.lanes=t,n}function b_(n,e,t){return e=hr(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function l$(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=a_(0),this.expirationTimes=a_(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=a_(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function TS(n,e,t,i,r,s,o,a,l){return n=new l$(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=hr(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},lS(s),n}function c$(n,e,t){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gP)}catch(n){console.error(n)}}gP(),gR.exports=tr;var p$=gR.exports,_P,zw=p$;_P=zw.createRoot,zw.hydrateRoot;const m$=Symbol("@@iwer/devui/devui"),Ex={buttonPressDuration:250},vP=Tt.createContext(Ex),CS=()=>Tt.useContext(vP);class g${constructor(e,t={}){e.ipd=0;const i=e.canvasContainer,r=document.createElement("div");r.style.position="fixed",r.style.width="100%",r.style.height="100%",r.style.top="0",r.style.left="0",r.style.display="flex",r.style.justifyContent="center",r.style.alignItems="center",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="3",i.appendChild(r);const s=new cG(e),o=s.domElement;o.style.position="fixed",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.left="0",o.style.zIndex="2",i.appendChild(o),_P(r).render(Q.jsx(_$,{xrDevice:e,inputLayer:s,options:t})),this[m$]={xrDevice:e,inputLayer:s}}}const _$=({xrDevice:n,inputLayer:e,options:t})=>{const[i,r]=Tt.useState(!1),[s,o]=Tt.useState(CO),[a,l]=Tt.useState(!1),[c,u]=Tt.useState(!1),[f,h]=Tt.useState(Ex);return Tt.useEffect(()=>{var p;h({buttonPressDuration:(p=t.buttonPressDuration)!==null&&p!==void 0?p:Ex.buttonPressDuration});const g=()=>{const _=document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement;r(!!_)};return document.addEventListener("pointerlockchange",g,!1),document.addEventListener("mozpointerlockchange",g,!1),document.addEventListener("webkitpointerlockchange",g,!1),()=>{document.removeEventListener("pointerlockchange",g,!1),document.removeEventListener("mozpointerlockchange",g,!1),document.removeEventListener("webkitpointerlockchange",g,!1)}},[]),Q.jsx(vP.Provider,{value:f,children:Q.jsxs("div",{style:{width:"100vw",height:"100vh",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[Q.jsx(WO,{xrDevice:n,inputLayer:e,keyMapOpen:a,setKeyMapOpen:l,fovSettingOpen:c,setFovSettingOpen:u}),a&&Q.jsx(LO,{keyMap:s,setKeyMap:o}),c&&Q.jsx(VO,{xrDevice:n,inputLayer:e}),Q.jsx(zO,{xrDevice:n,keyMap:s,pointerLocked:i})]})})},v$={RC_BOTTOM:0,RC_RIGHT:1,RC_LEFT:2,RC_TOP:3,BUMPER_LEFT:4,BUMPER_RIGHT:5,TRIGGER_LEFT:6,TRIGGER_RIGHT:7,CC_LEFT:8,CC_RIGHT:9,THUMBSTICK_LEFT:10,THUMBSTICK_RIGHT:11,LC_BOTTOM:12,LC_RIGHT:13,LC_LEFT:14,LC_TOP:15,CC_CENTER:16},x$={THUMBSTICK_LEFT_X:0,THUMBSTICK_LEFT_Y:1,THUMBSTICK_RIGHT_X:2,THUMBSTICK_RIGHT_Y:3},y$={TRIGGER:0,SQUEEZE:1,TOUCHPAD:2,THUMBSTICK:3,BUTTON_1:4,BUTTON_2:5},S$={TOUCHPAD_X:0,TOUCHPAD_Y:1,THUMBSTICK_X:2,THUMBSTICK_Y:3};class M${constructor(e,t={}){var i,r,s;this._buttons=[],this._gamepad=e,this._buttonPressValueMin=(i=t.buttonPressValueMin)!==null&&i!==void 0?i:0,this._buttonPressValueMax=(r=t.buttonPressValueMax)!==null&&r!==void 0?r:1,this._buttonClickThreshold=(s=t.buttonClickThreshold)!==null&&s!==void 0?s:.9;for(let o=0;othis._buttonPressValueMin:!1}getButton(e){const t=this.getButtonIdx(e);return this.getButtonByIndex(t)}getButtonDownByIndex(e){return this._buttons[e]?this._buttons[e].prevFrame.value<=this._buttonPressValueMin&&this._buttons[e].currFrame.value>this._buttonPressValueMin:!1}getButtonDown(e){const t=this.getButtonIdx(e);return this.getButtonDownByIndex(t)}getButtonUpByIndex(e){return this._buttons[e]?this._buttons[e].prevFrame.value>=this._buttonPressValueMax&&this._buttons[e].currFrame.valuethis._buttonClickThreshold:!1}getButtonClick(e){const t=this.getButtonIdx(e);return this.getButtonClickByIndex(t)}getAxisByIndex(e){return this._gamepad.axes[e]}getAxis(e){const t=this.getAxisIdx(e);return this.getAxisByIndex(t)}get2DInputAngle(e){const t=this.getAxis(e+"_X"),i=this.getAxis(e+"_Y");if(t==null||i==null||t==0&&i==0)return NaN;let r=Math.atan(t/i);return t>=0?i<0?r*=-1:i>0?r=Math.PI-r:i==0&&(r=Math.PI/2):i<0?r*=-1:i>0?r=-Math.PI-r:i==0&&(r=-Math.PI/2),r}get2DInputValue(e){const t=this.getAxis(e+"_X"),i=this.getAxis(e+"_Y");return Math.sqrt(t*t+i*i)}getHapticActuator(e){const t=this._gamepad.hapticActuators[e];if(t)return t;throw"Requested haptic actuator does not exist in gamepad"}}const Hw={type:"change"},PS={type:"start"},xP={type:"end"},dp=new Td,Vw=new ui,E$=Math.cos(70*gT.DEG2RAD),Sn=new Y,Mi=2*Math.PI,Bt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},R_=1e-6;class w$ extends D8{constructor(e,t=null){super(e,t),this.state=Bt.NONE,this.enabled=!0,this.target=new Y,this.cursor=new Y,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Nc.ROTATE,MIDDLE:Nc.DOLLY,RIGHT:Nc.PAN},this.touches={ONE:hc.ROTATE,TWO:hc.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new Y,this._lastQuaternion=new mr,this._lastTargetPosition=new Y,this._quat=new mr().setFromUnitVectors(e.up,new Y(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new r2,this._sphericalDelta=new r2,this._scale=1,this._panOffset=new Y,this._rotateStart=new lt,this._rotateEnd=new lt,this._rotateDelta=new lt,this._panStart=new lt,this._panEnd=new lt,this._panDelta=new lt,this._dollyStart=new lt,this._dollyEnd=new lt,this._dollyDelta=new lt,this._dollyDirection=new Y,this._mouse=new lt,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=A$.bind(this),this._onPointerDown=T$.bind(this),this._onPointerUp=b$.bind(this),this._onContextMenu=N$.bind(this),this._onMouseWheel=P$.bind(this),this._onKeyDown=L$.bind(this),this._onTouchStart=I$.bind(this),this._onTouchMove=D$.bind(this),this._onMouseDown=R$.bind(this),this._onMouseMove=C$.bind(this),this._interceptControlDown=U$.bind(this),this._interceptControlUp=O$.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Hw),this.update(),this.state=Bt.NONE}update(e=null){const t=this.object.position;Sn.copy(t).sub(this.target),Sn.applyQuaternion(this._quat),this._spherical.setFromVector3(Sn),this.autoRotate&&this.state===Bt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(i)&&isFinite(r)&&(i<-Math.PI?i+=Mi:i>Math.PI&&(i-=Mi),r<-Math.PI?r+=Mi:r>Math.PI&&(r-=Mi),i<=r?this._spherical.theta=Math.max(i,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+r)/2?Math.max(i,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(Sn.setFromSpherical(this._spherical),Sn.applyQuaternion(this._quatInverse),t.copy(this.target).add(Sn),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=Sn.length();o=this._clampDistance(a*this._scale);const l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const a=new Y(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new Y(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=Sn.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(dp.origin.copy(this.object.position),dp.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(dp.direction))R_||8*(1-this._lastQuaternion.dot(this.object.quaternion))>R_||this._lastTargetPosition.distanceToSquared(this.target)>R_?(this.dispatchEvent(Hw),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Mi/60*this.autoRotateSpeed*e:Mi/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Sn.setFromMatrixColumn(t,0),Sn.multiplyScalar(-e),this._panOffset.add(Sn)}_panUp(e,t){this.screenSpacePanning===!0?Sn.setFromMatrixColumn(t,1):(Sn.setFromMatrixColumn(t,0),Sn.crossVectors(this.object.up,Sn)),Sn.multiplyScalar(e),this._panOffset.add(Sn)}_pan(e,t){const i=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;Sn.copy(r).sub(this.target);let s=Sn.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/i.clientHeight,this.object.matrix),this._panUp(2*t*s/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),r=e-i.left,s=t-i.top,o=i.width,a=i.height;this._mouse.x=r/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Mi*this._rotateDelta.x/t.clientHeight),this._rotateUp(Mi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(Mi*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(-Mi*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(Mi*this.rotateSpeed/this.domElement.clientHeight):this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(-Mi*this.rotateSpeed/this.domElement.clientHeight):this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(i,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(i,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const i=this._getSecondPointerPosition(e),r=.5*(e.pageX+i.x),s=.5*(e.pageY+i.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Mi*this._rotateDelta.x/t.clientHeight),this._rotateUp(Mi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(i,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t=2.0 are supported."));return}const c=new gX(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&a[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}}function k$(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Mt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class B${constructor(e){this.parser=e,this.name=Mt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class J${constructor(e){this.parser=e,this.name=Mt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class eX{constructor(e){this.parser=e,this.name=Mt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class tX{constructor(e){this.name=Mt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=r.byteOffset||0,c=r.byteLength||0,u=r.count,f=r.byteStride,h=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,f,h,r.mode,r.filter).then(function(p){return p.buffer}):o.ready.then(function(){const p=new ArrayBuffer(u*f);return o.decodeGltfBuffer(new Uint8Array(p),u,f,h,r.mode,r.filter),p})})}else return null}}class nX{constructor(e){this.name=Mt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const c of r.primitives)if(c.mode!==or.TRIANGLES&&c.mode!==or.TRIANGLE_STRIP&&c.mode!==or.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=i.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(u=>(l[c]=u,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const u=c.pop(),f=u.isGroup?u.children:[u],h=c[0].count,p=[];for(const g of f){const _=new dt,m=new Y,d=new mr,x=new Y(1,1,1),v=new j6(g.geometry,g.material,h);for(let y=0;y0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":n.search(/\.ktx2($|\?)/i)>0||n.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const mX=new dt;class gX{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new k$,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);r=i&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&r<17||s&&o<98?this.textureLoader=new Kx(this.options.manager):this.textureLoader=new g8(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Yx(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};return Ba(s,a,r),Bs(a,r),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,u]of o.children.entries())s(u,a.children[c])};return s(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i=2&&m.setY(M,w[T*l+1]),l>=3&&m.setZ(M,w[T*l+2]),l>=4&&m.setW(M,w[T*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=g}return m})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=i.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,i){const r=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,i).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(s.samplers||{})[o.sampler]||{};return u.magFilter=$w[h.magFilter]||$i,u.minFilter=$w[h.minFilter]||os,u.wrapS=Xw[h.wrapS]||aa,u.wrapT=Xw[h.wrapT]||aa,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==ni&&u.minFilter!==$i,r.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const i=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const o=r.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(f){c=!0;const h=new Blob([f],{type:o.mimeType});return l=a.createObjectURL(h),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(f){return new Promise(function(h,p){let g=h;t.isImageBitmapLoader===!0&&(g=function(_){const m=new mi(_);m.needsUpdate=!0,h(m)}),t.load(Pf.resolveURL(f,s.path),g,void 0,p)})}).then(function(f){return c===!0&&a.revokeObjectURL(l),Bs(f,o),f.userData.mimeType=o.mimeType||pX(o.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=u,u}assignTexture(e,t,i,r){const s=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),s.extensions[Mt.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[Mt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Mt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return r!==void 0&&(o.colorSpace=r),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new GT,cs.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new Xx,cs.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,this.cache.add(a,l)),i=l}if(r||s||o){let a="ClonedMaterial:"+i.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}e.material=i}getMaterialType(){return qx}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[Mt.KHR_MATERIALS_UNLIT]){const f=r[Mt.KHR_MATERIALS_UNLIT];o=f.getMaterialType(),c.push(f.extendParams(a,s,t))}else{const f=s.pbrMetallicRoughness||{};if(a.color=new tt(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const h=f.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],pi),a.opacity=h[3]}f.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",f.baseColorTexture,En)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),o=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=fi);const u=s.alphaMode||P_.OPAQUE;if(u===P_.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===P_.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Or&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new lt(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;a.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&o!==Or&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Or){const f=s.emissiveFactor;a.emissive=new tt().setRGB(f[0],f[1],f[2],pi)}return s.emissiveTexture!==void 0&&o!==Or&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,En)),Promise.all(c).then(function(){const f=new o(a);return s.name&&(f.name=s.name),Bs(f,s),t.associations.set(f,{materials:e}),s.extensions&&Ba(r,f,s),f})}createUniqueName(e){const t=Nt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function s(a){return i[Mt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return jw(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&dX(d,s),d.name=t.createUniqueName(s.name||"mesh_"+e),Bs(d,s),m.extensions&&Ba(r,d,m),t.assignFinalMaterial(d),f.push(d)}for(let p=0,g=f.length;p1?u=new Ws:c.length===1?u=c[0]:u=new fn,u!==c[0])for(let f=0,h=c.length;f{const f=new Map;for(const[h,p]of r.associations)(h instanceof cs||h instanceof mi)&&f.set(h,p);return u.traverse(h=>{const p=r.associations.get(h);p!=null&&f.set(h,p)}),f};return r.associations=c(s),s})}_createAnimationTracks(e,t,i,r,s){const o=[],a=e.name?e.name:e.uuid,l=[];Lo[s.path]===Lo.weights?e.traverse(function(h){h.morphTargetInfluences&&l.push(h.name?h.name:h.uuid)}):l.push(a);let c;switch(Lo[s.path]){case Lo.weights:c=nu;break;case Lo.rotation:c=iu;break;case Lo.position:case Lo.scale:c=ru;break;default:switch(i.itemSize){case 1:c=nu;break;case 2:case 3:default:c=ru;break}break}const u=r.interpolation!==void 0?cX[r.interpolation]:Yf,f=this._getArrayFromAccessor(i);for(let h=0,p=l.length;h{const c=r[l];return c&&(s={profileId:l,profilePath:`${e}/${c.path}`,deprecated:!!c.deprecated}),!!s}),!s){if(!t)throw new Error("No matching profile name found");const l=r[t];if(!l)throw new Error(`No matching profile name found and default profile "${t}" missing.`);s={profileId:t,profilePath:`${e}/${l.path}`,deprecated:!!l.deprecated}}const o=await MP(s.profilePath);let a;if(i){let l;if(n.handedness==="any"?l=o.layouts[Object.keys(o.layouts)[0]]:l=o.layouts[n.handedness],!l)throw new Error(`No matching handedness, ${n.handedness}, in profile ${s.profileId}`);l.assetPath&&(a=s.profilePath.replace("profile.json",l.assetPath))}return{profile:o,assetPath:a}}const yX={xAxis:0,yAxis:0,button:0,state:cn.ComponentState.DEFAULT};function SX(n=0,e=0){let t=n,i=e;if(Math.sqrt(n*n+e*e)>1){const o=Math.atan2(e,n);t=Math.cos(o),i=Math.sin(o)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:i*.5+.5}}class MX{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===cn.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(yX)}updateFromComponent({xAxis:e,yAxis:t,button:i,state:r}){const{normalizedXAxis:s,normalizedYAxis:o}=SX(e,t);switch(this.componentProperty){case cn.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?s:.5;break;case cn.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?o:.5;break;case cn.ComponentProperty.BUTTON:this.value=this.states.includes(r)?i:0;break;case cn.ComponentProperty.STATE:this.valueNodeProperty===cn.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class EX{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(i=>{const r=new MX(t.visualResponses[i]);this.visualResponses[i]=r}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:cn.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=cn.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=cn.ComponentState.PRESSED:(t.touched||this.values.button>cn.ButtonTouchThreshold)&&(this.values.state=cn.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===cn.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>cn.AxisTouchThreshold&&(this.values.state=cn.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===cn.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>cn.AxisTouchThreshold&&(this.values.state=cn.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class wX{constructor(e,t,i){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=i,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(r=>{const s=this.layoutDescription.components[r];this.components[r]=new EX(r,s)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const TX="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",AX="generic-trigger";class bX extends fn{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(t=>{t.isMesh&&(t.material.envMap=this.envMap,t.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(t=>{Object.values(t.visualResponses).forEach(i=>{const{valueNode:r,minNode:s,maxNode:o,value:a,valueNodeProperty:l}=i;r&&(l===cn.VisualResponseProperty.VISIBILITY?r.visible=a:l===cn.VisualResponseProperty.TRANSFORM&&(r.quaternion.slerpQuaternions(s.quaternion,o.quaternion,a),r.position.lerpVectors(s.position,o.position,a)))})}))}}function RX(n,e){Object.values(n.components).forEach(t=>{const{type:i,touchPointNodeName:r,visualResponses:s}=t;if(i===cn.ComponentType.TOUCHPAD)if(t.touchPointNode=e.getObjectByName(r),t.touchPointNode){const o=new $T(.001),a=new Or({color:255}),l=new yn(o,a);t.touchPointNode.add(l)}else console.warn(`Could not find touch dot, ${t.touchPointNodeName}, in touchpad component ${t.id}`);Object.values(s).forEach(o=>{const{valueNodeName:a,minNodeName:l,maxNodeName:c,valueNodeProperty:u}=o;if(u===cn.VisualResponseProperty.TRANSFORM){if(o.minNode=e.getObjectByName(l),o.maxNode=e.getObjectByName(c),!o.minNode){console.warn(`Could not find ${l} in the model`);return}if(!o.maxNode){console.warn(`Could not find ${c} in the model`);return}}o.valueNode=e.getObjectByName(a),o.valueNode||console.warn(`Could not find ${a} in the model`)})})}function qw(n,e){RX(n.motionController,e),n.envMap&&e.traverse(t=>{t.isMesh&&(t.material.envMap=n.envMap,t.material.needsUpdate=!0)}),n.add(e)}class CX{constructor(e=null,t=null){this.gltfLoader=e,this.path=TX,this._assetCache={},this.onLoad=t,this.gltfLoader||(this.gltfLoader=new F$)}setPath(e){return this.path=e,this}createControllerModel(e){const t=new bX;let i=null;return e.addEventListener("connected",r=>{const s=r.data;s.targetRayMode!=="tracked-pointer"||!s.gamepad||s.hand||xX(s,this.path,AX).then(({profile:o,assetPath:a})=>{t.motionController=new wX(s,o,a);const l=this._assetCache[t.motionController.assetUrl];if(l)i=l.scene.clone(),qw(t,i),this.onLoad&&this.onLoad(i);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(t.motionController.assetUrl,c=>{this._assetCache[t.motionController.assetUrl]=c,i=c.scene.clone(),qw(t,i),this.onLoad&&this.onLoad(i)},null,()=>{throw new Error(`Asset ${t.motionController.assetUrl} missing or malformed.`)})}}).catch(o=>{console.warn(o)})}),e.addEventListener("disconnected",()=>{t.motionController=null,t.remove(i),i=null}),t}}const Qi=new KT,Go=document.createElement("div");Go.id="loading";const LS=document.createElement("div");LS.className="progress";Go.append(LS);const IS=document.createElement("div");IS.className="progressbar";LS.append(IS);Qi.div=Go;Qi.handlers=[()=>{Go.style.opacity=1;const n=()=>{Go.style.opacity=Go.style.opacity-.1,typeof n=="function"&&Go.style.opacity>0?setTimeout(n,33):Go.style.display="none"};n()}];Qi.addLoadHandler=n=>{Qi.handlers.push(n)};Qi.onLoad=()=>{Qi.handlers.map(async n=>typeof n=="function"?await n():void 0)};Qi.onProgress=(n,e,t)=>{const i=e/t;IS.style.transform=`scaleX(${i})`};class PX extends yn{constructor(e,t={}){super(e),this.isWater=!0;const i=this,r=t.textureWidth!==void 0?t.textureWidth:512,s=t.textureHeight!==void 0?t.textureHeight:512,o=t.clipBias!==void 0?t.clipBias:0,a=t.alpha!==void 0?t.alpha:1,l=t.time!==void 0?t.time:0,c=t.waterNormals!==void 0?t.waterNormals:null,u=t.sunDirection!==void 0?t.sunDirection:new Y(.70707,.70707,0),f=new tt(t.sunColor!==void 0?t.sunColor:16777215),h=new tt(t.waterColor!==void 0?t.waterColor:8355711),p=t.eye!==void 0?t.eye:new Y(0,0,0),g=t.distortionScale!==void 0?t.distortionScale:20,_=t.side!==void 0?t.side:Wr,m=t.fog!==void 0?t.fog:!1,d=new ui,x=new Y,v=new Y,y=new Y,b=new dt,w=new Y(0,0,-1),T=new Ct,C=new Y,M=new Y,S=new Ct,P=new dt,k=new Jn,U=new la(r,s),N={name:"MirrorShader",uniforms:xv.merge([ze.fog,ze.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new dt},sunColor:{value:new tt(8355711)},sunDirection:{value:new Y(.70707,.70707,0)},eye:{value:new Y},waterColor:{value:new tt(5592405)}}]),vertexShader:` + uniform mat4 textureMatrix; + uniform float time; + + varying vec4 mirrorCoord; + varying vec4 worldPosition; + + #include + #include + #include + #include + + void main() { + mirrorCoord = modelMatrix * vec4( position, 1.0 ); + worldPosition = mirrorCoord.xyzw; + mirrorCoord = textureMatrix * mirrorCoord; + vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); + gl_Position = projectionMatrix * mvPosition; + + #include + #include + #include + #include + #include + }`,fragmentShader:` + uniform sampler2D mirrorSampler; + uniform float alpha; + uniform float time; + uniform float size; + uniform float distortionScale; + uniform sampler2D normalSampler; + uniform vec3 sunColor; + uniform vec3 sunDirection; + uniform vec3 eye; + uniform vec3 waterColor; + + varying vec4 mirrorCoord; + varying vec4 worldPosition; + + vec4 getNoise( vec2 uv ) { + vec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0); + vec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 ); + vec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 ); + vec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 ); + vec4 noise = texture2D( normalSampler, uv0 ) + + texture2D( normalSampler, uv1 ) + + texture2D( normalSampler, uv2 ) + + texture2D( normalSampler, uv3 ); + return noise * 0.5 - 1.0; + } + + void sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) { + vec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) ); + float direction = max( 0.0, dot( eyeDirection, reflection ) ); + specularColor += pow( direction, shiny ) * sunColor * spec; + diffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse; + } + + #include + #include + #include + #include + #include + #include + #include + #include + + void main() { + + #include + vec4 noise = getNoise( worldPosition.xz * size ); + vec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) ); + + vec3 diffuseLight = vec3(0.0); + vec3 specularLight = vec3(0.0); + + vec3 worldToEye = eye-worldPosition.xyz; + vec3 eyeDirection = normalize( worldToEye ); + sunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight ); + + float distance = length(worldToEye); + + vec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale; + vec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) ); + + float theta = max( dot( eyeDirection, surfaceNormal ), 0.0 ); + float rf0 = 0.3; + float reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 ); + vec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor; + vec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance); + vec3 outgoingLight = albedo; + gl_FragColor = vec4( outgoingLight, alpha ); + + #include + #include + #include + }`},X=new Ki({name:N.name,uniforms:xv.clone(N.uniforms),vertexShader:N.vertexShader,fragmentShader:N.fragmentShader,lights:!0,side:_,fog:m});X.uniforms.mirrorSampler.value=U.texture,X.uniforms.textureMatrix.value=P,X.uniforms.alpha.value=a,X.uniforms.time.value=l,X.uniforms.normalSampler.value=c,X.uniforms.sunColor.value=f,X.uniforms.waterColor.value=h,X.uniforms.sunDirection.value=u,X.uniforms.distortionScale.value=g,X.uniforms.eye.value=p,i.material=X,i.onBeforeRender=function(z,te,L){if(v.setFromMatrixPosition(i.matrixWorld),y.setFromMatrixPosition(L.matrixWorld),b.extractRotation(i.matrixWorld),x.set(0,0,1),x.applyMatrix4(b),C.subVectors(v,y),C.dot(x)>0)return;C.reflect(x).negate(),C.add(v),b.extractRotation(L.matrixWorld),w.set(0,0,-1),w.applyMatrix4(b),w.add(y),M.subVectors(v,w),M.reflect(x).negate(),M.add(v),k.position.copy(C),k.up.set(0,1,0),k.up.applyMatrix4(b),k.up.reflect(x),k.lookAt(M),k.far=L.far,k.updateMatrixWorld(),k.projectionMatrix.copy(L.projectionMatrix),P.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),P.multiply(k.projectionMatrix),P.multiply(k.matrixWorldInverse),d.setFromNormalAndCoplanarPoint(x,v),d.applyMatrix4(k.matrixWorldInverse),T.set(d.normal.x,d.normal.y,d.normal.z,d.constant);const Z=k.projectionMatrix;S.x=(Math.sign(T.x)+Z.elements[8])/Z.elements[0],S.y=(Math.sign(T.y)+Z.elements[9])/Z.elements[5],S.z=-1,S.w=(1+Z.elements[10])/Z.elements[14],T.multiplyScalar(2/T.dot(S)),Z.elements[2]=T.x,Z.elements[6]=T.y,Z.elements[10]=T.z+1-o,Z.elements[14]=T.w,p.setFromMatrixPosition(L.matrixWorld);const ae=z.getRenderTarget(),fe=z.xr.enabled,Me=z.shadowMap.autoUpdate;i.visible=!1,z.xr.enabled=!1,z.shadowMap.autoUpdate=!1,z.setRenderTarget(U),z.state.buffers.depth.setMask(!0),z.autoClear===!1&&z.clear(),z.render(te,k),i.visible=!0,z.xr.enabled=fe,z.shadowMap.autoUpdate=Me,z.setRenderTarget(ae);const Ve=L.viewport;Ve!==void 0&&z.state.viewport(Ve)}}}function Os(n,e){const t=document.createElement("canvas"),i=t.getContext("2d");return t.width=t.height=n,i.fillStyle="#444",i.fillRect(0,0,n,n),i.fillStyle=e,i.fillRect(0,0,n/2,n/2),i.fillRect(n/2,n/2,n/2,n/2),i}let Ax=!1;const LX=Os(256,"#f00"),Uo=new Kx(Qi),Qt=Uo.load("assets/material/textures/mip-low-res-enlarged.png");Uo.load("assets/material/textures/mipmap-256.png",n=>{console.log("Load mipmap[0]"),Uo.load("assets/material/textures/mipmap-128.png",e=>{console.log("Load mipmap[1]"),Uo.load("assets/material/textures/mipmap-64.png",t=>{console.log("Load mipmap[2]"),Uo.load("assets/material/textures/mipmap-32.png",i=>{console.log("Load mipmap[3]"),Uo.load("assets/material/textures/mipmap-16.png",r=>{console.log("Load mipmap[4]"),Uo.load("assets/material/textures/mipmap-8.png",s=>{console.log("Load mipmap[5]"),Uo.load("assets/material/textures/mipmap-4.png",o=>{console.log("Load mipmap[6]"),Qt.image?(console.log(Qt.image),Qt.mipmaps[0]=Qt.image):Qt.mipmaps[0]=n.image,Qt.mipmaps[1]=e.image,Qt.mipmaps[2]=t.image,Qt.mipmaps[3]=i.image,Qt.mipmaps[4]=r.image,Qt.mipmaps[5]=s.image,Qt.mipmaps[6]=o.image,Ax=!0})})})})})})});Qi.addLoadHandler(()=>{Qt.colorSpace=En,Qt.magFilter=ni,Qt.minFilter=os,Ax||(console.log("meshMaterial mipmaps have not been initialized!"),Qt.mipmaps[0]=LX.getImageData(0,0,256,256),Qt.mipmaps[1]=Os(128,"#0f0").getImageData(0,0,128,128),Qt.mipmaps[2]=Os(64,"#0f0").getImageData(0,0,64,64),Qt.mipmaps[3]=Os(32,"#00f").getImageData(0,0,32,32),Qt.mipmaps[4]=Os(16,"#404").getImageData(0,0,16,16),Qt.mipmaps[5]=Os(8,"#044").getImageData(0,0,8,8),Qt.mipmaps[6]=Os(4,"#044").getImageData(0,0,4,4)),Qt.mipmaps[7]=Os(2,"#040").getImageData(0,0,2,2),Qt.mipmaps[8]=Os(1,"#400").getImageData(0,0,1,1),Ax=!0});const IX=new Or({map:Qt,opacity:1,side:fi}),DX=new Z6(7.5,3,300,300),I0=new yn(DX,IX);I0.position.y=2;I0.rotX=function(n){this.rotation.x+=n};I0.rotY=function(n){this.rotation.y+=n};const Yw=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} + #ifdef HIGH_PRECISION +float precisionSafeLength( vec3 v ) { return length( v ); } + #else +float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; +} + #endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH +varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; + #endif + vViewPosition = - mvPosition.xyz; + gl_Position = projectionMatrix * mvPosition; +} +`,bx=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} + #ifdef HIGH_PRECISION +float precisionSafeLength( vec3 v ) { return length( v ); } + #else +float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; +} + #endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH +varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + gl_FragColor = vec4(vNormal * 0.25 + 0.75, 1); +} +`,NX=` +#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION +varying vec3 vWorldPosition; +#endif +#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} + #ifdef HIGH_PRECISION +float precisionSafeLength( vec3 v ) { return length( v ); } + #else +float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; +} + #endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH +varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +uniform float time; +uniform float amplitude; +uniform float speed; +uniform float frequency; +vec3 mod289(vec3 x) { + return x - floor(x * (1.0 / 289.0)) * 289.0; +} +vec4 mod289(vec4 x) { + return x - floor(x * (1.0 / 289.0)) * 289.0; +} +vec4 permute(vec4 x) { + return mod289(((x*34.0)+1.0)*x); +} +vec4 taylorInvSqrt(vec4 r) +{ + return 1.79284291400159 - 0.85373472095314 * r; +} +float noise(vec3 v) +{ + const vec2 C = vec2(1.0/6.0, 1.0/3.0) ; + const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); + vec3 i = floor(v + dot(v, C.yyy) ); + vec3 x0 = v - i + dot(i, C.xxx) ; + vec3 g = step(x0.yzx, x0.xyz); + vec3 l = 1.0 - g; + vec3 i1 = min( g.xyz, l.zxy ); + vec3 i2 = max( g.xyz, l.zxy ); + vec3 x1 = x0 - i1 + C.xxx; + vec3 x2 = x0 - i2 + C.yyy; vec3 x3 = x0 - D.yyy; + i = mod289(i); + vec4 p = permute( permute( permute( + i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + + i.x + vec4(0.0, i1.x, i2.x, 1.0 )); + float n_ = 0.142857142857; vec3 ns = n_ * D.wyz - D.xzx; + vec4 j = p - 49.0 * floor(p * ns.z * ns.z); + vec4 x_ = floor(j * ns.z); + vec4 y_ = floor(j - 7.0 * x_ ); + vec4 x = x_ *ns.x + ns.yyyy; + vec4 y = y_ *ns.x + ns.yyyy; + vec4 h = 1.0 - abs(x) - abs(y); + vec4 b0 = vec4( x.xy, y.xy ); + vec4 b1 = vec4( x.zw, y.zw ); + vec4 s0 = floor(b0)*2.0 + 1.0; + vec4 s1 = floor(b1)*2.0 + 1.0; + vec4 sh = -step(h, vec4(0.0)); + vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; + vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; + vec3 p0 = vec3(a0.xy,h.x); + vec3 p1 = vec3(a0.zw,h.y); + vec3 p2 = vec3(a1.xy,h.z); + vec3 p3 = vec3(a1.zw,h.w); + vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); + p0 *= norm.x; + p1 *= norm.y; + p2 *= norm.z; + p3 *= norm.w; + vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); + m = m * m; + return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), + dot(p2,x2), dot(p3,x3) ) ); +} +float displace(vec3 point) { + return noise(vec3(point.x * frequency, point.z * frequency, time * speed)) * amplitude; +} +vec3 orthogonal(vec3 v) { + return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) + : vec3(0.0, -v.z, v.y)); +} +void main() { + vec3 displacedPosition = position + normal * displace(position); + float offset = 0.0078125; + vec3 tangent = orthogonal(normal); + vec3 bitangent = normalize(cross(normal, tangent)); + vec3 neighbour1 = position + tangent * offset; + vec3 neighbour2 = position + bitangent * offset; + vec3 displacedNeighbour1 = neighbour1 + normal * displace(neighbour1); + vec3 displacedNeighbour2 = neighbour2 + normal * displace(neighbour2); + vec3 displacedTangent = displacedNeighbour1 - displacedPosition; + vec3 displacedBitangent = displacedNeighbour2 - displacedPosition; + vec3 displacedNormal = normalize(cross(displacedTangent, displacedBitangent)); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 transformedNormal = displacedNormal; + #ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; + #endif + #ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif + #endif + #ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif + #endif + transformedNormal = normalMatrix * transformedNormal; + #ifdef FLIP_SIDED + transformedNormal = - transformedNormal; + #endif + #ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif + #endif + #include + #include + #include + #include + transformed = displacedPosition; + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; + #endif +}`,Kw=512,Zw=5,hp=10;let Rx={...ar.physical.uniforms,diffuse:{value:{r:.36,g:.51,b:.65}},roughness:{value:.5},amplitude:{value:.25},frequency:{value:.5},speed:{value:.3},time:{value:1}};const UX=new Ad(Zw,Zw,Kw,Kw).rotateX(-Math.PI/2),EP=new Ki({uniforms:Rx,vertexShader:NX,fragmentShader:bx,lights:!0,side:fi,defines:{STANDARD:"",PHYSICAL:""},extensions:{derivatives:!0},clipping:!0,clipShadows:!0});function OX(n,e){const t=new jx(.25,.03,100,16),i=EP;return new yn(t,i)}function FX(n){n.rotation.x+=.01,n.rotation.y+=.01}function Cx(n,e){if(n.hasOwnProperty("material")&&(n.material.clippingPlanes=[...e]),n.hasOwnProperty("traverse"))n.traverse(function(t){Cx(t,e)});else if(n.hasOwnProperty("children"))for(let t of n.children)Cx(t,e)}function kX(n,e,t,i,r,s=o=>{}){r.add(t);const o=new Ws;let a=!1,l=-100;const c=new ZT(16777215,.9);c.position.set(-.5,10,-10),o.add(c);const u=new m8(16777215,.3);o.add(u);const f=new PX(new Ad(1e4,1e4),{clipping:!0,clipShadows:!0,distortionScale:1/hp,fog:e.fog!==void 0,textureWidth:512,textureHeight:512,waterNormals:new Kx(Qi).load("assets/material/textures/waternormals.jpg",function(m){m.repeat.set(hp,hp),m.wrapS=m.wrapT=aa}),sunDirection:new Y,sunColor:16777215,waterColor:7695});f.rotation.x=-Math.PI/2,f.scale.x=f.scale.x,f.scale.y=f.scale.y,f.position.y=-hp/2;const h=new yn(UX,EP);h.position.set(0,-1,0);const p=I0;p.material=new Ki({uniforms:Rx,vertexShader:Yw,fragmentShader:bx});const g=OX(new tt(14540253));g.material=new Ki({uniforms:Rx,vertexShader:Yw,fragmentShader:bx}),g.position.set(0,1,0),o.add(h),o.add(p),o.add(g),e.add(o),o.translateX(0),o.translateY(1),o.translateZ(l);const _=.05;return console.log(o),s({soundMesh:g}),function(m,d,x,v,y,b){const w={};typeof v=="object"&&v!=null&&console.log("data_in:",v),FX(g),l+=_,l<-2.5?(o.translateZ(_),l<-25?(p.rotX(.05*(5*d)),p.rotY(.075*(5*d))):p.rotation.set(p.rotation.x-p.rotation.x/50,p.rotation.y-p.rotation.y/50,p.rotation.z-p.rotation.z/50)):(p.rotation.set(0,0,0),a||(a=!0,w.event="dream_landed")),h.material.uniforms.time.value=x,f.material.uniforms.time.value+=.1/60,b!==null&&b.length>0&&Cx(o,b),w.hasOwnProperty("event")&&typeof y=="function"&&y(w)}}const Qw=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} + #ifdef HIGH_PRECISION +float precisionSafeLength( vec3 v ) { return length( v ); } + #else +float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; +} + #endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH +varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec3 vPos; +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; + #endif + vViewPosition = - mvPosition.xyz; + vPos = position; + gl_Position = projectionMatrix * modelViewMatrix * vec4( vPos, 1.0 ); +} +`,Jw=`uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} + #ifdef HIGH_PRECISION +float precisionSafeLength( vec3 v ) { return length( v ); } + #else +float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; +} + #endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH +varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);} +vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;} +vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);} +float cnoise(vec3 P){ + vec3 Pi0 = floor(P); vec3 Pi1 = Pi0 + vec3(1.0); Pi0 = mod(Pi0, 289.0); + Pi1 = mod(Pi1, 289.0); + vec3 Pf0 = fract(P); vec3 Pf1 = Pf0 - vec3(1.0); vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); + vec4 iy = vec4(Pi0.yy, Pi1.yy); + vec4 iz0 = Pi0.zzzz; + vec4 iz1 = Pi1.zzzz; + vec4 ixy = permute(permute(ix) + iy); + vec4 ixy0 = permute(ixy + iz0); + vec4 ixy1 = permute(ixy + iz1); + vec4 gx0 = ixy0 / 7.0; + vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5; + gx0 = fract(gx0); + vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0); + vec4 sz0 = step(gz0, vec4(0.0)); + gx0 -= sz0 * (step(0.0, gx0) - 0.5); + gy0 -= sz0 * (step(0.0, gy0) - 0.5); + vec4 gx1 = ixy1 / 7.0; + vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5; + gx1 = fract(gx1); + vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1); + vec4 sz1 = step(gz1, vec4(0.0)); + gx1 -= sz1 * (step(0.0, gx1) - 0.5); + gy1 -= sz1 * (step(0.0, gy1) - 0.5); + vec3 g000 = vec3(gx0.x,gy0.x,gz0.x); + vec3 g100 = vec3(gx0.y,gy0.y,gz0.y); + vec3 g010 = vec3(gx0.z,gy0.z,gz0.z); + vec3 g110 = vec3(gx0.w,gy0.w,gz0.w); + vec3 g001 = vec3(gx1.x,gy1.x,gz1.x); + vec3 g101 = vec3(gx1.y,gy1.y,gz1.y); + vec3 g011 = vec3(gx1.z,gy1.z,gz1.z); + vec3 g111 = vec3(gx1.w,gy1.w,gz1.w); + vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); + g000 *= norm0.x; + g010 *= norm0.y; + g100 *= norm0.z; + g110 *= norm0.w; + vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); + g001 *= norm1.x; + g011 *= norm1.y; + g101 *= norm1.z; + g111 *= norm1.w; + float n000 = dot(g000, Pf0); + float n100 = dot(g100, vec3(Pf1.x, Pf0.yz)); + float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z)); + float n110 = dot(g110, vec3(Pf1.xy, Pf0.z)); + float n001 = dot(g001, vec3(Pf0.xy, Pf1.z)); + float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z)); + float n011 = dot(g011, vec3(Pf0.x, Pf1.yz)); + float n111 = dot(g111, Pf1); + vec3 fade_xyz = fade(Pf0); + vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z); + vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y); + float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); + return 2.2 * n_xyz; +} +varying vec3 vPos; +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include + gl_FragColor = gl_FragColor * 0.05; + float skyRadius = 5.01; + vec3 noiseOffset = vec3(100.01, 100.01, 100.01); + vec3 env_c1 = vec3(0.036, 0.051, 0.065); + vec3 env_c2 = vec3(0.065, 0.036, 0.051); + float clusterSize = 0.2; + float clusterStrength = 0.2; + float starSize = 0.01; + float starDensity = 0.09; + float freq = 1.1/skyRadius; + float noise = cnoise(vPos * freq); + vec4 backgroundColor = vec4(mix( + vec4(0.125 - mix(env_c1, vNormal * 0.25, noise), 1).rbg, + vec4(0.125 - mix(env_c2, vNormal * 0.25, noise), 1).rbg, + noise + ), 1.0); + gl_FragColor += backgroundColor; + float scaledClusterSize = (1.0/clusterSize)/skyRadius; + float scaledStarSize = (1.0/starSize)/skyRadius; + float cs = pow(cnoise(scaledClusterSize*vPos+noiseOffset),1.0/clusterStrength) + cnoise(scaledStarSize*vPos); + float c = clamp(pow(cs, 1.0/starDensity),0.0,1.0); + vec4 starColor = 0.5 * vec4(c, c, c, 1.0); + gl_FragColor += starColor; +} +`,BX=document.createElement("canvas"),Px=new WT(BX);function zX(n,e,t){const i=t*t;n.repeat.set(i,i),n.repeat.x=i,n.repeat.y=i,n.wrapS=n.wrapT=aa,n.colorSpace=En;const r=n.source.data.getContext("2d");r.canvas.width=r.canvas.height=i;const s=r.canvas.width,o=r.canvas.height;r.fillStyle="transparent",r.fillRect(0,0,r.canvas.width,r.canvas.height),r.strokeStyle=e,r.beginPath();for(let a=t/2;a<=s;a+=t)r.save(),r.translate(.5,0),r.moveTo(a-.5,0),r.lineTo(a-.5,o),r.restore();for(let a=t/2;a<=o;a+=t)r.save(),r.translate(0,.5),r.moveTo(0,a-.5),r.lineTo(s,a-.5),r.restore();return r.stroke(),r}zX(Px,"#09F",10);function I_(n,e){n.layers.set(e),n.traverse(function(t){t.layers.set(e)})}const Pr=new Map;Pr.set("inside",1);Pr.set("outside",2);Pr.set("portal",3);const Pl=new Map;Pl.set("white",new tt(16777215));Pl.set("grey",new tt(14540253));Pl.set("orangeLight",new tt(16766409));Pl.set("orangeDark",new tt(16495234));Pl.set("green",new tt(13161419));Pl.set("blue",new tt(12308958));const Vs=new Map;Vs.set("isLeft",!1);Vs.set("isRight",!1);Vs.set("isUp",!1);Vs.set("isDown",!1);const ms=new Map;ms.set("a","isLeft");ms.set("ArrowLeft","isLeft");ms.set("w","isUp");ms.set("ArrowUp","isUp");ms.set("s","isDown");ms.set("ArrowDown","isDown");ms.set("d","isRight");ms.set("ArrowRight","isRight");let fc=null,pf=null;const HX=[];let za=null;function VX(n,e){const t=new x8;return n.add(t),n.listener=t,window.listenerAnchor=n,new Promise((i,r)=>{const s=new M8(n.listener),o=new _8(Qi);document.body.append(Qi.div),o.load(e,a=>{s.setBuffer(a),s.setRefDistance(1),s.setVolume(1),n.sound=s,console.log("Play sound!"),s.play(),setTimeout(i,1500,s)})})}function GX(n){return new Promise((e,t)=>{const i=new E8(n,32);Qi.addLoadHandler(()=>{setTimeout(e,1500,i)})})}async function WX(n=(e,t,i,r)=>{}){const e=new JT;let t=!1;if(navigator.xr&&(t=await(navigator.xr.isSessionSupported("immersive-ar")||navigator.xr.isSessionSupported("immersive-vr"))),!t){const F=new hN(vN);F.installRuntime(),F.fovy=75/180*Math.PI,F.ipd=0,window.xrdevice=F,F.controllers.right.position.set(.15649,1.43474,-.38368),F.controllers.right.quaternion.set(.14766305685043335,.02471366710960865,-.0037767395842820406,.9887216687202454),F.controllers.left.position.set(-.15649,1.43474,-.38368),F.controllers.left.quaternion.set(.14766305685043335,.02471366710960865,-.0037767395842820406,.9887216687202454),new g$(F)}const i={width:window.innerWidth,height:window.innerHeight},r=new OM({antialias:!0});r.setPixelRatio(window.devicePixelRatio),r.setSize(i.width,i.height);function s(F,W){r.domElement.width=F,r.domElement.height=W,r.setSize(F,W)}const o=new WT(r.domElement),a=new OM({antialias:!0});a.setPixelRatio(window.devicePixelRatio),a.setSize(i.width,i.height),a.xr.enabled=!0;function l(F,W){a.setSize(F,W)}r.localClippingEnabled=!0,a.localClippingEnabled=!0,document.body.appendChild(r.domElement),r.domElement.style.display="inline-block",document.body.appendChild(a.domElement),a.domElement.style.display="inline-block";const c=new H6,u=new Ws;c.add(u);const f=new lt,h=document.createElement("div");h.id="data-pad",h.style="max-width: 100px; min-width: 100px; min-height: 320px; color: white; background-color: black;",h.innerHTML="More stats...
";const p=document.createElement("p");p.id="data-pad-data",p.innerHTML="",h.append(p);const g=new wP;g.showPanel(0),g.dom.append(h),g.dom.style.maxWidth="100px",g.dom.style.minWidth="100px",g.dom.style.backgroundColor="black",document.body.appendChild(g.dom);const _=new Jn(50,i.width/i.height,.1,100);_.position.set(0,1.6,1);function m(F,W){_.aspect=F/W,_.updateProjectionMatrix()}const d=new Y(0,.5,-1),x=new w$(_,a.domElement);x.enableZoom=!1,x.enablePan=!1,x.target=d,x.update();const v=new CX,y={left:null,right:null};for(let F=0;F<2;F++){const W=a.xr.getController(F),j=a.xr.getControllerGrip(F),le=v.createControllerModel(j);j.add(le),j.addEventListener("connected",pe=>{W.visible=!0,j.visible=!0;const ce=pe.data.handedness;y[ce]={gamepad:new M$(pe.data.gamepad),raySpace:W,gripSpace:j,mesh:le}}),j.addEventListener("disconnected",pe=>{W.visible=!1,j.visible=!1;const ce=pe.data.handedness;y[ce]=null}),u.add(W,j)}u.add(_);const b=n(a,c,_,y,u,async F=>{F.hasOwnProperty("soundMesh")&&(za=F.soundMesh,pf=await GX(await VX(za,"assets/audio/the_bardos_beyond_christmas.mp3")))}),T={...ar.physical.uniforms,diffuse:{value:{r:.36,g:.51,b:.65}},roughness:{value:.5},amplitude:{value:.25},frequency:{value:.5},speed:{value:.3},env_c1:{value:new tt("#0d1a2f")},env_c2:{value:new tt("#0f8682")},skyRadius:{value:5.01},noiseOffset:{value:new Y(100.01,100.01,100.01)},starSize:{value:.01},starDensity:{value:.09},clusterStrength:{value:.2},clusterSize:{value:.2},time:{value:1}};function C(F,W,j){const le=new $T(F,128,32),pe=j&&j!==null?new Or({uniforms:T,map:j,doubleSided:!0,defines:{STANDARD:"",PHYSICAL:""},extensions:{derivatives:!0},lights:!0,opacity:1,side:fi,transparent:!0}):new Ki({uniforms:T,vertexShader:Qw,fragmentShader:Jw,doubleSided:!0,defines:{STANDARD:"",PHYSICAL:""},extensions:{derivatives:!0},lights:!0,opacity:1,side:fi,transparent:!0});return j&&j!==null&&(pe.onBeforeCompile=ce=>{ce.uniforms.time=new Lf(1),ce.uniforms.uResolution=new Lf(f),ce.vertexShader=Qw,ce.fragmentShader=Jw,ce.fragmentShader=` + uniform float time; + uniform vec2 uResolution; +`+ce.fragmentShader},pe.onBeforeRender=ce=>{}),new yn(le,pe)}function M(F){const W=new Ad(F,F),j=new Or({map:o,opacity:1,side:fi});return j.onBeforeCompile=le=>{le.uniforms.uResolution=new Lf(f),le.fragmentShader=` + uniform vec2 uResolution; +`+le.fragmentShader,le.fragmentShader=le.fragmentShader.replace("#include ",` + vec2 pos = gl_FragCoord.xy/uResolution; + vec4 sampledDiffuseColor = texture2D( map, pos ); + diffuseColor *= sampledDiffuseColor; + `)},new yn(W,j)}console.log("canvasTexture:",Px);const S=C(50,Pl.get("orangeDark"),Px);S.position.y=0,I_(S,Pr.get("inside")),c.add(S);const k=M(1*2);k.position.set(0,1.2,0),I_(k,Pr.get("portal")),c.add(k);const U=.05,N=new Y;function X(){N.setFromMatrixColumn(_.matrix,0),N.crossVectors(_.up,N),_.position.addScaledVector(N,U)}function z(){N.setFromMatrixColumn(_.matrix,0),N.crossVectors(_.up,N),_.position.addScaledVector(N,-U)}function te(){N.setFromMatrixColumn(_.matrix,0),_.position.addScaledVector(N,-U)}function L(){N.setFromMatrixColumn(_.matrix,0),_.position.addScaledVector(N,U)}function Z(){Vs.get("isUp")&&X(),Vs.get("isDown")&&z(),Vs.get("isLeft")&&te(),Vs.get("isRight")&&L()}const ae=new Y;function fe(){_.getWorldDirection(ae),d.copy(_.position).add(ae.multiplyScalar(.01))}function Me(F,W){const j=new Y,le=100;return W.normalize(),j.addVectors(F,W.multiplyScalar(le)),j}const Ve=new Y(0,0,0),$=Me(Ve,new Y(0,-1,0)),oe=[];oe.push(Ve),oe.push($);const me=new xr;me.setFromPoints(oe);const de=me,be=new Xx({color:16711680}),Le=new qm(de,be);I_(Le,Pr.get("outside")),c.add(Le);const ke=new ui(new Y(0,0,1),0),Qe=new ui(new Y(0,0,-1),0);function V(){_.layers.disable(Pr.get("portal")),_.layers.disable(Pr.get("outside")),_.layers.enable(Pr.get("inside")),r.render(c,_)}function ot(){const F=e.getDelta(),W=e.getElapsedTime(),j={};r.clippingPlanes=[],_.layers.enable(Pr.get("inside")),_.layers.enable(Pr.get("outside"));let pe=a.xr.getCamera(_).matrixWorld,ce=new Y;ce.setFromMatrixPosition(pe);let Ee=pe.elements[8],ve=pe.elements[9],ue=pe.elements[10];new Y(-Ee,-ve,-ue).normalize();const Re=-1,Pe=1,ye=2.5,Se=1,Be=0,je=new Y(Re,ce.y,Be),J=new Y(Pe,ce.y,Be),H=new Y(ce.x,ye,Be),re=new Y(ce.x,Se,Be),q=new Y;q.subVectors(je,ce);const ie=new Y;ie.subVectors(J,ce);const xe=new Y;xe.subVectors(H,ce);const we=new Y;we.subVectors(re,ce);const Ye=new Y(1,0,0),ut=q.clone().cross(new Y(0,1,0)).normalize(),it=Ye.angleTo(ut.clone()),ft=Math.cos(it)*Re,Kt=new Y(-1,0,0),ri=ie.clone().cross(new Y(0,-1,0)).normalize(),Oi=Kt.angleTo(ri.clone()),xs=Math.cos(Oi)*Pe,ir=new Y(0,-1,0),ys=xe.clone().cross(new Y(1,0,0)).normalize(),jr=ir.angleTo(ys.clone()),co=Math.cos(jr)*ye,yr=ce.z>Be?new Y(0,1,0):new Y(0,-1,0),uo=we.clone().cross(new Y(-1,0,0)).normalize(),qr=yr.angleTo(uo.clone()),ya=Math.cos(qr)*Se,Ss=new ui(ut.clone(),-ft),fo=new ui(ri.clone(),xs),I=new ui(ys.clone(),co),se=new ui(uo.clone(),ya*-(Se-.001)),R=JSON.stringify({leftΘ:it,leftX:ft,rightΘ:Oi,rightX:xs,topΘ:jr,topY:co,bottomΘ:qr,bottomY:ya}).replace(new RegExp("\\\\n","g"),"
").replace(new RegExp('":',"g"),'":
').replace(new RegExp(",","g"),'",
').replace(new RegExp("{","g"),"{
").replace(new RegExp("}","g"),"
}");p.innerHTML=R,a.clippingPlanes=ce.z>Be?[Qe,Ss,fo,I,se]:[ke,Qe,Ss,fo,I,se],k.material.side=Wr,S.material.hasOwnProperty("clippingPlanes")&&(S.material.clippingPlanes=[Qe,Ss,fo,I,se]),S.material.hasOwnProperty("uniforms")&&(S.material.uniforms.time.value=W),b(fc,F,W,Object.keys(j).length>0?j:null,null,[Qe,Ss,fo,I,se]),T.time.value=W,a.render(c,_)}function ee(F){g.begin(),pf&&pf.hasOwnProperty("analyser")&&typeof pf.getFrequencyData=="function"&&za.hasOwnProperty("sound")&&za.sound.isPlaying&&HX.push([...pf.getFrequencyData()]),Z(),fe(),(fc===null||!t)&&V(),ot(),g.end()}function at(F,W){f.set(F,W),s(F,W),l(F,W),m(F,W)}function Ne(F,W){Vs.set(F,W)}function Ze(F){const W=ms.get(F.key);W&&Ne(W,!0)}function Ie(F){const W=ms.get(F.key);W&&Ne(W,!1)}function We(){const F={optionalFeatures:["local-floor","bounded-floor","hand-tracking","layers"],requiredFeatures:[]};if(navigator.xr.requestSession("immersive-ar",F).then(B),navigator.getVRDisplays){let W=function(){navigator.getVRDisplays().then(j=>{if(console.log("Checking VR display"),j.length)for(const le of j)console.log("Found VR Display:",le);else throw new Error("No VR display found")})};window.addEventListener("vrdisplayconnect",W),window.addEventListener("vrdisplaydisconnect",j=>console.log.bind(console)),window.addEventListener("vrdisplayactivate",j=>console.log.bind(console)),window.addEventListener("vrdisplaydeactivate",j=>console.log.bind(console)),window.addEventListener("vrdisplayblur",j=>console.log.bind(console)),window.addEventListener("vrdisplayfocus",j=>console.log.bind(console)),window.addEventListener("vrdisplaypointerrestricted",j=>console.log.bind(console)),window.addEventListener("vrdisplaypointerunrestricted",j=>console.log.bind(console)),window.addEventListener("vrdisplaypresentchange",j=>console.log.bind(console))}}async function B(F){a.xr.setSession(F).then(()=>{fc=F,fc.addEventListener("end",E)}),za.hasOwnProperty("sound")&&(console.log("Play sound!"),za.sound.pause(),za.sound.play())}function E(){fc.removeEventListener("end",E),fc=null}const A=document.createElement("button");A.className="xr-button",A.innerHTML="Enter XR",A.addEventListener("click",async()=>{console.log("XR Button clicked"),We(),_.position.y=0,u.position.z=_.position.z,u.position.y=_.position.y,i.width=window.innerWidth,i.height=window.innerHeight,at(i.width,i.height)}),document.body.appendChild(A),window.addEventListener("keydown",Ze),window.addEventListener("keyup",Ie),at(i.width,i.height),a.setAnimationLoop(ee)}WX(kX).then(()=>{console.log("WebGL scene has been initialized")}); diff --git a/public/threejs-portal-effect/assets/index-CDcHs4iU.js b/public/threejs-portal-effect/assets/index-CDcHs4iU.js new file mode 100644 index 0000000..44a9f92 --- /dev/null +++ b/public/threejs-portal-effect/assets/index-CDcHs4iU.js @@ -0,0 +1,9535 @@ +import wP from"https://unpkg.com/three@0.118.3/examples/jsm/libs/stats.module.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();/** + * @license + * Copyright 2010-2024 Three.js Authors + * SPDX-License-Identifier: MIT + */const Lx="170",Nc={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},hc={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},TP=0,NS=1,AP=2,eT=1,bP=2,Ns=3,Wr=0,Ri=1,fi=2,Yo=0,Uc=1,US=2,OS=3,FS=4,RP=5,Ya=100,CP=101,PP=102,LP=103,IP=104,DP=200,NP=201,UP=202,OP=203,D_=204,N_=205,FP=206,kP=207,BP=208,zP=209,HP=210,VP=211,GP=212,WP=213,$P=214,U_=0,O_=1,F_=2,Yc=3,k_=4,B_=5,z_=6,H_=7,tT=0,XP=1,jP=2,Ko=0,qP=1,YP=2,KP=3,ZP=4,QP=5,JP=6,e4=7,kS="attached",t4="detached",nT=300,Kc=301,Zc=302,V_=303,G_=304,$m=306,aa=1e3,Wo=1001,Kp=1002,ni=1003,iT=1004,mf=1005,$i=1006,pp=1007,os=1008,Zs=1009,rT=1010,sT=1011,jf=1012,Ix=1013,ml=1014,Ur=1015,wd=1016,Dx=1017,Nx=1018,Qc=1020,oT=35902,aT=1021,lT=1022,fr=1023,cT=1024,uT=1025,Oc=1026,Jc=1027,Ux=1028,Ox=1029,fT=1030,Fx=1031,kx=1033,mp=33776,gp=33777,_p=33778,vp=33779,W_=35840,$_=35841,X_=35842,j_=35843,q_=36196,Y_=37492,K_=37496,Z_=37808,Q_=37809,J_=37810,ev=37811,tv=37812,nv=37813,iv=37814,rv=37815,sv=37816,ov=37817,av=37818,lv=37819,cv=37820,uv=37821,xp=36492,fv=36494,dv=36495,dT=36283,hv=36284,pv=36285,mv=36286,qf=2300,Yf=2301,D0=2302,BS=2400,zS=2401,HS=2402,n4=2500,i4=0,hT=1,gv=2,r4=3200,s4=3201,pT=0,o4=1,Bo="",En="srgb",pi="srgb-linear",Xm="linear",kt="srgb",Il=7680,VS=519,a4=512,l4=513,c4=514,mT=515,u4=516,f4=517,d4=518,h4=519,_v=35044,GS="300 es",Gs=2e3,Zp=2001;let bl=class{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){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s>8&255]+$n[n>>16&255]+$n[n>>24&255]+"-"+$n[e&255]+$n[e>>8&255]+"-"+$n[e>>16&15|64]+$n[e>>24&255]+"-"+$n[t&63|128]+$n[t>>8&255]+"-"+$n[t>>16&255]+$n[t>>24&255]+$n[i&255]+$n[i>>8&255]+$n[i>>16&255]+$n[i>>24&255]).toLowerCase()}function Hn(n,e,t){return Math.max(e,Math.min(t,n))}function Bx(n,e){return(n%e+e)%e}function p4(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function m4(n,e,t){return n!==e?(t-n)/(e-n):0}function Cf(n,e,t){return(1-t)*n+t*e}function g4(n,e,t,i){return Cf(n,e,1-Math.exp(-t*i))}function _4(n,e=1){return e-Math.abs(Bx(n,e*2)-e)}function v4(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function x4(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function y4(n,e){return n+Math.floor(Math.random()*(e-n+1))}function S4(n,e){return n+Math.random()*(e-n)}function M4(n){return n*(.5-Math.random())}function E4(n){n!==void 0&&(WS=n);let e=WS+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function w4(n){return n*Rf}function T4(n){return n*eu}function A4(n){return(n&n-1)===0&&n!==0}function b4(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function R4(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function C4(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),u=o((e+i)/2),f=s((e-i)/2),h=o((e-i)/2),p=s((i-e)/2),g=o((i-e)/2);switch(r){case"XYX":n.set(a*u,l*f,l*h,a*c);break;case"YZY":n.set(l*h,a*u,l*f,a*c);break;case"ZXZ":n.set(l*f,l*h,a*u,a*c);break;case"XZX":n.set(a*u,l*g,l*p,a*c);break;case"YXY":n.set(l*p,a*u,l*g,a*c);break;case"ZYZ":n.set(l*g,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function Dr(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 Dt(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.")}}const gT={DEG2RAD:Rf,RAD2DEG:eu,generateUUID:Br,clamp:Hn,euclideanModulo:Bx,mapLinear:p4,inverseLerp:m4,lerp:Cf,damp:g4,pingpong:_4,smoothstep:v4,smootherstep:x4,randInt:y4,randFloat:S4,randFloatSpread:M4,seededRandom:E4,degToRad:w4,radToDeg:T4,isPowerOfTwo:A4,ceilPowerOfTwo:b4,floorPowerOfTwo:R4,setQuaternionFromProperEuler:C4,normalize:Dt,denormalize:Dr};let lt=class _T{constructor(e=0,t=0){_T.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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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(Hn(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,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},xt=class vT{constructor(e,t,i,r,s,o,a,l,c){vT.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=o,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,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],f=i[7],h=i[2],p=i[5],g=i[8],_=r[0],m=r[3],d=r[6],x=r[1],v=r[4],y=r[7],b=r[2],w=r[5],T=r[8];return s[0]=o*_+a*x+l*b,s[3]=o*m+a*v+l*w,s[6]=o*d+a*y+l*T,s[1]=c*_+u*x+f*b,s[4]=c*m+u*v+f*w,s[7]=c*d+u*y+f*T,s[2]=h*_+p*x+g*b,s[5]=h*m+p*v+g*w,s[8]=h*d+p*y+g*T,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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*s*u+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,h=a*l-u*s,p=c*s-o*l,g=t*f+i*h+r*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=f*_,e[1]=(r*c-u*i)*_,e[2]=(a*i-r*o)*_,e[3]=h*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-a*t)*_,e[6]=p*_,e[7]=(i*l-c*t)*_,e[8]=(o*t-i*s)*_,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,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(N0.makeScale(e,t)),this}rotate(e){return this.premultiply(N0.makeRotation(-e)),this}translate(e,t){return this.premultiply(N0.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 N0=new xt;function xT(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Kf(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function P4(){const n=Kf("canvas");return n.style.display="block",n}const $S={};function gf(n){n in $S||($S[n]=!0,console.warn(n))}function L4(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)})}function I4(n){const e=n.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function D4(n){const e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const wt={enabled:!0,workingColorSpace:pi,spaces:{},convert:function(n,e,t){return this.enabled===!1||e===t||!e||!t||(this.spaces[e].transfer===kt&&(n.r=Ys(n.r),n.g=Ys(n.g),n.b=Ys(n.b)),this.spaces[e].primaries!==this.spaces[t].primaries&&(n.applyMatrix3(this.spaces[e].toXYZ),n.applyMatrix3(this.spaces[t].fromXYZ)),this.spaces[t].transfer===kt&&(n.r=Fc(n.r),n.g=Fc(n.g),n.b=Fc(n.b))),n},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)},getPrimaries:function(n){return this.spaces[n].primaries},getTransfer:function(n){return n===Bo?Xm:this.spaces[n].transfer},getLuminanceCoefficients:function(n,e=this.workingColorSpace){return n.fromArray(this.spaces[e].luminanceCoefficients)},define:function(n){Object.assign(this.spaces,n)},_getMatrix:function(n,e,t){return n.copy(this.spaces[e].toXYZ).multiply(this.spaces[t].fromXYZ)},_getDrawingBufferColorSpace:function(n){return this.spaces[n].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(n=this.workingColorSpace){return this.spaces[n].workingColorSpaceConfig.unpackColorSpace}};function Ys(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Fc(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const XS=[.64,.33,.3,.6,.15,.06],jS=[.2126,.7152,.0722],qS=[.3127,.329],YS=new xt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),KS=new xt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);wt.define({[pi]:{primaries:XS,whitePoint:qS,transfer:Xm,toXYZ:YS,fromXYZ:KS,luminanceCoefficients:jS,workingColorSpaceConfig:{unpackColorSpace:En},outputColorSpaceConfig:{drawingBufferColorSpace:En}},[En]:{primaries:XS,whitePoint:qS,transfer:kt,toXYZ:YS,fromXYZ:KS,luminanceCoefficients:jS,outputColorSpaceConfig:{drawingBufferColorSpace:En}}});let Dl,N4=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Dl===void 0&&(Dl=Kf("canvas")),Dl.width=e.width,Dl.height=e.height;const i=Dl.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Dl}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Kf("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 o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==nT)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case aa:e.x=e.x-Math.floor(e.x);break;case Wo:e.x=e.x<0?0:1;break;case Kp: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 aa:e.y=e.y-Math.floor(e.y);break;case Wo:e.y=e.y<0?0:1;break;case Kp: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++}};mi.DEFAULT_IMAGE=null;mi.DEFAULT_MAPPING=nT;mi.DEFAULT_ANISOTROPY=1;let Ct=class ST{constructor(e=0,t=0,i=0,r=1){ST.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,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[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],f=l[8],h=l[1],p=l[5],g=l[9],_=l[2],m=l[6],d=l[10];if(Math.abs(u-h)<.01&&Math.abs(f-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+p+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const v=(c+1)/2,y=(p+1)/2,b=(d+1)/2,w=(u+h)/4,T=(f+_)/4,C=(g+m)/4;return v>y&&v>b?v<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(v),r=w/i,s=T/i):y>b?y<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(y),i=w/r,s=C/r):b<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(b),i=T/s,r=C/s),this.set(i,r,s,t),this}let x=Math.sqrt((m-g)*(m-g)+(f-_)*(f-_)+(h-u)*(h-u));return Math.abs(x)<.001&&(x=1),this.x=(m-g)/x,this.y=(f-_)/x,this.z=(h-u)/x,this.w=Math.acos((c+p+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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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}},F4=class extends bl{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ct(0,0,e,t),this.scissorTest=!1,this.viewport=new Ct(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:$i,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new mi(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a=0?1:-1,v=1-d*d;if(v>Number.EPSILON){const b=Math.sqrt(v),w=Math.atan2(b,d*x);m=Math.sin(m*w)/b,a=Math.sin(a*w)/b}const y=a*x;if(l=l*m+h*y,c=c*m+p*y,u=u*m+g*y,f=f*m+_*y,m===1-a){const b=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=b,c*=b,u*=b,f*=b}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],f=s[o],h=s[o+1],p=s[o+2],g=s[o+3];return e[t]=a*g+u*f+l*p-c*h,e[t+1]=l*g+u*h+c*f-a*p,e[t+2]=c*g+u*p+a*h-l*f,e[t+3]=u*g-a*f-l*h-c*p,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,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),f=a(s/2),h=l(i/2),p=l(r/2),g=l(s/2);switch(o){case"XYZ":this._x=h*u*f+c*p*g,this._y=c*p*f-h*u*g,this._z=c*u*g+h*p*f,this._w=c*u*f-h*p*g;break;case"YXZ":this._x=h*u*f+c*p*g,this._y=c*p*f-h*u*g,this._z=c*u*g-h*p*f,this._w=c*u*f+h*p*g;break;case"ZXY":this._x=h*u*f-c*p*g,this._y=c*p*f+h*u*g,this._z=c*u*g+h*p*f,this._w=c*u*f-h*p*g;break;case"ZYX":this._x=h*u*f-c*p*g,this._y=c*p*f+h*u*g,this._z=c*u*g-h*p*f,this._w=c*u*f+h*p*g;break;case"YZX":this._x=h*u*f+c*p*g,this._y=c*p*f+h*u*g,this._z=c*u*g-h*p*f,this._w=c*u*f-h*p*g;break;case"XZY":this._x=h*u*f-c*p*g,this._y=c*p*f-h*u*g,this._z=c*u*g+h*p*f,this._w=c*u*f+h*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}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],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],h=i+a+f;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(o-r)*p}else if(i>a&&i>f){const p=2*Math.sqrt(1+i-a-f);this._w=(u-l)/p,this._x=.25*p,this._y=(r+o)/p,this._z=(s+c)/p}else if(a>f){const p=2*Math.sqrt(1+a-i-f);this._w=(s-c)/p,this._x=(r+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+f-i-a);this._w=(o-r)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.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(Hn(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,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),f=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=o*f+this._w*h,this._x=i*f+this._x*h,this._y=r*f+this._y*h,this._z=s*f+this._z*h,this._onChangeCallback(),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}},Y=class ET{constructor(e=0,t=0,i=0){ET.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(ZS.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ZS.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,o=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])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),u=2*(a*t-s*r),f=2*(s*i-o*t);return this.x=t+l*c+o*f-a*u,this.y=i+l*u+a*c-s*f,this.z=r+l*f+s*u-o*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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,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 O0.copy(this).projectOnVector(e),this.sub(O0)}reflect(e){return this.sub(O0.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(Hn(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 O0=new Y,ZS=new mr;let oo=class{constructor(e=new Y(1/0,1/0,1/0),t=new Y(-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=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,Mr),Mr.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(Ou),Wd.subVectors(this.max,Ou),Nl.subVectors(e.a,Ou),Ul.subVectors(e.b,Ou),Ol.subVectors(e.c,Ou),po.subVectors(Ul,Nl),mo.subVectors(Ol,Ul),Sa.subVectors(Nl,Ol);let t=[0,-po.z,po.y,0,-mo.z,mo.y,0,-Sa.z,Sa.y,po.z,0,-po.x,mo.z,0,-mo.x,Sa.z,0,-Sa.x,-po.y,po.x,0,-mo.y,mo.x,0,-Sa.y,Sa.x,0];return!F0(t,Nl,Ul,Ol,Wd)||(t=[1,0,0,0,1,0,0,0,1],!F0(t,Nl,Ul,Ol,Wd))?!1:($d.crossVectors(po,mo),t=[$d.x,$d.y,$d.z],F0(t,Nl,Ul,Ol,Wd))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Mr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Mr).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:(Es[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Es[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Es[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Es[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Es[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Es[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Es[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Es[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Es),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)}};const Es=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],Mr=new Y,Gd=new oo,Nl=new Y,Ul=new Y,Ol=new Y,po=new Y,mo=new Y,Sa=new Y,Ou=new Y,Wd=new Y,$d=new Y,Ma=new Y;function F0(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Ma.fromArray(n,s);const a=r.x*Math.abs(Ma.x)+r.y*Math.abs(Ma.y)+r.z*Math.abs(Ma.z),l=e.dot(Ma),c=t.dot(Ma),u=i.dot(Ma);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const B4=new oo,Fu=new Y,k0=new Y;let gs=class{constructor(e=new Y,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):B4.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;sthis.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;Fu.subVectors(e,this.center);const t=Fu.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Fu,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):(k0.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Fu.copy(e.center).add(k0)),this.expandByPoint(Fu.copy(e.center).sub(k0))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};const ws=new Y,B0=new Y,Xd=new Y,go=new Y,z0=new Y,jd=new Y,H0=new Y;let Td=class{constructor(e=new Y,t=new Y(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,ws)),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=ws.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ws.copy(this.origin).addScaledVector(this.direction,t),ws.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){B0.copy(e).add(t).multiplyScalar(.5),Xd.copy(t).sub(e).normalize(),go.copy(this.origin).sub(B0);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Xd),a=go.dot(this.direction),l=-go.dot(Xd),c=go.lengthSq(),u=Math.abs(1-o*o);let f,h,p,g;if(u>0)if(f=o*l-a,h=o*a-l,g=s*u,f>=0)if(h>=-g)if(h<=g){const _=1/u;f*=_,h*=_,p=f*(f+o*h+2*a)+h*(o*f+h+2*l)+c}else h=s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h=-s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h<=-g?(f=Math.max(0,-(-o*s+a)),h=f>0?-s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c):h<=g?(f=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(f=Math.max(0,-(o*s+a)),h=f>0?s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c);else h=o>0?-s:s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(B0).addScaledVector(Xd,h),p}intersectSphere(e,t){ws.subVectors(e.center,this.origin);const i=ws.dot(this.direction),r=ws.dot(ws)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return 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,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,f=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,o=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o=0?(a=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||a>r)||((a>i||i!==i)&&(i=a),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,ws)!==null}intersectTriangle(e,t,i,r,s){z0.subVectors(t,e),jd.subVectors(i,e),H0.crossVectors(z0,jd);let o=this.direction.dot(H0),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;go.subVectors(this.origin,e);const l=a*this.direction.dot(jd.crossVectors(go,jd));if(l<0)return null;const c=a*this.direction.dot(z0.cross(go));if(c<0||l+c>o)return null;const u=-a*go.dot(H0);return u<0?null:this.at(u/o,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)}},dt=class vv{constructor(e,t,i,r,s,o,a,l,c,u,f,h,p,g,_,m){vv.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,o,a,l,c,u,f,h,p,g,_,m)}set(e,t,i,r,s,o,a,l,c,u,f,h,p,g,_,m){const d=this.elements;return d[0]=e,d[4]=t,d[8]=i,d[12]=r,d[1]=s,d[5]=o,d[9]=a,d[13]=l,d[2]=c,d[6]=u,d[10]=f,d[14]=h,d[3]=p,d[7]=g,d[11]=_,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 vv().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 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){const t=this.elements,i=e.elements,r=1/Fl.setFromMatrixColumn(e,0).length(),s=1/Fl.setFromMatrixColumn(e,1).length(),o=1/Fl.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]*o,t[9]=i[9]*o,t[10]=i[10]*o,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,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=o*u,p=o*f,g=a*u,_=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=p+g*c,t[5]=h-_*c,t[9]=-a*l,t[2]=_-h*c,t[6]=g+p*c,t[10]=o*l}else if(e.order==="YXZ"){const h=l*u,p=l*f,g=c*u,_=c*f;t[0]=h+_*a,t[4]=g*a-p,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=p*a-g,t[6]=_+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*u,p=l*f,g=c*u,_=c*f;t[0]=h-_*a,t[4]=-o*f,t[8]=g+p*a,t[1]=p+g*a,t[5]=o*u,t[9]=_-h*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*u,p=o*f,g=a*u,_=a*f;t[0]=l*u,t[4]=g*c-p,t[8]=h*c+_,t[1]=l*f,t[5]=_*c+h,t[9]=p*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,p=o*c,g=a*l,_=a*c;t[0]=l*u,t[4]=_-h*f,t[8]=g*f+p,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*f+g,t[10]=h-_*f}else if(e.order==="XZY"){const h=o*l,p=o*c,g=a*l,_=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=h*f+_,t[5]=o*u,t[9]=p*f-g,t[2]=g*f-p,t[6]=a*u,t[10]=_*f+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(z4,e,H4)}lookAt(e,t,i){const r=this.elements;return Fi.subVectors(e,t),Fi.lengthSq()===0&&(Fi.z=1),Fi.normalize(),_o.crossVectors(i,Fi),_o.lengthSq()===0&&(Math.abs(i.z)===1?Fi.x+=1e-4:Fi.z+=1e-4,Fi.normalize(),_o.crossVectors(i,Fi)),_o.normalize(),qd.crossVectors(Fi,_o),r[0]=_o.x,r[4]=qd.x,r[8]=Fi.x,r[1]=_o.y,r[5]=qd.y,r[9]=Fi.y,r[2]=_o.z,r[6]=qd.z,r[10]=Fi.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,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],f=i[5],h=i[9],p=i[13],g=i[2],_=i[6],m=i[10],d=i[14],x=i[3],v=i[7],y=i[11],b=i[15],w=r[0],T=r[4],C=r[8],M=r[12],S=r[1],P=r[5],k=r[9],U=r[13],N=r[2],X=r[6],z=r[10],te=r[14],L=r[3],Z=r[7],ae=r[11],fe=r[15];return s[0]=o*w+a*S+l*N+c*L,s[4]=o*T+a*P+l*X+c*Z,s[8]=o*C+a*k+l*z+c*ae,s[12]=o*M+a*U+l*te+c*fe,s[1]=u*w+f*S+h*N+p*L,s[5]=u*T+f*P+h*X+p*Z,s[9]=u*C+f*k+h*z+p*ae,s[13]=u*M+f*U+h*te+p*fe,s[2]=g*w+_*S+m*N+d*L,s[6]=g*T+_*P+m*X+d*Z,s[10]=g*C+_*k+m*z+d*ae,s[14]=g*M+_*U+m*te+d*fe,s[3]=x*w+v*S+y*N+b*L,s[7]=x*T+v*P+y*X+b*Z,s[11]=x*C+v*k+y*z+b*ae,s[15]=x*M+v*U+y*te+b*fe,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],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],h=e[10],p=e[14],g=e[3],_=e[7],m=e[11],d=e[15];return g*(+s*l*f-r*c*f-s*a*h+i*c*h+r*a*p-i*l*p)+_*(+t*l*p-t*c*h+s*o*h-r*o*p+r*c*u-s*l*u)+m*(+t*c*f-t*a*p-s*o*f+i*o*p+s*a*u-i*c*u)+d*(-r*a*u-t*l*f+t*a*h+r*o*f-i*o*h+i*l*u)}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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],h=e[10],p=e[11],g=e[12],_=e[13],m=e[14],d=e[15],x=f*m*c-_*h*c+_*l*p-a*m*p-f*l*d+a*h*d,v=g*h*c-u*m*c-g*l*p+o*m*p+u*l*d-o*h*d,y=u*_*c-g*f*c+g*a*p-o*_*p-u*a*d+o*f*d,b=g*f*l-u*_*l-g*a*h+o*_*h+u*a*m-o*f*m,w=t*x+i*v+r*y+s*b;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/w;return e[0]=x*T,e[1]=(_*h*s-f*m*s-_*r*p+i*m*p+f*r*d-i*h*d)*T,e[2]=(a*m*s-_*l*s+_*r*c-i*m*c-a*r*d+i*l*d)*T,e[3]=(f*l*s-a*h*s-f*r*c+i*h*c+a*r*p-i*l*p)*T,e[4]=v*T,e[5]=(u*m*s-g*h*s+g*r*p-t*m*p-u*r*d+t*h*d)*T,e[6]=(g*l*s-o*m*s-g*r*c+t*m*c+o*r*d-t*l*d)*T,e[7]=(o*h*s-u*l*s+u*r*c-t*h*c-o*r*p+t*l*p)*T,e[8]=y*T,e[9]=(g*f*s-u*_*s-g*i*p+t*_*p+u*i*d-t*f*d)*T,e[10]=(o*_*s-g*a*s+g*i*c-t*_*c-o*i*d+t*a*d)*T,e[11]=(u*a*s-o*f*s-u*i*c+t*f*c+o*i*p-t*a*p)*T,e[12]=b*T,e[13]=(u*_*r-g*f*r+g*i*h-t*_*h-u*i*m+t*f*m)*T,e[14]=(g*a*r-o*_*r-g*i*l+t*_*l+o*i*m-t*a*m)*T,e[15]=(o*f*r-u*a*r+u*i*l-t*f*l-o*i*h+t*a*h)*T,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,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,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,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,h=s*c,p=s*u,g=s*f,_=o*u,m=o*f,d=a*f,x=l*c,v=l*u,y=l*f,b=i.x,w=i.y,T=i.z;return r[0]=(1-(_+d))*b,r[1]=(p+y)*b,r[2]=(g-v)*b,r[3]=0,r[4]=(p-y)*w,r[5]=(1-(h+d))*w,r[6]=(m+x)*w,r[7]=0,r[8]=(g+v)*T,r[9]=(m-x)*T,r[10]=(1-(h+_))*T,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;let s=Fl.set(r[0],r[1],r[2]).length();const o=Fl.set(r[4],r[5],r[6]).length(),a=Fl.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Er.copy(this);const c=1/s,u=1/o,f=1/a;return Er.elements[0]*=c,Er.elements[1]*=c,Er.elements[2]*=c,Er.elements[4]*=u,Er.elements[5]*=u,Er.elements[6]*=u,Er.elements[8]*=f,Er.elements[9]*=f,Er.elements[10]*=f,t.setFromRotationMatrix(Er),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Gs){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),f=(t+e)/(t-e),h=(i+r)/(i-r);let p,g;if(a===Gs)p=-(o+s)/(o-s),g=-2*o*s/(o-s);else if(a===Zp)p=-o/(o-s),g=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Gs){const l=this.elements,c=1/(t-e),u=1/(i-r),f=1/(o-s),h=(t+e)*c,p=(i+r)*u;let g,_;if(a===Gs)g=(o+s)*f,_=-2*f;else if(a===Zp)g=s*f,_=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[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 Fl=new Y,Er=new dt,z4=new Y(0,0,0),H4=new Y(1,1,1),_o=new Y,qd=new Y,Fi=new Y,QS=new dt,JS=new mr;let ca=class wT{constructor(e=0,t=0,i=0,r=wT.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],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],h=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(Hn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Hn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Hn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Hn(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Hn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-Hn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return QS.makeRotationFromQuaternion(e),this.setFromRotationMatrix(QS,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return JS.setFromEuler(this),this.setFromQuaternion(JS,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}};ca.DEFAULT_ORDER="XYZ";let TT=class{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),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.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?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 a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),f.length>0&&(i.shapes=f),h.length>0&&(i.skeletons=h),p.length>0&&(i.animations=p),g.length>0&&(i.nodes=g)}return i.object=r,i;function o(a){const l=[];for(const c in a){const u=a[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),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){wr.subVectors(r,t),As.subVectors(i,t),G0.subVectors(e,t);const o=wr.dot(wr),a=wr.dot(As),l=wr.dot(G0),c=As.dot(As),u=As.dot(G0),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const h=1/f,p=(c*l-a*u)*h,g=(o*u-a*l)*h;return s.set(1-p-g,g,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,bs)===null?!1:bs.x>=0&&bs.y>=0&&bs.x+bs.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,bs)===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,bs.x),l.addScaledVector(o,bs.y),l.addScaledVector(a,bs.z),l)}static getInterpolatedAttribute(e,t,i,r,s,o){return j0.setScalar(0),q0.setScalar(0),Y0.setScalar(0),j0.fromBufferAttribute(e,t),q0.fromBufferAttribute(e,i),Y0.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(j0,s.x),o.addScaledVector(q0,s.y),o.addScaledVector(Y0,s.z),o}static isFrontFacing(e,t,i,r){return wr.subVectors(i,t),As.subVectors(e,t),wr.cross(As).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 wr.subVectors(this.c,this.b),As.subVectors(this.a,this.b),wr.cross(As).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return dc.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return dc.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return dc.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return dc.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return dc.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 o,a;zl.subVectors(r,i),Hl.subVectors(s,i),W0.subVectors(e,i);const l=zl.dot(W0),c=Hl.dot(W0);if(l<=0&&c<=0)return t.copy(i);$0.subVectors(e,r);const u=zl.dot($0),f=Hl.dot($0);if(u>=0&&f<=u)return t.copy(r);const h=l*f-u*c;if(h<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(zl,o);X0.subVectors(e,s);const p=zl.dot(X0),g=Hl.dot(X0);if(g>=0&&p<=g)return t.copy(s);const _=p*c-l*g;if(_<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(i).addScaledVector(Hl,a);const m=u*g-p*f;if(m<=0&&f-u>=0&&p-g>=0)return sM.subVectors(s,r),a=(f-u)/(f-u+(p-g)),t.copy(r).addScaledVector(sM,a);const d=1/(m+_+h);return o=_*d,a=h*d,t.copy(i).addScaledVector(zl,o).addScaledVector(Hl,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};const AT={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},vo={h:0,s:0,l:0},Kd={h:0,s:0,l:0};function K0(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}let tt=class{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=En){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,wt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=wt.workingColorSpace){return this.r=e,this.g=t,this.b=i,wt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=wt.workingColorSpace){if(e=Bx(e,1),t=Hn(t,0,1),i=Hn(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=K0(o,s,e+1/3),this.g=K0(o,s,e),this.b=K0(o,s,e-1/3)}return wt.toWorkingColorSpace(this,r),this}setStyle(e,t=En){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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(a))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(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=En){const i=AT[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.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=Ys(e.r),this.g=Ys(e.g),this.b=Ys(e.b),this}copyLinearToSRGB(e){return this.r=Fc(e.r),this.g=Fc(e.g),this.b=Fc(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=En){return wt.fromWorkingColorSpace(Xn.copy(this),e),Math.round(Hn(Xn.r*255,0,255))*65536+Math.round(Hn(Xn.g*255,0,255))*256+Math.round(Hn(Xn.b*255,0,255))}getHexString(e=En){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=wt.workingColorSpace){wt.fromWorkingColorSpace(Xn.copy(this),t);const i=Xn.r,r=Xn.g,s=Xn.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case i:l=(r-s)/f+(r0!=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){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.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.6,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.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!==Uc&&(i.blending=this.blending),this.side!==Wr&&(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!==D_&&(i.blendSrc=this.blendSrc),this.blendDst!==N_&&(i.blendDst=this.blendDst),this.blendEquation!==Ya&&(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!==Yc&&(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!==VS&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Il&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Il&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Il&&(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.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 o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}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.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++}onBuild(){console.warn("Material: onBuild() has been removed.")}},Or=class extends cs{static get type(){return"MeshBasicMaterial"}constructor(e){super(),this.isMeshBasicMaterial=!0,this.color=new tt(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 ca,this.combine=tT,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 gn=new Y,Zd=new lt;let di=class{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=_v,this.updateRanges=[],this.gpuType=Ur,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;rt.count&&console.warn("THREE.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 oo);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Y(-1/0,-1/0,-1/0),new Y(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i0&&(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 f=0,h=c.length;f0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),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(t));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=[],f=s[c];for(let h=0,p=f.length;h0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(oM.copy(s).invert(),Ea.copy(e.ray).applyMatrix4(oM),!(i.boundingBox!==null&&Ea.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Ea)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,h=s.groups,p=s.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,_=h.length;g<_;g++){const m=h[g],d=o[m.materialIndex],x=Math.max(m.start,p.start),v=Math.min(a.count,Math.min(m.start+m.count,p.start+p.count));for(let y=x,b=v;yt.far?null:{distance:c,point:ih.clone(),object:n}}function rh(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,Jd),n.getVertexPosition(l,eh),n.getVertexPosition(c,th);const u=q4(n,e,t,i,Jd,eh,th,lM);if(u){const f=new Y;Bu.getBarycoord(lM,Jd,eh,th,f),r&&(u.uv=Bu.getInterpolatedAttribute(r,a,l,c,f,new lt)),s&&(u.uv1=Bu.getInterpolatedAttribute(s,a,l,c,f,new lt)),o&&(u.normal=Bu.getInterpolatedAttribute(o,a,l,c,f,new Y),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new Y,materialIndex:0};Bu.getNormal(Jd,eh,th,h.normal),u.face=h,u.barycoord=f}return u}let zx=class PT extends xr{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],f=[];let h=0,p=0;g("z","y","x",-1,-1,i,t,e,o,s,0),g("z","y","x",1,-1,i,t,-e,o,s,1),g("x","z","y",1,1,e,i,t,r,o,2),g("x","z","y",1,-1,e,i,-t,r,o,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(f,2));function g(_,m,d,x,v,y,b,w,T,C,M){const S=y/T,P=b/C,k=y/2,U=b/2,N=w/2,X=T+1,z=C+1;let te=0,L=0;const Z=new Y;for(let ae=0;ae0?1:-1,u.push(Z.x,Z.y,Z.z),f.push(Me/T),f.push(1-ae/C),te+=1}}for(let ae=0;ae0&&(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}},IT=class extends fn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new dt,this.projectionMatrix=new dt,this.projectionMatrixInverse=new dt,this.coordinateSystem=Gs}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.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}};const xo=new Y,cM=new lt,uM=new lt;let Jn=class extends IT{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=eu*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Rf*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return eu*2*Math.atan(Math.tan(Rf*.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){xo.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(xo.x,xo.y).multiplyScalar(-e/xo.z),xo.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(xo.x,xo.y).multiplyScalar(-e/xo.z)}getViewSize(e,t){return this.getViewBounds(e,cM,uM),t.subVectors(uM,cM)}setViewOffset(e,t,i,r,s,o){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=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Rf*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),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}};const Gl=-90,Wl=1;let Q4=class extends fn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Jn(Gl,Wl,e,t);r.layers=this.layers,this.add(r);const s=new Jn(Gl,Wl,e,t);s.layers=this.layers,this.add(s);const o=new Jn(Gl,Wl,e,t);o.layers=this.layers,this.add(o);const a=new Jn(Gl,Wl,e,t);a.layers=this.layers,this.add(a);const l=new Jn(Gl,Wl,e,t);l.layers=this.layers,this.add(l);const c=new Jn(Gl,Wl,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Gs)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),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Zp)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),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.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,o,a,l,c,u]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=_,e.setRenderTarget(i,5,r),e.render(t,u),e.setRenderTarget(f,h,p),e.xr.enabled=g,i.texture.needsPMREMUpdate=!0}},DT=class extends mi{constructor(e,t,i,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Kc,super(e,t,i,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},J4=class extends la{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 DT(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:$i}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:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},r=new zx(5,5,5),s=new Ki({name:"CubemapFromEquirect",uniforms:tu(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ri,blending:Yo});s.uniforms.tEquirect.value=t;const o=new yn(r,s),a=t.minFilter;return t.minFilter===os&&(t.minFilter=$i),new Q4(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}};const J0=new Y,e5=new Y,t5=new xt;let ui=class{constructor(e=new Y(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=J0.subVectors(i,t).cross(e5.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(J0),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||t5.getNormalMatrix(e),r=this.coplanarPoint(J0).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 wa=new gs,sh=new Y;let Hx=class{constructor(e=new ui,t=new ui,i=new ui,r=new ui,s=new ui,o=new ui){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),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=Gs){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],f=r[6],h=r[7],p=r[8],g=r[9],_=r[10],m=r[11],d=r[12],x=r[13],v=r[14],y=r[15];if(i[0].setComponents(l-s,h-c,m-p,y-d).normalize(),i[1].setComponents(l+s,h+c,m+p,y+d).normalize(),i[2].setComponents(l+o,h+u,m+g,y+x).normalize(),i[3].setComponents(l-o,h-u,m-g,y-x).normalize(),i[4].setComponents(l-a,h-f,m-_,y-v).normalize(),t===Gs)i[5].setComponents(l+a,h+f,m+_,y+v).normalize();else if(t===Zp)i[5].setComponents(a,f,_,v).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(),wa.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),wa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(wa)}intersectsSprite(e){return wa.center.set(0,0,0),wa.radius=.7071067811865476,wa.applyMatrix4(e.matrixWorld),this.intersectsSphere(wa)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,sh.y=r.normal.y>0?e.max.y:e.min.y,sh.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(sh)<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)}};function NT(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),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 n5(n){const e=new WeakMap;function t(a,l){const c=a.array,u=a.usage,f=c.byteLength,h=n.createBuffer();n.bindBuffer(l,h),n.bufferData(l,c,u),a.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function i(a,l,c){const u=l.array,f=l.updateRanges;if(n.bindBuffer(c,a),f.length===0)n.bufferSubData(c,0,u);else{f.sort((p,g)=>p.start-g.start);let h=0;for(let p=1;p 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,x5=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,y5=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,S5=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,M5=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,E5=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,w5=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec3 vColor; +#endif`,T5=`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif +#ifdef USE_BATCHING_COLOR + vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); + vColor.xyz *= batchingColor.xyz; +#endif`,A5=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,b5=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,R5=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,C5=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,P5=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,L5=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,I5=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,D5="gl_FragColor = linearToOutputTexel( gl_FragColor );",N5=`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + 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 ); +}`,U5=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,O5=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,F5=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,k5=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,B5=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,z5=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,H5=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,V5=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,G5=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,W5=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,$5=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,X5=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,j5=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,q5=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,Y5=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,K5=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,Z5=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Q5=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,J5=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,eL=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,tL=`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return saturate(v); + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); +} +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + vec4 r = roughness * c0 + c1; + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + return fab; +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,nL=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,iL=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,rL=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,sL=`#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,oL=`#if defined( USE_LOGDEPTHBUF ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,aL=`#ifdef USE_LOGDEPTHBUF + varying float vFragDepth; + varying float vIsPerspective; +#endif`,lL=`#ifdef USE_LOGDEPTHBUF + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,cL=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,uL=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,fL=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,dL=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,hL=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,pL=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,mL=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,gL=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,_L=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,vL=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,xL=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,yL=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,SL=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,ML=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,EL=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,wL=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,TL=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,AL=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,bL=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,RL=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,CL=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,PL=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,LL=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + return depth * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * depth - far ); +}`,IL=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,DL=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,NL=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,UL=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,OL=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,FL=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,kL=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + + float lightToPositionLength = length( lightToPosition ); + if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { + float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + shadow = ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } +#endif`,BL=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,zL=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,HL=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,VL=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,GL=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,WL=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,$L=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,XL=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,jL=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,qL=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,YL=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,KL=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,ZL=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + + #else + + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,QL=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,JL=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,eI=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,tI=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const nI=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,iI=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,rI=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,sI=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,oI=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,aI=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,lI=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,cI=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,uI=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,fI=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,dI=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,hI=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,pI=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,mI=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,gI=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,_I=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,vI=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,xI=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,yI=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,SI=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,MI=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,EI=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,wI=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,TI=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,AI=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,bI=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,RI=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,CI=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,PI=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,LI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,II=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,DI=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,NI=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,UI=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,pt={alphahash_fragment:i5,alphahash_pars_fragment:r5,alphamap_fragment:s5,alphamap_pars_fragment:o5,alphatest_fragment:a5,alphatest_pars_fragment:l5,aomap_fragment:c5,aomap_pars_fragment:u5,batching_pars_vertex:f5,batching_vertex:d5,begin_vertex:h5,beginnormal_vertex:p5,bsdfs:m5,iridescence_fragment:g5,bumpmap_pars_fragment:_5,clipping_planes_fragment:v5,clipping_planes_pars_fragment:x5,clipping_planes_pars_vertex:y5,clipping_planes_vertex:S5,color_fragment:M5,color_pars_fragment:E5,color_pars_vertex:w5,color_vertex:T5,common:A5,cube_uv_reflection_fragment:b5,defaultnormal_vertex:R5,displacementmap_pars_vertex:C5,displacementmap_vertex:P5,emissivemap_fragment:L5,emissivemap_pars_fragment:I5,colorspace_fragment:D5,colorspace_pars_fragment:N5,envmap_fragment:U5,envmap_common_pars_fragment:O5,envmap_pars_fragment:F5,envmap_pars_vertex:k5,envmap_physical_pars_fragment:Y5,envmap_vertex:B5,fog_vertex:z5,fog_pars_vertex:H5,fog_fragment:V5,fog_pars_fragment:G5,gradientmap_pars_fragment:W5,lightmap_pars_fragment:$5,lights_lambert_fragment:X5,lights_lambert_pars_fragment:j5,lights_pars_begin:q5,lights_toon_fragment:K5,lights_toon_pars_fragment:Z5,lights_phong_fragment:Q5,lights_phong_pars_fragment:J5,lights_physical_fragment:eL,lights_physical_pars_fragment:tL,lights_fragment_begin:nL,lights_fragment_maps:iL,lights_fragment_end:rL,logdepthbuf_fragment:sL,logdepthbuf_pars_fragment:oL,logdepthbuf_pars_vertex:aL,logdepthbuf_vertex:lL,map_fragment:cL,map_pars_fragment:uL,map_particle_fragment:fL,map_particle_pars_fragment:dL,metalnessmap_fragment:hL,metalnessmap_pars_fragment:pL,morphinstance_vertex:mL,morphcolor_vertex:gL,morphnormal_vertex:_L,morphtarget_pars_vertex:vL,morphtarget_vertex:xL,normal_fragment_begin:yL,normal_fragment_maps:SL,normal_pars_fragment:ML,normal_pars_vertex:EL,normal_vertex:wL,normalmap_pars_fragment:TL,clearcoat_normal_fragment_begin:AL,clearcoat_normal_fragment_maps:bL,clearcoat_pars_fragment:RL,iridescence_pars_fragment:CL,opaque_fragment:PL,packing:LL,premultiplied_alpha_fragment:IL,project_vertex:DL,dithering_fragment:NL,dithering_pars_fragment:UL,roughnessmap_fragment:OL,roughnessmap_pars_fragment:FL,shadowmap_pars_fragment:kL,shadowmap_pars_vertex:BL,shadowmap_vertex:zL,shadowmask_pars_fragment:HL,skinbase_vertex:VL,skinning_pars_vertex:GL,skinning_vertex:WL,skinnormal_vertex:$L,specularmap_fragment:XL,specularmap_pars_fragment:jL,tonemapping_fragment:qL,tonemapping_pars_fragment:YL,transmission_fragment:KL,transmission_pars_fragment:ZL,uv_pars_fragment:QL,uv_pars_vertex:JL,uv_vertex:eI,worldpos_vertex:tI,background_vert:nI,background_frag:iI,backgroundCube_vert:rI,backgroundCube_frag:sI,cube_vert:oI,cube_frag:aI,depth_vert:lI,depth_frag:cI,distanceRGBA_vert:uI,distanceRGBA_frag:fI,equirect_vert:dI,equirect_frag:hI,linedashed_vert:pI,linedashed_frag:mI,meshbasic_vert:gI,meshbasic_frag:_I,meshlambert_vert:vI,meshlambert_frag:xI,meshmatcap_vert:yI,meshmatcap_frag:SI,meshnormal_vert:MI,meshnormal_frag:EI,meshphong_vert:wI,meshphong_frag:TI,meshphysical_vert:AI,meshphysical_frag:bI,meshtoon_vert:RI,meshtoon_frag:CI,points_vert:PI,points_frag:LI,shadow_vert:II,shadow_frag:DI,sprite_vert:NI,sprite_frag:UI},ze={common:{diffuse:{value:new tt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new xt}},envmap:{envMap:{value:null},envMapRotation:{value:new xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new xt},normalScale:{value:new lt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new tt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new tt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0},uvTransform:{value:new xt}},sprite:{diffuse:{value:new tt(16777215)},opacity:{value:1},center:{value:new lt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new xt},alphaMap:{value:null},alphaMapTransform:{value:new xt},alphaTest:{value:0}}},ar={basic:{uniforms:oi([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.fog]),vertexShader:pt.meshbasic_vert,fragmentShader:pt.meshbasic_frag},lambert:{uniforms:oi([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new tt(0)}}]),vertexShader:pt.meshlambert_vert,fragmentShader:pt.meshlambert_frag},phong:{uniforms:oi([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new tt(0)},specular:{value:new tt(1118481)},shininess:{value:30}}]),vertexShader:pt.meshphong_vert,fragmentShader:pt.meshphong_frag},standard:{uniforms:oi([ze.common,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.roughnessmap,ze.metalnessmap,ze.fog,ze.lights,{emissive:{value:new tt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:pt.meshphysical_vert,fragmentShader:pt.meshphysical_frag},toon:{uniforms:oi([ze.common,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.gradientmap,ze.fog,ze.lights,{emissive:{value:new tt(0)}}]),vertexShader:pt.meshtoon_vert,fragmentShader:pt.meshtoon_frag},matcap:{uniforms:oi([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,{matcap:{value:null}}]),vertexShader:pt.meshmatcap_vert,fragmentShader:pt.meshmatcap_frag},points:{uniforms:oi([ze.points,ze.fog]),vertexShader:pt.points_vert,fragmentShader:pt.points_frag},dashed:{uniforms:oi([ze.common,ze.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:pt.linedashed_vert,fragmentShader:pt.linedashed_frag},depth:{uniforms:oi([ze.common,ze.displacementmap]),vertexShader:pt.depth_vert,fragmentShader:pt.depth_frag},normal:{uniforms:oi([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,{opacity:{value:1}}]),vertexShader:pt.meshnormal_vert,fragmentShader:pt.meshnormal_frag},sprite:{uniforms:oi([ze.sprite,ze.fog]),vertexShader:pt.sprite_vert,fragmentShader:pt.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:pt.background_vert,fragmentShader:pt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new xt}},vertexShader:pt.backgroundCube_vert,fragmentShader:pt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:pt.cube_vert,fragmentShader:pt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:pt.equirect_vert,fragmentShader:pt.equirect_frag},distanceRGBA:{uniforms:oi([ze.common,ze.displacementmap,{referencePosition:{value:new Y},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:pt.distanceRGBA_vert,fragmentShader:pt.distanceRGBA_frag},shadow:{uniforms:oi([ze.lights,ze.fog,{color:{value:new tt(0)},opacity:{value:1}}]),vertexShader:pt.shadow_vert,fragmentShader:pt.shadow_frag}};ar.physical={uniforms:oi([ar.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new xt},clearcoatNormalScale:{value:new lt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new xt},sheen:{value:0},sheenColor:{value:new tt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new xt},transmissionSamplerSize:{value:new lt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new xt},attenuationDistance:{value:0},attenuationColor:{value:new tt(0)},specularColor:{value:new tt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new xt},anisotropyVector:{value:new lt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new xt}}]),vertexShader:pt.meshphysical_vert,fragmentShader:pt.meshphysical_frag};const oh={r:0,b:0,g:0},Ta=new ca,OI=new dt;function FI(n,e,t,i,r,s,o){const a=new tt(0);let l=s===!0?0:1,c,u,f=null,h=0,p=null;function g(x){let v=x.isScene===!0?x.background:null;return v&&v.isTexture&&(v=(x.backgroundBlurriness>0?t:e).get(v)),v}function _(x){let v=!1;const y=g(x);y===null?d(a,l):y&&y.isColor&&(d(y,1),v=!0);const b=n.xr.getEnvironmentBlendMode();b==="additive"?i.buffers.color.setClear(0,0,0,1,o):b==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||v)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function m(x,v){const y=g(v);y&&(y.isCubeTexture||y.mapping===$m)?(u===void 0&&(u=new yn(new zx(1,1,1),new Ki({name:"BackgroundCubeMaterial",uniforms:tu(ar.backgroundCube.uniforms),vertexShader:ar.backgroundCube.vertexShader,fragmentShader:ar.backgroundCube.fragmentShader,side:Ri,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(b,w,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Ta.copy(v.backgroundRotation),Ta.x*=-1,Ta.y*=-1,Ta.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Ta.y*=-1,Ta.z*=-1),u.material.uniforms.envMap.value=y,u.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(OI.makeRotationFromEuler(Ta)),u.material.toneMapped=wt.getTransfer(y.colorSpace)!==kt,(f!==y||h!==y.version||p!==n.toneMapping)&&(u.material.needsUpdate=!0,f=y,h=y.version,p=n.toneMapping),u.layers.enableAll(),x.unshift(u,u.geometry,u.material,0,0,null)):y&&y.isTexture&&(c===void 0&&(c=new yn(new Ad(2,2),new Ki({name:"BackgroundMaterial",uniforms:tu(ar.background.uniforms),vertexShader:ar.background.vertexShader,fragmentShader:ar.background.fragmentShader,side:Wr,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.toneMapped=wt.getTransfer(y.colorSpace)!==kt,y.matrixAutoUpdate===!0&&y.updateMatrix(),c.material.uniforms.uvTransform.value.copy(y.matrix),(f!==y||h!==y.version||p!==n.toneMapping)&&(c.material.needsUpdate=!0,f=y,h=y.version,p=n.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null))}function d(x,v){x.getRGB(oh,LT(n)),i.buffers.color.setClear(oh.r,oh.g,oh.b,v,o)}return{getClearColor:function(){return a},setClearColor:function(x,v=1){a.set(x),l=v,d(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,d(a,l)},render:_,addToRenderList:m}}function kI(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=h(null);let s=r,o=!1;function a(S,P,k,U,N){let X=!1;const z=f(U,k,P);s!==z&&(s=z,c(s.object)),X=p(S,U,k,N),X&&g(S,U,k,N),N!==null&&e.update(N,n.ELEMENT_ARRAY_BUFFER),(X||o)&&(o=!1,y(S,P,k,U),N!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(N).buffer))}function l(){return n.createVertexArray()}function c(S){return n.bindVertexArray(S)}function u(S){return n.deleteVertexArray(S)}function f(S,P,k){const U=k.wireframe===!0;let N=i[S.id];N===void 0&&(N={},i[S.id]=N);let X=N[P.id];X===void 0&&(X={},N[P.id]=X);let z=X[U];return z===void 0&&(z=h(l()),X[U]=z),z}function h(S){const P=[],k=[],U=[];for(let N=0;N=0){const ae=N[L];let fe=X[L];if(fe===void 0&&(L==="instanceMatrix"&&S.instanceMatrix&&(fe=S.instanceMatrix),L==="instanceColor"&&S.instanceColor&&(fe=S.instanceColor)),ae===void 0||ae.attribute!==fe||fe&&ae.data!==fe.data)return!0;z++}return s.attributesNum!==z||s.index!==U}function g(S,P,k,U){const N={},X=P.attributes;let z=0;const te=k.getAttributes();for(const L in te)if(te[L].location>=0){let ae=X[L];ae===void 0&&(L==="instanceMatrix"&&S.instanceMatrix&&(ae=S.instanceMatrix),L==="instanceColor"&&S.instanceColor&&(ae=S.instanceColor));const fe={};fe.attribute=ae,ae&&ae.data&&(fe.data=ae.data),N[L]=fe,z++}s.attributes=N,s.attributesNum=z,s.index=U}function _(){const S=s.newAttributes;for(let P=0,k=S.length;P=0){let Z=N[te];if(Z===void 0&&(te==="instanceMatrix"&&S.instanceMatrix&&(Z=S.instanceMatrix),te==="instanceColor"&&S.instanceColor&&(Z=S.instanceColor)),Z!==void 0){const ae=Z.normalized,fe=Z.itemSize,Me=e.get(Z);if(Me===void 0)continue;const Ve=Me.buffer,$=Me.type,oe=Me.bytesPerElement,me=$===n.INT||$===n.UNSIGNED_INT||Z.gpuType===Ix;if(Z.isInterleavedBufferAttribute){const de=Z.data,be=de.stride,Le=Z.offset;if(de.isInstancedInterleavedBuffer){for(let ke=0;ke0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";T="mediump"}return T==="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&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const f=t.logarithmicDepthBuffer===!0,h=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),p=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),g=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=n.getParameter(n.MAX_TEXTURE_SIZE),m=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),d=n.getParameter(n.MAX_VERTEX_ATTRIBS),x=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),v=n.getParameter(n.MAX_VARYING_VECTORS),y=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),b=g>0,w=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:h,maxTextures:p,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:d,maxVertexUniforms:x,maxVaryings:v,maxFragmentUniforms:y,vertexTextures:b,maxSamples:w}}function HI(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new ui,a=new xt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const p=f.length!==0||h||i!==0||r;return r=h,i=f.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){t=u(f,h,0)},this.setState=function(f,h,p){const g=f.clippingPlanes,_=f.clipIntersection,m=f.clipShadows,d=n.get(f);if(!r||g===null||g.length===0||s&&!m)s?u(null):c();else{const x=s?0:i,v=x*4;let y=d.clippingState||null;l.value=y,y=u(g,h,v,p);for(let b=0;b!==v;++b)y[b]=t[b];d.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=x}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(f,h,p,g){const _=f!==null?f.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const d=p+_*4,x=h.matrixWorldInverse;a.getNormalMatrix(x),(m===null||m.length0){const c=new J4(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}let Vx=class extends IT{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=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=o,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,o){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=o,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,o=i+e,a=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,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),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 pc=4,fM=[.125,.215,.35,.446,.526,.582],Ka=20,eg=new Vx,dM=new tt;let tg=null,ng=0,ig=0,rg=!1;const Va=(1+Math.sqrt(5))/2,$l=1/Va,hM=[new Y(-Va,$l,0),new Y(Va,$l,0),new Y(-$l,0,Va),new Y($l,0,Va),new Y(0,Va,-$l),new Y(0,Va,$l),new Y(-1,1,-1),new Y(1,1,-1),new Y(-1,1,1),new Y(1,1,1)];let pM=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){tg=this._renderer.getRenderTarget(),ng=this._renderer.getActiveCubeFace(),ig=this._renderer.getActiveMipmapLevel(),rg=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=_M(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=gM(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.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._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?v:0,v,v),u.setRenderTarget(r),_&&u.render(g,a),u.render(e,a)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=h,u.autoClear=f,e.background=m}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Kc||e.mapping===Zc;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=_M()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=gM());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new yn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;ah(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,eg)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sKa&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Ka}`);const d=[];let x=0;for(let T=0;Tv-pc?r-v+pc:0),w=4*(this._cubeSize-y);ah(t,b,w,3*y,2*y),l.setRenderTarget(t),l.render(f,eg)}};function GI(n){const e=[],t=[],i=[];let r=n;const s=n-pc+1+fM.length;for(let o=0;on-pc?l=fM[o-n+pc-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,f=1+c,h=[u,u,f,u,f,f,u,u,f,f,u,f],p=6,g=6,_=3,m=2,d=1,x=new Float32Array(_*g*p),v=new Float32Array(m*g*p),y=new Float32Array(d*g*p);for(let w=0;w2?0:-1,M=[T,C,0,T+2/3,C,0,T+2/3,C+1,0,T,C,0,T+2/3,C+1,0,T,C+1,0];x.set(M,_*g*w),v.set(h,m*g*w);const S=[w,w,w,w,w,w];y.set(S,d*g*w)}const b=new xr;b.setAttribute("position",new di(x,_)),b.setAttribute("uv",new di(v,m)),b.setAttribute("faceIndex",new di(y,d)),e.push(b),r>pc&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function mM(n,e,t){const i=new la(n,e,t);return i.texture.mapping=$m,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function ah(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function WI(n,e,t){const i=new Float32Array(Ka),r=new Y(0,1,0);return new Ki({name:"SphericalGaussianBlur",defines:{n:Ka,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:Gx(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:Yo,depthTest:!1,depthWrite:!1})}function gM(){return new Ki({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Gx(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:Yo,depthTest:!1,depthWrite:!1})}function _M(){return new Ki({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Gx(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:Yo,depthTest:!1,depthWrite:!1})}function Gx(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function $I(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===V_||l===G_,u=l===Kc||l===Zc;if(c||u){let f=e.get(a);const h=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==h)return t===null&&(t=new pM(n)),f=c?t.fromEquirectangular(a,f):t.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const p=a.image;return c&&p&&p.height>0||u&&p&&r(p)?(t===null&&(t=new pM(n)),f=c?t.fromEquirectangular(a):t.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(b=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const w=new Float32Array(y*b*4*f),T=new MT(w,y,b,f);T.type=Ur,T.needsUpdate=!0;const C=v*4;for(let S=0;S0)return n;const r=e*t;let s=xM[r];if(s===void 0&&(s=new Float32Array(r),xM[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function An(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` +`)}const AM=new xt;function $D(n){wt._getMatrix(AM,wt.workingColorSpace,n);const e=`mat3( ${AM.elements.map(t=>t.toFixed(4))} )`;switch(wt.getTransfer(n)){case Xm:return[e,"LinearTransferOETF"];case kt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function bM(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` + +`+r+` + +`+WD(n.getShaderSource(e),o)}else return r}function XD(n,e){const t=$D(e);return[`vec4 ${n}( vec4 value ) {`,` return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(` +`)}function jD(n,e){let t;switch(e){case qP:t="Linear";break;case YP:t="Reinhard";break;case KP:t="Cineon";break;case ZP:t="ACESFilmic";break;case JP:t="AgX";break;case e4:t="Neutral";break;case QP:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const lh=new Y;function qD(){wt.getLuminanceCoefficients(lh);const n=lh.x.toFixed(4),e=lh.y.toFixed(4),t=lh.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function YD(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(_f).join(` +`)}function KD(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` +`)}function ZD(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function yv(n){return n.replace(QD,e6)}const JD=new Map;function e6(n,e){let t=pt[e];if(t===void 0){const i=JD.get(e);if(i!==void 0)t=pt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return yv(t)}const t6=/#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 PM(n){return n.replace(t6,n6)}function n6(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(m+=` +`),d=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(_f).join(` +`),d.length>0&&(d+=` +`)):(m=[LM(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_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","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",` +`].filter(_f).join(` +`),d=[LM(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 "+f:"",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||t.batchingColor?"#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.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_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Ko?"#define TONE_MAPPING":"",t.toneMapping!==Ko?pt.tonemapping_pars_fragment:"",t.toneMapping!==Ko?jD("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",pt.colorspace_pars_fragment,XD("linearToOutputTexel",t.outputColorSpace),qD(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(_f).join(` +`)),o=yv(o),o=RM(o,t),o=CM(o,t),a=yv(a),a=RM(a,t),a=CM(a,t),o=PM(o),a=PM(a),t.isRawShaderMaterial!==!0&&(x=`#version 300 es +`,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+m,d=["#define varying in",t.glslVersion===GS?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===GS?"":"#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(` +`)+` +`+d);const v=x+m+o,y=x+d+a,b=TM(r,r.VERTEX_SHADER,v),w=TM(r,r.FRAGMENT_SHADER,y);r.attachShader(_,b),r.attachShader(_,w),t.index0AttributeName!==void 0?r.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function T(P){if(n.debug.checkShaderErrors){const k=r.getProgramInfoLog(_).trim(),U=r.getShaderInfoLog(b).trim(),N=r.getShaderInfoLog(w).trim();let X=!0,z=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(X=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,_,b,w);else{const te=bM(r,b,"vertex"),L=bM(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+` + +Material Name: `+P.name+` +Material Type: `+P.type+` + +Program Info Log: `+k+` +`+te+` +`+L)}else k!==""?console.warn("THREE.WebGLProgram: Program Info Log:",k):(U===""||N==="")&&(z=!1);z&&(P.diagnostics={runnable:X,programLog:k,vertexShader:{log:U,prefix:m},fragmentShader:{log:N,prefix:d}})}r.deleteShader(b),r.deleteShader(w),C=new Mp(r,_),M=ZD(r,_)}let C;this.getUniforms=function(){return C===void 0&&T(this),C};let M;this.getAttributes=function(){return M===void 0&&T(this),M};let S=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&&(S=r.getProgramParameter(_,VD)),S},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=GD++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=b,this.fragmentShader=w,this}let c6=0,u6=class{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),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.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 f6(e),t.set(e,i)),i}},f6=class{constructor(e){this.id=c6++,this.code=e,this.usedTimes=0}};function d6(n,e,t,i,r,s,o){const a=new TT,l=new u6,c=new Set,u=[],f=r.logarithmicDepthBuffer,h=r.vertexTextures;let p=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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 _(M){return c.add(M),M===0?"uv":`uv${M}`}function m(M,S,P,k,U){const N=k.fog,X=U.geometry,z=M.isMeshStandardMaterial?k.environment:null,te=(M.isMeshStandardMaterial?t:e).get(M.envMap||z),L=te&&te.mapping===$m?te.image.height:null,Z=g[M.type];M.precision!==null&&(p=r.getMaxPrecision(M.precision),p!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",p,"instead."));const ae=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,fe=ae!==void 0?ae.length:0;let Me=0;X.morphAttributes.position!==void 0&&(Me=1),X.morphAttributes.normal!==void 0&&(Me=2),X.morphAttributes.color!==void 0&&(Me=3);let Ve,$,oe,me;if(Z){const ft=ar[Z];Ve=ft.vertexShader,$=ft.fragmentShader}else Ve=M.vertexShader,$=M.fragmentShader,l.update(M),oe=l.getVertexShaderID(M),me=l.getFragmentShaderID(M);const de=n.getRenderTarget(),be=n.state.buffers.depth.getReversed(),Le=U.isInstancedMesh===!0,ke=U.isBatchedMesh===!0,Qe=!!M.map,V=!!M.matcap,ot=!!te,ee=!!M.aoMap,at=!!M.lightMap,Ne=!!M.bumpMap,Ze=!!M.normalMap,Ie=!!M.displacementMap,We=!!M.emissiveMap,B=!!M.metalnessMap,E=!!M.roughnessMap,A=M.anisotropy>0,F=M.clearcoat>0,W=M.dispersion>0,j=M.iridescence>0,le=M.sheen>0,pe=M.transmission>0,ce=A&&!!M.anisotropyMap,Ee=F&&!!M.clearcoatMap,ve=F&&!!M.clearcoatNormalMap,ue=F&&!!M.clearcoatRoughnessMap,Re=j&&!!M.iridescenceMap,Pe=j&&!!M.iridescenceThicknessMap,ye=le&&!!M.sheenColorMap,Se=le&&!!M.sheenRoughnessMap,Be=!!M.specularMap,je=!!M.specularColorMap,J=!!M.specularIntensityMap,H=pe&&!!M.transmissionMap,re=pe&&!!M.thicknessMap,q=!!M.gradientMap,ie=!!M.alphaMap,xe=M.alphaTest>0,we=!!M.alphaHash,Ye=!!M.extensions;let ut=Ko;M.toneMapped&&(de===null||de.isXRRenderTarget===!0)&&(ut=n.toneMapping);const it={shaderID:Z,shaderType:M.type,shaderName:M.name,vertexShader:Ve,fragmentShader:$,defines:M.defines,customVertexShaderID:oe,customFragmentShaderID:me,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:p,batching:ke,batchingColor:ke&&U._colorsTexture!==null,instancing:Le,instancingColor:Le&&U.instanceColor!==null,instancingMorph:Le&&U.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:de===null?n.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:pi,alphaToCoverage:!!M.alphaToCoverage,map:Qe,matcap:V,envMap:ot,envMapMode:ot&&te.mapping,envMapCubeUVHeight:L,aoMap:ee,lightMap:at,bumpMap:Ne,normalMap:Ze,displacementMap:h&&Ie,emissiveMap:We,normalMapObjectSpace:Ze&&M.normalMapType===o4,normalMapTangentSpace:Ze&&M.normalMapType===pT,metalnessMap:B,roughnessMap:E,anisotropy:A,anisotropyMap:ce,clearcoat:F,clearcoatMap:Ee,clearcoatNormalMap:ve,clearcoatRoughnessMap:ue,dispersion:W,iridescence:j,iridescenceMap:Re,iridescenceThicknessMap:Pe,sheen:le,sheenColorMap:ye,sheenRoughnessMap:Se,specularMap:Be,specularColorMap:je,specularIntensityMap:J,transmission:pe,transmissionMap:H,thicknessMap:re,gradientMap:q,opaque:M.transparent===!1&&M.blending===Uc&&M.alphaToCoverage===!1,alphaMap:ie,alphaTest:xe,alphaHash:we,combine:M.combine,mapUv:Qe&&_(M.map.channel),aoMapUv:ee&&_(M.aoMap.channel),lightMapUv:at&&_(M.lightMap.channel),bumpMapUv:Ne&&_(M.bumpMap.channel),normalMapUv:Ze&&_(M.normalMap.channel),displacementMapUv:Ie&&_(M.displacementMap.channel),emissiveMapUv:We&&_(M.emissiveMap.channel),metalnessMapUv:B&&_(M.metalnessMap.channel),roughnessMapUv:E&&_(M.roughnessMap.channel),anisotropyMapUv:ce&&_(M.anisotropyMap.channel),clearcoatMapUv:Ee&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:ve&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ue&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:Re&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:Pe&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:ye&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:Se&&_(M.sheenRoughnessMap.channel),specularMapUv:Be&&_(M.specularMap.channel),specularColorMapUv:je&&_(M.specularColorMap.channel),specularIntensityMapUv:J&&_(M.specularIntensityMap.channel),transmissionMapUv:H&&_(M.transmissionMap.channel),thicknessMapUv:re&&_(M.thicknessMap.channel),alphaMapUv:ie&&_(M.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(Ze||A),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:U.isPoints===!0&&!!X.attributes.uv&&(Qe||ie),fog:!!N,useFog:M.fog===!0,fogExp2:!!N&&N.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:be,skinning:U.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:fe,morphTextureStride:Me,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:M.dithering,shadowMapEnabled:n.shadowMap.enabled&&P.length>0,shadowMapType:n.shadowMap.type,toneMapping:ut,decodeVideoTexture:Qe&&M.map.isVideoTexture===!0&&wt.getTransfer(M.map.colorSpace)===kt,decodeVideoTextureEmissive:We&&M.emissiveMap.isVideoTexture===!0&&wt.getTransfer(M.emissiveMap.colorSpace)===kt,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===fi,flipSided:M.side===Ri,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:Ye&&M.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Ye&&M.extensions.multiDraw===!0||ke)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return it.vertexUv1s=c.has(1),it.vertexUv2s=c.has(2),it.vertexUv3s=c.has(3),c.clear(),it}function d(M){const S=[];if(M.shaderID?S.push(M.shaderID):(S.push(M.customVertexShaderID),S.push(M.customFragmentShaderID)),M.defines!==void 0)for(const P in M.defines)S.push(P),S.push(M.defines[P]);return M.isRawShaderMaterial===!1&&(x(S,M),v(S,M),S.push(n.outputColorSpace)),S.push(M.customProgramCacheKey),S.join()}function x(M,S){M.push(S.precision),M.push(S.outputColorSpace),M.push(S.envMapMode),M.push(S.envMapCubeUVHeight),M.push(S.mapUv),M.push(S.alphaMapUv),M.push(S.lightMapUv),M.push(S.aoMapUv),M.push(S.bumpMapUv),M.push(S.normalMapUv),M.push(S.displacementMapUv),M.push(S.emissiveMapUv),M.push(S.metalnessMapUv),M.push(S.roughnessMapUv),M.push(S.anisotropyMapUv),M.push(S.clearcoatMapUv),M.push(S.clearcoatNormalMapUv),M.push(S.clearcoatRoughnessMapUv),M.push(S.iridescenceMapUv),M.push(S.iridescenceThicknessMapUv),M.push(S.sheenColorMapUv),M.push(S.sheenRoughnessMapUv),M.push(S.specularMapUv),M.push(S.specularColorMapUv),M.push(S.specularIntensityMapUv),M.push(S.transmissionMapUv),M.push(S.thicknessMapUv),M.push(S.combine),M.push(S.fogExp2),M.push(S.sizeAttenuation),M.push(S.morphTargetsCount),M.push(S.morphAttributeCount),M.push(S.numDirLights),M.push(S.numPointLights),M.push(S.numSpotLights),M.push(S.numSpotLightMaps),M.push(S.numHemiLights),M.push(S.numRectAreaLights),M.push(S.numDirLightShadows),M.push(S.numPointLightShadows),M.push(S.numSpotLightShadows),M.push(S.numSpotLightShadowsWithMaps),M.push(S.numLightProbes),M.push(S.shadowMapType),M.push(S.toneMapping),M.push(S.numClippingPlanes),M.push(S.numClipIntersection),M.push(S.depthPacking)}function v(M,S){a.disableAll(),S.supportsVertexTextures&&a.enable(0),S.instancing&&a.enable(1),S.instancingColor&&a.enable(2),S.instancingMorph&&a.enable(3),S.matcap&&a.enable(4),S.envMap&&a.enable(5),S.normalMapObjectSpace&&a.enable(6),S.normalMapTangentSpace&&a.enable(7),S.clearcoat&&a.enable(8),S.iridescence&&a.enable(9),S.alphaTest&&a.enable(10),S.vertexColors&&a.enable(11),S.vertexAlphas&&a.enable(12),S.vertexUv1s&&a.enable(13),S.vertexUv2s&&a.enable(14),S.vertexUv3s&&a.enable(15),S.vertexTangents&&a.enable(16),S.anisotropy&&a.enable(17),S.alphaHash&&a.enable(18),S.batching&&a.enable(19),S.dispersion&&a.enable(20),S.batchingColor&&a.enable(21),M.push(a.mask),a.disableAll(),S.fog&&a.enable(0),S.useFog&&a.enable(1),S.flatShading&&a.enable(2),S.logarithmicDepthBuffer&&a.enable(3),S.reverseDepthBuffer&&a.enable(4),S.skinning&&a.enable(5),S.morphTargets&&a.enable(6),S.morphNormals&&a.enable(7),S.morphColors&&a.enable(8),S.premultipliedAlpha&&a.enable(9),S.shadowMapEnabled&&a.enable(10),S.doubleSided&&a.enable(11),S.flipSided&&a.enable(12),S.useDepthPacking&&a.enable(13),S.dithering&&a.enable(14),S.transmission&&a.enable(15),S.sheen&&a.enable(16),S.opaque&&a.enable(17),S.pointsUvs&&a.enable(18),S.decodeVideoTexture&&a.enable(19),S.decodeVideoTextureEmissive&&a.enable(20),S.alphaToCoverage&&a.enable(21),M.push(a.mask)}function y(M){const S=g[M.type];let P;if(S){const k=ar[S];P=xv.clone(k.uniforms)}else P=M.uniforms;return P}function b(M,S){let P;for(let k=0,U=u.length;k0?i.push(d):p.transparent===!0?r.push(d):t.push(d)}function l(f,h,p,g,_,m){const d=o(f,h,p,g,_,m);p.transmission>0?i.unshift(d):p.transparent===!0?r.unshift(d):t.unshift(d)}function c(f,h){t.length>1&&t.sort(f||p6),i.length>1&&i.sort(h||IM),r.length>1&&r.sort(h||IM)}function u(){for(let f=e,h=n.length;f=s.length?(o=new DM,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function g6(){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 Y,color:new tt};break;case"SpotLight":t={position:new Y,direction:new Y,color:new tt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Y,color:new tt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Y,skyColor:new tt,groundColor:new tt};break;case"RectAreaLight":t={color:new tt,position:new Y,halfWidth:new Y,halfHeight:new Y};break}return n[e.id]=t,t}}}function _6(){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 lt};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new lt};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new lt,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let v6=0;function x6(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function y6(n){const e=new g6,t=_6(),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 Y);const r=new Y,s=new dt,o=new dt;function a(c){let u=0,f=0,h=0;for(let M=0;M<9;M++)i.probe[M].set(0,0,0);let p=0,g=0,_=0,m=0,d=0,x=0,v=0,y=0,b=0,w=0,T=0;c.sort(x6);for(let M=0,S=c.length;M0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ze.LTC_FLOAT_1,i.rectAreaLTC2=ze.LTC_FLOAT_2):(i.rectAreaLTC1=ze.LTC_HALF_1,i.rectAreaLTC2=ze.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=f,i.ambient[2]=h;const C=i.hash;(C.directionalLength!==p||C.pointLength!==g||C.spotLength!==_||C.rectAreaLength!==m||C.hemiLength!==d||C.numDirectionalShadows!==x||C.numPointShadows!==v||C.numSpotShadows!==y||C.numSpotMaps!==b||C.numLightProbes!==T)&&(i.directional.length=p,i.spot.length=_,i.rectArea.length=m,i.point.length=g,i.hemi.length=d,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=v,i.pointShadowMap.length=v,i.spotShadow.length=y,i.spotShadowMap.length=y,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=v,i.spotLightMatrix.length=y+b-w,i.spotLightMap.length=b,i.numSpotLightShadowsWithMaps=w,i.numLightProbes=T,C.directionalLength=p,C.pointLength=g,C.spotLength=_,C.rectAreaLength=m,C.hemiLength=d,C.numDirectionalShadows=x,C.numPointShadows=v,C.numSpotShadows=y,C.numSpotMaps=b,C.numLightProbes=T,i.version=v6++)}function l(c,u){let f=0,h=0,p=0,g=0,_=0;const m=u.matrixWorldInverse;for(let d=0,x=c.length;d=o.length?(a=new NM(n),o.push(a)):a=o[s],a}function i(){e=new WeakMap}return{get:t,dispose:i}}let M6=class extends cs{static get type(){return"MeshDepthMaterial"}constructor(e){super(),this.isMeshDepthMaterial=!0,this.depthPacking=r4,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}},E6=class extends cs{static get type(){return"MeshDistanceMaterial"}constructor(e){super(),this.isMeshDistanceMaterial=!0,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 w6=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,T6=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function A6(n,e,t){let i=new Hx;const r=new lt,s=new lt,o=new Ct,a=new M6({depthPacking:s4}),l=new E6,c={},u=t.maxTextureSize,f={[Wr]:Ri,[Ri]:Wr,[fi]:fi},h=new Ki({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new lt},radius:{value:4}},vertexShader:w6,fragmentShader:T6}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const g=new xr;g.setAttribute("position",new di(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new yn(g,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=eT;let d=this.type;this.render=function(w,T,C){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||w.length===0)return;const M=n.getRenderTarget(),S=n.getActiveCubeFace(),P=n.getActiveMipmapLevel(),k=n.state;k.setBlending(Yo),k.buffers.color.setClear(1,1,1,1),k.buffers.depth.setTest(!0),k.setScissorTest(!1);const U=d!==Ns&&this.type===Ns,N=d===Ns&&this.type!==Ns;for(let X=0,z=w.length;Xu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/Z.x),r.x=s.x*Z.x,L.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/Z.y),r.y=s.y*Z.y,L.mapSize.y=s.y)),L.map===null||U===!0||N===!0){const fe=this.type!==Ns?{minFilter:ni,magFilter:ni}:{};L.map!==null&&L.map.dispose(),L.map=new la(r.x,r.y,fe),L.map.texture.name=te.name+".shadowMap",L.camera.updateProjectionMatrix()}n.setRenderTarget(L.map),n.clear();const ae=L.getViewportCount();for(let fe=0;fe0||T.map&&T.alphaTest>0){const k=S.uuid,U=T.uuid;let N=c[k];N===void 0&&(N={},c[k]=N);let X=N[U];X===void 0&&(X=S.clone(),N[U]=X,T.addEventListener("dispose",b)),S=X}if(S.visible=T.visible,S.wireframe=T.wireframe,M===Ns?S.side=T.shadowSide!==null?T.shadowSide:T.side:S.side=T.shadowSide!==null?T.shadowSide:f[T.side],S.alphaMap=T.alphaMap,S.alphaTest=T.alphaTest,S.map=T.map,S.clipShadows=T.clipShadows,S.clippingPlanes=T.clippingPlanes,S.clipIntersection=T.clipIntersection,S.displacementMap=T.displacementMap,S.displacementScale=T.displacementScale,S.displacementBias=T.displacementBias,S.wireframeLinewidth=T.wireframeLinewidth,S.linewidth=T.linewidth,C.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const k=n.properties.get(S);k.light=C}return S}function y(w,T,C,M,S){if(w.visible===!1)return;if(w.layers.test(T.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&S===Ns)&&(!w.frustumCulled||i.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,w.matrixWorld);const U=e.update(w),N=w.material;if(Array.isArray(N)){const X=U.groups;for(let z=0,te=X.length;z=1):L.indexOf("OpenGL ES")!==-1&&(te=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),z=te>=2);let Z=null,ae={};const fe=n.getParameter(n.SCISSOR_BOX),Me=n.getParameter(n.VIEWPORT),Ve=new Ct().fromArray(fe),$=new Ct().fromArray(Me);function oe(H,re,q,ie){const xe=new Uint8Array(4),we=n.createTexture();n.bindTexture(H,we),n.texParameteri(H,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(H,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Ye=0;Ye"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new lt,u=new WeakMap;let f;const h=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(E,A){return p?new OffscreenCanvas(E,A):Kf("canvas")}function _(E,A,F){let W=1;const j=B(E);if((j.width>F||j.height>F)&&(W=F/Math.max(j.width,j.height)),W<1)if(typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&E instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&E instanceof ImageBitmap||typeof VideoFrame<"u"&&E instanceof VideoFrame){const le=Math.floor(W*j.width),pe=Math.floor(W*j.height);f===void 0&&(f=g(le,pe));const ce=A?g(le,pe):f;return ce.width=le,ce.height=pe,ce.getContext("2d").drawImage(E,0,0,le,pe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+j.width+"x"+j.height+") to ("+le+"x"+pe+")."),ce}else return"data"in E&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+j.width+"x"+j.height+")."),E;return E}function m(E){return E.generateMipmaps}function d(E){n.generateMipmap(E)}function x(E){return E.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:E.isWebGL3DRenderTarget?n.TEXTURE_3D:E.isWebGLArrayRenderTarget||E.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function v(E,A,F,W,j=!1){if(E!==null){if(n[E]!==void 0)return n[E];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+E+"'")}let le=A;if(A===n.RED&&(F===n.FLOAT&&(le=n.R32F),F===n.HALF_FLOAT&&(le=n.R16F),F===n.UNSIGNED_BYTE&&(le=n.R8)),A===n.RED_INTEGER&&(F===n.UNSIGNED_BYTE&&(le=n.R8UI),F===n.UNSIGNED_SHORT&&(le=n.R16UI),F===n.UNSIGNED_INT&&(le=n.R32UI),F===n.BYTE&&(le=n.R8I),F===n.SHORT&&(le=n.R16I),F===n.INT&&(le=n.R32I)),A===n.RG&&(F===n.FLOAT&&(le=n.RG32F),F===n.HALF_FLOAT&&(le=n.RG16F),F===n.UNSIGNED_BYTE&&(le=n.RG8)),A===n.RG_INTEGER&&(F===n.UNSIGNED_BYTE&&(le=n.RG8UI),F===n.UNSIGNED_SHORT&&(le=n.RG16UI),F===n.UNSIGNED_INT&&(le=n.RG32UI),F===n.BYTE&&(le=n.RG8I),F===n.SHORT&&(le=n.RG16I),F===n.INT&&(le=n.RG32I)),A===n.RGB_INTEGER&&(F===n.UNSIGNED_BYTE&&(le=n.RGB8UI),F===n.UNSIGNED_SHORT&&(le=n.RGB16UI),F===n.UNSIGNED_INT&&(le=n.RGB32UI),F===n.BYTE&&(le=n.RGB8I),F===n.SHORT&&(le=n.RGB16I),F===n.INT&&(le=n.RGB32I)),A===n.RGBA_INTEGER&&(F===n.UNSIGNED_BYTE&&(le=n.RGBA8UI),F===n.UNSIGNED_SHORT&&(le=n.RGBA16UI),F===n.UNSIGNED_INT&&(le=n.RGBA32UI),F===n.BYTE&&(le=n.RGBA8I),F===n.SHORT&&(le=n.RGBA16I),F===n.INT&&(le=n.RGBA32I)),A===n.RGB&&F===n.UNSIGNED_INT_5_9_9_9_REV&&(le=n.RGB9_E5),A===n.RGBA){const pe=j?Xm:wt.getTransfer(W);F===n.FLOAT&&(le=n.RGBA32F),F===n.HALF_FLOAT&&(le=n.RGBA16F),F===n.UNSIGNED_BYTE&&(le=pe===kt?n.SRGB8_ALPHA8:n.RGBA8),F===n.UNSIGNED_SHORT_4_4_4_4&&(le=n.RGBA4),F===n.UNSIGNED_SHORT_5_5_5_1&&(le=n.RGB5_A1)}return(le===n.R16F||le===n.R32F||le===n.RG16F||le===n.RG32F||le===n.RGBA16F||le===n.RGBA32F)&&e.get("EXT_color_buffer_float"),le}function y(E,A){let F;return E?A===null||A===ml||A===Qc?F=n.DEPTH24_STENCIL8:A===Ur?F=n.DEPTH32F_STENCIL8:A===jf&&(F=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):A===null||A===ml||A===Qc?F=n.DEPTH_COMPONENT24:A===Ur?F=n.DEPTH_COMPONENT32F:A===jf&&(F=n.DEPTH_COMPONENT16),F}function b(E,A){return m(E)===!0||E.isFramebufferTexture&&E.minFilter!==ni&&E.minFilter!==$i?Math.log2(Math.max(A.width,A.height))+1:E.mipmaps!==void 0&&E.mipmaps.length>0?E.mipmaps.length:E.isCompressedTexture&&Array.isArray(E.image)?A.mipmaps.length:1}function w(E){const A=E.target;A.removeEventListener("dispose",w),C(A),A.isVideoTexture&&u.delete(A)}function T(E){const A=E.target;A.removeEventListener("dispose",T),S(A)}function C(E){const A=i.get(E);if(A.__webglInit===void 0)return;const F=E.source,W=h.get(F);if(W){const j=W[A.__cacheKey];j.usedTimes--,j.usedTimes===0&&M(E),Object.keys(W).length===0&&h.delete(F)}i.remove(E)}function M(E){const A=i.get(E);n.deleteTexture(A.__webglTexture);const F=E.source,W=h.get(F);delete W[A.__cacheKey],o.memory.textures--}function S(E){const A=i.get(E);if(E.depthTexture&&(E.depthTexture.dispose(),i.remove(E.depthTexture)),E.isWebGLCubeRenderTarget)for(let W=0;W<6;W++){if(Array.isArray(A.__webglFramebuffer[W]))for(let j=0;j=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+E+" texture units while this GPU supports only "+r.maxTextures),P+=1,E}function N(E){const A=[];return A.push(E.wrapS),A.push(E.wrapT),A.push(E.wrapR||0),A.push(E.magFilter),A.push(E.minFilter),A.push(E.anisotropy),A.push(E.internalFormat),A.push(E.format),A.push(E.type),A.push(E.generateMipmaps),A.push(E.premultiplyAlpha),A.push(E.flipY),A.push(E.unpackAlignment),A.push(E.colorSpace),A.join()}function X(E,A){const F=i.get(E);if(E.isVideoTexture&&Ie(E),E.isRenderTargetTexture===!1&&E.version>0&&F.__version!==E.version){const W=E.image;if(W===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(W.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{$(F,E,A);return}}t.bindTexture(n.TEXTURE_2D,F.__webglTexture,n.TEXTURE0+A)}function z(E,A){const F=i.get(E);if(E.version>0&&F.__version!==E.version){$(F,E,A);return}t.bindTexture(n.TEXTURE_2D_ARRAY,F.__webglTexture,n.TEXTURE0+A)}function te(E,A){const F=i.get(E);if(E.version>0&&F.__version!==E.version){$(F,E,A);return}t.bindTexture(n.TEXTURE_3D,F.__webglTexture,n.TEXTURE0+A)}function L(E,A){const F=i.get(E);if(E.version>0&&F.__version!==E.version){oe(F,E,A);return}t.bindTexture(n.TEXTURE_CUBE_MAP,F.__webglTexture,n.TEXTURE0+A)}const Z={[aa]:n.REPEAT,[Wo]:n.CLAMP_TO_EDGE,[Kp]:n.MIRRORED_REPEAT},ae={[ni]:n.NEAREST,[iT]:n.NEAREST_MIPMAP_NEAREST,[mf]:n.NEAREST_MIPMAP_LINEAR,[$i]:n.LINEAR,[pp]:n.LINEAR_MIPMAP_NEAREST,[os]:n.LINEAR_MIPMAP_LINEAR},fe={[a4]:n.NEVER,[h4]:n.ALWAYS,[l4]:n.LESS,[mT]:n.LEQUAL,[c4]:n.EQUAL,[d4]:n.GEQUAL,[u4]:n.GREATER,[f4]:n.NOTEQUAL};function Me(E,A){if(A.type===Ur&&e.has("OES_texture_float_linear")===!1&&(A.magFilter===$i||A.magFilter===pp||A.magFilter===mf||A.magFilter===os||A.minFilter===$i||A.minFilter===pp||A.minFilter===mf||A.minFilter===os)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(E,n.TEXTURE_WRAP_S,Z[A.wrapS]),n.texParameteri(E,n.TEXTURE_WRAP_T,Z[A.wrapT]),(E===n.TEXTURE_3D||E===n.TEXTURE_2D_ARRAY)&&n.texParameteri(E,n.TEXTURE_WRAP_R,Z[A.wrapR]),n.texParameteri(E,n.TEXTURE_MAG_FILTER,ae[A.magFilter]),n.texParameteri(E,n.TEXTURE_MIN_FILTER,ae[A.minFilter]),A.compareFunction&&(n.texParameteri(E,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(E,n.TEXTURE_COMPARE_FUNC,fe[A.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(A.magFilter===ni||A.minFilter!==mf&&A.minFilter!==os||A.type===Ur&&e.has("OES_texture_float_linear")===!1)return;if(A.anisotropy>1||i.get(A).__currentAnisotropy){const F=e.get("EXT_texture_filter_anisotropic");n.texParameterf(E,F.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(A.anisotropy,r.getMaxAnisotropy())),i.get(A).__currentAnisotropy=A.anisotropy}}}function Ve(E,A){let F=!1;E.__webglInit===void 0&&(E.__webglInit=!0,A.addEventListener("dispose",w));const W=A.source;let j=h.get(W);j===void 0&&(j={},h.set(W,j));const le=N(A);if(le!==E.__cacheKey){j[le]===void 0&&(j[le]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,F=!0),j[le].usedTimes++;const pe=j[E.__cacheKey];pe!==void 0&&(j[E.__cacheKey].usedTimes--,pe.usedTimes===0&&M(A)),E.__cacheKey=le,E.__webglTexture=j[le].texture}return F}function $(E,A,F){let W=n.TEXTURE_2D;(A.isDataArrayTexture||A.isCompressedArrayTexture)&&(W=n.TEXTURE_2D_ARRAY),A.isData3DTexture&&(W=n.TEXTURE_3D);const j=Ve(E,A),le=A.source;t.bindTexture(W,E.__webglTexture,n.TEXTURE0+F);const pe=i.get(le);if(le.version!==pe.__version||j===!0){t.activeTexture(n.TEXTURE0+F);const ce=wt.getPrimaries(wt.workingColorSpace),Ee=A.colorSpace===Bo?null:wt.getPrimaries(A.colorSpace),ve=A.colorSpace===Bo||ce===Ee?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,A.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,A.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,ve);let ue=_(A.image,!1,r.maxTextureSize);ue=We(A,ue);const Re=s.convert(A.format,A.colorSpace),Pe=s.convert(A.type);let ye=v(A.internalFormat,Re,Pe,A.colorSpace,A.isVideoTexture);Me(W,A);let Se;const Be=A.mipmaps,je=A.isVideoTexture!==!0,J=pe.__version===void 0||j===!0,H=le.dataReady,re=b(A,ue);if(A.isDepthTexture)ye=y(A.format===Jc,A.type),J&&(je?t.texStorage2D(n.TEXTURE_2D,1,ye,ue.width,ue.height):t.texImage2D(n.TEXTURE_2D,0,ye,ue.width,ue.height,0,Re,Pe,null));else if(A.isDataTexture)if(Be.length>0){je&&J&&t.texStorage2D(n.TEXTURE_2D,re,ye,Be[0].width,Be[0].height);for(let q=0,ie=Be.length;q0){const xe=UM(Se.width,Se.height,A.format,A.type);for(const we of A.layerUpdates){const Ye=Se.data.subarray(we*xe/Se.data.BYTES_PER_ELEMENT,(we+1)*xe/Se.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,we,Se.width,Se.height,1,Re,Ye)}A.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,0,Se.width,Se.height,ue.depth,Re,Se.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,q,ye,Se.width,Se.height,ue.depth,0,Se.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else je?H&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,q,0,0,0,Se.width,Se.height,ue.depth,Re,Pe,Se.data):t.texImage3D(n.TEXTURE_2D_ARRAY,q,ye,Se.width,Se.height,ue.depth,0,Re,Pe,Se.data)}else{je&&J&&t.texStorage2D(n.TEXTURE_2D,re,ye,Be[0].width,Be[0].height);for(let q=0,ie=Be.length;q0){const q=UM(ue.width,ue.height,A.format,A.type);for(const ie of A.layerUpdates){const xe=ue.data.subarray(ie*q/ue.data.BYTES_PER_ELEMENT,(ie+1)*q/ue.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,ie,ue.width,ue.height,1,Re,Pe,xe)}A.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ue.width,ue.height,ue.depth,Re,Pe,ue.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,ye,ue.width,ue.height,ue.depth,0,Re,Pe,ue.data);else if(A.isData3DTexture)je?(J&&t.texStorage3D(n.TEXTURE_3D,re,ye,ue.width,ue.height,ue.depth),H&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ue.width,ue.height,ue.depth,Re,Pe,ue.data)):t.texImage3D(n.TEXTURE_3D,0,ye,ue.width,ue.height,ue.depth,0,Re,Pe,ue.data);else if(A.isFramebufferTexture){if(J)if(je)t.texStorage2D(n.TEXTURE_2D,re,ye,ue.width,ue.height);else{let q=ue.width,ie=ue.height;for(let xe=0;xe>=1,ie>>=1}}else if(Be.length>0){if(je&&J){const q=B(Be[0]);t.texStorage2D(n.TEXTURE_2D,re,ye,q.width,q.height)}for(let q=0,ie=Be.length;q0&&re++;const ie=B(Re[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,re,Be,ie.width,ie.height)}for(let ie=0;ie<6;ie++)if(ue){je?H&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,0,0,Re[ie].width,Re[ie].height,ye,Se,Re[ie].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+ie,0,Be,Re[ie].width,Re[ie].height,0,ye,Se,Re[ie].data);for(let xe=0;xe>le),Pe=Math.max(1,A.height>>le);j===n.TEXTURE_3D||j===n.TEXTURE_2D_ARRAY?t.texImage3D(j,le,Ee,Re,Pe,A.depth,0,pe,ce,null):t.texImage2D(j,le,Ee,Re,Pe,0,pe,ce,null)}t.bindFramebuffer(n.FRAMEBUFFER,E),Ze(A)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,W,j,ue.__webglTexture,0,Ne(A)):(j===n.TEXTURE_2D||j>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&j<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,W,j,ue.__webglTexture,le),t.bindFramebuffer(n.FRAMEBUFFER,null)}function de(E,A,F){if(n.bindRenderbuffer(n.RENDERBUFFER,E),A.depthBuffer){const W=A.depthTexture,j=W&&W.isDepthTexture?W.type:null,le=y(A.stencilBuffer,j),pe=A.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ce=Ne(A);Ze(A)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,ce,le,A.width,A.height):F?n.renderbufferStorageMultisample(n.RENDERBUFFER,ce,le,A.width,A.height):n.renderbufferStorage(n.RENDERBUFFER,le,A.width,A.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,pe,n.RENDERBUFFER,E)}else{const W=A.textures;for(let j=0;j{delete A.__boundDepthTexture,delete A.__depthDisposeCallback,W.removeEventListener("dispose",j)};W.addEventListener("dispose",j),A.__depthDisposeCallback=j}A.__boundDepthTexture=W}if(E.depthTexture&&!A.__autoAllocateDepthBuffer){if(F)throw new Error("target.depthTexture not supported in Cube render targets");be(A.__webglFramebuffer,E)}else if(F){A.__webglDepthbuffer=[];for(let W=0;W<6;W++)if(t.bindFramebuffer(n.FRAMEBUFFER,A.__webglFramebuffer[W]),A.__webglDepthbuffer[W]===void 0)A.__webglDepthbuffer[W]=n.createRenderbuffer(),de(A.__webglDepthbuffer[W],E,!1);else{const j=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,le=A.__webglDepthbuffer[W];n.bindRenderbuffer(n.RENDERBUFFER,le),n.framebufferRenderbuffer(n.FRAMEBUFFER,j,n.RENDERBUFFER,le)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,A.__webglFramebuffer),A.__webglDepthbuffer===void 0)A.__webglDepthbuffer=n.createRenderbuffer(),de(A.__webglDepthbuffer,E,!1);else{const W=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,j=A.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,j),n.framebufferRenderbuffer(n.FRAMEBUFFER,W,n.RENDERBUFFER,j)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function ke(E,A,F){const W=i.get(E);A!==void 0&&me(W.__webglFramebuffer,E,E.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),F!==void 0&&Le(E)}function Qe(E){const A=E.texture,F=i.get(E),W=i.get(A);E.addEventListener("dispose",T);const j=E.textures,le=E.isWebGLCubeRenderTarget===!0,pe=j.length>1;if(pe||(W.__webglTexture===void 0&&(W.__webglTexture=n.createTexture()),W.__version=A.version,o.memory.textures++),le){F.__webglFramebuffer=[];for(let ce=0;ce<6;ce++)if(A.mipmaps&&A.mipmaps.length>0){F.__webglFramebuffer[ce]=[];for(let Ee=0;Ee0){F.__webglFramebuffer=[];for(let ce=0;ce0&&Ze(E)===!1){F.__webglMultisampledFramebuffer=n.createFramebuffer(),F.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,F.__webglMultisampledFramebuffer);for(let ce=0;ce0)for(let Ee=0;Ee0)for(let Ee=0;Ee0){if(Ze(E)===!1){const A=E.textures,F=E.width,W=E.height;let j=n.COLOR_BUFFER_BIT;const le=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pe=i.get(E),ce=A.length>1;if(ce)for(let Ee=0;Ee0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&A.__useRenderToTexture!==!1}function Ie(E){const A=o.render.frame;u.get(E)!==A&&(u.set(E,A),E.update())}function We(E,A){const F=E.colorSpace,W=E.format,j=E.type;return E.isCompressedTexture===!0||E.isVideoTexture===!0||F!==pi&&F!==Bo&&(wt.getTransfer(F)===kt?(W!==fr||j!==Zs)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",F)),A}function B(E){return typeof HTMLImageElement<"u"&&E instanceof HTMLImageElement?(c.width=E.naturalWidth||E.width,c.height=E.naturalHeight||E.height):typeof VideoFrame<"u"&&E instanceof VideoFrame?(c.width=E.displayWidth,c.height=E.displayHeight):(c.width=E.width,c.height=E.height),c}this.allocateTextureUnit=U,this.resetTextureUnits=k,this.setTexture2D=X,this.setTexture2DArray=z,this.setTexture3D=te,this.setTextureCube=L,this.rebindTextures=ke,this.setupRenderTarget=Qe,this.updateRenderTargetMipmap=V,this.updateMultisampleRenderTarget=at,this.setupDepthRenderbuffer=Le,this.setupFrameBufferTexture=me,this.useMultisampledRTT=Ze}function L6(n,e){function t(i,r=Bo){let s;const o=wt.getTransfer(r);if(i===Zs)return n.UNSIGNED_BYTE;if(i===Dx)return n.UNSIGNED_SHORT_4_4_4_4;if(i===Nx)return n.UNSIGNED_SHORT_5_5_5_1;if(i===oT)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===rT)return n.BYTE;if(i===sT)return n.SHORT;if(i===jf)return n.UNSIGNED_SHORT;if(i===Ix)return n.INT;if(i===ml)return n.UNSIGNED_INT;if(i===Ur)return n.FLOAT;if(i===wd)return n.HALF_FLOAT;if(i===aT)return n.ALPHA;if(i===lT)return n.RGB;if(i===fr)return n.RGBA;if(i===cT)return n.LUMINANCE;if(i===uT)return n.LUMINANCE_ALPHA;if(i===Oc)return n.DEPTH_COMPONENT;if(i===Jc)return n.DEPTH_STENCIL;if(i===Ux)return n.RED;if(i===Ox)return n.RED_INTEGER;if(i===fT)return n.RG;if(i===Fx)return n.RG_INTEGER;if(i===kx)return n.RGBA_INTEGER;if(i===mp||i===gp||i===_p||i===vp)if(o===kt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===mp)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===gp)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===_p)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===vp)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===mp)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===gp)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===_p)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===vp)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===W_||i===$_||i===X_||i===j_)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===W_)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===$_)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===X_)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===j_)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===q_||i===Y_||i===K_)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===q_||i===Y_)return o===kt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===K_)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===Z_||i===Q_||i===J_||i===ev||i===tv||i===nv||i===iv||i===rv||i===sv||i===ov||i===av||i===lv||i===cv||i===uv)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===Z_)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Q_)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===J_)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===ev)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===tv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===nv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===iv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===rv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===sv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===ov)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===av)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===lv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===cv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===uv)return o===kt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===xp||i===fv||i===dv)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===xp)return o===kt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===fv)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===dv)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===dT||i===hv||i===pv||i===mv)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===xp)return s.COMPRESSED_RED_RGTC1_EXT;if(i===hv)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===pv)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===mv)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Qc?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}let I6=class extends Jn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}},Ws=class extends fn{constructor(){super(),this.isGroup=!0,this.type="Group"}};const D6={type:"move"};let og=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ws,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 Ws,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Y),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ws,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Y),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,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const _ of e.hand.values()){const m=t.getJointPose(_,i),d=this._getHandJoint(c,_);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"],f=c.joints["thumb-tip"],h=u.position.distanceTo(f.position),p=.02,g=.005;c.inputState.pinching&&h>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-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));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(D6)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Ws;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}};const N6=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,U6=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;let O6=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new mi,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new Ki({vertexShader:N6,fragmentShader:U6,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new yn(new Ad(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},F6=class extends bl{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,h=null,p=null,g=null;const _=new O6,m=t.getContextAttributes();let d=null,x=null;const v=[],y=[],b=new lt;let w=null;const T=new Jn;T.viewport=new Ct;const C=new Jn;C.viewport=new Ct;const M=[T,C],S=new I6;let P=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function($){let oe=v[$];return oe===void 0&&(oe=new og,v[$]=oe),oe.getTargetRaySpace()},this.getControllerGrip=function($){let oe=v[$];return oe===void 0&&(oe=new og,v[$]=oe),oe.getGripSpace()},this.getHand=function($){let oe=v[$];return oe===void 0&&(oe=new og,v[$]=oe),oe.getHandSpace()};function U($){const oe=y.indexOf($.inputSource);if(oe===-1)return;const me=v[oe];me!==void 0&&(me.update($.inputSource,$.frame,c||o),me.dispatchEvent({type:$.type,data:$.inputSource}))}function N(){r.removeEventListener("select",U),r.removeEventListener("selectstart",U),r.removeEventListener("selectend",U),r.removeEventListener("squeeze",U),r.removeEventListener("squeezestart",U),r.removeEventListener("squeezeend",U),r.removeEventListener("end",N),r.removeEventListener("inputsourceschange",X);for(let $=0;$=0&&(y[de]=null,v[de].disconnect(me))}for(let oe=0;oe<$.added.length;oe++){const me=$.added[oe];let de=y.indexOf(me);if(de===-1){for(let Le=0;Le=y.length){y.push(me),de=Le;break}else if(y[Le]===null){y[Le]=me,de=Le;break}if(de===-1)break}const be=v[de];be&&be.connect(me)}}const z=new Y,te=new Y;function L($,oe,me){z.setFromMatrixPosition(oe.matrixWorld),te.setFromMatrixPosition(me.matrixWorld);const de=z.distanceTo(te),be=oe.projectionMatrix.elements,Le=me.projectionMatrix.elements,ke=be[14]/(be[10]-1),Qe=be[14]/(be[10]+1),V=(be[9]+1)/be[5],ot=(be[9]-1)/be[5],ee=(be[8]-1)/be[0],at=(Le[8]+1)/Le[0],Ne=ke*ee,Ze=ke*at,Ie=de/(-ee+at),We=Ie*-ee;if(oe.matrixWorld.decompose($.position,$.quaternion,$.scale),$.translateX(We),$.translateZ(Ie),$.matrixWorld.compose($.position,$.quaternion,$.scale),$.matrixWorldInverse.copy($.matrixWorld).invert(),be[10]===-1)$.projectionMatrix.copy(oe.projectionMatrix),$.projectionMatrixInverse.copy(oe.projectionMatrixInverse);else{const B=ke+Ie,E=Qe+Ie,A=Ne-We,F=Ze+(de-We),W=V*Qe/E*B,j=ot*Qe/E*B;$.projectionMatrix.makePerspective(A,F,W,j,B,E),$.projectionMatrixInverse.copy($.projectionMatrix).invert()}}function Z($,oe){oe===null?$.matrixWorld.copy($.matrix):$.matrixWorld.multiplyMatrices(oe.matrixWorld,$.matrix),$.matrixWorldInverse.copy($.matrixWorld).invert()}this.updateCamera=function($){if(r===null)return;let oe=$.near,me=$.far;_.texture!==null&&(_.depthNear>0&&(oe=_.depthNear),_.depthFar>0&&(me=_.depthFar)),S.near=C.near=T.near=oe,S.far=C.far=T.far=me,(P!==S.near||k!==S.far)&&(r.updateRenderState({depthNear:S.near,depthFar:S.far}),P=S.near,k=S.far),T.layers.mask=$.layers.mask|2,C.layers.mask=$.layers.mask|4,S.layers.mask=T.layers.mask|C.layers.mask;const de=$.parent,be=S.cameras;Z(S,de);for(let Le=0;Le0&&(m.alphaTest.value=d.alphaTest);const x=e.get(d),v=x.envMap,y=x.envMapRotation;v&&(m.envMap.value=v,Aa.copy(y),Aa.x*=-1,Aa.y*=-1,Aa.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Aa.y*=-1,Aa.z*=-1),m.envMapRotation.value.setFromMatrix4(k6.makeRotationFromEuler(Aa)),m.flipEnvMap.value=v.isCubeTexture&&v.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 o(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 a(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function l(m,d,x,v){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*x,m.scale.value=v*.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 f(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 p(m,d,x){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===Ri&&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=x.texture,m.transmissionSamplerSize.value.set(x.width,x.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 _(m,d){const x=e.get(d).light;m.referencePosition.value.setFromMatrixPosition(x.matrixWorld),m.nearDistance.value=x.shadow.camera.near,m.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function z6(n,e,t,i){let r={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(x,v){const y=v.program;i.uniformBlockBinding(x,y)}function c(x,v){let y=r[x.id];y===void 0&&(g(x),y=u(x),r[x.id]=y,x.addEventListener("dispose",m));const b=v.program;i.updateUBOMapping(x,b);const w=e.render.frame;s[x.id]!==w&&(h(x),s[x.id]=w)}function u(x){const v=f();x.__bindingPointIndex=v;const y=n.createBuffer(),b=x.__size,w=x.usage;return n.bindBuffer(n.UNIFORM_BUFFER,y),n.bufferData(n.UNIFORM_BUFFER,b,w),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,v,y),y}function f(){for(let x=0;x0&&(y+=b-w),x.__size=y,x.__cache={},this}function _(x){const v={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(v.boundary=4,v.storage=4):x.isVector2?(v.boundary=8,v.storage=8):x.isVector3||x.isColor?(v.boundary=16,v.storage=12):x.isVector4?(v.boundary=16,v.storage=16):x.isMatrix3?(v.boundary=48,v.storage=48):x.isMatrix4?(v.boundary=64,v.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),v}function m(x){const v=x.target;v.removeEventListener("dispose",m);const y=o.indexOf(v.__bindingPointIndex);o.splice(y,1),n.deleteBuffer(r[v.id]),delete r[v.id],delete s[v.id]}function d(){for(const x in r)n.deleteBuffer(r[x]);o=[],r={},s={}}return{bind:l,update:c,dispose:d}}let OM=class{constructor(e={}){const{canvas:t=P4(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1,reverseDepthBuffer:h=!1}=e;this.isWebGLRenderer=!0;let p;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=o;const g=new Uint32Array(4),_=new Int32Array(4);let m=null,d=null;const x=[],v=[];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._outputColorSpace=En,this.toneMapping=Ko,this.toneMappingExposure=1;const y=this;let b=!1,w=0,T=0,C=null,M=-1,S=null;const P=new Ct,k=new Ct;let U=null;const N=new tt(0);let X=0,z=t.width,te=t.height,L=1,Z=null,ae=null;const fe=new Ct(0,0,z,te),Me=new Ct(0,0,z,te);let Ve=!1;const $=new Hx;let oe=!1,me=!1;const de=new dt,be=new dt,Le=new Y,ke=new Ct,Qe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let V=!1;function ot(){return C===null?L:1}let ee=i;function at(R,D){return t.getContext(R,D)}try{const R={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Lx}`),t.addEventListener("webglcontextlost",ie,!1),t.addEventListener("webglcontextrestored",xe,!1),t.addEventListener("webglcontextcreationerror",we,!1),ee===null){const D="webgl2";if(ee=at(D,R),ee===null)throw at(D)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(R){throw console.error("THREE.WebGLRenderer: "+R.message),R}let Ne,Ze,Ie,We,B,E,A,F,W,j,le,pe,ce,Ee,ve,ue,Re,Pe,ye,Se,Be,je,J,H;function re(){Ne=new XI(ee),Ne.init(),je=new L6(ee,Ne),Ze=new zI(ee,Ne,e,je),Ie=new R6(ee,Ne),Ze.reverseDepthBuffer&&h&&Ie.buffers.depth.setReversed(!0),We=new YI(ee),B=new h6,E=new P6(ee,Ne,Ie,B,Ze,je,We),A=new VI(y),F=new $I(y),W=new n5(ee),J=new kI(ee,W),j=new jI(ee,W,We,J),le=new ZI(ee,j,W,We),ye=new KI(ee,Ze,E),ue=new HI(B),pe=new d6(y,A,F,Ne,Ze,J,ue),ce=new B6(y,B),Ee=new m6,ve=new S6(Ne),Pe=new FI(y,A,F,Ie,le,p,l),Re=new A6(y,le,Ze),H=new z6(ee,We,Ze,Ie),Se=new BI(ee,Ne,We),Be=new qI(ee,Ne,We),We.programs=pe.programs,y.capabilities=Ze,y.extensions=Ne,y.properties=B,y.renderLists=Ee,y.shadowMap=Re,y.state=Ie,y.info=We}re();const q=new F6(y,ee);this.xr=q,this.getContext=function(){return ee},this.getContextAttributes=function(){return ee.getContextAttributes()},this.forceContextLoss=function(){const R=Ne.get("WEBGL_lose_context");R&&R.loseContext()},this.forceContextRestore=function(){const R=Ne.get("WEBGL_lose_context");R&&R.restoreContext()},this.getPixelRatio=function(){return L},this.setPixelRatio=function(R){R!==void 0&&(L=R,this.setSize(z,te,!1))},this.getSize=function(R){return R.set(z,te)},this.setSize=function(R,D,O=!0){if(q.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}z=R,te=D,t.width=Math.floor(R*L),t.height=Math.floor(D*L),O===!0&&(t.style.width=R+"px",t.style.height=D+"px"),this.setViewport(0,0,R,D)},this.getDrawingBufferSize=function(R){return R.set(z*L,te*L).floor()},this.setDrawingBufferSize=function(R,D,O){z=R,te=D,L=O,t.width=Math.floor(R*O),t.height=Math.floor(D*O),this.setViewport(0,0,R,D)},this.getCurrentViewport=function(R){return R.copy(P)},this.getViewport=function(R){return R.copy(fe)},this.setViewport=function(R,D,O,K){R.isVector4?fe.set(R.x,R.y,R.z,R.w):fe.set(R,D,O,K),Ie.viewport(P.copy(fe).multiplyScalar(L).round())},this.getScissor=function(R){return R.copy(Me)},this.setScissor=function(R,D,O,K){R.isVector4?Me.set(R.x,R.y,R.z,R.w):Me.set(R,D,O,K),Ie.scissor(k.copy(Me).multiplyScalar(L).round())},this.getScissorTest=function(){return Ve},this.setScissorTest=function(R){Ie.setScissorTest(Ve=R)},this.setOpaqueSort=function(R){Z=R},this.setTransparentSort=function(R){ae=R},this.getClearColor=function(R){return R.copy(Pe.getClearColor())},this.setClearColor=function(){Pe.setClearColor.apply(Pe,arguments)},this.getClearAlpha=function(){return Pe.getClearAlpha()},this.setClearAlpha=function(){Pe.setClearAlpha.apply(Pe,arguments)},this.clear=function(R=!0,D=!0,O=!0){let K=0;if(R){let G=!1;if(C!==null){const he=C.texture.format;G=he===kx||he===Fx||he===Ox}if(G){const he=C.texture.type,ge=he===Zs||he===ml||he===jf||he===Qc||he===Dx||he===Nx,Te=Pe.getClearColor(),Ae=Pe.getClearAlpha(),Ce=Te.r,Ge=Te.g,Oe=Te.b;ge?(g[0]=Ce,g[1]=Ge,g[2]=Oe,g[3]=Ae,ee.clearBufferuiv(ee.COLOR,0,g)):(_[0]=Ce,_[1]=Ge,_[2]=Oe,_[3]=Ae,ee.clearBufferiv(ee.COLOR,0,_))}else K|=ee.COLOR_BUFFER_BIT}D&&(K|=ee.DEPTH_BUFFER_BIT),O&&(K|=ee.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ee.clear(K)},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",ie,!1),t.removeEventListener("webglcontextrestored",xe,!1),t.removeEventListener("webglcontextcreationerror",we,!1),Ee.dispose(),ve.dispose(),B.dispose(),A.dispose(),F.dispose(),le.dispose(),J.dispose(),H.dispose(),pe.dispose(),q.dispose(),q.removeEventListener("sessionstart",Oi),q.removeEventListener("sessionend",xs),ir.stop()};function ie(R){R.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),b=!0}function xe(){console.log("THREE.WebGLRenderer: Context Restored."),b=!1;const R=We.autoReset,D=Re.enabled,O=Re.autoUpdate,K=Re.needsUpdate,G=Re.type;re(),We.autoReset=R,Re.enabled=D,Re.autoUpdate=O,Re.needsUpdate=K,Re.type=G}function we(R){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",R.statusMessage)}function Ye(R){const D=R.target;D.removeEventListener("dispose",Ye),ut(D)}function ut(R){it(R),B.remove(R)}function it(R){const D=B.get(R).programs;D!==void 0&&(D.forEach(function(O){pe.releaseProgram(O)}),R.isShaderMaterial&&pe.releaseShaderCache(R))}this.renderBufferDirect=function(R,D,O,K,G,he){D===null&&(D=Qe);const ge=G.isMesh&&G.matrixWorld.determinant()<0,Te=fo(R,D,O,K,G);Ie.setMaterial(K,ge);let Ae=O.index,Ce=1;if(K.wireframe===!0){if(Ae=j.getWireframeAttribute(O),Ae===void 0)return;Ce=2}const Ge=O.drawRange,Oe=O.attributes.position;let nt=Ge.start*Ce,ht=(Ge.start+Ge.count)*Ce;he!==null&&(nt=Math.max(nt,he.start*Ce),ht=Math.min(ht,(he.start+he.count)*Ce)),Ae!==null?(nt=Math.max(nt,0),ht=Math.min(ht,Ae.count)):Oe!=null&&(nt=Math.max(nt,0),ht=Math.min(ht,Oe.count));const Je=ht-nt;if(Je<0||Je===1/0)return;J.setup(G,K,Te,O,Ae);let $e,rt=Se;if(Ae!==null&&($e=W.get(Ae),rt=Be,rt.setIndex($e)),G.isMesh)K.wireframe===!0?(Ie.setLineWidth(K.wireframeLinewidth*ot()),rt.setMode(ee.LINES)):rt.setMode(ee.TRIANGLES);else if(G.isLine){let Ue=K.linewidth;Ue===void 0&&(Ue=1),Ie.setLineWidth(Ue*ot()),G.isLineSegments?rt.setMode(ee.LINES):G.isLineLoop?rt.setMode(ee.LINE_LOOP):rt.setMode(ee.LINE_STRIP)}else G.isPoints?rt.setMode(ee.POINTS):G.isSprite&&rt.setMode(ee.TRIANGLES);if(G.isBatchedMesh)if(G._multiDrawInstances!==null)rt.renderMultiDrawInstances(G._multiDrawStarts,G._multiDrawCounts,G._multiDrawCount,G._multiDrawInstances);else if(Ne.get("WEBGL_multi_draw"))rt.renderMultiDraw(G._multiDrawStarts,G._multiDrawCounts,G._multiDrawCount);else{const Ue=G._multiDrawStarts,dn=G._multiDrawCounts,yt=G._multiDrawCount,Vt=Ae?W.get(Ae).bytesPerElement:1,Yr=B.get(K).currentProgram.getUniforms();for(let bt=0;bt{function he(){if(K.forEach(function(ge){B.get(ge).currentProgram.isReady()&&K.delete(ge)}),K.size===0){G(R);return}setTimeout(he,10)}Ne.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let Kt=null;function ri(R){Kt&&Kt(R)}function Oi(){ir.stop()}function xs(){ir.start()}const ir=new NT;ir.setAnimationLoop(ri),typeof self<"u"&&ir.setContext(self),this.setAnimationLoop=function(R){Kt=R,q.setAnimationLoop(R),R===null?ir.stop():ir.start()},q.addEventListener("sessionstart",Oi),q.addEventListener("sessionend",xs),this.render=function(R,D){if(D!==void 0&&D.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(b===!0)return;if(R.matrixWorldAutoUpdate===!0&&R.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),q.enabled===!0&&q.isPresenting===!0&&(q.cameraAutoUpdate===!0&&q.updateCamera(D),D=q.getCamera()),R.isScene===!0&&R.onBeforeRender(y,R,D,C),d=ve.get(R,v.length),d.init(D),v.push(d),be.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),$.setFromProjectionMatrix(be),me=this.localClippingEnabled,oe=ue.init(this.clippingPlanes,me),m=Ee.get(R,x.length),m.init(),x.push(m),q.enabled===!0&&q.isPresenting===!0){const he=y.xr.getDepthSensingMesh();he!==null&&ys(he,D,-1/0,y.sortObjects)}ys(R,D,0,y.sortObjects),m.finish(),y.sortObjects===!0&&m.sort(Z,ae),V=q.enabled===!1||q.isPresenting===!1||q.hasDepthSensing()===!1,V&&Pe.addToRenderList(m,R),this.info.render.frame++,oe===!0&&ue.beginShadows();const O=d.state.shadowsArray;Re.render(O,R,D),oe===!0&&ue.endShadows(),this.info.autoReset===!0&&this.info.reset();const K=m.opaque,G=m.transmissive;if(d.setupLights(),D.isArrayCamera){const he=D.cameras;if(G.length>0)for(let ge=0,Te=he.length;ge0&&co(K,G,R,D),V&&Pe.render(R),jr(m,R,D);C!==null&&(E.updateMultisampleRenderTarget(C),E.updateRenderTargetMipmap(C)),R.isScene===!0&&R.onAfterRender(y,R,D),J.resetDefaultState(),M=-1,S=null,v.pop(),v.length>0?(d=v[v.length-1],oe===!0&&ue.setGlobalState(y.clippingPlanes,d.state.camera)):d=null,x.pop(),x.length>0?m=x[x.length-1]:m=null};function ys(R,D,O,K){if(R.visible===!1)return;if(R.layers.test(D.layers)){if(R.isGroup)O=R.renderOrder;else if(R.isLOD)R.autoUpdate===!0&&R.update(D);else if(R.isLight)d.pushLight(R),R.castShadow&&d.pushShadow(R);else if(R.isSprite){if(!R.frustumCulled||$.intersectsSprite(R)){K&&ke.setFromMatrixPosition(R.matrixWorld).applyMatrix4(be);const ge=le.update(R),Te=R.material;Te.visible&&m.push(R,ge,Te,O,ke.z,null)}}else if((R.isMesh||R.isLine||R.isPoints)&&(!R.frustumCulled||$.intersectsObject(R))){const ge=le.update(R),Te=R.material;if(K&&(R.boundingSphere!==void 0?(R.boundingSphere===null&&R.computeBoundingSphere(),ke.copy(R.boundingSphere.center)):(ge.boundingSphere===null&&ge.computeBoundingSphere(),ke.copy(ge.boundingSphere.center)),ke.applyMatrix4(R.matrixWorld).applyMatrix4(be)),Array.isArray(Te)){const Ae=ge.groups;for(let Ce=0,Ge=Ae.length;Ce0&&yr(G,D,O),he.length>0&&yr(he,D,O),ge.length>0&&yr(ge,D,O),Ie.buffers.depth.setTest(!0),Ie.buffers.depth.setMask(!0),Ie.buffers.color.setMask(!0),Ie.setPolygonOffset(!1)}function co(R,D,O,K){if((O.isScene===!0?O.overrideMaterial:null)!==null)return;d.state.transmissionRenderTarget[K.id]===void 0&&(d.state.transmissionRenderTarget[K.id]=new la(1,1,{generateMipmaps:!0,type:Ne.has("EXT_color_buffer_half_float")||Ne.has("EXT_color_buffer_float")?wd:Zs,minFilter:os,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:wt.workingColorSpace}));const he=d.state.transmissionRenderTarget[K.id],ge=K.viewport||P;he.setSize(ge.z,ge.w);const Te=y.getRenderTarget();y.setRenderTarget(he),y.getClearColor(N),X=y.getClearAlpha(),X<1&&y.setClearColor(16777215,.5),y.clear(),V&&Pe.render(O);const Ae=y.toneMapping;y.toneMapping=Ko;const Ce=K.viewport;if(K.viewport!==void 0&&(K.viewport=void 0),d.setupLightsView(K),oe===!0&&ue.setGlobalState(y.clippingPlanes,K),yr(R,O,K),E.updateMultisampleRenderTarget(he),E.updateRenderTargetMipmap(he),Ne.has("WEBGL_multisampled_render_to_texture")===!1){let Ge=!1;for(let Oe=0,nt=D.length;Oe0),Oe=!!O.morphAttributes.position,nt=!!O.morphAttributes.normal,ht=!!O.morphAttributes.color;let Je=Ko;K.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(Je=y.toneMapping);const $e=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,rt=$e!==void 0?$e.length:0,Ue=B.get(K),dn=d.state.lights;if(oe===!0&&(me===!0||R!==S)){const yi=R===S&&K.id===M;ue.setState(K,R,yi)}let yt=!1;K.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==dn.state.version||Ue.outputColorSpace!==Te||G.isBatchedMesh&&Ue.batching===!1||!G.isBatchedMesh&&Ue.batching===!0||G.isBatchedMesh&&Ue.batchingColor===!0&&G.colorTexture===null||G.isBatchedMesh&&Ue.batchingColor===!1&&G.colorTexture!==null||G.isInstancedMesh&&Ue.instancing===!1||!G.isInstancedMesh&&Ue.instancing===!0||G.isSkinnedMesh&&Ue.skinning===!1||!G.isSkinnedMesh&&Ue.skinning===!0||G.isInstancedMesh&&Ue.instancingColor===!0&&G.instanceColor===null||G.isInstancedMesh&&Ue.instancingColor===!1&&G.instanceColor!==null||G.isInstancedMesh&&Ue.instancingMorph===!0&&G.morphTexture===null||G.isInstancedMesh&&Ue.instancingMorph===!1&&G.morphTexture!==null||Ue.envMap!==Ae||K.fog===!0&&Ue.fog!==he||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==ue.numPlanes||Ue.numIntersection!==ue.numIntersection)||Ue.vertexAlphas!==Ce||Ue.vertexTangents!==Ge||Ue.morphTargets!==Oe||Ue.morphNormals!==nt||Ue.morphColors!==ht||Ue.toneMapping!==Je||Ue.morphTargetsCount!==rt)&&(yt=!0):(yt=!0,Ue.__version=K.version);let Vt=Ue.currentProgram;yt===!0&&(Vt=qr(K,D,G));let Yr=!1,bt=!1,xi=!1;const It=Vt.getUniforms(),tn=Ue.uniforms;if(Ie.useProgram(Vt.program)&&(Yr=!0,bt=!0,xi=!0),K.id!==M&&(M=K.id,bt=!0),Yr||S!==R){Ie.buffers.depth.getReversed()?(de.copy(R.projectionMatrix),I4(de),D4(de),It.setValue(ee,"projectionMatrix",de)):It.setValue(ee,"projectionMatrix",R.projectionMatrix),It.setValue(ee,"viewMatrix",R.matrixWorldInverse);const Sr=It.map.cameraPosition;Sr!==void 0&&Sr.setValue(ee,Le.setFromMatrixPosition(R.matrixWorld)),Ze.logarithmicDepthBuffer&&It.setValue(ee,"logDepthBufFC",2/(Math.log(R.far+1)/Math.LN2)),(K.isMeshPhongMaterial||K.isMeshToonMaterial||K.isMeshLambertMaterial||K.isMeshBasicMaterial||K.isMeshStandardMaterial||K.isShaderMaterial)&&It.setValue(ee,"isOrthographic",R.isOrthographicCamera===!0),S!==R&&(S=R,bt=!0,xi=!0)}if(G.isSkinnedMesh){It.setOptional(ee,G,"bindMatrix"),It.setOptional(ee,G,"bindMatrixInverse");const yi=G.skeleton;yi&&(yi.boneTexture===null&&yi.computeBoneTexture(),It.setValue(ee,"boneTexture",yi.boneTexture,E))}G.isBatchedMesh&&(It.setOptional(ee,G,"batchingTexture"),It.setValue(ee,"batchingTexture",G._matricesTexture,E),It.setOptional(ee,G,"batchingIdTexture"),It.setValue(ee,"batchingIdTexture",G._indirectTexture,E),It.setOptional(ee,G,"batchingColorTexture"),G._colorsTexture!==null&&It.setValue(ee,"batchingColorTexture",G._colorsTexture,E));const Ms=O.morphAttributes;if((Ms.position!==void 0||Ms.normal!==void 0||Ms.color!==void 0)&&ye.update(G,O,Vt),(bt||Ue.receiveShadow!==G.receiveShadow)&&(Ue.receiveShadow=G.receiveShadow,It.setValue(ee,"receiveShadow",G.receiveShadow)),K.isMeshGouraudMaterial&&K.envMap!==null&&(tn.envMap.value=Ae,tn.flipEnvMap.value=Ae.isCubeTexture&&Ae.isRenderTargetTexture===!1?-1:1),K.isMeshStandardMaterial&&K.envMap===null&&D.environment!==null&&(tn.envMapIntensity.value=D.environmentIntensity),bt&&(It.setValue(ee,"toneMappingExposure",y.toneMappingExposure),Ue.needsLights&&I(tn,xi),he&&K.fog===!0&&ce.refreshFogUniforms(tn,he),ce.refreshMaterialUniforms(tn,K,L,te,d.state.transmissionRenderTarget[R.id]),Mp.upload(ee,ya(Ue),tn,E)),K.isShaderMaterial&&K.uniformsNeedUpdate===!0&&(Mp.upload(ee,ya(Ue),tn,E),K.uniformsNeedUpdate=!1),K.isSpriteMaterial&&It.setValue(ee,"center",G.center),It.setValue(ee,"modelViewMatrix",G.modelViewMatrix),It.setValue(ee,"normalMatrix",G.normalMatrix),It.setValue(ee,"modelMatrix",G.matrixWorld),K.isShaderMaterial||K.isRawShaderMaterial){const yi=K.uniformsGroups;for(let Sr=0,ho=yi.length;Sr0&&E.useMultisampledRTT(R)===!1?G=B.get(R).__webglMultisampledFramebuffer:Array.isArray(Ge)?G=Ge[O]:G=Ge,P.copy(R.viewport),k.copy(R.scissor),U=R.scissorTest}else P.copy(fe).multiplyScalar(L).floor(),k.copy(Me).multiplyScalar(L).floor(),U=Ve;if(Ie.bindFramebuffer(ee.FRAMEBUFFER,G)&&K&&Ie.drawBuffers(R,G),Ie.viewport(P),Ie.scissor(k),Ie.setScissorTest(U),he){const Ae=B.get(R.texture);ee.framebufferTexture2D(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,ee.TEXTURE_CUBE_MAP_POSITIVE_X+D,Ae.__webglTexture,O)}else if(ge){const Ae=B.get(R.texture),Ce=D||0;ee.framebufferTextureLayer(ee.FRAMEBUFFER,ee.COLOR_ATTACHMENT0,Ae.__webglTexture,O||0,Ce)}M=-1},this.readRenderTargetPixels=function(R,D,O,K,G,he,ge){if(!(R&&R.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Te=B.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&ge!==void 0&&(Te=Te[ge]),Te){Ie.bindFramebuffer(ee.FRAMEBUFFER,Te);try{const Ae=R.texture,Ce=Ae.format,Ge=Ae.type;if(!Ze.textureFormatReadable(Ce)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ze.textureTypeReadable(Ge)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=R.width-K&&O>=0&&O<=R.height-G&&ee.readPixels(D,O,K,G,je.convert(Ce),je.convert(Ge),he)}finally{const Ae=C!==null?B.get(C).__webglFramebuffer:null;Ie.bindFramebuffer(ee.FRAMEBUFFER,Ae)}}},this.readRenderTargetPixelsAsync=async function(R,D,O,K,G,he,ge){if(!(R&&R.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Te=B.get(R).__webglFramebuffer;if(R.isWebGLCubeRenderTarget&&ge!==void 0&&(Te=Te[ge]),Te){const Ae=R.texture,Ce=Ae.format,Ge=Ae.type;if(!Ze.textureFormatReadable(Ce))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ze.textureTypeReadable(Ge))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(D>=0&&D<=R.width-K&&O>=0&&O<=R.height-G){Ie.bindFramebuffer(ee.FRAMEBUFFER,Te);const Oe=ee.createBuffer();ee.bindBuffer(ee.PIXEL_PACK_BUFFER,Oe),ee.bufferData(ee.PIXEL_PACK_BUFFER,he.byteLength,ee.STREAM_READ),ee.readPixels(D,O,K,G,je.convert(Ce),je.convert(Ge),0);const nt=C!==null?B.get(C).__webglFramebuffer:null;Ie.bindFramebuffer(ee.FRAMEBUFFER,nt);const ht=ee.fenceSync(ee.SYNC_GPU_COMMANDS_COMPLETE,0);return ee.flush(),await L4(ee,ht,4),ee.bindBuffer(ee.PIXEL_PACK_BUFFER,Oe),ee.getBufferSubData(ee.PIXEL_PACK_BUFFER,0,he),ee.deleteBuffer(Oe),ee.deleteSync(ht),he}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(R,D=null,O=0){R.isTexture!==!0&&(gf("WebGLRenderer: copyFramebufferToTexture function signature has changed."),D=arguments[0]||null,R=arguments[1]);const K=Math.pow(2,-O),G=Math.floor(R.image.width*K),he=Math.floor(R.image.height*K),ge=D!==null?D.x:0,Te=D!==null?D.y:0;E.setTexture2D(R,0),ee.copyTexSubImage2D(ee.TEXTURE_2D,O,0,0,ge,Te,G,he),Ie.unbindTexture()},this.copyTextureToTexture=function(R,D,O=null,K=null,G=0){R.isTexture!==!0&&(gf("WebGLRenderer: copyTextureToTexture function signature has changed."),K=arguments[0]||null,R=arguments[1],D=arguments[2],G=arguments[3]||0,O=null);let he,ge,Te,Ae,Ce,Ge,Oe,nt,ht;const Je=R.isCompressedTexture?R.mipmaps[G]:R.image;O!==null?(he=O.max.x-O.min.x,ge=O.max.y-O.min.y,Te=O.isBox3?O.max.z-O.min.z:1,Ae=O.min.x,Ce=O.min.y,Ge=O.isBox3?O.min.z:0):(he=Je.width,ge=Je.height,Te=Je.depth||1,Ae=0,Ce=0,Ge=0),K!==null?(Oe=K.x,nt=K.y,ht=K.z):(Oe=0,nt=0,ht=0);const $e=je.convert(D.format),rt=je.convert(D.type);let Ue;D.isData3DTexture?(E.setTexture3D(D,0),Ue=ee.TEXTURE_3D):D.isDataArrayTexture||D.isCompressedArrayTexture?(E.setTexture2DArray(D,0),Ue=ee.TEXTURE_2D_ARRAY):(E.setTexture2D(D,0),Ue=ee.TEXTURE_2D),ee.pixelStorei(ee.UNPACK_FLIP_Y_WEBGL,D.flipY),ee.pixelStorei(ee.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),ee.pixelStorei(ee.UNPACK_ALIGNMENT,D.unpackAlignment);const dn=ee.getParameter(ee.UNPACK_ROW_LENGTH),yt=ee.getParameter(ee.UNPACK_IMAGE_HEIGHT),Vt=ee.getParameter(ee.UNPACK_SKIP_PIXELS),Yr=ee.getParameter(ee.UNPACK_SKIP_ROWS),bt=ee.getParameter(ee.UNPACK_SKIP_IMAGES);ee.pixelStorei(ee.UNPACK_ROW_LENGTH,Je.width),ee.pixelStorei(ee.UNPACK_IMAGE_HEIGHT,Je.height),ee.pixelStorei(ee.UNPACK_SKIP_PIXELS,Ae),ee.pixelStorei(ee.UNPACK_SKIP_ROWS,Ce),ee.pixelStorei(ee.UNPACK_SKIP_IMAGES,Ge);const xi=R.isDataArrayTexture||R.isData3DTexture,It=D.isDataArrayTexture||D.isData3DTexture;if(R.isRenderTargetTexture||R.isDepthTexture){const tn=B.get(R),Ms=B.get(D),yi=B.get(tn.__renderTarget),Sr=B.get(Ms.__renderTarget);Ie.bindFramebuffer(ee.READ_FRAMEBUFFER,yi.__webglFramebuffer),Ie.bindFramebuffer(ee.DRAW_FRAMEBUFFER,Sr.__webglFramebuffer);for(let ho=0;ho0&&(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}};class V6{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=_v,this.updateRanges=[],this.version=0,this.uuid=Br()}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.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;si)return;cg.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(cg);if(!(le.far))return{distance:l,point:XM.clone().applyMatrix4(n.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:n}}const jM=new Y,qM=new Y;class q6 extends qm{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sr.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class WT extends mi{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}let $T=class XT extends xr{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const u=[],f=new Y,h=new Y,p=[],g=[],_=[],m=[];for(let d=0;d<=i;d++){const x=[],v=d/i;let y=0;d===0&&o===0?y=.5/t:d===i&&l===Math.PI&&(y=-.5/t);for(let b=0;b<=t;b++){const w=b/t;f.x=-e*Math.cos(r+w*s)*Math.sin(o+v*a),f.y=e*Math.cos(o+v*a),f.z=e*Math.sin(r+w*s)*Math.sin(o+v*a),g.push(f.x,f.y,f.z),h.copy(f).normalize(),_.push(h.x,h.y,h.z),m.push(w+y,1-v),x.push(c++)}u.push(x)}for(let d=0;d0)&&p.push(v,y,w),(d!==i-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}function mh(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function Q6(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function J6(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function ZM(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function qT(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}class bd{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e=s)){const a=t[1];e=s)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&Q6(r))for(let a=0,l=r.length;a!==l;++a){const c=r[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===D0,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}vs.prototype.TimeBufferType=Float32Array;vs.prototype.ValueBufferType=Float32Array;vs.prototype.DefaultInterpolation=Yf;class bu extends vs{constructor(e,t,i){super(e,t,i)}}bu.prototype.ValueTypeName="bool";bu.prototype.ValueBufferType=Array;bu.prototype.DefaultInterpolation=qf;bu.prototype.InterpolantFactoryMethodLinear=void 0;bu.prototype.InterpolantFactoryMethodSmooth=void 0;class YT extends vs{}YT.prototype.ValueTypeName="color";class nu extends vs{}nu.prototype.ValueTypeName="number";class i8 extends bd{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let c=e*a;for(let u=c+a;c!==u;c+=4)mr.slerpFlat(s,0,o,c-a,o,c,l);return s}}class iu extends vs{InterpolantFactoryMethodLinear(e){return new i8(this.times,this.values,this.getValueSize(),e)}}iu.prototype.ValueTypeName="quaternion";iu.prototype.InterpolantFactoryMethodSmooth=void 0;class Ru extends vs{constructor(e,t,i){super(e,t,i)}}Ru.prototype.ValueTypeName="string";Ru.prototype.ValueBufferType=Array;Ru.prototype.DefaultInterpolation=qf;Ru.prototype.InterpolantFactoryMethodLinear=void 0;Ru.prototype.InterpolantFactoryMethodSmooth=void 0;class ru extends vs{}ru.prototype.ValueTypeName="vector";class r8{constructor(e="",t=-1,i=[],r=n4){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=Br(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(o8(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(vs.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a1){const f=u[1];let h=r[f];h||(r[f]=h=[]),h.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(f,h,p,g,_){if(p.length!==0){const m=[],d=[];qT(p,m,d,g),m.length!==0&&_.push(new f(h,m,d))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f{t&&t(s),this.manager.itemEnd(e)},0),s;if(Rs[e]!==void 0){Rs[e].push({onLoad:t,onProgress:i,onError:r});return}Rs[e]=[],Rs[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=Rs[e],f=c.body.getReader(),h=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),p=h?parseInt(h):0,g=p!==0;let _=0;const m=new ReadableStream({start(d){x();function x(){f.read().then(({done:v,value:y})=>{if(v)d.close();else{_+=y.byteLength;const b=new ProgressEvent("progress",{lengthComputable:g,loaded:_,total:p});for(let w=0,T=u.length;w{d.error(v)})}}});return new Response(m)}else throw new l8(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),h=f&&f[1]?f[1].toLowerCase():void 0,p=new TextDecoder(h);return c.arrayBuffer().then(g=>p.decode(g))}}}).then(c=>{$o.add(e,c);const u=Rs[e];delete Rs[e];for(let f=0,h=u.length;f{const u=Rs[e];if(u===void 0)throw this.manager.itemError(e),c;delete Rs[e];for(let f=0,h=u.length;f{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class c8 extends Rl{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$o.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Kf("img");function l(){u(),$o.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(f){u(),r&&r(f),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class Kx extends Rl{constructor(e){super(e)}load(e,t,i,r){const s=new mi,o=new c8(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class Ym extends fn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new tt(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const ug=new dt,QM=new Y,JM=new Y;class Zx{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new lt(512,512),this.map=null,this.mapPass=null,this.matrix=new dt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Hx,this._frameExtents=new lt(1,1),this._viewportCount=1,this._viewports=[new Ct(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;QM.setFromMatrixPosition(e.matrixWorld),t.position.copy(QM),JM.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(JM),t.updateMatrixWorld(),ug.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ug),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(ug)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class u8 extends Zx{constructor(){super(new Jn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=eu*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class f8 extends Ym{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(fn.DEFAULT_UP),this.updateMatrix(),this.target=new fn,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new u8}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const e2=new dt,Wu=new Y,fg=new Y;class d8 extends Zx{constructor(){super(new Jn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new lt(4,2),this._viewportCount=6,this._viewports=[new Ct(2,1,1,1),new Ct(0,1,1,1),new Ct(3,1,1,1),new Ct(1,1,1,1),new Ct(3,0,1,1),new Ct(1,0,1,1)],this._cubeDirections=[new Y(1,0,0),new Y(-1,0,0),new Y(0,0,1),new Y(0,0,-1),new Y(0,1,0),new Y(0,-1,0)],this._cubeUps=[new Y(0,1,0),new Y(0,1,0),new Y(0,1,0),new Y(0,1,0),new Y(0,0,1),new Y(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),Wu.setFromMatrixPosition(e.matrixWorld),i.position.copy(Wu),fg.copy(i.position),fg.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(fg),i.updateMatrixWorld(),r.makeTranslation(-Wu.x,-Wu.y,-Wu.z),e2.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(e2)}}class h8 extends Ym{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new d8}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class p8 extends Zx{constructor(){super(new Vx(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ZT extends Ym{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(fn.DEFAULT_UP),this.updateMatrix(),this.target=new fn,this.shadow=new p8}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class m8 extends Ym{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Pf{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=$o.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{r&&r(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return $o.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),$o.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});$o.add(e,l),s.manager.itemStart(e)}}let gh;class QT{static getContext(){return gh===void 0&&(gh=new(window.AudioContext||window.webkitAudioContext)),gh}static setContext(e){gh=e}}class _8 extends Rl{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Yx(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);QT.getContext().decodeAudioData(c,function(f){t(f)}).catch(a)}catch(c){a(c)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}class JT{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=t2(),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=t2();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function t2(){return performance.now()}const ba=new Y,n2=new mr,v8=new Y,Ra=new Y;class x8 extends fn{constructor(){super(),this.type="AudioListener",this.context=QT.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new JT}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ba,n2,v8),Ra.set(0,0,-1).applyQuaternion(n2),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(ba.x,r),t.positionY.linearRampToValueAtTime(ba.y,r),t.positionZ.linearRampToValueAtTime(ba.z,r),t.forwardX.linearRampToValueAtTime(Ra.x,r),t.forwardY.linearRampToValueAtTime(Ra.y,r),t.forwardZ.linearRampToValueAtTime(Ra.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(ba.x,ba.y,ba.z),t.setOrientation(Ra.x,Ra.y,Ra.z,i.x,i.y,i.z)}}class y8 extends fn{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0?(m=Math.sqrt(_+1)*2,n[3]=.25*m,n[0]=(f-p)/m,n[1]=(h-l)/m,n[2]=(a-c)/m):o>u&&o>g?(m=Math.sqrt(1+o-u-g)*2,n[3]=(f-p)/m,n[0]=.25*m,n[1]=(a+c)/m,n[2]=(h+l)/m):u>g?(m=Math.sqrt(1+u-o-g)*2,n[3]=(h-l)/m,n[0]=(a+c)/m,n[1]=.25*m,n[2]=(f+p)/m):(m=Math.sqrt(1+g-o-u)*2,n[3]=(a-c)/m,n[0]=(h+l)/m,n[1]=(f+p)/m,n[2]=.25*m),n}function F8(n,e,t,i){var r=e[0],s=e[1],o=e[2],a=e[3],l=r+r,c=s+s,u=o+o,f=r*l,h=r*c,p=r*u,g=s*c,_=s*u,m=o*u,d=a*l,x=a*c,v=a*u,y=i[0],b=i[1],w=i[2];return n[0]=(1-(g+m))*y,n[1]=(h+v)*y,n[2]=(p-x)*y,n[3]=0,n[4]=(h-v)*b,n[5]=(1-(f+m))*b,n[6]=(_+d)*b,n[7]=0,n[8]=(p+x)*w,n[9]=(_-d)*w,n[10]=(1-(f+g))*w,n[11]=0,n[12]=t[0],n[13]=t[1],n[14]=t[2],n[15]=1,n}function k8(n,e,t,i,r){var s=1/Math.tan(e/2),o;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[11]=-1,n[12]=0,n[13]=0,n[15]=0,r!=null&&r!==1/0?(o=1/(i-r),n[10]=(r+i)*o,n[14]=2*r*i*o):(n[10]=-1,n[14]=-2*i),n}var s2=k8;function Ji(){var n=new Ui(3);return Ui!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function B8(n){var e=n[0],t=n[1],i=n[2];return Math.hypot(e,t,i)}function Fr(n,e,t){var i=new Ui(3);return i[0]=n,i[1]=e,i[2]=t,i}function dg(n,e){return n[0]=e[0],n[1]=e[1],n[2]=e[2],n}function z8(n,e,t,i){return n[0]=e,n[1]=t,n[2]=i,n}function H8(n,e,t){return n[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n}function iA(n,e){var 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 V8(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]}function hg(n,e,t){var i=e[0],r=e[1],s=e[2],o=t[0],a=t[1],l=t[2];return n[0]=r*l-s*a,n[1]=s*o-i*l,n[2]=i*a-r*o,n}function wv(n,e,t,i){var r=e[0],s=e[1],o=e[2];return n[0]=r+i*(t[0]-r),n[1]=s+i*(t[1]-s),n[2]=o+i*(t[2]-o),n}function G8(n,e,t){var i=t[0],r=t[1],s=t[2],o=t[3],a=e[0],l=e[1],c=e[2],u=r*c-s*l,f=s*a-i*c,h=i*l-r*a,p=r*h-s*f,g=s*u-i*h,_=i*f-r*u,m=o*2;return u*=m,f*=m,h*=m,p*=2,g*=2,_*=2,n[0]=a+u+p,n[1]=l+f+g,n[2]=c+h+_,n}var W8=B8;(function(){var n=Ji();return function(e,t,i,r,s,o){var a,l;for(t||(t=3),i||(i=0),r?l=Math.min(r*t+i,e.length):l=e.length,a=i;a0&&(o=1/Math.sqrt(o)),n[0]=t*o,n[1]=i*o,n[2]=r*o,n[3]=s*o,n}(function(){var n=$8();return function(e,t,i,r,s,o){var a,l;for(t||(t=4),i||(i=0),r?l=Math.min(r*t+i,e.length):l=e.length,a=i;aN8?(h=Math.acos(p),g=Math.sin(h),_=Math.sin((1-i)*h)/g,m=Math.sin(i*h)/g):(_=1-i,m=i),n[0]=_*r+m*l,n[1]=_*s+m*c,n[2]=_*o+m*u,n[3]=_*a+m*f,n}function Z8(n,e){return n[0]=-e[0],n[1]=-e[1],n[2]=-e[2],n[3]=e[3],n}function Q8(n,e){var 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{var r=0;e[4]>e[0]&&(r=1),e[8]>e[r*3+r]&&(r=2);var s=(r+1)%3,o=(r+2)%3;i=Math.sqrt(e[r*3+r]-e[s*3+s]-e[o*3+o]+1),n[r]=.5*i,i=.5/i,n[3]=(e[s*3+o]-e[o*3+s])*i,n[s]=(e[s*3+r]+e[r*3+s])*i,n[o]=(e[o*3+r]+e[r*3+o])*i}return n}var tm=X8,pg=j8,o2=q8,Km=Y8;(function(){var n=Ji(),e=Fr(1,0,0),t=Fr(0,1,0);return function(i,r,s){var o=V8(r,s);return o<-.999999?(hg(n,e,r),W8(n)<1e-6&&hg(n,t,r),iA(n,n),rA(i,n,Math.PI),i):o>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(hg(n,r,s),i[0]=n[0],i[1]=n[1],i[2]=n[2],i[3]=1+o,Km(i,i))}})();(function(){var n=zr(),e=zr();return function(t,i,r,s,o,a){return If(n,i,o,a),If(e,r,s,a),If(t,n,e,2*a*(1-a)),t}})();(function(){var n=U8();return function(e,t,i,r){return n[0]=i[0],n[3]=i[1],n[6]=i[2],n[1]=r[0],n[4]=r[1],n[7]=r[2],n[2]=-t[0],n[5]=-t[1],n[8]=-t[2],Km(e,Q8(e,n))}})();const wn=Symbol("@immersive-web-emulation-runtime/xr-space");class ti extends EventTarget{constructor(e,t){super(),this[wn]={parentSpace:e,offsetMatrix:t?O8(t):Ci(),emulated:!0}}}class J8 extends ti{constructor(){super(void 0,Ci())}}class nm{static updateOffsetPosition(e,t){const i=e[wn].offsetMatrix;Zf(i,t)}static updateOffsetQuaternion(e,t){const i=e[wn].offsetMatrix,r=Ji();Qf(r,i),Rd(i,t,r)}static updateOffsetMatrix(e,t){const i=e[wn].offsetMatrix;eA(i,t)}static calculateGlobalOffsetMatrix(e,t=Ci()){const i=e[wn].parentSpace?nm.calculateGlobalOffsetMatrix(e[wn].parentSpace):Ci();return nA(t,i,e[wn].offsetMatrix),t}}let al=class sA{constructor(e=0,t=0,i=0){this.vec3=Fr(e,t,i),this.tempVec3=Ji()}get x(){return this.vec3[0]}set x(e){this.vec3[0]=e}get y(){return this.vec3[1]}set y(e){this.vec3[1]=e}get z(){return this.vec3[2]}set z(e){this.vec3[2]=e}set(e,t,i){return z8(this.vec3,e,t,i),this}clone(){return new sA(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}normalize(){return dg(this.tempVec3,this.vec3),iA(this.vec3,this.tempVec3),this}add(e){return dg(this.tempVec3,this.vec3),H8(this.vec3,this.tempVec3,e.vec3),this}applyQuaternion(e){return dg(this.tempVec3,this.vec3),G8(this.vec3,this.tempVec3,e.quat),this}},Df=class oA{constructor(e=0,t=0,i=0,r=1){this.quat=tm(e,t,i,r),this.tempQuat=zr()}get x(){return this.quat[0]}set x(e){this.quat[0]=e}get y(){return this.quat[1]}set y(e){this.quat[1]=e}get z(){return this.quat[2]}set z(e){this.quat[2]=e}get w(){return this.quat[3]}set w(e){this.quat[3]=e}set(e,t,i,r){return o2(this.quat,e,t,i,r),this}clone(){return new oA(this.x,this.y,this.z,this.w)}copy(e){return o2(this.quat,e.x,e.y,e.z,e.w),this}normalize(){return pg(this.tempQuat,this.quat),Km(this.quat,this.tempQuat),this}invert(){return pg(this.tempQuat,this.quat),Z8(this.quat,this.tempQuat),this}multiply(e){return pg(this.tempQuat,this.quat),K8(this.quat,this.tempQuat,e.quat),this}setFromAxisAngle(e,t){return rA(this.quat,e.vec3,t),this}};const et=Symbol("@immersive-web-emulation-runtime/gamepad");var Jf;(function(n){n.None="",n.Standard="standard",n.XRStandard="xr-standard"})(Jf||(Jf={}));class aA{constructor(e,t){this[et]={type:e,eventTrigger:t,pressed:!1,touched:!1,value:0,lastFrameValue:0,pendingValue:null}}get pressed(){return this[et].type==="manual"?this[et].pressed:this[et].value>0}get touched(){return this[et].type==="manual"?this[et].touched:this[et].touched||this.pressed}get value(){return this[et].value}}class eN{constructor(){this.pressed=!1,this.touched=!1,this.value=0}}class ey{constructor(e,t="",i=-1){this[et]={id:t,index:i,connected:!1,timestamp:performance.now(),mapping:e.mapping,buttonsMap:{},buttonsSequence:[],axesMap:{},axesSequence:[],hapticActuators:[]},e.buttons.forEach(r=>{var s;r===null?this[et].buttonsSequence.push(null):(this[et].buttonsSequence.push(r.id),this[et].buttonsMap[r.id]=new aA(r.type,(s=r.eventTrigger)!==null&&s!==void 0?s:null))}),e.axes.forEach(r=>{r===null?this[et].axesSequence.push(null):(this[et].axesSequence.push(r.id+r.type),this[et].axesMap[r.id]||(this[et].axesMap[r.id]={x:0,y:0}))})}get id(){return this[et].id}get index(){return this[et].index}get connected(){return this[et].connected}get timestamp(){return this[et].timestamp}get mapping(){return this[et].mapping}get axes(){const e=[];return this[et].axesSequence.forEach(t=>{if(t===null)e.push(null);else{const i=t.substring(0,t.length-6),r=t.substring(t.length-6);e.push(r==="y-axis"?this[et].axesMap[i].y:this[et].axesMap[i].x)}}),e}get buttons(){return this[et].buttonsSequence.map(e=>e===null?new eN:this[et].buttonsMap[e])}get hapticActuators(){return this[et].hapticActuators}get vibrationActuator(){return null}}var Wi;(function(n){n.None="none",n.Left="left",n.Right="right"})(Wi||(Wi={}));var im;(function(n){n.Gaze="gaze",n.TrackedPointer="tracked-pointer",n.Screen="screen",n.TransientPointer="transient-pointer"})(im||(im={}));class tN extends Array{}const yo=Symbol("@immersive-web-emulation-runtime/xr-input-source");class Zm{constructor(e,t,i,r,s,o,a){this[yo]={handedness:e,targetRayMode:t,targetRaySpace:r,gripSpace:o,profiles:i,gamepad:s,hand:a}}get handedness(){return this[yo].handedness}get targetRayMode(){return this[yo].targetRayMode}get targetRaySpace(){return this[yo].targetRaySpace}get gripSpace(){return this[yo].gripSpace}get profiles(){return this[yo].profiles}get gamepad(){return this[yo].gamepad}get hand(){return this[yo].hand}}class Ep extends Event{constructor(e,t){if(super(e,t),!t.frame)throw new Error("XRInputSourceEventInit.frame is required");if(!t.inputSource)throw new Error("XRInputSourceEventInit.inputSource is required");this.frame=t.frame,this.inputSource=t.inputSource}}const nn=Symbol("@immersive-web-emulation-runtime/xr-tracked-input"),a2={[Wi.Left]:{position:new al(-.25,1.5,-.4),quaternion:new Df},[Wi.Right]:{position:new al(.25,1.5,-.4),quaternion:new Df},[Wi.None]:{position:new al(.25,1.5,-.4),quaternion:new Df}};class lA{constructor(e){this[nn]={inputSource:e,position:a2[e.handedness].position.clone(),quaternion:a2[e.handedness].quaternion.clone(),connected:!0,lastFrameConnected:!1,inputSourceChanged:!0}}get position(){return this[nn].position}get quaternion(){return this[nn].quaternion}get inputSource(){return this[nn].inputSource}get connected(){return this[nn].connected}set connected(e){this[nn].connected=e,this[nn].inputSource.gamepad[et].connected=e}onFrameStart(e){const t=this[nn].inputSource.targetRaySpace;Rd(t[wn].offsetMatrix,this[nn].quaternion.quat,this[nn].position.vec3);const i=e.session;this[nn].inputSource.gamepad.buttons.forEach(r=>{r instanceof aA&&(r[et].lastFrameValue=r[et].value,r[et].pendingValue!=null&&(r[et].value=r[et].pendingValue,r[et].pendingValue=null),r[et].eventTrigger!=null&&(r[et].lastFrameValue===0&&r[et].value>0?(i.dispatchEvent(new Ep(r[et].eventTrigger,{frame:e,inputSource:this[nn].inputSource})),i.dispatchEvent(new Ep(r[et].eventTrigger+"start",{frame:e,inputSource:this[nn].inputSource}))):r[et].lastFrameValue>0&&r[et].value===0&&i.dispatchEvent(new Ep(r[et].eventTrigger+"end",{frame:e,inputSource:this[nn].inputSource}))))}),this[nn].inputSourceChanged=this.connected!==this[nn].lastFrameConnected,this[nn].lastFrameConnected=this.connected}}const l2=Symbol("@immersive-web-emulation-runtime/xr-controller");class nN extends lA{constructor(e,t,i){if(!e.layout[t])throw new DOMException("Handedness not supported","InvalidStateError");const r=new ti(i),s=e.layout[t].gripOffsetMatrix?new ti(r,e.layout[t].gripOffsetMatrix):void 0,o=[e.profileId,...e.fallbackProfileIds],a=new Zm(t,im.TrackedPointer,o,r,new ey(e.layout[t].gamepad),s);super(a),this[l2]={gamepadConfig:e.layout[t].gamepad}}get gamepadConfig(){return this[l2].gamepadConfig}updateButtonValue(e,t){if(t>1||t<0){console.warn(`Out-of-range value ${t} provided for button ${e}.`);return}const i=this[nn].inputSource.gamepad[et].buttonsMap[e];if(i){if(i[et].type==="binary"&&t!=1&&t!=0){console.warn(`Non-binary value ${t} provided for binary button ${e}.`);return}i[et].pendingValue=t}else console.warn(`Current controller does not have button ${e}.`)}updateButtonTouch(e,t){const i=this[nn].inputSource.gamepad[et].buttonsMap[e];i?i[et].touched=t:console.warn(`Current controller does not have button ${e}.`)}updateAxis(e,t,i){if(i>1||i<-1){console.warn(`Out-of-range value ${i} provided for ${e} axes.`);return}const r=this[nn].inputSource.gamepad[et].axesMap[e];r?t==="x-axis"?r.x=i:t==="y-axis"&&(r.y=i):console.warn(`Current controller does not have ${e} axes.`)}updateAxes(e,t,i){if(t>1||t<-1||i>1||i<-1){console.warn(`Out-of-range value x:${t}, y:${i} provided for ${e} axes.`);return}const r=this[nn].inputSource.gamepad[et].axesMap[e];r?(r.x=t,r.y=i):console.warn(`Current controller does not have ${e} axes.`)}}const Ga=Symbol("@immersive-web-emulation-runtime/xr-view");var Xt;(function(n){n.None="none",n.Left="left",n.Right="right"})(Xt||(Xt={}));class cA{constructor(e,t,i,r){this[Ga]={eye:e,projectionMatrix:t,transform:i,recommendedViewportScale:null,requestedViewportScale:1,session:r}}get eye(){return this[Ga].eye}get projectionMatrix(){return this[Ga].projectionMatrix}get transform(){return this[Ga].transform}get recommendedViewportScale(){return this[Ga].recommendedViewportScale}requestViewportScale(e){if(e===null||e<=0||e>1){console.warn("Invalid scale value. Scale must be > 0 and <= 1.");return}this[Ga].requestedViewportScale=e}}const ll=Symbol("@immersive-web-emulation-runtime/xr-joint-space");class ty extends ti{constructor(e,t,i){super(t,i),this[ll]={jointName:e,radius:0}}get jointName(){return this[ll].jointName}}const $u=Symbol("@immersive-web-emulation-runtime/xr-pose");class Qm{constructor(e,t=!1,i=void 0,r=void 0){this[$u]={transform:e,emulatedPosition:t,linearVelocity:i,angularVelocity:r}}get transform(){return this[$u].transform}get emulatedPosition(){return this[$u].emulatedPosition}get linearVelocity(){return this[$u].linearVelocity}get angularVelocity(){return this[$u].angularVelocity}}const c2=Symbol("@immersive-web-emulation-runtime/xr-joint-pose");class uA extends Qm{constructor(e,t,i=!1,r=void 0,s=void 0){super(e,i,r,s),this[c2]={radius:t}}get radius(){return this[c2].radius}}class rm{constructor(e=0,t=0,i=0,r=1){this.x=e,this.y=t,this.z=i,this.w=r,Object.freeze(this)}static fromPoint(e){return new rm(e.x,e.y,e.z,e.w)}matrixTransform(e){return new rm}toJSON(){return{x:this.x,y:this.y,z:this.z,w:this.w}}}const _h=typeof globalThis.DOMPointReadOnly<"u"?globalThis.DOMPointReadOnly:rm,Bi=Symbol("@immersive-web-emulation-runtime/xr-rigid-transform");class Jm{constructor(e,t){const i=Fr(0,0,0),r=zr();this[Bi]={matrix:Ci(),position:e?Fr(e.x,e.y,e.z):i,orientation:t?Km(zr(),tm(t.x,t.y,t.z,t.w)):r,inverse:null},this.updateMatrix()}updateMatrix(){Rd(this[Bi].matrix,this[Bi].orientation,this[Bi].position)}get matrix(){return this[Bi].matrix}get position(){const e=this[Bi].position;return new _h(e[0],e[1],e[2],1)}get orientation(){const e=this[Bi].orientation;return new _h(e[0],e[1],e[2],e[3])}get inverse(){if(!this[Bi].inverse){const e=Ci();if(!tA(e,this[Bi].matrix))throw new Error("Matrix is not invertible.");let t=Ji();Qf(t,e);let i=zr();em(i,e),this[Bi].inverse=new Jm(new _h(t[0],t[1],t[2],1),new _h(i[0],i[1],i[2],i[3])),this[Bi].inverse[Bi].inverse=this}return this[Bi].inverse}}const u2=Symbol("@immersive-web-emulation-runtime/xr-viewer-pose");class fA extends Qm{constructor(e,t,i=!1,r=void 0,s=void 0){super(e,i,r,s),this[u2]={views:Object.freeze(t)}}get views(){return this[u2].views}}const Ei=Symbol("@immersive-web-emulation-runtime/xr-frame"),f2=Ci(),d2=Ci(),h2=Ci(),p2=(n,e,t)=>{nm.calculateGlobalOffsetMatrix(e,f2),nm.calculateGlobalOffsetMatrix(t,d2),tA(h2,d2),nA(n,h2,f2)};class dA{constructor(e,t,i,r,s){this[Ei]={session:e,id:t,active:i,animationFrame:r,predictedDisplayTime:s,tempMat4:Ci()}}get session(){return this[Ei].session}get predictedDisplayTime(){return this[Ei].predictedDisplayTime}getPose(e,t){if(!this[Ei].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");p2(this[Ei].tempMat4,e,t);const i=Ji();Qf(i,this[Ei].tempMat4);const r=zr();return em(r,this[Ei].tempMat4),new Qm(new Jm({x:i[0],y:i[1],z:i[2],w:1},{x:r[0],y:r[1],z:r[2],w:r[3]}),e[wn].emulated)}getViewerPose(e){if(!this[Ei].animationFrame)throw new DOMException("getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.","InvalidStateError");const t=this[Ei].session,i=t[_e].device,r=this.getPose(i.viewerSpace,e),s=t[_e].mode===Ot.Inline?[Xt.None]:[Xt.Left,Xt.Right],o=[];return s.forEach(a=>{const l=i.viewSpaces[a],c=this.getPose(l,e),u=t[_e].getProjectionMatrix(a),f=new cA(a,new Float32Array(u),c.transform,t);o.push(f)}),new fA(r.transform,o,!1)}getJointPose(e,t){const i=this.getPose(e,t),r=e[ll].radius;return new uA(i.transform,r,!1)}fillJointRadii(e,t){if(e=Array.from(e),!this[Ei].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");if(e.length>t.length)throw new DOMException("The length of jointSpaces is larger than the number of elements in radii","TypeError");let i=!0;for(let r=0;ri.length)throw new DOMException("The length of spaces multiplied by 16 is larger than the number of elements in transforms","TypeError");return e.forEach((r,s)=>{p2(this[Ei].tempMat4,r,t);for(let o=0;o<16;o++)i[s*16+o]=this[Ei].tempMat4[o]}),!0}}class hA extends Event{constructor(e,t){if(super(e,t),!t.session)throw new Error("XRInputSourcesChangeEventInit.session is required");if(!t.added)throw new Error("XRInputSourcesChangeEventInit.added is required");if(!t.removed)throw new Error("XRInputSourcesChangeEventInit.removed is required");this.session=t.session,this.added=t.added,this.removed=t.removed}}var pA;const Oo=Symbol("@immersive-web-emulation-runtime/xr-reference-space");var In;(function(n){n.Viewer="viewer",n.Local="local",n.LocalFloor="local-floor",n.BoundedFloor="bounded-floor",n.Unbounded="unbounded"})(In||(In={}));class gl extends ti{constructor(e,t,i){super(t,i),this[pA]={type:null,onreset:()=>{}},this[Oo].type=e}get onreset(){var e;return(e=this[Oo].onreset)!==null&&e!==void 0?e:()=>{}}set onreset(e){this[Oo].onreset&&this.removeEventListener("reset",this[Oo].onreset),this[Oo].onreset=e,e&&this.addEventListener("reset",e)}getOffsetReferenceSpace(e){return new gl(this[Oo].type,this,e)}}pA=Oo;const Xu=Symbol("@immersive-web-emulation-runtime/xr-render-state");class Tv{constructor(e={},t){this[Xu]={depthNear:e.depthNear||(t==null?void 0:t.depthNear)||.1,depthFar:e.depthFar||(t==null?void 0:t.depthFar)||1e3,inlineVerticalFieldOfView:e.inlineVerticalFieldOfView||(t==null?void 0:t.inlineVerticalFieldOfView)||null,baseLayer:e.baseLayer||(t==null?void 0:t.baseLayer)||null}}get depthNear(){return this[Xu].depthNear}get depthFar(){return this[Xu].depthFar}get inlineVerticalFieldOfView(){return this[Xu].inlineVerticalFieldOfView}get baseLayer(){return this[Xu].baseLayer}}class sm extends Event{constructor(e,t){if(super(e,t),!t.session)throw new Error("XRSessionEventInit.session is required");this.session=t.session}}class mA extends EventTarget{}const Io=Symbol("@immersive-web-emulation-runtime/XRWebGLLayer"),iN={antialias:!0,depth:!0,stencil:!1,alpha:!0,ignoreDepthValues:!1,framebufferScaleFactor:1};let rN=class extends mA{constructor(e,t,i={}){if(super(),e[_e].ended)throw new DOMException("Session has ended","InvalidStateError");const r={...iN,...i};this[Io]={session:e,context:t,antialias:r.antialias}}get context(){return this[Io].context}get antialias(){return this[Io].antialias}get ignoreDepthValues(){return!0}get framebuffer(){return null}get framebufferWidth(){return this[Io].context.drawingBufferWidth}get framebufferHeight(){return this[Io].context.drawingBufferHeight}getViewport(e){if(e[Ga].session!==this[Io].session)throw new DOMException("View's session differs from Layer's session","InvalidStateError");return this[Io].session[_e].device[Fe].getViewport(this,e)}static getNativeFramebufferScaleFactor(e){if(!(e instanceof ny))throw new TypeError("getNativeFramebufferScaleFactor must be passed a session.");return e[_e].ended?0:1}};var mc;(function(n){n.Visible="visible",n.VisibleBlurred="visible-blurred",n.Hidden="hidden"})(mc||(mc={}));var Ot;(function(n){n.Inline="inline",n.ImmersiveVR="immersive-vr",n.ImmersiveAR="immersive-ar"})(Ot||(Ot={}));var $r;(function(n){n.Opaque="opaque",n.AlphaBlend="alpha-blend",n.Additive="additive"})($r||($r={}));var su;(function(n){n.ScreenSpace="screen-space",n.WorldSpace="world-space"})(su||(su={}));const _e=Symbol("@immersive-web-emulation-runtime/xr-session");class ny extends EventTarget{constructor(e,t,i){super(),this[_e]={device:e,mode:t,renderState:new Tv,pendingRenderState:null,enabledFeatures:i,isSystemKeyboardSupported:!1,ended:!1,projectionMatrices:{[Xt.Left]:Ci(),[Xt.Right]:Ci(),[Xt.None]:Ci()},getProjectionMatrix:r=>this[_e].projectionMatrices[r],referenceSpaceIsSupported:r=>{if(!this[_e].enabledFeatures.includes(r))return!1;switch(r){case In.Viewer:return!0;case In.Local:case In.LocalFloor:case In.BoundedFloor:case In.Unbounded:return this[_e].mode!=Ot.Inline}},frameHandle:0,frameCallbacks:[],currentFrameCallbacks:null,onDeviceFrame:()=>{if(this[_e].ended)return;this[_e].deviceFrameHandle=globalThis.requestAnimationFrame(this[_e].onDeviceFrame),this[_e].pendingRenderState!=null&&(this[_e].renderState=this[_e].pendingRenderState,this[_e].pendingRenderState=null,this[_e].device[Fe].onBaseLayerSet(this[_e].renderState.baseLayer));const r=this[_e].renderState.baseLayer;if(r===null)return;const s=r.context,o=s.canvas;if(this[_e].mode!=Ot.Inline){const g=s.getParameter(s.COLOR_CLEAR_VALUE),_=s.getParameter(s.DEPTH_CLEAR_VALUE),m=s.getParameter(s.STENCIL_CLEAR_VALUE);s.clearColor(0,0,0,0),s.clearDepth(1),s.clearStencil(0),s.clear(s.DEPTH_BUFFER_BIT|s.COLOR_BUFFER_BIT|s.STENCIL_BUFFER_BIT),s.clearColor(g[0],g[1],g[2],g[3]),s.clearDepth(_),s.clearStencil(m)}const{depthNear:a,depthFar:l}=this[_e].renderState,{width:c,height:u}=o;if(this[_e].mode!==Ot.Inline){const g=c*(this[_e].device.stereoEnabled?.5:1)/u;s2(this[_e].projectionMatrices[Xt.Left],this[_e].device.fovy,g,a,l),eA(this[_e].projectionMatrices[Xt.Right],this[_e].projectionMatrices[Xt.Left])}else{const g=c/u;s2(this[_e].projectionMatrices[Xt.None],this[_e].renderState.inlineVerticalFieldOfView,g,a,l)}const f=new dA(this,this[_e].frameHandle,!0,!0,performance.now());this[_e].device[Fe].onFrameStart(f),this[_e].updateActiveInputSources();const h=this[_e].currentFrameCallbacks=this[_e].frameCallbacks;this[_e].frameCallbacks=[];const p=performance.now();for(let g=0;g{const r=this[_e].enabledFeatures.includes(ct.HandTracking),s=this[_e].activeInputSources,o=this[_e].device.inputSources.filter(c=>!c.hand||r),a=o.filter(c=>!s.includes(c)),l=s.filter(c=>!o.includes(c));this[_e].activeInputSources=o,(a.length>0||l.length>0)&&this.dispatchEvent(new hA("inputsourceschange",{session:this,added:a,removed:l}))},onend:null,oninputsourceschange:null,onselect:null,onselectstart:null,onselectend:null,onsqueeze:null,onsqueezestart:null,onsqueezeend:null,onvisibilitychange:null,onframeratechange:null},this[_e].onDeviceFrame()}get visibilityState(){return this[_e].device.visibilityState}get frameRate(){return this[_e].nominalFrameRate}get supportedFrameRates(){return new Float32Array(this[_e].device.supportedFrameRates)}get renderState(){return this[_e].renderState}get inputSources(){return this[_e].inputSourceArray.length=0,!this[_e].ended&&this[_e].mode!==Ot.Inline&&this[_e].inputSourceArray.push(...this[_e].activeInputSources),this[_e].inputSourceArray}get enabledFeatures(){return this[_e].enabledFeatures}get isSystemKeyboardSupported(){return this[_e].isSystemKeyboardSupported}get environmentBlendMode(){var e;return(e=this[_e].device[Fe].environmentBlendModes[this[_e].mode])!==null&&e!==void 0?e:$r.Opaque}get interactionMode(){return this[_e].device[Fe].interactionMode}updateRenderState(e={}){var t,i,r,s;if(this[_e].ended)throw new DOMException("XRSession has already ended.","InvalidStateError");if(e.baseLayer&&e.baseLayer[Io].session!==this)throw new DOMException("Base layer was created by a different XRSession","InvalidStateError");if(e.inlineVerticalFieldOfView!=null&&this[_e].mode!==Ot.Inline)throw new DOMException("InlineVerticalFieldOfView must not be set for an immersive session","InvalidStateError");const o={baseLayer:e.baseLayer||((t=this[_e].pendingRenderState)===null||t===void 0?void 0:t.baseLayer)||void 0,depthFar:e.depthFar||((i=this[_e].pendingRenderState)===null||i===void 0?void 0:i.depthFar)||void 0,depthNear:e.depthNear||((r=this[_e].pendingRenderState)===null||r===void 0?void 0:r.depthNear)||void 0,inlineVerticalFieldOfView:e.inlineVerticalFieldOfView||((s=this[_e].pendingRenderState)===null||s===void 0?void 0:s.inlineVerticalFieldOfView)||void 0};this[_e].pendingRenderState=new Tv(o,this[_e].renderState)}async updateTargetFrameRate(e){return new Promise((t,i)=>{this[_e].ended?i(new DOMException("XRSession has already ended.","InvalidStateError")):this[_e].device.supportedFrameRates.includes(e)?(this[_e].nominalFrameRate===e?console.log("Requested frame rate is the same as the current nominal frame rate, no update made"):(this[_e].nominalFrameRate=e,this.dispatchEvent(new sm("frameratechange",{session:this})),console.log(`Nominal frame rate updated to ${e}`)),t()):i(new DOMException("Requested frame rate not supported.","InvalidStateError"))})}async requestReferenceSpace(e){return new Promise((t,i)=>{if(this[_e].ended||!this[_e].referenceSpaceIsSupported(e)){i(new DOMException("The requested reference space type is not supported.","NotSupportedError"));return}let r;switch(e){case In.Viewer:r=this[_e].device.viewerSpace;break;case In.Local:r=new gl(e,this[_e].device[Fe].globalSpace,this[_e].device.viewerSpace[wn].offsetMatrix);break;case In.LocalFloor:case In.BoundedFloor:case In.Unbounded:r=new gl(e,this[_e].device[Fe].globalSpace);break}this[_e].referenceSpaces.push(r),t(r)})}requestAnimationFrame(e){if(this[_e].ended)return 0;const t=++this[_e].frameHandle;return this[_e].frameCallbacks.push({handle:t,callback:e,cancelled:!1}),t}cancelAnimationFrame(e){let t=this[_e].frameCallbacks,i=t.findIndex(r=>r&&r.handle===e);i>-1&&(t[i].cancelled=!0,t.splice(i,1)),t=this[_e].currentFrameCallbacks,t&&(i=t.findIndex(r=>r&&r.handle===e),i>-1&&(t[i].cancelled=!0))}async end(){return new Promise((e,t)=>{this[_e].ended||this[_e].deviceFrameHandle===null?t(new DOMException("XRSession has already ended.","InvalidStateError")):(globalThis.cancelAnimationFrame(this[_e].deviceFrameHandle),this[_e].device[Fe].onSessionEnd(),this.dispatchEvent(new sm("end",{session:this})),e())})}get onend(){var e;return(e=this[_e].onend)!==null&&e!==void 0?e:()=>{}}set onend(e){this[_e].onend&&this.removeEventListener("end",this[_e].onend),this[_e].onend=e,e&&this.addEventListener("end",e)}get oninputsourceschange(){var e;return(e=this[_e].oninputsourceschange)!==null&&e!==void 0?e:()=>{}}set oninputsourceschange(e){this[_e].oninputsourceschange&&this.removeEventListener("inputsourceschange",this[_e].oninputsourceschange),this[_e].oninputsourceschange=e,e&&this.addEventListener("inputsourceschange",e)}get onselect(){var e;return(e=this[_e].onselect)!==null&&e!==void 0?e:()=>{}}set onselect(e){this[_e].onselect&&this.removeEventListener("select",this[_e].onselect),this[_e].onselect=e,e&&this.addEventListener("select",e)}get onselectstart(){var e;return(e=this[_e].onselectstart)!==null&&e!==void 0?e:()=>{}}set onselectstart(e){this[_e].onselectstart&&this.removeEventListener("selectstart",this[_e].onselectstart),this[_e].onselectstart=e,e&&this.addEventListener("selectstart",e)}get onselectend(){var e;return(e=this[_e].onselectend)!==null&&e!==void 0?e:()=>{}}set onselectend(e){this[_e].onselectend&&this.removeEventListener("selectend",this[_e].onselectend),this[_e].onselectend=e,e&&this.addEventListener("selectend",e)}get onsqueeze(){var e;return(e=this[_e].onsqueeze)!==null&&e!==void 0?e:()=>{}}set onsqueeze(e){this[_e].onsqueeze&&this.removeEventListener("squeeze",this[_e].onsqueeze),this[_e].onsqueeze=e,e&&this.addEventListener("squeeze",e)}get onsqueezestart(){var e;return(e=this[_e].onsqueezestart)!==null&&e!==void 0?e:()=>{}}set onsqueezestart(e){this[_e].onsqueezestart&&this.removeEventListener("squeezestart",this[_e].onsqueezestart),this[_e].onsqueezestart=e,e&&this.addEventListener("squeezestart",e)}get onsqueezeend(){var e;return(e=this[_e].onsqueezeend)!==null&&e!==void 0?e:()=>{}}set onsqueezeend(e){this[_e].onsqueezeend&&this.removeEventListener("squeezeend",this[_e].onsqueezeend),this[_e].onsqueezeend=e,e&&this.addEventListener("squeezeend",e)}get onvisibilitychange(){var e;return(e=this[_e].onvisibilitychange)!==null&&e!==void 0?e:()=>{}}set onvisibilitychange(e){this[_e].onvisibilitychange&&this.removeEventListener("visibilitychange",this[_e].onvisibilitychange),this[_e].onvisibilitychange=e,e&&this.addEventListener("visibilitychange",e)}get onframeratechange(){var e;return(e=this[_e].onframeratechange)!==null&&e!==void 0?e:()=>{}}set onframeratechange(e){this[_e].onframeratechange&&this.removeEventListener("frameratechange",this[_e].onframeratechange),this[_e].onframeratechange=e,e&&this.addEventListener("frameratechange",e)}}var ed;(function(n){n.Wrist="wrist",n.ThumbMetacarpal="thumb-metacarpal",n.ThumbPhalanxProximal="thumb-phalanx-proximal",n.ThumbPhalanxDistal="thumb-phalanx-distal",n.ThumbTip="thumb-tip",n.IndexFingerMetacarpal="index-finger-metacarpal",n.IndexFingerPhalanxProximal="index-finger-phalanx-proximal",n.IndexFingerPhalanxIntermediate="index-finger-phalanx-intermediate",n.IndexFingerPhalanxDistal="index-finger-phalanx-distal",n.IndexFingerTip="index-finger-tip",n.MiddleFingerMetacarpal="middle-finger-metacarpal",n.MiddleFingerPhalanxProximal="middle-finger-phalanx-proximal",n.MiddleFingerPhalanxIntermediate="middle-finger-phalanx-intermediate",n.MiddleFingerPhalanxDistal="middle-finger-phalanx-distal",n.MiddleFingerTip="middle-finger-tip",n.RingFingerMetacarpal="ring-finger-metacarpal",n.RingFingerPhalanxProximal="ring-finger-phalanx-proximal",n.RingFingerPhalanxIntermediate="ring-finger-phalanx-intermediate",n.RingFingerPhalanxDistal="ring-finger-phalanx-distal",n.RingFingerTip="ring-finger-tip",n.PinkyFingerMetacarpal="pinky-finger-metacarpal",n.PinkyFingerPhalanxProximal="pinky-finger-phalanx-proximal",n.PinkyFingerPhalanxIntermediate="pinky-finger-phalanx-intermediate",n.PinkyFingerPhalanxDistal="pinky-finger-phalanx-distal",n.PinkyFingerTip="pinky-finger-tip"})(ed||(ed={}));class iy extends Map{}const sN={jointTransforms:{wrist:{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06867414712905884,-.009423808194696903,.10627774149179459,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.5012241005897522,-.8650535345077515,-.0213695727288723,0,.7415963411331177,-.4421543478965759,.5045139193534851,0,-.44587990641593933,.23702676594257355,.8631392121315002,0,-.032122574746608734,-.01196830440312624,.07194234430789948,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[-.3175753057003021,-.9460570216178894,-.06419729441404343,0,.8958902955055237,-.32153913378715515,.30658137798309326,0,-.3106854259967804,.03984907269477844,.9496771097183228,0,-.017625702545046806,-.01967475935816765,.04387917369604111,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,-.007126678712666035,-.021021386608481407,.011786630377173424,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,.0003423091256991029,-.024528030306100845,-.011410919018089771,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.038037415593862534,-.0020236473064869642,.07626739144325256,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.7986818552017212,-.35985732078552246,.48229536414146423,0,.538311243057251,.7854709625244141,-.30537736415863037,0,-.2689369022846222,.5035246014595032,.8210577368736267,0,-.006869405973702669,.033938243985176086,.04206443578004837,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.8285930156707764,-.32672837376594543,.4546217918395996,0,.5577570199966431,.4116027057170868,-.7207564115524292,0,.04836784675717354,.8507823944091797,.5232869386672974,0,.0033306588884443045,.014840902760624886,.010923954658210278,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,.0021551470272243023,-.0058362227864563465,-.0017938464879989624,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,-.00131594471167773,-.025222131982445717,-.012442642822861671,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.05395089089870453,.003063359996303916,.07402937114238739,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9187911748886108,-.1530158370733261,.36387869715690613,0,.038666240870952606,.9522662162780762,.302808940410614,0,-.3928440511226654,-.26414817571640015,.8808513283729553,0,-.02717282809317112,.04162866622209549,.03678669035434723,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9228746294975281,-.12856416404247284,.36300456523895264,0,.14524033665657043,.9892153143882751,-.01890045404434204,0,-.3566599190235138,.07016586512327194,.9315956234931946,0,-.01030921470373869,.05296773463487625,-.0010256498353555799,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,-.0004833847051486373,.05103470757603645,-.026690717786550522,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,.008158999495208263,.05004044249653816,-.050120558589696884,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06732909381389618,.007902119308710098,.07209732383489609,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9391821026802063,-.027994679287075996,.34227466583251953,0,-.18282271921634674,.8029410243034363,.5673282742500305,0,-.2907087206840515,-.5954000353813171,.7489906549453735,0,-.047129884362220764,.03806127607822418,.032147664576768875,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9249380826950073,.03699534013867378,.3783116042613983,0,-.12898847460746765,.9667453765869141,.2208271026611328,0,-.3575615882873535,-.25304901599884033,.8989526629447937,0,-.03579339757561684,.06127955764532089,.002939916681498289,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.026291755959391594,.06800390034914017,-.02094830758869648,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.016345610842108727,.07300511747598648,-.04263874143362045,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.8769711852073669,.31462907791137695,.36322021484375,0,-.4506046175956726,.801031768321991,.39408499002456665,0,-.16696058213710785,-.5092697143554688,.8442559838294983,0,-.07460174709558487,.0062340241856873035,.06756893545389175,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9498357176780701,.1553308218717575,.2714462876319885,0,-.3019258379936218,.6817675232887268,.6663586497306824,0,-.08155745267868042,-.7148879170417786,.694466233253479,0,-.06697750836610794,.029482364654541016,.02902858518064022,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9214097261428833,.27928245067596436,.2701927423477173,0,-.3670244514942169,.8538867831230164,.36901235580444336,0,-.12765564024448395,-.43917882442474365,.8892839550971985,0,-.06447203457355499,.05144399777054787,.0076942890882492065,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.06187915802001953,.060364335775375366,-.010368337854743004,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.056796226650476456,.07042007893323898,-.02921444922685623,1],radius:.005425984505563974}},gripOffsetMatrix:[.08027800917625427,-.8086723685264587,-.5827556252479553,0,-.4154181480407715,-.5585916638374329,.7179154753684998,0,-.9060805439949036,.1844543218612671,-.3807799518108368,0,-.038054611533880234,-.002910431008785963,.03720742464065552,1]},oN={jointTransforms:{wrist:{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05789132043719292,.01670890860259533,.11183350533246994,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[.02145560085773468,-.9978390336036682,.0621047280728817,0,.41311800479888916,.06541631370782852,.9083252549171448,0,-.9104245901107788,.006167683284729719,.4136286973953247,0,-.016488194465637207,.012708572670817375,.08862338215112686,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.21270370483398438,-.966137707233429,.14606566727161407,0,.49890995025634766,.2359165996313095,.8339261412620544,0,-.8401462435722351,-.10450579971075058,.5321959853172302,0,.013112368993461132,.012508046813309193,.07517509907484055,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.04150351136922836,.016039609909057617,.05719054117798805,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.06548332422971725,.01683700829744339,.0516640841960907,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.02592567168176174,.019982583820819855,.08479326963424683,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9063700437545776,-.21756279468536377,.3621589243412018,0,.0970839336514473,.9415287375450134,.3226419687271118,0,-.41117796301841736,-.2572731077671051,.8744958639144897,0,-.0015709538711234927,.043078210204839706,.034657616168260574,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9159826040267944,-.1651475727558136,.36565208435058594,0,.09755707532167435,.9756820797920227,.1962820291519165,0,-.3891757130622864,-.14411886036396027,.9098196625709534,0,.014023927971720695,.052835866808891296,.0014903299743309617,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.023482320830225945,.05633850023150444,-.020621655508875847,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.03096788562834263,.06281610578298569,-.040703095495700836,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.04184452444314957,.022474845871329308,.08177298307418823,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9720265865325928,-.08313076198101044,.21966552734375,0,.20477405190467834,.7580050826072693,-.6192700862884521,0,-.11502730846405029,.6469289064407349,.7538246512413025,0,-.022107340395450592,.05035499855875969,.02970452979207039,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9779140949249268,-.07129573822021484,.19646917283535004,0,.1287083923816681,-.5352076292037964,-.8348574042320251,0,.1646735966205597,.8417060971260071,-.5142109394073486,0,-.017169542610645294,.022584279999136925,-.00265491777099669,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02170622907578945,-.0006043742760084569,.011511396616697311,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02438267692923546,-.0026927536819130182,.03627248480916023,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05944233387708664,.0264605600386858,.07478221505880356,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9842101335525513,.024470895528793335,.1753024309873581,0,.12200043350458145,.6237703561782837,-.7720272541046143,0,-.12824076414108276,.7812241315841675,.610936164855957,0,-.04249368980526924,.0467497780919075,.027722163125872612,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9941774606704712,.05949164181947708,.08983955532312393,0,.10504482686519623,-.7208291888237,-.6851072907447815,0,.024001073092222214,.6905553936958313,-.7228817939758301,0,-.0374927744269371,.016285063698887825,.0038980208337306976,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.038130562752485275,-.0020653479732573032,.02310742810368538,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.0390593595802784,.004176302347332239,.0466572530567646,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9147363901138306,.3458845317363739,.20885537564754486,0,-.3923271894454956,.8839452862739563,.2544005811214447,0,-.09662359952926636,-.3146490156650543,.9442773461341858,0,-.06715242564678192,.024195827543735504,.07137546688318253,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9613109827041626,.22439135611057281,.15977802872657776,0,.01002211682498455,.5511574745178223,-.8343409299850464,0,-.27528178691864014,.8036624789237976,.5275853276252747,0,-.06273911893367767,.038559623062610626,.028268879279494286,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9820972084999084,.18811029195785522,-.00995189044624567,0,.14063723385334015,-.7673450708389282,-.6256227493286133,0,-.12532226741313934,.6130226850509644,-.7800630927085876,0,-.05428232625126839,.013870777562260628,.012061242014169693,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9744614362716675,.20454788208007812,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05173685774207115,.0014194445684552193,.02790539152920246,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9744614362716675,.20454788208007812,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05098633095622063,.008463085629045963,.048688892275094986,1],radius:.005425984505563974}},gripOffsetMatrix:[.005510995630174875,-.9149997234344482,-.40341615676879883,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.9340395331382751,.13936474919319153,-.32885703444480896,0,-.031803809106349945,.007837686687707901,.04313928261399269,1]},aN={jointTransforms:{wrist:{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.04913589730858803,.0021463718730956316,.11701996624469757,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.07536252588033676,-.9959676265716553,-.04867160692811012,0,.5877083539962769,-.08379616588354111,.8047218918800354,0,-.8055551648139954,.032041035592556,.5916536450386047,0,-.010643752291798592,.0006936835707165301,.08736639469861984,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.1374533325433731,-.9904957413673401,.004982374142855406,0,.5534393787384033,.08097179979085922,.8289443850517273,0,-.8214688897132874,-.11118389666080475,.559309184551239,0,.015547193586826324,-.0003480653394944966,.0681300163269043,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.04330715537071228,.003409178927540779,.0492292083799839,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.062003348022699356,.004069602582603693,.03322213143110275,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.02009812369942665,.008770795539021492,.08660387247800827,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9001791477203369,-.2598813474178314,.3494834005832672,0,.06073702871799469,.8695210218429565,.490146666765213,0,-.4312632381916046,-.41999316215515137,.7985095381736755,0,-.00017739279428496957,.03890012577176094,.039073407649993896,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9082008600234985,-.20898112654685974,.36262574791908264,0,.11045389622449875,.9553793668746948,.27395179867744446,0,-.40369608998298645,-.20874978601932526,.8907597661018372,0,.01617925800383091,.05482936650514603,.008788082748651505,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.02599053829908371,.059902746230363846,-.012860597111284733,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.03362493962049484,.06421422213315964,-.033461250364780426,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.03627845644950867,.011579737067222595,.08550142496824265,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9876697659492493,-.06786545366048813,.1410750150680542,0,-.015095947310328484,.855663537979126,.5173118710517883,0,-.15582047402858734,-.5130629539489746,.8440889716148376,0,-.021259509027004242,.04587256908416748,.03659208118915558,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.988391637802124,-.04354291781783104,.14555205404758453,0,.008894841186702251,.9729899168014526,.23067504167556763,0,-.15166506171226501,-.22670257091522217,.9620829224586487,0,-.014570588245987892,.06789684295654297,.0003578895702958107,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.010392282158136368,.07414241135120392,-.026147106662392616,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.0069718430750072,.08024183660745621,-.05014154314994812,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,.0005348679260350764,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.05402477830648422,.015797706320881844,.08152295649051666,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9940828680992126,.05735103040933609,.09224652498960495,0,-.10022822767496109,.8116500377655029,.5754809379577637,0,-.041867565363645554,-.5813214182853699,.8125960826873779,0,-.041623555123806,.04171867296099663,.03582974523305893,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9843675494194031,.12044742703437805,.12850022315979004,0,-.15629759430885315,.9337108135223389,.3221098482608795,0,-.08118485659360886,-.3371586799621582,.937940776348114,0,-.039990875869989395,.06438793987035751,.004141641780734062,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03783353418111801,.07334739714860916,-.020782606676220894,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03445569798350334,.0802423357963562,-.04392268508672714,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9181402921676636,.35625091195106506,.17350243031978607,0,-.39615097641944885,.8352503180503845,.38134080171585083,0,-.009065053425729275,-.41885748505592346,.9080066680908203,0,-.06191859766840935,.013620133511722088,.07850203663110733,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9714386463165283,.236698180437088,-.016745081171393394,0,-.18462024629116058,.7982627749443054,.5733163952827454,0,.14906984567642212,-.5538501739501953,.8191629648208618,0,-.061502378433942795,.032741155475378036,.03705105185508728,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9337416291236877,.35620439052581787,-.03527557849884033,0,-.33203884959220886,.8987522721290588,.28634607791900635,0,.13370157778263092,-.2556603252887726,.9574766755104065,0,-.06608185172080994,.049755651503801346,.011886020191013813,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.0687975287437439,.054948460310697556,-.007561664097011089,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.06947512179613113,.0613851435482502,-.028543535619974136,1],radius:.005425984505563974}},gripOffsetMatrix:[-.0005348679260350764,-.8648636937141418,-.5020061135292053,0,-.2741127908229828,-.48265108466148376,.8318111896514893,0,-.9616971015930176,.13805119693279266,-.2368120402097702,0,-.02878567762672901,.0017147823236882687,.04536811262369156,1]},m2={profileId:"oculus-hand",fallbackProfileIds:["generic-hand","generic-hand-select","generic-trigger"],poses:{default:aN,pinch:sN,point:oN}},lN={mapping:Jf.None,buttons:[{id:"pinch",type:"analog",eventTrigger:"select"}],axes:[]},g2=Ji(),_2=zr(),v2=Ji(),x2=Ji(),y2=zr(),S2=Ji(),M2=Ji(),E2=zr(),w2=Ji(),T2=(n,e,t,i)=>(Qf(g2,e),em(_2,e),Ev(v2,e),Qf(x2,t),em(y2,t),Ev(S2,t),wv(M2,g2,x2,i),If(E2,_2,y2,i),wv(w2,v2,S2,i),F8(n,E2,M2,w2),n),cN=[1,-1,-1,0,-1,1,1,0,-1,1,1,0,-1,1,1,1],uN=n=>{for(let e=0;e<16;e++)n[e]*=cN[e]},La=Symbol("@immersive-web-emulation-runtime/xr-hand-input");class A2 extends lA{constructor(e,t,i){if(t!==Wi.Left&&t!==Wi.Right)throw new DOMException('handedness for XRHandInput must be either "left" or "right"',"InvalidStateError");if(!e.poses.default||!e.poses.pinch)throw new DOMException('"default" and "pinch" hand pose configs are required',"InvalidStateError");const r=new ti(i),s=new ti(r),o=[e.profileId,...e.fallbackProfileIds],a=new iy;Object.values(ed).forEach(c=>{a.set(c,new ty(c,r))});const l=new Zm(t,im.TrackedPointer,o,r,new ey(lN),s,a);super(l),this[La]={poseId:"default",poses:e.poses},this.updateHandPose()}get poseId(){return this[La].poseId}set poseId(e){if(!this[La].poses[e]){console.warn(`Pose config ${e} not found`);return}this[La].poseId=e}updateHandPose(){const e=this[La].poses[this[La].poseId],t=this[La].poses.pinch;Object.values(ed).forEach(i=>{const r=e.jointTransforms[i].offsetMatrix,s=t.jointTransforms[i].offsetMatrix,o=this.inputSource.hand.get(i);T2(o[wn].offsetMatrix,r,s,this.pinchValue),this.inputSource.handedness===Wi.Right&&uN(o[wn].offsetMatrix),o[ll].radius=(1-this.pinchValue)*e.jointTransforms[i].radius+this.pinchValue*t.jointTransforms[i].radius}),e.gripOffsetMatrix&&t.gripOffsetMatrix&&T2(this.inputSource.gripSpace[wn].offsetMatrix,e.gripOffsetMatrix,t.gripOffsetMatrix,this.pinchValue)}get pinchValue(){return this[nn].inputSource.gamepad[et].buttonsMap.pinch.value}updatePinchValue(e){if(e>1||e<0){console.warn(`Out-of-range value ${e} provided for pinch`);return}const t=this[nn].inputSource.gamepad[et].buttonsMap.pinch;t[et].pendingValue=e}onFrameStart(e){super.onFrameStart(e),this.updateHandPose()}}const Do=Symbol("@immersive-web-emulation-runtime/xr-system");class b2 extends EventTarget{constructor(e){super(),this[Do]={device:e}}isSessionSupported(e){return new Promise((t,i)=>{e===Ot.Inline?t(!0):t(this[Do].device.supportedSessionModes.includes(e))})}requestSession(e,t={}){return new Promise((i,r)=>{this.isSessionSupported(e).then(s=>{if(!s){r(new DOMException("The requested XRSession mode is not supported.","NotSupportedError"));return}if(this[Do].activeSession){r(new DOMException("An active XRSession already exists.","InvalidStateError"));return}const{requiredFeatures:o=[],optionalFeatures:a=[]}=t,{supportedFeatures:l}=this[Do].device;if(!o.every(p=>l.includes(p))){r(new Error("One or more required features are not supported by the device."));return}const u=a.filter(p=>l.includes(p)),f=Array.from(new Set([...o,...u,ct.Viewer,ct.Local])),h=new ny(this[Do].device,e,f);this[Do].activeSession=h,h.addEventListener("end",()=>{this[Do].activeSession=void 0}),i(h)}).catch(r)})}}const vt=Symbol("@immersive-web-emulation-runtime/action-player");class fN{constructor(e,t,i){const{schema:r,frames:s}=t;if(!s||!r||s.length===0)throw new DOMException("wrong recording format","NotSupportedError");const o=new gl(In.Viewer,e),a={[Xt.Left]:new ti(o),[Xt.Right]:new ti(o),[Xt.None]:new ti(o)};this[vt]={refSpace:e,inputSources:new Map,inputSchemas:new Map,frames:s,recordedFramePointer:0,startingTimeStamp:s[0][0],endingTimeStamp:s[s.length-1][0],playbackTime:s[0][0],playing:!1,viewerSpace:o,viewSpaces:a,vec3:Ji(),quat:zr()},Zf(this[vt].viewSpaces[Xt.Left][wn].offsetMatrix,Fr(-i/2,0,0)),Zf(this[vt].viewSpaces[Xt.Right][wn].offsetMatrix,Fr(i/2,0,0)),r.forEach(l=>{const c=l[0],u=l[1];let f;if(u.hasGamepad){const _=[];for(let d=0;d{p.set(_,new ty(_,h))}));const g=new Zm(u.handedness,u.targetRayMode,u.profiles,h,f,u.hasGrip?new ti(e):void 0,u.hasHand?p:void 0);this[vt].inputSources.set(c,{active:!1,source:g}),this[vt].inputSchemas.set(c,u)})}play(){this[vt].recordedFramePointer=0,this[vt].playbackTime=this[vt].startingTimeStamp,this[vt].playing=!0,this[vt].actualTimeStamp=performance.now()}stop(){this[vt].playing=!1}get playing(){return this[vt].playing}get viewerSpace(){return this[vt].viewerSpace}get viewSpaces(){return this[vt].viewSpaces}get inputSources(){return Array.from(this[vt].inputSources.values()).filter(e=>e.active).map(e=>e.source)}playFrame(){const e=performance.now(),t=e-this[vt].actualTimeStamp;if(this[vt].actualTimeStamp=e,this[vt].playbackTime+=t,this[vt].playbackTime>this[vt].endingTimeStamp){this.stop();return}for(;this[vt].frames[this[vt].recordedFramePointer+1][0]{l.active=!1}),a.forEach((l,c)=>{this[vt].inputSources.get(c).active=!0;const u=this[vt].inputSources.get(c).source,f=this[vt].inputSchemas.get(c);this.updateInputSource(u,f,o.has(c)?o.get(c):l,l,s)})}updateInputSource(e,t,i,r,s){if(this.updateXRSpaceFromMergedFrames(e.targetRaySpace,i.targetRayTransform,r.targetRayTransform,s),t.hasGrip&&this.updateXRSpaceFromMergedFrames(e.gripSpace,i.gripTransform,r.gripTransform,s),t.hasHand)for(let o=0;o<25;o++){const a=i.handTransforms.slice(o*8,o*8+7),l=r.handTransforms.slice(o*8,o*8+7),c=i.handTransforms[o*8+7],u=r.handTransforms[o*8+7],f=e.hand.get(t.jointSequence[o]);this.updateXRSpaceFromMergedFrames(f,a,l,s),f[ll].radius=(u-c)*s+c}if(t.hasGamepad){const o=e.gamepad;r.buttons.forEach((a,l)=>{const c=o.buttons[l];c[et].pressed=a[0]===1,c[et].touched=a[1]===1;const u=i.buttons[l][2],f=a[2];c[et].value=(f-u)*s+u}),r.axes.forEach((a,l)=>{const c=i.axes[l];o[et].axesMap[l.toString()].x=(a-c)*s+c})}}updateXRSpaceFromMergedFrames(e,t,i,r){const s=Fr(t[0],t[1],t[2]),o=tm(t[3],t[4],t[5],t[6]),a=Fr(i[0],i[1],i[2]),l=tm(i[3],i[4],i[5],i[6]);wv(this[vt].vec3,s,a,r),If(this[vt].quat,o,l,r),Rd(e[wn].offsetMatrix,this[vt].quat,this[vt].vec3)}processRawInputData(e){const t=e[0],i=this[vt].inputSchemas.get(t),s={targetRayTransform:e.slice(1,8)};let o=8;if(i.hasGrip&&(s.gripTransform=e[o++]),i.hasHand&&(s.handTransforms=e[o++]),i.hasGamepad){const a=e[o];s.buttons=a.slice(0,i.numButtons),s.axes=a.slice(i.numButtons)}return{index:t,inputData:s}}}const dN="1.0.4";class R2 extends Event{constructor(e,t){if(super(e,t),!t.referenceSpace)throw new Error("XRReferenceSpaceEventInit.referenceSpace is required");this.referenceSpace=t.referenceSpace,this.transform=t.transform}}const ju=Symbol("@immersive-web-emulation-runtime/xr-viewport");class vh{constructor(e,t,i,r){this[ju]={x:e,y:t,width:i,height:r}}get x(){return this[ju].x}get y(){return this[ju].y}get width(){return this[ju].width}get height(){return this[ju].height}}var ct;(function(n){n.Viewer="viewer",n.Local="local",n.LocalFloor="local-floor",n.BoundedFloor="bounded-floor",n.Unbounded="unbounded",n.DomOverlay="dom-overlay",n.Anchors="anchors",n.PlaneDetection="plane-detection",n.MeshDetection="mesh-detection",n.HitTest="hit-test",n.HandTracking="hand-tracking",n.DepthSensing="depth-sensing"})(ct||(ct={}));const Fe=Symbol("@immersive-web-emulation-runtime/xr-device"),qu={ipd:.063,fovy:Math.PI/2,headsetPosition:new al(0,1.6,0),headsetQuaternion:new Df,stereoEnabled:!1};class hN{constructor(e,t={}){var i,r,s,o,a,l;const c=new J8,u=new gl(In.Viewer,c),f={[Xt.Left]:new ti(u),[Xt.Right]:new ti(u),[Xt.None]:new ti(u)},h=e.controllerConfig,p={};h&&Object.values(Wi).forEach(m=>{h.layout[m]&&(p[m]=new nN(h,m,c))});const g={[Wi.Left]:new A2(m2,Wi.Left,c),[Wi.Right]:new A2(m2,Wi.Right,c)},_=(i=t.canvasContainer)!==null&&i!==void 0?i:document.createElement("div");_.dataset.webxr_runtime=`Immersive Web Emulation Runtime v${dN}`,_.style.position="fixed",_.style.width="100%",_.style.height="100%",_.style.top="0",_.style.left="0",_.style.display="flex",_.style.justifyContent="center",_.style.alignItems="center",_.style.overflow="hidden",_.style.zIndex="999",this[Fe]={name:e.name,supportedSessionModes:e.supportedSessionModes,supportedFeatures:e.supportedFeatures,supportedFrameRates:e.supportedFrameRates,isSystemKeyboardSupported:e.isSystemKeyboardSupported,internalNominalFrameRate:e.internalNominalFrameRate,environmentBlendModes:e.environmentBlendModes,interactionMode:e.interactionMode,userAgent:e.userAgent,position:(r=t.headsetPosition)!==null&&r!==void 0?r:qu.headsetPosition.clone(),quaternion:(s=t.headsetQuaternion)!==null&&s!==void 0?s:qu.headsetQuaternion.clone(),stereoEnabled:(o=t.stereoEnabled)!==null&&o!==void 0?o:qu.stereoEnabled,ipd:(a=t.ipd)!==null&&a!==void 0?a:qu.ipd,fovy:(l=t.fovy)!==null&&l!==void 0?l:qu.fovy,controllers:p,hands:g,primaryInputMode:"controller",pendingReferenceSpaceReset:!1,visibilityState:mc.Visible,pendingVisibilityState:null,xrSystem:null,matrix:Ci(),globalSpace:c,viewerSpace:u,viewSpaces:f,canvasContainer:_,getViewport:(m,d)=>{const x=m.context.canvas,{width:v,height:y}=x;switch(d.eye){case Xt.None:return new vh(0,0,v,y);case Xt.Left:return new vh(0,0,this[Fe].stereoEnabled?v/2:v,y);case Xt.Right:return new vh(v/2,0,this[Fe].stereoEnabled?v/2:0,y)}},updateViews:()=>{const m=this[Fe].viewerSpace;Rd(m[wn].offsetMatrix,this[Fe].quaternion.quat,this[Fe].position.vec3),Zf(this[Fe].viewSpaces[Xt.Left][wn].offsetMatrix,Fr(-this[Fe].ipd/2,0,0)),Zf(this[Fe].viewSpaces[Xt.Right][wn].offsetMatrix,Fr(this[Fe].ipd/2,0,0))},onBaseLayerSet:m=>{if(!m)return;const d=m.context.canvas;d.parentElement!==this[Fe].canvasContainer&&(this[Fe].canvasData={canvas:d,parent:d.parentElement,width:d.width,height:d.height},this[Fe].canvasContainer.appendChild(d),document.body.appendChild(this[Fe].canvasContainer)),d.width=window.innerWidth,d.height=window.innerHeight},onSessionEnd:()=>{if(this[Fe].canvasData){const{canvas:m,parent:d,width:x,height:v}=this[Fe].canvasData;m.width=x,m.height=v,d?d.appendChild(m):this[Fe].canvasContainer.removeChild(m),document.body.removeChild(this[Fe].canvasContainer),window.dispatchEvent(new Event("resize"))}},onFrameStart:m=>{var d;if(!((d=this[Fe].actionPlayer)===null||d===void 0)&&d.playing)this[Fe].actionPlayer.playFrame();else{const x=m.session;this[Fe].updateViews(),this[Fe].pendingVisibilityState&&(this[Fe].visibilityState=this[Fe].pendingVisibilityState,this[Fe].pendingVisibilityState=null,x.dispatchEvent(new sm("visibilitychange",{session:x}))),this[Fe].visibilityState===mc.Visible&&this.activeInputs.forEach(v=>{v.onFrameStart(m)}),this[Fe].pendingReferenceSpaceReset&&(x[_e].referenceSpaces.forEach(v=>{switch(v[Oo].type){case In.Local:case In.LocalFloor:case In.BoundedFloor:case In.Unbounded:v.dispatchEvent(new R2("reset",{referenceSpace:v}));break}}),this[Fe].pendingReferenceSpaceReset=!1)}this[Fe].updateViews()}},this[Fe].updateViews()}installRuntime(e=globalThis){Object.defineProperty(WebGL2RenderingContext.prototype,"makeXRCompatible",{value:function(){return new Promise((t,i)=>{t(!0)})},configurable:!0}),this[Fe].xrSystem=new b2(this),Object.defineProperty(globalThis.navigator,"xr",{value:this[Fe].xrSystem,configurable:!0}),Object.defineProperty(navigator,"userAgent",{value:this[Fe].userAgent,writable:!1,configurable:!1,enumerable:!0}),e.XRSystem=b2,e.XRSession=ny,e.XRRenderState=Tv,e.XRFrame=dA,e.XRSpace=ti,e.XRReferenceSpace=gl,e.XRJointSpace=ty,e.XRView=cA,e.XRViewport=vh,e.XRRigidTransform=Jm,e.XRPose=Qm,e.XRViewerPose=fA,e.XRJointPose=uA,e.XRInputSource=Zm,e.XRInputSourceArray=tN,e.XRHand=iy,e.XRLayer=mA,e.XRWebGLLayer=rN,e.XRSessionEvent=sm,e.XRInputSourceEvent=Ep,e.XRInputSourcesChangeEvent=hA,e.XRReferenceSpaceEvent=R2}get supportedSessionModes(){return this[Fe].supportedSessionModes}get supportedFeatures(){return this[Fe].supportedFeatures}get supportedFrameRates(){return this[Fe].supportedFrameRates}get isSystemKeyboardSupported(){return this[Fe].isSystemKeyboardSupported}get internalNominalFrameRate(){return this[Fe].internalNominalFrameRate}get stereoEnabled(){return this[Fe].stereoEnabled}set stereoEnabled(e){this[Fe].stereoEnabled=e}get ipd(){return this[Fe].ipd}set ipd(e){this[Fe].ipd=e}get fovy(){return this[Fe].fovy}set fovy(e){this[Fe].fovy=e}get position(){return this[Fe].position}get quaternion(){return this[Fe].quaternion}get viewerSpace(){var e;return!((e=this[Fe].actionPlayer)===null||e===void 0)&&e.playing?this[Fe].actionPlayer.viewerSpace:this[Fe].viewerSpace}get viewSpaces(){var e;return!((e=this[Fe].actionPlayer)===null||e===void 0)&&e.playing?this[Fe].actionPlayer.viewSpaces:this[Fe].viewSpaces}get controllers(){return this[Fe].controllers}get hands(){return this[Fe].hands}get primaryInputMode(){return this[Fe].primaryInputMode}set primaryInputMode(e){if(e!=="controller"&&e!=="hand"){console.warn('primary input mode can only be "controller" or "hand"');return}this[Fe].primaryInputMode=e}get activeInputs(){return this[Fe].visibilityState!==mc.Visible?[]:(this[Fe].primaryInputMode==="controller"?Object.values(this[Fe].controllers):Object.values(this[Fe].hands)).filter(t=>t.connected)}get inputSources(){var e;return!((e=this[Fe].actionPlayer)===null||e===void 0)&&e.playing?this[Fe].actionPlayer.inputSources:this.activeInputs.map(t=>t.inputSource)}get canvasContainer(){return this[Fe].canvasContainer}get activeSession(){var e;return(e=this[Fe].xrSystem)===null||e===void 0?void 0:e[Do].activeSession}recenter(){const e=new al(-this.position.x,0,-this.position.z),t=new al(0,0,-1).applyQuaternion(this.quaternion);t.y=0,t.normalize();const i=Math.atan2(t.x,-t.z),r=new Df().setFromAxisAngle(new al(0,1,0),i);this.position.add(e),this.quaternion.multiply(r),[...Object.values(this[Fe].controllers),...Object.values(this[Fe].hands)].forEach(s=>{s.position.add(e),s.quaternion.multiply(r),s.position.applyQuaternion(r)}),this[Fe].pendingReferenceSpaceReset=!0}get visibilityState(){return this[Fe].visibilityState}updateVisibilityState(e){if(!Object.values(mc).includes(e))throw new DOMException("Invalid XRVisibilityState value","NotSupportedError");e!==this[Fe].visibilityState&&(this[Fe].pendingVisibilityState=e)}createActionPlayer(e,t){return this[Fe].actionPlayer=new fN(e,t,this[Fe].ipd),this[Fe].actionPlayer}}const e0={mapping:Jf.XRStandard,buttons:[{id:"trigger",type:"analog",eventTrigger:"select"},{id:"squeeze",type:"analog",eventTrigger:"squeeze"},null,{id:"thumbstick",type:"binary"},{id:"x-button",type:"binary"},{id:"y-button",type:"binary"},{id:"thumbrest",type:"binary"}],axes:[null,null,{id:"thumbstick",type:"x-axis"},{id:"thumbstick",type:"y-axis"}]},t0={mapping:Jf.XRStandard,buttons:[{id:"trigger",type:"analog",eventTrigger:"select"},{id:"squeeze",type:"analog",eventTrigger:"squeeze"},null,{id:"thumbstick",type:"binary"},{id:"a-button",type:"binary"},{id:"b-button",type:"binary"},{id:"thumbrest",type:"binary"}],axes:[null,null,{id:"thumbstick",type:"x-axis"},{id:"thumbstick",type:"y-axis"}]},pN={profileId:"oculus-touch-v2",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:e0,gripOffsetMatrix:[.9925461411476135,4673031295254759e-24,-.12186938524246216,0,.08617470413446426,.7071065306663513,.7018362283706665,0,.0861746296286583,-.70710688829422,.7018358707427979,0,-.003979847766458988,-.01585787907242775,.04964185878634453,1],numHapticActuators:1},right:{gamepad:t0,gripOffsetMatrix:[.9925461411476135,3688163374704345e-23,.12186937034130096,0,-.08617469668388367,.7071066498756409,.7018361687660217,0,-.0861746147274971,-.7071068286895752,.7018359899520874,0,.003979853354394436,-.01585787907242775,.04964182525873184,1],numHapticActuators:1}}},mN={profileId:"oculus-touch-v3",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:e0,gripOffsetMatrix:[.9925461411476135,20823669899527886e-24,-.12186937034130096,0,.08617465198040009,.7071067094802856,.701836109161377,0,.08617466688156128,-.7071067690849304,.7018360495567322,0,-.003979838453233242,-.015857907012104988,.04964181408286095,1],numHapticActuators:1},right:{gamepad:t0,gripOffsetMatrix:[.9925461411476135,-8329467959811154e-23,.12186941504478455,0,-.08617465943098068,.7071066498756409,.7018361687660217,0,-.08617471158504486,-.7071068286895752,.7018359303474426,0,.003979798872023821,-.015857888385653496,.049641866236925125,1],numHapticActuators:1}}},gN={profileId:"meta-quest-touch-pro",fallbackProfileIds:["oculus-touch-v2","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:e0,gripOffsetMatrix:[.9925461411476135,-15779937356796836e-24,-.12186935544013977,0,.08617467433214188,.7071067094802856,.701836109161377,0,.0861746296286583,-.7071067690849304,.7018360495567322,0,-.003979836590588093,-.015857847407460213,.049641840159893036,1],numHapticActuators:3},right:{gamepad:t0,gripOffsetMatrix:[.9925461411476135,9267653311439972e-26,.12186937034130096,0,-.08617467433214188,.7071067094802856,.7018361687660217,0,-.08617464452981949,-.7071067690849304,.7018360495567322,0,.003979847766458988,-.01585782691836357,.04964186251163483,1],numHapticActuators:3}}},_N={profileId:"meta-quest-touch-plus",fallbackProfileIds:["oculus-touch-v3","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:e0,gripOffsetMatrix:[.9925461411476135,10736208366779465e-24,-.12186933308839798,0,.08617459982633591,.70710688829422,.7018360495567322,0,.08617466688156128,-.7071067094802856,.7018362283706665,0,-.003979803062975407,-.015857873484492302,.04964187368750572,1],numHapticActuators:1},right:{gamepad:t0,gripOffsetMatrix:[.9925461411476135,-26238110351073374e-24,.12186934053897858,0,-.0861746147274971,.7071067690849304,.7018360495567322,0,-.08617465943098068,-.7071067094802856,.701836109161377,0,.003979838453233242,-.015857869759202003,.04964182525873184,1],numHapticActuators:1}}};Ot.Inline,Ot.ImmersiveVR,Ot.ImmersiveAR,ct.Viewer,ct.Local,ct.LocalFloor,ct.BoundedFloor,ct.Unbounded,ct.Anchors,ct.PlaneDetection,ct.HandTracking,Ot.ImmersiveVR+"",$r.Opaque,Ot.ImmersiveAR+"",$r.AlphaBlend,su.WorldSpace;Ot.Inline,Ot.ImmersiveVR,Ot.ImmersiveAR,ct.Viewer,ct.Local,ct.LocalFloor,ct.BoundedFloor,ct.Unbounded,ct.Anchors,ct.PlaneDetection,ct.MeshDetection,ct.HitTest,ct.HandTracking,Ot.ImmersiveVR+"",$r.Opaque,Ot.ImmersiveAR+"",$r.AlphaBlend,su.WorldSpace;Ot.Inline,Ot.ImmersiveVR,Ot.ImmersiveAR,ct.Viewer,ct.Local,ct.LocalFloor,ct.BoundedFloor,ct.Unbounded,ct.Anchors,ct.PlaneDetection,ct.MeshDetection,ct.HitTest,ct.HandTracking,Ot.ImmersiveVR+"",$r.Opaque,Ot.ImmersiveAR+"",$r.AlphaBlend,su.WorldSpace;const vN={name:"Meta Quest 3",controllerConfig:_N,supportedSessionModes:[Ot.Inline,Ot.ImmersiveVR,Ot.ImmersiveAR],supportedFeatures:[ct.Viewer,ct.Local,ct.LocalFloor,ct.BoundedFloor,ct.Unbounded,ct.Anchors,ct.PlaneDetection,ct.MeshDetection,ct.HitTest,ct.HandTracking,ct.DepthSensing],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,environmentBlendModes:{[Ot.ImmersiveVR]:$r.Opaque,[Ot.ImmersiveAR]:$r.AlphaBlend},interactionMode:su.WorldSpace,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 3) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"};function gA(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var _A={exports:{}},n0={},vA={exports:{}},Et={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Cd=Symbol.for("react.element"),xN=Symbol.for("react.portal"),yN=Symbol.for("react.fragment"),SN=Symbol.for("react.strict_mode"),MN=Symbol.for("react.profiler"),EN=Symbol.for("react.provider"),wN=Symbol.for("react.context"),TN=Symbol.for("react.forward_ref"),AN=Symbol.for("react.suspense"),bN=Symbol.for("react.memo"),RN=Symbol.for("react.lazy"),C2=Symbol.iterator;function CN(n){return n===null||typeof n!="object"?null:(n=C2&&n[C2]||n["@@iterator"],typeof n=="function"?n:null)}var xA={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},yA=Object.assign,SA={};function Cu(n,e,t){this.props=n,this.context=e,this.refs=SA,this.updater=t||xA}Cu.prototype.isReactComponent={};Cu.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};Cu.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function MA(){}MA.prototype=Cu.prototype;function ry(n,e,t){this.props=n,this.context=e,this.refs=SA,this.updater=t||xA}var sy=ry.prototype=new MA;sy.constructor=ry;yA(sy,Cu.prototype);sy.isPureReactComponent=!0;var P2=Array.isArray,EA=Object.prototype.hasOwnProperty,oy={current:null},wA={key:!0,ref:!0,__self:!0,__source:!0};function TA(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)EA.call(e,i)&&!wA.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1{};let ly={},RA={},CA=null,PA={mark:I2,measure:I2};try{typeof window<"u"&&(ly=window),typeof document<"u"&&(RA=document),typeof MutationObserver<"u"&&(CA=MutationObserver),typeof performance<"u"&&(PA=performance)}catch{}const{userAgent:D2=""}=ly.navigator||{},ua=ly,jt=RA,N2=CA,yh=PA;ua.document;const ao=!!jt.documentElement&&!!jt.head&&typeof jt.addEventListener=="function"&&typeof jt.createElement=="function",LA=~D2.indexOf("MSIE")||~D2.indexOf("Trident/");var en="classic",IA="duotone",ji="sharp",qi="sharp-duotone",zN=[en,IA,ji,qi],HN={classic:{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},sharp:{900:"fass",400:"fasr",300:"fasl",100:"fast"},"sharp-duotone":{900:"fasds"}},U2={kit:{fak:"kit","fa-kit":"kit"},"kit-duotone":{fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"}},VN=["kit"],GN=/fa(s|r|l|t|d|b|k|kd|ss|sr|sl|st|sds)?[\-\ ]/,WN=/Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit)?.*/i,$N={"Font Awesome 5 Free":{900:"fas",400:"far"},"Font Awesome 5 Pro":{900:"fas",400:"far",normal:"far",300:"fal"},"Font Awesome 5 Brands":{400:"fab",normal:"fab"},"Font Awesome 5 Duotone":{900:"fad"}},XN={"Font Awesome 6 Free":{900:"fas",400:"far"},"Font Awesome 6 Pro":{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},"Font Awesome 6 Brands":{400:"fab",normal:"fab"},"Font Awesome 6 Duotone":{900:"fad"},"Font Awesome 6 Sharp":{900:"fass",400:"fasr",normal:"fasr",300:"fasl",100:"fast"},"Font Awesome 6 Sharp Duotone":{900:"fasds"}},jN={classic:{"fa-brands":"fab","fa-duotone":"fad","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"},sharp:{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"},"sharp-duotone":{"fa-solid":"fasds"}},qN={classic:["fas","far","fal","fat"],sharp:["fass","fasr","fasl","fast"],"sharp-duotone":["fasds"]},YN={classic:{fab:"fa-brands",fad:"fa-duotone",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"},sharp:{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"},"sharp-duotone":{fasds:"fa-solid"}},KN={classic:{solid:"fas",regular:"far",light:"fal",thin:"fat",duotone:"fad",brands:"fab"},sharp:{solid:"fass",regular:"fasr",light:"fasl",thin:"fast"},"sharp-duotone":{solid:"fasds"}},DA={classic:{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fad:"duotone","fa-duotone":"duotone",fab:"brands","fa-brands":"brands"},sharp:{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"},"sharp-duotone":{fa:"solid",fasds:"solid","fa-solid":"solid"}},ZN=["solid","regular","light","thin","duotone","brands"],NA=[1,2,3,4,5,6,7,8,9,10],QN=NA.concat([11,12,13,14,15,16,17,18,19,20]),vf={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},JN=[...Object.keys(qN),...ZN,"2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","fw","inverse","layers-counter","layers-text","layers","li","pull-left","pull-right","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul",vf.GROUP,vf.SWAP_OPACITY,vf.PRIMARY,vf.SECONDARY].concat(NA.map(n=>"".concat(n,"x"))).concat(QN.map(n=>"w-".concat(n))),eU={"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}},tU={kit:{"fa-kit":"fak"},"kit-duotone":{"fa-kit-duotone":"fakd"}},nU={kit:{fak:"fa-kit"},"kit-duotone":{fakd:"fa-kit-duotone"}},O2={kit:{kit:"fak"},"kit-duotone":{"kit-duotone":"fakd"}};const Qs="___FONT_AWESOME___",Av=16,UA="fa",OA="svg-inline--fa",vl="data-fa-i2svg",bv="data-fa-pseudo-element",iU="data-fa-pseudo-element-pending",cy="data-prefix",uy="data-icon",F2="fontawesome-i2svg",rU="async",sU=["HTML","HEAD","STYLE","SCRIPT"],FA=(()=>{try{return!0}catch{return!1}})(),kA=[en,ji,qi];function Pd(n){return new Proxy(n,{get(e,t){return t in e?e[t]:e[en]}})}const BA={...DA};BA[en]={...DA[en],...U2.kit,...U2["kit-duotone"]};const cl=Pd(BA),Rv={...KN};Rv[en]={...Rv[en],...O2.kit,...O2["kit-duotone"]};const td=Pd(Rv),Cv={...YN};Cv[en]={...Cv[en],...nU.kit};const ul=Pd(Cv),Pv={...jN};Pv[en]={...Pv[en],...tU.kit};const oU=Pd(Pv),aU=GN,zA="fa-layers-text",lU=WN,cU={...HN};Pd(cU);const uU=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],gg=vf,ou=new Set;Object.keys(td[en]).map(ou.add.bind(ou));Object.keys(td[ji]).map(ou.add.bind(ou));Object.keys(td[qi]).map(ou.add.bind(ou));const fU=[...VN,...JN],Nf=ua.FontAwesomeConfig||{};function dU(n){var e=jt.querySelector("script["+n+"]");if(e)return e.getAttribute(n)}function hU(n){return n===""?!0:n==="false"?!1:n==="true"?!0:n}jt&&typeof jt.querySelector=="function"&&[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-auto-a11y","autoA11y"],["data-search-pseudo-elements","searchPseudoElements"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]].forEach(e=>{let[t,i]=e;const r=hU(dU(t));r!=null&&(Nf[i]=r)});const HA={styleDefault:"solid",familyDefault:"classic",cssPrefix:UA,replacementClass:OA,autoReplaceSvg:!0,autoAddCss:!0,autoA11y:!0,searchPseudoElements:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};Nf.familyPrefix&&(Nf.cssPrefix=Nf.familyPrefix);const au={...HA,...Nf};au.autoReplaceSvg||(au.observeMutations=!1);const Ke={};Object.keys(HA).forEach(n=>{Object.defineProperty(Ke,n,{enumerable:!0,set:function(e){au[n]=e,Uf.forEach(t=>t(Ke))},get:function(){return au[n]}})});Object.defineProperty(Ke,"familyPrefix",{enumerable:!0,set:function(n){au.cssPrefix=n,Uf.forEach(e=>e(Ke))},get:function(){return au.cssPrefix}});ua.FontAwesomeConfig=Ke;const Uf=[];function pU(n){return Uf.push(n),()=>{Uf.splice(Uf.indexOf(n),1)}}const So=Av,as={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function mU(n){if(!n||!ao)return;const e=jt.createElement("style");e.setAttribute("type","text/css"),e.innerHTML=n;const t=jt.head.childNodes;let i=null;for(let r=t.length-1;r>-1;r--){const s=t[r],o=(s.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(o)>-1&&(i=s)}return jt.head.insertBefore(e,i),n}const gU="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function nd(){let n=12,e="";for(;n-- >0;)e+=gU[Math.random()*62|0];return e}function Pu(n){const e=[];for(let t=(n||[]).length>>>0;t--;)e[t]=n[t];return e}function fy(n){return n.classList?Pu(n.classList):(n.getAttribute("class")||"").split(" ").filter(e=>e)}function VA(n){return"".concat(n).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function _U(n){return Object.keys(n||{}).reduce((e,t)=>e+"".concat(t,'="').concat(VA(n[t]),'" '),"").trim()}function i0(n){return Object.keys(n||{}).reduce((e,t)=>e+"".concat(t,": ").concat(n[t].trim(),";"),"")}function dy(n){return n.size!==as.size||n.x!==as.x||n.y!==as.y||n.rotate!==as.rotate||n.flipX||n.flipY}function vU(n){let{transform:e,containerWidth:t,iconWidth:i}=n;const r={transform:"translate(".concat(t/2," 256)")},s="translate(".concat(e.x*32,", ").concat(e.y*32,") "),o="scale(".concat(e.size/16*(e.flipX?-1:1),", ").concat(e.size/16*(e.flipY?-1:1),") "),a="rotate(".concat(e.rotate," 0 0)"),l={transform:"".concat(s," ").concat(o," ").concat(a)},c={transform:"translate(".concat(i/2*-1," -256)")};return{outer:r,inner:l,path:c}}function xU(n){let{transform:e,width:t=Av,height:i=Av,startCentered:r=!1}=n,s="";return r&&LA?s+="translate(".concat(e.x/So-t/2,"em, ").concat(e.y/So-i/2,"em) "):r?s+="translate(calc(-50% + ".concat(e.x/So,"em), calc(-50% + ").concat(e.y/So,"em)) "):s+="translate(".concat(e.x/So,"em, ").concat(e.y/So,"em) "),s+="scale(".concat(e.size/So*(e.flipX?-1:1),", ").concat(e.size/So*(e.flipY?-1:1),") "),s+="rotate(".concat(e.rotate,"deg) "),s}var yU=`:root, :host { + --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Free"; + --fa-font-regular: normal 400 1em/1 "Font Awesome 6 Free"; + --fa-font-light: normal 300 1em/1 "Font Awesome 6 Pro"; + --fa-font-thin: normal 100 1em/1 "Font Awesome 6 Pro"; + --fa-font-duotone: normal 900 1em/1 "Font Awesome 6 Duotone"; + --fa-font-brands: normal 400 1em/1 "Font Awesome 6 Brands"; + --fa-font-sharp-solid: normal 900 1em/1 "Font Awesome 6 Sharp"; + --fa-font-sharp-regular: normal 400 1em/1 "Font Awesome 6 Sharp"; + --fa-font-sharp-light: normal 300 1em/1 "Font Awesome 6 Sharp"; + --fa-font-sharp-thin: normal 100 1em/1 "Font Awesome 6 Sharp"; + --fa-font-sharp-duotone-solid: normal 900 1em/1 "Font Awesome 6 Sharp Duotone"; +} + +svg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa { + overflow: visible; + box-sizing: content-box; +} + +.svg-inline--fa { + display: var(--fa-display, inline-block); + height: 1em; + overflow: visible; + vertical-align: -0.125em; +} +.svg-inline--fa.fa-2xs { + vertical-align: 0.1em; +} +.svg-inline--fa.fa-xs { + vertical-align: 0em; +} +.svg-inline--fa.fa-sm { + vertical-align: -0.0714285705em; +} +.svg-inline--fa.fa-lg { + vertical-align: -0.2em; +} +.svg-inline--fa.fa-xl { + vertical-align: -0.25em; +} +.svg-inline--fa.fa-2xl { + vertical-align: -0.3125em; +} +.svg-inline--fa.fa-pull-left { + margin-right: var(--fa-pull-margin, 0.3em); + width: auto; +} +.svg-inline--fa.fa-pull-right { + margin-left: var(--fa-pull-margin, 0.3em); + width: auto; +} +.svg-inline--fa.fa-li { + width: var(--fa-li-width, 2em); + top: 0.25em; +} +.svg-inline--fa.fa-fw { + width: var(--fa-fw-width, 1.25em); +} + +.fa-layers svg.svg-inline--fa { + bottom: 0; + left: 0; + margin: auto; + position: absolute; + right: 0; + top: 0; +} + +.fa-layers-counter, .fa-layers-text { + display: inline-block; + position: absolute; + text-align: center; +} + +.fa-layers { + display: inline-block; + height: 1em; + position: relative; + text-align: center; + vertical-align: -0.125em; + width: 1em; +} +.fa-layers svg.svg-inline--fa { + transform-origin: center center; +} + +.fa-layers-text { + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + transform-origin: center center; +} + +.fa-layers-counter { + background-color: var(--fa-counter-background-color, #ff253a); + border-radius: var(--fa-counter-border-radius, 1em); + box-sizing: border-box; + color: var(--fa-inverse, #fff); + line-height: var(--fa-counter-line-height, 1); + max-width: var(--fa-counter-max-width, 5em); + min-width: var(--fa-counter-min-width, 1.5em); + overflow: hidden; + padding: var(--fa-counter-padding, 0.25em 0.5em); + right: var(--fa-right, 0); + text-overflow: ellipsis; + top: var(--fa-top, 0); + transform: scale(var(--fa-counter-scale, 0.25)); + transform-origin: top right; +} + +.fa-layers-bottom-right { + bottom: var(--fa-bottom, 0); + right: var(--fa-right, 0); + top: auto; + transform: scale(var(--fa-layers-scale, 0.25)); + transform-origin: bottom right; +} + +.fa-layers-bottom-left { + bottom: var(--fa-bottom, 0); + left: var(--fa-left, 0); + right: auto; + top: auto; + transform: scale(var(--fa-layers-scale, 0.25)); + transform-origin: bottom left; +} + +.fa-layers-top-right { + top: var(--fa-top, 0); + right: var(--fa-right, 0); + transform: scale(var(--fa-layers-scale, 0.25)); + transform-origin: top right; +} + +.fa-layers-top-left { + left: var(--fa-left, 0); + right: auto; + top: var(--fa-top, 0); + transform: scale(var(--fa-layers-scale, 0.25)); + transform-origin: top left; +} + +.fa-1x { + font-size: 1em; +} + +.fa-2x { + font-size: 2em; +} + +.fa-3x { + font-size: 3em; +} + +.fa-4x { + font-size: 4em; +} + +.fa-5x { + font-size: 5em; +} + +.fa-6x { + font-size: 6em; +} + +.fa-7x { + font-size: 7em; +} + +.fa-8x { + font-size: 8em; +} + +.fa-9x { + font-size: 9em; +} + +.fa-10x { + font-size: 10em; +} + +.fa-2xs { + font-size: 0.625em; + line-height: 0.1em; + vertical-align: 0.225em; +} + +.fa-xs { + font-size: 0.75em; + line-height: 0.0833333337em; + vertical-align: 0.125em; +} + +.fa-sm { + font-size: 0.875em; + line-height: 0.0714285718em; + vertical-align: 0.0535714295em; +} + +.fa-lg { + font-size: 1.25em; + line-height: 0.05em; + vertical-align: -0.075em; +} + +.fa-xl { + font-size: 1.5em; + line-height: 0.0416666682em; + vertical-align: -0.125em; +} + +.fa-2xl { + font-size: 2em; + line-height: 0.03125em; + vertical-align: -0.1875em; +} + +.fa-fw { + text-align: center; + width: 1.25em; +} + +.fa-ul { + list-style-type: none; + margin-left: var(--fa-li-margin, 2.5em); + padding-left: 0; +} +.fa-ul > li { + position: relative; +} + +.fa-li { + left: calc(-1 * var(--fa-li-width, 2em)); + position: absolute; + text-align: center; + width: var(--fa-li-width, 2em); + line-height: inherit; +} + +.fa-border { + border-color: var(--fa-border-color, #eee); + border-radius: var(--fa-border-radius, 0.1em); + border-style: var(--fa-border-style, solid); + border-width: var(--fa-border-width, 0.08em); + padding: var(--fa-border-padding, 0.2em 0.25em 0.15em); +} + +.fa-pull-left { + float: left; + margin-right: var(--fa-pull-margin, 0.3em); +} + +.fa-pull-right { + float: right; + margin-left: var(--fa-pull-margin, 0.3em); +} + +.fa-beat { + animation-name: fa-beat; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-in-out); +} + +.fa-bounce { + animation-name: fa-bounce; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1)); +} + +.fa-fade { + animation-name: fa-fade; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1)); +} + +.fa-beat-fade { + animation-name: fa-beat-fade; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1)); +} + +.fa-flip { + animation-name: fa-flip; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, ease-in-out); +} + +.fa-shake { + animation-name: fa-shake; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, linear); +} + +.fa-spin { + animation-name: fa-spin; + animation-delay: var(--fa-animation-delay, 0s); + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 2s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, linear); +} + +.fa-spin-reverse { + --fa-animation-direction: reverse; +} + +.fa-pulse, +.fa-spin-pulse { + animation-name: fa-spin; + animation-direction: var(--fa-animation-direction, normal); + animation-duration: var(--fa-animation-duration, 1s); + animation-iteration-count: var(--fa-animation-iteration-count, infinite); + animation-timing-function: var(--fa-animation-timing, steps(8)); +} + +@media (prefers-reduced-motion: reduce) { + .fa-beat, +.fa-bounce, +.fa-fade, +.fa-beat-fade, +.fa-flip, +.fa-pulse, +.fa-shake, +.fa-spin, +.fa-spin-pulse { + animation-delay: -1ms; + animation-duration: 1ms; + animation-iteration-count: 1; + transition-delay: 0s; + transition-duration: 0s; + } +} +@keyframes fa-beat { + 0%, 90% { + transform: scale(1); + } + 45% { + transform: scale(var(--fa-beat-scale, 1.25)); + } +} +@keyframes fa-bounce { + 0% { + transform: scale(1, 1) translateY(0); + } + 10% { + transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0); + } + 30% { + transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em)); + } + 50% { + transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0); + } + 57% { + transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em)); + } + 64% { + transform: scale(1, 1) translateY(0); + } + 100% { + transform: scale(1, 1) translateY(0); + } +} +@keyframes fa-fade { + 50% { + opacity: var(--fa-fade-opacity, 0.4); + } +} +@keyframes fa-beat-fade { + 0%, 100% { + opacity: var(--fa-beat-fade-opacity, 0.4); + transform: scale(1); + } + 50% { + opacity: 1; + transform: scale(var(--fa-beat-fade-scale, 1.125)); + } +} +@keyframes fa-flip { + 50% { + transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg)); + } +} +@keyframes fa-shake { + 0% { + transform: rotate(-15deg); + } + 4% { + transform: rotate(15deg); + } + 8%, 24% { + transform: rotate(-18deg); + } + 12%, 28% { + transform: rotate(18deg); + } + 16% { + transform: rotate(-22deg); + } + 20% { + transform: rotate(22deg); + } + 32% { + transform: rotate(-12deg); + } + 36% { + transform: rotate(12deg); + } + 40%, 100% { + transform: rotate(0deg); + } +} +@keyframes fa-spin { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} +.fa-rotate-90 { + transform: rotate(90deg); +} + +.fa-rotate-180 { + transform: rotate(180deg); +} + +.fa-rotate-270 { + transform: rotate(270deg); +} + +.fa-flip-horizontal { + transform: scale(-1, 1); +} + +.fa-flip-vertical { + transform: scale(1, -1); +} + +.fa-flip-both, +.fa-flip-horizontal.fa-flip-vertical { + transform: scale(-1, -1); +} + +.fa-rotate-by { + transform: rotate(var(--fa-rotate-angle, 0)); +} + +.fa-stack { + display: inline-block; + vertical-align: middle; + height: 2em; + position: relative; + width: 2.5em; +} + +.fa-stack-1x, +.fa-stack-2x { + bottom: 0; + left: 0; + margin: auto; + position: absolute; + right: 0; + top: 0; + z-index: var(--fa-stack-z-index, auto); +} + +.svg-inline--fa.fa-stack-1x { + height: 1em; + width: 1.25em; +} +.svg-inline--fa.fa-stack-2x { + height: 2em; + width: 2.5em; +} + +.fa-inverse { + color: var(--fa-inverse, #fff); +} + +.sr-only, +.fa-sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +.sr-only-focusable:not(:focus), +.fa-sr-only-focusable:not(:focus) { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +.svg-inline--fa .fa-primary { + fill: var(--fa-primary-color, currentColor); + opacity: var(--fa-primary-opacity, 1); +} + +.svg-inline--fa .fa-secondary { + fill: var(--fa-secondary-color, currentColor); + opacity: var(--fa-secondary-opacity, 0.4); +} + +.svg-inline--fa.fa-swap-opacity .fa-primary { + opacity: var(--fa-secondary-opacity, 0.4); +} + +.svg-inline--fa.fa-swap-opacity .fa-secondary { + opacity: var(--fa-primary-opacity, 1); +} + +.svg-inline--fa mask .fa-primary, +.svg-inline--fa mask .fa-secondary { + fill: black; +} + +.fad.fa-inverse, +.fa-duotone.fa-inverse { + color: var(--fa-inverse, #fff); +}`;function GA(){const n=UA,e=OA,t=Ke.cssPrefix,i=Ke.replacementClass;let r=yU;if(t!==n||i!==e){const s=new RegExp("\\.".concat(n,"\\-"),"g"),o=new RegExp("\\--".concat(n,"\\-"),"g"),a=new RegExp("\\.".concat(e),"g");r=r.replace(s,".".concat(t,"-")).replace(o,"--".concat(t,"-")).replace(a,".".concat(i))}return r}let k2=!1;function _g(){Ke.autoAddCss&&!k2&&(mU(GA()),k2=!0)}var SU={mixout(){return{dom:{css:GA,insertCss:_g}}},hooks(){return{beforeDOMElementCreation(){_g()},beforeI2svg(){_g()}}}};const Js=ua||{};Js[Qs]||(Js[Qs]={});Js[Qs].styles||(Js[Qs].styles={});Js[Qs].hooks||(Js[Qs].hooks={});Js[Qs].shims||(Js[Qs].shims=[]);var ls=Js[Qs];const WA=[],$A=function(){jt.removeEventListener("DOMContentLoaded",$A),om=1,WA.map(n=>n())};let om=!1;ao&&(om=(jt.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(jt.readyState),om||jt.addEventListener("DOMContentLoaded",$A));function MU(n){ao&&(om?setTimeout(n,0):WA.push(n))}function Ld(n){const{tag:e,attributes:t={},children:i=[]}=n;return typeof n=="string"?VA(n):"<".concat(e," ").concat(_U(t),">").concat(i.map(Ld).join(""),"")}function B2(n,e,t){if(n&&n[e]&&n[e][t])return{prefix:e,iconName:t,icon:n[e][t]}}var vg=function(e,t,i,r){var s=Object.keys(e),o=s.length,a=t,l,c,u;for(i===void 0?(l=1,u=e[s[0]]):(l=0,u=i);l=55296&&r<=56319&&t=55296&&i<=56319&&t>e+1&&(r=n.charCodeAt(e+1),r>=56320&&r<=57343)?(i-55296)*1024+r-56320+65536:i}function z2(n){return Object.keys(n).reduce((e,t)=>{const i=n[t];return!!i.icon?e[i.iconName]=i.icon:e[t]=i,e},{})}function Iv(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{skipHooks:i=!1}=t,r=z2(e);typeof ls.hooks.addPack=="function"&&!i?ls.hooks.addPack(n,z2(e)):ls.styles[n]={...ls.styles[n]||{},...r},n==="fas"&&Iv("fa",e)}const{styles:Za,shims:TU}=ls,AU={[en]:Object.values(ul[en]),[ji]:Object.values(ul[ji]),[qi]:Object.values(ul[qi])};let hy=null,XA={},jA={},qA={},YA={},KA={};const bU={[en]:Object.keys(cl[en]),[ji]:Object.keys(cl[ji]),[qi]:Object.keys(cl[qi])};function RU(n){return~fU.indexOf(n)}function CU(n,e){const t=e.split("-"),i=t[0],r=t.slice(1).join("-");return i===n&&r!==""&&!RU(r)?r:null}const ZA=()=>{const n=i=>vg(Za,(r,s,o)=>(r[o]=vg(s,i,{}),r),{});XA=n((i,r,s)=>(r[3]&&(i[r[3]]=s),r[2]&&r[2].filter(a=>typeof a=="number").forEach(a=>{i[a.toString(16)]=s}),i)),jA=n((i,r,s)=>(i[s]=s,r[2]&&r[2].filter(a=>typeof a=="string").forEach(a=>{i[a]=s}),i)),KA=n((i,r,s)=>{const o=r[2];return i[s]=s,o.forEach(a=>{i[a]=s}),i});const e="far"in Za||Ke.autoFetchSvg,t=vg(TU,(i,r)=>{const s=r[0];let o=r[1];const a=r[2];return o==="far"&&!e&&(o="fas"),typeof s=="string"&&(i.names[s]={prefix:o,iconName:a}),typeof s=="number"&&(i.unicodes[s.toString(16)]={prefix:o,iconName:a}),i},{names:{},unicodes:{}});qA=t.names,YA=t.unicodes,hy=r0(Ke.styleDefault,{family:Ke.familyDefault})};pU(n=>{hy=r0(n.styleDefault,{family:Ke.familyDefault})});ZA();function py(n,e){return(XA[n]||{})[e]}function PU(n,e){return(jA[n]||{})[e]}function Xo(n,e){return(KA[n]||{})[e]}function QA(n){return qA[n]||{prefix:null,iconName:null}}function LU(n){const e=YA[n],t=py("fas",n);return e||(t?{prefix:"fas",iconName:t}:null)||{prefix:null,iconName:null}}function fa(){return hy}const my=()=>({prefix:null,iconName:null,rest:[]});function r0(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{family:t=en}=e,i=cl[t][n],r=td[t][n]||td[t][i],s=n in ls.styles?n:null;return r||s||null}const IU={[en]:Object.keys(ul[en]),[ji]:Object.keys(ul[ji]),[qi]:Object.keys(ul[qi])};function s0(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{skipLookups:t=!1}=e,i={[en]:"".concat(Ke.cssPrefix,"-").concat(en),[ji]:"".concat(Ke.cssPrefix,"-").concat(ji),[qi]:"".concat(Ke.cssPrefix,"-").concat(qi)};let r=null,s=en;const o=zN.filter(l=>l!==IA);o.forEach(l=>{(n.includes(i[l])||n.some(c=>IU[l].includes(c)))&&(s=l)});const a=n.reduce((l,c)=>{const u=CU(Ke.cssPrefix,c);if(Za[c]?(c=AU[s].includes(c)?oU[s][c]:c,r=c,l.prefix=c):bU[s].indexOf(c)>-1?(r=c,l.prefix=r0(c,{family:s})):u?l.iconName=u:c!==Ke.replacementClass&&!o.some(f=>c===i[f])&&l.rest.push(c),!t&&l.prefix&&l.iconName){const f=r==="fa"?QA(l.iconName):{},h=Xo(l.prefix,l.iconName);f.prefix&&(r=null),l.iconName=f.iconName||h||l.iconName,l.prefix=f.prefix||l.prefix,l.prefix==="far"&&!Za.far&&Za.fas&&!Ke.autoFetchSvg&&(l.prefix="fas")}return l},my());return(n.includes("fa-brands")||n.includes("fab"))&&(a.prefix="fab"),(n.includes("fa-duotone")||n.includes("fad"))&&(a.prefix="fad"),!a.prefix&&s===ji&&(Za.fass||Ke.autoFetchSvg)&&(a.prefix="fass",a.iconName=Xo(a.prefix,a.iconName)||a.iconName),!a.prefix&&s===qi&&(Za.fasds||Ke.autoFetchSvg)&&(a.prefix="fasds",a.iconName=Xo(a.prefix,a.iconName)||a.iconName),(a.prefix==="fa"||r==="fa")&&(a.prefix=fa()||"fas"),a}class DU{constructor(){this.definitions={}}add(){for(var e=arguments.length,t=new Array(e),i=0;i{this.definitions[s]={...this.definitions[s]||{},...r[s]},Iv(s,r[s]);const o=ul[en][s];o&&Iv(o,r[s]),ZA()})}reset(){this.definitions={}}_pullDefinitions(e,t){const i=t.prefix&&t.iconName&&t.icon?{0:t}:t;return Object.keys(i).map(r=>{const{prefix:s,iconName:o,icon:a}=i[r],l=a[2];e[s]||(e[s]={}),l.length>0&&l.forEach(c=>{typeof c=="string"&&(e[s][c]=a)}),e[s][o]=a}),e}}let H2=[],gc={};const kc={},NU=Object.keys(kc);function UU(n,e){let{mixoutsTo:t}=e;return H2=n,gc={},Object.keys(kc).forEach(i=>{NU.indexOf(i)===-1&&delete kc[i]}),H2.forEach(i=>{const r=i.mixout?i.mixout():{};if(Object.keys(r).forEach(s=>{typeof r[s]=="function"&&(t[s]=r[s]),typeof r[s]=="object"&&Object.keys(r[s]).forEach(o=>{t[s]||(t[s]={}),t[s][o]=r[s][o]})}),i.hooks){const s=i.hooks();Object.keys(s).forEach(o=>{gc[o]||(gc[o]=[]),gc[o].push(s[o])})}i.provides&&i.provides(kc)}),t}function Dv(n,e){for(var t=arguments.length,i=new Array(t>2?t-2:0),r=2;r{e=o.apply(null,[e,...i])}),e}function xl(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i{s.apply(null,t)})}function da(){const n=arguments[0],e=Array.prototype.slice.call(arguments,1);return kc[n]?kc[n].apply(null,e):void 0}function Nv(n){n.prefix==="fa"&&(n.prefix="fas");let{iconName:e}=n;const t=n.prefix||fa();if(e)return e=Xo(t,e)||e,B2(JA.definitions,t,e)||B2(ls.styles,t,e)}const JA=new DU,OU=()=>{Ke.autoReplaceSvg=!1,Ke.observeMutations=!1,xl("noAuto")},FU={i2svg:function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ao?(xl("beforeI2svg",n),da("pseudoElements2svg",n),da("i2svg",n)):Promise.reject(new Error("Operation requires a DOM of some kind."))},watch:function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{autoReplaceSvgRoot:e}=n;Ke.autoReplaceSvg===!1&&(Ke.autoReplaceSvg=!0),Ke.observeMutations=!0,MU(()=>{BU({autoReplaceSvgRoot:e}),xl("watch",n)})}},kU={icon:n=>{if(n===null)return null;if(typeof n=="object"&&n.prefix&&n.iconName)return{prefix:n.prefix,iconName:Xo(n.prefix,n.iconName)||n.iconName};if(Array.isArray(n)&&n.length===2){const e=n[1].indexOf("fa-")===0?n[1].slice(3):n[1],t=r0(n[0]);return{prefix:t,iconName:Xo(t,e)||e}}if(typeof n=="string"&&(n.indexOf("".concat(Ke.cssPrefix,"-"))>-1||n.match(aU))){const e=s0(n.split(" "),{skipLookups:!0});return{prefix:e.prefix||fa(),iconName:Xo(e.prefix,e.iconName)||e.iconName}}if(typeof n=="string"){const e=fa();return{prefix:e,iconName:Xo(e,n)||n}}}},er={noAuto:OU,config:Ke,dom:FU,parse:kU,library:JA,findIconDefinition:Nv,toHtml:Ld},BU=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{autoReplaceSvgRoot:e=jt}=n;(Object.keys(ls.styles).length>0||Ke.autoFetchSvg)&&ao&&Ke.autoReplaceSvg&&er.dom.i2svg({node:e})};function o0(n,e){return Object.defineProperty(n,"abstract",{get:e}),Object.defineProperty(n,"html",{get:function(){return n.abstract.map(t=>Ld(t))}}),Object.defineProperty(n,"node",{get:function(){if(!ao)return;const t=jt.createElement("div");return t.innerHTML=n.html,t.children}}),n}function zU(n){let{children:e,main:t,mask:i,attributes:r,styles:s,transform:o}=n;if(dy(o)&&t.found&&!i.found){const{width:a,height:l}=t,c={x:a/l/2,y:.5};r.style=i0({...s,"transform-origin":"".concat(c.x+o.x/16,"em ").concat(c.y+o.y/16,"em")})}return[{tag:"svg",attributes:r,children:e}]}function HU(n){let{prefix:e,iconName:t,children:i,attributes:r,symbol:s}=n;const o=s===!0?"".concat(e,"-").concat(Ke.cssPrefix,"-").concat(t):s;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:{...r,id:o},children:i}]}]}function gy(n){const{icons:{main:e,mask:t},prefix:i,iconName:r,transform:s,symbol:o,title:a,maskId:l,titleId:c,extra:u,watchable:f=!1}=n,{width:h,height:p}=t.found?t:e,g=i==="fak",_=[Ke.replacementClass,r?"".concat(Ke.cssPrefix,"-").concat(r):""].filter(b=>u.classes.indexOf(b)===-1).filter(b=>b!==""||!!b).concat(u.classes).join(" ");let m={children:[],attributes:{...u.attributes,"data-prefix":i,"data-icon":r,class:_,role:u.attributes.role||"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(h," ").concat(p)}};const d=g&&!~u.classes.indexOf("fa-fw")?{width:"".concat(h/p*16*.0625,"em")}:{};f&&(m.attributes[vl]=""),a&&(m.children.push({tag:"title",attributes:{id:m.attributes["aria-labelledby"]||"title-".concat(c||nd())},children:[a]}),delete m.attributes.title);const x={...m,prefix:i,iconName:r,main:e,mask:t,maskId:l,transform:s,symbol:o,styles:{...d,...u.styles}},{children:v,attributes:y}=t.found&&e.found?da("generateAbstractMask",x)||{children:[],attributes:{}}:da("generateAbstractIcon",x)||{children:[],attributes:{}};return x.children=v,x.attributes=y,o?HU(x):zU(x)}function V2(n){const{content:e,width:t,height:i,transform:r,title:s,extra:o,watchable:a=!1}=n,l={...o.attributes,...s?{title:s}:{},class:o.classes.join(" ")};a&&(l[vl]="");const c={...o.styles};dy(r)&&(c.transform=xU({transform:r,startCentered:!0,width:t,height:i}),c["-webkit-transform"]=c.transform);const u=i0(c);u.length>0&&(l.style=u);const f=[];return f.push({tag:"span",attributes:l,children:[e]}),s&&f.push({tag:"span",attributes:{class:"sr-only"},children:[s]}),f}function VU(n){const{content:e,title:t,extra:i}=n,r={...i.attributes,...t?{title:t}:{},class:i.classes.join(" ")},s=i0(i.styles);s.length>0&&(r.style=s);const o=[];return o.push({tag:"span",attributes:r,children:[e]}),t&&o.push({tag:"span",attributes:{class:"sr-only"},children:[t]}),o}const{styles:xg}=ls;function Uv(n){const e=n[0],t=n[1],[i]=n.slice(4);let r=null;return Array.isArray(i)?r={tag:"g",attributes:{class:"".concat(Ke.cssPrefix,"-").concat(gg.GROUP)},children:[{tag:"path",attributes:{class:"".concat(Ke.cssPrefix,"-").concat(gg.SECONDARY),fill:"currentColor",d:i[0]}},{tag:"path",attributes:{class:"".concat(Ke.cssPrefix,"-").concat(gg.PRIMARY),fill:"currentColor",d:i[1]}}]}:r={tag:"path",attributes:{fill:"currentColor",d:i}},{found:!0,width:e,height:t,icon:r}}const GU={found:!1,width:512,height:512};function WU(n,e){!FA&&!Ke.showMissingIcons&&n&&console.error('Icon with name "'.concat(n,'" and prefix "').concat(e,'" is missing.'))}function Ov(n,e){let t=e;return e==="fa"&&Ke.styleDefault!==null&&(e=fa()),new Promise((i,r)=>{if(t==="fa"){const s=QA(n)||{};n=s.iconName||n,e=s.prefix||e}if(n&&e&&xg[e]&&xg[e][n]){const s=xg[e][n];return i(Uv(s))}WU(n,e),i({...GU,icon:Ke.showMissingIcons&&n?da("missingIconAbstract")||{}:{}})})}const G2=()=>{},Fv=Ke.measurePerformance&&yh&&yh.mark&&yh.measure?yh:{mark:G2,measure:G2},xf='FA "6.6.0"',$U=n=>(Fv.mark("".concat(xf," ").concat(n," begins")),()=>eb(n)),eb=n=>{Fv.mark("".concat(xf," ").concat(n," ends")),Fv.measure("".concat(xf," ").concat(n),"".concat(xf," ").concat(n," begins"),"".concat(xf," ").concat(n," ends"))};var _y={begin:$U,end:eb};const Ap=()=>{};function W2(n){return typeof(n.getAttribute?n.getAttribute(vl):null)=="string"}function XU(n){const e=n.getAttribute?n.getAttribute(cy):null,t=n.getAttribute?n.getAttribute(uy):null;return e&&t}function jU(n){return n&&n.classList&&n.classList.contains&&n.classList.contains(Ke.replacementClass)}function qU(){return Ke.autoReplaceSvg===!0?bp.replace:bp[Ke.autoReplaceSvg]||bp.replace}function YU(n){return jt.createElementNS("http://www.w3.org/2000/svg",n)}function KU(n){return jt.createElement(n)}function tb(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{ceFn:t=n.tag==="svg"?YU:KU}=e;if(typeof n=="string")return jt.createTextNode(n);const i=t(n.tag);return Object.keys(n.attributes||[]).forEach(function(s){i.setAttribute(s,n.attributes[s])}),(n.children||[]).forEach(function(s){i.appendChild(tb(s,{ceFn:t}))}),i}function ZU(n){let e=" ".concat(n.outerHTML," ");return e="".concat(e,"Font Awesome fontawesome.com "),e}const bp={replace:function(n){const e=n[0];if(e.parentNode)if(n[1].forEach(t=>{e.parentNode.insertBefore(tb(t),e)}),e.getAttribute(vl)===null&&Ke.keepOriginalSource){let t=jt.createComment(ZU(e));e.parentNode.replaceChild(t,e)}else e.remove()},nest:function(n){const e=n[0],t=n[1];if(~fy(e).indexOf(Ke.replacementClass))return bp.replace(n);const i=new RegExp("".concat(Ke.cssPrefix,"-.*"));if(delete t[0].attributes.id,t[0].attributes.class){const s=t[0].attributes.class.split(" ").reduce((o,a)=>(a===Ke.replacementClass||a.match(i)?o.toSvg.push(a):o.toNode.push(a),o),{toNode:[],toSvg:[]});t[0].attributes.class=s.toSvg.join(" "),s.toNode.length===0?e.removeAttribute("class"):e.setAttribute("class",s.toNode.join(" "))}const r=t.map(s=>Ld(s)).join(` +`);e.setAttribute(vl,""),e.innerHTML=r}};function $2(n){n()}function nb(n,e){const t=typeof e=="function"?e:Ap;if(n.length===0)t();else{let i=$2;Ke.mutateApproach===rU&&(i=ua.requestAnimationFrame||$2),i(()=>{const r=qU(),s=_y.begin("mutate");n.map(r),s(),t()})}}let vy=!1;function ib(){vy=!0}function kv(){vy=!1}let am=null;function X2(n){if(!N2||!Ke.observeMutations)return;const{treeCallback:e=Ap,nodeCallback:t=Ap,pseudoElementsCallback:i=Ap,observeMutationsRoot:r=jt}=n;am=new N2(s=>{if(vy)return;const o=fa();Pu(s).forEach(a=>{if(a.type==="childList"&&a.addedNodes.length>0&&!W2(a.addedNodes[0])&&(Ke.searchPseudoElements&&i(a.target),e(a.target)),a.type==="attributes"&&a.target.parentNode&&Ke.searchPseudoElements&&i(a.target.parentNode),a.type==="attributes"&&W2(a.target)&&~uU.indexOf(a.attributeName))if(a.attributeName==="class"&&XU(a.target)){const{prefix:l,iconName:c}=s0(fy(a.target));a.target.setAttribute(cy,l||o),c&&a.target.setAttribute(uy,c)}else jU(a.target)&&t(a.target)})}),ao&&am.observe(r,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}function QU(){am&&am.disconnect()}function JU(n){const e=n.getAttribute("style");let t=[];return e&&(t=e.split(";").reduce((i,r)=>{const s=r.split(":"),o=s[0],a=s.slice(1);return o&&a.length>0&&(i[o]=a.join(":").trim()),i},{})),t}function e9(n){const e=n.getAttribute("data-prefix"),t=n.getAttribute("data-icon"),i=n.innerText!==void 0?n.innerText.trim():"";let r=s0(fy(n));return r.prefix||(r.prefix=fa()),e&&t&&(r.prefix=e,r.iconName=t),r.iconName&&r.prefix||(r.prefix&&i.length>0&&(r.iconName=PU(r.prefix,n.innerText)||py(r.prefix,Lv(n.innerText))),!r.iconName&&Ke.autoFetchSvg&&n.firstChild&&n.firstChild.nodeType===Node.TEXT_NODE&&(r.iconName=n.firstChild.data)),r}function t9(n){const e=Pu(n.attributes).reduce((r,s)=>(r.name!=="class"&&r.name!=="style"&&(r[s.name]=s.value),r),{}),t=n.getAttribute("title"),i=n.getAttribute("data-fa-title-id");return Ke.autoA11y&&(t?e["aria-labelledby"]="".concat(Ke.replacementClass,"-title-").concat(i||nd()):(e["aria-hidden"]="true",e.focusable="false")),e}function n9(){return{iconName:null,title:null,titleId:null,prefix:null,transform:as,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}}}function j2(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{styleParser:!0};const{iconName:t,prefix:i,rest:r}=e9(n),s=t9(n),o=Dv("parseNodeAttributes",{},n);let a=e.styleParser?JU(n):[];return{iconName:t,title:n.getAttribute("title"),titleId:n.getAttribute("data-fa-title-id"),prefix:i,transform:as,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:r,styles:a,attributes:s},...o}}const{styles:i9}=ls;function rb(n){const e=Ke.autoReplaceSvg==="nest"?j2(n,{styleParser:!1}):j2(n);return~e.extra.classes.indexOf(zA)?da("generateLayersText",n,e):da("generateSvgReplacementMutation",n,e)}let hs=new Set;kA.map(n=>{hs.add("fa-".concat(n))});Object.keys(cl[en]).map(hs.add.bind(hs));Object.keys(cl[ji]).map(hs.add.bind(hs));Object.keys(cl[qi]).map(hs.add.bind(hs));hs=[...hs];function q2(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!ao)return Promise.resolve();const t=jt.documentElement.classList,i=u=>t.add("".concat(F2,"-").concat(u)),r=u=>t.remove("".concat(F2,"-").concat(u)),s=Ke.autoFetchSvg?hs:kA.map(u=>"fa-".concat(u)).concat(Object.keys(i9));s.includes("fa")||s.push("fa");const o=[".".concat(zA,":not([").concat(vl,"])")].concat(s.map(u=>".".concat(u,":not([").concat(vl,"])"))).join(", ");if(o.length===0)return Promise.resolve();let a=[];try{a=Pu(n.querySelectorAll(o))}catch{}if(a.length>0)i("pending"),r("complete");else return Promise.resolve();const l=_y.begin("onTree"),c=a.reduce((u,f)=>{try{const h=rb(f);h&&u.push(h)}catch(h){FA||h.name==="MissingIcon"&&console.error(h)}return u},[]);return new Promise((u,f)=>{Promise.all(c).then(h=>{nb(h,()=>{i("active"),i("complete"),r("pending"),typeof e=="function"&&e(),l(),u()})}).catch(h=>{l(),f(h)})})}function r9(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;rb(n).then(t=>{t&&nb([t],e)})}function s9(n){return function(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const i=(e||{}).icon?e:Nv(e||{});let{mask:r}=t;return r&&(r=(r||{}).icon?r:Nv(r||{})),n(i,{...t,mask:r})}}const o9=function(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{transform:t=as,symbol:i=!1,mask:r=null,maskId:s=null,title:o=null,titleId:a=null,classes:l=[],attributes:c={},styles:u={}}=e;if(!n)return;const{prefix:f,iconName:h,icon:p}=n;return o0({type:"icon",...n},()=>(xl("beforeDOMElementCreation",{iconDefinition:n,params:e}),Ke.autoA11y&&(o?c["aria-labelledby"]="".concat(Ke.replacementClass,"-title-").concat(a||nd()):(c["aria-hidden"]="true",c.focusable="false")),gy({icons:{main:Uv(p),mask:r?Uv(r.icon):{found:!1,width:null,height:null,icon:{}}},prefix:f,iconName:h,transform:{...as,...t},symbol:i,title:o,maskId:s,titleId:a,extra:{attributes:c,styles:u,classes:l}})))};var a9={mixout(){return{icon:s9(o9)}},hooks(){return{mutationObserverCallbacks(n){return n.treeCallback=q2,n.nodeCallback=r9,n}}},provides(n){n.i2svg=function(e){const{node:t=jt,callback:i=()=>{}}=e;return q2(t,i)},n.generateSvgReplacementMutation=function(e,t){const{iconName:i,title:r,titleId:s,prefix:o,transform:a,symbol:l,mask:c,maskId:u,extra:f}=t;return new Promise((h,p)=>{Promise.all([Ov(i,o),c.iconName?Ov(c.iconName,c.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(g=>{let[_,m]=g;h([e,gy({icons:{main:_,mask:m},prefix:o,iconName:i,transform:a,symbol:l,maskId:u,title:r,titleId:s,extra:f,watchable:!0})])}).catch(p)})},n.generateAbstractIcon=function(e){let{children:t,attributes:i,main:r,transform:s,styles:o}=e;const a=i0(o);a.length>0&&(i.style=a);let l;return dy(s)&&(l=da("generateAbstractTransformGrouping",{main:r,transform:s,containerWidth:r.width,iconWidth:r.width})),t.push(l||r.icon),{children:t,attributes:i}}}},l9={mixout(){return{layer(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{classes:t=[]}=e;return o0({type:"layer"},()=>{xl("beforeDOMElementCreation",{assembler:n,params:e});let i=[];return n(r=>{Array.isArray(r)?r.map(s=>{i=i.concat(s.abstract)}):i=i.concat(r.abstract)}),[{tag:"span",attributes:{class:["".concat(Ke.cssPrefix,"-layers"),...t].join(" ")},children:i}]})}}}},c9={mixout(){return{counter(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{title:t=null,classes:i=[],attributes:r={},styles:s={}}=e;return o0({type:"counter",content:n},()=>(xl("beforeDOMElementCreation",{content:n,params:e}),VU({content:n.toString(),title:t,extra:{attributes:r,styles:s,classes:["".concat(Ke.cssPrefix,"-layers-counter"),...i]}})))}}}},u9={mixout(){return{text(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{transform:t=as,title:i=null,classes:r=[],attributes:s={},styles:o={}}=e;return o0({type:"text",content:n},()=>(xl("beforeDOMElementCreation",{content:n,params:e}),V2({content:n,transform:{...as,...t},title:i,extra:{attributes:s,styles:o,classes:["".concat(Ke.cssPrefix,"-layers-text"),...r]}})))}}},provides(n){n.generateLayersText=function(e,t){const{title:i,transform:r,extra:s}=t;let o=null,a=null;if(LA){const l=parseInt(getComputedStyle(e).fontSize,10),c=e.getBoundingClientRect();o=c.width/l,a=c.height/l}return Ke.autoA11y&&!i&&(s.attributes["aria-hidden"]="true"),Promise.resolve([e,V2({content:e.innerHTML,width:o,height:a,transform:r,title:i,extra:s,watchable:!0})])}}};const f9=new RegExp('"',"ug"),Y2=[1105920,1112319],K2={FontAwesome:{normal:"fas",400:"fas"},...XN,...$N,...eU},Bv=Object.keys(K2).reduce((n,e)=>(n[e.toLowerCase()]=K2[e],n),{}),d9=Object.keys(Bv).reduce((n,e)=>{const t=Bv[e];return n[e]=t[900]||[...Object.entries(t)][0][1],n},{});function h9(n){const e=n.replace(f9,""),t=wU(e,0),i=t>=Y2[0]&&t<=Y2[1],r=e.length===2?e[0]===e[1]:!1;return{value:Lv(r?e[0]:e),isSecondary:i||r}}function p9(n,e){const t=n.replace(/^['"]|['"]$/g,"").toLowerCase(),i=parseInt(e),r=isNaN(i)?"normal":i;return(Bv[t]||{})[r]||d9[t]}function Z2(n,e){const t="".concat(iU).concat(e.replace(":","-"));return new Promise((i,r)=>{if(n.getAttribute(t)!==null)return i();const o=Pu(n.children).filter(h=>h.getAttribute(bv)===e)[0],a=ua.getComputedStyle(n,e),l=a.getPropertyValue("font-family"),c=l.match(lU),u=a.getPropertyValue("font-weight"),f=a.getPropertyValue("content");if(o&&!c)return n.removeChild(o),i();if(c&&f!=="none"&&f!==""){const h=a.getPropertyValue("content");let p=p9(l,u);const{value:g,isSecondary:_}=h9(h),m=c[0].startsWith("FontAwesome");let d=py(p,g),x=d;if(m){const v=LU(g);v.iconName&&v.prefix&&(d=v.iconName,p=v.prefix)}if(d&&!_&&(!o||o.getAttribute(cy)!==p||o.getAttribute(uy)!==x)){n.setAttribute(t,x),o&&n.removeChild(o);const v=n9(),{extra:y}=v;y.attributes[bv]=e,Ov(d,p).then(b=>{const w=gy({...v,icons:{main:b,mask:my()},prefix:p,iconName:x,extra:y,watchable:!0}),T=jt.createElementNS("http://www.w3.org/2000/svg","svg");e==="::before"?n.insertBefore(T,n.firstChild):n.appendChild(T),T.outerHTML=w.map(C=>Ld(C)).join(` +`),n.removeAttribute(t),i()}).catch(r)}else i()}else i()})}function m9(n){return Promise.all([Z2(n,"::before"),Z2(n,"::after")])}function g9(n){return n.parentNode!==document.head&&!~sU.indexOf(n.tagName.toUpperCase())&&!n.getAttribute(bv)&&(!n.parentNode||n.parentNode.tagName!=="svg")}function Q2(n){if(ao)return new Promise((e,t)=>{const i=Pu(n.querySelectorAll("*")).filter(g9).map(m9),r=_y.begin("searchPseudoElements");ib(),Promise.all(i).then(()=>{r(),kv(),e()}).catch(()=>{r(),kv(),t()})})}var _9={hooks(){return{mutationObserverCallbacks(n){return n.pseudoElementsCallback=Q2,n}}},provides(n){n.pseudoElements2svg=function(e){const{node:t=jt}=e;Ke.searchPseudoElements&&Q2(t)}}};let J2=!1;var v9={mixout(){return{dom:{unwatch(){ib(),J2=!0}}}},hooks(){return{bootstrap(){X2(Dv("mutationObserverCallbacks",{}))},noAuto(){QU()},watch(n){const{observeMutationsRoot:e}=n;J2?kv():X2(Dv("mutationObserverCallbacks",{observeMutationsRoot:e}))}}}};const eE=n=>{let e={size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0};return n.toLowerCase().split(" ").reduce((t,i)=>{const r=i.toLowerCase().split("-"),s=r[0];let o=r.slice(1).join("-");if(s&&o==="h")return t.flipX=!0,t;if(s&&o==="v")return t.flipY=!0,t;if(o=parseFloat(o),isNaN(o))return t;switch(s){case"grow":t.size=t.size+o;break;case"shrink":t.size=t.size-o;break;case"left":t.x=t.x-o;break;case"right":t.x=t.x+o;break;case"up":t.y=t.y-o;break;case"down":t.y=t.y+o;break;case"rotate":t.rotate=t.rotate+o;break}return t},e)};var x9={mixout(){return{parse:{transform:n=>eE(n)}}},hooks(){return{parseNodeAttributes(n,e){const t=e.getAttribute("data-fa-transform");return t&&(n.transform=eE(t)),n}}},provides(n){n.generateAbstractTransformGrouping=function(e){let{main:t,transform:i,containerWidth:r,iconWidth:s}=e;const o={transform:"translate(".concat(r/2," 256)")},a="translate(".concat(i.x*32,", ").concat(i.y*32,") "),l="scale(".concat(i.size/16*(i.flipX?-1:1),", ").concat(i.size/16*(i.flipY?-1:1),") "),c="rotate(".concat(i.rotate," 0 0)"),u={transform:"".concat(a," ").concat(l," ").concat(c)},f={transform:"translate(".concat(s/2*-1," -256)")},h={outer:o,inner:u,path:f};return{tag:"g",attributes:{...h.outer},children:[{tag:"g",attributes:{...h.inner},children:[{tag:t.icon.tag,children:t.icon.children,attributes:{...t.icon.attributes,...h.path}}]}]}}}};const yg={x:0,y:0,width:"100%",height:"100%"};function tE(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return n.attributes&&(n.attributes.fill||e)&&(n.attributes.fill="black"),n}function y9(n){return n.tag==="g"?n.children:[n]}var S9={hooks(){return{parseNodeAttributes(n,e){const t=e.getAttribute("data-fa-mask"),i=t?s0(t.split(" ").map(r=>r.trim())):my();return i.prefix||(i.prefix=fa()),n.mask=i,n.maskId=e.getAttribute("data-fa-mask-id"),n}}},provides(n){n.generateAbstractMask=function(e){let{children:t,attributes:i,main:r,mask:s,maskId:o,transform:a}=e;const{width:l,icon:c}=r,{width:u,icon:f}=s,h=vU({transform:a,containerWidth:u,iconWidth:l}),p={tag:"rect",attributes:{...yg,fill:"white"}},g=c.children?{children:c.children.map(tE)}:{},_={tag:"g",attributes:{...h.inner},children:[tE({tag:c.tag,attributes:{...c.attributes,...h.path},...g})]},m={tag:"g",attributes:{...h.outer},children:[_]},d="mask-".concat(o||nd()),x="clip-".concat(o||nd()),v={tag:"mask",attributes:{...yg,id:d,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"},children:[p,m]},y={tag:"defs",children:[{tag:"clipPath",attributes:{id:x},children:y9(f)},v]};return t.push(y,{tag:"rect",attributes:{fill:"currentColor","clip-path":"url(#".concat(x,")"),mask:"url(#".concat(d,")"),...yg}}),{children:t,attributes:i}}}},M9={provides(n){let e=!1;ua.matchMedia&&(e=ua.matchMedia("(prefers-reduced-motion: reduce)").matches),n.missingIconAbstract=function(){const t=[],i={fill:"currentColor"},r={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};t.push({tag:"path",attributes:{...i,d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"}});const s={...r,attributeName:"opacity"},o={tag:"circle",attributes:{...i,cx:"256",cy:"364",r:"28"},children:[]};return e||o.children.push({tag:"animate",attributes:{...r,attributeName:"r",values:"28;14;28;28;14;28;"}},{tag:"animate",attributes:{...s,values:"1;0;1;1;0;1;"}}),t.push(o),t.push({tag:"path",attributes:{...i,opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"},children:e?[]:[{tag:"animate",attributes:{...s,values:"1;0;0;0;0;1;"}}]}),e||t.push({tag:"path",attributes:{...i,opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"},children:[{tag:"animate",attributes:{...s,values:"0;0;1;1;0;0;"}}]}),{tag:"g",attributes:{class:"missing"},children:t}}}},E9={hooks(){return{parseNodeAttributes(n,e){const t=e.getAttribute("data-fa-symbol"),i=t===null?!1:t===""?!0:t;return n.symbol=i,n}}}},w9=[SU,a9,l9,c9,u9,_9,v9,x9,S9,M9,E9];UU(w9,{mixoutsTo:er});er.noAuto;er.config;er.library;er.dom;const zv=er.parse;er.findIconDefinition;er.toHtml;const T9=er.icon;er.layer;er.text;er.counter;var sb={exports:{}},A9="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",b9=A9,R9=b9;function ob(){}function ab(){}ab.resetWarningCache=ob;var C9=function(){function n(i,r,s,o,a,l){if(l!==R9){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}n.isRequired=n;function e(){return n}var t={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:e,element:n,elementType:n,instanceOf:e,node:n,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:ab,resetWarningCache:ob};return t.PropTypes=t,t};sb.exports=C9();var P9=sb.exports;const St=gA(P9);function nE(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function es(n){for(var e=1;e=0)&&(t[r]=n[r]);return t}function I9(n,e){if(n==null)return{};var t=L9(n,e),i,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(n);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function Hv(n){return D9(n)||N9(n)||U9(n)||O9()}function D9(n){if(Array.isArray(n))return Vv(n)}function N9(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function U9(n,e){if(n){if(typeof n=="string")return Vv(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Vv(n,e)}}function Vv(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t2&&arguments[2]!==void 0?arguments[2]:{};if(typeof e=="string")return e;var i=(e.children||[]).map(function(l){return cb(n,l)}),r=Object.keys(e.attributes||{}).reduce(function(l,c){var u=e.attributes[c];switch(c){case"class":l.attrs.className=u,delete e.attributes.class;break;case"style":l.attrs.style=H9(u);break;default:c.indexOf("aria-")===0||c.indexOf("data-")===0?l.attrs[c.toLowerCase()]=u:l.attrs[lb(c)]=u}return l},{attrs:{}}),s=t.style,o=s===void 0?{}:s,a=I9(t,B9);return r.attrs.style=es(es({},r.attrs.style),o),n.apply(void 0,[e.tag,es(es({},r.attrs),a)].concat(Hv(i)))}var ub=!1;try{ub=!0}catch{}function V9(){if(!ub&&console&&typeof console.error=="function"){var n;(n=console).error.apply(n,arguments)}}function iE(n){if(n&&lm(n)==="object"&&n.prefix&&n.iconName&&n.icon)return n;if(zv.icon)return zv.icon(n);if(n===null)return null;if(n&&lm(n)==="object"&&n.prefix&&n.iconName)return n;if(Array.isArray(n)&&n.length===2)return{prefix:n[0],iconName:n[1]};if(typeof n=="string")return{prefix:"fas",iconName:n}}function Sg(n,e){return Array.isArray(e)&&e.length>0||!Array.isArray(e)&&e?_c({},n,e):{}}var rE={border:!1,className:"",mask:null,maskId:null,fixedWidth:!1,inverse:!1,flip:!1,icon:null,listItem:!1,pull:null,pulse:!1,rotation:null,size:null,spin:!1,spinPulse:!1,spinReverse:!1,beat:!1,fade:!1,beatFade:!1,bounce:!1,shake:!1,symbol:!1,title:"",titleId:null,transform:null,swapOpacity:!1},id=_l.forwardRef(function(n,e){var t=es(es({},rE),n),i=t.icon,r=t.mask,s=t.symbol,o=t.className,a=t.title,l=t.titleId,c=t.maskId,u=iE(i),f=Sg("classes",[].concat(Hv(F9(t)),Hv((o||"").split(" ")))),h=Sg("transform",typeof t.transform=="string"?zv.transform(t.transform):t.transform),p=Sg("mask",iE(r)),g=T9(u,es(es(es(es({},f),h),p),{},{symbol:s,title:a,titleId:l,maskId:c}));if(!g)return V9("Could not find icon",u),null;var _=g.abstract,m={ref:e};return Object.keys(t).forEach(function(d){rE.hasOwnProperty(d)||(m[d]=t[d])}),G9(_[0],m)});id.displayName="FontAwesomeIcon";id.propTypes={beat:St.bool,border:St.bool,beatFade:St.bool,bounce:St.bool,className:St.string,fade:St.bool,flash:St.bool,mask:St.oneOfType([St.object,St.array,St.string]),maskId:St.string,fixedWidth:St.bool,inverse:St.bool,flip:St.oneOf([!0,!1,"horizontal","vertical","both"]),icon:St.oneOfType([St.object,St.array,St.string]),listItem:St.bool,pull:St.oneOf(["right","left"]),pulse:St.bool,rotation:St.oneOf([0,90,180,270]),shake:St.bool,size:St.oneOf(["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"]),spin:St.bool,spinPulse:St.bool,spinReverse:St.bool,symbol:St.oneOfType([St.bool,St.string]),title:St.string,titleId:St.string,transform:St.oneOfType([St.string,St.object]),swapOpacity:St.bool};var G9=cb.bind(null,_l.createElement),Ai=function(){return Ai=Object.assign||function(e){for(var t,i=1,r=arguments.length;i0?Dn(Lu,--gr):0,cu--,vn===10&&(cu=1,l0--),vn}function Hr(){return vn=gr2||Wv(vn)>3?"":" "}function J9(n,e){for(;--e&&Hr()&&!(vn<48||vn>102||vn>57&&vn<65||vn>70&&vn<97););return u0(n,Cp()+(e<6&&fl()==32&&Hr()==32))}function $v(n){for(;Hr();)switch(vn){case n:return gr;case 34:case 39:n!==34&&n!==39&&$v(vn);break;case 40:n===41&&$v(n);break;case 92:Hr();break}return gr}function e7(n,e){for(;Hr()&&n+vn!==57;)if(n+vn===84&&fl()===47)break;return"/*"+u0(e,gr-1)+"*"+yy(n===47?n:Hr())}function t7(n){for(;!Wv(fl());)Hr();return u0(n,gr)}function n7(n){return Z9(Pp("",null,null,null,[""],n=K9(n),0,[0],n))}function Pp(n,e,t,i,r,s,o,a,l){for(var c=0,u=0,f=o,h=0,p=0,g=0,_=1,m=1,d=1,x=0,v="",y=r,b=s,w=i,T=v;m;)switch(g=x,x=Hr()){case 40:if(g!=108&&Dn(T,f-1)==58){Rp(T+=gt(Mg(x),"&","&\f"),"&\f",hb(c?a[c-1]:0))!=-1&&(d=-1);break}case 34:case 39:case 91:T+=Mg(x);break;case 9:case 10:case 13:case 32:T+=Q9(g);break;case 92:T+=J9(Cp()-1,7);continue;case 47:switch(fl()){case 42:case 47:yf(i7(e7(Hr(),Cp()),e,t,l),l);break;default:T+="/"}break;case 123*_:a[c++]=ts(T)*d;case 125*_:case 59:case 0:switch(x){case 0:case 125:m=0;case 59+u:d==-1&&(T=gt(T,/\f/g,"")),p>0&&ts(T)-f&&yf(p>32?aE(T+";",i,t,f-1,l):aE(gt(T," ","")+";",i,t,f-2,l),l);break;case 59:T+=";";default:if(yf(w=oE(T,e,t,c,u,r,a,v,y=[],b=[],f,s),s),x===123)if(u===0)Pp(T,e,w,w,y,s,f,a,b);else switch(h===99&&Dn(T,3)===110?100:h){case 100:case 108:case 109:case 115:Pp(n,w,w,i&&yf(oE(n,w,w,0,0,r,a,v,r,y=[],f,b),b),r,b,f,a,i?y:b);break;default:Pp(T,w,w,w,[""],b,0,a,b)}}c=u=p=0,_=d=1,v=T="",f=o;break;case 58:f=1+ts(T),p=g;default:if(_<1){if(x==123)--_;else if(x==125&&_++==0&&Y9()==125)continue}switch(T+=yy(x),x*_){case 38:d=u>0?1:(T+="\f",-1);break;case 44:a[c++]=(ts(T)-1)*d,d=1;break;case 64:fl()===45&&(T+=Mg(Hr())),h=fl(),u=f=ts(v=T+=t7(Cp())),x++;break;case 45:g===45&&ts(T)==2&&(_=0)}}return s}function oE(n,e,t,i,r,s,o,a,l,c,u,f){for(var h=r-1,p=r===0?s:[""],g=mb(p),_=0,m=0,d=0;_0?p[x]+" "+v:gt(v,/&\f/g,p[x])))&&(l[d++]=y);return c0(n,e,t,r===0?a0:a,l,c,u,f)}function i7(n,e,t,i){return c0(n,e,t,fb,yy(q9()),lu(n,2,-2),0,i)}function aE(n,e,t,i,r){return c0(n,e,t,xy,lu(n,0,i),lu(n,i+1,-1),i,r)}function _b(n,e,t){switch(X9(n,e)){case 5103:return Pt+"print-"+n+n;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Pt+n+n;case 4789:return Of+n+n;case 5349:case 4246:case 4810:case 6968:case 2756:return Pt+n+Of+n+Gt+n+n;case 5936:switch(Dn(n,e+11)){case 114:return Pt+n+Gt+gt(n,/[svh]\w+-[tblr]{2}/,"tb")+n;case 108:return Pt+n+Gt+gt(n,/[svh]\w+-[tblr]{2}/,"tb-rl")+n;case 45:return Pt+n+Gt+gt(n,/[svh]\w+-[tblr]{2}/,"lr")+n}case 6828:case 4268:case 2903:return Pt+n+Gt+n+n;case 6165:return Pt+n+Gt+"flex-"+n+n;case 5187:return Pt+n+gt(n,/(\w+).+(:[^]+)/,Pt+"box-$1$2"+Gt+"flex-$1$2")+n;case 5443:return Pt+n+Gt+"flex-item-"+gt(n,/flex-|-self/g,"")+(Fs(n,/flex-|baseline/)?"":Gt+"grid-row-"+gt(n,/flex-|-self/g,""))+n;case 4675:return Pt+n+Gt+"flex-line-pack"+gt(n,/align-content|flex-|-self/g,"")+n;case 5548:return Pt+n+Gt+gt(n,"shrink","negative")+n;case 5292:return Pt+n+Gt+gt(n,"basis","preferred-size")+n;case 6060:return Pt+"box-"+gt(n,"-grow","")+Pt+n+Gt+gt(n,"grow","positive")+n;case 4554:return Pt+gt(n,/([^-])(transform)/g,"$1"+Pt+"$2")+n;case 6187:return gt(gt(gt(n,/(zoom-|grab)/,Pt+"$1"),/(image-set)/,Pt+"$1"),n,"")+n;case 5495:case 3959:return gt(n,/(image-set\([^]*)/,Pt+"$1$`$1");case 4968:return gt(gt(n,/(.+:)(flex-)?(.*)/,Pt+"box-pack:$3"+Gt+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Pt+n+n;case 4200:if(!Fs(n,/flex-|baseline/))return Gt+"grid-column-align"+lu(n,e)+n;break;case 2592:case 3360:return Gt+gt(n,"template-","")+n;case 4384:case 3616:return t&&t.some(function(i,r){return e=r,Fs(i.props,/grid-\w+-end/)})?~Rp(n+(t=t[e].value),"span",0)?n:Gt+gt(n,"-start","")+n+Gt+"grid-row-span:"+(~Rp(t,"span",0)?Fs(t,/\d+/):+Fs(t,/\d+/)-+Fs(n,/\d+/))+";":Gt+gt(n,"-start","")+n;case 4896:case 4128:return t&&t.some(function(i){return Fs(i.props,/grid-\w+-start/)})?n:Gt+gt(gt(n,"-end","-span"),"span ","")+n;case 4095:case 3583:case 4068:case 2532:return gt(n,/(.+)-inline(.+)/,Pt+"$1$2")+n;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(ts(n)-1-e>6)switch(Dn(n,e+1)){case 109:if(Dn(n,e+4)!==45)break;case 102:return gt(n,/(.+:)(.+)-([^]+)/,"$1"+Pt+"$2-$3$1"+Of+(Dn(n,e+3)==108?"$3":"$2-$3"))+n;case 115:return~Rp(n,"stretch",0)?_b(gt(n,"stretch","fill-available"),e,t)+n:n}break;case 5152:case 5920:return gt(n,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(i,r,s,o,a,l,c){return Gt+r+":"+s+c+(o?Gt+r+"-span:"+(a?l:+l-+s)+c:"")+n});case 4949:if(Dn(n,e+6)===121)return gt(n,":",":"+Pt)+n;break;case 6444:switch(Dn(n,Dn(n,14)===45?18:11)){case 120:return gt(n,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Pt+(Dn(n,14)===45?"inline-":"")+"box$3$1"+Pt+"$2$3$1"+Gt+"$2box$3")+n;case 100:return gt(n,":",":"+Gt)+n}break;case 5719:case 2647:case 2135:case 3927:case 2391:return gt(n,"scroll-","scroll-snap-")+n}return n}function um(n,e){for(var t="",i=0;i-1&&!n.return)switch(n.type){case xy:n.return=_b(n.value,n.length,t);return;case db:return um([No(n,{value:gt(n.value,"@","@"+Pt)})],i);case a0:if(n.length)return j9(t=n.props,function(r){switch(Fs(r,i=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":jl(No(n,{props:[gt(r,/:(read-\w+)/,":"+Of+"$1")]})),jl(No(n,{props:[r]})),Gv(n,{props:sE(t,i)});break;case"::placeholder":jl(No(n,{props:[gt(r,/:(plac\w+)/,":"+Pt+"input-$1")]})),jl(No(n,{props:[gt(r,/:(plac\w+)/,":"+Of+"$1")]})),jl(No(n,{props:[gt(r,/:(plac\w+)/,Gt+"input-$1")]})),jl(No(n,{props:[r]})),Gv(n,{props:sE(t,i)});break}return""})}}var l7={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Vi={},uu=typeof process<"u"&&Vi!==void 0&&(Vi.REACT_APP_SC_ATTR||Vi.SC_ATTR)||"data-styled",vb="active",xb="data-styled-version",f0="6.1.13",Sy=`/*!sc*/ +`,fm=typeof window<"u"&&"HTMLElement"in window,c7=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&Vi!==void 0&&Vi.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&Vi.REACT_APP_SC_DISABLE_SPEEDY!==""?Vi.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&Vi.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&Vi!==void 0&&Vi.SC_DISABLE_SPEEDY!==void 0&&Vi.SC_DISABLE_SPEEDY!==""&&Vi.SC_DISABLE_SPEEDY!=="false"&&Vi.SC_DISABLE_SPEEDY),d0=Object.freeze([]),fu=Object.freeze({});function u7(n,e,t){return t===void 0&&(t=fu),n.theme!==t.theme&&n.theme||e||t.theme}var yb=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),f7=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,d7=/(^-|-$)/g;function lE(n){return n.replace(f7,"-").replace(d7,"")}var h7=/(a)(d)/gi,Sh=52,cE=function(n){return String.fromCharCode(n+(n>25?39:97))};function Xv(n){var e,t="";for(e=Math.abs(n);e>Sh;e=e/Sh|0)t=cE(e%Sh)+t;return(cE(e%Sh)+t).replace(h7,"$1-$2")}var Eg,Sb=5381,vc=function(n,e){for(var t=e.length;t;)n=33*n^e.charCodeAt(--t);return n},Mb=function(n){return vc(Sb,n)};function p7(n){return Xv(Mb(n)>>>0)}function m7(n){return n.displayName||n.name||"Component"}function wg(n){return typeof n=="string"&&!0}var Eb=typeof Symbol=="function"&&Symbol.for,wb=Eb?Symbol.for("react.memo"):60115,g7=Eb?Symbol.for("react.forward_ref"):60112,_7={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},v7={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Tb={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},x7=((Eg={})[g7]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Eg[wb]=Tb,Eg);function uE(n){return("type"in(e=n)&&e.type.$$typeof)===wb?Tb:"$$typeof"in n?x7[n.$$typeof]:_7;var e}var y7=Object.defineProperty,S7=Object.getOwnPropertyNames,fE=Object.getOwnPropertySymbols,M7=Object.getOwnPropertyDescriptor,E7=Object.getPrototypeOf,dE=Object.prototype;function Ab(n,e,t){if(typeof e!="string"){if(dE){var i=E7(e);i&&i!==dE&&Ab(n,i,t)}var r=S7(e);fE&&(r=r.concat(fE(e)));for(var s=uE(n),o=uE(e),a=0;a0?" Args: ".concat(e.join(", ")):""))}var w7=function(){function n(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return n.prototype.indexOfGroup=function(e){for(var t=0,i=0;i=this.groupSizes.length){for(var i=this.groupSizes,r=i.length,s=r;e>=s;)if((s<<=1)<0)throw Id(16,"".concat(e));this.groupSizes=new Uint32Array(s),this.groupSizes.set(i),this.length=s;for(var o=r;o=this.length||this.groupSizes[e]===0)return t;for(var i=this.groupSizes[e],r=this.indexOfGroup(e),s=r+i,o=r;o=0){var i=document.createTextNode(t);return this.element.insertBefore(i,this.nodes[e]||null),this.length++,!0}return!1},n.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},n.prototype.getRule=function(e){return e0&&(m+="".concat(d,","))}),l+="".concat(g).concat(_,'{content:"').concat(m,'"}').concat(Sy)},u=0;u0?".".concat(e):h},u=l.slice();u.push(function(h){h.type===a0&&h.value.includes("&")&&(h.props[0]=h.props[0].replace(U7,t).replace(i,c))}),o.prefix&&u.push(a7),u.push(r7);var f=function(h,p,g,_){p===void 0&&(p=""),g===void 0&&(g=""),_===void 0&&(_="&"),e=_,t=p,i=new RegExp("\\".concat(t,"\\b"),"g");var m=h.replace(O7,""),d=n7(g||p?"".concat(g," ").concat(p," { ").concat(m," }"):m);o.namespace&&(d=Cb(d,o.namespace));var x=[];return um(d,s7(u.concat(o7(function(v){return x.push(v)})))),x};return f.hash=l.length?l.reduce(function(h,p){return p.name||Id(15),vc(h,p.name)},Sb).toString():"",f}var k7=new Rb,qv=F7(),Pb=_l.createContext({shouldForwardProp:void 0,styleSheet:k7,stylis:qv});Pb.Consumer;_l.createContext(void 0);function gE(){return Tt.useContext(Pb)}var B7=function(){function n(e,t){var i=this;this.inject=function(r,s){s===void 0&&(s=qv);var o=i.name+s.hash;r.hasNameForId(i.id,o)||r.insertRules(i.id,o,s(i.rules,o,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,Ey(this,function(){throw Id(12,String(i.name))})}return n.prototype.getName=function(e){return e===void 0&&(e=qv),this.name+e.hash},n}(),z7=function(n){return n>="A"&&n<="Z"};function _E(n){for(var e="",t=0;t>>0);if(!t.hasNameForId(this.componentId,o)){var a=i(s,".".concat(o),void 0,this.componentId);t.insertRules(this.componentId,o,a)}r=tl(r,o),this.staticRulesId=o}else{for(var l=vc(this.baseHash,i.hash),c="",u=0;u>>0);t.hasNameForId(this.componentId,p)||t.insertRules(this.componentId,p,i(c,".".concat(p),void 0,this.componentId)),r=tl(r,p)}}return r},n}(),Db=_l.createContext(void 0);Db.Consumer;var Tg={};function W7(n,e,t){var i=My(n),r=n,s=!wg(n),o=e.attrs,a=o===void 0?d0:o,l=e.componentId,c=l===void 0?function(y,b){var w=typeof y!="string"?"sc":lE(y);Tg[w]=(Tg[w]||0)+1;var T="".concat(w,"-").concat(p7(f0+w+Tg[w]));return b?"".concat(b,"-").concat(T):T}(e.displayName,e.parentComponentId):l,u=e.displayName,f=u===void 0?function(y){return wg(y)?"styled.".concat(y):"Styled(".concat(m7(y),")")}(n):u,h=e.displayName&&e.componentId?"".concat(lE(e.displayName),"-").concat(e.componentId):e.componentId||c,p=i&&r.attrs?r.attrs.concat(a).filter(Boolean):a,g=e.shouldForwardProp;if(i&&r.shouldForwardProp){var _=r.shouldForwardProp;if(e.shouldForwardProp){var m=e.shouldForwardProp;g=function(y,b){return _(y,b)&&m(y,b)}}else g=_}var d=new G7(t,h,i?r.componentStyle:void 0);function x(y,b){return function(w,T,C){var M=w.attrs,S=w.componentStyle,P=w.defaultProps,k=w.foldedComponentIds,U=w.styledComponentId,N=w.target,X=_l.useContext(Db),z=gE(),te=w.shouldForwardProp||z.shouldForwardProp,L=u7(T,X,P)||fu,Z=function(oe,me,de){for(var be,Le=Ai(Ai({},me),{className:void 0,theme:de}),ke=0;ken?"2px 8px 8px 2px":"8px 2px 2px 8px"}; + } + + &:last-child { + border-radius: ${({$reverse:n})=>n?"8px 2px 2px 8px":"2px 8px 8px 2px"}; + } +`,ci=ln.div` + background-color: ${({$pressed:n})=>n?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)"}; + border: none; + display: flex; + align-items: center; + justify-content: center; + color: white; + border-radius: 5px; + font-size: 14px; + font-family: Arial, sans-serif; + height: 20px; + width: 20px; + transition: all 0.2s ease-in-out; +`,Ub=ln.div` + display: flex; + align-items: center; + height: 24px; + margin-bottom: 2px; + justify-content: flex-start; + flex-direction: ${({$reverse:n})=>n?"row-reverse":"row"}; +`,hu=ln.div` + display: flex; + flex-direction: ${({$reverse:n})=>n?"row-reverse":"row"}; + height: 100%; + justify-content: space-between; + align-items: center; +`;ln.button` + background-color: rgba(255, 255, 255, 0.3); + border: none; + display: flex; + justify-content: center; + align-items: center; + padding: 0; + pointer-events: none; + width: 50px; + height: 50px; + border-radius: 50%; + position: relative; + margin: 0 5px; + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); +`;ln.div` + position: absolute; + background-color: white; + border-radius: 50%; + width: 36px; + height: 36px; + cursor: pointer; + pointer-events: auto; +`;const Ob=ln.input.attrs({type:"range"})` + -webkit-appearance: none; + appearance: none; + background-color: rgba(255, 255, 255, 0.3); + border: none; + height: 100%; + width: 49px; + cursor: pointer; + margin: 0 1px; + transition: all 0.2s ease-in-out; + border-radius: ${({$reverse:n})=>n?"8px 2px 2px 8px":"2px 8px 8px 2px"}; + + &::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + width: 8px; + height: 24px; + background-color: white; + border-radius: 3px; + } + + &::-moz-range-thumb { + width: 8px; + height: 24px; + background-color: white; + border-radius: 3px; + } + + &::-ms-thumb { + width: 8px; + height: 24px; + background-color: white; + border-radius: 3px; + } +`,X7=ln.div` + display: flex; + flex-direction: column; + align-items: ${({$reverse:n})=>n?"flex-start":"flex-end"}; + justify-content: center; + margin: ${({$reverse:n})=>n?"2px -26px 0 0":"2px 0 0 -26px"}; +`,yE=ln.div` + display: flex; + flex-direction: ${({$reverse:n})=>n?"row-reverse":"row"}; + align-items: center; + justify-content: center; +`;ln.div` + display: flex; + flex-direction: column; + height: 50px; + justify-content: space-between; +`;const pn=ln(id)` + height: 14px; + min-height: 14px; + max-height: 14px; + width: 14px; + min-width: 14px; + max-width: 14px; +`,j7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M7 13.125a7 7 0 1 0 14 0v1.75a7 7 0 0 1-14 0v-1.75Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.55,d:"M14 19.863a6.738 6.738 0 1 0 0-13.476 6.738 6.738 0 0 0 0 13.476Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M16.529 16.1h-.893l-1.653-2.713-1.68 2.713h-.832l2.074-3.255-1.942-2.992h.875l1.531 2.45 1.54-2.45h.831l-1.933 2.975 2.082 3.272Z",style:{fill:"#fff",fillOpacity:1}})]}),q7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M7 13.125a7 7 0 1 0 14 0v1.75a7 7 0 0 1-14 0v-1.75Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.55,d:"M14 19.863a6.738 6.738 0 1 0 0-13.476 6.738 6.738 0 0 0 0 13.476Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"m14.086 12.924 1.627-3.071h.849l-2.083 3.823V16.1h-.787v-2.389L11.61 9.853h.857l1.619 3.07Z",style:{fill:"#fff",fillOpacity:1}})]}),Y7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M7 13.125a7 7 0 1 0 14 0v1.75a7 7 0 0 1-14 0v-1.75Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.55,d:"M14 19.863a6.738 6.738 0 1 0 0-13.476 6.738 6.738 0 0 0 0 13.476Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"m15.975 16.1-.753-1.934h-2.476l-.744 1.934h-.796l2.441-6.274h.709l2.432 6.274h-.813Zm-1.69-4.524a29.052 29.052 0 0 1-.21-.63 5.175 5.175 0 0 0-.087-.306c-.029.117-.06.236-.096.359-.03.116-.061.224-.096.323-.03.1-.056.184-.079.254l-.709 1.89h1.978l-.7-1.89Z",style:{fill:"#fff",fillOpacity:1}})]}),K7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M7 13.125a7 7 0 1 0 14 0v1.75a7 7 0 0 1-14 0v-1.75Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.55,d:"M14 19.863a6.738 6.738 0 1 0 0-13.476 6.738 6.738 0 0 0 0 13.476Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M13.876 9.853c.519 0 .954.05 1.304.148.355.1.62.263.796.49.18.228.271.531.271.91 0 .245-.047.464-.14.656a1.198 1.198 0 0 1-.402.473 1.62 1.62 0 0 1-.648.254v.043c.262.041.499.117.709.228.216.11.385.268.507.473.123.204.184.47.184.796 0 .379-.088.703-.262.971a1.663 1.663 0 0 1-.753.604c-.32.134-.706.201-1.155.201h-2.196V9.853h1.785Zm.157 2.66c.537 0 .905-.085 1.103-.254.198-.175.297-.432.297-.77 0-.344-.122-.59-.367-.735-.24-.152-.624-.228-1.155-.228h-1.033v1.986h1.155Zm-1.155.656v2.266h1.26c.555 0 .94-.108 1.155-.324.216-.216.324-.498.324-.849 0-.221-.05-.414-.149-.577-.093-.163-.254-.289-.481-.376-.222-.093-.525-.14-.91-.14h-1.199Z",style:{fill:"#fff",fillOpacity:1}})]}),Z7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:.5,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M12.642 17.325v-6.247h.787v5.547h2.73v.7h-3.517ZM14.479 6.389a.525.525 0 0 1-.782 0l-2.235-2.495a.525.525 0 0 1 .39-.875h4.47c.454 0 .694.537.391.875L14.478 6.39Z",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"m13.045 6.711-1.093-1.22a8.75 8.75 0 1 0 4.24.036L15.11 6.733A7.352 7.352 0 0 1 14 21.35a7.35 7.35 0 0 1-.955-14.639Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),Q7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:.7,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM14.479 6.389a.525.525 0 0 1-.782 0l-2.235-2.495a.525.525 0 0 1 .39-.875h4.47c.454 0 .694.537.391.875L14.478 6.39Z",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"m13.045 6.711-1.093-1.22a8.75 8.75 0 1 0 4.24.036L15.11 6.733A7.352 7.352 0 0 1 14 21.35a7.35 7.35 0 0 1-.955-14.639Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),J7=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M12.642 17.325v-6.248h.787v5.548h2.73v.7h-3.517ZM13.697.611a.525.525 0 0 1 .782 0l2.234 2.495a.525.525 0 0 1-.39.875h-4.47a.525.525 0 0 1-.391-.875L13.697.61Z",style:{fill:"#fff",fillOpacity:1}})]}),eO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M12.642 17.325v-6.248h.787v5.548h2.73v.7h-3.517ZM14.479 27.389a.525.525 0 0 1-.782 0l-2.235-2.495a.525.525 0 0 1 .39-.875h4.47c.454 0 .694.537.391.875l-2.235 2.495Z",style:{fill:"#fff",fillOpacity:1}})]}),tO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M12.642 17.325v-6.248h.787v5.548h2.73v.7h-3.517ZM.611 14.303a.525.525 0 0 1 0-.782l2.495-2.234a.525.525 0 0 1 .875.39v4.47a.525.525 0 0 1-.875.391L.61 14.303Z",style:{fill:"#fff",fillOpacity:1}})]}),nO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M12.642 17.325v-6.248h.787v5.548h2.73v.7h-3.517ZM27.389 13.521a.525.525 0 0 1 0 .782l-2.495 2.235a.525.525 0 0 1-.875-.39v-4.47c0-.454.537-.694.875-.391l2.495 2.234Z",style:{fill:"#fff",fillOpacity:1}})]}),iO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM13.697.611a.525.525 0 0 1 .782 0l2.234 2.495a.525.525 0 0 1-.39.875h-4.47a.525.525 0 0 1-.391-.875L13.697.61Z",style:{fill:"#fff",fillOpacity:1}})]}),rO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM14.479 27.389a.525.525 0 0 1-.782 0l-2.235-2.495a.525.525 0 0 1 .39-.875h4.47c.454 0 .694.537.391.875l-2.235 2.495Z",style:{fill:"#fff",fillOpacity:1}})]}),sO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM.611 14.303a.525.525 0 0 1 0-.782l2.495-2.234a.525.525 0 0 1 .875.39v4.47a.525.525 0 0 1-.875.391L.61 14.303Z",style:{fill:"#fff",fillOpacity:1}})]}),oO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM27.389 13.521a.525.525 0 0 1 0 .782l-2.495 2.235a.525.525 0 0 1-.875-.39v-4.47c0-.454.537-.694.875-.391l2.495 2.234Z",style:{fill:"#fff",fillOpacity:1}})]}),aO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M7.525 7.875c-2.283 1.22-3.82 3.507-3.82 6.125s1.537 4.904 3.82 6.125C4.405 19.425 2.1 16.948 2.1 14s2.306-5.425 5.425-6.125Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.7,d:"M24.702 10.954a2.187 2.187 0 0 0-2.095-2.817H11.025a5.863 5.863 0 0 0 0 11.726h9.377c.966 0 1.818-.634 2.095-1.56l2.205-7.35Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M10.594 17.15v-6.248h.788v5.548h2.73v.7h-3.518Zm7.13-3.299h2.162v3.063c-.338.11-.68.192-1.024.245a7.837 7.837 0 0 1-1.172.078c-.648 0-1.193-.128-1.637-.385a2.567 2.567 0 0 1-1.015-1.11c-.227-.485-.34-1.057-.34-1.716 0-.653.127-1.219.384-1.697a2.699 2.699 0 0 1 1.103-1.112c.484-.268 1.067-.402 1.75-.402.35 0 .68.032.988.096.315.064.607.155.875.271l-.297.683a4.55 4.55 0 0 0-.753-.254 3.453 3.453 0 0 0-.857-.105c-.496 0-.922.102-1.278.306a2.004 2.004 0 0 0-.813.875c-.187.374-.28.82-.28 1.34 0 .495.078.935.236 1.32.163.38.417.677.761.893.344.21.796.315 1.356.315.187 0 .35-.006.49-.018.146-.017.277-.037.394-.06.123-.024.236-.047.341-.07V14.55h-1.373v-.7Z",style:{fill:"#fff",fillOpacity:1}})]}),lO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M20.441 7.875c2.283 1.22 3.82 3.507 3.82 6.125s-1.537 4.904-3.82 6.125c3.12-.7 5.425-3.177 5.425-6.125s-2.305-5.425-5.425-6.125Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{stroke:"#fff",strokeWidth:.7,d:"M3.264 10.954a2.187 2.187 0 0 1 2.095-2.817h11.582a5.862 5.862 0 0 1 0 11.726H7.564a2.188 2.188 0 0 1-2.095-1.56l-2.205-7.35Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M9.497 10.902c.519 0 .945.068 1.277.202.339.128.59.323.753.586.163.262.245.592.245.989 0 .332-.062.61-.184.83-.122.223-.28.4-.472.535-.187.128-.386.23-.595.306l1.714 2.8h-.918l-1.514-2.581H8.56v2.58h-.787v-6.247h1.724Zm-.044.683H8.56v2.319h.937c.338 0 .615-.044.831-.132a.956.956 0 0 0 .473-.402c.104-.175.157-.394.157-.656 0-.274-.055-.493-.166-.657a.905.905 0 0 0-.49-.358c-.222-.076-.505-.114-.849-.114Zm6.476 2.266h2.16v3.063c-.337.11-.679.192-1.023.245a7.837 7.837 0 0 1-1.172.078c-.648 0-1.193-.128-1.637-.385a2.568 2.568 0 0 1-1.015-1.11c-.227-.485-.34-1.057-.34-1.716 0-.653.127-1.219.384-1.697a2.699 2.699 0 0 1 1.103-1.112c.484-.268 1.067-.402 1.75-.402.35 0 .68.032.988.096.315.064.607.155.875.271l-.297.683a4.551 4.551 0 0 0-.753-.254 3.453 3.453 0 0 0-.857-.105c-.496 0-.922.102-1.278.306a2.004 2.004 0 0 0-.813.875c-.187.374-.28.82-.28 1.34 0 .495.078.935.236 1.32.163.38.417.677.761.893.344.21.796.315 1.356.315.187 0 .35-.006.49-.018a5.17 5.17 0 0 0 .394-.06c.123-.024.236-.047.341-.07V14.55H15.93v-.7Z",style:{fill:"#fff",fillOpacity:1}})]}),cO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:.7,d:"M14 20.212a7.612 7.612 0 1 0 0-15.224 7.612 7.612 0 0 0 0 15.224Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M10.209 15.662V9.415h.787v5.548h2.73v.7H10.21Zm6.395 0h-.787v-5.556h-1.952v-.691h4.682v.691h-1.943v5.556Z",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M21.235 17.5a8.31 8.31 0 0 1-7.205 4.165A8.31 8.31 0 0 1 6.825 17.5c.823 3.4 3.737 5.915 7.205 5.915 3.469 0 6.382-2.514 7.205-5.915Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),uO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",strokeWidth:.7,d:"M14 20.212a7.612 7.612 0 1 0 0-15.224 7.612 7.612 0 0 0 0 15.224Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",d:"M11.42 9.415c.52 0 .945.067 1.277.201.339.129.59.324.753.587.163.262.245.592.245.988 0 .333-.061.61-.184.832-.122.221-.28.4-.472.533-.187.129-.385.23-.595.307l1.715 2.8h-.92l-1.513-2.582h-1.242v2.582h-.788V9.415h1.724Zm-.044.683h-.892v2.318h.936c.338 0 .615-.043.831-.131a.956.956 0 0 0 .473-.402c.105-.175.157-.394.157-.657 0-.274-.055-.493-.166-.656a.905.905 0 0 0-.49-.359c-.222-.075-.505-.114-.849-.114Zm5.74 5.564h-.787v-5.556h-1.951v-.691h4.681v.691h-1.942v5.556Z",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M21.235 17.5a8.31 8.31 0 0 1-7.205 4.165A8.31 8.31 0 0 1 6.825 17.5c.823 3.4 3.737 5.915 7.205 5.915 3.469 0 6.382-2.514 7.205-5.915Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),fO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",d:"m20.01 15.768-4.242 4.242a5.5 5.5 0 1 1-7.778-7.778l4.242-4.242a5.5 5.5 0 1 1 7.778 7.778Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M11.172 16.828a1 1 0 0 0 1.414 0L15.414 14l.707.707-2.828 2.828a2 2 0 1 1-2.829-2.828l.708.707a1 1 0 0 0 0 1.414ZM12.586 14l2.828-2.829a1 1 0 1 1 1.414 1.415l.708.707a2 2 0 0 0-2.829-2.829l-2.828 2.829.707.707Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M15.414 16.828 18.243 14a3 3 0 0 0-2.289-5.117l-.869-.869a4 4 0 0 1 3.864 6.693l-2.828 2.828-.707-.707Zm-.707 2.122a4 4 0 1 1-5.657-5.657l4.243-4.243.707.707L9.757 14A3 3 0 1 0 14 18.242l.707.708Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),dO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:[Q.jsx("path",{stroke:"#fff",d:"m15.768 7.99 4.242 4.242a5.5 5.5 0 1 1-7.778 7.778L7.99 15.768a5.5 5.5 0 1 1 7.778-7.778Z",style:{stroke:"#fff",strokeOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M16.828 16.828a1 1 0 0 0 0-1.414L14 12.586l.707-.707 2.828 2.828a2 2 0 1 1-2.828 2.828l.707-.707a1 1 0 0 0 1.414 0ZM14 15.414l-2.828-2.828a1 1 0 0 1 1.414-1.414l.707-.708a2 2 0 0 0-2.829 2.829l2.829 2.828.707-.707Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M16.828 12.586 14 9.757a3 3 0 0 0-5.117 2.289l-.869.869a4 4 0 0 1 6.693-3.864l2.828 2.828-.707.707Zm2.122.707a4 4 0 1 1-5.657 5.657L9.05 14.707 9.757 14 14 18.243A3 3 0 1 0 18.243 14l.707-.707Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),hO={"x-button-left":j7,"y-button-left":q7,"a-button-right":Y7,"b-button-right":K7,"thumbstick-left":Z7,"thumbstick-up-left":J7,"thumbstick-down-left":eO,"thumbstick-right-left":nO,"thumbstick-left-left":tO,"thumbstick-right":Q7,"thumbstick-up-right":iO,"thumbstick-down-right":rO,"thumbstick-right-right":oO,"thumbstick-left-right":sO,"trigger-left":cO,"trigger-right":uO,"squeeze-left":aO,"squeeze-right":lO,"thumbrest-left":fO,"thumbrest-right":dO},sd=({buttonName:n,handedness:e})=>{const t=`${n}-${e}`,i=hO[t];return i?Q.jsx(i,{}):Q.jsx("div",{style:{width:"28px",height:"28px"}})},pO=()=>Q.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:28,height:28,fill:"none",children:Q.jsx("path",{fill:"#fff",fillRule:"evenodd",d:"M1 11.2A5.2 5.2 0 0 1 6.2 6h15.6a5.2 5.2 0 0 1 5.2 5.2v5.2a5.2 5.2 0 0 1-5.2 5.2h-3.109c-1.149 0-2.199-.65-2.713-1.677l-.199-.398a1.733 1.733 0 0 0-1.55-.958h-.458c-.656 0-1.257.37-1.55.958l-.2.398A3.033 3.033 0 0 1 9.31 21.6H6.2A5.2 5.2 0 0 1 1 16.4v-5.2Zm9.1 2.167a2.6 2.6 0 1 1-5.2 0 2.6 2.6 0 0 1 5.2 0Zm15.538-1.426a.498.498 0 0 0 .141-.542l.002-.002a5.456 5.456 0 0 0-.347-.755l-.104-.178a5.586 5.586 0 0 0-.486-.686.502.502 0 0 0-.54-.15l-1.225.39a4.234 4.234 0 0 0-.968-.56l-.275-1.256a.497.497 0 0 0-.4-.392 5.686 5.686 0 0 0-1.871.003.497.497 0 0 0-.4.391l-.276 1.257a4.234 4.234 0 0 0-.968.559l-1.226-.39a.498.498 0 0 0-.539.15 5.586 5.586 0 0 0-.486.686l-.104.179c-.134.242-.25.492-.347.754a.498.498 0 0 0 .14.542l.953.867a4.26 4.26 0 0 0 0 1.12l-.952.867a.498.498 0 0 0-.141.541c.097.262.213.513.347.755l.104.178c.145.242.308.471.486.687.13.156.346.211.54.15l1.223-.392c.295.226.62.416.968.559l.275 1.256c.044.2.198.359.4.392a5.686 5.686 0 0 0 1.871 0 .497.497 0 0 0 .4-.392l.276-1.256c.347-.143.673-.333.968-.56l1.225.39c.194.062.41.009.54-.15a5.59 5.59 0 0 0 .486-.686l.103-.178a5.45 5.45 0 0 0 .348-.755.498.498 0 0 0-.14-.541l-.954-.867a4.258 4.258 0 0 0 0-1.118l.953-.867ZM20.5 15.967a2.6 2.6 0 1 0 0-5.2 2.6 2.6 0 0 0 0 5.2Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})}),mO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:16,fill:"none",children:[Q.jsx("g",{clipPath:"url(#a)",children:Q.jsx("path",{stroke:"#fff",d:"M.5 6.5H6m-5.5 0V5C.5 2.237 2.237.5 5 .5h1m-5.5 6V11c0 2.762 1.737 4.5 4.5 4.5h2c2.762 0 4.5-1.738 4.5-4.5V6.5M6 6.5v-6m0 6h5.5M6 .5h1c2.762 0 4.5 1.737 4.5 4.5v1.5",style:{stroke:"#fff",strokeOpacity:1}})}),Q.jsx("path",{fill:"#fff",d:"M.5 6.5H6v-6H5C2.237.5.5 2.237.5 5v1.5Z",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("defs",{children:Q.jsx("clipPath",{id:"a",children:Q.jsx("path",{fill:"#fff",d:"M0 0h12v16H0z",style:{fill:"#fff",fillOpacity:1}})})})]}),gO=()=>Q.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:16,fill:"none",children:[Q.jsx("g",{clipPath:"url(#a)",children:Q.jsx("path",{stroke:"#fff",d:"M.5 6.5H6m-5.5 0V5C.5 2.237 2.237.5 5 .5h1m-5.5 6V11c0 2.762 1.737 4.5 4.5 4.5h2c2.762 0 4.5-1.738 4.5-4.5V6.5M6 6.5v-6m0 6h5.5M6 .5h1c2.762 0 4.5 1.737 4.5 4.5v1.5",style:{stroke:"#fff",strokeOpacity:1}})}),Q.jsx("path",{fill:"#fff",d:"M11.5 6.5H6v-6h1c2.762 0 4.5 1.737 4.5 4.5v1.5Z",style:{fill:"#fff",fillOpacity:1}}),Q.jsx("defs",{children:Q.jsx("clipPath",{id:"a",children:Q.jsx("path",{fill:"#fff",d:"M0 0h12v16H0z",style:{fill:"#fff",fillOpacity:1}})})})]}),_O={prefix:"fas",iconName:"right-from-bracket",icon:[512,512,["sign-out-alt"],"f2f5","M377.9 105.9L500.7 228.7c7.2 7.2 11.3 17.1 11.3 27.3s-4.1 20.1-11.3 27.3L377.9 406.1c-6.4 6.4-15 9.9-24 9.9c-18.7 0-33.9-15.2-33.9-33.9l0-62.1-128 0c-17.7 0-32-14.3-32-32l0-64c0-17.7 14.3-32 32-32l128 0 0-62.1c0-18.7 15.2-33.9 33.9-33.9c9 0 17.6 3.6 24 9.9zM160 96L96 96c-17.7 0-32 14.3-32 32l0 256c0 17.7 14.3 32 32 32l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-64 0c-53 0-96-43-96-96L0 128C0 75 43 32 96 32l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32z"]},wy={prefix:"fas",iconName:"fingerprint",icon:[512,512,[],"f577","M48 256C48 141.1 141.1 48 256 48c63.1 0 119.6 28.1 157.8 72.5c8.6 10.1 23.8 11.2 33.8 2.6s11.2-23.8 2.6-33.8C403.3 34.6 333.7 0 256 0C114.6 0 0 114.6 0 256l0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40zm458.5-52.9c-2.7-13-15.5-21.3-28.4-18.5s-21.3 15.5-18.5 28.4c2.9 13.9 4.5 28.3 4.5 43.1l0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40c0-18.1-1.9-35.8-5.5-52.9zM256 80c-19 0-37.4 3-54.5 8.6c-15.2 5-18.7 23.7-8.3 35.9c7.1 8.3 18.8 10.8 29.4 7.9c10.6-2.9 21.8-4.4 33.4-4.4c70.7 0 128 57.3 128 128l0 24.9c0 25.2-1.5 50.3-4.4 75.3c-1.7 14.6 9.4 27.8 24.2 27.8c11.8 0 21.9-8.6 23.3-20.3c3.3-27.4 5-55 5-82.7l0-24.9c0-97.2-78.8-176-176-176zM150.7 148.7c-9.1-10.6-25.3-11.4-33.9-.4C93.7 178 80 215.4 80 256l0 24.9c0 24.2-2.6 48.4-7.8 71.9C68.8 368.4 80.1 384 96.1 384c10.5 0 19.9-7 22.2-17.3c6.4-28.1 9.7-56.8 9.7-85.8l0-24.9c0-27.2 8.5-52.4 22.9-73.1c7.2-10.4 8-24.6-.2-34.2zM256 160c-53 0-96 43-96 96l0 24.9c0 35.9-4.6 71.5-13.8 106.1c-3.8 14.3 6.7 29 21.5 29c9.5 0 17.9-6.2 20.4-15.4c10.5-39 15.9-79.2 15.9-119.7l0-24.9c0-28.7 23.3-52 52-52s52 23.3 52 52l0 24.9c0 36.3-3.5 72.4-10.4 107.9c-2.7 13.9 7.7 27.2 21.8 27.2c10.2 0 19-7 21-17c7.7-38.8 11.6-78.3 11.6-118.1l0-24.9c0-53-43-96-96-96zm24 96c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 24.9c0 59.9-11 119.3-32.5 175.2l-5.9 15.3c-4.8 12.4 1.4 26.3 13.8 31s26.3-1.4 31-13.8l5.9-15.3C267.9 411.9 280 346.7 280 280.9l0-24.9z"]},vO={prefix:"fas",iconName:"caret-right",icon:[256,512,[],"f0da","M246.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-9.2-9.2-22.9-11.9-34.9-6.9s-19.8 16.6-19.8 29.6l0 256c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l128-128z"]},xO={prefix:"fas",iconName:"caret-left",icon:[256,512,[],"f0d9","M9.4 278.6c-12.5-12.5-12.5-32.8 0-45.3l128-128c9.2-9.2 22.9-11.9 34.9-6.9s19.8 16.6 19.8 29.6l0 256c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-128-128z"]},SE={prefix:"fas",iconName:"ban",icon:[512,512,[128683,"cancel"],"f05e","M367.2 412.5L99.5 144.8C77.1 176.1 64 214.5 64 256c0 106 86 192 192 192c41.5 0 79.9-13.1 111.2-35.5zm45.3-45.3C434.9 335.9 448 297.5 448 256c0-106-86-192-192-192c-41.5 0-79.9 13.1-111.2 35.5L412.5 367.2zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256z"]},yO={prefix:"fas",iconName:"arrow-right-to-bracket",icon:[512,512,["sign-in"],"f090","M352 96l64 0c17.7 0 32 14.3 32 32l0 256c0 17.7-14.3 32-32 32l-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0c53 0 96-43 96-96l0-256c0-53-43-96-96-96l-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32zm-9.4 182.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L242.7 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l210.7 0-73.4 73.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l128-128z"]},Fb={prefix:"fas",iconName:"caret-up",icon:[320,512,[],"f0d8","M182.6 137.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8l256 0c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-128-128z"]},SO={prefix:"fas",iconName:"rotate-left",icon:[512,512,["rotate-back","rotate-backward","undo-alt"],"f2ea","M48.5 224L40 224c-13.3 0-24-10.7-24-24L16 72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2L98.6 96.6c87.6-86.5 228.7-86.2 315.8 1c87.5 87.5 87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3c-62.2-62.2-162.7-62.5-225.3-1L185 183c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8L48.5 224z"]},MO={prefix:"fas",iconName:"circle-play",icon:[512,512,[61469,"play-circle"],"f144","M0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM188.3 147.1c-7.6 4.2-12.3 12.3-12.3 20.9l0 176c0 8.7 4.7 16.7 12.3 20.9s16.8 4.1 24.3-.5l144-88c7.1-4.4 11.5-12.1 11.5-20.5s-4.4-16.1-11.5-20.5l-144-88c-7.4-4.5-16.7-4.7-24.3-.5z"]},EO={prefix:"fas",iconName:"square-arrow-up-right",icon:[448,512,["external-link-square"],"f14c","M384 32c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96C0 60.7 28.7 32 64 32l320 0zM160 144c-13.3 0-24 10.7-24 24s10.7 24 24 24l94.1 0L119 327c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l135-135L288 328c0 13.3 10.7 24 24 24s24-10.7 24-24l0-160c0-13.3-10.7-24-24-24l-152 0z"]},wO={prefix:"fas",iconName:"keyboard",icon:[576,512,[9e3],"f11c","M64 64C28.7 64 0 92.7 0 128L0 384c0 35.3 28.7 64 64 64l448 0c35.3 0 64-28.7 64-64l0-256c0-35.3-28.7-64-64-64L64 64zm16 64l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16zM64 240c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zm16 80l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16zm80-176c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zm16 80l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16zM160 336c0-8.8 7.2-16 16-16l224 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-224 0c-8.8 0-16-7.2-16-16l0-32zM272 128l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16zM256 240c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zM368 128l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16zM352 240c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zM464 128l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16zM448 240c0-8.8 7.2-16 16-16l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32zm16 80l32 0c8.8 0 16 7.2 16 16l0 32c0 8.8-7.2 16-16 16l-32 0c-8.8 0-16-7.2-16-16l0-32c0-8.8 7.2-16 16-16z"]},kb={prefix:"fas",iconName:"caret-down",icon:[320,512,[],"f0d7","M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z"]},TO={prefix:"fas",iconName:"delete-left",icon:[576,512,[9003,"backspace"],"f55a","M576 128c0-35.3-28.7-64-64-64L205.3 64c-17 0-33.3 6.7-45.3 18.7L9.4 233.4c-6 6-9.4 14.1-9.4 22.6s3.4 16.6 9.4 22.6L160 429.3c12 12 28.3 18.7 45.3 18.7L512 448c35.3 0 64-28.7 64-64l0-256zM271 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"]},ME={prefix:"fas",iconName:"angle-up",icon:[448,512,[8963],"f106","M201.4 137.4c12.5-12.5 32.8-12.5 45.3 0l160 160c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L224 205.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l160-160z"]},AO={prefix:"fas",iconName:"arrow-turn-down",icon:[384,512,["level-down"],"f149","M32 64C14.3 64 0 49.7 0 32S14.3 0 32 0l96 0c53 0 96 43 96 96l0 306.7 73.4-73.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3l-128 128c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 402.7 160 96c0-17.7-14.3-32-32-32L32 64z"]},bO={prefix:"fas",iconName:"arrows-up-down",icon:[320,512,["arrows-v"],"f07d","M182.6 9.4c-12.5-12.5-32.8-12.5-45.3 0l-96 96c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L128 109.3l0 293.5L86.6 361.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l96 96c12.5 12.5 32.8 12.5 45.3 0l96-96c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 402.7l0-293.5 41.4 41.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-96-96z"]},RO={prefix:"fas",iconName:"video",icon:[576,512,["video-camera"],"f03d","M0 128C0 92.7 28.7 64 64 64l256 0c35.3 0 64 28.7 64 64l0 256c0 35.3-28.7 64-64 64L64 448c-35.3 0-64-28.7-64-64L0 128zM559.1 99.8c10.4 5.6 16.9 16.4 16.9 28.2l0 256c0 11.8-6.5 22.6-16.9 28.2s-23 5-32.9-1.6l-96-64L416 337.1l0-17.1 0-128 0-17.1 14.2-9.5 96-64c9.8-6.5 22.4-7.2 32.9-1.6z"]},Hs={KeyA:"A",KeyB:"B",KeyC:"C",KeyD:"D",KeyE:"E",KeyF:"F",KeyG:"G",KeyH:"H",KeyI:"I",KeyJ:"J",KeyK:"K",KeyL:"L",KeyM:"M",KeyN:"N",KeyO:"O",KeyP:"P",KeyQ:"Q",KeyR:"R",KeyS:"S",KeyT:"T",KeyU:"U",KeyV:"V",KeyW:"W",KeyX:"X",KeyY:"Y",KeyZ:"Z",Digit0:"0",Digit1:"1",Digit2:"2",Digit3:"3",Digit4:"4",Digit5:"5",Digit6:"6",Digit7:"7",Digit8:"8",Digit9:"9",Tab:Q.jsx(pn,{icon:yO}),Backspace:Q.jsx(pn,{icon:TO}),Enter:Q.jsx(pn,{style:{transform:"rotate(90deg)"},icon:AO}),ShiftLeft:Q.jsx(pn,{icon:ME}),ShiftRight:Q.jsx(pn,{icon:ME}),Space:" ",ArrowUp:Q.jsx(pn,{icon:Fb}),ArrowDown:Q.jsx(pn,{icon:kb}),ArrowLeft:Q.jsx(pn,{icon:xO}),ArrowRight:Q.jsx(pn,{icon:vO}),Semicolon:";",Equal:"=",Comma:",",Minus:"-",Period:".",Slash:"/",Backquote:"`",BracketLeft:"[",Backslash:"\\",BracketRight:"]",Quote:"'",MouseLeft:Q.jsx(mO,{}),MouseRight:Q.jsx(gO,{})},CO={left:{"thumbstick-up":"KeyW","thumbstick-down":"KeyS","thumbstick-left":"KeyA","thumbstick-right":"KeyD",thumbstick:"KeyR","x-button":"KeyX","y-button":"KeyZ",trigger:"KeyQ",squeeze:"KeyE"},right:{"thumbstick-up":"ArrowUp","thumbstick-down":"ArrowDown","thumbstick-left":"ArrowLeft","thumbstick-right":"ArrowRight",thumbstick:"Slash","a-button":"Enter","b-button":"ShiftRight",trigger:"MouseLeft",squeeze:"MouseRight"}},PO=ln.div` + display: flex; + justify-content: space-between; + pointer-events: all; + position: fixed; + display: flex; + top: 40px; + left: calc(50vw - 156px); + width: 312px; +`,EE=ln.div` + display: flex; + flex-direction: column; + width: 50%; +`,wE=ln.div` + display: flex; + height: 24px; + align-items: center; + margin-bottom: 2px; +`,LO=({keyMap:n,setKeyMap:e})=>{const[t,i]=Tt.useState(null),r=(o,a)=>{i({controller:o,action:a})},s=(o,a)=>{e(l=>({...l,[o]:{...l[o],[a]:"Unmapped"}}))};return Tt.useEffect(()=>{const o=c=>{t&&Hs[c.code]&&(e(u=>({...u,[t.controller]:{...u[t.controller],[t.action]:c.code}})),i(null))},a=c=>{if(t){const u=c.button===0?"MouseLeft":c.button===2?"MouseRight":null;u&&Hs[u]&&(e(f=>({...f,[t.controller]:{...f[t.controller],[t.action]:u}})),i(null))}},l=c=>{c.preventDefault()};return window.addEventListener("keydown",o),window.addEventListener("mousedown",a),window.addEventListener("contextmenu",l),()=>{window.removeEventListener("keydown",o),window.removeEventListener("mousedown",a),window.removeEventListener("contextmenu",l)}},[t,e]),Q.jsxs(PO,{children:[Q.jsx(EE,{children:Object.keys(n.left).map(o=>Q.jsxs(wE,{children:[Q.jsx(sd,{buttonName:o==="up"?"thumbstick":o,handedness:"left"}),Q.jsxs(hu,{$reverse:!1,children:[Q.jsx(Un,{$reverse:!1,style:{width:"100px",backgroundColor:t&&t.controller==="left"&&t.action===o?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)"},onClick:()=>r("left",o),onContextMenu:a=>a.preventDefault(),children:n.left[o]}),Q.jsx(Un,{style:{width:"24px"},$reverse:!1,onClick:()=>s("left",o),onContextMenu:a=>a.preventDefault(),children:Q.jsx(id,{icon:SE})})]})]},o))}),Q.jsx(EE,{children:Object.keys(n.right).map(o=>Q.jsxs(wE,{children:[Q.jsx(sd,{buttonName:o==="up"?"thumbstick":o,handedness:"right"}),Q.jsxs(hu,{$reverse:!1,children:[Q.jsx(Un,{$reverse:!1,style:{width:"100px",backgroundColor:t&&t.controller==="right"&&t.action===o?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)"},onClick:()=>r("right",o),onContextMenu:a=>a.preventDefault(),children:n.right[o]}),Q.jsx(Un,{$reverse:!1,style:{width:"24px"},onClick:()=>s("right",o),onContextMenu:a=>a.preventDefault(),children:Q.jsx(id,{icon:SE})})]})]},o))})]})},IO=({xrController:n,buttonId:e,pointerLocked:t,mappedKey:i})=>{const r=CS(),[s,o]=Tt.useState(!1),[a,l]=Tt.useState(!1),[c,u]=Tt.useState(!1),[f,h]=Tt.useState(0),p=n.inputSource.handedness;return Tt.useEffect(()=>{const g=x=>{x.code===i&&(n.updateButtonValue(e,1),u(!0))},_=x=>{x.code===i&&(n.updateButtonValue(e,0),u(!1))},m=x=>{(i==="MouseLeft"&&x.button===0||i==="MouseRight"&&x.button===2)&&(n.updateButtonValue(e,1),u(!0))},d=x=>{(i==="MouseLeft"&&x.button===0||i==="MouseRight"&&x.button===2)&&(n.updateButtonValue(e,0),u(!1))};return t?i==="MouseLeft"||i==="MouseRight"?(window.addEventListener("mousedown",m),window.addEventListener("mouseup",d)):(window.addEventListener("keydown",g),window.addEventListener("keyup",_)):i==="MouseLeft"||i==="MouseRight"?(window.removeEventListener("mousedown",m),window.removeEventListener("mouseup",d)):(window.removeEventListener("keydown",g),window.removeEventListener("keyup",_)),()=>{i==="MouseLeft"||i==="MouseRight"?(window.removeEventListener("mousedown",m),window.removeEventListener("mouseup",d)):(window.removeEventListener("keydown",g),window.removeEventListener("keyup",_))}},[i,t,e,n]),Q.jsxs(Ub,{$reverse:p==="right",children:[Q.jsx(sd,{buttonName:e,handedness:p}),Q.jsx(hu,{$reverse:p==="right",children:t?Q.jsx(ci,{$pressed:c,children:Hs[i]}):Q.jsxs(Q.Fragment,{children:[Q.jsx(Un,{$reverse:p==="right",style:{backgroundColor:a?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"50px"},onClick:()=>{l(!0),n.updateButtonValue(e,1),setTimeout(()=>{l(!1),n.updateButtonValue(e,0)},r.buttonPressDuration)},children:"Press"}),Q.jsx(Un,{$reverse:p==="right",style:{backgroundColor:s?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"29px"},onClick:()=>{o(!s),n.updateButtonTouch(e,!s)},children:Q.jsx(pn,{icon:wy})}),Q.jsx(Ob,{$reverse:p==="right",value:f,onChange:g=>{const _=Number(g.target.value);h(_),n.updateButtonValue(e,_/100)},min:"0",max:"100"})]})})]})},DO=({xrController:n,buttonId:e,pointerLocked:t,mappedKey:i})=>{const r=CS(),[s,o]=Tt.useState(!1),[a,l]=Tt.useState(!1),[c,u]=Tt.useState(!1),[f,h]=Tt.useState(!1),p=n.inputSource.handedness;return Tt.useEffect(()=>{const g=m=>{m.code===i&&(n.updateButtonValue(e,1),h(!0))},_=m=>{m.code===i&&(n.updateButtonValue(e,0),h(!1))};return t?(window.addEventListener("keydown",g),window.addEventListener("keyup",_)):(window.removeEventListener("keydown",g),window.removeEventListener("keyup",_)),()=>{window.removeEventListener("keydown",g),window.removeEventListener("keyup",_)}},[i,t,e,n]),Q.jsxs(Ub,{$reverse:p==="right",children:[Q.jsx(sd,{buttonName:e,handedness:p}),Q.jsx(hu,{$reverse:p==="right",children:t?Q.jsx(ci,{$pressed:f,children:Hs[i]}):Q.jsxs(Q.Fragment,{children:[Q.jsx(Un,{$reverse:p==="right",style:{backgroundColor:c?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"50px"},onClick:()=>{u(!0),n.updateButtonValue(e,1),setTimeout(()=>{u(!1),n.updateButtonValue(e,0)},r.buttonPressDuration)},children:"Press"}),Q.jsx(Un,{$reverse:p==="right",style:{backgroundColor:s?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"29px"},onClick:()=>{o(!s),n.updateButtonTouch(e,!s)},children:Q.jsx(pn,{icon:wy})}),Q.jsx(Un,{$reverse:p==="right",style:{backgroundColor:a?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"49px"},onClick:()=>{l(!a),n.updateButtonValue(e,a?0:1)},children:"Hold"})]})})]})},NO=ln.div` + display: flex; + align-items: center; + margin-bottom: 2px; +`,UO=ln.button` + background-color: rgba(255, 255, 255, 0.3); + border: none; + display: flex; + justify-content: center; + align-items: center; + padding: 0; + pointer-events: none; + width: 50px; + height: 50px; + border-radius: 50%; + position: relative; + margin: 0 5px; + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); +`,OO=ln.div` + position: absolute; + background-color: white; + border-radius: 50%; + width: 36px; + height: 36px; + cursor: pointer; + pointer-events: auto; +`,TE=ln(Un)` + width: 49px; + font-size: 14px; + + ${({$reverse:n})=>n?` + &:first-child { + margin-left: 1px; + border-radius: 2px 8px 8px 2px; + } + + &:last-child { + margin-right: 1px; + border-radius: 8px 2px 2px 8px; + } + `:` + &:first-child { + margin-right: 1px; + border-radius: 8px 2px 2px 8px; + } + + &:last-child { + margin-left: 1px; + border-radius: 2px 8px 8px 2px; + } + `} +`,FO=({xrController:n,pointerLocked:e,buttonId:t,mappedKeyUp:i,mappedKeyDown:r,mappedKeyLeft:s,mappedKeyRight:o,mappedKeyPressed:a})=>{const l=CS(),c=Tt.useRef(null),[u,f]=Tt.useState(!1),[h,p]=Tt.useState(!1),[g,_]=Tt.useState(!1),[m,d]=Tt.useState(!1),[x,v]=Tt.useState({x:0,y:0}),[y,b]=Tt.useState({up:!1,down:!1,left:!1,right:!1,pressed:!1}),w=n.inputSource.handedness,T=()=>{if(c.current){const S=c.current.getBoundingClientRect();v({x:S.left+S.width/2,y:S.top+S.height/2}),f(!0)}},C=S=>{if(u&&c.current){const P=S.clientX-x.x,k=S.clientY-x.y,U=Math.sqrt(P*P+k*k),N=12;let X,z;if(U{f(!1),c.current&&(c.current.style.transform="translate(0, 0)",n.updateAxes(t,0,0))};return Tt.useEffect(()=>{const S=U=>{const N={...y};U.code===i&&(N.up=!0),U.code===r&&(N.down=!0),U.code===s&&(N.left=!0),U.code===o&&(N.right=!0),U.code===a&&(N.pressed=!0,n.updateButtonValue(t,1)),b(N),k(N)},P=U=>{const N={...y};U.code===i&&(N.up=!1),U.code===r&&(N.down=!1),U.code===s&&(N.left=!1),U.code===o&&(N.right=!1),U.code===a&&(N.pressed=!1,n.updateButtonValue(t,0)),b(N),k(N)},k=U=>{const N=(U.right?1:0)-(U.left?1:0),X=(U.down?1:0)-(U.up?1:0),z=Math.sqrt(N*N+X*X);if(z===0){n.updateAxes(t,0,0);return}const te=N/z,L=X/z;n.updateAxes(t,te,L)};return e?(window.addEventListener("keydown",S),window.addEventListener("keyup",P)):(window.removeEventListener("keydown",S),window.removeEventListener("keyup",P)),()=>{window.removeEventListener("keydown",S),window.removeEventListener("keyup",P)}},[i,r,s,o,e,y]),Tt.useEffect(()=>(document.addEventListener("mousemove",C),document.addEventListener("mouseup",M),()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",M)}),[u,x]),Q.jsxs(NO,{style:{flexDirection:n.inputSource.handedness==="left"?"row":"row-reverse",alignItems:"flex-start"},children:[Q.jsx(sd,{buttonName:"thumbstick",handedness:n.inputSource.handedness}),e?Q.jsxs(X7,{$reverse:w==="right",children:[Q.jsxs(yE,{$reverse:w==="right",children:[Q.jsx(ci,{$pressed:y.up,style:{margin:"2px"},children:Hs[i]}),Q.jsx(ci,{$pressed:y.pressed,style:{margin:"2px"},children:Hs[a]})]}),Q.jsxs(yE,{$reverse:!1,children:[Q.jsx(ci,{$pressed:y.left,style:{margin:"2px"},children:Hs[s]}),Q.jsx(ci,{$pressed:y.down,style:{margin:"2px"},children:Hs[r]}),Q.jsx(ci,{$pressed:y.right,style:{margin:"2px"},children:Hs[o]})]})]}):Q.jsxs(Q.Fragment,{children:[Q.jsx(UO,{style:{margin:n.inputSource.handedness==="left"?"0 5px 0 -3px":"0 -3px 0 5px"},children:Q.jsx(OO,{ref:c,onMouseDown:T})}),Q.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[Q.jsx(Un,{$reverse:w==="right",style:{backgroundColor:m?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"80px",marginBottom:"2px",borderRadius:"8px"},onClick:()=>{d(!0),n.updateButtonValue(t,1),setTimeout(()=>{d(!1),n.updateButtonValue(t,0)},l.buttonPressDuration)},children:"Press"}),Q.jsxs(hu,{$reverse:w==="right",children:[Q.jsx(TE,{$reverse:n.inputSource.handedness!=="left",style:{backgroundColor:h?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"29px"},onClick:()=>{p(!h),n.updateButtonTouch(t,!h)},children:Q.jsx(pn,{icon:wy})}),Q.jsx(TE,{$reverse:n.inputSource.handedness!=="left",style:{backgroundColor:g?"rgba(255, 255, 255, 0.6)":"rgba(255, 255, 255, 0.3)",width:"49px"},onClick:()=>{_(!g),n.updateButtonValue(t,g?0:1)},children:"Hold"})]})]})]})]})},kO=ln.div` + padding: ${({$reverse:n})=>n?"6px 2px 3px 5px":"6px 5px 3px 2px"}; + pointer-events: all; + background-color: rgba(43, 43, 43, 0.5); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + border-radius: ${({$reverse:n})=>n?"12px 0 0 0":"0 12px 0 0"}; +`;function BO(n){const e=new Set;for(const i of n.axes)i&&i.id&&e.add(i.id);const t=n.buttons.filter(i=>i!==null).map(i=>({id:i.id,type:i.type,hasAxes:e.has(i.id)}));return t.sort((i,r)=>i.hasAxes&&!r.hasAxes?-1:!i.hasAxes&&r.hasAxes?1:0),t}const zO=({xrDevice:n,keyMap:e,pointerLocked:t})=>Q.jsx("div",{style:{display:"flex",justifyContent:"space-between",flexDirection:"row"},children:Object.entries(n.controllers).map(([i,r])=>Q.jsx(kO,{$reverse:i!=="left",children:BO(r.gamepadConfig).map(s=>{const o=e[i];return s.hasAxes?Q.jsx(FO,{xrController:r,pointerLocked:t,buttonId:s.id,mappedKeyUp:e[i][`${s.id}-up`],mappedKeyDown:o[`${s.id}-down`],mappedKeyLeft:o[`${s.id}-left`],mappedKeyRight:o[`${s.id}-right`],mappedKeyPressed:o[s.id]},s.id):s.type==="analog"?Q.jsx(IO,{xrController:r,buttonId:s.id,mappedKey:o[s.id],pointerLocked:t},s.id):Q.jsx(DO,{xrController:r,buttonId:s.id,mappedKey:o[s.id],pointerLocked:t},s.id)})},i))}),HO=ln.div` + display: flex; + justify-content: center; + pointer-events: all; + position: fixed; + display: flex; + top: 40px; + left: calc(50vw - 156px); + width: 312px; +`,VO=({xrDevice:n,inputLayer:e})=>{const[t,i]=Tt.useState(n.fovy);return Q.jsx(HO,{children:Q.jsxs(hu,{$reverse:!1,children:[Q.jsx(Un,{$reverse:!1,disabled:!0,children:"FOV-Y"}),Q.jsx(Ob,{$reverse:!1,value:t,style:{width:"100px",borderRadius:"2px"},onChange:r=>{const s=Number(r.target.value);i(s),n.fovy=s,e.syncFovy(),e.renderScene()},min:Math.PI/6,max:Math.PI/1.5,step:Math.PI/48}),Q.jsxs(Un,{$reverse:!1,disabled:!0,children:[(t/Math.PI*180).toFixed(2),"°"]})]})})},GO=ln.div` + padding: 6px 5px; + display: flex; + background-color: rgba(43, 43, 43, 0.5); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + justify-content: center; + pointer-events: all; + border-radius: 0 0 12px 12px; + align-items: center; + height: 24px; +`,AE=ln.div` + background-color: rgba(43, 43, 43, 0.5); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + border: none; + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: center; + cursor: pointer; + color: white; + white-space: nowrap; + font-size: 14px; + text-transform: none; + box-shadow: none; + font-family: Arial, sans-serif; + border-radius: ${({$reverse:n})=>n?"0 0 0 12px":"0 0 12px 0"}; + padding: 5px; + + > div { + display: flex; + flex-direction: row; + align-items: center; + gap: 2px; + margin: 2px; + } +`,WO=({xrDevice:n,inputLayer:e,keyMapOpen:t,setKeyMapOpen:i,fovSettingOpen:r,setFovSettingOpen:s})=>Q.jsxs("div",{style:{display:"flex",justifyContent:"center"},children:[Q.jsxs(GO,{children:[Q.jsx(pO,{}),Q.jsxs("div",{style:{display:"flex",flexDirection:"row",marginLeft:"4px"},children:[Q.jsx(Un,{$reverse:!1,onClick:()=>{e.resetDeviceTransforms()},children:Q.jsx(pn,{icon:SO})}),Q.jsx(Un,{$reverse:!1,onClick:()=>{e.lockPointer(),i(!1),s(!1)},children:Q.jsx(pn,{icon:MO})}),Q.jsx(Un,{$reverse:!1,onClick:()=>{i(!t),s(!1)},children:Q.jsx(pn,{icon:wO})}),Q.jsx(Un,{$reverse:!1,onClick:()=>{s(!r),i(!1)},children:Q.jsx(pn,{icon:RO})}),Q.jsx(Un,{$reverse:!1,onClick:()=>{const o=n.activeSession;o==null||o.end()},children:Q.jsx(pn,{icon:_O})})]})]}),Q.jsxs(AE,{$reverse:!1,style:{position:"fixed",left:"0",top:"0"},children:[Q.jsxs("div",{children:[Q.jsx(pn,{icon:EO,style:{marginRight:"4px"}})," ","Roomscale Movement"]}),Q.jsxs("div",{children:[Q.jsx(ci,{$pressed:!1,style:{width:"50px"},children:"L Shift"}),Q.jsx("span",{style:{margin:"0 4px"},children:"+"}),Q.jsx(ci,{$pressed:!1,children:"W"}),Q.jsx(ci,{$pressed:!1,children:"A"}),Q.jsx(ci,{$pressed:!1,children:"S"}),Q.jsx(ci,{$pressed:!1,children:"D"})]})]}),Q.jsxs(AE,{$reverse:!0,style:{position:"fixed",right:"0",top:"0"},children:[Q.jsxs("div",{children:[Q.jsx(pn,{icon:bO,style:{marginRight:"4px"}})," Camera Height"]}),Q.jsxs("div",{children:[Q.jsx(ci,{$pressed:!1,style:{width:"50px"},children:"L Shift"}),Q.jsx("span",{style:{margin:"0 4px"},children:"+"}),Q.jsx(ci,{$pressed:!1,children:Q.jsx(pn,{icon:Fb})}),Q.jsx(ci,{$pressed:!1,children:Q.jsx(pn,{icon:kb})})]})]})]});/** + * @license + * Copyright 2010-2024 Three.js Authors + * SPDX-License-Identifier: MIT + */const Ty="168",$O=0,bE=1,XO=2,Bb=1,jO=2,Us=3,eo=0,Pi=1,is=2,Zo=0,Bc=1,RE=2,CE=3,PE=4,qO=5,Qa=100,YO=101,KO=102,ZO=103,QO=104,JO=200,eF=201,tF=202,nF=203,Kv=204,Zv=205,iF=206,rF=207,sF=208,oF=209,aF=210,lF=211,cF=212,uF=213,fF=214,dF=0,hF=1,pF=2,hm=3,mF=4,gF=5,_F=6,vF=7,zb=0,xF=1,yF=2,Qo=0,SF=1,MF=2,EF=3,wF=4,TF=5,AF=6,bF=7,Hb=300,pu=301,mu=302,Qv=303,Jv=304,h0=306,e1=1e3,nl=1001,t1=1002,dr=1003,RF=1004,Eh=1005,Nr=1006,Ag=1007,il=1008,to=1009,Vb=1010,Gb=1011,od=1012,Ay=1013,yl=1014,$s=1015,Dd=1016,by=1017,Ry=1018,gu=1020,Wb=35902,$b=1021,Xb=1022,kr=1023,jb=1024,qb=1025,zc=1026,_u=1027,Yb=1028,Cy=1029,Kb=1030,Py=1031,Ly=1033,Dp=33776,Np=33777,Up=33778,Op=33779,n1=35840,i1=35841,r1=35842,s1=35843,o1=36196,a1=37492,l1=37496,c1=37808,u1=37809,f1=37810,d1=37811,h1=37812,p1=37813,m1=37814,g1=37815,_1=37816,v1=37817,x1=37818,y1=37819,S1=37820,M1=37821,Fp=36492,E1=36494,w1=36495,Zb=36283,T1=36284,A1=36285,b1=36286,CF=3200,PF=3201,LF=0,IF=1,zo="",Jr="srgb",ga="srgb-linear",Iy="display-p3",p0="display-p3-linear",pm="linear",$t="srgb",mm="rec709",gm="p3",ql=7680,LE=519,DF=512,NF=513,UF=514,Qb=515,OF=516,FF=517,kF=518,BF=519,IE=35044,DE="300 es",Xs=2e3,_m=2001;class Iu{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){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s>8&255]+jn[n>>16&255]+jn[n>>24&255]+"-"+jn[e&255]+jn[e>>8&255]+"-"+jn[e>>16&15|64]+jn[e>>24&255]+"-"+jn[t&63|128]+jn[t>>8&255]+"-"+jn[t>>16&255]+jn[t>>24&255]+jn[i&255]+jn[i>>8&255]+jn[i>>16&255]+jn[i>>24&255]).toLowerCase()}function wi(n,e,t){return Math.max(e,Math.min(t,n))}function zF(n,e){return(n%e+e)%e}function Rg(n,e,t){return(1-t)*n+t*e}function Yu(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 Si(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 At{constructor(e=0,t=0){At.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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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(wi(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,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class _t{constructor(e,t,i,r,s,o,a,l,c){_t.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=o,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,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],f=i[7],h=i[2],p=i[5],g=i[8],_=r[0],m=r[3],d=r[6],x=r[1],v=r[4],y=r[7],b=r[2],w=r[5],T=r[8];return s[0]=o*_+a*x+l*b,s[3]=o*m+a*v+l*w,s[6]=o*d+a*y+l*T,s[1]=c*_+u*x+f*b,s[4]=c*m+u*v+f*w,s[7]=c*d+u*y+f*T,s[2]=h*_+p*x+g*b,s[5]=h*m+p*v+g*w,s[8]=h*d+p*y+g*T,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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*s*u+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,h=a*l-u*s,p=c*s-o*l,g=t*f+i*h+r*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=f*_,e[1]=(r*c-u*i)*_,e[2]=(a*i-r*o)*_,e[3]=h*_,e[4]=(u*t-r*l)*_,e[5]=(r*s-a*t)*_,e[6]=p*_,e[7]=(i*l-c*t)*_,e[8]=(o*t-i*s)*_,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,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Cg.makeScale(e,t)),this}rotate(e){return this.premultiply(Cg.makeRotation(-e)),this}translate(e,t){return this.premultiply(Cg.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 Cg=new _t;function Jb(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function vm(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function HF(){const n=vm("canvas");return n.style.display="block",n}const NE={};function Ff(n){n in NE||(NE[n]=!0,console.warn(n))}function VF(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 UE=new _t().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),OE=new _t().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ku={[ga]:{transfer:pm,primaries:mm,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n,fromReference:n=>n},[Jr]:{transfer:$t,primaries:mm,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[p0]:{transfer:pm,primaries:gm,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.applyMatrix3(OE),fromReference:n=>n.applyMatrix3(UE)},[Iy]:{transfer:$t,primaries:gm,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.convertSRGBToLinear().applyMatrix3(OE),fromReference:n=>n.applyMatrix3(UE).convertLinearToSRGB()}},GF=new Set([ga,p0]),Lt={enabled:!0,_workingColorSpace:ga,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!GF.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=Ku[e].toReference,r=Ku[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Ku[n].primaries},getTransfer:function(n){return n===zo?pm:Ku[n].transfer},getLuminanceCoefficients:function(n,e=this._workingColorSpace){return n.fromArray(Ku[e].luminanceCoefficients)}};function Hc(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Pg(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let Yl;class WF{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Yl===void 0&&(Yl=vm("canvas")),Yl.width=e.width,Yl.height=e.height;const i=Yl.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Yl}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=vm("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 o=0;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Hb)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case e1:e.x=e.x-Math.floor(e.x);break;case nl:e.x=e.x<0?0:1;break;case t1: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 e1:e.y=e.y-Math.floor(e.y);break;case nl:e.y=e.y<0?0:1;break;case t1: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++}}Li.DEFAULT_IMAGE=null;Li.DEFAULT_MAPPING=Hb;Li.DEFAULT_ANISOTROPY=1;class On{constructor(e=0,t=0,i=0,r=1){On.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,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,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],f=l[8],h=l[1],p=l[5],g=l[9],_=l[2],m=l[6],d=l[10];if(Math.abs(u-h)<.01&&Math.abs(f-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+p+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const v=(c+1)/2,y=(p+1)/2,b=(d+1)/2,w=(u+h)/4,T=(f+_)/4,C=(g+m)/4;return v>y&&v>b?v<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(v),r=w/i,s=T/i):y>b?y<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(y),i=w/r,s=C/r):b<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(b),i=T/s,r=C/s),this.set(i,r,s,t),this}let x=Math.sqrt((m-g)*(m-g)+(f-_)*(f-_)+(h-u)*(h-u));return Math.abs(x)<.001&&(x=1),this.x=(m-g)/x,this.y=(f-_)/x,this.z=(h-u)/x,this.w=Math.acos((c+p+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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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 jF extends Iu{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new On(0,0,e,t),this.scissorTest=!1,this.viewport=new On(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Nr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new Li(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a=0?1:-1,v=1-d*d;if(v>Number.EPSILON){const b=Math.sqrt(v),w=Math.atan2(b,d*x);m=Math.sin(m*w)/b,a=Math.sin(a*w)/b}const y=a*x;if(l=l*m+h*y,c=c*m+p*y,u=u*m+g*y,f=f*m+_*y,m===1-a){const b=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=b,c*=b,u*=b,f*=b}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],f=s[o],h=s[o+1],p=s[o+2],g=s[o+3];return e[t]=a*g+u*f+l*p-c*h,e[t+1]=l*g+u*h+c*f-a*p,e[t+2]=c*g+u*p+a*h-l*f,e[t+3]=u*g-a*f-l*h-c*p,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,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),f=a(s/2),h=l(i/2),p=l(r/2),g=l(s/2);switch(o){case"XYZ":this._x=h*u*f+c*p*g,this._y=c*p*f-h*u*g,this._z=c*u*g+h*p*f,this._w=c*u*f-h*p*g;break;case"YXZ":this._x=h*u*f+c*p*g,this._y=c*p*f-h*u*g,this._z=c*u*g-h*p*f,this._w=c*u*f+h*p*g;break;case"ZXY":this._x=h*u*f-c*p*g,this._y=c*p*f+h*u*g,this._z=c*u*g+h*p*f,this._w=c*u*f-h*p*g;break;case"ZYX":this._x=h*u*f-c*p*g,this._y=c*p*f+h*u*g,this._z=c*u*g-h*p*f,this._w=c*u*f+h*p*g;break;case"YZX":this._x=h*u*f+c*p*g,this._y=c*p*f+h*u*g,this._z=c*u*g-h*p*f,this._w=c*u*f-h*p*g;break;case"XZY":this._x=h*u*f-c*p*g,this._y=c*p*f-h*u*g,this._z=c*u*g+h*p*f,this._w=c*u*f+h*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}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],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],h=i+a+f;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(o-r)*p}else if(i>a&&i>f){const p=2*Math.sqrt(1+i-a-f);this._w=(u-l)/p,this._x=.25*p,this._y=(r+o)/p,this._z=(s+c)/p}else if(a>f){const p=2*Math.sqrt(1+a-i-f);this._w=(s-c)/p,this._x=(r+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+f-i-a);this._w=(o-r)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.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(wi(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,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),f=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=o*f+this._w*h,this._x=i*f+this._x*h,this._y=r*f+this._y*h,this._z=s*f+this._z*h,this._onChangeCallback(),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 ne{constructor(e=0,t=0,i=0){ne.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(FE.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(FE.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,o=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])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),u=2*(a*t-s*r),f=2*(s*i-o*t);return this.x=t+l*c+o*f-a*u,this.y=i+l*u+a*c-s*f,this.z=r+l*f+s*u-o*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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,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 Ig.copy(this).projectOnVector(e),this.sub(Ig)}reflect(e){return this.sub(Ig.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(wi(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 Ig=new ne,FE=new zn;class Ud{constructor(e=new ne(1/0,1/0,1/0),t=new ne(-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=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,Tr),Tr.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(Zu),Th.subVectors(this.max,Zu),Kl.subVectors(e.a,Zu),Zl.subVectors(e.b,Zu),Ql.subVectors(e.c,Zu),Mo.subVectors(Zl,Kl),Eo.subVectors(Ql,Zl),Ia.subVectors(Kl,Ql);let t=[0,-Mo.z,Mo.y,0,-Eo.z,Eo.y,0,-Ia.z,Ia.y,Mo.z,0,-Mo.x,Eo.z,0,-Eo.x,Ia.z,0,-Ia.x,-Mo.y,Mo.x,0,-Eo.y,Eo.x,0,-Ia.y,Ia.x,0];return!Dg(t,Kl,Zl,Ql,Th)||(t=[1,0,0,0,1,0,0,0,1],!Dg(t,Kl,Zl,Ql,Th))?!1:(Ah.crossVectors(Mo,Eo),t=[Ah.x,Ah.y,Ah.z],Dg(t,Kl,Zl,Ql,Th))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Tr).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Tr).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:(Cs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Cs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Cs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Cs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Cs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Cs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Cs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Cs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Cs),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)}}const Cs=[new ne,new ne,new ne,new ne,new ne,new ne,new ne,new ne],Tr=new ne,wh=new Ud,Kl=new ne,Zl=new ne,Ql=new ne,Mo=new ne,Eo=new ne,Ia=new ne,Zu=new ne,Th=new ne,Ah=new ne,Da=new ne;function Dg(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Da.fromArray(n,s);const a=r.x*Math.abs(Da.x)+r.y*Math.abs(Da.y)+r.z*Math.abs(Da.z),l=e.dot(Da),c=t.dot(Da),u=i.dot(Da);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const YF=new Ud,Qu=new ne,Ng=new ne;class m0{constructor(e=new ne,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):YF.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;sthis.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;Qu.subVectors(e,this.center);const t=Qu.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Qu,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):(Ng.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Qu.copy(e.center).add(Ng)),this.expandByPoint(Qu.copy(e.center).sub(Ng))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ps=new ne,Ug=new ne,bh=new ne,wo=new ne,Og=new ne,Rh=new ne,Fg=new ne;class Dy{constructor(e=new ne,t=new ne(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,Ps)),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=Ps.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ps.copy(this.origin).addScaledVector(this.direction,t),Ps.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){Ug.copy(e).add(t).multiplyScalar(.5),bh.copy(t).sub(e).normalize(),wo.copy(this.origin).sub(Ug);const s=e.distanceTo(t)*.5,o=-this.direction.dot(bh),a=wo.dot(this.direction),l=-wo.dot(bh),c=wo.lengthSq(),u=Math.abs(1-o*o);let f,h,p,g;if(u>0)if(f=o*l-a,h=o*a-l,g=s*u,f>=0)if(h>=-g)if(h<=g){const _=1/u;f*=_,h*=_,p=f*(f+o*h+2*a)+h*(o*f+h+2*l)+c}else h=s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h=-s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h<=-g?(f=Math.max(0,-(-o*s+a)),h=f>0?-s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c):h<=g?(f=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(f=Math.max(0,-(o*s+a)),h=f>0?s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c);else h=o>0?-s:s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,f),r&&r.copy(Ug).addScaledVector(bh,h),p}intersectSphere(e,t){Ps.subVectors(e.center,this.origin);const i=Ps.dot(this.direction),r=Ps.dot(Ps)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return 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,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,f=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,o=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o=0?(a=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),i>l||a>r)||((a>i||i!==i)&&(i=a),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,Ps)!==null}intersectTriangle(e,t,i,r,s){Og.subVectors(t,e),Rh.subVectors(i,e),Fg.crossVectors(Og,Rh);let o=this.direction.dot(Fg),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;wo.subVectors(this.origin,e);const l=a*this.direction.dot(Rh.crossVectors(wo,Rh));if(l<0)return null;const c=a*this.direction.dot(Og.cross(wo));if(c<0||l+c>o)return null;const u=-a*wo.dot(Fg);return u<0?null:this.at(u/o,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 sn{constructor(e,t,i,r,s,o,a,l,c,u,f,h,p,g,_,m){sn.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,o,a,l,c,u,f,h,p,g,_,m)}set(e,t,i,r,s,o,a,l,c,u,f,h,p,g,_,m){const d=this.elements;return d[0]=e,d[4]=t,d[8]=i,d[12]=r,d[1]=s,d[5]=o,d[9]=a,d[13]=l,d[2]=c,d[6]=u,d[10]=f,d[14]=h,d[3]=p,d[7]=g,d[11]=_,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 sn().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 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){const t=this.elements,i=e.elements,r=1/Jl.setFromMatrixColumn(e,0).length(),s=1/Jl.setFromMatrixColumn(e,1).length(),o=1/Jl.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]*o,t[9]=i[9]*o,t[10]=i[10]*o,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,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=o*u,p=o*f,g=a*u,_=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=p+g*c,t[5]=h-_*c,t[9]=-a*l,t[2]=_-h*c,t[6]=g+p*c,t[10]=o*l}else if(e.order==="YXZ"){const h=l*u,p=l*f,g=c*u,_=c*f;t[0]=h+_*a,t[4]=g*a-p,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=p*a-g,t[6]=_+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*u,p=l*f,g=c*u,_=c*f;t[0]=h-_*a,t[4]=-o*f,t[8]=g+p*a,t[1]=p+g*a,t[5]=o*u,t[9]=_-h*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*u,p=o*f,g=a*u,_=a*f;t[0]=l*u,t[4]=g*c-p,t[8]=h*c+_,t[1]=l*f,t[5]=_*c+h,t[9]=p*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,p=o*c,g=a*l,_=a*c;t[0]=l*u,t[4]=_-h*f,t[8]=g*f+p,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*f+g,t[10]=h-_*f}else if(e.order==="XZY"){const h=o*l,p=o*c,g=a*l,_=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=h*f+_,t[5]=o*u,t[9]=p*f-g,t[2]=g*f-p,t[6]=a*u,t[10]=_*f+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(KF,e,ZF)}lookAt(e,t,i){const r=this.elements;return zi.subVectors(e,t),zi.lengthSq()===0&&(zi.z=1),zi.normalize(),To.crossVectors(i,zi),To.lengthSq()===0&&(Math.abs(i.z)===1?zi.x+=1e-4:zi.z+=1e-4,zi.normalize(),To.crossVectors(i,zi)),To.normalize(),Ch.crossVectors(zi,To),r[0]=To.x,r[4]=Ch.x,r[8]=zi.x,r[1]=To.y,r[5]=Ch.y,r[9]=zi.y,r[2]=To.z,r[6]=Ch.z,r[10]=zi.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,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],f=i[5],h=i[9],p=i[13],g=i[2],_=i[6],m=i[10],d=i[14],x=i[3],v=i[7],y=i[11],b=i[15],w=r[0],T=r[4],C=r[8],M=r[12],S=r[1],P=r[5],k=r[9],U=r[13],N=r[2],X=r[6],z=r[10],te=r[14],L=r[3],Z=r[7],ae=r[11],fe=r[15];return s[0]=o*w+a*S+l*N+c*L,s[4]=o*T+a*P+l*X+c*Z,s[8]=o*C+a*k+l*z+c*ae,s[12]=o*M+a*U+l*te+c*fe,s[1]=u*w+f*S+h*N+p*L,s[5]=u*T+f*P+h*X+p*Z,s[9]=u*C+f*k+h*z+p*ae,s[13]=u*M+f*U+h*te+p*fe,s[2]=g*w+_*S+m*N+d*L,s[6]=g*T+_*P+m*X+d*Z,s[10]=g*C+_*k+m*z+d*ae,s[14]=g*M+_*U+m*te+d*fe,s[3]=x*w+v*S+y*N+b*L,s[7]=x*T+v*P+y*X+b*Z,s[11]=x*C+v*k+y*z+b*ae,s[15]=x*M+v*U+y*te+b*fe,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],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],h=e[10],p=e[14],g=e[3],_=e[7],m=e[11],d=e[15];return g*(+s*l*f-r*c*f-s*a*h+i*c*h+r*a*p-i*l*p)+_*(+t*l*p-t*c*h+s*o*h-r*o*p+r*c*u-s*l*u)+m*(+t*c*f-t*a*p-s*o*f+i*o*p+s*a*u-i*c*u)+d*(-r*a*u-t*l*f+t*a*h+r*o*f-i*o*h+i*l*u)}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],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],h=e[10],p=e[11],g=e[12],_=e[13],m=e[14],d=e[15],x=f*m*c-_*h*c+_*l*p-a*m*p-f*l*d+a*h*d,v=g*h*c-u*m*c-g*l*p+o*m*p+u*l*d-o*h*d,y=u*_*c-g*f*c+g*a*p-o*_*p-u*a*d+o*f*d,b=g*f*l-u*_*l-g*a*h+o*_*h+u*a*m-o*f*m,w=t*x+i*v+r*y+s*b;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/w;return e[0]=x*T,e[1]=(_*h*s-f*m*s-_*r*p+i*m*p+f*r*d-i*h*d)*T,e[2]=(a*m*s-_*l*s+_*r*c-i*m*c-a*r*d+i*l*d)*T,e[3]=(f*l*s-a*h*s-f*r*c+i*h*c+a*r*p-i*l*p)*T,e[4]=v*T,e[5]=(u*m*s-g*h*s+g*r*p-t*m*p-u*r*d+t*h*d)*T,e[6]=(g*l*s-o*m*s-g*r*c+t*m*c+o*r*d-t*l*d)*T,e[7]=(o*h*s-u*l*s+u*r*c-t*h*c-o*r*p+t*l*p)*T,e[8]=y*T,e[9]=(g*f*s-u*_*s-g*i*p+t*_*p+u*i*d-t*f*d)*T,e[10]=(o*_*s-g*a*s+g*i*c-t*_*c-o*i*d+t*a*d)*T,e[11]=(u*a*s-o*f*s-u*i*c+t*f*c+o*i*p-t*a*p)*T,e[12]=b*T,e[13]=(u*_*r-g*f*r+g*i*h-t*_*h-u*i*m+t*f*m)*T,e[14]=(g*a*r-o*_*r-g*i*l+t*_*l+o*i*m-t*a*m)*T,e[15]=(o*f*r-u*a*r+u*i*l-t*f*l-o*i*h+t*a*h)*T,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,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,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,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,h=s*c,p=s*u,g=s*f,_=o*u,m=o*f,d=a*f,x=l*c,v=l*u,y=l*f,b=i.x,w=i.y,T=i.z;return r[0]=(1-(_+d))*b,r[1]=(p+y)*b,r[2]=(g-v)*b,r[3]=0,r[4]=(p-y)*w,r[5]=(1-(h+d))*w,r[6]=(m+x)*w,r[7]=0,r[8]=(g+v)*T,r[9]=(m-x)*T,r[10]=(1-(h+_))*T,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;let s=Jl.set(r[0],r[1],r[2]).length();const o=Jl.set(r[4],r[5],r[6]).length(),a=Jl.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Ar.copy(this);const c=1/s,u=1/o,f=1/a;return Ar.elements[0]*=c,Ar.elements[1]*=c,Ar.elements[2]*=c,Ar.elements[4]*=u,Ar.elements[5]*=u,Ar.elements[6]*=u,Ar.elements[8]*=f,Ar.elements[9]*=f,Ar.elements[10]*=f,t.setFromRotationMatrix(Ar),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Xs){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),f=(t+e)/(t-e),h=(i+r)/(i-r);let p,g;if(a===Xs)p=-(o+s)/(o-s),g=-2*o*s/(o-s);else if(a===_m)p=-o/(o-s),g=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Xs){const l=this.elements,c=1/(t-e),u=1/(i-r),f=1/(o-s),h=(t+e)*c,p=(i+r)*u;let g,_;if(a===Xs)g=(o+s)*f,_=-2*f;else if(a===_m)g=s*f,_=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=_,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[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 Jl=new ne,Ar=new sn,KF=new ne(0,0,0),ZF=new ne(1,1,1),To=new ne,Ch=new ne,zi=new ne,kE=new sn,BE=new zn;class ps{constructor(e=0,t=0,i=0,r=ps.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],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],f=r[2],h=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(wi(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-wi(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(wi(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-wi(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(wi(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-wi(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return kE.makeRotationFromQuaternion(e),this.setFromRotationMatrix(kE,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return BE.setFromEuler(this),this.setFromQuaternion(BE,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}}ps.DEFAULT_ORDER="XYZ";class Ny{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),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.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?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 a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),f.length>0&&(i.shapes=f),h.length>0&&(i.skeletons=h),p.length>0&&(i.animations=p),g.length>0&&(i.nodes=g)}return i.object=r,i;function o(a){const l=[];for(const c in a){const u=a[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),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){br.subVectors(r,t),Is.subVectors(i,t),Bg.subVectors(e,t);const o=br.dot(br),a=br.dot(Is),l=br.dot(Bg),c=Is.dot(Is),u=Is.dot(Bg),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const h=1/f,p=(c*l-a*u)*h,g=(o*u-a*l)*h;return s.set(1-p-g,g,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,Ds)===null?!1:Ds.x>=0&&Ds.y>=0&&Ds.x+Ds.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,Ds)===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,Ds.x),l.addScaledVector(o,Ds.y),l.addScaledVector(a,Ds.z),l)}static isFrontFacing(e,t,i,r){return br.subVectors(i,t),Is.subVectors(e,t),br.cross(Is).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 br.subVectors(this.c,this.b),Is.subVectors(this.a,this.b),br.cross(Is).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return rs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return rs.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return rs.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return rs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return rs.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 o,a;nc.subVectors(r,i),ic.subVectors(s,i),zg.subVectors(e,i);const l=nc.dot(zg),c=ic.dot(zg);if(l<=0&&c<=0)return t.copy(i);Hg.subVectors(e,r);const u=nc.dot(Hg),f=ic.dot(Hg);if(u>=0&&f<=u)return t.copy(r);const h=l*f-u*c;if(h<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(nc,o);Vg.subVectors(e,s);const p=nc.dot(Vg),g=ic.dot(Vg);if(g>=0&&p<=g)return t.copy(s);const _=p*c-l*g;if(_<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(i).addScaledVector(ic,a);const m=u*g-p*f;if(m<=0&&f-u>=0&&p-g>=0)return $E.subVectors(s,r),a=(f-u)/(f-u+(p-g)),t.copy(r).addScaledVector($E,a);const d=1/(m+_+h);return o=_*d,a=h*d,t.copy(i).addScaledVector(nc,o).addScaledVector(ic,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const nR={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},Ao={h:0,s:0,l:0},Lh={h:0,s:0,l:0};function Gg(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 Ut{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=Jr){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Lt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Lt.workingColorSpace){return this.r=e,this.g=t,this.b=i,Lt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Lt.workingColorSpace){if(e=zF(e,1),t=wi(t,0,1),i=wi(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=Gg(o,s,e+1/3),this.g=Gg(o,s,e),this.b=Gg(o,s,e-1/3)}return Lt.toWorkingColorSpace(this,r),this}setStyle(e,t=Jr){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))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(a))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(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Jr){const i=nR[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.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=Hc(e.r),this.g=Hc(e.g),this.b=Hc(e.b),this}copyLinearToSRGB(e){return this.r=Pg(e.r),this.g=Pg(e.g),this.b=Pg(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Jr){return Lt.fromWorkingColorSpace(qn.copy(this),e),Math.round(wi(qn.r*255,0,255))*65536+Math.round(wi(qn.g*255,0,255))*256+Math.round(wi(qn.b*255,0,255))}getHexString(e=Jr){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Lt.workingColorSpace){Lt.fromWorkingColorSpace(qn.copy(this),t);const i=qn.r,r=qn.g,s=qn.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case i:l=(r-s)/f+(r0!=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){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.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.6,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.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!==Bc&&(i.blending=this.blending),this.side!==eo&&(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!==Kv&&(i.blendSrc=this.blendSrc),this.blendDst!==Zv&&(i.blendDst=this.blendDst),this.blendEquation!==Qa&&(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!==hm&&(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!==LE&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ql&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ql&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ql&&(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.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 o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}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.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++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Fd extends Od{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ut(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 ps,this.combine=zb,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 _n=new ne,Ih=new At;class us{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=IE,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=$s,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return Ff("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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;r0&&(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 f=0,h=c.length;f0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),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(t));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=[],f=s[c];for(let h=0,p=f.length;h0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(XE.copy(s).invert(),Na.copy(e.ray).applyMatrix4(XE),!(i.boundingBox!==null&&Na.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Na)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,f=s.attributes.normal,h=s.groups,p=s.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,_=h.length;g<_;g++){const m=h[g],d=o[m.materialIndex],x=Math.max(m.start,p.start),v=Math.min(a.count,Math.min(m.start+m.count,p.start+p.count));for(let y=x,b=v;yt.far?null:{distance:c,point:Bh.clone(),object:n}}function zh(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,sc),n.getVertexPosition(l,oc),n.getVertexPosition(c,ac);const u=rk(n,e,t,i,sc,oc,ac,kh);if(u){r&&(Uh.fromBufferAttribute(r,a),Oh.fromBufferAttribute(r,l),Fh.fromBufferAttribute(r,c),u.uv=rs.getInterpolation(kh,sc,oc,ac,Uh,Oh,Fh,new At)),s&&(Uh.fromBufferAttribute(s,a),Oh.fromBufferAttribute(s,l),Fh.fromBufferAttribute(s,c),u.uv1=rs.getInterpolation(kh,sc,oc,ac,Uh,Oh,Fh,new At)),o&&(qE.fromBufferAttribute(o,a),YE.fromBufferAttribute(o,l),KE.fromBufferAttribute(o,c),u.normal=rs.getInterpolation(kh,sc,oc,ac,qE,YE,KE,new ne),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const f={a,b:l,c,normal:new ne,materialIndex:0};rs.getNormal(sc,oc,ac,f.normal),u.face=f}return u}class hn extends gi{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],f=[];let h=0,p=0;g("z","y","x",-1,-1,i,t,e,o,s,0),g("z","y","x",1,-1,i,t,-e,o,s,1),g("x","z","y",1,1,e,i,t,r,o,2),g("x","z","y",1,-1,e,i,-t,r,o,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 Yt(c,3)),this.setAttribute("normal",new Yt(u,3)),this.setAttribute("uv",new Yt(f,2));function g(_,m,d,x,v,y,b,w,T,C,M){const S=y/T,P=b/C,k=y/2,U=b/2,N=w/2,X=T+1,z=C+1;let te=0,L=0;const Z=new ne;for(let ae=0;ae0?1:-1,u.push(Z.x,Z.y,Z.z),f.push(Me/T),f.push(1-ae/C),te+=1}}for(let ae=0;ae0&&(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 oR extends Vn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new sn,this.projectionMatrix=new sn,this.projectionMatrixInverse=new sn,this.coordinateSystem=Xs}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.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const bo=new ne,ZE=new At,QE=new At;class lr extends oR{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=R1*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(bg*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return R1*2*Math.atan(Math.tan(bg*.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){bo.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(bo.x,bo.y).multiplyScalar(-e/bo.z),bo.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(bo.x,bo.y).multiplyScalar(-e/bo.z)}getViewSize(e,t){return this.getViewBounds(e,ZE,QE),t.subVectors(QE,ZE)}setViewOffset(e,t,i,r,s,o){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=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(bg*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),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}}const lc=-90,cc=1;class ck extends Vn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new lr(lc,cc,e,t);r.layers=this.layers,this.add(r);const s=new lr(lc,cc,e,t);s.layers=this.layers,this.add(s);const o=new lr(lc,cc,e,t);o.layers=this.layers,this.add(o);const a=new lr(lc,cc,e,t);a.layers=this.layers,this.add(a);const l=new lr(lc,cc,e,t);l.layers=this.layers,this.add(l);const c=new lr(lc,cc,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Xs)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),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===_m)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),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.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,o,a,l,c,u]=this.children,f=e.getRenderTarget(),h=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=_,e.setRenderTarget(i,5,r),e.render(t,u),e.setRenderTarget(f,h,p),e.xr.enabled=g,i.texture.needsPMREMUpdate=!0}}class aR extends Li{constructor(e,t,i,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:pu,super(e,t,i,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class uk extends Sl{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 aR(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Nr}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:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},r=new hn(5,5,5),s=new ha({name:"CubemapFromEquirect",uniforms:vu(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Pi,blending:Zo});s.uniforms.tEquirect.value=t;const o=new Xe(r,s),a=t.minFilter;return t.minFilter===il&&(t.minFilter=Nr),new ck(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const Xg=new ne,fk=new ne,dk=new _t;class Wa{constructor(e=new ne(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=Xg.subVectors(i,t).cross(fk.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(Xg),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||dk.getNormalMatrix(e),r=this.coplanarPoint(Xg).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 Ua=new m0,Hh=new ne;class lR{constructor(e=new Wa,t=new Wa,i=new Wa,r=new Wa,s=new Wa,o=new Wa){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),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=Xs){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],f=r[6],h=r[7],p=r[8],g=r[9],_=r[10],m=r[11],d=r[12],x=r[13],v=r[14],y=r[15];if(i[0].setComponents(l-s,h-c,m-p,y-d).normalize(),i[1].setComponents(l+s,h+c,m+p,y+d).normalize(),i[2].setComponents(l+o,h+u,m+g,y+x).normalize(),i[3].setComponents(l-o,h-u,m-g,y-x).normalize(),i[4].setComponents(l-a,h-f,m-_,y-v).normalize(),t===Xs)i[5].setComponents(l+a,h+f,m+_,y+v).normalize();else if(t===_m)i[5].setComponents(a,f,_,v).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(),Ua.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ua.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ua)}intersectsSprite(e){return Ua.center.set(0,0,0),Ua.radius=.7071067811865476,Ua.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ua)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,Hh.y=r.normal.y>0?e.max.y:e.min.y,Hh.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Hh)<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)}}function cR(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),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 hk(n){const e=new WeakMap;function t(a,l){const c=a.array,u=a.usage,f=c.byteLength,h=n.createBuffer();n.bindBuffer(l,h),n.bufferData(l,c,u),a.onUploadCallback();let p;if(c instanceof Float32Array)p=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?p=n.HALF_FLOAT:p=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=n.SHORT;else if(c instanceof Uint32Array)p=n.UNSIGNED_INT;else if(c instanceof Int32Array)p=n.INT;else if(c instanceof Int8Array)p=n.BYTE;else if(c instanceof Uint8Array)p=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function i(a,l,c){const u=l.array,f=l._updateRange,h=l.updateRanges;if(n.bindBuffer(c,a),f.count===-1&&h.length===0&&n.bufferSubData(c,0,u),h.length!==0){for(let p=0,g=h.length;p 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,Pk=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,Lk=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,Ik=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,Dk=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,Nk=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,Uk=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec3 vColor; +#endif`,Ok=`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif +#ifdef USE_BATCHING_COLOR + vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); + vColor.xyz *= batchingColor.xyz; +#endif`,Fk=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,kk=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,Bk=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,zk=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,Hk=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,Vk=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,Gk=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,Wk="gl_FragColor = linearToOutputTexel( gl_FragColor );",$k=` +const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( + vec3( 0.8224621, 0.177538, 0.0 ), + vec3( 0.0331941, 0.9668058, 0.0 ), + vec3( 0.0170827, 0.0723974, 0.9105199 ) +); +const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( + vec3( 1.2249401, - 0.2249404, 0.0 ), + vec3( - 0.0420569, 1.0420571, 0.0 ), + vec3( - 0.0196376, - 0.0786361, 1.0982735 ) +); +vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { + return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); +} +vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { + return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); +} +vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferOETF( in vec4 value ) { + 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 ); +}`,Xk=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,jk=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,qk=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,Yk=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,Kk=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,Zk=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,Qk=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,Jk=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,eB=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,tB=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,nB=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,iB=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,rB=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,sB=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,oB=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,aB=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,lB=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,cB=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,uB=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,fB=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,dB=`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return saturate(v); + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); +} +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + vec4 r = roughness * c0 + c1; + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + return fab; +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,hB=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,pB=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,mB=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,gB=`#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,_B=`#if defined( USE_LOGDEPTHBUF ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,vB=`#ifdef USE_LOGDEPTHBUF + varying float vFragDepth; + varying float vIsPerspective; +#endif`,xB=`#ifdef USE_LOGDEPTHBUF + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,yB=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); + + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,SB=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,MB=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,EB=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,wB=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,TB=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,AB=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,bB=`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,RB=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,CB=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,PB=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,LB=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,IB=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,DB=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,NB=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,UB=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,OB=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,FB=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,kB=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,BB=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,zB=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,HB=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,VB=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + return depth * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * depth - far ); +}`,GB=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,WB=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,$B=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,XB=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,jB=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,qB=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,YB=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + + float lightToPositionLength = length( lightToPosition ); + if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { + float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + shadow = ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } +#endif`,KB=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,ZB=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,QB=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,JB=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,ez=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,tz=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,nz=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,iz=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,rz=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,sz=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,oz=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,az=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,lz=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + + #else + + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,cz=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,uz=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,fz=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,dz=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const hz=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,pz=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,mz=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,gz=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,_z=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,vz=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,xz=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,yz=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,Sz=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,Mz=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,Ez=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,wz=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,Tz=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,Az=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,bz=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,Rz=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,Cz=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,Pz=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,Lz=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,Iz=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,Dz=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,Nz=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,Uz=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,Oz=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,Fz=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,kz=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,Bz=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,zz=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,Hz=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,Vz=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,Gz=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,Wz=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,$z=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,Xz=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,mt={alphahash_fragment:pk,alphahash_pars_fragment:mk,alphamap_fragment:gk,alphamap_pars_fragment:_k,alphatest_fragment:vk,alphatest_pars_fragment:xk,aomap_fragment:yk,aomap_pars_fragment:Sk,batching_pars_vertex:Mk,batching_vertex:Ek,begin_vertex:wk,beginnormal_vertex:Tk,bsdfs:Ak,iridescence_fragment:bk,bumpmap_pars_fragment:Rk,clipping_planes_fragment:Ck,clipping_planes_pars_fragment:Pk,clipping_planes_pars_vertex:Lk,clipping_planes_vertex:Ik,color_fragment:Dk,color_pars_fragment:Nk,color_pars_vertex:Uk,color_vertex:Ok,common:Fk,cube_uv_reflection_fragment:kk,defaultnormal_vertex:Bk,displacementmap_pars_vertex:zk,displacementmap_vertex:Hk,emissivemap_fragment:Vk,emissivemap_pars_fragment:Gk,colorspace_fragment:Wk,colorspace_pars_fragment:$k,envmap_fragment:Xk,envmap_common_pars_fragment:jk,envmap_pars_fragment:qk,envmap_pars_vertex:Yk,envmap_physical_pars_fragment:oB,envmap_vertex:Kk,fog_vertex:Zk,fog_pars_vertex:Qk,fog_fragment:Jk,fog_pars_fragment:eB,gradientmap_pars_fragment:tB,lightmap_pars_fragment:nB,lights_lambert_fragment:iB,lights_lambert_pars_fragment:rB,lights_pars_begin:sB,lights_toon_fragment:aB,lights_toon_pars_fragment:lB,lights_phong_fragment:cB,lights_phong_pars_fragment:uB,lights_physical_fragment:fB,lights_physical_pars_fragment:dB,lights_fragment_begin:hB,lights_fragment_maps:pB,lights_fragment_end:mB,logdepthbuf_fragment:gB,logdepthbuf_pars_fragment:_B,logdepthbuf_pars_vertex:vB,logdepthbuf_vertex:xB,map_fragment:yB,map_pars_fragment:SB,map_particle_fragment:MB,map_particle_pars_fragment:EB,metalnessmap_fragment:wB,metalnessmap_pars_fragment:TB,morphinstance_vertex:AB,morphcolor_vertex:bB,morphnormal_vertex:RB,morphtarget_pars_vertex:CB,morphtarget_vertex:PB,normal_fragment_begin:LB,normal_fragment_maps:IB,normal_pars_fragment:DB,normal_pars_vertex:NB,normal_vertex:UB,normalmap_pars_fragment:OB,clearcoat_normal_fragment_begin:FB,clearcoat_normal_fragment_maps:kB,clearcoat_pars_fragment:BB,iridescence_pars_fragment:zB,opaque_fragment:HB,packing:VB,premultiplied_alpha_fragment:GB,project_vertex:WB,dithering_fragment:$B,dithering_pars_fragment:XB,roughnessmap_fragment:jB,roughnessmap_pars_fragment:qB,shadowmap_pars_fragment:YB,shadowmap_pars_vertex:KB,shadowmap_vertex:ZB,shadowmask_pars_fragment:QB,skinbase_vertex:JB,skinning_pars_vertex:ez,skinning_vertex:tz,skinnormal_vertex:nz,specularmap_fragment:iz,specularmap_pars_fragment:rz,tonemapping_fragment:sz,tonemapping_pars_fragment:oz,transmission_fragment:az,transmission_pars_fragment:lz,uv_pars_fragment:cz,uv_pars_vertex:uz,uv_vertex:fz,worldpos_vertex:dz,background_vert:hz,background_frag:pz,backgroundCube_vert:mz,backgroundCube_frag:gz,cube_vert:_z,cube_frag:vz,depth_vert:xz,depth_frag:yz,distanceRGBA_vert:Sz,distanceRGBA_frag:Mz,equirect_vert:Ez,equirect_frag:wz,linedashed_vert:Tz,linedashed_frag:Az,meshbasic_vert:bz,meshbasic_frag:Rz,meshlambert_vert:Cz,meshlambert_frag:Pz,meshmatcap_vert:Lz,meshmatcap_frag:Iz,meshnormal_vert:Dz,meshnormal_frag:Nz,meshphong_vert:Uz,meshphong_frag:Oz,meshphysical_vert:Fz,meshphysical_frag:kz,meshtoon_vert:Bz,meshtoon_frag:zz,points_vert:Hz,points_frag:Vz,shadow_vert:Gz,shadow_frag:Wz,sprite_vert:$z,sprite_frag:Xz},He={common:{diffuse:{value:new Ut(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new _t},alphaMap:{value:null},alphaMapTransform:{value:new _t},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new _t}},envmap:{envMap:{value:null},envMapRotation:{value:new _t},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new _t}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new _t}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new _t},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new _t},normalScale:{value:new At(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new _t},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new _t}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new _t}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new _t}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ut(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ut(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new _t},alphaTest:{value:0},uvTransform:{value:new _t}},sprite:{diffuse:{value:new Ut(16777215)},opacity:{value:1},center:{value:new At(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new _t},alphaMap:{value:null},alphaMapTransform:{value:new _t},alphaTest:{value:0}}},ns={basic:{uniforms:ai([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.fog]),vertexShader:mt.meshbasic_vert,fragmentShader:mt.meshbasic_frag},lambert:{uniforms:ai([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 Ut(0)}}]),vertexShader:mt.meshlambert_vert,fragmentShader:mt.meshlambert_frag},phong:{uniforms:ai([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 Ut(0)},specular:{value:new Ut(1118481)},shininess:{value:30}}]),vertexShader:mt.meshphong_vert,fragmentShader:mt.meshphong_frag},standard:{uniforms:ai([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 Ut(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:mt.meshphysical_vert,fragmentShader:mt.meshphysical_frag},toon:{uniforms:ai([He.common,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.gradientmap,He.fog,He.lights,{emissive:{value:new Ut(0)}}]),vertexShader:mt.meshtoon_vert,fragmentShader:mt.meshtoon_frag},matcap:{uniforms:ai([He.common,He.bumpmap,He.normalmap,He.displacementmap,He.fog,{matcap:{value:null}}]),vertexShader:mt.meshmatcap_vert,fragmentShader:mt.meshmatcap_frag},points:{uniforms:ai([He.points,He.fog]),vertexShader:mt.points_vert,fragmentShader:mt.points_frag},dashed:{uniforms:ai([He.common,He.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:mt.linedashed_vert,fragmentShader:mt.linedashed_frag},depth:{uniforms:ai([He.common,He.displacementmap]),vertexShader:mt.depth_vert,fragmentShader:mt.depth_frag},normal:{uniforms:ai([He.common,He.bumpmap,He.normalmap,He.displacementmap,{opacity:{value:1}}]),vertexShader:mt.meshnormal_vert,fragmentShader:mt.meshnormal_frag},sprite:{uniforms:ai([He.sprite,He.fog]),vertexShader:mt.sprite_vert,fragmentShader:mt.sprite_frag},background:{uniforms:{uvTransform:{value:new _t},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:mt.background_vert,fragmentShader:mt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new _t}},vertexShader:mt.backgroundCube_vert,fragmentShader:mt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:mt.cube_vert,fragmentShader:mt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:mt.equirect_vert,fragmentShader:mt.equirect_frag},distanceRGBA:{uniforms:ai([He.common,He.displacementmap,{referencePosition:{value:new ne},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:mt.distanceRGBA_vert,fragmentShader:mt.distanceRGBA_frag},shadow:{uniforms:ai([He.lights,He.fog,{color:{value:new Ut(0)},opacity:{value:1}}]),vertexShader:mt.shadow_vert,fragmentShader:mt.shadow_frag}};ns.physical={uniforms:ai([ns.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new _t},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new _t},clearcoatNormalScale:{value:new At(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new _t},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new _t},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new _t},sheen:{value:0},sheenColor:{value:new Ut(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new _t},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new _t},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new _t},transmissionSamplerSize:{value:new At},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new _t},attenuationDistance:{value:0},attenuationColor:{value:new Ut(0)},specularColor:{value:new Ut(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new _t},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new _t},anisotropyVector:{value:new At},anisotropyMap:{value:null},anisotropyMapTransform:{value:new _t}}]),vertexShader:mt.meshphysical_vert,fragmentShader:mt.meshphysical_frag};const Vh={r:0,b:0,g:0},Oa=new ps,jz=new sn;function qz(n,e,t,i,r,s,o){const a=new Ut(0);let l=s===!0?0:1,c,u,f=null,h=0,p=null;function g(x){let v=x.isScene===!0?x.background:null;return v&&v.isTexture&&(v=(x.backgroundBlurriness>0?t:e).get(v)),v}function _(x){let v=!1;const y=g(x);y===null?d(a,l):y&&y.isColor&&(d(y,1),v=!0);const b=n.xr.getEnvironmentBlendMode();b==="additive"?i.buffers.color.setClear(0,0,0,1,o):b==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||v)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function m(x,v){const y=g(v);y&&(y.isCubeTexture||y.mapping===h0)?(u===void 0&&(u=new Xe(new hn(1,1,1),new ha({name:"BackgroundCubeMaterial",uniforms:vu(ns.backgroundCube.uniforms),vertexShader:ns.backgroundCube.vertexShader,fragmentShader:ns.backgroundCube.fragmentShader,side:Pi,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(b,w,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Oa.copy(v.backgroundRotation),Oa.x*=-1,Oa.y*=-1,Oa.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(Oa.y*=-1,Oa.z*=-1),u.material.uniforms.envMap.value=y,u.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(jz.makeRotationFromEuler(Oa)),u.material.toneMapped=Lt.getTransfer(y.colorSpace)!==$t,(f!==y||h!==y.version||p!==n.toneMapping)&&(u.material.needsUpdate=!0,f=y,h=y.version,p=n.toneMapping),u.layers.enableAll(),x.unshift(u,u.geometry,u.material,0,0,null)):y&&y.isTexture&&(c===void 0&&(c=new Xe(new kd(2,2),new ha({name:"BackgroundMaterial",uniforms:vu(ns.background.uniforms),vertexShader:ns.background.vertexShader,fragmentShader:ns.background.fragmentShader,side:eo,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=y,c.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,c.material.toneMapped=Lt.getTransfer(y.colorSpace)!==$t,y.matrixAutoUpdate===!0&&y.updateMatrix(),c.material.uniforms.uvTransform.value.copy(y.matrix),(f!==y||h!==y.version||p!==n.toneMapping)&&(c.material.needsUpdate=!0,f=y,h=y.version,p=n.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null))}function d(x,v){x.getRGB(Vh,sR(n)),i.buffers.color.setClear(Vh.r,Vh.g,Vh.b,v,o)}return{getClearColor:function(){return a},setClearColor:function(x,v=1){a.set(x),l=v,d(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,d(a,l)},render:_,addToRenderList:m}}function Yz(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=h(null);let s=r,o=!1;function a(S,P,k,U,N){let X=!1;const z=f(U,k,P);s!==z&&(s=z,c(s.object)),X=p(S,U,k,N),X&&g(S,U,k,N),N!==null&&e.update(N,n.ELEMENT_ARRAY_BUFFER),(X||o)&&(o=!1,y(S,P,k,U),N!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(N).buffer))}function l(){return n.createVertexArray()}function c(S){return n.bindVertexArray(S)}function u(S){return n.deleteVertexArray(S)}function f(S,P,k){const U=k.wireframe===!0;let N=i[S.id];N===void 0&&(N={},i[S.id]=N);let X=N[P.id];X===void 0&&(X={},N[P.id]=X);let z=X[U];return z===void 0&&(z=h(l()),X[U]=z),z}function h(S){const P=[],k=[],U=[];for(let N=0;N=0){const ae=N[L];let fe=X[L];if(fe===void 0&&(L==="instanceMatrix"&&S.instanceMatrix&&(fe=S.instanceMatrix),L==="instanceColor"&&S.instanceColor&&(fe=S.instanceColor)),ae===void 0||ae.attribute!==fe||fe&&ae.data!==fe.data)return!0;z++}return s.attributesNum!==z||s.index!==U}function g(S,P,k,U){const N={},X=P.attributes;let z=0;const te=k.getAttributes();for(const L in te)if(te[L].location>=0){let ae=X[L];ae===void 0&&(L==="instanceMatrix"&&S.instanceMatrix&&(ae=S.instanceMatrix),L==="instanceColor"&&S.instanceColor&&(ae=S.instanceColor));const fe={};fe.attribute=ae,ae&&ae.data&&(fe.data=ae.data),N[L]=fe,z++}s.attributes=N,s.attributesNum=z,s.index=U}function _(){const S=s.newAttributes;for(let P=0,k=S.length;P=0){let Z=N[te];if(Z===void 0&&(te==="instanceMatrix"&&S.instanceMatrix&&(Z=S.instanceMatrix),te==="instanceColor"&&S.instanceColor&&(Z=S.instanceColor)),Z!==void 0){const ae=Z.normalized,fe=Z.itemSize,Me=e.get(Z);if(Me===void 0)continue;const Ve=Me.buffer,$=Me.type,oe=Me.bytesPerElement,me=$===n.INT||$===n.UNSIGNED_INT||Z.gpuType===Ay;if(Z.isInterleavedBufferAttribute){const de=Z.data,be=de.stride,Le=Z.offset;if(de.isInstancedInterleavedBuffer){for(let ke=0;ke0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";w="mediump"}return w==="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&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const f=t.logarithmicDepthBuffer===!0,h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=n.getParameter(n.MAX_TEXTURE_SIZE),_=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),m=n.getParameter(n.MAX_VERTEX_ATTRIBS),d=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),x=n.getParameter(n.MAX_VARYING_VECTORS),v=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),y=p>0,b=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,maxTextures:h,maxVertexTextures:p,maxTextureSize:g,maxCubemapSize:_,maxAttributes:m,maxVertexUniforms:d,maxVaryings:x,maxFragmentUniforms:v,vertexTextures:y,maxSamples:b}}function Qz(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new Wa,a=new _t,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const p=f.length!==0||h||i!==0||r;return r=h,i=f.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){t=u(f,h,0)},this.setState=function(f,h,p){const g=f.clippingPlanes,_=f.clipIntersection,m=f.clipShadows,d=n.get(f);if(!r||g===null||g.length===0||s&&!m)s?u(null):c();else{const x=s?0:i,v=x*4;let y=d.clippingState||null;l.value=y,y=u(g,h,v,p);for(let b=0;b!==v;++b)y[b]=t[b];d.clippingState=y,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=x}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(f,h,p,g){const _=f!==null?f.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const d=p+_*4,x=h.matrixWorldInverse;a.getNormalMatrix(x),(m===null||m.length0){const c=new uk(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class eH extends oR{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=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=o,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,o){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=o,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,o=i+e,a=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,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),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 xc=4,JE=[.125,.215,.35,.446,.526,.582],Ja=20,jg=new eH,e3=new Ut;let qg=null,Yg=0,Kg=0,Zg=!1;const $a=(1+Math.sqrt(5))/2,uc=1/$a,t3=[new ne(-$a,uc,0),new ne($a,uc,0),new ne(-uc,0,$a),new ne(uc,0,$a),new ne(0,$a,-uc),new ne(0,$a,uc),new ne(-1,1,-1),new ne(1,1,-1),new ne(-1,1,1),new ne(1,1,1)];class n3{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){qg=this._renderer.getRenderTarget(),Yg=this._renderer.getActiveCubeFace(),Kg=this._renderer.getActiveMipmapLevel(),Zg=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=s3(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=r3(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.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._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?v:0,v,v),u.setRenderTarget(r),_&&u.render(g,a),u.render(e,a)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=h,u.autoClear=f,e.background=m}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===pu||e.mapping===mu;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=s3()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=r3());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Xe(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Gh(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,jg)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sJa&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Ja}`);const d=[];let x=0;for(let T=0;Tv-xc?r-v+xc:0),w=4*(this._cubeSize-y);Gh(t,b,w,3*y,2*y),l.setRenderTarget(t),l.render(f,jg)}}function tH(n){const e=[],t=[],i=[];let r=n;const s=n-xc+1+JE.length;for(let o=0;on-xc?l=JE[o-n+xc-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,f=1+c,h=[u,u,f,u,f,f,u,u,f,f,u,f],p=6,g=6,_=3,m=2,d=1,x=new Float32Array(_*g*p),v=new Float32Array(m*g*p),y=new Float32Array(d*g*p);for(let w=0;w2?0:-1,M=[T,C,0,T+2/3,C,0,T+2/3,C+1,0,T,C,0,T+2/3,C+1,0,T,C+1,0];x.set(M,_*g*w),v.set(h,m*g*w);const S=[w,w,w,w,w,w];y.set(S,d*g*w)}const b=new gi;b.setAttribute("position",new us(x,_)),b.setAttribute("uv",new us(v,m)),b.setAttribute("faceIndex",new us(y,d)),e.push(b),r>xc&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function i3(n,e,t){const i=new Sl(n,e,t);return i.texture.mapping=h0,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Gh(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function nH(n,e,t){const i=new Float32Array(Ja),r=new ne(0,1,0);return new ha({name:"SphericalGaussianBlur",defines:{n:Ja,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:Uy(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:Zo,depthTest:!1,depthWrite:!1})}function r3(){return new ha({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Uy(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:Zo,depthTest:!1,depthWrite:!1})}function s3(){return new ha({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Uy(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:Zo,depthTest:!1,depthWrite:!1})}function Uy(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function iH(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===Qv||l===Jv,u=l===pu||l===mu;if(c||u){let f=e.get(a);const h=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==h)return t===null&&(t=new n3(n)),f=c?t.fromEquirectangular(a,f):t.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const p=a.image;return c&&p&&p.height>0||u&&p&&r(p)?(t===null&&(t=new n3(n)),f=c?t.fromEquirectangular(a):t.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(b=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const w=new Float32Array(y*b*4*f),T=new tR(w,y,b,f);T.type=$s,T.needsUpdate=!0;const C=v*4;for(let S=0;S0)return n;const r=e*t;let s=a3[r];if(s===void 0&&(s=new Float32Array(r),a3[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Rn(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` +`)}function iV(n){const e=Lt.getPrimaries(Lt.workingColorSpace),t=Lt.getPrimaries(n);let i;switch(e===t?i="":e===gm&&t===mm?i="LinearDisplayP3ToLinearSRGB":e===mm&&t===gm&&(i="LinearSRGBToLinearDisplayP3"),n){case ga:case p0:return[i,"LinearTransferOETF"];case Jr:case Iy:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function p3(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` + +`+r+` + +`+nV(n.getShaderSource(e),o)}else return r}function rV(n,e){const t=iV(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function sV(n,e){let t;switch(e){case SF:t="Linear";break;case MF:t="Reinhard";break;case EF:t="Cineon";break;case wF:t="ACESFilmic";break;case AF:t="AgX";break;case bF:t="Neutral";break;case TF:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Wh=new ne;function oV(){Lt.getLuminanceCoefficients(Wh);const n=Wh.x.toFixed(4),e=Wh.y.toFixed(4),t=Wh.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` +`)}function aV(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Sf).join(` +`)}function lV(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` +`)}function cV(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function C1(n){return n.replace(uV,dV)}const fV=new Map;function dV(n,e){let t=mt[e];if(t===void 0){const i=fV.get(e);if(i!==void 0)t=mt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return C1(t)}const hV=/#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 _3(n){return n.replace(hV,pV)}function pV(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(m+=` +`),d=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(Sf).join(` +`),d.length>0&&(d+=` +`)):(m=[v3(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_LOGDEPTHBUF":"","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",` +`].filter(Sf).join(` +`),d=[v3(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 "+f:"",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||t.batchingColor?"#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.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.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Qo?"#define TONE_MAPPING":"",t.toneMapping!==Qo?mt.tonemapping_pars_fragment:"",t.toneMapping!==Qo?sV("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",mt.colorspace_pars_fragment,rV("linearToOutputTexel",t.outputColorSpace),oV(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Sf).join(` +`)),o=C1(o),o=m3(o,t),o=g3(o,t),a=C1(a),a=m3(a,t),a=g3(a,t),o=_3(o),a=_3(a),t.isRawShaderMaterial!==!0&&(x=`#version 300 es +`,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+m,d=["#define varying in",t.glslVersion===DE?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===DE?"":"#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(` +`)+` +`+d);const v=x+m+o,y=x+d+a,b=h3(r,r.VERTEX_SHADER,v),w=h3(r,r.FRAGMENT_SHADER,y);r.attachShader(_,b),r.attachShader(_,w),t.index0AttributeName!==void 0?r.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(_,0,"position"),r.linkProgram(_);function T(P){if(n.debug.checkShaderErrors){const k=r.getProgramInfoLog(_).trim(),U=r.getShaderInfoLog(b).trim(),N=r.getShaderInfoLog(w).trim();let X=!0,z=!0;if(r.getProgramParameter(_,r.LINK_STATUS)===!1)if(X=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,_,b,w);else{const te=p3(r,b,"vertex"),L=p3(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(_,r.VALIDATE_STATUS)+` + +Material Name: `+P.name+` +Material Type: `+P.type+` + +Program Info Log: `+k+` +`+te+` +`+L)}else k!==""?console.warn("THREE.WebGLProgram: Program Info Log:",k):(U===""||N==="")&&(z=!1);z&&(P.diagnostics={runnable:X,programLog:k,vertexShader:{log:U,prefix:m},fragmentShader:{log:N,prefix:d}})}r.deleteShader(b),r.deleteShader(w),C=new kp(r,_),M=cV(r,_)}let C;this.getUniforms=function(){return C===void 0&&T(this),C};let M;this.getAttributes=function(){return M===void 0&&T(this),M};let S=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&&(S=r.getProgramParameter(_,eV)),S},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=tV++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=b,this.fragmentShader=w,this}let SV=0;class MV{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),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.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 EV(e),t.set(e,i)),i}}class EV{constructor(e){this.id=SV++,this.code=e,this.usedTimes=0}}function wV(n,e,t,i,r,s,o){const a=new Ny,l=new MV,c=new Set,u=[],f=r.logarithmicDepthBuffer,h=r.vertexTextures;let p=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",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 _(M){return c.add(M),M===0?"uv":`uv${M}`}function m(M,S,P,k,U){const N=k.fog,X=U.geometry,z=M.isMeshStandardMaterial?k.environment:null,te=(M.isMeshStandardMaterial?t:e).get(M.envMap||z),L=te&&te.mapping===h0?te.image.height:null,Z=g[M.type];M.precision!==null&&(p=r.getMaxPrecision(M.precision),p!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",p,"instead."));const ae=X.morphAttributes.position||X.morphAttributes.normal||X.morphAttributes.color,fe=ae!==void 0?ae.length:0;let Me=0;X.morphAttributes.position!==void 0&&(Me=1),X.morphAttributes.normal!==void 0&&(Me=2),X.morphAttributes.color!==void 0&&(Me=3);let Ve,$,oe,me;if(Z){const it=ns[Z];Ve=it.vertexShader,$=it.fragmentShader}else Ve=M.vertexShader,$=M.fragmentShader,l.update(M),oe=l.getVertexShaderID(M),me=l.getFragmentShaderID(M);const de=n.getRenderTarget(),be=U.isInstancedMesh===!0,Le=U.isBatchedMesh===!0,ke=!!M.map,Qe=!!M.matcap,V=!!te,ot=!!M.aoMap,ee=!!M.lightMap,at=!!M.bumpMap,Ne=!!M.normalMap,Ze=!!M.displacementMap,Ie=!!M.emissiveMap,We=!!M.metalnessMap,B=!!M.roughnessMap,E=M.anisotropy>0,A=M.clearcoat>0,F=M.dispersion>0,W=M.iridescence>0,j=M.sheen>0,le=M.transmission>0,pe=E&&!!M.anisotropyMap,ce=A&&!!M.clearcoatMap,Ee=A&&!!M.clearcoatNormalMap,ve=A&&!!M.clearcoatRoughnessMap,ue=W&&!!M.iridescenceMap,Re=W&&!!M.iridescenceThicknessMap,Pe=j&&!!M.sheenColorMap,ye=j&&!!M.sheenRoughnessMap,Se=!!M.specularMap,Be=!!M.specularColorMap,je=!!M.specularIntensityMap,J=le&&!!M.transmissionMap,H=le&&!!M.thicknessMap,re=!!M.gradientMap,q=!!M.alphaMap,ie=M.alphaTest>0,xe=!!M.alphaHash,we=!!M.extensions;let Ye=Qo;M.toneMapped&&(de===null||de.isXRRenderTarget===!0)&&(Ye=n.toneMapping);const ut={shaderID:Z,shaderType:M.type,shaderName:M.name,vertexShader:Ve,fragmentShader:$,defines:M.defines,customVertexShaderID:oe,customFragmentShaderID:me,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:p,batching:Le,batchingColor:Le&&U._colorsTexture!==null,instancing:be,instancingColor:be&&U.instanceColor!==null,instancingMorph:be&&U.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:de===null?n.outputColorSpace:de.isXRRenderTarget===!0?de.texture.colorSpace:ga,alphaToCoverage:!!M.alphaToCoverage,map:ke,matcap:Qe,envMap:V,envMapMode:V&&te.mapping,envMapCubeUVHeight:L,aoMap:ot,lightMap:ee,bumpMap:at,normalMap:Ne,displacementMap:h&&Ze,emissiveMap:Ie,normalMapObjectSpace:Ne&&M.normalMapType===IF,normalMapTangentSpace:Ne&&M.normalMapType===LF,metalnessMap:We,roughnessMap:B,anisotropy:E,anisotropyMap:pe,clearcoat:A,clearcoatMap:ce,clearcoatNormalMap:Ee,clearcoatRoughnessMap:ve,dispersion:F,iridescence:W,iridescenceMap:ue,iridescenceThicknessMap:Re,sheen:j,sheenColorMap:Pe,sheenRoughnessMap:ye,specularMap:Se,specularColorMap:Be,specularIntensityMap:je,transmission:le,transmissionMap:J,thicknessMap:H,gradientMap:re,opaque:M.transparent===!1&&M.blending===Bc&&M.alphaToCoverage===!1,alphaMap:q,alphaTest:ie,alphaHash:xe,combine:M.combine,mapUv:ke&&_(M.map.channel),aoMapUv:ot&&_(M.aoMap.channel),lightMapUv:ee&&_(M.lightMap.channel),bumpMapUv:at&&_(M.bumpMap.channel),normalMapUv:Ne&&_(M.normalMap.channel),displacementMapUv:Ze&&_(M.displacementMap.channel),emissiveMapUv:Ie&&_(M.emissiveMap.channel),metalnessMapUv:We&&_(M.metalnessMap.channel),roughnessMapUv:B&&_(M.roughnessMap.channel),anisotropyMapUv:pe&&_(M.anisotropyMap.channel),clearcoatMapUv:ce&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:Ee&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ve&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:ue&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:Re&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:Pe&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:ye&&_(M.sheenRoughnessMap.channel),specularMapUv:Se&&_(M.specularMap.channel),specularColorMapUv:Be&&_(M.specularColorMap.channel),specularIntensityMapUv:je&&_(M.specularIntensityMap.channel),transmissionMapUv:J&&_(M.transmissionMap.channel),thicknessMapUv:H&&_(M.thicknessMap.channel),alphaMapUv:q&&_(M.alphaMap.channel),vertexTangents:!!X.attributes.tangent&&(Ne||E),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!X.attributes.color&&X.attributes.color.itemSize===4,pointsUvs:U.isPoints===!0&&!!X.attributes.uv&&(ke||q),fog:!!N,useFog:M.fog===!0,fogExp2:!!N&&N.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:U.isSkinnedMesh===!0,morphTargets:X.morphAttributes.position!==void 0,morphNormals:X.morphAttributes.normal!==void 0,morphColors:X.morphAttributes.color!==void 0,morphTargetsCount:fe,morphTextureStride:Me,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:M.dithering,shadowMapEnabled:n.shadowMap.enabled&&P.length>0,shadowMapType:n.shadowMap.type,toneMapping:Ye,decodeVideoTexture:ke&&M.map.isVideoTexture===!0&&Lt.getTransfer(M.map.colorSpace)===$t,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===is,flipSided:M.side===Pi,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:we&&M.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(we&&M.extensions.multiDraw===!0||Le)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return ut.vertexUv1s=c.has(1),ut.vertexUv2s=c.has(2),ut.vertexUv3s=c.has(3),c.clear(),ut}function d(M){const S=[];if(M.shaderID?S.push(M.shaderID):(S.push(M.customVertexShaderID),S.push(M.customFragmentShaderID)),M.defines!==void 0)for(const P in M.defines)S.push(P),S.push(M.defines[P]);return M.isRawShaderMaterial===!1&&(x(S,M),v(S,M),S.push(n.outputColorSpace)),S.push(M.customProgramCacheKey),S.join()}function x(M,S){M.push(S.precision),M.push(S.outputColorSpace),M.push(S.envMapMode),M.push(S.envMapCubeUVHeight),M.push(S.mapUv),M.push(S.alphaMapUv),M.push(S.lightMapUv),M.push(S.aoMapUv),M.push(S.bumpMapUv),M.push(S.normalMapUv),M.push(S.displacementMapUv),M.push(S.emissiveMapUv),M.push(S.metalnessMapUv),M.push(S.roughnessMapUv),M.push(S.anisotropyMapUv),M.push(S.clearcoatMapUv),M.push(S.clearcoatNormalMapUv),M.push(S.clearcoatRoughnessMapUv),M.push(S.iridescenceMapUv),M.push(S.iridescenceThicknessMapUv),M.push(S.sheenColorMapUv),M.push(S.sheenRoughnessMapUv),M.push(S.specularMapUv),M.push(S.specularColorMapUv),M.push(S.specularIntensityMapUv),M.push(S.transmissionMapUv),M.push(S.thicknessMapUv),M.push(S.combine),M.push(S.fogExp2),M.push(S.sizeAttenuation),M.push(S.morphTargetsCount),M.push(S.morphAttributeCount),M.push(S.numDirLights),M.push(S.numPointLights),M.push(S.numSpotLights),M.push(S.numSpotLightMaps),M.push(S.numHemiLights),M.push(S.numRectAreaLights),M.push(S.numDirLightShadows),M.push(S.numPointLightShadows),M.push(S.numSpotLightShadows),M.push(S.numSpotLightShadowsWithMaps),M.push(S.numLightProbes),M.push(S.shadowMapType),M.push(S.toneMapping),M.push(S.numClippingPlanes),M.push(S.numClipIntersection),M.push(S.depthPacking)}function v(M,S){a.disableAll(),S.supportsVertexTextures&&a.enable(0),S.instancing&&a.enable(1),S.instancingColor&&a.enable(2),S.instancingMorph&&a.enable(3),S.matcap&&a.enable(4),S.envMap&&a.enable(5),S.normalMapObjectSpace&&a.enable(6),S.normalMapTangentSpace&&a.enable(7),S.clearcoat&&a.enable(8),S.iridescence&&a.enable(9),S.alphaTest&&a.enable(10),S.vertexColors&&a.enable(11),S.vertexAlphas&&a.enable(12),S.vertexUv1s&&a.enable(13),S.vertexUv2s&&a.enable(14),S.vertexUv3s&&a.enable(15),S.vertexTangents&&a.enable(16),S.anisotropy&&a.enable(17),S.alphaHash&&a.enable(18),S.batching&&a.enable(19),S.dispersion&&a.enable(20),S.batchingColor&&a.enable(21),M.push(a.mask),a.disableAll(),S.fog&&a.enable(0),S.useFog&&a.enable(1),S.flatShading&&a.enable(2),S.logarithmicDepthBuffer&&a.enable(3),S.skinning&&a.enable(4),S.morphTargets&&a.enable(5),S.morphNormals&&a.enable(6),S.morphColors&&a.enable(7),S.premultipliedAlpha&&a.enable(8),S.shadowMapEnabled&&a.enable(9),S.doubleSided&&a.enable(10),S.flipSided&&a.enable(11),S.useDepthPacking&&a.enable(12),S.dithering&&a.enable(13),S.transmission&&a.enable(14),S.sheen&&a.enable(15),S.opaque&&a.enable(16),S.pointsUvs&&a.enable(17),S.decodeVideoTexture&&a.enable(18),S.alphaToCoverage&&a.enable(19),M.push(a.mask)}function y(M){const S=g[M.type];let P;if(S){const k=ns[S];P=ok.clone(k.uniforms)}else P=M.uniforms;return P}function b(M,S){let P;for(let k=0,U=u.length;k0?i.push(d):p.transparent===!0?r.push(d):t.push(d)}function l(f,h,p,g,_,m){const d=o(f,h,p,g,_,m);p.transmission>0?i.unshift(d):p.transparent===!0?r.unshift(d):t.unshift(d)}function c(f,h){t.length>1&&t.sort(f||AV),i.length>1&&i.sort(h||x3),r.length>1&&r.sort(h||x3)}function u(){for(let f=e,h=n.length;f=s.length?(o=new y3,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function RV(){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 ne,color:new Ut};break;case"SpotLight":t={position:new ne,direction:new ne,color:new Ut,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new ne,color:new Ut,distance:0,decay:0};break;case"HemisphereLight":t={direction:new ne,skyColor:new Ut,groundColor:new Ut};break;case"RectAreaLight":t={color:new Ut,position:new ne,halfWidth:new ne,halfHeight:new ne};break}return n[e.id]=t,t}}}function CV(){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 At};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new At};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new At,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let PV=0;function LV(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function IV(n){const e=new RV,t=CV(),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 ne);const r=new ne,s=new sn,o=new sn;function a(c){let u=0,f=0,h=0;for(let M=0;M<9;M++)i.probe[M].set(0,0,0);let p=0,g=0,_=0,m=0,d=0,x=0,v=0,y=0,b=0,w=0,T=0;c.sort(LV);for(let M=0,S=c.length;M0&&(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]=f,i.ambient[2]=h;const C=i.hash;(C.directionalLength!==p||C.pointLength!==g||C.spotLength!==_||C.rectAreaLength!==m||C.hemiLength!==d||C.numDirectionalShadows!==x||C.numPointShadows!==v||C.numSpotShadows!==y||C.numSpotMaps!==b||C.numLightProbes!==T)&&(i.directional.length=p,i.spot.length=_,i.rectArea.length=m,i.point.length=g,i.hemi.length=d,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=v,i.pointShadowMap.length=v,i.spotShadow.length=y,i.spotShadowMap.length=y,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=v,i.spotLightMatrix.length=y+b-w,i.spotLightMap.length=b,i.numSpotLightShadowsWithMaps=w,i.numLightProbes=T,C.directionalLength=p,C.pointLength=g,C.spotLength=_,C.rectAreaLength=m,C.hemiLength=d,C.numDirectionalShadows=x,C.numPointShadows=v,C.numSpotShadows=y,C.numSpotMaps=b,C.numLightProbes=T,i.version=PV++)}function l(c,u){let f=0,h=0,p=0,g=0,_=0;const m=u.matrixWorldInverse;for(let d=0,x=c.length;d=o.length?(a=new S3(n),o.push(a)):a=o[s],a}function i(){e=new WeakMap}return{get:t,dispose:i}}class NV extends Od{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=CF,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 UV extends Od{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 OV=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,FV=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function kV(n,e,t){let i=new lR;const r=new At,s=new At,o=new On,a=new NV({depthPacking:PF}),l=new UV,c={},u=t.maxTextureSize,f={[eo]:Pi,[Pi]:eo,[is]:is},h=new ha({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new At},radius:{value:4}},vertexShader:OV,fragmentShader:FV}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const g=new gi;g.setAttribute("position",new us(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Xe(g,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Bb;let d=this.type;this.render=function(w,T,C){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||w.length===0)return;const M=n.getRenderTarget(),S=n.getActiveCubeFace(),P=n.getActiveMipmapLevel(),k=n.state;k.setBlending(Zo),k.buffers.color.setClear(1,1,1,1),k.buffers.depth.setTest(!0),k.setScissorTest(!1);const U=d!==Us&&this.type===Us,N=d===Us&&this.type!==Us;for(let X=0,z=w.length;Xu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/Z.x),r.x=s.x*Z.x,L.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/Z.y),r.y=s.y*Z.y,L.mapSize.y=s.y)),L.map===null||U===!0||N===!0){const fe=this.type!==Us?{minFilter:dr,magFilter:dr}:{};L.map!==null&&L.map.dispose(),L.map=new Sl(r.x,r.y,fe),L.map.texture.name=te.name+".shadowMap",L.camera.updateProjectionMatrix()}n.setRenderTarget(L.map),n.clear();const ae=L.getViewportCount();for(let fe=0;fe0||T.map&&T.alphaTest>0){const k=S.uuid,U=T.uuid;let N=c[k];N===void 0&&(N={},c[k]=N);let X=N[U];X===void 0&&(X=S.clone(),N[U]=X,T.addEventListener("dispose",b)),S=X}if(S.visible=T.visible,S.wireframe=T.wireframe,M===Us?S.side=T.shadowSide!==null?T.shadowSide:T.side:S.side=T.shadowSide!==null?T.shadowSide:f[T.side],S.alphaMap=T.alphaMap,S.alphaTest=T.alphaTest,S.map=T.map,S.clipShadows=T.clipShadows,S.clippingPlanes=T.clippingPlanes,S.clipIntersection=T.clipIntersection,S.displacementMap=T.displacementMap,S.displacementScale=T.displacementScale,S.displacementBias=T.displacementBias,S.wireframeLinewidth=T.wireframeLinewidth,S.linewidth=T.linewidth,C.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const k=n.properties.get(S);k.light=C}return S}function y(w,T,C,M,S){if(w.visible===!1)return;if(w.layers.test(T.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&S===Us)&&(!w.frustumCulled||i.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,w.matrixWorld);const U=e.update(w),N=w.material;if(Array.isArray(N)){const X=U.groups;for(let z=0,te=X.length;z=1):te.indexOf("OpenGL ES")!==-1&&(z=parseFloat(/^OpenGL ES (\d)/.exec(te)[1]),X=z>=2);let L=null,Z={};const ae=n.getParameter(n.SCISSOR_BOX),fe=n.getParameter(n.VIEWPORT),Me=new On().fromArray(ae),Ve=new On().fromArray(fe);function $(J,H,re,q){const ie=new Uint8Array(4),xe=n.createTexture();n.bindTexture(J,xe),n.texParameteri(J,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(J,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let we=0;we"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new At,u=new WeakMap;let f;const h=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(B,E){return p?new OffscreenCanvas(B,E):vm("canvas")}function _(B,E,A){let F=1;const W=We(B);if((W.width>A||W.height>A)&&(F=A/Math.max(W.width,W.height)),F<1)if(typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&B instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&B instanceof ImageBitmap||typeof VideoFrame<"u"&&B instanceof VideoFrame){const j=Math.floor(F*W.width),le=Math.floor(F*W.height);f===void 0&&(f=g(j,le));const pe=E?g(j,le):f;return pe.width=j,pe.height=le,pe.getContext("2d").drawImage(B,0,0,j,le),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+W.width+"x"+W.height+") to ("+j+"x"+le+")."),pe}else return"data"in B&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+W.width+"x"+W.height+")."),B;return B}function m(B){return B.generateMipmaps&&B.minFilter!==dr&&B.minFilter!==Nr}function d(B){n.generateMipmap(B)}function x(B,E,A,F,W=!1){if(B!==null){if(n[B]!==void 0)return n[B];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+B+"'")}let j=E;if(E===n.RED&&(A===n.FLOAT&&(j=n.R32F),A===n.HALF_FLOAT&&(j=n.R16F),A===n.UNSIGNED_BYTE&&(j=n.R8)),E===n.RED_INTEGER&&(A===n.UNSIGNED_BYTE&&(j=n.R8UI),A===n.UNSIGNED_SHORT&&(j=n.R16UI),A===n.UNSIGNED_INT&&(j=n.R32UI),A===n.BYTE&&(j=n.R8I),A===n.SHORT&&(j=n.R16I),A===n.INT&&(j=n.R32I)),E===n.RG&&(A===n.FLOAT&&(j=n.RG32F),A===n.HALF_FLOAT&&(j=n.RG16F),A===n.UNSIGNED_BYTE&&(j=n.RG8)),E===n.RG_INTEGER&&(A===n.UNSIGNED_BYTE&&(j=n.RG8UI),A===n.UNSIGNED_SHORT&&(j=n.RG16UI),A===n.UNSIGNED_INT&&(j=n.RG32UI),A===n.BYTE&&(j=n.RG8I),A===n.SHORT&&(j=n.RG16I),A===n.INT&&(j=n.RG32I)),E===n.RGB&&A===n.UNSIGNED_INT_5_9_9_9_REV&&(j=n.RGB9_E5),E===n.RGBA){const le=W?pm:Lt.getTransfer(F);A===n.FLOAT&&(j=n.RGBA32F),A===n.HALF_FLOAT&&(j=n.RGBA16F),A===n.UNSIGNED_BYTE&&(j=le===$t?n.SRGB8_ALPHA8:n.RGBA8),A===n.UNSIGNED_SHORT_4_4_4_4&&(j=n.RGBA4),A===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 v(B,E){let A;return B?E===null||E===yl||E===gu?A=n.DEPTH24_STENCIL8:E===$s?A=n.DEPTH32F_STENCIL8:E===od&&(A=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):E===null||E===yl||E===gu?A=n.DEPTH_COMPONENT24:E===$s?A=n.DEPTH_COMPONENT32F:E===od&&(A=n.DEPTH_COMPONENT16),A}function y(B,E){return m(B)===!0||B.isFramebufferTexture&&B.minFilter!==dr&&B.minFilter!==Nr?Math.log2(Math.max(E.width,E.height))+1:B.mipmaps!==void 0&&B.mipmaps.length>0?B.mipmaps.length:B.isCompressedTexture&&Array.isArray(B.image)?E.mipmaps.length:1}function b(B){const E=B.target;E.removeEventListener("dispose",b),T(E),E.isVideoTexture&&u.delete(E)}function w(B){const E=B.target;E.removeEventListener("dispose",w),M(E)}function T(B){const E=i.get(B);if(E.__webglInit===void 0)return;const A=B.source,F=h.get(A);if(F){const W=F[E.__cacheKey];W.usedTimes--,W.usedTimes===0&&C(B),Object.keys(F).length===0&&h.delete(A)}i.remove(B)}function C(B){const E=i.get(B);n.deleteTexture(E.__webglTexture);const A=B.source,F=h.get(A);delete F[E.__cacheKey],o.memory.textures--}function M(B){const E=i.get(B);if(B.depthTexture&&B.depthTexture.dispose(),B.isWebGLCubeRenderTarget)for(let F=0;F<6;F++){if(Array.isArray(E.__webglFramebuffer[F]))for(let W=0;W=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+B+" texture units while this GPU supports only "+r.maxTextures),S+=1,B}function U(B){const E=[];return E.push(B.wrapS),E.push(B.wrapT),E.push(B.wrapR||0),E.push(B.magFilter),E.push(B.minFilter),E.push(B.anisotropy),E.push(B.internalFormat),E.push(B.format),E.push(B.type),E.push(B.generateMipmaps),E.push(B.premultiplyAlpha),E.push(B.flipY),E.push(B.unpackAlignment),E.push(B.colorSpace),E.join()}function N(B,E){const A=i.get(B);if(B.isVideoTexture&&Ze(B),B.isRenderTargetTexture===!1&&B.version>0&&A.__version!==B.version){const F=B.image;if(F===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(F.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ve(A,B,E);return}}t.bindTexture(n.TEXTURE_2D,A.__webglTexture,n.TEXTURE0+E)}function X(B,E){const A=i.get(B);if(B.version>0&&A.__version!==B.version){Ve(A,B,E);return}t.bindTexture(n.TEXTURE_2D_ARRAY,A.__webglTexture,n.TEXTURE0+E)}function z(B,E){const A=i.get(B);if(B.version>0&&A.__version!==B.version){Ve(A,B,E);return}t.bindTexture(n.TEXTURE_3D,A.__webglTexture,n.TEXTURE0+E)}function te(B,E){const A=i.get(B);if(B.version>0&&A.__version!==B.version){$(A,B,E);return}t.bindTexture(n.TEXTURE_CUBE_MAP,A.__webglTexture,n.TEXTURE0+E)}const L={[e1]:n.REPEAT,[nl]:n.CLAMP_TO_EDGE,[t1]:n.MIRRORED_REPEAT},Z={[dr]:n.NEAREST,[RF]:n.NEAREST_MIPMAP_NEAREST,[Eh]:n.NEAREST_MIPMAP_LINEAR,[Nr]:n.LINEAR,[Ag]:n.LINEAR_MIPMAP_NEAREST,[il]:n.LINEAR_MIPMAP_LINEAR},ae={[DF]:n.NEVER,[BF]:n.ALWAYS,[NF]:n.LESS,[Qb]:n.LEQUAL,[UF]:n.EQUAL,[kF]:n.GEQUAL,[OF]:n.GREATER,[FF]:n.NOTEQUAL};function fe(B,E){if(E.type===$s&&e.has("OES_texture_float_linear")===!1&&(E.magFilter===Nr||E.magFilter===Ag||E.magFilter===Eh||E.magFilter===il||E.minFilter===Nr||E.minFilter===Ag||E.minFilter===Eh||E.minFilter===il)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(B,n.TEXTURE_WRAP_S,L[E.wrapS]),n.texParameteri(B,n.TEXTURE_WRAP_T,L[E.wrapT]),(B===n.TEXTURE_3D||B===n.TEXTURE_2D_ARRAY)&&n.texParameteri(B,n.TEXTURE_WRAP_R,L[E.wrapR]),n.texParameteri(B,n.TEXTURE_MAG_FILTER,Z[E.magFilter]),n.texParameteri(B,n.TEXTURE_MIN_FILTER,Z[E.minFilter]),E.compareFunction&&(n.texParameteri(B,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(B,n.TEXTURE_COMPARE_FUNC,ae[E.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(E.magFilter===dr||E.minFilter!==Eh&&E.minFilter!==il||E.type===$s&&e.has("OES_texture_float_linear")===!1)return;if(E.anisotropy>1||i.get(E).__currentAnisotropy){const A=e.get("EXT_texture_filter_anisotropic");n.texParameterf(B,A.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(E.anisotropy,r.getMaxAnisotropy())),i.get(E).__currentAnisotropy=E.anisotropy}}}function Me(B,E){let A=!1;B.__webglInit===void 0&&(B.__webglInit=!0,E.addEventListener("dispose",b));const F=E.source;let W=h.get(F);W===void 0&&(W={},h.set(F,W));const j=U(E);if(j!==B.__cacheKey){W[j]===void 0&&(W[j]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,A=!0),W[j].usedTimes++;const le=W[B.__cacheKey];le!==void 0&&(W[B.__cacheKey].usedTimes--,le.usedTimes===0&&C(E)),B.__cacheKey=j,B.__webglTexture=W[j].texture}return A}function Ve(B,E,A){let F=n.TEXTURE_2D;(E.isDataArrayTexture||E.isCompressedArrayTexture)&&(F=n.TEXTURE_2D_ARRAY),E.isData3DTexture&&(F=n.TEXTURE_3D);const W=Me(B,E),j=E.source;t.bindTexture(F,B.__webglTexture,n.TEXTURE0+A);const le=i.get(j);if(j.version!==le.__version||W===!0){t.activeTexture(n.TEXTURE0+A);const pe=Lt.getPrimaries(Lt.workingColorSpace),ce=E.colorSpace===zo?null:Lt.getPrimaries(E.colorSpace),Ee=E.colorSpace===zo||pe===ce?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,E.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,E.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,E.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ee);let ve=_(E.image,!1,r.maxTextureSize);ve=Ie(E,ve);const ue=s.convert(E.format,E.colorSpace),Re=s.convert(E.type);let Pe=x(E.internalFormat,ue,Re,E.colorSpace,E.isVideoTexture);fe(F,E);let ye;const Se=E.mipmaps,Be=E.isVideoTexture!==!0,je=le.__version===void 0||W===!0,J=j.dataReady,H=y(E,ve);if(E.isDepthTexture)Pe=v(E.format===_u,E.type),je&&(Be?t.texStorage2D(n.TEXTURE_2D,1,Pe,ve.width,ve.height):t.texImage2D(n.TEXTURE_2D,0,Pe,ve.width,ve.height,0,ue,Re,null));else if(E.isDataTexture)if(Se.length>0){Be&&je&&t.texStorage2D(n.TEXTURE_2D,H,Pe,Se[0].width,Se[0].height);for(let re=0,q=Se.length;re0){const ie=M3(ye.width,ye.height,E.format,E.type);for(const xe of E.layerUpdates){const we=ye.data.subarray(xe*ie/ye.data.BYTES_PER_ELEMENT,(xe+1)*ie/ye.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,re,0,0,xe,ye.width,ye.height,1,ue,we,0,0)}E.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,re,0,0,0,ye.width,ye.height,ve.depth,ue,ye.data,0,0)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,re,Pe,ye.width,ye.height,ve.depth,0,ye.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Be?J&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,re,0,0,0,ye.width,ye.height,ve.depth,ue,Re,ye.data):t.texImage3D(n.TEXTURE_2D_ARRAY,re,Pe,ye.width,ye.height,ve.depth,0,ue,Re,ye.data)}else{Be&&je&&t.texStorage2D(n.TEXTURE_2D,H,Pe,Se[0].width,Se[0].height);for(let re=0,q=Se.length;re0){const re=M3(ve.width,ve.height,E.format,E.type);for(const q of E.layerUpdates){const ie=ve.data.subarray(q*re/ve.data.BYTES_PER_ELEMENT,(q+1)*re/ve.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,q,ve.width,ve.height,1,ue,Re,ie)}E.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ve.width,ve.height,ve.depth,ue,Re,ve.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,Pe,ve.width,ve.height,ve.depth,0,ue,Re,ve.data);else if(E.isData3DTexture)Be?(je&&t.texStorage3D(n.TEXTURE_3D,H,Pe,ve.width,ve.height,ve.depth),J&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ve.width,ve.height,ve.depth,ue,Re,ve.data)):t.texImage3D(n.TEXTURE_3D,0,Pe,ve.width,ve.height,ve.depth,0,ue,Re,ve.data);else if(E.isFramebufferTexture){if(je)if(Be)t.texStorage2D(n.TEXTURE_2D,H,Pe,ve.width,ve.height);else{let re=ve.width,q=ve.height;for(let ie=0;ie>=1,q>>=1}}else if(Se.length>0){if(Be&&je){const re=We(Se[0]);t.texStorage2D(n.TEXTURE_2D,H,Pe,re.width,re.height)}for(let re=0,q=Se.length;re0&&H++;const q=We(ue[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,H,Se,q.width,q.height)}for(let q=0;q<6;q++)if(ve){Be?J&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,0,0,ue[q].width,ue[q].height,Pe,ye,ue[q].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,Se,ue[q].width,ue[q].height,0,Pe,ye,ue[q].data);for(let ie=0;ie>j),ue=Math.max(1,E.height>>j);W===n.TEXTURE_3D||W===n.TEXTURE_2D_ARRAY?t.texImage3D(W,j,ce,ve,ue,E.depth,0,le,pe,null):t.texImage2D(W,j,ce,ve,ue,0,le,pe,null)}t.bindFramebuffer(n.FRAMEBUFFER,B),Ne(E)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,F,W,i.get(A).__webglTexture,0,at(E)):(W===n.TEXTURE_2D||W>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&W<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,F,W,i.get(A).__webglTexture,j),t.bindFramebuffer(n.FRAMEBUFFER,null)}function me(B,E,A){if(n.bindRenderbuffer(n.RENDERBUFFER,B),E.depthBuffer){const F=E.depthTexture,W=F&&F.isDepthTexture?F.type:null,j=v(E.stencilBuffer,W),le=E.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pe=at(E);Ne(E)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,pe,j,E.width,E.height):A?n.renderbufferStorageMultisample(n.RENDERBUFFER,pe,j,E.width,E.height):n.renderbufferStorage(n.RENDERBUFFER,j,E.width,E.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,le,n.RENDERBUFFER,B)}else{const F=E.textures;for(let W=0;W{delete E.__boundDepthTexture,delete E.__depthDisposeCallback,F.removeEventListener("dispose",W)};F.addEventListener("dispose",W),E.__depthDisposeCallback=W}E.__boundDepthTexture=F}if(B.depthTexture&&!E.__autoAllocateDepthBuffer){if(A)throw new Error("target.depthTexture not supported in Cube render targets");de(E.__webglFramebuffer,B)}else if(A){E.__webglDepthbuffer=[];for(let F=0;F<6;F++)if(t.bindFramebuffer(n.FRAMEBUFFER,E.__webglFramebuffer[F]),E.__webglDepthbuffer[F]===void 0)E.__webglDepthbuffer[F]=n.createRenderbuffer(),me(E.__webglDepthbuffer[F],B,!1);else{const W=B.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,j=E.__webglDepthbuffer[F];n.bindRenderbuffer(n.RENDERBUFFER,j),n.framebufferRenderbuffer(n.FRAMEBUFFER,W,n.RENDERBUFFER,j)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,E.__webglFramebuffer),E.__webglDepthbuffer===void 0)E.__webglDepthbuffer=n.createRenderbuffer(),me(E.__webglDepthbuffer,B,!1);else{const F=B.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,W=E.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,W),n.framebufferRenderbuffer(n.FRAMEBUFFER,F,n.RENDERBUFFER,W)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function Le(B,E,A){const F=i.get(B);E!==void 0&&oe(F.__webglFramebuffer,B,B.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),A!==void 0&&be(B)}function ke(B){const E=B.texture,A=i.get(B),F=i.get(E);B.addEventListener("dispose",w);const W=B.textures,j=B.isWebGLCubeRenderTarget===!0,le=W.length>1;if(le||(F.__webglTexture===void 0&&(F.__webglTexture=n.createTexture()),F.__version=E.version,o.memory.textures++),j){A.__webglFramebuffer=[];for(let pe=0;pe<6;pe++)if(E.mipmaps&&E.mipmaps.length>0){A.__webglFramebuffer[pe]=[];for(let ce=0;ce0){A.__webglFramebuffer=[];for(let pe=0;pe0&&Ne(B)===!1){A.__webglMultisampledFramebuffer=n.createFramebuffer(),A.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,A.__webglMultisampledFramebuffer);for(let pe=0;pe0)for(let ce=0;ce0)for(let ce=0;ce0){if(Ne(B)===!1){const E=B.textures,A=B.width,F=B.height;let W=n.COLOR_BUFFER_BIT;const j=B.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,le=i.get(B),pe=E.length>1;if(pe)for(let ce=0;ce0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&E.__useRenderToTexture!==!1}function Ze(B){const E=o.render.frame;u.get(B)!==E&&(u.set(B,E),B.update())}function Ie(B,E){const A=B.colorSpace,F=B.format,W=B.type;return B.isCompressedTexture===!0||B.isVideoTexture===!0||A!==ga&&A!==zo&&(Lt.getTransfer(A)===$t?(F!==kr||W!==to)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",A)),E}function We(B){return typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement?(c.width=B.naturalWidth||B.width,c.height=B.naturalHeight||B.height):typeof VideoFrame<"u"&&B instanceof VideoFrame?(c.width=B.displayWidth,c.height=B.displayHeight):(c.width=B.width,c.height=B.height),c}this.allocateTextureUnit=k,this.resetTextureUnits=P,this.setTexture2D=N,this.setTexture2DArray=X,this.setTexture3D=z,this.setTextureCube=te,this.rebindTextures=Le,this.setupRenderTarget=ke,this.updateRenderTargetMipmap=Qe,this.updateMultisampleRenderTarget=ee,this.setupDepthRenderbuffer=be,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=Ne}function VV(n,e){function t(i,r=zo){let s;const o=Lt.getTransfer(r);if(i===to)return n.UNSIGNED_BYTE;if(i===by)return n.UNSIGNED_SHORT_4_4_4_4;if(i===Ry)return n.UNSIGNED_SHORT_5_5_5_1;if(i===Wb)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===Vb)return n.BYTE;if(i===Gb)return n.SHORT;if(i===od)return n.UNSIGNED_SHORT;if(i===Ay)return n.INT;if(i===yl)return n.UNSIGNED_INT;if(i===$s)return n.FLOAT;if(i===Dd)return n.HALF_FLOAT;if(i===$b)return n.ALPHA;if(i===Xb)return n.RGB;if(i===kr)return n.RGBA;if(i===jb)return n.LUMINANCE;if(i===qb)return n.LUMINANCE_ALPHA;if(i===zc)return n.DEPTH_COMPONENT;if(i===_u)return n.DEPTH_STENCIL;if(i===Yb)return n.RED;if(i===Cy)return n.RED_INTEGER;if(i===Kb)return n.RG;if(i===Py)return n.RG_INTEGER;if(i===Ly)return n.RGBA_INTEGER;if(i===Dp||i===Np||i===Up||i===Op)if(o===$t)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Dp)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Np)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Up)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Op)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Dp)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Np)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Up)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Op)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===n1||i===i1||i===r1||i===s1)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===n1)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===i1)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===r1)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===s1)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===o1||i===a1||i===l1)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===o1||i===a1)return o===$t?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===l1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===c1||i===u1||i===f1||i===d1||i===h1||i===p1||i===m1||i===g1||i===_1||i===v1||i===x1||i===y1||i===S1||i===M1)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===c1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===u1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===f1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===d1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===h1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===p1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===m1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===g1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===_1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===v1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===x1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===y1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===S1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===M1)return o===$t?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Fp||i===E1||i===w1)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Fp)return o===$t?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===E1)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===w1)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Zb||i===T1||i===A1||i===b1)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Fp)return s.COMPRESSED_RED_RGTC1_EXT;if(i===T1)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===A1)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===b1)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===gu?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}class GV extends lr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class yc extends Vn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const WV={type:"move"};class Jg{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new yc,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 yc,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ne,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ne),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new yc,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ne,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ne),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,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const _ of e.hand.values()){const m=t.getJointPose(_,i),d=this._getHandJoint(c,_);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"],f=c.joints["thumb-tip"],h=u.position.distanceTo(f.position),p=.02,g=.005;c.inputState.pinching&&h>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-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));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(WV)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new yc;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const $V=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,XV=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class jV{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new Li,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new ha({vertexShader:$V,fragmentShader:XV,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Xe(new kd(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class qV extends Iu{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,h=null,p=null,g=null;const _=new jV,m=t.getContextAttributes();let d=null,x=null;const v=[],y=[],b=new At;let w=null;const T=new lr;T.layers.enable(1),T.viewport=new On;const C=new lr;C.layers.enable(2),C.viewport=new On;const M=[T,C],S=new GV;S.layers.enable(1),S.layers.enable(2);let P=null,k=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function($){let oe=v[$];return oe===void 0&&(oe=new Jg,v[$]=oe),oe.getTargetRaySpace()},this.getControllerGrip=function($){let oe=v[$];return oe===void 0&&(oe=new Jg,v[$]=oe),oe.getGripSpace()},this.getHand=function($){let oe=v[$];return oe===void 0&&(oe=new Jg,v[$]=oe),oe.getHandSpace()};function U($){const oe=y.indexOf($.inputSource);if(oe===-1)return;const me=v[oe];me!==void 0&&(me.update($.inputSource,$.frame,c||o),me.dispatchEvent({type:$.type,data:$.inputSource}))}function N(){r.removeEventListener("select",U),r.removeEventListener("selectstart",U),r.removeEventListener("selectend",U),r.removeEventListener("squeeze",U),r.removeEventListener("squeezestart",U),r.removeEventListener("squeezeend",U),r.removeEventListener("end",N),r.removeEventListener("inputsourceschange",X);for(let $=0;$=0&&(y[de]=null,v[de].disconnect(me))}for(let oe=0;oe<$.added.length;oe++){const me=$.added[oe];let de=y.indexOf(me);if(de===-1){for(let Le=0;Le=y.length){y.push(me),de=Le;break}else if(y[Le]===null){y[Le]=me,de=Le;break}if(de===-1)break}const be=v[de];be&&be.connect(me)}}const z=new ne,te=new ne;function L($,oe,me){z.setFromMatrixPosition(oe.matrixWorld),te.setFromMatrixPosition(me.matrixWorld);const de=z.distanceTo(te),be=oe.projectionMatrix.elements,Le=me.projectionMatrix.elements,ke=be[14]/(be[10]-1),Qe=be[14]/(be[10]+1),V=(be[9]+1)/be[5],ot=(be[9]-1)/be[5],ee=(be[8]-1)/be[0],at=(Le[8]+1)/Le[0],Ne=ke*ee,Ze=ke*at,Ie=de/(-ee+at),We=Ie*-ee;if(oe.matrixWorld.decompose($.position,$.quaternion,$.scale),$.translateX(We),$.translateZ(Ie),$.matrixWorld.compose($.position,$.quaternion,$.scale),$.matrixWorldInverse.copy($.matrixWorld).invert(),be[10]===-1)$.projectionMatrix.copy(oe.projectionMatrix),$.projectionMatrixInverse.copy(oe.projectionMatrixInverse);else{const B=ke+Ie,E=Qe+Ie,A=Ne-We,F=Ze+(de-We),W=V*Qe/E*B,j=ot*Qe/E*B;$.projectionMatrix.makePerspective(A,F,W,j,B,E),$.projectionMatrixInverse.copy($.projectionMatrix).invert()}}function Z($,oe){oe===null?$.matrixWorld.copy($.matrix):$.matrixWorld.multiplyMatrices(oe.matrixWorld,$.matrix),$.matrixWorldInverse.copy($.matrixWorld).invert()}this.updateCamera=function($){if(r===null)return;let oe=$.near,me=$.far;_.texture!==null&&(_.depthNear>0&&(oe=_.depthNear),_.depthFar>0&&(me=_.depthFar)),S.near=C.near=T.near=oe,S.far=C.far=T.far=me,(P!==S.near||k!==S.far)&&(r.updateRenderState({depthNear:S.near,depthFar:S.far}),P=S.near,k=S.far);const de=$.parent,be=S.cameras;Z(S,de);for(let Le=0;Le0&&(m.alphaTest.value=d.alphaTest);const x=e.get(d),v=x.envMap,y=x.envMapRotation;v&&(m.envMap.value=v,Fa.copy(y),Fa.x*=-1,Fa.y*=-1,Fa.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Fa.y*=-1,Fa.z*=-1),m.envMapRotation.value.setFromMatrix4(YV.makeRotationFromEuler(Fa)),m.flipEnvMap.value=v.isCubeTexture&&v.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 o(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 a(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function l(m,d,x,v){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*x,m.scale.value=v*.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 f(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 p(m,d,x){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===Pi&&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=x.texture,m.transmissionSamplerSize.value.set(x.width,x.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 _(m,d){const x=e.get(d).light;m.referencePosition.value.setFromMatrixPosition(x.matrixWorld),m.nearDistance.value=x.shadow.camera.near,m.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function ZV(n,e,t,i){let r={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(x,v){const y=v.program;i.uniformBlockBinding(x,y)}function c(x,v){let y=r[x.id];y===void 0&&(g(x),y=u(x),r[x.id]=y,x.addEventListener("dispose",m));const b=v.program;i.updateUBOMapping(x,b);const w=e.render.frame;s[x.id]!==w&&(h(x),s[x.id]=w)}function u(x){const v=f();x.__bindingPointIndex=v;const y=n.createBuffer(),b=x.__size,w=x.usage;return n.bindBuffer(n.UNIFORM_BUFFER,y),n.bufferData(n.UNIFORM_BUFFER,b,w),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,v,y),y}function f(){for(let x=0;x0&&(y+=b-w),x.__size=y,x.__cache={},this}function _(x){const v={boundary:0,storage:0};return typeof x=="number"||typeof x=="boolean"?(v.boundary=4,v.storage=4):x.isVector2?(v.boundary=8,v.storage=8):x.isVector3||x.isColor?(v.boundary=16,v.storage=12):x.isVector4?(v.boundary=16,v.storage=16):x.isMatrix3?(v.boundary=48,v.storage=48):x.isMatrix4?(v.boundary=64,v.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),v}function m(x){const v=x.target;v.removeEventListener("dispose",m);const y=o.indexOf(v.__bindingPointIndex);o.splice(y,1),n.deleteBuffer(r[v.id]),delete r[v.id],delete s[v.id]}function d(){for(const x in r)n.deleteBuffer(r[x]);o=[],r={},s={}}return{bind:l,update:c,dispose:d}}class QV{constructor(e={}){const{canvas:t=HF(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let h;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");h=i.getContextAttributes().alpha}else h=o;const p=new Uint32Array(4),g=new Int32Array(4);let _=null,m=null;const d=[],x=[];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._outputColorSpace=Jr,this.toneMapping=Qo,this.toneMappingExposure=1;const v=this;let y=!1,b=0,w=0,T=null,C=-1,M=null;const S=new On,P=new On;let k=null;const U=new Ut(0);let N=0,X=t.width,z=t.height,te=1,L=null,Z=null;const ae=new On(0,0,X,z),fe=new On(0,0,X,z);let Me=!1;const Ve=new lR;let $=!1,oe=!1;const me=new sn,de=new ne,be=new On,Le={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ke=!1;function Qe(){return T===null?te:1}let V=i;function ot(I,se){return t.getContext(I,se)}try{const I={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:f};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Ty}`),t.addEventListener("webglcontextlost",re,!1),t.addEventListener("webglcontextrestored",q,!1),t.addEventListener("webglcontextcreationerror",ie,!1),V===null){const se="webgl2";if(V=ot(se,I),V===null)throw ot(se)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(I){throw console.error("THREE.WebGLRenderer: "+I.message),I}let ee,at,Ne,Ze,Ie,We,B,E,A,F,W,j,le,pe,ce,Ee,ve,ue,Re,Pe,ye,Se,Be,je;function J(){ee=new rH(V),ee.init(),Se=new VV(V,ee),at=new Zz(V,ee,e,Se),Ne=new BV(V),Ze=new aH(V),Ie=new TV,We=new HV(V,ee,Ne,Ie,at,Se,Ze),B=new Jz(v),E=new iH(v),A=new hk(V),Be=new Yz(V,A),F=new sH(V,A,Ze,Be),W=new cH(V,F,A,Ze),Re=new lH(V,at,We),Ee=new Qz(Ie),j=new wV(v,B,E,ee,at,Be,Ee),le=new KV(v,Ie),pe=new bV,ce=new DV(ee),ue=new qz(v,B,E,Ne,W,h,l),ve=new kV(v,W,at),je=new ZV(V,Ze,at,Ne),Pe=new Kz(V,ee,Ze),ye=new oH(V,ee,Ze),Ze.programs=j.programs,v.capabilities=at,v.extensions=ee,v.properties=Ie,v.renderLists=pe,v.shadowMap=ve,v.state=Ne,v.info=Ze}J();const H=new qV(v,V);this.xr=H,this.getContext=function(){return V},this.getContextAttributes=function(){return V.getContextAttributes()},this.forceContextLoss=function(){const I=ee.get("WEBGL_lose_context");I&&I.loseContext()},this.forceContextRestore=function(){const I=ee.get("WEBGL_lose_context");I&&I.restoreContext()},this.getPixelRatio=function(){return te},this.setPixelRatio=function(I){I!==void 0&&(te=I,this.setSize(X,z,!1))},this.getSize=function(I){return I.set(X,z)},this.setSize=function(I,se,R=!0){if(H.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}X=I,z=se,t.width=Math.floor(I*te),t.height=Math.floor(se*te),R===!0&&(t.style.width=I+"px",t.style.height=se+"px"),this.setViewport(0,0,I,se)},this.getDrawingBufferSize=function(I){return I.set(X*te,z*te).floor()},this.setDrawingBufferSize=function(I,se,R){X=I,z=se,te=R,t.width=Math.floor(I*R),t.height=Math.floor(se*R),this.setViewport(0,0,I,se)},this.getCurrentViewport=function(I){return I.copy(S)},this.getViewport=function(I){return I.copy(ae)},this.setViewport=function(I,se,R,D){I.isVector4?ae.set(I.x,I.y,I.z,I.w):ae.set(I,se,R,D),Ne.viewport(S.copy(ae).multiplyScalar(te).round())},this.getScissor=function(I){return I.copy(fe)},this.setScissor=function(I,se,R,D){I.isVector4?fe.set(I.x,I.y,I.z,I.w):fe.set(I,se,R,D),Ne.scissor(P.copy(fe).multiplyScalar(te).round())},this.getScissorTest=function(){return Me},this.setScissorTest=function(I){Ne.setScissorTest(Me=I)},this.setOpaqueSort=function(I){L=I},this.setTransparentSort=function(I){Z=I},this.getClearColor=function(I){return I.copy(ue.getClearColor())},this.setClearColor=function(){ue.setClearColor.apply(ue,arguments)},this.getClearAlpha=function(){return ue.getClearAlpha()},this.setClearAlpha=function(){ue.setClearAlpha.apply(ue,arguments)},this.clear=function(I=!0,se=!0,R=!0){let D=0;if(I){let O=!1;if(T!==null){const K=T.texture.format;O=K===Ly||K===Py||K===Cy}if(O){const K=T.texture.type,G=K===to||K===yl||K===od||K===gu||K===by||K===Ry,he=ue.getClearColor(),ge=ue.getClearAlpha(),Te=he.r,Ae=he.g,Ce=he.b;G?(p[0]=Te,p[1]=Ae,p[2]=Ce,p[3]=ge,V.clearBufferuiv(V.COLOR,0,p)):(g[0]=Te,g[1]=Ae,g[2]=Ce,g[3]=ge,V.clearBufferiv(V.COLOR,0,g))}else D|=V.COLOR_BUFFER_BIT}se&&(D|=V.DEPTH_BUFFER_BIT),R&&(D|=V.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),V.clear(D)},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",re,!1),t.removeEventListener("webglcontextrestored",q,!1),t.removeEventListener("webglcontextcreationerror",ie,!1),pe.dispose(),ce.dispose(),Ie.dispose(),B.dispose(),E.dispose(),W.dispose(),Be.dispose(),je.dispose(),j.dispose(),H.dispose(),H.removeEventListener("sessionstart",Kt),H.removeEventListener("sessionend",ri),Oi.stop()};function re(I){I.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function q(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const I=Ze.autoReset,se=ve.enabled,R=ve.autoUpdate,D=ve.needsUpdate,O=ve.type;J(),Ze.autoReset=I,ve.enabled=se,ve.autoUpdate=R,ve.needsUpdate=D,ve.type=O}function ie(I){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",I.statusMessage)}function xe(I){const se=I.target;se.removeEventListener("dispose",xe),we(se)}function we(I){Ye(I),Ie.remove(I)}function Ye(I){const se=Ie.get(I).programs;se!==void 0&&(se.forEach(function(R){j.releaseProgram(R)}),I.isShaderMaterial&&j.releaseShaderCache(I))}this.renderBufferDirect=function(I,se,R,D,O,K){se===null&&(se=Le);const G=O.isMesh&&O.matrixWorld.determinant()<0,he=ya(I,se,R,D,O);Ne.setMaterial(D,G);let ge=R.index,Te=1;if(D.wireframe===!0){if(ge=F.getWireframeAttribute(R),ge===void 0)return;Te=2}const Ae=R.drawRange,Ce=R.attributes.position;let Ge=Ae.start*Te,Oe=(Ae.start+Ae.count)*Te;K!==null&&(Ge=Math.max(Ge,K.start*Te),Oe=Math.min(Oe,(K.start+K.count)*Te)),ge!==null?(Ge=Math.max(Ge,0),Oe=Math.min(Oe,ge.count)):Ce!=null&&(Ge=Math.max(Ge,0),Oe=Math.min(Oe,Ce.count));const nt=Oe-Ge;if(nt<0||nt===1/0)return;Be.setup(O,D,he,R,ge);let ht,Je=Pe;if(ge!==null&&(ht=A.get(ge),Je=ye,Je.setIndex(ht)),O.isMesh)D.wireframe===!0?(Ne.setLineWidth(D.wireframeLinewidth*Qe()),Je.setMode(V.LINES)):Je.setMode(V.TRIANGLES);else if(O.isLine){let $e=D.linewidth;$e===void 0&&($e=1),Ne.setLineWidth($e*Qe()),O.isLineSegments?Je.setMode(V.LINES):O.isLineLoop?Je.setMode(V.LINE_LOOP):Je.setMode(V.LINE_STRIP)}else O.isPoints?Je.setMode(V.POINTS):O.isSprite&&Je.setMode(V.TRIANGLES);if(O.isBatchedMesh)if(O._multiDrawInstances!==null)Je.renderMultiDrawInstances(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount,O._multiDrawInstances);else if(ee.get("WEBGL_multi_draw"))Je.renderMultiDraw(O._multiDrawStarts,O._multiDrawCounts,O._multiDrawCount);else{const $e=O._multiDrawStarts,rt=O._multiDrawCounts,Ue=O._multiDrawCount,dn=ge?A.get(ge).bytesPerElement:1,yt=Ie.get(D).currentProgram.getUniforms();for(let Vt=0;Vt{function K(){if(D.forEach(function(G){Ie.get(G).currentProgram.isReady()&&D.delete(G)}),D.size===0){O(I);return}setTimeout(K,10)}ee.get("KHR_parallel_shader_compile")!==null?K():setTimeout(K,10)})};let it=null;function ft(I){it&&it(I)}function Kt(){Oi.stop()}function ri(){Oi.start()}const Oi=new cR;Oi.setAnimationLoop(ft),typeof self<"u"&&Oi.setContext(self),this.setAnimationLoop=function(I){it=I,H.setAnimationLoop(I),I===null?Oi.stop():Oi.start()},H.addEventListener("sessionstart",Kt),H.addEventListener("sessionend",ri),this.render=function(I,se){if(se!==void 0&&se.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(y===!0)return;if(I.matrixWorldAutoUpdate===!0&&I.updateMatrixWorld(),se.parent===null&&se.matrixWorldAutoUpdate===!0&&se.updateMatrixWorld(),H.enabled===!0&&H.isPresenting===!0&&(H.cameraAutoUpdate===!0&&H.updateCamera(se),se=H.getCamera()),I.isScene===!0&&I.onBeforeRender(v,I,se,T),m=ce.get(I,x.length),m.init(se),x.push(m),me.multiplyMatrices(se.projectionMatrix,se.matrixWorldInverse),Ve.setFromProjectionMatrix(me),oe=this.localClippingEnabled,$=Ee.init(this.clippingPlanes,oe),_=pe.get(I,d.length),_.init(),d.push(_),H.enabled===!0&&H.isPresenting===!0){const K=v.xr.getDepthSensingMesh();K!==null&&xs(K,se,-1/0,v.sortObjects)}xs(I,se,0,v.sortObjects),_.finish(),v.sortObjects===!0&&_.sort(L,Z),ke=H.enabled===!1||H.isPresenting===!1||H.hasDepthSensing()===!1,ke&&ue.addToRenderList(_,I),this.info.render.frame++,$===!0&&Ee.beginShadows();const R=m.state.shadowsArray;ve.render(R,I,se),$===!0&&Ee.endShadows(),this.info.autoReset===!0&&this.info.reset();const D=_.opaque,O=_.transmissive;if(m.setupLights(),se.isArrayCamera){const K=se.cameras;if(O.length>0)for(let G=0,he=K.length;G0&&ys(D,O,I,se),ke&&ue.render(I),ir(_,I,se);T!==null&&(We.updateMultisampleRenderTarget(T),We.updateRenderTargetMipmap(T)),I.isScene===!0&&I.onAfterRender(v,I,se),Be.resetDefaultState(),C=-1,M=null,x.pop(),x.length>0?(m=x[x.length-1],$===!0&&Ee.setGlobalState(v.clippingPlanes,m.state.camera)):m=null,d.pop(),d.length>0?_=d[d.length-1]:_=null};function xs(I,se,R,D){if(I.visible===!1)return;if(I.layers.test(se.layers)){if(I.isGroup)R=I.renderOrder;else if(I.isLOD)I.autoUpdate===!0&&I.update(se);else if(I.isLight)m.pushLight(I),I.castShadow&&m.pushShadow(I);else if(I.isSprite){if(!I.frustumCulled||Ve.intersectsSprite(I)){D&&be.setFromMatrixPosition(I.matrixWorld).applyMatrix4(me);const G=W.update(I),he=I.material;he.visible&&_.push(I,G,he,R,be.z,null)}}else if((I.isMesh||I.isLine||I.isPoints)&&(!I.frustumCulled||Ve.intersectsObject(I))){const G=W.update(I),he=I.material;if(D&&(I.boundingSphere!==void 0?(I.boundingSphere===null&&I.computeBoundingSphere(),be.copy(I.boundingSphere.center)):(G.boundingSphere===null&&G.computeBoundingSphere(),be.copy(G.boundingSphere.center)),be.applyMatrix4(I.matrixWorld).applyMatrix4(me)),Array.isArray(he)){const ge=G.groups;for(let Te=0,Ae=ge.length;Te0&&jr(O,se,R),K.length>0&&jr(K,se,R),G.length>0&&jr(G,se,R),Ne.buffers.depth.setTest(!0),Ne.buffers.depth.setMask(!0),Ne.buffers.color.setMask(!0),Ne.setPolygonOffset(!1)}function ys(I,se,R,D){if((R.isScene===!0?R.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[D.id]===void 0&&(m.state.transmissionRenderTarget[D.id]=new Sl(1,1,{generateMipmaps:!0,type:ee.has("EXT_color_buffer_half_float")||ee.has("EXT_color_buffer_float")?Dd:to,minFilter:il,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Lt.workingColorSpace}));const K=m.state.transmissionRenderTarget[D.id],G=D.viewport||S;K.setSize(G.z,G.w);const he=v.getRenderTarget();v.setRenderTarget(K),v.getClearColor(U),N=v.getClearAlpha(),N<1&&v.setClearColor(16777215,.5),v.clear(),ke&&ue.render(R);const ge=v.toneMapping;v.toneMapping=Qo;const Te=D.viewport;if(D.viewport!==void 0&&(D.viewport=void 0),m.setupLightsView(D),$===!0&&Ee.setGlobalState(v.clippingPlanes,D),jr(I,R,D),We.updateMultisampleRenderTarget(K),We.updateRenderTargetMipmap(K),ee.has("WEBGL_multisampled_render_to_texture")===!1){let Ae=!1;for(let Ce=0,Ge=se.length;Ce0),Ce=!!R.morphAttributes.position,Ge=!!R.morphAttributes.normal,Oe=!!R.morphAttributes.color;let nt=Qo;D.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(nt=v.toneMapping);const ht=R.morphAttributes.position||R.morphAttributes.normal||R.morphAttributes.color,Je=ht!==void 0?ht.length:0,$e=Ie.get(D),rt=m.state.lights;if($===!0&&(oe===!0||I!==M)){const tn=I===M&&D.id===C;Ee.setState(D,I,tn)}let Ue=!1;D.version===$e.__version?($e.needsLights&&$e.lightsStateVersion!==rt.state.version||$e.outputColorSpace!==he||O.isBatchedMesh&&$e.batching===!1||!O.isBatchedMesh&&$e.batching===!0||O.isBatchedMesh&&$e.batchingColor===!0&&O.colorTexture===null||O.isBatchedMesh&&$e.batchingColor===!1&&O.colorTexture!==null||O.isInstancedMesh&&$e.instancing===!1||!O.isInstancedMesh&&$e.instancing===!0||O.isSkinnedMesh&&$e.skinning===!1||!O.isSkinnedMesh&&$e.skinning===!0||O.isInstancedMesh&&$e.instancingColor===!0&&O.instanceColor===null||O.isInstancedMesh&&$e.instancingColor===!1&&O.instanceColor!==null||O.isInstancedMesh&&$e.instancingMorph===!0&&O.morphTexture===null||O.isInstancedMesh&&$e.instancingMorph===!1&&O.morphTexture!==null||$e.envMap!==ge||D.fog===!0&&$e.fog!==K||$e.numClippingPlanes!==void 0&&($e.numClippingPlanes!==Ee.numPlanes||$e.numIntersection!==Ee.numIntersection)||$e.vertexAlphas!==Te||$e.vertexTangents!==Ae||$e.morphTargets!==Ce||$e.morphNormals!==Ge||$e.morphColors!==Oe||$e.toneMapping!==nt||$e.morphTargetsCount!==Je)&&(Ue=!0):(Ue=!0,$e.__version=D.version);let dn=$e.currentProgram;Ue===!0&&(dn=yr(D,se,O));let yt=!1,Vt=!1,Yr=!1;const bt=dn.getUniforms(),xi=$e.uniforms;if(Ne.useProgram(dn.program)&&(yt=!0,Vt=!0,Yr=!0),D.id!==C&&(C=D.id,Vt=!0),yt||M!==I){bt.setValue(V,"projectionMatrix",I.projectionMatrix),bt.setValue(V,"viewMatrix",I.matrixWorldInverse);const tn=bt.map.cameraPosition;tn!==void 0&&tn.setValue(V,de.setFromMatrixPosition(I.matrixWorld)),at.logarithmicDepthBuffer&&bt.setValue(V,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2)),(D.isMeshPhongMaterial||D.isMeshToonMaterial||D.isMeshLambertMaterial||D.isMeshBasicMaterial||D.isMeshStandardMaterial||D.isShaderMaterial)&&bt.setValue(V,"isOrthographic",I.isOrthographicCamera===!0),M!==I&&(M=I,Vt=!0,Yr=!0)}if(O.isSkinnedMesh){bt.setOptional(V,O,"bindMatrix"),bt.setOptional(V,O,"bindMatrixInverse");const tn=O.skeleton;tn&&(tn.boneTexture===null&&tn.computeBoneTexture(),bt.setValue(V,"boneTexture",tn.boneTexture,We))}O.isBatchedMesh&&(bt.setOptional(V,O,"batchingTexture"),bt.setValue(V,"batchingTexture",O._matricesTexture,We),bt.setOptional(V,O,"batchingIdTexture"),bt.setValue(V,"batchingIdTexture",O._indirectTexture,We),bt.setOptional(V,O,"batchingColorTexture"),O._colorsTexture!==null&&bt.setValue(V,"batchingColorTexture",O._colorsTexture,We));const It=R.morphAttributes;if((It.position!==void 0||It.normal!==void 0||It.color!==void 0)&&Re.update(O,R,dn),(Vt||$e.receiveShadow!==O.receiveShadow)&&($e.receiveShadow=O.receiveShadow,bt.setValue(V,"receiveShadow",O.receiveShadow)),D.isMeshGouraudMaterial&&D.envMap!==null&&(xi.envMap.value=ge,xi.flipEnvMap.value=ge.isCubeTexture&&ge.isRenderTargetTexture===!1?-1:1),D.isMeshStandardMaterial&&D.envMap===null&&se.environment!==null&&(xi.envMapIntensity.value=se.environmentIntensity),Vt&&(bt.setValue(V,"toneMappingExposure",v.toneMappingExposure),$e.needsLights&&Ss(xi,Yr),K&&D.fog===!0&&le.refreshFogUniforms(xi,K),le.refreshMaterialUniforms(xi,D,te,z,m.state.transmissionRenderTarget[I.id]),kp.upload(V,uo($e),xi,We)),D.isShaderMaterial&&D.uniformsNeedUpdate===!0&&(kp.upload(V,uo($e),xi,We),D.uniformsNeedUpdate=!1),D.isSpriteMaterial&&bt.setValue(V,"center",O.center),bt.setValue(V,"modelViewMatrix",O.modelViewMatrix),bt.setValue(V,"normalMatrix",O.normalMatrix),bt.setValue(V,"modelMatrix",O.matrixWorld),D.isShaderMaterial||D.isRawShaderMaterial){const tn=D.uniformsGroups;for(let Ms=0,yi=tn.length;Ms0&&We.useMultisampledRTT(I)===!1?O=Ie.get(I).__webglMultisampledFramebuffer:Array.isArray(Ae)?O=Ae[R]:O=Ae,S.copy(I.viewport),P.copy(I.scissor),k=I.scissorTest}else S.copy(ae).multiplyScalar(te).floor(),P.copy(fe).multiplyScalar(te).floor(),k=Me;if(Ne.bindFramebuffer(V.FRAMEBUFFER,O)&&D&&Ne.drawBuffers(I,O),Ne.viewport(S),Ne.scissor(P),Ne.setScissorTest(k),K){const ge=Ie.get(I.texture);V.framebufferTexture2D(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,V.TEXTURE_CUBE_MAP_POSITIVE_X+se,ge.__webglTexture,R)}else if(G){const ge=Ie.get(I.texture),Te=se||0;V.framebufferTextureLayer(V.FRAMEBUFFER,V.COLOR_ATTACHMENT0,ge.__webglTexture,R||0,Te)}C=-1},this.readRenderTargetPixels=function(I,se,R,D,O,K,G){if(!(I&&I.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let he=Ie.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&G!==void 0&&(he=he[G]),he){Ne.bindFramebuffer(V.FRAMEBUFFER,he);try{const ge=I.texture,Te=ge.format,Ae=ge.type;if(!at.textureFormatReadable(Te)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!at.textureTypeReadable(Ae)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}se>=0&&se<=I.width-D&&R>=0&&R<=I.height-O&&V.readPixels(se,R,D,O,Se.convert(Te),Se.convert(Ae),K)}finally{const ge=T!==null?Ie.get(T).__webglFramebuffer:null;Ne.bindFramebuffer(V.FRAMEBUFFER,ge)}}},this.readRenderTargetPixelsAsync=async function(I,se,R,D,O,K,G){if(!(I&&I.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let he=Ie.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&G!==void 0&&(he=he[G]),he){Ne.bindFramebuffer(V.FRAMEBUFFER,he);try{const ge=I.texture,Te=ge.format,Ae=ge.type;if(!at.textureFormatReadable(Te))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!at.textureTypeReadable(Ae))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(se>=0&&se<=I.width-D&&R>=0&&R<=I.height-O){const Ce=V.createBuffer();V.bindBuffer(V.PIXEL_PACK_BUFFER,Ce),V.bufferData(V.PIXEL_PACK_BUFFER,K.byteLength,V.STREAM_READ),V.readPixels(se,R,D,O,Se.convert(Te),Se.convert(Ae),0),V.flush();const Ge=V.fenceSync(V.SYNC_GPU_COMMANDS_COMPLETE,0);await VF(V,Ge,4);try{V.bindBuffer(V.PIXEL_PACK_BUFFER,Ce),V.getBufferSubData(V.PIXEL_PACK_BUFFER,0,K)}finally{V.deleteBuffer(Ce),V.deleteSync(Ge)}return K}}finally{const ge=T!==null?Ie.get(T).__webglFramebuffer:null;Ne.bindFramebuffer(V.FRAMEBUFFER,ge)}}},this.copyFramebufferToTexture=function(I,se=null,R=0){I.isTexture!==!0&&(Ff("WebGLRenderer: copyFramebufferToTexture function signature has changed."),se=arguments[0]||null,I=arguments[1]);const D=Math.pow(2,-R),O=Math.floor(I.image.width*D),K=Math.floor(I.image.height*D),G=se!==null?se.x:0,he=se!==null?se.y:0;We.setTexture2D(I,0),V.copyTexSubImage2D(V.TEXTURE_2D,R,0,0,G,he,O,K),Ne.unbindTexture()},this.copyTextureToTexture=function(I,se,R=null,D=null,O=0){I.isTexture!==!0&&(Ff("WebGLRenderer: copyTextureToTexture function signature has changed."),D=arguments[0]||null,I=arguments[1],se=arguments[2],O=arguments[3]||0,R=null);let K,G,he,ge,Te,Ae;R!==null?(K=R.max.x-R.min.x,G=R.max.y-R.min.y,he=R.min.x,ge=R.min.y):(K=I.image.width,G=I.image.height,he=0,ge=0),D!==null?(Te=D.x,Ae=D.y):(Te=0,Ae=0);const Ce=Se.convert(se.format),Ge=Se.convert(se.type);We.setTexture2D(se,0),V.pixelStorei(V.UNPACK_FLIP_Y_WEBGL,se.flipY),V.pixelStorei(V.UNPACK_PREMULTIPLY_ALPHA_WEBGL,se.premultiplyAlpha),V.pixelStorei(V.UNPACK_ALIGNMENT,se.unpackAlignment);const Oe=V.getParameter(V.UNPACK_ROW_LENGTH),nt=V.getParameter(V.UNPACK_IMAGE_HEIGHT),ht=V.getParameter(V.UNPACK_SKIP_PIXELS),Je=V.getParameter(V.UNPACK_SKIP_ROWS),$e=V.getParameter(V.UNPACK_SKIP_IMAGES),rt=I.isCompressedTexture?I.mipmaps[O]:I.image;V.pixelStorei(V.UNPACK_ROW_LENGTH,rt.width),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,rt.height),V.pixelStorei(V.UNPACK_SKIP_PIXELS,he),V.pixelStorei(V.UNPACK_SKIP_ROWS,ge),I.isDataTexture?V.texSubImage2D(V.TEXTURE_2D,O,Te,Ae,K,G,Ce,Ge,rt.data):I.isCompressedTexture?V.compressedTexSubImage2D(V.TEXTURE_2D,O,Te,Ae,rt.width,rt.height,Ce,rt.data):V.texSubImage2D(V.TEXTURE_2D,O,Te,Ae,K,G,Ce,Ge,rt),V.pixelStorei(V.UNPACK_ROW_LENGTH,Oe),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,nt),V.pixelStorei(V.UNPACK_SKIP_PIXELS,ht),V.pixelStorei(V.UNPACK_SKIP_ROWS,Je),V.pixelStorei(V.UNPACK_SKIP_IMAGES,$e),O===0&&se.generateMipmaps&&V.generateMipmap(V.TEXTURE_2D),Ne.unbindTexture()},this.copyTextureToTexture3D=function(I,se,R=null,D=null,O=0){I.isTexture!==!0&&(Ff("WebGLRenderer: copyTextureToTexture3D function signature has changed."),R=arguments[0]||null,D=arguments[1]||null,I=arguments[2],se=arguments[3],O=arguments[4]||0);let K,G,he,ge,Te,Ae,Ce,Ge,Oe;const nt=I.isCompressedTexture?I.mipmaps[O]:I.image;R!==null?(K=R.max.x-R.min.x,G=R.max.y-R.min.y,he=R.max.z-R.min.z,ge=R.min.x,Te=R.min.y,Ae=R.min.z):(K=nt.width,G=nt.height,he=nt.depth,ge=0,Te=0,Ae=0),D!==null?(Ce=D.x,Ge=D.y,Oe=D.z):(Ce=0,Ge=0,Oe=0);const ht=Se.convert(se.format),Je=Se.convert(se.type);let $e;if(se.isData3DTexture)We.setTexture3D(se,0),$e=V.TEXTURE_3D;else if(se.isDataArrayTexture||se.isCompressedArrayTexture)We.setTexture2DArray(se,0),$e=V.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}V.pixelStorei(V.UNPACK_FLIP_Y_WEBGL,se.flipY),V.pixelStorei(V.UNPACK_PREMULTIPLY_ALPHA_WEBGL,se.premultiplyAlpha),V.pixelStorei(V.UNPACK_ALIGNMENT,se.unpackAlignment);const rt=V.getParameter(V.UNPACK_ROW_LENGTH),Ue=V.getParameter(V.UNPACK_IMAGE_HEIGHT),dn=V.getParameter(V.UNPACK_SKIP_PIXELS),yt=V.getParameter(V.UNPACK_SKIP_ROWS),Vt=V.getParameter(V.UNPACK_SKIP_IMAGES);V.pixelStorei(V.UNPACK_ROW_LENGTH,nt.width),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,nt.height),V.pixelStorei(V.UNPACK_SKIP_PIXELS,ge),V.pixelStorei(V.UNPACK_SKIP_ROWS,Te),V.pixelStorei(V.UNPACK_SKIP_IMAGES,Ae),I.isDataTexture||I.isData3DTexture?V.texSubImage3D($e,O,Ce,Ge,Oe,K,G,he,ht,Je,nt.data):se.isCompressedArrayTexture?V.compressedTexSubImage3D($e,O,Ce,Ge,Oe,K,G,he,ht,nt.data):V.texSubImage3D($e,O,Ce,Ge,Oe,K,G,he,ht,Je,nt),V.pixelStorei(V.UNPACK_ROW_LENGTH,rt),V.pixelStorei(V.UNPACK_IMAGE_HEIGHT,Ue),V.pixelStorei(V.UNPACK_SKIP_PIXELS,dn),V.pixelStorei(V.UNPACK_SKIP_ROWS,yt),V.pixelStorei(V.UNPACK_SKIP_IMAGES,Vt),O===0&&se.generateMipmaps&&V.generateMipmap($e),Ne.unbindTexture()},this.initRenderTarget=function(I){Ie.get(I).__webglFramebuffer===void 0&&We.setupRenderTarget(I)},this.initTexture=function(I){I.isCubeTexture?We.setTextureCube(I,0):I.isData3DTexture?We.setTexture3D(I,0):I.isDataArrayTexture||I.isCompressedArrayTexture?We.setTexture2DArray(I,0):We.setTexture2D(I,0),Ne.unbindTexture()},this.resetState=function(){b=0,w=0,T=null,Ne.reset(),Be.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Xs}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Iy?"display-p3":"srgb",t.unpackColorSpace=Lt.workingColorSpace===p0?"display-p3":"srgb"}}class JV extends Vn{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 ps,this.environmentIntensity=1,this.environmentRotation=new ps,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}}class mR extends Od{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ut(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const xm=new ne,ym=new ne,E3=new sn,tf=new Dy,$h=new m0,e_=new ne,w3=new ne;class Ro extends Vn{constructor(e=new gi,t=new mR){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;si)return;e_.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(e_);if(!(le.far))return{distance:l,point:w3.clone().applyMatrix4(n.matrixWorld),index:r,face:null,faceIndex:null,object:n}}class Zn extends gi{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],f=[],h=[],p=[];let g=0;const _=[],m=i/2;let d=0;x(),o===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(u),this.setAttribute("position",new Yt(f,3)),this.setAttribute("normal",new Yt(h,3)),this.setAttribute("uv",new Yt(p,2));function x(){const y=new ne,b=new ne;let w=0;const T=(t-e)/i;for(let C=0;C<=s;C++){const M=[],S=C/s,P=S*(t-e)+e;for(let k=0;k<=r;k++){const U=k/r,N=U*l+a,X=Math.sin(N),z=Math.cos(N);b.x=P*X,b.y=-S*i+m,b.z=P*z,f.push(b.x,b.y,b.z),y.set(X,T,z).normalize(),h.push(y.x,y.y,y.z),p.push(U,1-S),M.push(g++)}_.push(M)}for(let C=0;C.9&&T<.1&&(v<.2&&(o[x+0]+=1),y<.2&&(o[x+2]+=1),b<.2&&(o[x+4]+=1))}}function h(x){s.push(x.x,x.y,x.z)}function p(x,v){const y=x*3;v.x=e[y+0],v.y=e[y+1],v.z=e[y+2]}function g(){const x=new ne,v=new ne,y=new ne,b=new ne,w=new At,T=new At,C=new At;for(let M=0,S=0;M0)&&p.push(v,y,w),(d!==i-1||l.9&&(o.visible=!1)),this.axis==="Y"&&(Zt.setFromEuler(jh.set(0,0,Math.PI/2)),o.quaternion.copy(i).multiply(Zt),Math.abs(zt.copy(Xa).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Z"&&(Zt.setFromEuler(jh.set(0,Math.PI/2,0)),o.quaternion.copy(i).multiply(Zt),Math.abs(zt.copy(Ef).applyQuaternion(i).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="XYZE"&&(Zt.setFromEuler(jh.set(0,Math.PI/2,0)),zt.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(D3.lookAt(I3,zt,Xa)),o.quaternion.multiply(Zt),o.visible=this.dragging),this.axis==="E"&&(o.visible=!1)):o.name==="START"?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):o.name==="END"?(o.position.copy(this.worldPosition),o.visible=this.dragging):o.name==="DELTA"?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),Qn.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Qn.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(Qn),o.visible=this.dragging):(o.quaternion.copy(i),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=this.axis.search(o.name)!==-1));continue}o.quaternion.copy(i),this.mode==="translate"||this.mode==="scale"?(o.name==="X"&&Math.abs(zt.copy(Mf).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Y"&&Math.abs(zt.copy(Xa).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Z"&&Math.abs(zt.copy(Ef).applyQuaternion(i).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XY"&&Math.abs(zt.copy(Ef).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="YZ"&&Math.abs(zt.copy(Mf).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XZ"&&Math.abs(zt.copy(Xa).applyQuaternion(i).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)):this.mode==="rotate"&&(qh.copy(i),zt.copy(this.eye).applyQuaternion(Zt.copy(i).invert()),o.name.search("E")!==-1&&o.quaternion.setFromRotationMatrix(D3.lookAt(this.eye,I3,Xa)),o.name==="X"&&(Zt.setFromAxisAngle(Mf,Math.atan2(-zt.y,zt.z)),Zt.multiplyQuaternions(qh,Zt),o.quaternion.copy(Zt)),o.name==="Y"&&(Zt.setFromAxisAngle(Xa,Math.atan2(zt.x,zt.z)),Zt.multiplyQuaternions(qh,Zt),o.quaternion.copy(Zt)),o.name==="Z"&&(Zt.setFromAxisAngle(Ef,Math.atan2(zt.y,zt.x)),Zt.multiplyQuaternions(qh,Zt),o.quaternion.copy(Zt))),o.visible=o.visible&&(o.name.indexOf("X")===-1||this.showX),o.visible=o.visible&&(o.name.indexOf("Y")===-1||this.showY),o.visible=o.visible&&(o.name.indexOf("Z")===-1||this.showZ),o.visible=o.visible&&(o.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),o.material._color=o.material._color||o.material.color.clone(),o.material._opacity=o.material._opacity||o.material.opacity,o.material.color.copy(o.material._color),o.material.opacity=o.material._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(l){return o.name===l}))&&(o.material.color.setHex(16776960),o.material.opacity=1)}super.updateMatrixWorld(e)}}class aG extends Xe{constructor(){super(new kd(1e5,1e5,2,2),new Fd({visible:!1,wireframe:!0,side:is,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),Yh.copy(Mf).applyQuaternion(t==="local"?this.worldQuaternion:Bp),nf.copy(Xa).applyQuaternion(t==="local"?this.worldQuaternion:Bp),rf.copy(Ef).applyQuaternion(t==="local"?this.worldQuaternion:Bp),zt.copy(nf),this.mode){case"translate":case"scale":switch(this.axis){case"X":zt.copy(this.eye).cross(Yh),Kr.copy(Yh).cross(zt);break;case"Y":zt.copy(this.eye).cross(nf),Kr.copy(nf).cross(zt);break;case"Z":zt.copy(this.eye).cross(rf),Kr.copy(rf).cross(zt);break;case"XY":Kr.copy(rf);break;case"YZ":Kr.copy(Yh);break;case"XZ":zt.copy(rf),Kr.copy(nf);break;case"XYZ":case"E":Kr.set(0,0,0);break}break;case"rotate":default:Kr.set(0,0,0)}Kr.length()===0?this.quaternion.copy(this.cameraQuaternion):(N3.lookAt(Qn.set(0,0,0),Kr,zt),this.quaternion.setFromRotationMatrix(N3)),super.updateMatrixWorld(e)}}const st=Symbol("@@iwer/devui/input-scene"),lG=.016;class cG{constructor(e){const t=e.canvasContainer,i=new JV,r=new lr(e.fovy/Math.PI*180,t.offsetWidth/t.offsetHeight,.1,1e3),s=new yc,o=new yc;i.add(s),s.add(o),o.position.fromArray(e.position.vec3),o.quaternion.fromArray(e.quaternion.quat),o.add(r),r.position.x-=e.ipd/2;const a=new Xe(new hn(.1,.1,.1)),l=a.clone();a.position.fromArray(e.controllers.left.position.vec3),a.quaternion.fromArray(e.controllers.left.quaternion.quat),l.position.fromArray(e.controllers.right.position.vec3),l.quaternion.fromArray(e.controllers.right.quaternion.quat),o.attach(a),o.attach(l),a.visible=!1,l.visible=!1;const c=new Xe(new Fy(.25,.27,32),new Fd({color:16777215,side:eo}));c.rotateX(-Math.PI/2),i.add(c);const u=new QV({alpha:!0});u.setSize(t.offsetWidth,t.offsetHeight),u.setClearColor(0,0),t.appendChild(u.domElement);const f=new L3(r,u.domElement);f.attach(a),i.add(f);const h=new L3(r,u.domElement);h.attach(l),i.add(h);const p=new ResizeObserver(()=>{this.resize()});p.observe(t);const g=m=>{m.addEventListener("mouseDown",()=>{m.userData.pressStart=performance.now()}),m.addEventListener("mouseUp",()=>{const d=performance.now()-m.userData.pressStart;m.userData.pressStart=null,d<200&&(m.mode==="rotate"?m.setMode("translate"):m.setMode("rotate"))}),m.addEventListener("change",()=>{this.renderScene()})};g(f),g(h);const _=m=>{if(!this[st].isPointerLocked)return;const d=m.movementX||m.mozMovementX||m.webkitMovementX||0,x=m.movementY||m.mozMovementY||m.webkitMovementY||0;s.rotation.y-=d*.002,o.rotation.x-=x*.002,e.quaternion.copy(o.getWorldQuaternion(new zn)),this.renderScene()};this[st]={canvasContainer:t,renderer:u,scene:i,camera:r,playerRig:s,cameraRig:o,xrDevice:e,controllerIndicators:{left:a,right:l},transformControls:{left:f,right:h},headsetDefaultPosition:o.position.clone(),headsetDefaultQuaternion:o.quaternion.clone(),controllerDefaultPositions:{left:a.position.clone(),right:l.position.clone()},controllerDefaultQuaternions:{left:a.quaternion.clone(),right:l.quaternion.clone()},resizeObserver:p,isPointerLocked:!1,vec3:new ne,quat:new zn,mouseMoveHandler:_,keyState:{ShiftLeft:!1,KeyW:!1,KeyA:!1,KeyS:!1,KeyD:!1,ArrowUp:!1,ArrowDown:!1},movePlayerRig:()=>this.movePlayerRig(),moveInterval:null},document.addEventListener("pointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.addEventListener("mozpointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.addEventListener("webkitpointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.addEventListener("keydown",this.keyDownHandler.bind(this),!1),document.addEventListener("keyup",this.keyUpHandler.bind(this),!1)}lockPointer(){this[st].renderer.domElement.requestPointerLock=this[st].renderer.domElement.requestPointerLock||this[st].renderer.domElement.mozRequestPointerLock||this[st].renderer.domElement.webkitRequestPointerLock,this[st].renderer.domElement.requestPointerLock()}pointerLockChangeHandler(){this[st].isPointerLocked=document.pointerLockElement===this[st].renderer.domElement||document.mozPointerLockElement===this[st].renderer.domElement||document.webkitPointerLockElement===this[st].renderer.domElement,this[st].isPointerLocked?(document.addEventListener("mousemove",this[st].mouseMoveHandler,!1),Object.values(this[st].transformControls).forEach(e=>{e.enabled=!1,e.visible=!1})):(document.removeEventListener("mousemove",this[st].mouseMoveHandler,!1),Object.values(this[st].transformControls).forEach(e=>{e.enabled=!0,e.visible=!0}))}keyDownHandler(e){const{keyState:t,movePlayerRig:i,moveInterval:r}=this[st];e.code in t&&(t[e.code]=!0),t.ShiftLeft&&(t.KeyW||t.KeyA||t.KeyS||t.KeyD)&&(r||(this[st].moveInterval=window.setInterval(i,16))),t.ShiftLeft&&t.ArrowUp&&(this[st].cameraRig.position.y+=.05,this.renderScene()),t.ShiftLeft&&t.ArrowDown&&(this[st].cameraRig.position.y-=.05,this.renderScene())}keyUpHandler(e){const{keyState:t,moveInterval:i}=this[st];e.code in t&&(t[e.code]=!1),(!t.ShiftLeft||!(t.KeyW||t.KeyA||t.KeyS||t.KeyD))&&i&&(window.clearInterval(i),this[st].moveInterval=null)}movePlayerRig(){const{playerRig:e,keyState:t,vec3:i}=this[st];i.set((t.KeyD?1:0)-(t.KeyA?1:0),0,(t.KeyS?1:0)-(t.KeyW?1:0)),i.lengthSq()>0&&(i.normalize().multiplyScalar(lG).applyQuaternion(e.quaternion),e.position.add(i),this.renderScene())}syncFovy(){this[st].camera.fov=this[st].xrDevice.fovy/Math.PI*180,this[st].camera.updateProjectionMatrix()}resetDeviceTransforms(){const{playerRig:e,cameraRig:t,controllerIndicators:i}=this[st];t.position.copy(this[st].headsetDefaultPosition),t.quaternion.set(0,0,0,1),e.position.set(0,0,0),e.quaternion.set(0,0,0,1),Object.entries(i).forEach(([r,s])=>{s.position.copy(this[st].controllerDefaultPositions[r]),s.quaternion.copy(this[st].controllerDefaultQuaternions[r])}),this.syncDeviceTransforms(),this.renderScene()}syncDeviceTransforms(){const{xrDevice:e,cameraRig:t,controllerIndicators:i}=this[st];e.position.copy(t.getWorldPosition(this[st].vec3)),e.quaternion.copy(t.getWorldQuaternion(this[st].quat)),Object.entries(i).forEach(([r,s])=>{e.controllers[r].position.copy(s.getWorldPosition(this[st].vec3)),e.controllers[r].quaternion.copy(s.getWorldQuaternion(this[st].quat))})}renderScene(){this.syncDeviceTransforms(),this[st].renderer.render(this[st].scene,this[st].camera)}get domElement(){return this[st].renderer.domElement}resize(){const e=this[st].canvasContainer.offsetWidth,t=this[st].canvasContainer.offsetHeight;this[st].renderer.setSize(e,t),this[st].camera.aspect=e/t,this[st].camera.updateProjectionMatrix(),this.renderScene()}dispose(){this[st].resizeObserver.disconnect(),this[st].renderer.dispose(),document.removeEventListener("pointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.removeEventListener("mozpointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.removeEventListener("webkitpointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.removeEventListener("mousemove",this[st].mouseMoveHandler,!1),document.removeEventListener("keydown",this.keyDownHandler.bind(this),!1),document.removeEventListener("keyup",this.keyUpHandler.bind(this),!1)}}var gR={exports:{}},tr={},_R={exports:{}},vR={};/** + * @license React + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */(function(n){function e(L,Z){var ae=L.length;L.push(Z);e:for(;0>>1,Me=L[fe];if(0>>1;fer(oe,ae))mer(de,oe)?(L[fe]=de,L[me]=ae,fe=me):(L[fe]=oe,L[$]=ae,fe=$);else if(mer(de,ae))L[fe]=de,L[me]=ae,fe=me;else break e}}return Z}function r(L,Z){var ae=L.sortIndex-Z.sortIndex;return ae!==0?ae:L.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,f=null,h=3,p=!1,g=!1,_=!1,m=typeof setTimeout=="function"?setTimeout:null,d=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(L){for(var Z=t(c);Z!==null;){if(Z.callback===null)i(c);else if(Z.startTime<=L)i(c),Z.sortIndex=Z.expirationTime,e(l,Z);else break;Z=t(c)}}function y(L){if(_=!1,v(L),!g)if(t(l)!==null)g=!0,z(b);else{var Z=t(c);Z!==null&&te(y,Z.startTime-L)}}function b(L,Z){g=!1,_&&(_=!1,d(C),C=-1),p=!0;var ae=h;try{for(v(Z),f=t(l);f!==null&&(!(f.expirationTime>Z)||L&&!P());){var fe=f.callback;if(typeof fe=="function"){f.callback=null,h=f.priorityLevel;var Me=fe(f.expirationTime<=Z);Z=n.unstable_now(),typeof Me=="function"?f.callback=Me:f===t(l)&&i(l),v(Z)}else i(l);f=t(l)}if(f!==null)var Ve=!0;else{var $=t(c);$!==null&&te(y,$.startTime-Z),Ve=!1}return Ve}finally{f=null,h=ae,p=!1}}var w=!1,T=null,C=-1,M=5,S=-1;function P(){return!(n.unstable_now()-SL||125fe?(L.sortIndex=ae,e(c,L),t(l)===null&&L===t(c)&&(_?(d(C),C=-1):_=!0,te(y,ae-fe))):(L.sortIndex=Me,e(l,L),g||p||(g=!0,z(b))),L},n.unstable_shouldYield=P,n.unstable_wrapCallback=function(L){var Z=h;return function(){var ae=h;h=Z;try{return L.apply(this,arguments)}finally{h=ae}}}})(vR);_R.exports=vR;var uG=_R.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var fG=Tt,Zi=uG;function De(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),L1=Object.prototype.hasOwnProperty,dG=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,U3={},O3={};function hG(n){return L1.call(O3,n)?!0:L1.call(U3,n)?!1:dG.test(n)?O3[n]=!0:(U3[n]=!0,!1)}function pG(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function mG(n,e,t,i){if(e===null||typeof e>"u"||pG(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function vi(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Wn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Wn[n]=new vi(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Wn[e]=new vi(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Wn[n]=new vi(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Wn[n]=new vi(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){Wn[n]=new vi(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Wn[n]=new vi(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Wn[n]=new vi(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Wn[n]=new vi(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Wn[n]=new vi(n,5,!1,n.toLowerCase(),null,!1,!1)});var By=/[\-:]([a-z])/g;function zy(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(By,zy);Wn[e]=new vi(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(By,zy);Wn[e]=new vi(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(By,zy);Wn[e]=new vi(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Wn[n]=new vi(n,1,!1,n.toLowerCase(),null,!1,!1)});Wn.xlinkHref=new vi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Wn[n]=new vi(n,1,!1,n.toLowerCase(),null,!0,!0)});function Hy(n,e,t,i){var r=Wn.hasOwnProperty(e)?Wn[e]:null;(r!==null?r.type!==0:i||!(2a||r[o]!==s[a]){var l=` +`+r[o].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{r_=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?wf(n):""}function gG(n){switch(n.tag){case 5:return wf(n.type);case 16:return wf("Lazy");case 13:return wf("Suspense");case 19:return wf("SuspenseList");case 0:case 2:case 15:return n=s_(n.type,!1),n;case 11:return n=s_(n.type.render,!1),n;case 1:return n=s_(n.type,!0),n;default:return""}}function U1(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case Ec:return"Fragment";case Mc:return"Portal";case I1:return"Profiler";case Vy:return"StrictMode";case D1:return"Suspense";case N1:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case SR:return(n.displayName||"Context")+".Consumer";case yR:return(n._context.displayName||"Context")+".Provider";case Gy:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Wy:return e=n.displayName||null,e!==null?e:U1(n.type)||"Memo";case Fo:e=n._payload,n=n._init;try{return U1(n(e))}catch{}}return null}function _G(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return U1(e);case 8:return e===Vy?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function pa(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function ER(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function vG(n){var e=ER(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Zh(n){n._valueTracker||(n._valueTracker=vG(n))}function wR(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=ER(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function Sm(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function O1(n,e){var t=e.checked;return an({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function k3(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;t=pa(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function TR(n,e){e=e.checked,e!=null&&Hy(n,"checked",e,!1)}function F1(n,e){TR(n,e);var t=pa(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?k1(n,e.type,t):e.hasOwnProperty("defaultValue")&&k1(n,e.type,pa(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function B3(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function k1(n,e,t){(e!=="number"||Sm(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var Tf=Array.isArray;function Vc(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=Qh.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function ld(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var kf={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},xG=["Webkit","ms","Moz","O"];Object.keys(kf).forEach(function(n){xG.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),kf[e]=kf[n]})});function CR(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||kf.hasOwnProperty(n)&&kf[n]?(""+e).trim():e+"px"}function PR(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=CR(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var yG=an({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function H1(n,e){if(e){if(yG[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(De(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(De(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(De(61))}if(e.style!=null&&typeof e.style!="object")throw Error(De(62))}}function V1(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var G1=null;function $y(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var W1=null,Gc=null,Wc=null;function V3(n){if(n=Hd(n)){if(typeof W1!="function")throw Error(De(280));var e=n.stateNode;e&&(e=S0(e),W1(n.stateNode,n.type,e))}}function LR(n){Gc?Wc?Wc.push(n):Wc=[n]:Gc=n}function IR(){if(Gc){var n=Gc,e=Wc;if(Wc=Gc=null,V3(n),e)for(n=0;n>>=0,n===0?32:31-(LG(n)/IG|0)|0}var Jh=64,ep=4194304;function Af(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function Tm(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=Af(a):(s&=o,s!==0&&(i=Af(s)))}else o=t&~r,o!==0?i=Af(o):s!==0&&(i=Af(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0t;t++)e.push(n);return e}function Bd(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-Vr(e),n[e]=t}function OG(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0=zf),Z3=" ",Q3=!1;function QR(n,e){switch(n){case"keyup":return uW.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function JR(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var wc=!1;function dW(n,e){switch(n){case"compositionend":return JR(e);case"keypress":return e.which!==32?null:(Q3=!0,Z3);case"textInput":return n=e.data,n===Z3&&Q3?null:n;default:return null}}function hW(n,e){if(wc)return n==="compositionend"||!Jy&&QR(n,e)?(n=KR(),Hp=Ky=jo=null,wc=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=nw(t)}}function iC(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?iC(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function rC(){for(var n=window,e=Sm();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Sm(n.document)}return e}function eS(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function MW(n){var e=rC(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&iC(t.ownerDocument.documentElement,t)){if(i!==null&&eS(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=iw(t,s);var o=iw(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,Tc=null,K1=null,Vf=null,Z1=!1;function rw(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;Z1||Tc==null||Tc!==Sm(i)||(i=Tc,"selectionStart"in i&&eS(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Vf&&pd(Vf,i)||(Vf=i,i=Rm(K1,"onSelect"),0Rc||(n.current=ix[Rc],ix[Rc]=null,Rc--)}function Ht(n,e){Rc++,ix[Rc]=n.current,n.current=e}var ma={},ii=va(ma),Ii=va(!1),Ml=ma;function yu(n,e){var t=n.type.contextTypes;if(!t)return ma;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function Di(n){return n=n.childContextTypes,n!=null}function Pm(){qt(Ii),qt(ii)}function fw(n,e,t){if(ii.current!==ma)throw Error(De(168));Ht(ii,e),Ht(Ii,t)}function hC(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(De(108,_G(n)||"Unknown",r));return an({},t,i)}function Lm(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||ma,Ml=ii.current,Ht(ii,n),Ht(Ii,Ii.current),!0}function dw(n,e,t){var i=n.stateNode;if(!i)throw Error(De(169));t?(n=hC(n,e,Ml),i.__reactInternalMemoizedMergedChildContext=n,qt(Ii),qt(ii),Ht(ii,n)):qt(Ii),Ht(Ii,t)}var zs=null,M0=!1,x_=!1;function pC(n){zs===null?zs=[n]:zs.push(n)}function NW(n){M0=!0,pC(n)}function xa(){if(!x_&&zs!==null){x_=!0;var n=0,e=Ft;try{var t=zs;for(Ft=1;n>=o,r-=o,js=1<<32-Vr(e)+r|t<C?(M=T,T=null):M=T.sibling;var S=h(d,T,v[C],y);if(S===null){T===null&&(T=M);break}n&&T&&S.alternate===null&&e(d,T),x=s(S,x,C),w===null?b=S:w.sibling=S,w=S,T=M}if(C===v.length)return t(d,T),Jt&&ja(d,C),b;if(T===null){for(;CC?(M=T,T=null):M=T.sibling;var P=h(d,T,S.value,y);if(P===null){T===null&&(T=M);break}n&&T&&P.alternate===null&&e(d,T),x=s(P,x,C),w===null?b=P:w.sibling=P,w=P,T=M}if(S.done)return t(d,T),Jt&&ja(d,C),b;if(T===null){for(;!S.done;C++,S=v.next())S=f(d,S.value,y),S!==null&&(x=s(S,x,C),w===null?b=S:w.sibling=S,w=S);return Jt&&ja(d,C),b}for(T=i(d,T);!S.done;C++,S=v.next())S=p(T,d,C,S.value,y),S!==null&&(n&&S.alternate!==null&&T.delete(S.key===null?C:S.key),x=s(S,x,C),w===null?b=S:w.sibling=S,w=S);return n&&T.forEach(function(k){return e(d,k)}),Jt&&ja(d,C),b}function m(d,x,v,y){if(typeof v=="object"&&v!==null&&v.type===Ec&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Kh:e:{for(var b=v.key,w=x;w!==null;){if(w.key===b){if(b=v.type,b===Ec){if(w.tag===7){t(d,w.sibling),x=r(w,v.props.children),x.return=d,d=x;break e}}else if(w.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Fo&&mw(b)===w.type){t(d,w.sibling),x=r(w,v.props),x.ref=uf(d,w,v),x.return=d,d=x;break e}t(d,w);break}else e(d,w);w=w.sibling}v.type===Ec?(x=pl(v.props.children,d.mode,y,v.key),x.return=d,d=x):(y=Yp(v.type,v.key,v.props,null,d.mode,y),y.ref=uf(d,x,v),y.return=d,d=y)}return o(d);case Mc:e:{for(w=v.key;x!==null;){if(x.key===w)if(x.tag===4&&x.stateNode.containerInfo===v.containerInfo&&x.stateNode.implementation===v.implementation){t(d,x.sibling),x=r(x,v.children||[]),x.return=d,d=x;break e}else{t(d,x);break}else e(d,x);x=x.sibling}x=b_(v,d.mode,y),x.return=d,d=x}return o(d);case Fo:return w=v._init,m(d,x,w(v._payload),y)}if(Tf(v))return g(d,x,v,y);if(sf(v))return _(d,x,v,y);ap(d,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,x!==null&&x.tag===6?(t(d,x.sibling),x=r(x,v),x.return=d,d=x):(t(d,x),x=A_(v,d.mode,y),x.return=d,d=x),o(d)):t(d,x)}return m}var Mu=vC(!0),xC=vC(!1),Nm=va(null),Um=null,Lc=null,rS=null;function sS(){rS=Lc=Um=null}function oS(n){var e=Nm.current;qt(Nm),n._currentValue=e}function ox(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function Xc(n,e){Um=n,rS=Lc=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(bi=!0),n.firstContext=null)}function _r(n){var e=n._currentValue;if(rS!==n)if(n={context:n,memoizedValue:e,next:null},Lc===null){if(Um===null)throw Error(De(308));Lc=n,Um.dependencies={lanes:0,firstContext:n}}else Lc=Lc.next=n;return e}var sl=null;function aS(n){sl===null?sl=[n]:sl.push(n)}function yC(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,aS(e)):(t.next=r.next,r.next=t),e.interleaved=t,ro(n,i)}function ro(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var ko=!1;function lS(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function SC(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Ks(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function ia(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,Rt&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,ro(n,t)}return r=i.interleaved,r===null?(e.next=e,aS(i)):(e.next=r.next,r.next=e),i.interleaved=e,ro(n,t)}function Gp(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,jy(n,t)}}function gw(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function Om(n,e,t,i){var r=n.updateQueue;ko=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=n.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var f=r.baseState;o=0,u=c=l=null,a=s;do{var h=a.lane,p=a.eventTime;if((i&h)===h){u!==null&&(u=u.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=n,_=a;switch(h=e,p=t,_.tag){case 1:if(g=_.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=_.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=an({},f,h);break e;case 2:ko=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,h=r.effects,h===null?r.effects=[a]:h.push(a))}else p={eventTime:p,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=p,l=f):u=u.next=p,o|=h;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;h=a,a=h.next,h.next=null,r.lastBaseUpdate=h,r.shared.pending=null}}while(!0);if(u===null&&(l=f),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);Tl|=o,n.lanes=o,n.memoizedState=f}}function _w(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;et?t:4,n(!0);var i=S_.transition;S_.transition={};try{n(!1),e()}finally{Ft=t,S_.transition=i}}function kC(){return vr().memoizedState}function kW(n,e,t){var i=sa(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},BC(n))zC(e,t);else if(t=yC(n,e,t,i),t!==null){var r=hi();Gr(t,n,i,r),HC(t,e,i)}}function BW(n,e,t){var i=sa(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(BC(n))zC(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(r.hasEagerState=!0,r.eagerState=a,Xr(a,o)){var l=e.interleaved;l===null?(r.next=r,aS(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=yC(n,e,r,i),t!==null&&(r=hi(),Gr(t,n,i,r),HC(t,e,i))}}function BC(n){var e=n.alternate;return n===on||e!==null&&e===on}function zC(n,e){Gf=km=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function HC(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,jy(n,t)}}var Bm={readContext:_r,useCallback:Yn,useContext:Yn,useEffect:Yn,useImperativeHandle:Yn,useInsertionEffect:Yn,useLayoutEffect:Yn,useMemo:Yn,useReducer:Yn,useRef:Yn,useState:Yn,useDebugValue:Yn,useDeferredValue:Yn,useTransition:Yn,useMutableSource:Yn,useSyncExternalStore:Yn,useId:Yn,unstable_isNewReconciler:!1},zW={readContext:_r,useCallback:function(n,e){return Qr().memoizedState=[n,e===void 0?null:e],n},useContext:_r,useEffect:xw,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,$p(4194308,4,DC.bind(null,e,n),t)},useLayoutEffect:function(n,e){return $p(4194308,4,n,e)},useInsertionEffect:function(n,e){return $p(4,2,n,e)},useMemo:function(n,e){var t=Qr();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=Qr();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=kW.bind(null,on,n),[i.memoizedState,n]},useRef:function(n){var e=Qr();return n={current:n},e.memoizedState=n},useState:vw,useDebugValue:gS,useDeferredValue:function(n){return Qr().memoizedState=n},useTransition:function(){var n=vw(!1),e=n[0];return n=FW.bind(null,n[1]),Qr().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=on,r=Qr();if(Jt){if(t===void 0)throw Error(De(407));t=t()}else{if(t=e(),kn===null)throw Error(De(349));wl&30||TC(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,xw(bC.bind(null,i,s,n),[n]),i.flags|=2048,Md(9,AC.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=Qr(),e=kn.identifierPrefix;if(Jt){var t=qs,i=js;t=(i&~(1<<32-Vr(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=yd++,0<\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[ss]=e,n[_d]=i,ZC(n,e,!1,!1),e.stateNode=n;e:{switch(o=V1(t,i),t){case"dialog":Wt("cancel",n),Wt("close",n),r=i;break;case"iframe":case"object":case"embed":Wt("load",n),r=i;break;case"video":case"audio":for(r=0;rTu&&(e.flags|=128,i=!0,ff(s,!1),e.lanes=4194304)}else{if(!i)if(n=Fm(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),ff(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Jt)return Kn(e),null}else 2*mn()-s.renderingStartTime>Tu&&t!==1073741824&&(e.flags|=128,i=!0,ff(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=mn(),e.sibling=null,t=rn.current,Ht(rn,i?t&1|2:t&1),e):(Kn(e),null);case 22:case 23:return MS(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Gi&1073741824&&(Kn(e),e.subtreeFlags&6&&(e.flags|=8192)):Kn(e),null;case 24:return null;case 25:return null}throw Error(De(156,e.tag))}function qW(n,e){switch(nS(e),e.tag){case 1:return Di(e.type)&&Pm(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Eu(),qt(Ii),qt(ii),fS(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return uS(e),null;case 13:if(qt(rn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(De(340));Su()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return qt(rn),null;case 4:return Eu(),null;case 10:return oS(e.type._context),null;case 22:case 23:return MS(),null;case 24:return null;default:return null}}var cp=!1,ei=!1,YW=typeof WeakSet=="function"?WeakSet:Set,qe=null;function Ic(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){un(n,e,i)}else t.current=null}function mx(n,e,t){try{t()}catch(i){un(n,e,i)}}var Pw=!1;function KW(n,e){if(Q1=Am,n=rC(),eS(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,f=n,h=null;t:for(;;){for(var p;f!==t||r!==0&&f.nodeType!==3||(a=o+r),f!==s||i!==0&&f.nodeType!==3||(l=o+i),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===n)break t;if(h===t&&++c===r&&(a=o),h===s&&++u===i&&(l=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(J1={focusedElem:n,selectionRange:t},Am=!1,qe=e;qe!==null;)if(e=qe,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,qe=n;else for(;qe!==null;){e=qe;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var _=g.memoizedProps,m=g.memoizedState,d=e.stateNode,x=d.getSnapshotBeforeUpdate(e.elementType===e.type?_:Cr(e.type,_),m);d.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var v=e.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(De(163))}}catch(y){un(e,e.return,y)}if(n=e.sibling,n!==null){n.return=e.return,qe=n;break}qe=e.return}return g=Pw,Pw=!1,g}function Wf(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&mx(e,t,s)}r=r.next}while(r!==i)}}function T0(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function gx(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function eP(n){var e=n.alternate;e!==null&&(n.alternate=null,eP(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[ss],delete e[_d],delete e[nx],delete e[IW],delete e[DW])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function tP(n){return n.tag===5||n.tag===3||n.tag===4}function Lw(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||tP(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function _x(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=Cm));else if(i!==4&&(n=n.child,n!==null))for(_x(n,e,t),n=n.sibling;n!==null;)_x(n,e,t),n=n.sibling}function vx(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(vx(n,e,t),n=n.sibling;n!==null;)vx(n,e,t),n=n.sibling}var Bn=null,Lr=!1;function Po(n,e,t){for(t=t.child;t!==null;)nP(n,e,t),t=t.sibling}function nP(n,e,t){if(fs&&typeof fs.onCommitFiberUnmount=="function")try{fs.onCommitFiberUnmount(_0,t)}catch{}switch(t.tag){case 5:ei||Ic(t,e);case 6:var i=Bn,r=Lr;Bn=null,Po(n,e,t),Bn=i,Lr=r,Bn!==null&&(Lr?(n=Bn,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Bn.removeChild(t.stateNode));break;case 18:Bn!==null&&(Lr?(n=Bn,t=t.stateNode,n.nodeType===8?v_(n.parentNode,t):n.nodeType===1&&v_(n,t),dd(n)):v_(Bn,t.stateNode));break;case 4:i=Bn,r=Lr,Bn=t.stateNode.containerInfo,Lr=!0,Po(n,e,t),Bn=i,Lr=r;break;case 0:case 11:case 14:case 15:if(!ei&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&mx(t,e,o),r=r.next}while(r!==i)}Po(n,e,t);break;case 1:if(!ei&&(Ic(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){un(t,e,a)}Po(n,e,t);break;case 21:Po(n,e,t);break;case 22:t.mode&1?(ei=(i=ei)||t.memoizedState!==null,Po(n,e,t),ei=i):Po(n,e,t);break;default:Po(n,e,t)}}function Iw(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new YW),e.forEach(function(i){var r=s$.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function Rr(n,e){var t=e.deletions;if(t!==null)for(var i=0;ir&&(r=o),i&=~s}if(i=r,i=mn()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*QW(i/1960))-i,10n?16:n,qo===null)var i=!1;else{if(n=qo,qo=null,Vm=0,Rt&6)throw Error(De(331));var r=Rt;for(Rt|=4,qe=n.current;qe!==null;){var s=qe,o=s.child;if(qe.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lmn()-yS?hl(n,0):xS|=t),Ni(n,e)}function uP(n,e){e===0&&(n.mode&1?(e=ep,ep<<=1,!(ep&130023424)&&(ep=4194304)):e=1);var t=hi();n=ro(n,e),n!==null&&(Bd(n,e,t),Ni(n,t))}function r$(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),uP(n,t)}function s$(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(De(314))}i!==null&&i.delete(e),uP(n,t)}var fP;fP=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Ii.current)bi=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return bi=!1,XW(n,e,t);bi=!!(n.flags&131072)}else bi=!1,Jt&&e.flags&1048576&&mC(e,Dm,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;Xp(n,e),n=e.pendingProps;var r=yu(e,ii.current);Xc(e,t),r=hS(null,e,i,n,r,t);var s=pS();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Di(i)?(s=!0,Lm(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,lS(e),r.updater=w0,e.stateNode=r,r._reactInternals=e,lx(e,i,n,t),e=fx(null,e,i,!0,s,t)):(e.tag=0,Jt&&s&&tS(e),li(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(Xp(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=a$(i),n=Cr(i,n),r){case 0:e=ux(null,e,i,n,t);break e;case 1:e=bw(null,e,i,n,t);break e;case 11:e=Tw(null,e,i,n,t);break e;case 14:e=Aw(null,e,i,Cr(i.type,n),t);break e}throw Error(De(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Cr(i,r),ux(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Cr(i,r),bw(n,e,i,r,t);case 3:e:{if(qC(e),n===null)throw Error(De(387));i=e.pendingProps,s=e.memoizedState,r=s.element,SC(n,e),Om(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=wu(Error(De(423)),e),e=Rw(n,e,i,t,r);break e}else if(i!==r){r=wu(Error(De(424)),e),e=Rw(n,e,i,t,r);break e}else for(Xi=na(e.stateNode.containerInfo.firstChild),Yi=e,Jt=!0,Ir=null,t=xC(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Su(),i===r){e=so(n,e,t);break e}li(n,e,i,t)}e=e.child}return e;case 5:return MC(e),n===null&&sx(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,ex(i,r)?o=null:s!==null&&ex(i,s)&&(e.flags|=32),jC(n,e),li(n,e,o,t),e.child;case 6:return n===null&&sx(e),null;case 13:return YC(n,e,t);case 4:return cS(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=Mu(e,null,i,t):li(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Cr(i,r),Tw(n,e,i,r,t);case 7:return li(n,e,e.pendingProps,t),e.child;case 8:return li(n,e,e.pendingProps.children,t),e.child;case 12:return li(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,Ht(Nm,i._currentValue),i._currentValue=o,s!==null)if(Xr(s.value,o)){if(s.children===r.children&&!Ii.current){e=so(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=Ks(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),ox(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(De(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),ox(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}li(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Xc(e,t),r=_r(r),i=i(r),e.flags|=1,li(n,e,i,t),e.child;case 14:return i=e.type,r=Cr(i,e.pendingProps),r=Cr(i.type,r),Aw(n,e,i,r,t);case 15:return $C(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Cr(i,r),Xp(n,e),e.tag=1,Di(i)?(n=!0,Lm(e)):n=!1,Xc(e,t),VC(e,i,r),lx(e,i,r,t),fx(null,e,i,!0,n,t);case 19:return KC(n,e,t);case 22:return XC(n,e,t)}throw Error(De(156,e.tag))};function dP(n,e){return BR(n,e)}function o$(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function hr(n,e,t,i){return new o$(n,e,t,i)}function wS(n){return n=n.prototype,!(!n||!n.isReactComponent)}function a$(n){if(typeof n=="function")return wS(n)?1:0;if(n!=null){if(n=n.$$typeof,n===Gy)return 11;if(n===Wy)return 14}return 2}function oa(n,e){var t=n.alternate;return t===null?(t=hr(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function Yp(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")wS(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case Ec:return pl(t.children,r,s,e);case Vy:o=8,r|=8;break;case I1:return n=hr(12,t,e,r|2),n.elementType=I1,n.lanes=s,n;case D1:return n=hr(13,t,e,r),n.elementType=D1,n.lanes=s,n;case N1:return n=hr(19,t,e,r),n.elementType=N1,n.lanes=s,n;case MR:return b0(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case yR:o=10;break e;case SR:o=9;break e;case Gy:o=11;break e;case Wy:o=14;break e;case Fo:o=16,i=null;break e}throw Error(De(130,n==null?n:typeof n,""))}return e=hr(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function pl(n,e,t,i){return n=hr(7,n,i,e),n.lanes=t,n}function b0(n,e,t,i){return n=hr(22,n,i,e),n.elementType=MR,n.lanes=t,n.stateNode={isHidden:!1},n}function A_(n,e,t){return n=hr(6,n,null,e),n.lanes=t,n}function b_(n,e,t){return e=hr(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function l$(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=a_(0),this.expirationTimes=a_(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=a_(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function TS(n,e,t,i,r,s,o,a,l){return n=new l$(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=hr(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},lS(s),n}function c$(n,e,t){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gP)}catch(n){console.error(n)}}gP(),gR.exports=tr;var p$=gR.exports,_P,zw=p$;_P=zw.createRoot,zw.hydrateRoot;const m$=Symbol("@@iwer/devui/devui"),Ex={buttonPressDuration:250},vP=Tt.createContext(Ex),CS=()=>Tt.useContext(vP);class g${constructor(e,t={}){e.ipd=0;const i=e.canvasContainer,r=document.createElement("div");r.style.position="fixed",r.style.width="100%",r.style.height="100%",r.style.top="0",r.style.left="0",r.style.display="flex",r.style.justifyContent="center",r.style.alignItems="center",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.zIndex="3",i.appendChild(r);const s=new cG(e),o=s.domElement;o.style.position="fixed",o.style.width="100%",o.style.height="100%",o.style.top="0",o.style.left="0",o.style.zIndex="2",i.appendChild(o),_P(r).render(Q.jsx(_$,{xrDevice:e,inputLayer:s,options:t})),this[m$]={xrDevice:e,inputLayer:s}}}const _$=({xrDevice:n,inputLayer:e,options:t})=>{const[i,r]=Tt.useState(!1),[s,o]=Tt.useState(CO),[a,l]=Tt.useState(!1),[c,u]=Tt.useState(!1),[f,h]=Tt.useState(Ex);return Tt.useEffect(()=>{var p;h({buttonPressDuration:(p=t.buttonPressDuration)!==null&&p!==void 0?p:Ex.buttonPressDuration});const g=()=>{const _=document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement;r(!!_)};return document.addEventListener("pointerlockchange",g,!1),document.addEventListener("mozpointerlockchange",g,!1),document.addEventListener("webkitpointerlockchange",g,!1),()=>{document.removeEventListener("pointerlockchange",g,!1),document.removeEventListener("mozpointerlockchange",g,!1),document.removeEventListener("webkitpointerlockchange",g,!1)}},[]),Q.jsx(vP.Provider,{value:f,children:Q.jsxs("div",{style:{width:"100vw",height:"100vh",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[Q.jsx(WO,{xrDevice:n,inputLayer:e,keyMapOpen:a,setKeyMapOpen:l,fovSettingOpen:c,setFovSettingOpen:u}),a&&Q.jsx(LO,{keyMap:s,setKeyMap:o}),c&&Q.jsx(VO,{xrDevice:n,inputLayer:e}),Q.jsx(zO,{xrDevice:n,keyMap:s,pointerLocked:i})]})})},v$={RC_BOTTOM:0,RC_RIGHT:1,RC_LEFT:2,RC_TOP:3,BUMPER_LEFT:4,BUMPER_RIGHT:5,TRIGGER_LEFT:6,TRIGGER_RIGHT:7,CC_LEFT:8,CC_RIGHT:9,THUMBSTICK_LEFT:10,THUMBSTICK_RIGHT:11,LC_BOTTOM:12,LC_RIGHT:13,LC_LEFT:14,LC_TOP:15,CC_CENTER:16},x$={THUMBSTICK_LEFT_X:0,THUMBSTICK_LEFT_Y:1,THUMBSTICK_RIGHT_X:2,THUMBSTICK_RIGHT_Y:3},y$={TRIGGER:0,SQUEEZE:1,TOUCHPAD:2,THUMBSTICK:3,BUTTON_1:4,BUTTON_2:5},S$={TOUCHPAD_X:0,TOUCHPAD_Y:1,THUMBSTICK_X:2,THUMBSTICK_Y:3};class M${constructor(e,t={}){var i,r,s;this._buttons=[],this._gamepad=e,this._buttonPressValueMin=(i=t.buttonPressValueMin)!==null&&i!==void 0?i:0,this._buttonPressValueMax=(r=t.buttonPressValueMax)!==null&&r!==void 0?r:1,this._buttonClickThreshold=(s=t.buttonClickThreshold)!==null&&s!==void 0?s:.9;for(let o=0;othis._buttonPressValueMin:!1}getButton(e){const t=this.getButtonIdx(e);return this.getButtonByIndex(t)}getButtonDownByIndex(e){return this._buttons[e]?this._buttons[e].prevFrame.value<=this._buttonPressValueMin&&this._buttons[e].currFrame.value>this._buttonPressValueMin:!1}getButtonDown(e){const t=this.getButtonIdx(e);return this.getButtonDownByIndex(t)}getButtonUpByIndex(e){return this._buttons[e]?this._buttons[e].prevFrame.value>=this._buttonPressValueMax&&this._buttons[e].currFrame.valuethis._buttonClickThreshold:!1}getButtonClick(e){const t=this.getButtonIdx(e);return this.getButtonClickByIndex(t)}getAxisByIndex(e){return this._gamepad.axes[e]}getAxis(e){const t=this.getAxisIdx(e);return this.getAxisByIndex(t)}get2DInputAngle(e){const t=this.getAxis(e+"_X"),i=this.getAxis(e+"_Y");if(t==null||i==null||t==0&&i==0)return NaN;let r=Math.atan(t/i);return t>=0?i<0?r*=-1:i>0?r=Math.PI-r:i==0&&(r=Math.PI/2):i<0?r*=-1:i>0?r=-Math.PI-r:i==0&&(r=-Math.PI/2),r}get2DInputValue(e){const t=this.getAxis(e+"_X"),i=this.getAxis(e+"_Y");return Math.sqrt(t*t+i*i)}getHapticActuator(e){const t=this._gamepad.hapticActuators[e];if(t)return t;throw"Requested haptic actuator does not exist in gamepad"}}const Hw={type:"change"},PS={type:"start"},xP={type:"end"},dp=new Td,Vw=new ui,E$=Math.cos(70*gT.DEG2RAD),Sn=new Y,Mi=2*Math.PI,Bt={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},R_=1e-6;class w$ extends D8{constructor(e,t=null){super(e,t),this.state=Bt.NONE,this.enabled=!0,this.target=new Y,this.cursor=new Y,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minTargetRadius=0,this.maxTargetRadius=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.mouseButtons={LEFT:Nc.ROTATE,MIDDLE:Nc.DOLLY,RIGHT:Nc.PAN},this.touches={ONE:hc.ROTATE,TWO:hc.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this._lastPosition=new Y,this._lastQuaternion=new mr,this._lastTargetPosition=new Y,this._quat=new mr().setFromUnitVectors(e.up,new Y(0,1,0)),this._quatInverse=this._quat.clone().invert(),this._spherical=new r2,this._sphericalDelta=new r2,this._scale=1,this._panOffset=new Y,this._rotateStart=new lt,this._rotateEnd=new lt,this._rotateDelta=new lt,this._panStart=new lt,this._panEnd=new lt,this._panDelta=new lt,this._dollyStart=new lt,this._dollyEnd=new lt,this._dollyDelta=new lt,this._dollyDirection=new Y,this._mouse=new lt,this._performCursorZoom=!1,this._pointers=[],this._pointerPositions={},this._controlActive=!1,this._onPointerMove=A$.bind(this),this._onPointerDown=T$.bind(this),this._onPointerUp=b$.bind(this),this._onContextMenu=N$.bind(this),this._onMouseWheel=P$.bind(this),this._onKeyDown=L$.bind(this),this._onTouchStart=I$.bind(this),this._onTouchMove=D$.bind(this),this._onMouseDown=R$.bind(this),this._onMouseMove=C$.bind(this),this._interceptControlDown=U$.bind(this),this._interceptControlUp=O$.bind(this),this.domElement!==null&&this.connect(),this.update()}connect(){this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointercancel",this._onPointerUp),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.addEventListener("wheel",this._onMouseWheel,{passive:!1}),this.domElement.getRootNode().addEventListener("keydown",this._interceptControlDown,{passive:!0,capture:!0}),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.removeEventListener("pointercancel",this._onPointerUp),this.domElement.removeEventListener("wheel",this._onMouseWheel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.stopListenToKeyEvents(),this.domElement.getRootNode().removeEventListener("keydown",this._interceptControlDown,{capture:!0}),this.domElement.style.touchAction="auto"}dispose(){this.disconnect()}getPolarAngle(){return this._spherical.phi}getAzimuthalAngle(){return this._spherical.theta}getDistance(){return this.object.position.distanceTo(this.target)}listenToKeyEvents(e){e.addEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=e}stopListenToKeyEvents(){this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this._onKeyDown),this._domElementKeyEvents=null)}saveState(){this.target0.copy(this.target),this.position0.copy(this.object.position),this.zoom0=this.object.zoom}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Hw),this.update(),this.state=Bt.NONE}update(e=null){const t=this.object.position;Sn.copy(t).sub(this.target),Sn.applyQuaternion(this._quat),this._spherical.setFromVector3(Sn),this.autoRotate&&this.state===Bt.NONE&&this._rotateLeft(this._getAutoRotationAngle(e)),this.enableDamping?(this._spherical.theta+=this._sphericalDelta.theta*this.dampingFactor,this._spherical.phi+=this._sphericalDelta.phi*this.dampingFactor):(this._spherical.theta+=this._sphericalDelta.theta,this._spherical.phi+=this._sphericalDelta.phi);let i=this.minAzimuthAngle,r=this.maxAzimuthAngle;isFinite(i)&&isFinite(r)&&(i<-Math.PI?i+=Mi:i>Math.PI&&(i-=Mi),r<-Math.PI?r+=Mi:r>Math.PI&&(r-=Mi),i<=r?this._spherical.theta=Math.max(i,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+r)/2?Math.max(i,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(Sn.setFromSpherical(this._spherical),Sn.applyQuaternion(this._quatInverse),t.copy(this.target).add(Sn),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=Sn.length();o=this._clampDistance(a*this._scale);const l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const a=new Y(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new Y(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=Sn.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(dp.origin.copy(this.object.position),dp.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(dp.direction))R_||8*(1-this._lastQuaternion.dot(this.object.quaternion))>R_||this._lastTargetPosition.distanceToSquared(this.target)>R_?(this.dispatchEvent(Hw),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Mi/60*this.autoRotateSpeed*e:Mi/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Sn.setFromMatrixColumn(t,0),Sn.multiplyScalar(-e),this._panOffset.add(Sn)}_panUp(e,t){this.screenSpacePanning===!0?Sn.setFromMatrixColumn(t,1):(Sn.setFromMatrixColumn(t,0),Sn.crossVectors(this.object.up,Sn)),Sn.multiplyScalar(e),this._panOffset.add(Sn)}_pan(e,t){const i=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;Sn.copy(r).sub(this.target);let s=Sn.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/i.clientHeight,this.object.matrix),this._panUp(2*t*s/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),r=e-i.left,s=t-i.top,o=i.width,a=i.height;this._mouse.x=r/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Mi*this._rotateDelta.x/t.clientHeight),this._rotateUp(Mi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(Mi*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(-Mi*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(Mi*this.rotateSpeed/this.domElement.clientHeight):this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(-Mi*this.rotateSpeed/this.domElement.clientHeight):this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(i,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(i,r)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const i=this._getSecondPointerPosition(e),r=.5*(e.pageX+i.x),s=.5*(e.pageY+i.y);this._rotateEnd.set(r,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Mi*this._rotateDelta.x/t.clientHeight),this._rotateUp(Mi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),i=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(i,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),i=e.pageX-t.x,r=e.pageY-t.y,s=Math.sqrt(i*i+r*r);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t=2.0 are supported."));return}const c=new gX(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&a[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}}function k$(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Mt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class B${constructor(e){this.parser=e,this.name=Mt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class J${constructor(e){this.parser=e,this.name=Mt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class eX{constructor(e){this.parser=e,this.name=Mt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class tX{constructor(e){this.name=Mt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=r.byteOffset||0,c=r.byteLength||0,u=r.count,f=r.byteStride,h=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,f,h,r.mode,r.filter).then(function(p){return p.buffer}):o.ready.then(function(){const p=new ArrayBuffer(u*f);return o.decodeGltfBuffer(new Uint8Array(p),u,f,h,r.mode,r.filter),p})})}else return null}}class nX{constructor(e){this.name=Mt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const c of r.primitives)if(c.mode!==or.TRIANGLES&&c.mode!==or.TRIANGLE_STRIP&&c.mode!==or.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=i.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(u=>(l[c]=u,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const u=c.pop(),f=u.isGroup?u.children:[u],h=c[0].count,p=[];for(const g of f){const _=new dt,m=new Y,d=new mr,x=new Y(1,1,1),v=new j6(g.geometry,g.material,h);for(let y=0;y0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":n.search(/\.ktx2($|\?)/i)>0||n.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const mX=new dt;class gX{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new k$,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);r=i&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&r<17||s&&o<98?this.textureLoader=new Kx(this.options.manager):this.textureLoader=new g8(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Yx(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};return Ba(s,a,r),Bs(a,r),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,u]of o.children.entries())s(u,a.children[c])};return s(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i=2&&m.setY(M,w[T*l+1]),l>=3&&m.setZ(M,w[T*l+2]),l>=4&&m.setW(M,w[T*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=g}return m})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=i.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,i){const r=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,i).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(s.samplers||{})[o.sampler]||{};return u.magFilter=$w[h.magFilter]||$i,u.minFilter=$w[h.minFilter]||os,u.wrapS=Xw[h.wrapS]||aa,u.wrapT=Xw[h.wrapT]||aa,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==ni&&u.minFilter!==$i,r.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const i=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const o=r.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(f){c=!0;const h=new Blob([f],{type:o.mimeType});return l=a.createObjectURL(h),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(f){return new Promise(function(h,p){let g=h;t.isImageBitmapLoader===!0&&(g=function(_){const m=new mi(_);m.needsUpdate=!0,h(m)}),t.load(Pf.resolveURL(f,s.path),g,void 0,p)})}).then(function(f){return c===!0&&a.revokeObjectURL(l),Bs(f,o),f.userData.mimeType=o.mimeType||pX(o.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=u,u}assignTexture(e,t,i,r){const s=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),s.extensions[Mt.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[Mt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Mt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return r!==void 0&&(o.colorSpace=r),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new GT,cs.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new Xx,cs.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,this.cache.add(a,l)),i=l}if(r||s||o){let a="ClonedMaterial:"+i.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}e.material=i}getMaterialType(){return qx}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[Mt.KHR_MATERIALS_UNLIT]){const f=r[Mt.KHR_MATERIALS_UNLIT];o=f.getMaterialType(),c.push(f.extendParams(a,s,t))}else{const f=s.pbrMetallicRoughness||{};if(a.color=new tt(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const h=f.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],pi),a.opacity=h[3]}f.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",f.baseColorTexture,En)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),o=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=fi);const u=s.alphaMode||P_.OPAQUE;if(u===P_.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===P_.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Or&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new lt(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;a.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&o!==Or&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Or){const f=s.emissiveFactor;a.emissive=new tt().setRGB(f[0],f[1],f[2],pi)}return s.emissiveTexture!==void 0&&o!==Or&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,En)),Promise.all(c).then(function(){const f=new o(a);return s.name&&(f.name=s.name),Bs(f,s),t.associations.set(f,{materials:e}),s.extensions&&Ba(r,f,s),f})}createUniqueName(e){const t=Nt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function s(a){return i[Mt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return jw(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&dX(d,s),d.name=t.createUniqueName(s.name||"mesh_"+e),Bs(d,s),m.extensions&&Ba(r,d,m),t.assignFinalMaterial(d),f.push(d)}for(let p=0,g=f.length;p1?u=new Ws:c.length===1?u=c[0]:u=new fn,u!==c[0])for(let f=0,h=c.length;f{const f=new Map;for(const[h,p]of r.associations)(h instanceof cs||h instanceof mi)&&f.set(h,p);return u.traverse(h=>{const p=r.associations.get(h);p!=null&&f.set(h,p)}),f};return r.associations=c(s),s})}_createAnimationTracks(e,t,i,r,s){const o=[],a=e.name?e.name:e.uuid,l=[];Lo[s.path]===Lo.weights?e.traverse(function(h){h.morphTargetInfluences&&l.push(h.name?h.name:h.uuid)}):l.push(a);let c;switch(Lo[s.path]){case Lo.weights:c=nu;break;case Lo.rotation:c=iu;break;case Lo.position:case Lo.scale:c=ru;break;default:switch(i.itemSize){case 1:c=nu;break;case 2:case 3:default:c=ru;break}break}const u=r.interpolation!==void 0?cX[r.interpolation]:Yf,f=this._getArrayFromAccessor(i);for(let h=0,p=l.length;h{const c=r[l];return c&&(s={profileId:l,profilePath:`${e}/${c.path}`,deprecated:!!c.deprecated}),!!s}),!s){if(!t)throw new Error("No matching profile name found");const l=r[t];if(!l)throw new Error(`No matching profile name found and default profile "${t}" missing.`);s={profileId:t,profilePath:`${e}/${l.path}`,deprecated:!!l.deprecated}}const o=await MP(s.profilePath);let a;if(i){let l;if(n.handedness==="any"?l=o.layouts[Object.keys(o.layouts)[0]]:l=o.layouts[n.handedness],!l)throw new Error(`No matching handedness, ${n.handedness}, in profile ${s.profileId}`);l.assetPath&&(a=s.profilePath.replace("profile.json",l.assetPath))}return{profile:o,assetPath:a}}const yX={xAxis:0,yAxis:0,button:0,state:cn.ComponentState.DEFAULT};function SX(n=0,e=0){let t=n,i=e;if(Math.sqrt(n*n+e*e)>1){const o=Math.atan2(e,n);t=Math.cos(o),i=Math.sin(o)}return{normalizedXAxis:t*.5+.5,normalizedYAxis:i*.5+.5}}class MX{constructor(e){this.componentProperty=e.componentProperty,this.states=e.states,this.valueNodeName=e.valueNodeName,this.valueNodeProperty=e.valueNodeProperty,this.valueNodeProperty===cn.VisualResponseProperty.TRANSFORM&&(this.minNodeName=e.minNodeName,this.maxNodeName=e.maxNodeName),this.value=0,this.updateFromComponent(yX)}updateFromComponent({xAxis:e,yAxis:t,button:i,state:r}){const{normalizedXAxis:s,normalizedYAxis:o}=SX(e,t);switch(this.componentProperty){case cn.ComponentProperty.X_AXIS:this.value=this.states.includes(r)?s:.5;break;case cn.ComponentProperty.Y_AXIS:this.value=this.states.includes(r)?o:.5;break;case cn.ComponentProperty.BUTTON:this.value=this.states.includes(r)?i:0;break;case cn.ComponentProperty.STATE:this.valueNodeProperty===cn.VisualResponseProperty.VISIBILITY?this.value=this.states.includes(r):this.value=this.states.includes(r)?1:0;break;default:throw new Error(`Unexpected visualResponse componentProperty ${this.componentProperty}`)}}}class EX{constructor(e,t){if(!e||!t||!t.visualResponses||!t.gamepadIndices||Object.keys(t.gamepadIndices).length===0)throw new Error("Invalid arguments supplied");this.id=e,this.type=t.type,this.rootNodeName=t.rootNodeName,this.touchPointNodeName=t.touchPointNodeName,this.visualResponses={},Object.keys(t.visualResponses).forEach(i=>{const r=new MX(t.visualResponses[i]);this.visualResponses[i]=r}),this.gamepadIndices=Object.assign({},t.gamepadIndices),this.values={state:cn.ComponentState.DEFAULT,button:this.gamepadIndices.button!==void 0?0:void 0,xAxis:this.gamepadIndices.xAxis!==void 0?0:void 0,yAxis:this.gamepadIndices.yAxis!==void 0?0:void 0}}get data(){return{id:this.id,...this.values}}updateFromGamepad(e){if(this.values.state=cn.ComponentState.DEFAULT,this.gamepadIndices.button!==void 0&&e.buttons.length>this.gamepadIndices.button){const t=e.buttons[this.gamepadIndices.button];this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=this.values.button>1?1:this.values.button,t.pressed||this.values.button===1?this.values.state=cn.ComponentState.PRESSED:(t.touched||this.values.button>cn.ButtonTouchThreshold)&&(this.values.state=cn.ComponentState.TOUCHED)}this.gamepadIndices.xAxis!==void 0&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=this.values.xAxis>1?1:this.values.xAxis,this.values.state===cn.ComponentState.DEFAULT&&Math.abs(this.values.xAxis)>cn.AxisTouchThreshold&&(this.values.state=cn.ComponentState.TOUCHED)),this.gamepadIndices.yAxis!==void 0&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=this.values.yAxis>1?1:this.values.yAxis,this.values.state===cn.ComponentState.DEFAULT&&Math.abs(this.values.yAxis)>cn.AxisTouchThreshold&&(this.values.state=cn.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(t=>{t.updateFromComponent(this.values)})}}class wX{constructor(e,t,i){if(!e)throw new Error("No xrInputSource supplied");if(!t)throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=i,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(r=>{const s=this.layoutDescription.components[r];this.components[r]=new EX(r,s)}),this.updateFromGamepad()}get gripSpace(){return this.xrInputSource.gripSpace}get targetRaySpace(){return this.xrInputSource.targetRaySpace}get data(){const e=[];return Object.values(this.components).forEach(t=>{e.push(t.data)}),e}updateFromGamepad(){Object.values(this.components).forEach(e=>{e.updateFromGamepad(this.xrInputSource.gamepad)})}}const TX="https://cdn.jsdelivr.net/npm/@webxr-input-profiles/assets@1.0/dist/profiles",AX="generic-trigger";class bX extends fn{constructor(){super(),this.motionController=null,this.envMap=null}setEnvironmentMap(e){return this.envMap==e?this:(this.envMap=e,this.traverse(t=>{t.isMesh&&(t.material.envMap=this.envMap,t.material.needsUpdate=!0)}),this)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(t=>{Object.values(t.visualResponses).forEach(i=>{const{valueNode:r,minNode:s,maxNode:o,value:a,valueNodeProperty:l}=i;r&&(l===cn.VisualResponseProperty.VISIBILITY?r.visible=a:l===cn.VisualResponseProperty.TRANSFORM&&(r.quaternion.slerpQuaternions(s.quaternion,o.quaternion,a),r.position.lerpVectors(s.position,o.position,a)))})}))}}function RX(n,e){Object.values(n.components).forEach(t=>{const{type:i,touchPointNodeName:r,visualResponses:s}=t;if(i===cn.ComponentType.TOUCHPAD)if(t.touchPointNode=e.getObjectByName(r),t.touchPointNode){const o=new $T(.001),a=new Or({color:255}),l=new yn(o,a);t.touchPointNode.add(l)}else console.warn(`Could not find touch dot, ${t.touchPointNodeName}, in touchpad component ${t.id}`);Object.values(s).forEach(o=>{const{valueNodeName:a,minNodeName:l,maxNodeName:c,valueNodeProperty:u}=o;if(u===cn.VisualResponseProperty.TRANSFORM){if(o.minNode=e.getObjectByName(l),o.maxNode=e.getObjectByName(c),!o.minNode){console.warn(`Could not find ${l} in the model`);return}if(!o.maxNode){console.warn(`Could not find ${c} in the model`);return}}o.valueNode=e.getObjectByName(a),o.valueNode||console.warn(`Could not find ${a} in the model`)})})}function qw(n,e){RX(n.motionController,e),n.envMap&&e.traverse(t=>{t.isMesh&&(t.material.envMap=n.envMap,t.material.needsUpdate=!0)}),n.add(e)}class CX{constructor(e=null,t=null){this.gltfLoader=e,this.path=TX,this._assetCache={},this.onLoad=t,this.gltfLoader||(this.gltfLoader=new F$)}setPath(e){return this.path=e,this}createControllerModel(e){const t=new bX;let i=null;return e.addEventListener("connected",r=>{const s=r.data;s.targetRayMode!=="tracked-pointer"||!s.gamepad||s.hand||xX(s,this.path,AX).then(({profile:o,assetPath:a})=>{t.motionController=new wX(s,o,a);const l=this._assetCache[t.motionController.assetUrl];if(l)i=l.scene.clone(),qw(t,i),this.onLoad&&this.onLoad(i);else{if(!this.gltfLoader)throw new Error("GLTFLoader not set.");this.gltfLoader.setPath(""),this.gltfLoader.load(t.motionController.assetUrl,c=>{this._assetCache[t.motionController.assetUrl]=c,i=c.scene.clone(),qw(t,i),this.onLoad&&this.onLoad(i)},null,()=>{throw new Error(`Asset ${t.motionController.assetUrl} missing or malformed.`)})}}).catch(o=>{console.warn(o)})}),e.addEventListener("disconnected",()=>{t.motionController=null,t.remove(i),i=null}),t}}const Qi=new KT,Go=document.createElement("div");Go.id="loading";const LS=document.createElement("div");LS.className="progress";Go.append(LS);const IS=document.createElement("div");IS.className="progressbar";LS.append(IS);Qi.div=Go;Qi.handlers=[()=>{Go.style.opacity=1;const n=()=>{Go.style.opacity=Go.style.opacity-.1,typeof n=="function"&&Go.style.opacity>0?setTimeout(n,33):Go.style.display="none"};n()}];Qi.addLoadHandler=n=>{Qi.handlers.push(n)};Qi.onLoad=()=>{Qi.handlers.map(async n=>typeof n=="function"?await n():void 0)};Qi.onProgress=(n,e,t)=>{const i=e/t;IS.style.transform=`scaleX(${i})`};class PX extends yn{constructor(e,t={}){super(e),this.isWater=!0;const i=this,r=t.textureWidth!==void 0?t.textureWidth:512,s=t.textureHeight!==void 0?t.textureHeight:512,o=t.clipBias!==void 0?t.clipBias:0,a=t.alpha!==void 0?t.alpha:1,l=t.time!==void 0?t.time:0,c=t.waterNormals!==void 0?t.waterNormals:null,u=t.sunDirection!==void 0?t.sunDirection:new Y(.70707,.70707,0),f=new tt(t.sunColor!==void 0?t.sunColor:16777215),h=new tt(t.waterColor!==void 0?t.waterColor:8355711),p=t.eye!==void 0?t.eye:new Y(0,0,0),g=t.distortionScale!==void 0?t.distortionScale:20,_=t.side!==void 0?t.side:Wr,m=t.fog!==void 0?t.fog:!1,d=new ui,x=new Y,v=new Y,y=new Y,b=new dt,w=new Y(0,0,-1),T=new Ct,C=new Y,M=new Y,S=new Ct,P=new dt,k=new Jn,U=new la(r,s),N={name:"MirrorShader",uniforms:xv.merge([ze.fog,ze.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new dt},sunColor:{value:new tt(8355711)},sunDirection:{value:new Y(.70707,.70707,0)},eye:{value:new Y},waterColor:{value:new tt(5592405)}}]),vertexShader:` + uniform mat4 textureMatrix; + uniform float time; + + varying vec4 mirrorCoord; + varying vec4 worldPosition; + + #include + #include + #include + #include + + void main() { + mirrorCoord = modelMatrix * vec4( position, 1.0 ); + worldPosition = mirrorCoord.xyzw; + mirrorCoord = textureMatrix * mirrorCoord; + vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); + gl_Position = projectionMatrix * mvPosition; + + #include + #include + #include + #include + #include + }`,fragmentShader:` + uniform sampler2D mirrorSampler; + uniform float alpha; + uniform float time; + uniform float size; + uniform float distortionScale; + uniform sampler2D normalSampler; + uniform vec3 sunColor; + uniform vec3 sunDirection; + uniform vec3 eye; + uniform vec3 waterColor; + + varying vec4 mirrorCoord; + varying vec4 worldPosition; + + vec4 getNoise( vec2 uv ) { + vec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0); + vec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 ); + vec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 ); + vec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 ); + vec4 noise = texture2D( normalSampler, uv0 ) + + texture2D( normalSampler, uv1 ) + + texture2D( normalSampler, uv2 ) + + texture2D( normalSampler, uv3 ); + return noise * 0.5 - 1.0; + } + + void sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) { + vec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) ); + float direction = max( 0.0, dot( eyeDirection, reflection ) ); + specularColor += pow( direction, shiny ) * sunColor * spec; + diffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse; + } + + #include + #include + #include + #include + #include + #include + #include + #include + + void main() { + + #include + vec4 noise = getNoise( worldPosition.xz * size ); + vec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) ); + + vec3 diffuseLight = vec3(0.0); + vec3 specularLight = vec3(0.0); + + vec3 worldToEye = eye-worldPosition.xyz; + vec3 eyeDirection = normalize( worldToEye ); + sunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight ); + + float distance = length(worldToEye); + + vec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale; + vec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) ); + + float theta = max( dot( eyeDirection, surfaceNormal ), 0.0 ); + float rf0 = 0.3; + float reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 ); + vec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor; + vec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance); + vec3 outgoingLight = albedo; + gl_FragColor = vec4( outgoingLight, alpha ); + + #include + #include + #include + }`},X=new Ki({name:N.name,uniforms:xv.clone(N.uniforms),vertexShader:N.vertexShader,fragmentShader:N.fragmentShader,lights:!0,side:_,fog:m});X.uniforms.mirrorSampler.value=U.texture,X.uniforms.textureMatrix.value=P,X.uniforms.alpha.value=a,X.uniforms.time.value=l,X.uniforms.normalSampler.value=c,X.uniforms.sunColor.value=f,X.uniforms.waterColor.value=h,X.uniforms.sunDirection.value=u,X.uniforms.distortionScale.value=g,X.uniforms.eye.value=p,i.material=X,i.onBeforeRender=function(z,te,L){if(v.setFromMatrixPosition(i.matrixWorld),y.setFromMatrixPosition(L.matrixWorld),b.extractRotation(i.matrixWorld),x.set(0,0,1),x.applyMatrix4(b),C.subVectors(v,y),C.dot(x)>0)return;C.reflect(x).negate(),C.add(v),b.extractRotation(L.matrixWorld),w.set(0,0,-1),w.applyMatrix4(b),w.add(y),M.subVectors(v,w),M.reflect(x).negate(),M.add(v),k.position.copy(C),k.up.set(0,1,0),k.up.applyMatrix4(b),k.up.reflect(x),k.lookAt(M),k.far=L.far,k.updateMatrixWorld(),k.projectionMatrix.copy(L.projectionMatrix),P.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),P.multiply(k.projectionMatrix),P.multiply(k.matrixWorldInverse),d.setFromNormalAndCoplanarPoint(x,v),d.applyMatrix4(k.matrixWorldInverse),T.set(d.normal.x,d.normal.y,d.normal.z,d.constant);const Z=k.projectionMatrix;S.x=(Math.sign(T.x)+Z.elements[8])/Z.elements[0],S.y=(Math.sign(T.y)+Z.elements[9])/Z.elements[5],S.z=-1,S.w=(1+Z.elements[10])/Z.elements[14],T.multiplyScalar(2/T.dot(S)),Z.elements[2]=T.x,Z.elements[6]=T.y,Z.elements[10]=T.z+1-o,Z.elements[14]=T.w,p.setFromMatrixPosition(L.matrixWorld);const ae=z.getRenderTarget(),fe=z.xr.enabled,Me=z.shadowMap.autoUpdate;i.visible=!1,z.xr.enabled=!1,z.shadowMap.autoUpdate=!1,z.setRenderTarget(U),z.state.buffers.depth.setMask(!0),z.autoClear===!1&&z.clear(),z.render(te,k),i.visible=!0,z.xr.enabled=fe,z.shadowMap.autoUpdate=Me,z.setRenderTarget(ae);const Ve=L.viewport;Ve!==void 0&&z.state.viewport(Ve)}}}function Os(n,e){const t=document.createElement("canvas"),i=t.getContext("2d");return t.width=t.height=n,i.fillStyle="#444",i.fillRect(0,0,n,n),i.fillStyle=e,i.fillRect(0,0,n/2,n/2),i.fillRect(n/2,n/2,n/2,n/2),i}let Ax=!1;const LX=Os(256,"#f00"),Uo=new Kx(Qi),Qt=Uo.load("assets/material/textures/mip-low-res-enlarged.png");Uo.load("assets/material/textures/mipmap-256.png",n=>{console.log("Load mipmap[0]"),Uo.load("assets/material/textures/mipmap-128.png",e=>{console.log("Load mipmap[1]"),Uo.load("assets/material/textures/mipmap-64.png",t=>{console.log("Load mipmap[2]"),Uo.load("assets/material/textures/mipmap-32.png",i=>{console.log("Load mipmap[3]"),Uo.load("assets/material/textures/mipmap-16.png",r=>{console.log("Load mipmap[4]"),Uo.load("assets/material/textures/mipmap-8.png",s=>{console.log("Load mipmap[5]"),Uo.load("assets/material/textures/mipmap-4.png",o=>{console.log("Load mipmap[6]"),Qt.image?(console.log(Qt.image),Qt.mipmaps[0]=Qt.image):Qt.mipmaps[0]=n.image,Qt.mipmaps[1]=e.image,Qt.mipmaps[2]=t.image,Qt.mipmaps[3]=i.image,Qt.mipmaps[4]=r.image,Qt.mipmaps[5]=s.image,Qt.mipmaps[6]=o.image,Ax=!0})})})})})})});Qi.addLoadHandler(()=>{Qt.colorSpace=En,Qt.magFilter=ni,Qt.minFilter=os,Ax||(console.log("meshMaterial mipmaps have not been initialized!"),Qt.mipmaps[0]=LX.getImageData(0,0,256,256),Qt.mipmaps[1]=Os(128,"#0f0").getImageData(0,0,128,128),Qt.mipmaps[2]=Os(64,"#0f0").getImageData(0,0,64,64),Qt.mipmaps[3]=Os(32,"#00f").getImageData(0,0,32,32),Qt.mipmaps[4]=Os(16,"#404").getImageData(0,0,16,16),Qt.mipmaps[5]=Os(8,"#044").getImageData(0,0,8,8),Qt.mipmaps[6]=Os(4,"#044").getImageData(0,0,4,4)),Qt.mipmaps[7]=Os(2,"#040").getImageData(0,0,2,2),Qt.mipmaps[8]=Os(1,"#400").getImageData(0,0,1,1),Ax=!0});const IX=new Or({map:Qt,opacity:1,side:fi}),DX=new Z6(7.5,3,300,300),I0=new yn(DX,IX);I0.position.y=2;I0.rotX=function(n){this.rotation.x+=n};I0.rotY=function(n){this.rotation.y+=n};const Yw=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} + #ifdef HIGH_PRECISION +float precisionSafeLength( vec3 v ) { return length( v ); } + #else +float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; +} + #endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH +varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; + #endif + vViewPosition = - mvPosition.xyz; + gl_Position = projectionMatrix * mvPosition; +} +`,bx=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} + #ifdef HIGH_PRECISION +float precisionSafeLength( vec3 v ) { return length( v ); } + #else +float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; +} + #endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH +varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + gl_FragColor = vec4(vNormal * 0.25 + 0.75, 1); +} +`,NX=` +#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION +varying vec3 vWorldPosition; +#endif +#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} + #ifdef HIGH_PRECISION +float precisionSafeLength( vec3 v ) { return length( v ); } + #else +float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; +} + #endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH +varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +uniform float time; +uniform float amplitude; +uniform float speed; +uniform float frequency; +vec3 mod289(vec3 x) { + return x - floor(x * (1.0 / 289.0)) * 289.0; +} +vec4 mod289(vec4 x) { + return x - floor(x * (1.0 / 289.0)) * 289.0; +} +vec4 permute(vec4 x) { + return mod289(((x*34.0)+1.0)*x); +} +vec4 taylorInvSqrt(vec4 r) +{ + return 1.79284291400159 - 0.85373472095314 * r; +} +float noise(vec3 v) +{ + const vec2 C = vec2(1.0/6.0, 1.0/3.0) ; + const vec4 D = vec4(0.0, 0.5, 1.0, 2.0); + vec3 i = floor(v + dot(v, C.yyy) ); + vec3 x0 = v - i + dot(i, C.xxx) ; + vec3 g = step(x0.yzx, x0.xyz); + vec3 l = 1.0 - g; + vec3 i1 = min( g.xyz, l.zxy ); + vec3 i2 = max( g.xyz, l.zxy ); + vec3 x1 = x0 - i1 + C.xxx; + vec3 x2 = x0 - i2 + C.yyy; vec3 x3 = x0 - D.yyy; + i = mod289(i); + vec4 p = permute( permute( permute( + i.z + vec4(0.0, i1.z, i2.z, 1.0 )) + + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + + i.x + vec4(0.0, i1.x, i2.x, 1.0 )); + float n_ = 0.142857142857; vec3 ns = n_ * D.wyz - D.xzx; + vec4 j = p - 49.0 * floor(p * ns.z * ns.z); + vec4 x_ = floor(j * ns.z); + vec4 y_ = floor(j - 7.0 * x_ ); + vec4 x = x_ *ns.x + ns.yyyy; + vec4 y = y_ *ns.x + ns.yyyy; + vec4 h = 1.0 - abs(x) - abs(y); + vec4 b0 = vec4( x.xy, y.xy ); + vec4 b1 = vec4( x.zw, y.zw ); + vec4 s0 = floor(b0)*2.0 + 1.0; + vec4 s1 = floor(b1)*2.0 + 1.0; + vec4 sh = -step(h, vec4(0.0)); + vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ; + vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ; + vec3 p0 = vec3(a0.xy,h.x); + vec3 p1 = vec3(a0.zw,h.y); + vec3 p2 = vec3(a1.xy,h.z); + vec3 p3 = vec3(a1.zw,h.w); + vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3))); + p0 *= norm.x; + p1 *= norm.y; + p2 *= norm.z; + p3 *= norm.w; + vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); + m = m * m; + return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), + dot(p2,x2), dot(p3,x3) ) ); +} +float displace(vec3 point) { + return noise(vec3(point.x * frequency, point.z * frequency, time * speed)) * amplitude; +} +vec3 orthogonal(vec3 v) { + return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) + : vec3(0.0, -v.z, v.y)); +} +void main() { + vec3 displacedPosition = position + normal * displace(position); + float offset = 0.0078125; + vec3 tangent = orthogonal(normal); + vec3 bitangent = normalize(cross(normal, tangent)); + vec3 neighbour1 = position + tangent * offset; + vec3 neighbour2 = position + bitangent * offset; + vec3 displacedNeighbour1 = neighbour1 + normal * displace(neighbour1); + vec3 displacedNeighbour2 = neighbour2 + normal * displace(neighbour2); + vec3 displacedTangent = displacedNeighbour1 - displacedPosition; + vec3 displacedBitangent = displacedNeighbour2 - displacedPosition; + vec3 displacedNormal = normalize(cross(displacedTangent, displacedBitangent)); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 transformedNormal = displacedNormal; + #ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; + #endif + #ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif + #endif + #ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif + #endif + transformedNormal = normalMatrix * transformedNormal; + #ifdef FLIP_SIDED + transformedNormal = - transformedNormal; + #endif + #ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif + #endif + #include + #include + #include + #include + transformed = displacedPosition; + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; + #endif +}`,Kw=512,Zw=5,hp=10;let Rx={...ar.physical.uniforms,diffuse:{value:{r:.36,g:.51,b:.65}},roughness:{value:.5},amplitude:{value:.25},frequency:{value:.5},speed:{value:.3},time:{value:1}};const UX=new Ad(Zw,Zw,Kw,Kw).rotateX(-Math.PI/2),EP=new Ki({uniforms:Rx,vertexShader:NX,fragmentShader:bx,lights:!0,side:fi,defines:{STANDARD:"",PHYSICAL:""},extensions:{derivatives:!0},clipping:!0,clipShadows:!0});function OX(n,e){const t=new jx(.25,.03,100,16),i=EP;return new yn(t,i)}function FX(n){n.rotation.x+=.01,n.rotation.y+=.01}function Cx(n,e){if(n.hasOwnProperty("material")&&(n.material.clippingPlanes=[...e]),n.hasOwnProperty("traverse"))n.traverse(function(t){Cx(t,e)});else if(n.hasOwnProperty("children"))for(let t of n.children)Cx(t,e)}function kX(n,e,t,i,r,s=o=>{}){r.add(t);const o=new Ws;let a=!1,l=-100;const c=new ZT(16777215,.9);c.position.set(-.5,10,-10),o.add(c);const u=new m8(16777215,.3);o.add(u);const f=new PX(new Ad(1e4,1e4),{clipping:!0,clipShadows:!0,distortionScale:1/hp,fog:e.fog!==void 0,textureWidth:512,textureHeight:512,waterNormals:new Kx(Qi).load("assets/material/textures/waternormals.jpg",function(m){m.repeat.set(hp,hp),m.wrapS=m.wrapT=aa}),sunDirection:new Y,sunColor:16777215,waterColor:7695});f.rotation.x=-Math.PI/2,f.scale.x=f.scale.x,f.scale.y=f.scale.y,f.position.y=-hp/2;const h=new yn(UX,EP);h.position.set(0,-1,0);const p=I0;p.material=new Ki({uniforms:Rx,vertexShader:Yw,fragmentShader:bx});const g=OX(new tt(14540253));g.material=new Ki({uniforms:Rx,vertexShader:Yw,fragmentShader:bx}),g.position.set(0,1,0),o.add(h),o.add(p),o.add(g),e.add(o),o.translateX(0),o.translateY(1),o.translateZ(l);const _=.05;return console.log(o),s({soundMesh:g}),function(m,d,x,v,y,b){const w={};typeof v=="object"&&v!=null&&console.log("data_in:",v),FX(g),l+=_,l<-2.5?(o.translateZ(_),l<-25?(p.rotX(.05*(5*d)),p.rotY(.075*(5*d))):p.rotation.set(p.rotation.x-p.rotation.x/50,p.rotation.y-p.rotation.y/50,p.rotation.z-p.rotation.z/50)):(p.rotation.set(0,0,0),a||(a=!0,w.event="dream_landed")),h.material.uniforms.time.value=x,f.material.uniforms.time.value+=.1/60,b!==null&&b.length>0&&Cx(o,b),w.hasOwnProperty("event")&&typeof y=="function"&&y(w)}}const Qw=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} + #ifdef HIGH_PRECISION +float precisionSafeLength( vec3 v ) { return length( v ); } + #else +float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; +} + #endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH +varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec3 vPos; +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; + #endif + vViewPosition = - mvPosition.xyz; + vPos = position; + gl_Position = projectionMatrix * modelViewMatrix * vec4( vPos, 1.0 ); +} +`,Jw=`uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} + #ifdef HIGH_PRECISION +float precisionSafeLength( vec3 v ) { return length( v ); } + #else +float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; +} + #endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH +varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);} +vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;} +vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);} +float cnoise(vec3 P){ + vec3 Pi0 = floor(P); vec3 Pi1 = Pi0 + vec3(1.0); Pi0 = mod(Pi0, 289.0); + Pi1 = mod(Pi1, 289.0); + vec3 Pf0 = fract(P); vec3 Pf1 = Pf0 - vec3(1.0); vec4 ix = vec4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); + vec4 iy = vec4(Pi0.yy, Pi1.yy); + vec4 iz0 = Pi0.zzzz; + vec4 iz1 = Pi1.zzzz; + vec4 ixy = permute(permute(ix) + iy); + vec4 ixy0 = permute(ixy + iz0); + vec4 ixy1 = permute(ixy + iz1); + vec4 gx0 = ixy0 / 7.0; + vec4 gy0 = fract(floor(gx0) / 7.0) - 0.5; + gx0 = fract(gx0); + vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0); + vec4 sz0 = step(gz0, vec4(0.0)); + gx0 -= sz0 * (step(0.0, gx0) - 0.5); + gy0 -= sz0 * (step(0.0, gy0) - 0.5); + vec4 gx1 = ixy1 / 7.0; + vec4 gy1 = fract(floor(gx1) / 7.0) - 0.5; + gx1 = fract(gx1); + vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1); + vec4 sz1 = step(gz1, vec4(0.0)); + gx1 -= sz1 * (step(0.0, gx1) - 0.5); + gy1 -= sz1 * (step(0.0, gy1) - 0.5); + vec3 g000 = vec3(gx0.x,gy0.x,gz0.x); + vec3 g100 = vec3(gx0.y,gy0.y,gz0.y); + vec3 g010 = vec3(gx0.z,gy0.z,gz0.z); + vec3 g110 = vec3(gx0.w,gy0.w,gz0.w); + vec3 g001 = vec3(gx1.x,gy1.x,gz1.x); + vec3 g101 = vec3(gx1.y,gy1.y,gz1.y); + vec3 g011 = vec3(gx1.z,gy1.z,gz1.z); + vec3 g111 = vec3(gx1.w,gy1.w,gz1.w); + vec4 norm0 = taylorInvSqrt(vec4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); + g000 *= norm0.x; + g010 *= norm0.y; + g100 *= norm0.z; + g110 *= norm0.w; + vec4 norm1 = taylorInvSqrt(vec4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); + g001 *= norm1.x; + g011 *= norm1.y; + g101 *= norm1.z; + g111 *= norm1.w; + float n000 = dot(g000, Pf0); + float n100 = dot(g100, vec3(Pf1.x, Pf0.yz)); + float n010 = dot(g010, vec3(Pf0.x, Pf1.y, Pf0.z)); + float n110 = dot(g110, vec3(Pf1.xy, Pf0.z)); + float n001 = dot(g001, vec3(Pf0.xy, Pf1.z)); + float n101 = dot(g101, vec3(Pf1.x, Pf0.y, Pf1.z)); + float n011 = dot(g011, vec3(Pf0.x, Pf1.yz)); + float n111 = dot(g111, Pf1); + vec3 fade_xyz = fade(Pf0); + vec4 n_z = mix(vec4(n000, n100, n010, n110), vec4(n001, n101, n011, n111), fade_xyz.z); + vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y); + float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x); + return 2.2 * n_xyz; +} +varying vec3 vPos; +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include + gl_FragColor = gl_FragColor * 0.05; + float skyRadius = 5.01; + vec3 noiseOffset = vec3(100.01, 100.01, 100.01); + vec3 env_c1 = vec3(0.036, 0.051, 0.065); + vec3 env_c2 = vec3(0.065, 0.036, 0.051); + float clusterSize = 0.2; + float clusterStrength = 0.2; + float starSize = 0.01; + float starDensity = 0.09; + float freq = 1.1/skyRadius; + float noise = cnoise(vPos * freq); + vec4 backgroundColor = vec4(mix( + vec4(0.125 - mix(env_c1, vNormal * 0.25, noise), 1).rbg, + vec4(0.125 - mix(env_c2, vNormal * 0.25, noise), 1).rbg, + noise + ), 1.0); + gl_FragColor += backgroundColor; + float scaledClusterSize = (1.0/clusterSize)/skyRadius; + float scaledStarSize = (1.0/starSize)/skyRadius; + float cs = pow(cnoise(scaledClusterSize*vPos+noiseOffset),1.0/clusterStrength) + cnoise(scaledStarSize*vPos); + float c = clamp(pow(cs, 1.0/starDensity),0.0,1.0); + vec4 starColor = 0.5 * vec4(c, c, c, 1.0); + gl_FragColor += starColor; +} +`,BX=document.createElement("canvas"),Px=new WT(BX);function zX(n,e,t){const i=t*t;n.repeat.set(i,i),n.repeat.x=i,n.repeat.y=i,n.wrapS=n.wrapT=aa,n.colorSpace=En;const r=n.source.data.getContext("2d");r.canvas.width=r.canvas.height=i;const s=r.canvas.width,o=r.canvas.height;r.fillStyle="transparent",r.fillRect(0,0,r.canvas.width,r.canvas.height),r.strokeStyle=e,r.beginPath();for(let a=t/2;a<=s;a+=t)r.save(),r.translate(.5,0),r.moveTo(a-.5,0),r.lineTo(a-.5,o),r.restore();for(let a=t/2;a<=o;a+=t)r.save(),r.translate(0,.5),r.moveTo(0,a-.5),r.lineTo(s,a-.5),r.restore();return r.stroke(),r}zX(Px,"#09F",10);function I_(n,e){n.layers.set(e),n.traverse(function(t){t.layers.set(e)})}const Pr=new Map;Pr.set("inside",1);Pr.set("outside",2);Pr.set("portal",3);const Ll=new Map;Ll.set("white",new tt(16777215));Ll.set("grey",new tt(14540253));Ll.set("orangeLight",new tt(16766409));Ll.set("orangeDark",new tt(16495234));Ll.set("green",new tt(13161419));Ll.set("blue",new tt(12308958));const Vs=new Map;Vs.set("isLeft",!1);Vs.set("isRight",!1);Vs.set("isUp",!1);Vs.set("isDown",!1);const ms=new Map;ms.set("a","isLeft");ms.set("ArrowLeft","isLeft");ms.set("w","isUp");ms.set("ArrowUp","isUp");ms.set("s","isDown");ms.set("ArrowDown","isDown");ms.set("d","isRight");ms.set("ArrowRight","isRight");let za=null,pf=null;const HX=[];let Ha=null;function VX(n,e){const t=new x8;return n.add(t),n.listener=t,window.listenerAnchor=n,new Promise((i,r)=>{const s=new M8(n.listener),o=new _8(Qi);document.body.append(Qi.div),o.load(e,a=>{s.setBuffer(a),s.setRefDistance(1),s.setVolume(1),n.sound=s,console.log("Play sound!"),s.play(),setTimeout(i,1500,s)})})}function GX(n){return new Promise((e,t)=>{const i=new E8(n,32);Qi.addLoadHandler(()=>{setTimeout(e,1500,i)})})}async function WX(n=(e,t,i,r)=>{}){const e=new JT;let t=!1;if(navigator.xr&&(t=await(navigator.xr.isSessionSupported("immersive-ar")||navigator.xr.isSessionSupported("immersive-vr"))),!t){const F=new hN(vN);F.installRuntime(),F.fovy=75/180*Math.PI,F.ipd=0,window.xrdevice=F,F.controllers.right.position.set(.15649,1.43474,-.38368),F.controllers.right.quaternion.set(.14766305685043335,.02471366710960865,-.0037767395842820406,.9887216687202454),F.controllers.left.position.set(-.15649,1.43474,-.38368),F.controllers.left.quaternion.set(.14766305685043335,.02471366710960865,-.0037767395842820406,.9887216687202454),new g$(F)}const i={width:window.innerWidth,height:window.innerHeight},r=new OM({antialias:!0});r.setPixelRatio(window.devicePixelRatio),r.setSize(i.width,i.height);function s(F,W){r.domElement.width=F,r.domElement.height=W,r.setSize(F,W)}const o=new WT(r.domElement),a=new OM({antialias:!0});a.setPixelRatio(window.devicePixelRatio),a.setSize(i.width,i.height),a.xr.enabled=!0;function l(F,W){a.setSize(F,W)}r.localClippingEnabled=!0,a.localClippingEnabled=!0,document.body.appendChild(r.domElement),r.domElement.style.display="inline-block",document.body.appendChild(a.domElement),a.domElement.style.display="inline-block";const c=new H6,u=new Ws;c.add(u);const f=new lt,h=document.createElement("div");h.id="data-pad",h.style="max-width: 100px; min-width: 100px; min-height: 320px; color: white; background-color: black;",h.innerHTML="More stats...
";const p=document.createElement("p");p.id="data-pad-data",p.innerHTML="",h.append(p);const g=new wP;g.showPanel(0),g.dom.append(h),g.dom.style.maxWidth="100px",g.dom.style.minWidth="100px",g.dom.style.backgroundColor="black",document.body.appendChild(g.dom);const _=new Jn(50,i.width/i.height,.1,100);_.position.set(0,1.6,1);function m(F,W){_.aspect=F/W,_.updateProjectionMatrix()}const d=new Y(0,.5,-1),x=new w$(_,a.domElement);x.enableZoom=!1,x.enablePan=!1,x.target=d,x.update();const v=new CX,y={left:null,right:null};for(let F=0;F<2;F++){const W=a.xr.getController(F),j=a.xr.getControllerGrip(F),le=v.createControllerModel(j);j.add(le),j.addEventListener("connected",pe=>{W.visible=!0,j.visible=!0;const ce=pe.data.handedness;y[ce]={gamepad:new M$(pe.data.gamepad),raySpace:W,gripSpace:j,mesh:le}}),j.addEventListener("disconnected",pe=>{W.visible=!1,j.visible=!1;const ce=pe.data.handedness;y[ce]=null}),u.add(W,j)}u.add(_),za=null;const b=n(a,c,_,y,u,async F=>{F.hasOwnProperty("soundMesh")&&(Ha=F.soundMesh,pf=await GX(await VX(Ha,"assets/audio/the_bardos_beyond_christmas.mp3")))}),T={...ar.physical.uniforms,diffuse:{value:{r:.36,g:.51,b:.65}},roughness:{value:.5},amplitude:{value:.25},frequency:{value:.5},speed:{value:.3},env_c1:{value:new tt("#0d1a2f")},env_c2:{value:new tt("#0f8682")},skyRadius:{value:5.01},noiseOffset:{value:new Y(100.01,100.01,100.01)},starSize:{value:.01},starDensity:{value:.09},clusterStrength:{value:.2},clusterSize:{value:.2},time:{value:1}};function C(F,W,j){const le=new $T(F,128,32),pe=j&&j!==null?new Or({uniforms:T,map:j,doubleSided:!0,defines:{STANDARD:"",PHYSICAL:""},extensions:{derivatives:!0},lights:!0,opacity:1,side:fi,transparent:!0}):new Ki({uniforms:T,vertexShader:Qw,fragmentShader:Jw,doubleSided:!0,defines:{STANDARD:"",PHYSICAL:""},extensions:{derivatives:!0},lights:!0,opacity:1,side:fi,transparent:!0});return j&&j!==null&&(pe.onBeforeCompile=ce=>{ce.uniforms.time=new Lf(1),ce.uniforms.uResolution=new Lf(f),ce.vertexShader=Qw,ce.fragmentShader=Jw,ce.fragmentShader=` + uniform float time; + uniform vec2 uResolution; +`+ce.fragmentShader},pe.onBeforeRender=ce=>{}),new yn(le,pe)}function M(F){const W=new Ad(F,F),j=new Or({map:o,opacity:1,side:fi});return j.onBeforeCompile=le=>{le.uniforms.uResolution=new Lf(f),le.fragmentShader=` + uniform vec2 uResolution; +`+le.fragmentShader,le.fragmentShader=le.fragmentShader.replace("#include ",` + vec2 pos = gl_FragCoord.xy/uResolution; + vec4 sampledDiffuseColor = texture2D( map, pos ); + diffuseColor *= sampledDiffuseColor; + `)},new yn(W,j)}console.log("canvasTexture:",Px);const S=C(50,Ll.get("orangeDark"),Px);S.position.y=0,I_(S,Pr.get("inside")),c.add(S);const k=M(1*2);k.position.set(0,1.2,0),I_(k,Pr.get("portal")),c.add(k);const U=.05,N=new Y;function X(){N.setFromMatrixColumn(_.matrix,0),N.crossVectors(_.up,N),_.position.addScaledVector(N,U)}function z(){N.setFromMatrixColumn(_.matrix,0),N.crossVectors(_.up,N),_.position.addScaledVector(N,-U)}function te(){N.setFromMatrixColumn(_.matrix,0),_.position.addScaledVector(N,-U)}function L(){N.setFromMatrixColumn(_.matrix,0),_.position.addScaledVector(N,U)}function Z(){Vs.get("isUp")&&X(),Vs.get("isDown")&&z(),Vs.get("isLeft")&&te(),Vs.get("isRight")&&L()}const ae=new Y;function fe(){_.getWorldDirection(ae),d.copy(_.position).add(ae.multiplyScalar(.01))}function Me(F,W){const j=new Y,le=100;return W.normalize(),j.addVectors(F,W.multiplyScalar(le)),j}const Ve=new Y(0,0,0),$=Me(Ve,new Y(0,-1,0)),oe=[];oe.push(Ve),oe.push($);const me=new xr;me.setFromPoints(oe);const de=me,be=new Xx({color:16711680}),Le=new qm(de,be);I_(Le,Pr.get("outside")),c.add(Le);const ke=new ui(new Y(0,0,1),0),Qe=new ui(new Y(0,0,-1),0);function V(){_.layers.disable(Pr.get("portal")),_.layers.disable(Pr.get("outside")),_.layers.enable(Pr.get("inside")),r.render(c,_)}function ot(){const F=e.getDelta(),W=e.getElapsedTime(),j={};r.clippingPlanes=[],_.layers.enable(Pr.get("inside")),_.layers.enable(Pr.get("outside"));let pe=a.xr.getCamera(_).matrixWorld,ce=new Y;ce.setFromMatrixPosition(pe);let Ee=pe.elements[8],ve=pe.elements[9],ue=pe.elements[10];new Y(-Ee,-ve,-ue).normalize();const Re=-1,Pe=1,ye=2.5,Se=1,Be=0,je=new Y(Re,ce.y,Be),J=new Y(Pe,ce.y,Be),H=new Y(ce.x,ye,Be),re=new Y(ce.x,Se,Be),q=new Y;q.subVectors(je,ce);const ie=new Y;ie.subVectors(J,ce);const xe=new Y;xe.subVectors(H,ce);const we=new Y;we.subVectors(re,ce);const Ye=new Y(1,0,0),ut=q.clone().cross(new Y(0,1,0)).normalize(),it=Ye.angleTo(ut.clone()),ft=Math.cos(it)*Re,Kt=new Y(-1,0,0),ri=ie.clone().cross(new Y(0,-1,0)).normalize(),Oi=Kt.angleTo(ri.clone()),xs=Math.cos(Oi)*Pe,ir=new Y(0,-1,0),ys=xe.clone().cross(new Y(1,0,0)).normalize(),jr=ir.angleTo(ys.clone()),co=Math.cos(jr)*ye,yr=ce.z>Be?new Y(0,1,0):new Y(0,-1,0),uo=we.clone().cross(new Y(-1,0,0)).normalize(),qr=yr.angleTo(uo.clone()),ya=Math.cos(qr)*Se,Ss=new ui(ut.clone(),-ft),fo=new ui(ri.clone(),xs),I=new ui(ys.clone(),co),se=new ui(uo.clone(),ya*-(Se-.001)),R=JSON.stringify({leftΘ:it,leftX:ft,rightΘ:Oi,rightX:xs,topΘ:jr,topY:co,bottomΘ:qr,bottomY:ya}).replace(new RegExp("\\\\n","g"),"
").replace(new RegExp('":',"g"),'":
').replace(new RegExp(",","g"),'",
').replace(new RegExp("{","g"),"{
").replace(new RegExp("}","g"),"
}");p.innerHTML=R,a.clippingPlanes=ce.z>Be?[Qe,Ss,fo,I,se]:[ke,Qe,Ss,fo,I,se],k.material.side=Wr,S.material.hasOwnProperty("clippingPlanes")&&(S.material.clippingPlanes=[Qe,Ss,fo,I,se]),S.material.hasOwnProperty("uniforms")&&(S.material.uniforms.time.value=W),b(za,F,W,Object.keys(j).length>0?j:null,null,[Qe,Ss,fo,I,se]),T.time.value=W,a.render(c,_)}function ee(F){g.begin(),pf&&pf.hasOwnProperty("analyser")&&typeof pf.getFrequencyData=="function"&&Ha.hasOwnProperty("sound")&&Ha.sound.isPlaying&&HX.push([...pf.getFrequencyData()]),Z(),fe(),(za===null||!t)&&V(),ot(),g.end()}function at(F,W){f.set(F,W),s(F,W),l(F,W),m(F,W)}function Ne(F,W){Vs.set(F,W)}function Ze(F){const W=ms.get(F.key);W&&Ne(W,!0)}function Ie(F){const W=ms.get(F.key);W&&Ne(W,!1)}function We(){const F={optionalFeatures:["local-floor","bounded-floor","hand-tracking","layers"],requiredFeatures:[]};if(navigator.xr.requestSession("immersive-ar",F).then(B),navigator.getVRDisplays){let W=function(){navigator.getVRDisplays().then(j=>{if(console.log("Checking VR display"),j.length)for(const le of j)console.log("Found VR Display:",le);else throw new Error("No VR display found")})};window.addEventListener("vrdisplayconnect",W),window.addEventListener("vrdisplaydisconnect",j=>console.log.bind(console)),window.addEventListener("vrdisplayactivate",j=>console.log.bind(console)),window.addEventListener("vrdisplaydeactivate",j=>console.log.bind(console)),window.addEventListener("vrdisplayblur",j=>console.log.bind(console)),window.addEventListener("vrdisplayfocus",j=>console.log.bind(console)),window.addEventListener("vrdisplaypointerrestricted",j=>console.log.bind(console)),window.addEventListener("vrdisplaypointerunrestricted",j=>console.log.bind(console)),window.addEventListener("vrdisplaypresentchange",j=>console.log.bind(console))}}async function B(F){a.xr.setSession(F).then(()=>{za=F,za.addEventListener("end",E)}),Ha.hasOwnProperty("sound")&&(console.log("Play sound!"),Ha.sound.pause(),Ha.sound.play())}function E(){za.removeEventListener("end",E),za=null}const A=document.createElement("button");A.className="xr-button",A.innerHTML="Enter XR",A.addEventListener("click",async()=>{console.log("XR Button clicked"),We(),_.position.y=0,u.position.z=_.position.z,u.position.y=_.position.y,i.width=window.innerWidth,i.height=window.innerHeight,at(i.width,i.height)}),document.body.appendChild(A),window.addEventListener("keydown",Ze),window.addEventListener("keyup",Ie),at(i.width,i.height),a.setAnimationLoop(ee)}WX(kX).then(()=>{console.log("WebGL scene has been initialized")}); diff --git a/public/threejs-portal-effect/assets/index-o6NpKq3I.css b/public/threejs-portal-effect/assets/index-o6NpKq3I.css new file mode 100644 index 0000000..fba4867 --- /dev/null +++ b/public/threejs-portal-effect/assets/index-o6NpKq3I.css @@ -0,0 +1 @@ +body{margin:0;background-color:#00f;color:#fff;font-family:Monospace;font-size:13px;line-height:24px;overscroll-behavior:none}a{color:#ff0;text-decoration:none}a:hover{text-decoration:underline}button{cursor:pointer;text-transform:uppercase}#info{position:absolute;top:0;width:100%;padding:10px;box-sizing:border-box;text-align:center;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;z-index:1}a,button,input,select{pointer-events:auto}.lil-gui{z-index:2!important}@media all and (max-width: 640px){.lil-gui.root{right:auto;top:auto;max-height:50%;max-width:80%;bottom:0;left:0}}#overlay{position:absolute;font-size:16px;z-index:2;top:0;left:0;width:100%;height:100%;display:flex;align-items:center;justify-content:center;flex-direction:column;background:#000000b3}#overlay button{background:transparent;border:0;border:1px solid rgb(255,255,255);border-radius:4px;color:#fff;padding:12px 18px;text-transform:uppercase;cursor:pointer}#notSupported{width:50%;margin:20px auto auto;background-color:red;padding:10px}body{background-color:#bfe3dd;color:#fff}a{color:#2983ff}.vr-button,.xr-button{position:fixed;left:calc(50% - 50px)!important;bottom:20px;width:100px;padding:12px 6px;color:#fff;cursor:pointer;border:1px solid rgb(255,255,255);border-radius:4px;background:#0a0a0a80;font:14px sans-serif;font-weight:700;text-align:center;opacity:.5;outline:none;z-index:999}#loading{position:fixed;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center}#loading .progress{margin:1.5em;border:1px solid white;width:50vw}#loading .progressbar{margin:2px;background:#fff;height:1em;transform-origin:top left;transform:scaleX(0)} diff --git a/public/threejs-portal-effect/assets/material/textures/mip-low-res-enlarged.png b/public/threejs-portal-effect/assets/material/textures/mip-low-res-enlarged.png new file mode 100644 index 0000000..a95399d Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/mip-low-res-enlarged.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/mipmap-128.png b/public/threejs-portal-effect/assets/material/textures/mipmap-128.png new file mode 100644 index 0000000..1f5cac6 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/mipmap-128.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/mipmap-16.png b/public/threejs-portal-effect/assets/material/textures/mipmap-16.png new file mode 100644 index 0000000..9c8cd87 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/mipmap-16.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/mipmap-256.png b/public/threejs-portal-effect/assets/material/textures/mipmap-256.png new file mode 100644 index 0000000..d8dd8ca Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/mipmap-256.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/mipmap-32.png b/public/threejs-portal-effect/assets/material/textures/mipmap-32.png new file mode 100644 index 0000000..6783283 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/mipmap-32.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/mipmap-4.png b/public/threejs-portal-effect/assets/material/textures/mipmap-4.png new file mode 100644 index 0000000..59f13df Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/mipmap-4.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/mipmap-64.png b/public/threejs-portal-effect/assets/material/textures/mipmap-64.png new file mode 100644 index 0000000..2ad9cb6 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/mipmap-64.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/mipmap-8.png b/public/threejs-portal-effect/assets/material/textures/mipmap-8.png new file mode 100644 index 0000000..cf7fc3f Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/mipmap-8.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_bk.jpg new file mode 100644 index 0000000..7788d87 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_dn.jpg new file mode 100644 index 0000000..cc8d6fc Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_ft.jpg new file mode 100644 index 0000000..ad6106a Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_lf.jpg new file mode 100644 index 0000000..2bc1345 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_rt.jpg new file mode 100644 index 0000000..af67edb Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_up.jpg new file mode 100644 index 0000000..0bda418 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/dusk_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/readme.txt new file mode 100644 index 0000000..09214b1 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (10)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +dusk diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_bk.jpg new file mode 100644 index 0000000..d9f60c3 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_dn.jpg new file mode 100644 index 0000000..b1c4ccd Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_ft.jpg new file mode 100644 index 0000000..1615e14 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_lf.jpg new file mode 100644 index 0000000..f7dc90e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_rt.jpg new file mode 100644 index 0000000..e991434 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_up.jpg new file mode 100644 index 0000000..c56e9fc Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/dust_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/readme.txt new file mode 100644 index 0000000..af2d459 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (11)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +dust diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_bk.jpg new file mode 100644 index 0000000..8cc6cf7 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_dn.jpg new file mode 100644 index 0000000..f226178 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_ft.jpg new file mode 100644 index 0000000..dd321a0 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_lf.jpg new file mode 100644 index 0000000..dfc6aa6 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_rt.jpg new file mode 100644 index 0000000..4558bb9 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_up.jpg new file mode 100644 index 0000000..18d20f3 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/flames_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/readme.txt new file mode 100644 index 0000000..4de198e --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (12)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +flames diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_bk.jpg new file mode 100644 index 0000000..ebe455d Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_dn.jpg new file mode 100644 index 0000000..190d0f0 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_ft.jpg new file mode 100644 index 0000000..ef08541 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_lf.jpg new file mode 100644 index 0000000..bd2a833 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_rt.jpg new file mode 100644 index 0000000..a4fc5c3 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_up.jpg new file mode 100644 index 0000000..8767a0b Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/gloom_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/readme.txt new file mode 100644 index 0000000..eae0c8f --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (13)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +gloom diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_bk.jpg new file mode 100644 index 0000000..7ec4b99 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_dn.jpg new file mode 100644 index 0000000..60e3e93 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_ft.jpg new file mode 100644 index 0000000..4fcdc8c Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_lf.jpg new file mode 100644 index 0000000..8b4b447 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_rt.jpg new file mode 100644 index 0000000..0b00f7a Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_up.jpg new file mode 100644 index 0000000..13c2a29 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/harmony_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/readme.txt new file mode 100644 index 0000000..a902cdd --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (14)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +harmony diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_bk.jpg new file mode 100644 index 0000000..7baa7ed Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_dn.jpg new file mode 100644 index 0000000..d5cd50b Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_ft.jpg new file mode 100644 index 0000000..76d82de Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_lf.jpg new file mode 100644 index 0000000..dc67598 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_rt.jpg new file mode 100644 index 0000000..428c529 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_up.jpg new file mode 100644 index 0000000..1b7f575 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/haze_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/readme.txt new file mode 100644 index 0000000..77a4759 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (15)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +haze diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_bk.jpg new file mode 100644 index 0000000..c37572e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_dn.jpg new file mode 100644 index 0000000..655fc0e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_ft.jpg new file mode 100644 index 0000000..d001cac Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_lf.jpg new file mode 100644 index 0000000..269cb1e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_rt.jpg new file mode 100644 index 0000000..efe5d81 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_up.jpg new file mode 100644 index 0000000..35d8536 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/heather_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/readme.txt new file mode 100644 index 0000000..b1978ad --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (16)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +heather diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_bk.jpg new file mode 100644 index 0000000..9e91578 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_dn.jpg new file mode 100644 index 0000000..c7011f5 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_ft.jpg new file mode 100644 index 0000000..8889a8b Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_lf.jpg new file mode 100644 index 0000000..96acf51 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_rt.jpg new file mode 100644 index 0000000..8b382a2 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_up.jpg new file mode 100644 index 0000000..e17e8fe Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/humble_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/readme.txt new file mode 100644 index 0000000..7559ea0 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (17)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +humble diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_bk.png b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_bk.png new file mode 100644 index 0000000..d00ee11 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_bk.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_dn.png b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_dn.png new file mode 100644 index 0000000..9398531 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_dn.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_ft.png b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_ft.png new file mode 100644 index 0000000..8fab847 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_ft.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_lf.png b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_lf.png new file mode 100644 index 0000000..90b881f Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_lf.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_rt.png b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_rt.png new file mode 100644 index 0000000..c05f846 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_rt.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_up.png b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_up.png new file mode 100644 index 0000000..03fcff9 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/kenon_cloudbox_up.png differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/readme.txt new file mode 100644 index 0000000..4644e9a --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (18)/readme.txt @@ -0,0 +1,12 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_bk.jpg new file mode 100644 index 0000000..592588d Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_dn.jpg new file mode 100644 index 0000000..6745e24 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_ft.jpg new file mode 100644 index 0000000..c8de4d8 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_lf.jpg new file mode 100644 index 0000000..827665e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_rt.jpg new file mode 100644 index 0000000..6222f90 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_up.jpg new file mode 100644 index 0000000..e00d405 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/kenon_star_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/readme.txt new file mode 100644 index 0000000..4644e9a --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (19)/readme.txt @@ -0,0 +1,12 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_bk.jpg new file mode 100644 index 0000000..3e306da Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_dn.jpg new file mode 100644 index 0000000..a9c021c Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_ft.jpg new file mode 100644 index 0000000..ed9c2cc Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_lf.jpg new file mode 100644 index 0000000..223b81e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_rt.jpg new file mode 100644 index 0000000..d4062ac Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_up.jpg new file mode 100644 index 0000000..c2d40f3 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/arid2_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/readme.txt new file mode 100644 index 0000000..00be670 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (2)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +arid2 diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_bk.jpg new file mode 100644 index 0000000..34cad42 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_dn.jpg new file mode 100644 index 0000000..5ed5eb5 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_ft.jpg new file mode 100644 index 0000000..3b4a8c5 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_lf.jpg new file mode 100644 index 0000000..5b2fedc Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_rt.jpg new file mode 100644 index 0000000..b4530e6 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_up.jpg new file mode 100644 index 0000000..aeb6a21 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/majik_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/readme.txt new file mode 100644 index 0000000..a4c4494 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (20)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +majik diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_bk.jpg new file mode 100644 index 0000000..e0aed81 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_dn.jpg new file mode 100644 index 0000000..68b02fb Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_ft.jpg new file mode 100644 index 0000000..7719f7d Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_lf.jpg new file mode 100644 index 0000000..bde2b78 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_rt.jpg new file mode 100644 index 0000000..b4267d4 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_up.jpg new file mode 100644 index 0000000..a3fc499 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/meadow_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/readme.txt new file mode 100644 index 0000000..7a60b81 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (21)/readme.txt @@ -0,0 +1,14 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +I would like to know where and in what games my skyboxes are used. +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter "Red Eclipse" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +meadow \ No newline at end of file diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_bk.jpg new file mode 100644 index 0000000..301b058 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_dn.jpg new file mode 100644 index 0000000..0427469 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_ft.jpg new file mode 100644 index 0000000..008b608 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_lf.jpg new file mode 100644 index 0000000..36419c0 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_rt.jpg new file mode 100644 index 0000000..f582d74 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_up.jpg new file mode 100644 index 0000000..0da6748 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/mellow_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/readme.txt new file mode 100644 index 0000000..ea21432 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (22)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +mellow diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_bk.jpg new file mode 100644 index 0000000..bba8f58 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_dn.jpg new file mode 100644 index 0000000..81f02e8 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_ft.jpg new file mode 100644 index 0000000..29b1c14 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_lf.jpg new file mode 100644 index 0000000..195d36d Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_rt.jpg new file mode 100644 index 0000000..e1fc837 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_up.jpg new file mode 100644 index 0000000..6481d95 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/morning_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/readme.txt new file mode 100644 index 0000000..ed9dfaf --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (23)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +morning diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_bk.jpg new file mode 100644 index 0000000..7845e8b Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_dn.jpg new file mode 100644 index 0000000..7ffe2cf Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_ft.jpg new file mode 100644 index 0000000..c5f20bb Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_lf.jpg new file mode 100644 index 0000000..4485943 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_rt.jpg new file mode 100644 index 0000000..896890e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_up.jpg new file mode 100644 index 0000000..19a0844 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/mystic_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/readme.txt new file mode 100644 index 0000000..3a44c84 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (24)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +mystic diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_bk.jpg new file mode 100644 index 0000000..dee8057 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_dn.jpg new file mode 100644 index 0000000..1dba069 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_ft.jpg new file mode 100644 index 0000000..7876968 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_lf.jpg new file mode 100644 index 0000000..0ba7d4d Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_rt.jpg new file mode 100644 index 0000000..039f101 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_up.jpg new file mode 100644 index 0000000..8ce4dea Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/ocean_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/readme.txt new file mode 100644 index 0000000..2ed2b5e --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (25)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +ocean diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_bk.jpg new file mode 100644 index 0000000..7db4919 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_dn.jpg new file mode 100644 index 0000000..f697b45 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_ft.jpg new file mode 100644 index 0000000..8374241 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_lf.jpg new file mode 100644 index 0000000..98e9eac Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_rt.jpg new file mode 100644 index 0000000..0521949 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_up.jpg new file mode 100644 index 0000000..86dccdd Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/overcast_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/readme.txt new file mode 100644 index 0000000..555a73b --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (26)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +overcast diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_bk.jpg new file mode 100644 index 0000000..9447e70 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_dn.jpg new file mode 100644 index 0000000..222b308 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_ft.jpg new file mode 100644 index 0000000..e3c908a Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_lf.jpg new file mode 100644 index 0000000..cff2833 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_rt.jpg new file mode 100644 index 0000000..b1fc4e0 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_up.jpg new file mode 100644 index 0000000..2cf7a88 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/paze_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/readme.txt new file mode 100644 index 0000000..6f77bcb --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (27)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +paze diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_bk.jpg new file mode 100644 index 0000000..c491608 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_dn.jpg new file mode 100644 index 0000000..9d90d19 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_ft.jpg new file mode 100644 index 0000000..9dc7af2 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_lf.jpg new file mode 100644 index 0000000..52d7ec5 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_rt.jpg new file mode 100644 index 0000000..2de2ce4 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_up.jpg new file mode 100644 index 0000000..1bbbed6 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/pit_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/readme.txt new file mode 100644 index 0000000..f1b98df --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (28)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +pit diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_bk.jpg new file mode 100644 index 0000000..48a424b Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_dn.jpg new file mode 100644 index 0000000..ca45eb2 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_ft.jpg new file mode 100644 index 0000000..47795da Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_lf.jpg new file mode 100644 index 0000000..b0c6785 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_rt.jpg new file mode 100644 index 0000000..245487e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_up.jpg new file mode 100644 index 0000000..c478939 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/quirk_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/readme.txt new file mode 100644 index 0000000..b08aa1d --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (29)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +quirk diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_bk.jpg new file mode 100644 index 0000000..2ce2bea Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_dn.jpg new file mode 100644 index 0000000..bfceb46 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_ft.jpg new file mode 100644 index 0000000..0d95dbe Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_lf.jpg new file mode 100644 index 0000000..10f2f49 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_rt.jpg new file mode 100644 index 0000000..9f70778 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_up.jpg new file mode 100644 index 0000000..d2d8cb9 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/barren_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/readme.txt new file mode 100644 index 0000000..c8d99d0 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (3)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +barren diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_bk.jpg new file mode 100644 index 0000000..def48df Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_dn.jpg new file mode 100644 index 0000000..e7aee3f Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_ft.jpg new file mode 100644 index 0000000..5c2bbd9 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_lf.jpg new file mode 100644 index 0000000..139ffda Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_rt.jpg new file mode 100644 index 0000000..bf88ed5 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_up.jpg new file mode 100644 index 0000000..161a4fd Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/raspberry_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/readme.txt new file mode 100644 index 0000000..3ee3bc4 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (30)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +raspberry diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/readme.txt new file mode 100644 index 0000000..bed5fcd --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +serenity diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_bk.jpg new file mode 100644 index 0000000..dd955fd Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_dn.jpg new file mode 100644 index 0000000..516cf0a Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_ft.jpg new file mode 100644 index 0000000..610e19b Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_lf.jpg new file mode 100644 index 0000000..b56d1b3 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_rt.jpg new file mode 100644 index 0000000..29bcb5a Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_up.jpg new file mode 100644 index 0000000..91ebe58 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (31)/serenity_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/readme.txt new file mode 100644 index 0000000..1563541 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +sleepyhollow diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_bk.jpg new file mode 100644 index 0000000..ea931fe Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_dn.jpg new file mode 100644 index 0000000..96d8642 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_ft.jpg new file mode 100644 index 0000000..ef9af15 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_lf.jpg new file mode 100644 index 0000000..fe047ee Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_rt.jpg new file mode 100644 index 0000000..61504ec Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_up.jpg new file mode 100644 index 0000000..789115a Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (32)/sleepyhollow_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/readme.txt new file mode 100644 index 0000000..39990f4 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +sun diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_bk.jpg new file mode 100644 index 0000000..da358ea Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_dn.jpg new file mode 100644 index 0000000..a539493 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_ft.jpg new file mode 100644 index 0000000..add5431 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_lf.jpg new file mode 100644 index 0000000..58ad88e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_rt.jpg new file mode 100644 index 0000000..554ea82 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_up.jpg new file mode 100644 index 0000000..7ee0a85 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (33)/sun_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/readme.txt new file mode 100644 index 0000000..1848693 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +tears diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_bk.jpg new file mode 100644 index 0000000..79b8e9c Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_dn.jpg new file mode 100644 index 0000000..c920afe Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_ft.jpg new file mode 100644 index 0000000..5f556e7 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_lf.jpg new file mode 100644 index 0000000..9acf0cb Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_rt.jpg new file mode 100644 index 0000000..8a5d7ae Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_up.jpg new file mode 100644 index 0000000..157bb8c Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (34)/tears_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/readme.txt new file mode 100644 index 0000000..aa33b75 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +torture diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_bk.jpg new file mode 100644 index 0000000..02daece Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_dn.jpg new file mode 100644 index 0000000..4861dd6 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_ft.jpg new file mode 100644 index 0000000..b510d9e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_lf.jpg new file mode 100644 index 0000000..de1a68d Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_rt.jpg new file mode 100644 index 0000000..be31d1c Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_up.jpg new file mode 100644 index 0000000..7ae2a07 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (35)/torture_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/readme.txt new file mode 100644 index 0000000..8721a53 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +trance diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_bk.jpg new file mode 100644 index 0000000..2205cba Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_dn.jpg new file mode 100644 index 0000000..e91a284 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_ft.jpg new file mode 100644 index 0000000..14df61e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_lf.jpg new file mode 100644 index 0000000..73a1d48 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_rt.jpg new file mode 100644 index 0000000..f6b479e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_up.jpg new file mode 100644 index 0000000..fdbdd69 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (36)/trance_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/readme.txt new file mode 100644 index 0000000..55575ba --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +tropic diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_bk.jpg new file mode 100644 index 0000000..ae8ab81 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_dn.jpg new file mode 100644 index 0000000..a2a5967 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_ft.jpg new file mode 100644 index 0000000..9f0054b Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_lf.jpg new file mode 100644 index 0000000..e0ec92b Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_rt.jpg new file mode 100644 index 0000000..9424fbe Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_up.jpg new file mode 100644 index 0000000..18e44cc Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (37)/tropic_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/readme.txt new file mode 100644 index 0000000..6278288 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +trouble diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_bk.jpg new file mode 100644 index 0000000..eda6abc Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_dn.jpg new file mode 100644 index 0000000..c22db3f Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_ft.jpg new file mode 100644 index 0000000..2918339 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_lf.jpg new file mode 100644 index 0000000..abbd145 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_rt.jpg new file mode 100644 index 0000000..1bdc1e6 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_up.jpg new file mode 100644 index 0000000..02054bc Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (38)/trouble_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/readme.txt new file mode 100644 index 0000000..1f8b275 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +valley diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_bk.jpg new file mode 100644 index 0000000..e0dcef6 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_dn.jpg new file mode 100644 index 0000000..992d6c3 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_ft.jpg new file mode 100644 index 0000000..942cbc8 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_lf.jpg new file mode 100644 index 0000000..a2bb6c2 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_rt.jpg new file mode 100644 index 0000000..873eada Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_up.jpg new file mode 100644 index 0000000..1e3b0b5 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (39)/valley_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_bk.jpg new file mode 100644 index 0000000..b37eb00 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_dn.jpg new file mode 100644 index 0000000..6387033 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_ft.jpg new file mode 100644 index 0000000..ed5d05f Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_lf.jpg new file mode 100644 index 0000000..6a8de0c Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_rt.jpg new file mode 100644 index 0000000..8cebc32 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_up.jpg new file mode 100644 index 0000000..53eccc2 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/battery_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/readme.txt new file mode 100644 index 0000000..a94b881 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (4)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +battery diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/readme.txt new file mode 100644 index 0000000..73021ef --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +violence diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_bk.jpg new file mode 100644 index 0000000..f8cb42e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_dn.jpg new file mode 100644 index 0000000..c1a00a9 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_ft.jpg new file mode 100644 index 0000000..b4de2ac Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_lf.jpg new file mode 100644 index 0000000..30ef68f Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_rt.jpg new file mode 100644 index 0000000..4c27b00 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_up.jpg new file mode 100644 index 0000000..2bef334 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (40)/violence_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/readme.txt new file mode 100644 index 0000000..524b349 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +vulcan diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_bk.jpg new file mode 100644 index 0000000..c24fb24 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_dn.jpg new file mode 100644 index 0000000..ca6da8a Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_ft.jpg new file mode 100644 index 0000000..5c63c50 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_lf.jpg new file mode 100644 index 0000000..f5e37d4 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_rt.jpg new file mode 100644 index 0000000..50f6776 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_up.jpg new file mode 100644 index 0000000..f8291b3 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (41)/vulcan_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/readme.txt new file mode 100644 index 0000000..3bda5f0 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +wasteland diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_bk.jpg new file mode 100644 index 0000000..5089a4d Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_dn.jpg new file mode 100644 index 0000000..318ddf8 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_ft.jpg new file mode 100644 index 0000000..203dda9 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_lf.jpg new file mode 100644 index 0000000..83a42ef Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_rt.jpg new file mode 100644 index 0000000..6dc7a73 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_up.jpg new file mode 100644 index 0000000..b33059a Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (42)/wasteland_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/readme.txt new file mode 100644 index 0000000..370f334 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +wrath diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_bk.jpg new file mode 100644 index 0000000..88d6a6d Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_dn.jpg new file mode 100644 index 0000000..6a82f0c Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_ft.jpg new file mode 100644 index 0000000..011e89d Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_lf.jpg new file mode 100644 index 0000000..92f27e1 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_rt.jpg new file mode 100644 index 0000000..d90b514 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_up.jpg new file mode 100644 index 0000000..a97d750 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (43)/wrath_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/readme.txt new file mode 100644 index 0000000..e384088 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +yonder diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_bk.jpg new file mode 100644 index 0000000..64f14c7 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_dn.jpg new file mode 100644 index 0000000..8916cbd Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_ft.jpg new file mode 100644 index 0000000..3cd496d Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_lf.jpg new file mode 100644 index 0000000..74d796e Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_rt.jpg new file mode 100644 index 0000000..7d18292 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_up.jpg new file mode 100644 index 0000000..b420d1b Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (44)/yonder_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/readme.txt new file mode 100644 index 0000000..36fbbe7 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/readme.txt @@ -0,0 +1,14 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(zachery@freezurbern.com) +http://www.freezurbern.com +I would like to know where and in what games my skyboxes are used. +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +zeus \ No newline at end of file diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_bk.jpg new file mode 100644 index 0000000..6d3ce30 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_dn.jpg new file mode 100644 index 0000000..0650f8b Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_ft.jpg new file mode 100644 index 0000000..d7f8d23 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_lf.jpg new file mode 100644 index 0000000..d161df4 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_rt.jpg new file mode 100644 index 0000000..4b4bde5 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_up.jpg new file mode 100644 index 0000000..626551b Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (45)/zeus_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_bk.jpg new file mode 100644 index 0000000..00c4bd2 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_dn.jpg new file mode 100644 index 0000000..9d0d142 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_ft.jpg new file mode 100644 index 0000000..44b9924 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_lf.jpg new file mode 100644 index 0000000..b2fa953 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_rt.jpg new file mode 100644 index 0000000..a30a4e1 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_up.jpg new file mode 100644 index 0000000..9b7fd1d Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/bay_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/readme.txt new file mode 100644 index 0000000..374225f --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (5)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +bay diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_bk.jpg new file mode 100644 index 0000000..899fd4d Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_dn.jpg new file mode 100644 index 0000000..0ed2fe2 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_ft.jpg new file mode 100644 index 0000000..4b4532c Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_lf.jpg new file mode 100644 index 0000000..21171be Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_rt.jpg new file mode 100644 index 0000000..6ecf236 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_up.jpg new file mode 100644 index 0000000..0a21996 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/blizzard_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/readme.txt new file mode 100644 index 0000000..098135f --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (6)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +blizzard diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_bk.jpg new file mode 100644 index 0000000..2b385bd Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_dn.jpg new file mode 100644 index 0000000..0c40a8b Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_ft.jpg new file mode 100644 index 0000000..247dbca Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_lf.jpg new file mode 100644 index 0000000..c734b05 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_rt.jpg new file mode 100644 index 0000000..d5913b8 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_up.jpg new file mode 100644 index 0000000..caafcca Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/cocoa_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/readme.txt new file mode 100644 index 0000000..a820f1b --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (7)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +cocoa diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_bk.jpg new file mode 100644 index 0000000..4b3f65b Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_dn.jpg new file mode 100644 index 0000000..a1b18bc Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_ft.jpg new file mode 100644 index 0000000..51a93dc Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_lf.jpg new file mode 100644 index 0000000..07362f9 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_rt.jpg new file mode 100644 index 0000000..19d1962 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_up.jpg new file mode 100644 index 0000000..690276f Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/desertdawn_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/readme.txt new file mode 100644 index 0000000..404d774 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (8)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +desertdawn diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_bk.jpg new file mode 100644 index 0000000..aed45aa Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_dn.jpg new file mode 100644 index 0000000..423e69a Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_ft.jpg new file mode 100644 index 0000000..4fa08ec Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_lf.jpg new file mode 100644 index 0000000..962b733 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_rt.jpg new file mode 100644 index 0000000..04173a7 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_up.jpg new file mode 100644 index 0000000..74e5947 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/divine_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/readme.txt new file mode 100644 index 0000000..00aac94 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins (9)/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +divine diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_bk.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_bk.jpg new file mode 100644 index 0000000..ec41e24 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_bk.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_dn.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_dn.jpg new file mode 100644 index 0000000..cf41373 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_dn.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_ft.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_ft.jpg new file mode 100644 index 0000000..9846673 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_ft.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_lf.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_lf.jpg new file mode 100644 index 0000000..2ba2608 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_lf.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_rt.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_rt.jpg new file mode 100644 index 0000000..e753fd8 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_rt.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_up.jpg b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_up.jpg new file mode 100644 index 0000000..a8b2750 Binary files /dev/null and b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/arid_up.jpg differ diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/readme.txt new file mode 100644 index 0000000..1b064d4 --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/penguins/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +arid diff --git a/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/readme.txt b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/readme.txt new file mode 100644 index 0000000..dec094f --- /dev/null +++ b/public/threejs-portal-effect/assets/material/textures/penguins-skybox-pack/readme.txt @@ -0,0 +1,13 @@ +Sky/Cloud boxes created by Zachery "skiingpenguins" Slocum +(freezurbern@gmail.com) +http://www.freezurbern.com +If you do use them, feel free to send me an email. I'd enjoy playing whatever game you put them in. + +Originally created for the first person shooter engine "Cube 2: Sauerbraten" + +This readme includes the attribution required by the license, hence you are encouraged copy it along with the content (although attribution could be provided by other reasonable means). +Content released under the Creative Commons Attribution-ShareAlike? 3.0 Unported License. +http://creativecommons.org/licenses/by-sa/3.0/ + +This license applies to the following: +LIST \ No newline at end of file diff --git a/public/threejs-portal-effect/index.html b/public/threejs-portal-effect/index.html index d209268..a2b4728 100644 --- a/public/threejs-portal-effect/index.html +++ b/public/threejs-portal-effect/index.html @@ -2,7 +2,7 @@ - WebXR Start! + WebXR Portal Effect @@ -15,12 +15,15 @@ } } - - + + -
three.js - webgl portal effect demo
(use arrow keys and mouse to navigate - through the portal!)
+
+ Three.js - WebXR Portal Effect
+ (a demo of how to use clipping planes to construct/project a WebXR scene in mixed reality - through the portal!) +
diff --git a/src/app/page.tsx b/src/app/page.tsx index 108b28d..a9aa152 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -29,7 +29,7 @@ export default function Home() { contentRoot: "threejs-portal-effect", slug: "", // => /threejs-portal-effect/index.html date: new Date('2025-01-31'), - description: "three.js - webxr portal effect demo (use arrow keys and mouse to navigate around the portal!)..." + description: "Three.js - WebXR Portal Effect (a demo of how to use clipping planes to construct/project WebXR scene in mixed reality - through the portal!)" }, { title: "Visualizing R Data with SveltR",