const __vite__fileDeps=["assets/chunks/VPLocalSearchBox.CuzPtg3-.js","assets/chunks/framework.DvHfxfnp.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); import{u as j,r as Ge,w as Ct,i as $d,t as Vm,c as Hm,o as Nn,n as qc,g as Gm,a as Wm,b as ma,d as gr,e as ke,f as Ri,h as zr,j as $m,k as Be,l as Xd,s as Rn,m as Wn,p as Y,q as fe,v as yt,x as Yc,y as vr,z as Xm,A as eh,F as xt,B as qm,C as cn,D as $e,E as ye,G as Jt,H as De,I as Fe,J as ue,K as Ht,L as ft,T as Zc,_ as Ye,M as Ym,N as Zm,O as Jm,P as Jc,Q as me,R as Wt,S as $t,U as is,V as Kl,W as qd,X as Km,Y as jm,Z as Aa,$ as Bs,a0 as Yd,a1 as Vr,a2 as ia,a3 as Qm,a4 as jl,a5 as Zd,a6 as Ta,a7 as eg,a8 as tg,a9 as Jd,aa as ng,ab as ig,ac as sg,ad as rg,ae as og,af as ag}from"./framework.DvHfxfnp.js";/** * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT */const Hr="165",lg={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},cg={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Kd=0,Ql=1,jd=2,ug=3,hg=0,Kc=1,jc=2,kn=3,oi=0,nn=1,En=2,si=0,es=1,ga=2,ec=3,tc=4,Qd=5,Ai=100,ef=101,tf=102,nf=103,sf=104,rf=200,of=201,af=202,lf=203,va=204,_a=205,cf=206,uf=207,hf=208,df=209,ff=210,pf=211,mf=212,gf=213,vf=214,_f=0,yf=1,xf=2,_r=3,Mf=4,bf=5,Sf=6,wf=7,Gr=0,Af=1,Tf=2,Hn=0,Ef=1,Cf=2,Pf=3,Ea=4,Rf=5,If=6,Lf=7,nc="attached",Nf="detached",Ca=300,ai=301,Ci=302,yr=303,xr=304,Ws=306,Mr=1e3,Mn=1001,br=1002,Gt=1003,Qc=1004,dg=1004,Ds=1005,fg=1005,Ot=1006,hr=1007,pg=1007,zn=1008,mg=1008,li=1009,Df=1010,Uf=1011,Sr=1012,eu=1013,ss=1014,gn=1015,Wr=1016,tu=1017,nu=1018,rs=1020,Of=35902,Ff=1021,kf=1022,un=1023,Bf=1024,zf=1025,ts=1026,os=1027,iu=1028,su=1029,Vf=1030,ru=1031,ou=1033,sa=33776,ra=33777,oa=33778,aa=33779,ic=35840,sc=35841,rc=35842,oc=35843,ac=36196,lc=37492,cc=37496,uc=37808,hc=37809,dc=37810,fc=37811,pc=37812,mc=37813,gc=37814,vc=37815,_c=37816,yc=37817,xc=37818,Mc=37819,bc=37820,Sc=37821,la=36492,wc=36494,Ac=36495,Hf=36283,Tc=36284,Ec=36285,Cc=36286,Gf=2200,Wf=2201,$f=2202,wr=2300,ya=2301,ca=2302,Ji=2400,Ki=2401,Ar=2402,Pa=2500,au=2501,gg=0,vg=1,_g=2,Xf=3200,qf=3201,Ii=0,Yf=1,ti="",ln="srgb",ci="srgb-linear",Ra="display-p3",$r="display-p3-linear",Tr="linear",Mt="srgb",Er="rec709",Cr="p3",yg=0,Bn=7680,xg=7681,Mg=7682,bg=7683,Sg=34055,wg=34056,Ag=5386,Tg=512,Eg=513,Zf=514,Cg=515,Pg=516,Rg=517,Ig=518,Pc=519,Jf=512,Kf=513,jf=514,lu=515,Qf=516,ep=517,tp=518,np=519,Pr=35044,Lg=35048,Ng=35040,Dg=35045,Ug=35049,Og=35041,Fg=35046,kg=35050,Bg=35042,zg="100",Rc="300 es",Vn=2e3,Rr=2001;class ui{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const r=i.indexOf(t);r!==-1&&i.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let r=0,o=i.length;r>8&255]+Xt[s>>16&255]+Xt[s>>24&255]+"-"+Xt[e&255]+Xt[e>>8&255]+"-"+Xt[e>>16&15|64]+Xt[e>>24&255]+"-"+Xt[t&63|128]+Xt[t>>8&255]+"-"+Xt[t>>16&255]+Xt[t>>24&255]+Xt[n&255]+Xt[n>>8&255]+Xt[n>>16&255]+Xt[n>>24&255]).toLowerCase()}function Et(s,e,t){return Math.max(e,Math.min(t,s))}function cu(s,e){return(s%e+e)%e}function Vg(s,e,t,n,i){return n+(s-e)*(i-n)/(t-e)}function Hg(s,e,t){return s!==e?(t-s)/(e-s):0}function dr(s,e,t){return(1-t)*s+t*e}function Gg(s,e,t,n){return dr(s,e,1-Math.exp(-t*n))}function Wg(s,e=1){return e-Math.abs(cu(s,e*2)-e)}function $g(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*(3-2*s))}function Xg(s,e,t){return s<=e?0:s>=t?1:(s=(s-e)/(t-e),s*s*s*(s*(s*6-15)+10))}function qg(s,e){return s+Math.floor(Math.random()*(e-s+1))}function Yg(s,e){return s+Math.random()*(e-s)}function Zg(s){return s*(.5-Math.random())}function Jg(s){s!==void 0&&(th=s);let e=th+=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 Kg(s){return s*ns}function jg(s){return s*Vs}function Qg(s){return(s&s-1)===0&&s!==0}function ev(s){return Math.pow(2,Math.ceil(Math.log(s)/Math.LN2))}function tv(s){return Math.pow(2,Math.floor(Math.log(s)/Math.LN2))}function nv(s,e,t,n,i){const r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),c=r((e+n)/2),u=o((e+n)/2),h=r((e-n)/2),d=o((e-n)/2),f=r((n-e)/2),g=o((n-e)/2);switch(i){case"XYX":s.set(a*u,l*h,l*d,a*c);break;case"YZY":s.set(l*d,a*u,l*h,a*c);break;case"ZXZ":s.set(l*h,l*d,a*u,a*c);break;case"XZX":s.set(a*u,l*g,l*f,a*c);break;case"YXY":s.set(l*f,a*u,l*g,a*c);break;case"ZYZ":s.set(l*g,l*f,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function tn(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return s/4294967295;case Uint16Array:return s/65535;case Uint8Array:return s/255;case Int32Array:return Math.max(s/2147483647,-1);case Int16Array:return Math.max(s/32767,-1);case Int8Array:return Math.max(s/127,-1);default:throw new Error("Invalid component type.")}}function tt(s,e){switch(e.constructor){case Float32Array:return s;case Uint32Array:return Math.round(s*4294967295);case Uint16Array:return Math.round(s*65535);case Uint8Array:return Math.round(s*255);case Int32Array:return Math.round(s*2147483647);case Int16Array:return Math.round(s*32767);case Int8Array:return Math.round(s*127);default:throw new Error("Invalid component type.")}}const ip={DEG2RAD:ns,RAD2DEG:Vs,generateUUID:vn,clamp:Et,euclideanModulo:cu,mapLinear:Vg,inverseLerp:Hg,lerp:dr,damp:Gg,pingpong:Wg,smoothstep:$g,smootherstep:Xg,randInt:qg,randFloat:Yg,randFloatSpread:Zg,seededRandom:Jg,degToRad:Kg,radToDeg:jg,isPowerOfTwo:Qg,ceilPowerOfTwo:ev,floorPowerOfTwo:tv,setQuaternionFromProperEuler:nv,normalize:tt,denormalize:tn};class se{constructor(e=0,t=0){se.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,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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 n=this.dot(e)/t;return Math.acos(Et(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*n-o*i+e.x,this.y=r*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ze{constructor(e,t,n,i,r,o,a,l,c){Ze.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,o,a,l,c)}set(e,t,n,i,r,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=r,u[5]=l,u[6]=n,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,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){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 n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],h=n[7],d=n[2],f=n[5],g=n[8],v=i[0],m=i[3],p=i[6],y=i[1],_=i[4],x=i[7],A=i[2],b=i[5],E=i[8];return r[0]=o*v+a*y+l*A,r[3]=o*m+a*_+l*b,r[6]=o*p+a*x+l*E,r[1]=c*v+u*y+h*A,r[4]=c*m+u*_+h*b,r[7]=c*p+u*x+h*E,r[2]=d*v+f*y+g*A,r[5]=d*m+f*_+g*b,r[8]=d*p+f*x+g*E,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],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*r*u+n*a*l+i*r*c-i*o*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,d=a*l-u*r,f=c*r-o*l,g=t*h+n*d+i*f;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/g;return e[0]=h*v,e[1]=(i*c-u*n)*v,e[2]=(a*n-i*o)*v,e[3]=d*v,e[4]=(u*t-i*l)*v,e[5]=(i*r-a*t)*v,e[6]=f*v,e[7]=(n*l-c*t)*v,e[8]=(o*t-n*r)*v,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,o,a){const l=Math.cos(r),c=Math.sin(r);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(cl.makeScale(e,t)),this}rotate(e){return this.premultiply(cl.makeRotation(-e)),this}translate(e,t){return this.premultiply(cl.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),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const cl=new Ze;function sp(s){for(let e=s.length-1;e>=0;--e)if(s[e]>=65535)return!0;return!1}const iv={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Us(s,e){return new iv[s](e)}function Ir(s){return document.createElementNS("http://www.w3.org/1999/xhtml",s)}function rp(){const s=Ir("canvas");return s.style.display="block",s}const nh={};function uu(s){s in nh||(nh[s]=!0,console.warn(s))}function sv(s,e,t){return new Promise(function(n,i){function r(){switch(s.clientWaitSync(e,s.SYNC_FLUSH_COMMANDS_BIT,0)){case s.WAIT_FAILED:i();break;case s.TIMEOUT_EXPIRED:setTimeout(r,t);break;default:n()}}setTimeout(r,t)})}const ih=new Ze().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),sh=new Ze().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),oo={[ci]:{transfer:Tr,primaries:Er,toReference:s=>s,fromReference:s=>s},[ln]:{transfer:Mt,primaries:Er,toReference:s=>s.convertSRGBToLinear(),fromReference:s=>s.convertLinearToSRGB()},[$r]:{transfer:Tr,primaries:Cr,toReference:s=>s.applyMatrix3(sh),fromReference:s=>s.applyMatrix3(ih)},[Ra]:{transfer:Mt,primaries:Cr,toReference:s=>s.convertSRGBToLinear().applyMatrix3(sh),fromReference:s=>s.applyMatrix3(ih).convertLinearToSRGB()}},rv=new Set([ci,$r]),ht={enabled:!0,_workingColorSpace:ci,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(s){if(!rv.has(s))throw new Error(`Unsupported working color space, "${s}".`);this._workingColorSpace=s},convert:function(s,e,t){if(this.enabled===!1||e===t||!e||!t)return s;const n=oo[e].toReference,i=oo[t].fromReference;return i(n(s))},fromWorkingColorSpace:function(s,e){return this.convert(s,this._workingColorSpace,e)},toWorkingColorSpace:function(s,e){return this.convert(s,e,this._workingColorSpace)},getPrimaries:function(s){return oo[s].primaries},getTransfer:function(s){return s===ti?Tr:oo[s].transfer}};function zs(s){return s<.04045?s*.0773993808:Math.pow(s*.9478672986+.0521327014,2.4)}function ul(s){return s<.0031308?s*12.92:1.055*Math.pow(s,.41666)-.055}let ds;class op{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ds===void 0&&(ds=Ir("canvas")),ds.width=e.width,ds.height=e.height;const n=ds.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=ds}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=Ir("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let o=0;o0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Ca)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Mr:e.x=e.x-Math.floor(e.x);break;case Mn:e.x=e.x<0?0:1;break;case br: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 Mr:e.y=e.y-Math.floor(e.y);break;case Mn:e.y=e.y<0?0:1;break;case br: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++}}Pt.DEFAULT_IMAGE=null;Pt.DEFAULT_MAPPING=Ca;Pt.DEFAULT_ANISOTROPY=1;class gt{constructor(e=0,t=0,n=0,i=1){gt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}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,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,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,n=this.y,i=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*r,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*r,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*r,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*r,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,n,i,r;const l=e.elements,c=l[0],u=l[4],h=l[8],d=l[1],f=l[5],g=l[9],v=l[2],m=l[6],p=l[10];if(Math.abs(u-d)<.01&&Math.abs(h-v)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+v)<.1&&Math.abs(g+m)<.1&&Math.abs(c+f+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const _=(c+1)/2,x=(f+1)/2,A=(p+1)/2,b=(u+d)/4,E=(h+v)/4,I=(g+m)/4;return _>x&&_>A?_<.01?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(_),i=b/n,r=E/n):x>A?x<.01?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(x),n=b/i,r=I/i):A<.01?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(A),n=E/r,i=I/r),this.set(n,i,r,t),this}let y=Math.sqrt((m-g)*(m-g)+(h-v)*(h-v)+(d-u)*(d-u));return Math.abs(y)<.001&&(y=1),this.x=(m-g)/y,this.y=(h-v)/y,this.z=(d-u)/y,this.w=Math.acos((c+f+p-1)/2),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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,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 ap extends ui{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new gt(0,0,e,t),this.scissorTest=!1,this.viewport=new gt(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ot,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new Pt(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const o=n.count;for(let a=0;a=0?1:-1,_=1-p*p;if(_>Number.EPSILON){const A=Math.sqrt(_),b=Math.atan2(A,p*y);m=Math.sin(m*b)/A,a=Math.sin(a*b)/A}const x=a*y;if(l=l*m+d*x,c=c*m+f*x,u=u*m+g*x,h=h*m+v*x,m===1-a){const A=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=A,c*=A,u*=A,h*=A}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,o){const a=n[i],l=n[i+1],c=n[i+2],u=n[i+3],h=r[o],d=r[o+1],f=r[o+2],g=r[o+3];return e[t]=a*g+u*h+l*f-c*d,e[t+1]=l*g+u*d+c*h-a*f,e[t+2]=c*g+u*f+a*d-l*h,e[t+3]=u*g-a*h-l*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(i/2),h=a(r/2),d=l(n/2),f=l(i/2),g=l(r/2);switch(o){case"XYZ":this._x=d*u*h+c*f*g,this._y=c*f*h-d*u*g,this._z=c*u*g+d*f*h,this._w=c*u*h-d*f*g;break;case"YXZ":this._x=d*u*h+c*f*g,this._y=c*f*h-d*u*g,this._z=c*u*g-d*f*h,this._w=c*u*h+d*f*g;break;case"ZXY":this._x=d*u*h-c*f*g,this._y=c*f*h+d*u*g,this._z=c*u*g+d*f*h,this._w=c*u*h-d*f*g;break;case"ZYX":this._x=d*u*h-c*f*g,this._y=c*f*h+d*u*g,this._z=c*u*g-d*f*h,this._w=c*u*h+d*f*g;break;case"YZX":this._x=d*u*h+c*f*g,this._y=c*f*h+d*u*g,this._z=c*u*g-d*f*h,this._w=c*u*h-d*f*g;break;case"XZY":this._x=d*u*h-c*f*g,this._y=c*f*h-d*u*g,this._z=c*u*g+d*f*h,this._w=c*u*h+d*f*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=n+a+h;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(u-l)*f,this._y=(r-c)*f,this._z=(o-i)*f}else if(n>a&&n>h){const f=2*Math.sqrt(1+n-a-h);this._w=(u-l)/f,this._x=.25*f,this._y=(i+o)/f,this._z=(r+c)/f}else if(a>h){const f=2*Math.sqrt(1+a-n-h);this._w=(r-c)/f,this._x=(i+o)/f,this._y=.25*f,this._z=(l+u)/f}else{const f=2*Math.sqrt(1+h-n-a);this._w=(o-i)/f,this._x=(r+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Et(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+i*c-r*l,this._y=i*u+o*l+r*a-n*c,this._z=r*u+o*c+n*l-i*a,this._w=o*u-n*a-i*l-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,r=this._z,o=this._w;let a=o*e._w+n*e._x+i*e._y+r*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=n,this._y=i,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const f=1-t;return this._w=f*o+t*this._w,this._x=f*n+t*this._x,this._y=f*i+t*this._y,this._z=f*r+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=o*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*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 N{constructor(e=0,t=0,n=0){N.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(rh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(rh.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,o=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*o,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*o,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*n),u=2*(a*t-r*i),h=2*(r*n-o*t);return this.x=t+l*c+o*h-a*u,this.y=n+l*u+a*c-r*h,this.z=i+l*h+r*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,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-r*a,this.y=r*o-n*l,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return dl.copy(this).projectOnVector(e),this.sub(dl)}reflect(e){return this.sub(dl.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 n=this.dot(e)/t;return Math.acos(Et(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){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(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const dl=new N,rh=new hn;class sn{constructor(e=new N(1/0,1/0,1/0),t=new N(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,bn),bn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Zs),lo.subVectors(this.max,Zs),fs.subVectors(e.a,Zs),ps.subVectors(e.b,Zs),ms.subVectors(e.c,Zs),mi.subVectors(ps,fs),gi.subVectors(ms,ps),Oi.subVectors(fs,ms);let t=[0,-mi.z,mi.y,0,-gi.z,gi.y,0,-Oi.z,Oi.y,mi.z,0,-mi.x,gi.z,0,-gi.x,Oi.z,0,-Oi.x,-mi.y,mi.x,0,-gi.y,gi.x,0,-Oi.y,Oi.x,0];return!fl(t,fs,ps,ms,lo)||(t=[1,0,0,0,1,0,0,0,1],!fl(t,fs,ps,ms,lo))?!1:(co.crossVectors(mi,gi),t=[co.x,co.y,co.z],fl(t,fs,ps,ms,lo))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,bn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(bn).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:(Zn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Zn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Zn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Zn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Zn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Zn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Zn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Zn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Zn),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 Zn=[new N,new N,new N,new N,new N,new N,new N,new N],bn=new N,ao=new sn,fs=new N,ps=new N,ms=new N,mi=new N,gi=new N,Oi=new N,Zs=new N,lo=new N,co=new N,Fi=new N;function fl(s,e,t,n,i){for(let r=0,o=s.length-3;r<=o;r+=3){Fi.fromArray(s,r);const a=i.x*Math.abs(Fi.x)+i.y*Math.abs(Fi.y)+i.z*Math.abs(Fi.z),l=e.dot(Fi),c=t.dot(Fi),u=n.dot(Fi);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const uv=new sn,Js=new N,pl=new N;class Zt{constructor(e=new N,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 n=this.center;t!==void 0?n.copy(t):uv.setFromPoints(e).getCenter(n);let i=0;for(let r=0,o=e.length;rthis.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;Js.subVectors(e,this.center);const t=Js.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Js,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(pl.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Js.copy(e.center).add(pl)),this.expandByPoint(Js.copy(e.center).sub(pl))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Jn=new N,ml=new N,uo=new N,vi=new N,gl=new N,ho=new N,vl=new N;class $s{constructor(e=new N,t=new N(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,Jn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Jn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Jn.copy(this.origin).addScaledVector(this.direction,t),Jn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){ml.copy(e).add(t).multiplyScalar(.5),uo.copy(t).sub(e).normalize(),vi.copy(this.origin).sub(ml);const r=e.distanceTo(t)*.5,o=-this.direction.dot(uo),a=vi.dot(this.direction),l=-vi.dot(uo),c=vi.lengthSq(),u=Math.abs(1-o*o);let h,d,f,g;if(u>0)if(h=o*l-a,d=o*a-l,g=r*u,h>=0)if(d>=-g)if(d<=g){const v=1/u;h*=v,d*=v,f=h*(h+o*d+2*a)+d*(o*h+d+2*l)+c}else d=r,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*l)+c;else d=-r,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*l)+c;else d<=-g?(h=Math.max(0,-(-o*r+a)),d=h>0?-r:Math.min(Math.max(-r,-l),r),f=-h*h+d*(d+2*l)+c):d<=g?(h=0,d=Math.min(Math.max(-r,-l),r),f=d*(d+2*l)+c):(h=Math.max(0,-(o*r+a)),d=h>0?r:Math.min(Math.max(-r,-l),r),f=-h*h+d*(d+2*l)+c);else d=o>0?-r:r,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(ml).addScaledVector(uo,d),f}intersectSphere(e,t){Jn.subVectors(e.center,this.origin);const n=Jn.dot(this.direction),i=Jn.dot(Jn)-n*n,r=e.radius*e.radius;if(i>r)return null;const o=Math.sqrt(r-i),a=n-o,l=n+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 n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,i=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,i=(e.min.x-d.x)*c),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),n>o||r>i||((r>n||isNaN(n))&&(n=r),(o=0?(a=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),n>l||a>i)||((a>n||n!==n)&&(n=a),(l=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,Jn)!==null}intersectTriangle(e,t,n,i,r){gl.subVectors(t,e),ho.subVectors(n,e),vl.crossVectors(gl,ho);let o=this.direction.dot(vl),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;vi.subVectors(this.origin,e);const l=a*this.direction.dot(ho.crossVectors(vi,ho));if(l<0)return null;const c=a*this.direction.dot(gl.cross(vi));if(c<0||l+c>o)return null;const u=-a*vi.dot(vl);return u<0?null:this.at(u/o,r)}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 qe{constructor(e,t,n,i,r,o,a,l,c,u,h,d,f,g,v,m){qe.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,r,o,a,l,c,u,h,d,f,g,v,m)}set(e,t,n,i,r,o,a,l,c,u,h,d,f,g,v,m){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=r,p[5]=o,p[9]=a,p[13]=l,p[2]=c,p[6]=u,p[10]=h,p[14]=d,p[3]=f,p[7]=g,p[11]=v,p[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 qe().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[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,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/gs.setFromMatrixColumn(e,0).length(),r=1/gs.setFromMatrixColumn(e,1).length(),o=1/gs.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(r),h=Math.sin(r);if(e.order==="XYZ"){const d=o*u,f=o*h,g=a*u,v=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=f+g*c,t[5]=d-v*c,t[9]=-a*l,t[2]=v-d*c,t[6]=g+f*c,t[10]=o*l}else if(e.order==="YXZ"){const d=l*u,f=l*h,g=c*u,v=c*h;t[0]=d+v*a,t[4]=g*a-f,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=f*a-g,t[6]=v+d*a,t[10]=o*l}else if(e.order==="ZXY"){const d=l*u,f=l*h,g=c*u,v=c*h;t[0]=d-v*a,t[4]=-o*h,t[8]=g+f*a,t[1]=f+g*a,t[5]=o*u,t[9]=v-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const d=o*u,f=o*h,g=a*u,v=a*h;t[0]=l*u,t[4]=g*c-f,t[8]=d*c+v,t[1]=l*h,t[5]=v*c+d,t[9]=f*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const d=o*l,f=o*c,g=a*l,v=a*c;t[0]=l*u,t[4]=v-d*h,t[8]=g*h+f,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=f*h+g,t[10]=d-v*h}else if(e.order==="XZY"){const d=o*l,f=o*c,g=a*l,v=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+v,t[5]=o*u,t[9]=f*h-g,t[2]=g*h-f,t[6]=a*u,t[10]=v*h+d}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(hv,e,dv)}lookAt(e,t,n){const i=this.elements;return fn.subVectors(e,t),fn.lengthSq()===0&&(fn.z=1),fn.normalize(),_i.crossVectors(n,fn),_i.lengthSq()===0&&(Math.abs(n.z)===1?fn.x+=1e-4:fn.z+=1e-4,fn.normalize(),_i.crossVectors(n,fn)),_i.normalize(),fo.crossVectors(fn,_i),i[0]=_i.x,i[4]=fo.x,i[8]=fn.x,i[1]=_i.y,i[5]=fo.y,i[9]=fn.y,i[2]=_i.z,i[6]=fo.z,i[10]=fn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],h=n[5],d=n[9],f=n[13],g=n[2],v=n[6],m=n[10],p=n[14],y=n[3],_=n[7],x=n[11],A=n[15],b=i[0],E=i[4],I=i[8],w=i[12],M=i[1],F=i[5],V=i[9],G=i[13],q=i[2],ae=i[6],Q=i[10],oe=i[14],B=i[3],Me=i[7],be=i[11],Ae=i[15];return r[0]=o*b+a*M+l*q+c*B,r[4]=o*E+a*F+l*ae+c*Me,r[8]=o*I+a*V+l*Q+c*be,r[12]=o*w+a*G+l*oe+c*Ae,r[1]=u*b+h*M+d*q+f*B,r[5]=u*E+h*F+d*ae+f*Me,r[9]=u*I+h*V+d*Q+f*be,r[13]=u*w+h*G+d*oe+f*Ae,r[2]=g*b+v*M+m*q+p*B,r[6]=g*E+v*F+m*ae+p*Me,r[10]=g*I+v*V+m*Q+p*be,r[14]=g*w+v*G+m*oe+p*Ae,r[3]=y*b+_*M+x*q+A*B,r[7]=y*E+_*F+x*ae+A*Me,r[11]=y*I+_*V+x*Q+A*be,r[15]=y*w+_*G+x*oe+A*Ae,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],n=e[4],i=e[8],r=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],f=e[14],g=e[3],v=e[7],m=e[11],p=e[15];return g*(+r*l*h-i*c*h-r*a*d+n*c*d+i*a*f-n*l*f)+v*(+t*l*f-t*c*d+r*o*d-i*o*f+i*c*u-r*l*u)+m*(+t*c*h-t*a*f-r*o*h+n*o*f+r*a*u-n*c*u)+p*(-i*a*u-t*l*h+t*a*d+i*o*h-n*o*d+n*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,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],f=e[11],g=e[12],v=e[13],m=e[14],p=e[15],y=h*m*c-v*d*c+v*l*f-a*m*f-h*l*p+a*d*p,_=g*d*c-u*m*c-g*l*f+o*m*f+u*l*p-o*d*p,x=u*v*c-g*h*c+g*a*f-o*v*f-u*a*p+o*h*p,A=g*h*l-u*v*l-g*a*d+o*v*d+u*a*m-o*h*m,b=t*y+n*_+i*x+r*A;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const E=1/b;return e[0]=y*E,e[1]=(v*d*r-h*m*r-v*i*f+n*m*f+h*i*p-n*d*p)*E,e[2]=(a*m*r-v*l*r+v*i*c-n*m*c-a*i*p+n*l*p)*E,e[3]=(h*l*r-a*d*r-h*i*c+n*d*c+a*i*f-n*l*f)*E,e[4]=_*E,e[5]=(u*m*r-g*d*r+g*i*f-t*m*f-u*i*p+t*d*p)*E,e[6]=(g*l*r-o*m*r-g*i*c+t*m*c+o*i*p-t*l*p)*E,e[7]=(o*d*r-u*l*r+u*i*c-t*d*c-o*i*f+t*l*f)*E,e[8]=x*E,e[9]=(g*h*r-u*v*r-g*n*f+t*v*f+u*n*p-t*h*p)*E,e[10]=(o*v*r-g*a*r+g*n*c-t*v*c-o*n*p+t*a*p)*E,e[11]=(u*a*r-o*h*r-u*n*c+t*h*c+o*n*f-t*a*f)*E,e[12]=A*E,e[13]=(u*v*i-g*h*i+g*n*d-t*v*d-u*n*m+t*h*m)*E,e[14]=(g*a*i-o*v*i-g*n*l+t*v*l+o*n*m-t*a*m)*E,e[15]=(o*h*i-u*a*i+u*n*l-t*h*l-o*n*d+t*a*d)*E,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,o=e.x,a=e.y,l=e.z,c=r*o,u=r*a;return this.set(c*o+n,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+n,u*l-i*o,0,c*l-i*a,u*l+i*o,r*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,o){return this.set(1,n,r,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,o=t._y,a=t._z,l=t._w,c=r+r,u=o+o,h=a+a,d=r*c,f=r*u,g=r*h,v=o*u,m=o*h,p=a*h,y=l*c,_=l*u,x=l*h,A=n.x,b=n.y,E=n.z;return i[0]=(1-(v+p))*A,i[1]=(f+x)*A,i[2]=(g-_)*A,i[3]=0,i[4]=(f-x)*b,i[5]=(1-(d+p))*b,i[6]=(m+y)*b,i[7]=0,i[8]=(g+_)*E,i[9]=(m-y)*E,i[10]=(1-(d+v))*E,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let r=gs.set(i[0],i[1],i[2]).length();const o=gs.set(i[4],i[5],i[6]).length(),a=gs.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),e.x=i[12],e.y=i[13],e.z=i[14],Sn.copy(this);const c=1/r,u=1/o,h=1/a;return Sn.elements[0]*=c,Sn.elements[1]*=c,Sn.elements[2]*=c,Sn.elements[4]*=u,Sn.elements[5]*=u,Sn.elements[6]*=u,Sn.elements[8]*=h,Sn.elements[9]*=h,Sn.elements[10]*=h,t.setFromRotationMatrix(Sn),n.x=r,n.y=o,n.z=a,this}makePerspective(e,t,n,i,r,o,a=Vn){const l=this.elements,c=2*r/(t-e),u=2*r/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let f,g;if(a===Vn)f=-(o+r)/(o-r),g=-2*o*r/(o-r);else if(a===Rr)f=-o/(o-r),g=-o*r/(o-r);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,r,o,a=Vn){const l=this.elements,c=1/(t-e),u=1/(n-i),h=1/(o-r),d=(t+e)*c,f=(n+i)*u;let g,v;if(a===Vn)g=(o+r)*h,v=-2*h;else if(a===Rr)g=r*h,v=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-d,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=v,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const gs=new N,Sn=new qe,hv=new N(0,0,0),dv=new N(1,1,1),_i=new N,fo=new N,fn=new N,oh=new qe,ah=new hn;class _n{constructor(e=0,t=0,n=0,i=_n.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],o=i[4],a=i[8],l=i[1],c=i[5],u=i[9],h=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(Et(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Et(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Et(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-Et(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Et(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-Et(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return oh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(oh,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return ah.setFromEuler(this),this.setFromQuaternion(ah,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}}_n.DEFAULT_ORDER="XYZ";class La{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.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()})),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function r(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(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){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),g.length>0&&(n.nodes=g)}return n.object=i,n;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 n=0;n0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){wn.subVectors(i,t),jn.subVectors(n,t),yl.subVectors(e,t);const o=wn.dot(wn),a=wn.dot(jn),l=wn.dot(yl),c=jn.dot(jn),u=jn.dot(yl),h=o*c-a*a;if(h===0)return r.set(0,0,0),null;const d=1/h,f=(c*l-a*u)*d,g=(o*u-a*l)*d;return r.set(1-f-g,g,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Qn)===null?!1:Qn.x>=0&&Qn.y>=0&&Qn.x+Qn.y<=1}static getInterpolation(e,t,n,i,r,o,a,l){return this.getBarycoord(e,t,n,i,Qn)===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(r,Qn.x),l.addScaledVector(o,Qn.y),l.addScaledVector(a,Qn.z),l)}static isFrontFacing(e,t,n,i){return wn.subVectors(n,t),jn.subVectors(e,t),wn.cross(jn).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),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 wn.subVectors(this.c,this.b),jn.subVectors(this.a,this.b),wn.cross(jn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return mn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return mn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return mn.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return mn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return mn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let o,a;ys.subVectors(i,n),xs.subVectors(r,n),xl.subVectors(e,n);const l=ys.dot(xl),c=xs.dot(xl);if(l<=0&&c<=0)return t.copy(n);Ml.subVectors(e,i);const u=ys.dot(Ml),h=xs.dot(Ml);if(u>=0&&h<=u)return t.copy(i);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(ys,o);bl.subVectors(e,r);const f=ys.dot(bl),g=xs.dot(bl);if(g>=0&&f<=g)return t.copy(r);const v=f*c-l*g;if(v<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(n).addScaledVector(xs,a);const m=u*g-f*h;if(m<=0&&h-u>=0&&f-g>=0)return fh.subVectors(r,i),a=(h-u)/(h-u+(f-g)),t.copy(i).addScaledVector(fh,a);const p=1/(m+v+d);return o=v*p,a=d*p,t.copy(n).addScaledVector(ys,o).addScaledVector(xs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const lp={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},yi={h:0,s:0,l:0},mo={h:0,s:0,l:0};function Sl(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*6*(2/3-t):s}class Pe{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ln){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ht.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=ht.workingColorSpace){return this.r=e,this.g=t,this.b=n,ht.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=ht.workingColorSpace){if(e=cu(e,1),t=Et(t,0,1),n=Et(n,0,1),t===0)this.r=this.g=this.b=n;else{const r=n<=.5?n*(1+t):n+t-n*t,o=2*n-r;this.r=Sl(o,r,e+1/3),this.g=Sl(o,r,e),this.b=Sl(o,r,e-1/3)}return ht.toWorkingColorSpace(this,i),this}setStyle(e,t=ln){function n(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=i[1],o=r.length;if(o===3)return this.setRGB(parseInt(r.charAt(0),16)/15,parseInt(r.charAt(1),16)/15,parseInt(r.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(r,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=ln){const n=lp[e.toLowerCase()];return n!==void 0?this.setHex(n,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=zs(e.r),this.g=zs(e.g),this.b=zs(e.b),this}copyLinearToSRGB(e){return this.r=ul(e.r),this.g=ul(e.g),this.b=ul(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ln){return ht.fromWorkingColorSpace(qt.copy(this),e),Math.round(Et(qt.r*255,0,255))*65536+Math.round(Et(qt.g*255,0,255))*256+Math.round(Et(qt.b*255,0,255))}getHexString(e=ln){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ht.workingColorSpace){ht.fromWorkingColorSpace(qt.copy(this),t);const n=qt.r,i=qt.g,r=qt.b,o=Math.max(n,i,r),a=Math.min(n,i,r);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case n:l=(i-r)/h+(i0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==es&&(n.blending=this.blending),this.side!==oi&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==va&&(n.blendSrc=this.blendSrc),this.blendDst!==_a&&(n.blendDst=this.blendDst),this.blendEquation!==Ai&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==_r&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Pc&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Bn&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Bn&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Bn&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(r){const o=[];for(const a in r){const l=r[a];delete l.metadata,o.push(l)}return o}if(t){const r=i(e.textures),o=i(e.images);r.length>0&&(n.textures=r),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.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++}}class hi extends Kt{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Pe(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 _n,this.combine=Gr,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 ni=_v();function _v(){const s=new ArrayBuffer(4),e=new Float32Array(s),t=new Uint32Array(s),n=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(n[l]=0,n[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(n[l]=1024>>-c-14,n[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,i[l]=24,i[l|256]=24):(n[l]=31744,n[l|256]=64512,i[l]=13,i[l|256]=13)}const r=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,r[l]=c|u}for(let l=1024;l<2048;++l)r[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:r,exponentTable:o,offsetTable:a}}function an(s){Math.abs(s)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),s=Et(s,-65504,65504),ni.floatView[0]=s;const e=ni.uint32View[0],t=e>>23&511;return ni.baseTable[t]+((e&8388607)>>ni.shiftTable[t])}function cr(s){const e=s>>10;return ni.uint32View[0]=ni.mantissaTable[ni.offsetTable[e]+(s&1023)]+ni.exponentTable[e],ni.floatView[0]}const yv={toHalfFloat:an,fromHalfFloat:cr},Dt=new N,go=new se;class pt{constructor(e,t,n=!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=n,this.usage=Pr,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=gn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return uu("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,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;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 n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h0&&(i[l]=u,r=!0)}r&&(e.data.morphAttributes=i,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 n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const r=e.morphAttributes;for(const c in r){const u=[],h=r[c];for(let d=0,f=h.length;d0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;r(e.far-e.near)**2))&&(ph.copy(r).invert(),ki.copy(e.ray).applyMatrix4(ph),!(n.boundingBox!==null&&ki.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,ki)))}_computeIntersections(e,t,n){let i;const r=this.geometry,o=this.material,a=r.index,l=r.attributes.position,c=r.attributes.uv,u=r.attributes.uv1,h=r.attributes.normal,d=r.groups,f=r.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,v=d.length;gt.far?null:{distance:c,point:So.clone(),object:s}}function wo(s,e,t,n,i,r,o,a,l,c){s.getVertexPosition(a,bs),s.getVertexPosition(l,Ss),s.getVertexPosition(c,ws);const u=Ev(s,e,t,n,bs,Ss,ws,bo);if(u){i&&(yo.fromBufferAttribute(i,a),xo.fromBufferAttribute(i,l),Mo.fromBufferAttribute(i,c),u.uv=mn.getInterpolation(bo,bs,Ss,ws,yo,xo,Mo,new se)),r&&(yo.fromBufferAttribute(r,a),xo.fromBufferAttribute(r,l),Mo.fromBufferAttribute(r,c),u.uv1=mn.getInterpolation(bo,bs,Ss,ws,yo,xo,Mo,new se)),o&&(gh.fromBufferAttribute(o,a),vh.fromBufferAttribute(o,l),_h.fromBufferAttribute(o,c),u.normal=mn.getInterpolation(bo,bs,Ss,ws,gh,vh,_h,new N),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new N,materialIndex:0};mn.getNormal(bs,Ss,ws,h.normal),u.face=h}return u}class cs extends it{constructor(e=1,t=1,n=1,i=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:o};const a=this;i=Math.floor(i),r=Math.floor(r),o=Math.floor(o);const l=[],c=[],u=[],h=[];let d=0,f=0;g("z","y","x",-1,-1,n,t,e,o,r,0),g("z","y","x",1,-1,n,t,-e,o,r,1),g("x","z","y",1,1,e,n,t,i,o,2),g("x","z","y",1,-1,e,n,-t,i,o,3),g("x","y","z",1,-1,e,t,n,i,r,4),g("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(l),this.setAttribute("position",new Ne(c,3)),this.setAttribute("normal",new Ne(u,3)),this.setAttribute("uv",new Ne(h,2));function g(v,m,p,y,_,x,A,b,E,I,w){const M=x/E,F=A/I,V=x/2,G=A/2,q=b/2,ae=E+1,Q=I+1;let oe=0,B=0;const Me=new N;for(let be=0;be0?1:-1,u.push(Me.x,Me.y,Me.z),h.push(ge/E),h.push(1-be/I),oe+=1}}for(let be=0;be0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Xr extends ct{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new qe,this.projectionMatrix=new qe,this.projectionMatrixInverse=new qe,this.coordinateSystem=Vn}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 xi=new N,yh=new se,xh=new se;class Ut extends Xr{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,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=Vs*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ns*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Vs*2*Math.atan(Math.tan(ns*.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,n){xi.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(xi.x,xi.y).multiplyScalar(-e/xi.z),xi.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(xi.x,xi.y).multiplyScalar(-e/xi.z)}getViewSize(e,t){return this.getViewBounds(e,yh,xh),t.subVectors(xh,yh)}setViewOffset(e,t,n,i,r,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=n,this.view.offsetY=i,this.view.width=r,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(ns*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;r+=o.offsetX*i/l,t-=o.offsetY*n/c,i*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,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 As=-90,Ts=1;class hp extends ct{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Ut(As,Ts,e,t);i.layers=this.layers,this.add(i);const r=new Ut(As,Ts,e,t);r.layers=this.layers,this.add(r);const o=new Ut(As,Ts,e,t);o.layers=this.layers,this.add(o);const a=new Ut(As,Ts,e,t);a.layers=this.layers,this.add(a);const l=new Ut(As,Ts,e,t);l.layers=this.layers,this.add(l);const c=new Ut(As,Ts,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,o,a,l]=t;for(const c of t)this.remove(c);if(e===Vn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.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===Rr)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.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:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,o,a,l,c,u]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const v=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,o),e.setRenderTarget(n,2,i),e.render(t,a),e.setRenderTarget(n,3,i),e.render(t,l),e.setRenderTarget(n,4,i),e.render(t,c),n.texture.generateMipmaps=v,e.setRenderTarget(n,5,i),e.render(t,u),e.setRenderTarget(h,d,f),e.xr.enabled=g,n.texture.needsPMREMUpdate=!0}}class qr extends Pt{constructor(e,t,n,i,r,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:ai,super(e,t,n,i,r,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class dp extends In{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new qr(i,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:Ot}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 n={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 ); } `},i=new cs(5,5,5),r=new Ln({name:"CubemapFromEquirect",uniforms:Hs(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:nn,blending:si});r.uniforms.tEquirect.value=t;const o=new Nt(i,r),a=t.minFilter;return t.minFilter===zn&&(t.minFilter=Ot),new hp(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(r)}}const Tl=new N,Iv=new N,Lv=new Ze;class wi{constructor(e=new N(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,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Tl.subVectors(n,t).cross(Iv.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,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 n=e.delta(Tl),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:t.copy(e.start).addScaledVector(n,r)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<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 n=t||Lv.getNormalMatrix(e),i=this.coplanarPoint(Tl).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),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 Bi=new Zt,Ao=new N;class Yr{constructor(e=new wi,t=new wi,n=new wi,i=new wi,r=new wi,o=new wi){this.planes=[e,t,n,i,r,o]}set(e,t,n,i,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Vn){const n=this.planes,i=e.elements,r=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],h=i[6],d=i[7],f=i[8],g=i[9],v=i[10],m=i[11],p=i[12],y=i[13],_=i[14],x=i[15];if(n[0].setComponents(l-r,d-c,m-f,x-p).normalize(),n[1].setComponents(l+r,d+c,m+f,x+p).normalize(),n[2].setComponents(l+o,d+u,m+g,x+y).normalize(),n[3].setComponents(l-o,d-u,m-g,x-y).normalize(),n[4].setComponents(l-a,d-h,m-v,x-_).normalize(),t===Vn)n[5].setComponents(l+a,d+h,m+v,x+_).normalize();else if(t===Rr)n[5].setComponents(a,h,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(),Bi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Bi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Bi)}intersectsSprite(e){return Bi.center.set(0,0,0),Bi.radius=.7071067811865476,Bi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Bi)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(n)0?e.max.x:e.min.x,Ao.y=i.normal.y>0?e.max.y:e.min.y,Ao.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Ao)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function fp(){let s=null,e=!1,t=null,n=null;function i(r,o){t(r,o),n=s.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=s.requestAnimationFrame(i),e=!0)},stop:function(){s.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){s=r}}}function Nv(s){const e=new WeakMap;function t(a,l){const c=a.array,u=a.usage,h=c.byteLength,d=s.createBuffer();s.bindBuffer(l,d),s.bufferData(l,c,u),a.onUploadCallback();let f;if(c instanceof Float32Array)f=s.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?f=s.HALF_FLOAT:f=s.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=s.SHORT;else if(c instanceof Uint32Array)f=s.UNSIGNED_INT;else if(c instanceof Int32Array)f=s.INT;else if(c instanceof Int8Array)f=s.BYTE;else if(c instanceof Uint8Array)f=s.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=s.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:d,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:h}}function n(a,l,c){const u=l.array,h=l._updateRange,d=l.updateRanges;if(s.bindBuffer(c,a),h.count===-1&&d.length===0&&s.bufferSubData(c,0,u),d.length!==0){for(let f=0,g=d.length;f 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`,Jv=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,Kv=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,jv=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,Qv=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,e_=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,t_=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec3 vColor; #endif`,n_=`#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( batchId ); vColor.xyz *= batchingColor.xyz; #endif`,i_=`#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; } float luminance( const in vec3 rgb ) { const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); return dot( weights, rgb ); } 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`,s_=`#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`,r_=`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`,o_=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,a_=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,l_=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; #endif`,c_=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,u_="gl_FragColor = linearToOutputTexel( gl_FragColor );",h_=` 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 ); } vec4 LinearToLinear( in vec4 value ) { return value; } vec4 LinearTosRGB( in vec4 value ) { return sRGBTransferOETF( value ); }`,d_=`#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`,f_=`#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`,p_=`#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`,m_=`#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`,g_=`#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`,v_=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,__=`#ifdef USE_FOG varying float vFogDepth; #endif`,y_=`#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`,x_=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,M_=`#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 }`,b_=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,S_=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,w_=`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`,A_=`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`,T_=`#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`,E_=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,C_=`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`,P_=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,R_=`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`,I_=`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`,L_=`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 ); }`,N_=` 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.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.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.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`,D_=`#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`,U_=`#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`,O_=`#if defined( USE_LOGDEPTHBUF ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,F_=`#if defined( USE_LOGDEPTHBUF ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,k_=`#ifdef USE_LOGDEPTHBUF varying float vFragDepth; varying float vIsPerspective; #endif`,B_=`#ifdef USE_LOGDEPTHBUF vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #endif`,z_=`#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`,V_=`#ifdef USE_MAP uniform sampler2D map; #endif`,H_=`#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`,G_=`#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`,W_=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; #endif`,$_=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,X_=`#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`,q_=`#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`,Y_=`#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`,Z_=`#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`,J_=`#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`,K_=`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;`,j_=`#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`,Q_=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,e0=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,t0=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,n0=`#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`,i0=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; #endif`,s0=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,r0=`#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`,o0=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,a0=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,l0=`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 vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); const float ShiftRight8 = 1. / 256.; vec4 packDepthToRGBA( const in float v ) { vec4 r = vec4( fract( v * PackFactors ), v ); r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors ); } vec2 packDepthToRG( in highp float v ) { return packDepthToRGBA( v ).yx; } float unpackRGToDepth( const in highp vec2 v ) { return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); } vec4 pack2HalfToRGBA( 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( 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 ); }`,c0=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,u0=`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;`,h0=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,d0=`#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`,f0=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; #endif`,p0=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,m0=`#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 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 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 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 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 shadow; } 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 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 shadow; } #endif`,g0=`#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 shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 struct SpotLightShadow { 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 shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`,v0=`#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`,_0=`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.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.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.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif #endif return shadow; }`,y0=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,x0=`#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`,M0=`#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`,b0=`#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`,S0=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,w0=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,A0=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,T0=`#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 OptimizedCineonToneMapping( 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; }`,E0=`#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`,C0=`#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`,P0=`#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`,R0=`#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`,I0=`#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`,L0=`#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 N0=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,D0=`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 }`,U0=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,O0=`#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 }`,F0=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,k0=`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 }`,B0=`#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; }`,z0=`#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 ); #endif }`,V0=`#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; }`,H0=`#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 ); }`,G0=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,W0=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,$0=`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 }`,X0=`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 }`,q0=`#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 }`,Y0=`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 }`,Z0=`#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 }`,J0=`#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 }`,K0=`#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; }`,j0=`#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 }`,Q0=`#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 }`,ey=`#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 }`,ty=`#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 }`,ny=`#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 }`,iy=`#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 }`,sy=`#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 }`,ry=`#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 }`,oy=`#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 }`,ay=`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 }`,ly=`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 }`,cy=`#include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include }`,uy=`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 }`,hy=`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 }`,dy=`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 }`,nt={alphahash_fragment:Dv,alphahash_pars_fragment:Uv,alphamap_fragment:Ov,alphamap_pars_fragment:Fv,alphatest_fragment:kv,alphatest_pars_fragment:Bv,aomap_fragment:zv,aomap_pars_fragment:Vv,batching_pars_vertex:Hv,batching_vertex:Gv,begin_vertex:Wv,beginnormal_vertex:$v,bsdfs:Xv,iridescence_fragment:qv,bumpmap_pars_fragment:Yv,clipping_planes_fragment:Zv,clipping_planes_pars_fragment:Jv,clipping_planes_pars_vertex:Kv,clipping_planes_vertex:jv,color_fragment:Qv,color_pars_fragment:e_,color_pars_vertex:t_,color_vertex:n_,common:i_,cube_uv_reflection_fragment:s_,defaultnormal_vertex:r_,displacementmap_pars_vertex:o_,displacementmap_vertex:a_,emissivemap_fragment:l_,emissivemap_pars_fragment:c_,colorspace_fragment:u_,colorspace_pars_fragment:h_,envmap_fragment:d_,envmap_common_pars_fragment:f_,envmap_pars_fragment:p_,envmap_pars_vertex:m_,envmap_physical_pars_fragment:T_,envmap_vertex:g_,fog_vertex:v_,fog_pars_vertex:__,fog_fragment:y_,fog_pars_fragment:x_,gradientmap_pars_fragment:M_,lightmap_pars_fragment:b_,lights_lambert_fragment:S_,lights_lambert_pars_fragment:w_,lights_pars_begin:A_,lights_toon_fragment:E_,lights_toon_pars_fragment:C_,lights_phong_fragment:P_,lights_phong_pars_fragment:R_,lights_physical_fragment:I_,lights_physical_pars_fragment:L_,lights_fragment_begin:N_,lights_fragment_maps:D_,lights_fragment_end:U_,logdepthbuf_fragment:O_,logdepthbuf_pars_fragment:F_,logdepthbuf_pars_vertex:k_,logdepthbuf_vertex:B_,map_fragment:z_,map_pars_fragment:V_,map_particle_fragment:H_,map_particle_pars_fragment:G_,metalnessmap_fragment:W_,metalnessmap_pars_fragment:$_,morphinstance_vertex:X_,morphcolor_vertex:q_,morphnormal_vertex:Y_,morphtarget_pars_vertex:Z_,morphtarget_vertex:J_,normal_fragment_begin:K_,normal_fragment_maps:j_,normal_pars_fragment:Q_,normal_pars_vertex:e0,normal_vertex:t0,normalmap_pars_fragment:n0,clearcoat_normal_fragment_begin:i0,clearcoat_normal_fragment_maps:s0,clearcoat_pars_fragment:r0,iridescence_pars_fragment:o0,opaque_fragment:a0,packing:l0,premultiplied_alpha_fragment:c0,project_vertex:u0,dithering_fragment:h0,dithering_pars_fragment:d0,roughnessmap_fragment:f0,roughnessmap_pars_fragment:p0,shadowmap_pars_fragment:m0,shadowmap_pars_vertex:g0,shadowmap_vertex:v0,shadowmask_pars_fragment:_0,skinbase_vertex:y0,skinning_pars_vertex:x0,skinning_vertex:M0,skinnormal_vertex:b0,specularmap_fragment:S0,specularmap_pars_fragment:w0,tonemapping_fragment:A0,tonemapping_pars_fragment:T0,transmission_fragment:E0,transmission_pars_fragment:C0,uv_pars_fragment:P0,uv_pars_vertex:R0,uv_vertex:I0,worldpos_vertex:L0,background_vert:N0,background_frag:D0,backgroundCube_vert:U0,backgroundCube_frag:O0,cube_vert:F0,cube_frag:k0,depth_vert:B0,depth_frag:z0,distanceRGBA_vert:V0,distanceRGBA_frag:H0,equirect_vert:G0,equirect_frag:W0,linedashed_vert:$0,linedashed_frag:X0,meshbasic_vert:q0,meshbasic_frag:Y0,meshlambert_vert:Z0,meshlambert_frag:J0,meshmatcap_vert:K0,meshmatcap_frag:j0,meshnormal_vert:Q0,meshnormal_frag:ey,meshphong_vert:ty,meshphong_frag:ny,meshphysical_vert:iy,meshphysical_frag:sy,meshtoon_vert:ry,meshtoon_frag:oy,points_vert:ay,points_frag:ly,shadow_vert:cy,shadow_frag:uy,sprite_vert:hy,sprite_frag:dy},Ce={common:{diffuse:{value:new Pe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ze},alphaMap:{value:null},alphaMapTransform:{value:new Ze},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ze}},envmap:{envMap:{value:null},envMapRotation:{value:new Ze},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ze}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ze}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ze},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ze},normalScale:{value:new se(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ze},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ze}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ze}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ze}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Pe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 Pe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ze},alphaTest:{value:0},uvTransform:{value:new Ze}},sprite:{diffuse:{value:new Pe(16777215)},opacity:{value:1},center:{value:new se(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ze},alphaMap:{value:null},alphaMapTransform:{value:new Ze},alphaTest:{value:0}}},Tn={basic:{uniforms:en([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.fog]),vertexShader:nt.meshbasic_vert,fragmentShader:nt.meshbasic_frag},lambert:{uniforms:en([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new Pe(0)}}]),vertexShader:nt.meshlambert_vert,fragmentShader:nt.meshlambert_frag},phong:{uniforms:en([Ce.common,Ce.specularmap,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,Ce.lights,{emissive:{value:new Pe(0)},specular:{value:new Pe(1118481)},shininess:{value:30}}]),vertexShader:nt.meshphong_vert,fragmentShader:nt.meshphong_frag},standard:{uniforms:en([Ce.common,Ce.envmap,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.roughnessmap,Ce.metalnessmap,Ce.fog,Ce.lights,{emissive:{value:new Pe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag},toon:{uniforms:en([Ce.common,Ce.aomap,Ce.lightmap,Ce.emissivemap,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.gradientmap,Ce.fog,Ce.lights,{emissive:{value:new Pe(0)}}]),vertexShader:nt.meshtoon_vert,fragmentShader:nt.meshtoon_frag},matcap:{uniforms:en([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,Ce.fog,{matcap:{value:null}}]),vertexShader:nt.meshmatcap_vert,fragmentShader:nt.meshmatcap_frag},points:{uniforms:en([Ce.points,Ce.fog]),vertexShader:nt.points_vert,fragmentShader:nt.points_frag},dashed:{uniforms:en([Ce.common,Ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:nt.linedashed_vert,fragmentShader:nt.linedashed_frag},depth:{uniforms:en([Ce.common,Ce.displacementmap]),vertexShader:nt.depth_vert,fragmentShader:nt.depth_frag},normal:{uniforms:en([Ce.common,Ce.bumpmap,Ce.normalmap,Ce.displacementmap,{opacity:{value:1}}]),vertexShader:nt.meshnormal_vert,fragmentShader:nt.meshnormal_frag},sprite:{uniforms:en([Ce.sprite,Ce.fog]),vertexShader:nt.sprite_vert,fragmentShader:nt.sprite_frag},background:{uniforms:{uvTransform:{value:new Ze},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:nt.background_vert,fragmentShader:nt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ze}},vertexShader:nt.backgroundCube_vert,fragmentShader:nt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:nt.cube_vert,fragmentShader:nt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:nt.equirect_vert,fragmentShader:nt.equirect_frag},distanceRGBA:{uniforms:en([Ce.common,Ce.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:nt.distanceRGBA_vert,fragmentShader:nt.distanceRGBA_frag},shadow:{uniforms:en([Ce.lights,Ce.fog,{color:{value:new Pe(0)},opacity:{value:1}}]),vertexShader:nt.shadow_vert,fragmentShader:nt.shadow_frag}};Tn.physical={uniforms:en([Tn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ze},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ze},clearcoatNormalScale:{value:new se(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ze},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ze},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ze},sheen:{value:0},sheenColor:{value:new Pe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ze},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ze},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ze},transmissionSamplerSize:{value:new se},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ze},attenuationDistance:{value:0},attenuationColor:{value:new Pe(0)},specularColor:{value:new Pe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ze},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ze},anisotropyVector:{value:new se},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ze}}]),vertexShader:nt.meshphysical_vert,fragmentShader:nt.meshphysical_frag};const To={r:0,b:0,g:0},zi=new _n,fy=new qe;function py(s,e,t,n,i,r,o){const a=new Pe(0);let l=r===!0?0:1,c,u,h=null,d=0,f=null;function g(y){let _=y.isScene===!0?y.background:null;return _&&_.isTexture&&(_=(y.backgroundBlurriness>0?t:e).get(_)),_}function v(y){let _=!1;const x=g(y);x===null?p(a,l):x&&x.isColor&&(p(x,1),_=!0);const A=s.xr.getEnvironmentBlendMode();A==="additive"?n.buffers.color.setClear(0,0,0,1,o):A==="alpha-blend"&&n.buffers.color.setClear(0,0,0,0,o),(s.autoClear||_)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),s.clear(s.autoClearColor,s.autoClearDepth,s.autoClearStencil))}function m(y,_){const x=g(_);x&&(x.isCubeTexture||x.mapping===Ws)?(u===void 0&&(u=new Nt(new cs(1,1,1),new Ln({name:"BackgroundCubeMaterial",uniforms:Hs(Tn.backgroundCube.uniforms),vertexShader:Tn.backgroundCube.vertexShader,fragmentShader:Tn.backgroundCube.fragmentShader,side:nn,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(A,b,E){this.matrixWorld.copyPosition(E.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),zi.copy(_.backgroundRotation),zi.x*=-1,zi.y*=-1,zi.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(zi.y*=-1,zi.z*=-1),u.material.uniforms.envMap.value=x,u.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=_.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(fy.makeRotationFromEuler(zi)),u.material.toneMapped=ht.getTransfer(x.colorSpace)!==Mt,(h!==x||d!==x.version||f!==s.toneMapping)&&(u.material.needsUpdate=!0,h=x,d=x.version,f=s.toneMapping),u.layers.enableAll(),y.unshift(u,u.geometry,u.material,0,0,null)):x&&x.isTexture&&(c===void 0&&(c=new Nt(new Xs(2,2),new Ln({name:"BackgroundMaterial",uniforms:Hs(Tn.background.uniforms),vertexShader:Tn.background.vertexShader,fragmentShader:Tn.background.fragmentShader,side:oi,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=x,c.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,c.material.toneMapped=ht.getTransfer(x.colorSpace)!==Mt,x.matrixAutoUpdate===!0&&x.updateMatrix(),c.material.uniforms.uvTransform.value.copy(x.matrix),(h!==x||d!==x.version||f!==s.toneMapping)&&(c.material.needsUpdate=!0,h=x,d=x.version,f=s.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null))}function p(y,_){y.getRGB(To,cp(s)),n.buffers.color.setClear(To.r,To.g,To.b,_,o)}return{getClearColor:function(){return a},setClearColor:function(y,_=1){a.set(y),l=_,p(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(y){l=y,p(a,l)},render:v,addToRenderList:m}}function my(s,e){const t=s.getParameter(s.MAX_VERTEX_ATTRIBS),n={},i=d(null);let r=i,o=!1;function a(M,F,V,G,q){let ae=!1;const Q=h(G,V,F);r!==Q&&(r=Q,c(r.object)),ae=f(M,G,V,q),ae&&g(M,G,V,q),q!==null&&e.update(q,s.ELEMENT_ARRAY_BUFFER),(ae||o)&&(o=!1,x(M,F,V,G),q!==null&&s.bindBuffer(s.ELEMENT_ARRAY_BUFFER,e.get(q).buffer))}function l(){return s.createVertexArray()}function c(M){return s.bindVertexArray(M)}function u(M){return s.deleteVertexArray(M)}function h(M,F,V){const G=V.wireframe===!0;let q=n[M.id];q===void 0&&(q={},n[M.id]=q);let ae=q[F.id];ae===void 0&&(ae={},q[F.id]=ae);let Q=ae[G];return Q===void 0&&(Q=d(l()),ae[G]=Q),Q}function d(M){const F=[],V=[],G=[];for(let q=0;q=0){const be=q[B];let Ae=ae[B];if(Ae===void 0&&(B==="instanceMatrix"&&M.instanceMatrix&&(Ae=M.instanceMatrix),B==="instanceColor"&&M.instanceColor&&(Ae=M.instanceColor)),be===void 0||be.attribute!==Ae||Ae&&be.data!==Ae.data)return!0;Q++}return r.attributesNum!==Q||r.index!==G}function g(M,F,V,G){const q={},ae=F.attributes;let Q=0;const oe=V.getAttributes();for(const B in oe)if(oe[B].location>=0){let be=ae[B];be===void 0&&(B==="instanceMatrix"&&M.instanceMatrix&&(be=M.instanceMatrix),B==="instanceColor"&&M.instanceColor&&(be=M.instanceColor));const Ae={};Ae.attribute=be,be&&be.data&&(Ae.data=be.data),q[B]=Ae,Q++}r.attributes=q,r.attributesNum=Q,r.index=G}function v(){const M=r.newAttributes;for(let F=0,V=M.length;F=0){let Me=q[oe];if(Me===void 0&&(oe==="instanceMatrix"&&M.instanceMatrix&&(Me=M.instanceMatrix),oe==="instanceColor"&&M.instanceColor&&(Me=M.instanceColor)),Me!==void 0){const be=Me.normalized,Ae=Me.itemSize,ge=e.get(Me);if(ge===void 0)continue;const ze=ge.buffer,U=ge.type,D=ge.bytesPerElement,R=U===s.INT||U===s.UNSIGNED_INT||Me.gpuType===eu;if(Me.isInterleavedBufferAttribute){const T=Me.data,ie=T.stride,he=Me.offset;if(T.isInstancedInterleavedBuffer){for(let J=0;J0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision>0)return"highp";b="mediump"}return b==="mediump"&&s.getShaderPrecisionFormat(s.VERTEX_SHADER,s.MEDIUM_FLOAT).precision>0&&s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.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 h=t.logarithmicDepthBuffer===!0,d=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),f=s.getParameter(s.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=s.getParameter(s.MAX_TEXTURE_SIZE),v=s.getParameter(s.MAX_CUBE_MAP_TEXTURE_SIZE),m=s.getParameter(s.MAX_VERTEX_ATTRIBS),p=s.getParameter(s.MAX_VERTEX_UNIFORM_VECTORS),y=s.getParameter(s.MAX_VARYING_VECTORS),_=s.getParameter(s.MAX_FRAGMENT_UNIFORM_VECTORS),x=f>0,A=s.getParameter(s.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:r,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:h,maxTextures:d,maxVertexTextures:f,maxTextureSize:g,maxCubemapSize:v,maxAttributes:m,maxVertexUniforms:p,maxVaryings:y,maxFragmentUniforms:_,vertexTextures:x,maxSamples:A}}function _y(s){const e=this;let t=null,n=0,i=!1,r=!1;const o=new wi,a=new Ze,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d){const f=h.length!==0||d||n!==0||i;return i=d,n=h.length,f},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(h,d){t=u(h,d,0)},this.setState=function(h,d,f){const g=h.clippingPlanes,v=h.clipIntersection,m=h.clipShadows,p=s.get(h);if(!i||g===null||g.length===0||r&&!m)r?u(null):c();else{const y=r?0:n,_=y*4;let x=p.clippingState||null;l.value=x,x=u(g,d,_,f);for(let A=0;A!==_;++A)x[A]=t[A];p.clippingState=x,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=y}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,d,f,g){const v=h!==null?h.length:0;let m=null;if(v!==0){if(m=l.value,g!==!0||m===null){const p=f+v*4,y=d.matrixWorldInverse;a.getNormalMatrix(y),(m===null||m.length0){const c=new dp(l.height);return c.fromEquirectangularTexture(s,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function r(){e=new WeakMap}return{get:n,dispose:r}}class Na extends Xr{constructor(e=-1,t=1,n=1,i=-1,r=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,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,n,i,r,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=n,this.view.offsetY=i,this.view.width=r,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),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,o=n+e,a=i+t,l=i-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;r+=c*this.view.offsetX,o=r+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(r,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 Os=4,Mh=[.125,.215,.35,.446,.526,.582],Zi=20,El=new Na,bh=new Pe;let Cl=null,Pl=0,Rl=0,Il=!1;const Yi=(1+Math.sqrt(5))/2,Es=1/Yi,Sh=[new N(-Yi,Es,0),new N(Yi,Es,0),new N(-Es,0,Yi),new N(Es,0,Yi),new N(0,Yi,-Es),new N(0,Yi,Es),new N(-1,1,-1),new N(1,1,-1),new N(-1,1,1),new N(1,1,1)];class Ic{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,n=.1,i=100){Cl=this._renderer.getRenderTarget(),Pl=this._renderer.getActiveCubeFace(),Rl=this._renderer.getActiveMipmapLevel(),Il=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Th(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Ah(),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?_:0,_,_),u.setRenderTarget(i),v&&u.render(g,a),u.render(e,a)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=d,u.autoClear=h,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===ai||e.mapping===Ci;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=Th()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Ah());const r=i?this._cubemapMaterial:this._equirectMaterial,o=new Nt(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;const l=this._cubeSize;Eo(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,El)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let r=1;rZi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${Zi}`);const p=[];let y=0;for(let E=0;E_-Os?i-_+Os:0),b=4*(this._cubeSize-x);Eo(t,A,b,3*x,2*x),l.setRenderTarget(t),l.render(h,El)}}function xy(s){const e=[],t=[],n=[];let i=s;const r=s-Os+1+Mh.length;for(let o=0;os-Os?l=Mh[o-s+Os-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],f=6,g=6,v=3,m=2,p=1,y=new Float32Array(v*g*f),_=new Float32Array(m*g*f),x=new Float32Array(p*g*f);for(let b=0;b2?0:-1,w=[E,I,0,E+2/3,I,0,E+2/3,I+1,0,E,I,0,E+2/3,I+1,0,E,I+1,0];y.set(w,v*g*b),_.set(d,m*g*b);const M=[b,b,b,b,b,b];x.set(M,p*g*b)}const A=new it;A.setAttribute("position",new pt(y,v)),A.setAttribute("uv",new pt(_,m)),A.setAttribute("faceIndex",new pt(x,p)),e.push(A),i>Os&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function wh(s,e,t){const n=new In(s,e,t);return n.texture.mapping=Ws,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Eo(s,e,t,n,i){s.viewport.set(e,t,n,i),s.scissor.set(e,t,n,i)}function My(s,e,t){const n=new Float32Array(Zi),i=new N(0,1,0);return new Ln({name:"SphericalGaussianBlur",defines:{n:Zi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${s}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:pu(),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:si,depthTest:!1,depthWrite:!1})}function Ah(){return new Ln({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:pu(),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:si,depthTest:!1,depthWrite:!1})}function Th(){return new Ln({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:pu(),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:si,depthTest:!1,depthWrite:!1})}function pu(){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 by(s){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){const l=a.mapping,c=l===yr||l===xr,u=l===ai||l===Ci;if(c||u){let h=e.get(a);const d=h!==void 0?h.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==d)return t===null&&(t=new Ic(s)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),h.texture.pmremVersion=a.pmremVersion,e.set(a,h),h.texture;if(h!==void 0)return h.texture;{const f=a.image;return c&&f&&f.height>0||u&&f&&i(f)?(t===null&&(t=new Ic(s)),h=c?t.fromEquirectangular(a):t.fromCubemap(a),h.texture.pmremVersion=a.pmremVersion,e.set(a,h),a.addEventListener("dispose",r),h.texture):null}}}return a}function i(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(A=Math.ceil(x/e.maxTextureSize),x=e.maxTextureSize);const b=new Float32Array(x*A*4*h),E=new Ia(b,x,A,h);E.type=gn,E.needsUpdate=!0;const I=_*4;for(let M=0;M0)return s;const i=e*t;let r=Eh[i];if(r===void 0&&(r=new Float32Array(i),Eh[i]=r),e!==0){n.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,s[o].toArray(r,a)}return r}function Ft(s,e){if(s.length!==e.length)return!1;for(let t=0,n=s.length;t":" "} ${a}: ${t[o]}`)}return n.join(` `)}function bx(s){const e=ht.getPrimaries(ht.workingColorSpace),t=ht.getPrimaries(s);let n;switch(e===t?n="":e===Cr&&t===Er?n="LinearDisplayP3ToLinearSRGB":e===Er&&t===Cr&&(n="LinearSRGBToLinearDisplayP3"),s){case ci:case $r:return[n,"LinearTransferOETF"];case ln:case Ra:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",s),[n,"LinearTransferOETF"]}}function Dh(s,e,t){const n=s.getShaderParameter(e,s.COMPILE_STATUS),i=s.getShaderInfoLog(e).trim();if(n&&i==="")return"";const r=/ERROR: 0:(\d+)/.exec(i);if(r){const o=parseInt(r[1]);return t.toUpperCase()+` `+i+` `+Mx(s.getShaderSource(e),o)}else return i}function Sx(s,e){const t=bx(e);return`vec4 ${s}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function wx(s,e){let t;switch(e){case Ef:t="Linear";break;case Cf:t="Reinhard";break;case Pf:t="OptimizedCineon";break;case Ea:t="ACESFilmic";break;case If:t="AgX";break;case Lf:t="Neutral";break;case Rf:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+s+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Ax(s){return[s.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",s.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(ur).join(` `)}function Tx(s){const e=[];for(const t in s){const n=s[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` `)}function Ex(s,e){const t={},n=s.getProgramParameter(e,s.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function Lc(s){return s.replace(Cx,Rx)}const Px=new Map;function Rx(s,e){let t=nt[e];if(t===void 0){const n=Px.get(e);if(n!==void 0)t=nt[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return Lc(t)}const Ix=/#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 Fh(s){return s.replace(Ix,Lx)}function Lx(s,e,t,n){let i="";for(let r=parseInt(e);r0&&(m+=` `),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,g].filter(ur).join(` `),p.length>0&&(p+=` `)):(m=[kh(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(ur).join(` `),p=[kh(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 "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.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!==Hn?"#define TONE_MAPPING":"",t.toneMapping!==Hn?nt.tonemapping_pars_fragment:"",t.toneMapping!==Hn?wx("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",nt.colorspace_pars_fragment,Sx("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(ur).join(` `)),o=Lc(o),o=Uh(o,t),o=Oh(o,t),a=Lc(a),a=Uh(a,t),a=Oh(a,t),o=Fh(o),a=Fh(a),t.isRawShaderMaterial!==!0&&(y=`#version 300 es `,m=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+m,p=["#define varying in",t.glslVersion===Rc?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Rc?"":"#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(` `)+` `+p);const _=y+m+o,x=y+p+a,A=Nh(i,i.VERTEX_SHADER,_),b=Nh(i,i.FRAGMENT_SHADER,x);i.attachShader(v,A),i.attachShader(v,b),t.index0AttributeName!==void 0?i.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(v,0,"position"),i.linkProgram(v);function E(F){if(s.debug.checkShaderErrors){const V=i.getProgramInfoLog(v).trim(),G=i.getShaderInfoLog(A).trim(),q=i.getShaderInfoLog(b).trim();let ae=!0,Q=!0;if(i.getProgramParameter(v,i.LINK_STATUS)===!1)if(ae=!1,typeof s.debug.onShaderError=="function")s.debug.onShaderError(i,v,A,b);else{const oe=Dh(i,A,"vertex"),B=Dh(i,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(v,i.VALIDATE_STATUS)+` Material Name: `+F.name+` Material Type: `+F.type+` Program Info Log: `+V+` `+oe+` `+B)}else V!==""?console.warn("THREE.WebGLProgram: Program Info Log:",V):(G===""||q==="")&&(Q=!1);Q&&(F.diagnostics={runnable:ae,programLog:V,vertexShader:{log:G,prefix:m},fragmentShader:{log:q,prefix:p}})}i.deleteShader(A),i.deleteShader(b),I=new ua(i,v),w=Ex(i,v)}let I;this.getUniforms=function(){return I===void 0&&E(this),I};let w;this.getAttributes=function(){return w===void 0&&E(this),w};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=i.getProgramParameter(v,yx)),M},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=xx++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=A,this.fragmentShader=b,this}let Bx=0;class zx{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.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 n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Vx(e),t.set(e,n)),n}}class Vx{constructor(e){this.id=Bx++,this.code=e,this.usedTimes=0}}function Hx(s,e,t,n,i,r,o){const a=new La,l=new zx,c=new Set,u=[],h=i.logarithmicDepthBuffer,d=i.vertexTextures;let f=i.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 v(w){return c.add(w),w===0?"uv":`uv${w}`}function m(w,M,F,V,G){const q=V.fog,ae=G.geometry,Q=w.isMeshStandardMaterial?V.environment:null,oe=(w.isMeshStandardMaterial?t:e).get(w.envMap||Q),B=oe&&oe.mapping===Ws?oe.image.height:null,Me=g[w.type];w.precision!==null&&(f=i.getMaxPrecision(w.precision),f!==w.precision&&console.warn("THREE.WebGLProgram.getParameters:",w.precision,"not supported, using",f,"instead."));const be=ae.morphAttributes.position||ae.morphAttributes.normal||ae.morphAttributes.color,Ae=be!==void 0?be.length:0;let ge=0;ae.morphAttributes.position!==void 0&&(ge=1),ae.morphAttributes.normal!==void 0&&(ge=2),ae.morphAttributes.color!==void 0&&(ge=3);let ze,U,D,R;if(Me){const vt=Tn[Me];ze=vt.vertexShader,U=vt.fragmentShader}else ze=w.vertexShader,U=w.fragmentShader,l.update(w),D=l.getVertexShaderID(w),R=l.getFragmentShaderID(w);const T=s.getRenderTarget(),ie=G.isInstancedMesh===!0,he=G.isBatchedMesh===!0,J=!!w.map,L=!!w.matcap,X=!!oe,K=!!w.aoMap,H=!!w.lightMap,$=!!w.bumpMap,te=!!w.normalMap,le=!!w.displacementMap,k=!!w.emissiveMap,O=!!w.metalnessMap,P=!!w.roughnessMap,S=w.anisotropy>0,ee=w.clearcoat>0,pe=w.dispersion>0,ce=w.iridescence>0,ve=w.sheen>0,Ve=w.transmission>0,Ee=S&&!!w.anisotropyMap,Te=ee&&!!w.clearcoatMap,Qe=ee&&!!w.clearcoatNormalMap,xe=ee&&!!w.clearcoatRoughnessMap,Ue=ce&&!!w.iridescenceMap,st=ce&&!!w.iridescenceThicknessMap,Je=ve&&!!w.sheenColorMap,Re=ve&&!!w.sheenRoughnessMap,rt=!!w.specularMap,at=!!w.specularColorMap,Rt=!!w.specularIntensityMap,z=Ve&&!!w.transmissionMap,Ie=Ve&&!!w.thicknessMap,de=!!w.gradientMap,_e=!!w.alphaMap,we=w.alphaTest>0,et=!!w.alphaHash,ut=!!w.extensions;let It=Hn;w.toneMapped&&(T===null||T.isXRRenderTarget===!0)&&(It=s.toneMapping);const Bt={shaderID:Me,shaderType:w.type,shaderName:w.name,vertexShader:ze,fragmentShader:U,defines:w.defines,customVertexShaderID:D,customFragmentShaderID:R,isRawShaderMaterial:w.isRawShaderMaterial===!0,glslVersion:w.glslVersion,precision:f,batching:he,batchingColor:he&&G._colorsTexture!==null,instancing:ie,instancingColor:ie&&G.instanceColor!==null,instancingMorph:ie&&G.morphTexture!==null,supportsVertexTextures:d,outputColorSpace:T===null?s.outputColorSpace:T.isXRRenderTarget===!0?T.texture.colorSpace:ci,alphaToCoverage:!!w.alphaToCoverage,map:J,matcap:L,envMap:X,envMapMode:X&&oe.mapping,envMapCubeUVHeight:B,aoMap:K,lightMap:H,bumpMap:$,normalMap:te,displacementMap:d&&le,emissiveMap:k,normalMapObjectSpace:te&&w.normalMapType===Yf,normalMapTangentSpace:te&&w.normalMapType===Ii,metalnessMap:O,roughnessMap:P,anisotropy:S,anisotropyMap:Ee,clearcoat:ee,clearcoatMap:Te,clearcoatNormalMap:Qe,clearcoatRoughnessMap:xe,dispersion:pe,iridescence:ce,iridescenceMap:Ue,iridescenceThicknessMap:st,sheen:ve,sheenColorMap:Je,sheenRoughnessMap:Re,specularMap:rt,specularColorMap:at,specularIntensityMap:Rt,transmission:Ve,transmissionMap:z,thicknessMap:Ie,gradientMap:de,opaque:w.transparent===!1&&w.blending===es&&w.alphaToCoverage===!1,alphaMap:_e,alphaTest:we,alphaHash:et,combine:w.combine,mapUv:J&&v(w.map.channel),aoMapUv:K&&v(w.aoMap.channel),lightMapUv:H&&v(w.lightMap.channel),bumpMapUv:$&&v(w.bumpMap.channel),normalMapUv:te&&v(w.normalMap.channel),displacementMapUv:le&&v(w.displacementMap.channel),emissiveMapUv:k&&v(w.emissiveMap.channel),metalnessMapUv:O&&v(w.metalnessMap.channel),roughnessMapUv:P&&v(w.roughnessMap.channel),anisotropyMapUv:Ee&&v(w.anisotropyMap.channel),clearcoatMapUv:Te&&v(w.clearcoatMap.channel),clearcoatNormalMapUv:Qe&&v(w.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:xe&&v(w.clearcoatRoughnessMap.channel),iridescenceMapUv:Ue&&v(w.iridescenceMap.channel),iridescenceThicknessMapUv:st&&v(w.iridescenceThicknessMap.channel),sheenColorMapUv:Je&&v(w.sheenColorMap.channel),sheenRoughnessMapUv:Re&&v(w.sheenRoughnessMap.channel),specularMapUv:rt&&v(w.specularMap.channel),specularColorMapUv:at&&v(w.specularColorMap.channel),specularIntensityMapUv:Rt&&v(w.specularIntensityMap.channel),transmissionMapUv:z&&v(w.transmissionMap.channel),thicknessMapUv:Ie&&v(w.thicknessMap.channel),alphaMapUv:_e&&v(w.alphaMap.channel),vertexTangents:!!ae.attributes.tangent&&(te||S),vertexColors:w.vertexColors,vertexAlphas:w.vertexColors===!0&&!!ae.attributes.color&&ae.attributes.color.itemSize===4,pointsUvs:G.isPoints===!0&&!!ae.attributes.uv&&(J||_e),fog:!!q,useFog:w.fog===!0,fogExp2:!!q&&q.isFogExp2,flatShading:w.flatShading===!0,sizeAttenuation:w.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:G.isSkinnedMesh===!0,morphTargets:ae.morphAttributes.position!==void 0,morphNormals:ae.morphAttributes.normal!==void 0,morphColors:ae.morphAttributes.color!==void 0,morphTargetsCount:Ae,morphTextureStride:ge,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:w.dithering,shadowMapEnabled:s.shadowMap.enabled&&F.length>0,shadowMapType:s.shadowMap.type,toneMapping:It,decodeVideoTexture:J&&w.map.isVideoTexture===!0&&ht.getTransfer(w.map.colorSpace)===Mt,premultipliedAlpha:w.premultipliedAlpha,doubleSided:w.side===En,flipSided:w.side===nn,useDepthPacking:w.depthPacking>=0,depthPacking:w.depthPacking||0,index0AttributeName:w.index0AttributeName,extensionClipCullDistance:ut&&w.extensions.clipCullDistance===!0&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:ut&&w.extensions.multiDraw===!0&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:w.customProgramCacheKey()};return Bt.vertexUv1s=c.has(1),Bt.vertexUv2s=c.has(2),Bt.vertexUv3s=c.has(3),c.clear(),Bt}function p(w){const M=[];if(w.shaderID?M.push(w.shaderID):(M.push(w.customVertexShaderID),M.push(w.customFragmentShaderID)),w.defines!==void 0)for(const F in w.defines)M.push(F),M.push(w.defines[F]);return w.isRawShaderMaterial===!1&&(y(M,w),_(M,w),M.push(s.outputColorSpace)),M.push(w.customProgramCacheKey),M.join()}function y(w,M){w.push(M.precision),w.push(M.outputColorSpace),w.push(M.envMapMode),w.push(M.envMapCubeUVHeight),w.push(M.mapUv),w.push(M.alphaMapUv),w.push(M.lightMapUv),w.push(M.aoMapUv),w.push(M.bumpMapUv),w.push(M.normalMapUv),w.push(M.displacementMapUv),w.push(M.emissiveMapUv),w.push(M.metalnessMapUv),w.push(M.roughnessMapUv),w.push(M.anisotropyMapUv),w.push(M.clearcoatMapUv),w.push(M.clearcoatNormalMapUv),w.push(M.clearcoatRoughnessMapUv),w.push(M.iridescenceMapUv),w.push(M.iridescenceThicknessMapUv),w.push(M.sheenColorMapUv),w.push(M.sheenRoughnessMapUv),w.push(M.specularMapUv),w.push(M.specularColorMapUv),w.push(M.specularIntensityMapUv),w.push(M.transmissionMapUv),w.push(M.thicknessMapUv),w.push(M.combine),w.push(M.fogExp2),w.push(M.sizeAttenuation),w.push(M.morphTargetsCount),w.push(M.morphAttributeCount),w.push(M.numDirLights),w.push(M.numPointLights),w.push(M.numSpotLights),w.push(M.numSpotLightMaps),w.push(M.numHemiLights),w.push(M.numRectAreaLights),w.push(M.numDirLightShadows),w.push(M.numPointLightShadows),w.push(M.numSpotLightShadows),w.push(M.numSpotLightShadowsWithMaps),w.push(M.numLightProbes),w.push(M.shadowMapType),w.push(M.toneMapping),w.push(M.numClippingPlanes),w.push(M.numClipIntersection),w.push(M.depthPacking)}function _(w,M){a.disableAll(),M.supportsVertexTextures&&a.enable(0),M.instancing&&a.enable(1),M.instancingColor&&a.enable(2),M.instancingMorph&&a.enable(3),M.matcap&&a.enable(4),M.envMap&&a.enable(5),M.normalMapObjectSpace&&a.enable(6),M.normalMapTangentSpace&&a.enable(7),M.clearcoat&&a.enable(8),M.iridescence&&a.enable(9),M.alphaTest&&a.enable(10),M.vertexColors&&a.enable(11),M.vertexAlphas&&a.enable(12),M.vertexUv1s&&a.enable(13),M.vertexUv2s&&a.enable(14),M.vertexUv3s&&a.enable(15),M.vertexTangents&&a.enable(16),M.anisotropy&&a.enable(17),M.alphaHash&&a.enable(18),M.batching&&a.enable(19),M.dispersion&&a.enable(20),M.batchingColor&&a.enable(21),w.push(a.mask),a.disableAll(),M.fog&&a.enable(0),M.useFog&&a.enable(1),M.flatShading&&a.enable(2),M.logarithmicDepthBuffer&&a.enable(3),M.skinning&&a.enable(4),M.morphTargets&&a.enable(5),M.morphNormals&&a.enable(6),M.morphColors&&a.enable(7),M.premultipliedAlpha&&a.enable(8),M.shadowMapEnabled&&a.enable(9),M.doubleSided&&a.enable(10),M.flipSided&&a.enable(11),M.useDepthPacking&&a.enable(12),M.dithering&&a.enable(13),M.transmission&&a.enable(14),M.sheen&&a.enable(15),M.opaque&&a.enable(16),M.pointsUvs&&a.enable(17),M.decodeVideoTexture&&a.enable(18),M.alphaToCoverage&&a.enable(19),w.push(a.mask)}function x(w){const M=g[w.type];let F;if(M){const V=Tn[M];F=up.clone(V.uniforms)}else F=w.uniforms;return F}function A(w,M){let F;for(let V=0,G=u.length;V0?n.push(p):f.transparent===!0?i.push(p):t.push(p)}function l(h,d,f,g,v,m){const p=o(h,d,f,g,v,m);f.transmission>0?n.unshift(p):f.transparent===!0?i.unshift(p):t.unshift(p)}function c(h,d){t.length>1&&t.sort(h||Wx),n.length>1&&n.sort(d||Bh),i.length>1&&i.sort(d||Bh)}function u(){for(let h=e,d=s.length;h=r.length?(o=new zh,r.push(o)):o=r[i],o}function t(){s=new WeakMap}return{get:e,dispose:t}}function Xx(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new N,color:new Pe};break;case"SpotLight":t={position:new N,direction:new N,color:new Pe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new N,color:new Pe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new N,skyColor:new Pe,groundColor:new Pe};break;case"RectAreaLight":t={color:new Pe,position:new N,halfWidth:new N,halfHeight:new N};break}return s[e.id]=t,t}}}function qx(){const s={};return{get:function(e){if(s[e.id]!==void 0)return s[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new se};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new se};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new se,shadowCameraNear:1,shadowCameraFar:1e3};break}return s[e.id]=t,t}}}let Yx=0;function Zx(s,e){return(e.castShadow?2:0)-(s.castShadow?2:0)+(e.map?1:0)-(s.map?1:0)}function Jx(s){const e=new Xx,t=qx(),n={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++)n.probe.push(new N);const i=new N,r=new qe,o=new qe;function a(c){let u=0,h=0,d=0;for(let w=0;w<9;w++)n.probe[w].set(0,0,0);let f=0,g=0,v=0,m=0,p=0,y=0,_=0,x=0,A=0,b=0,E=0;c.sort(Zx);for(let w=0,M=c.length;w0&&(s.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=Ce.LTC_FLOAT_1,n.rectAreaLTC2=Ce.LTC_FLOAT_2):(n.rectAreaLTC1=Ce.LTC_HALF_1,n.rectAreaLTC2=Ce.LTC_HALF_2)),n.ambient[0]=u,n.ambient[1]=h,n.ambient[2]=d;const I=n.hash;(I.directionalLength!==f||I.pointLength!==g||I.spotLength!==v||I.rectAreaLength!==m||I.hemiLength!==p||I.numDirectionalShadows!==y||I.numPointShadows!==_||I.numSpotShadows!==x||I.numSpotMaps!==A||I.numLightProbes!==E)&&(n.directional.length=f,n.spot.length=v,n.rectArea.length=m,n.point.length=g,n.hemi.length=p,n.directionalShadow.length=y,n.directionalShadowMap.length=y,n.pointShadow.length=_,n.pointShadowMap.length=_,n.spotShadow.length=x,n.spotShadowMap.length=x,n.directionalShadowMatrix.length=y,n.pointShadowMatrix.length=_,n.spotLightMatrix.length=x+A-b,n.spotLightMap.length=A,n.numSpotLightShadowsWithMaps=b,n.numLightProbes=E,I.directionalLength=f,I.pointLength=g,I.spotLength=v,I.rectAreaLength=m,I.hemiLength=p,I.numDirectionalShadows=y,I.numPointShadows=_,I.numSpotShadows=x,I.numSpotMaps=A,I.numLightProbes=E,n.version=Yx++)}function l(c,u){let h=0,d=0,f=0,g=0,v=0;const m=u.matrixWorldInverse;for(let p=0,y=c.length;p=o.length?(a=new Vh(s),o.push(a)):a=o[r],a}function n(){e=new WeakMap}return{get:t,dispose:n}}class gu extends Kt{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Xf,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 vu extends Kt{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 jx=`void main() { gl_Position = vec4( position, 1.0 ); }`,Qx=`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 eM(s,e,t){let n=new Yr;const i=new se,r=new se,o=new gt,a=new gu({depthPacking:qf}),l=new vu,c={},u=t.maxTextureSize,h={[oi]:nn,[nn]:oi,[En]:En},d=new Ln({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new se},radius:{value:4}},vertexShader:jx,fragmentShader:Qx}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const g=new it;g.setAttribute("position",new pt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Nt(g,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Kc;let p=this.type;this.render=function(b,E,I){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||b.length===0)return;const w=s.getRenderTarget(),M=s.getActiveCubeFace(),F=s.getActiveMipmapLevel(),V=s.state;V.setBlending(si),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);const G=p!==kn&&this.type===kn,q=p===kn&&this.type!==kn;for(let ae=0,Q=b.length;aeu||i.y>u)&&(i.x>u&&(r.x=Math.floor(u/Me.x),i.x=r.x*Me.x,B.mapSize.x=r.x),i.y>u&&(r.y=Math.floor(u/Me.y),i.y=r.y*Me.y,B.mapSize.y=r.y)),B.map===null||G===!0||q===!0){const Ae=this.type!==kn?{minFilter:Gt,magFilter:Gt}:{};B.map!==null&&B.map.dispose(),B.map=new In(i.x,i.y,Ae),B.map.texture.name=oe.name+".shadowMap",B.camera.updateProjectionMatrix()}s.setRenderTarget(B.map),s.clear();const be=B.getViewportCount();for(let Ae=0;Ae0||E.map&&E.alphaTest>0){const V=M.uuid,G=E.uuid;let q=c[V];q===void 0&&(q={},c[V]=q);let ae=q[G];ae===void 0&&(ae=M.clone(),q[G]=ae,E.addEventListener("dispose",A)),M=ae}if(M.visible=E.visible,M.wireframe=E.wireframe,w===kn?M.side=E.shadowSide!==null?E.shadowSide:E.side:M.side=E.shadowSide!==null?E.shadowSide:h[E.side],M.alphaMap=E.alphaMap,M.alphaTest=E.alphaTest,M.map=E.map,M.clipShadows=E.clipShadows,M.clippingPlanes=E.clippingPlanes,M.clipIntersection=E.clipIntersection,M.displacementMap=E.displacementMap,M.displacementScale=E.displacementScale,M.displacementBias=E.displacementBias,M.wireframeLinewidth=E.wireframeLinewidth,M.linewidth=E.linewidth,I.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const V=s.properties.get(M);V.light=I}return M}function x(b,E,I,w,M){if(b.visible===!1)return;if(b.layers.test(E.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&M===kn)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,b.matrixWorld);const G=e.update(b),q=b.material;if(Array.isArray(q)){const ae=G.groups;for(let Q=0,oe=ae.length;Q=1):oe.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(oe)[1]),ae=Q>=2);let B=null,Me={};const be=s.getParameter(s.SCISSOR_BOX),Ae=s.getParameter(s.VIEWPORT),ge=new gt().fromArray(be),ze=new gt().fromArray(Ae);function U(z,Ie,de,_e){const we=new Uint8Array(4),et=s.createTexture();s.bindTexture(z,et),s.texParameteri(z,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(z,s.TEXTURE_MAG_FILTER,s.NEAREST);for(let ut=0;ut"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new se,u=new WeakMap;let h;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(P,S){return f?new OffscreenCanvas(P,S):Ir("canvas")}function v(P,S,ee){let pe=1;const ce=O(P);if((ce.width>ee||ce.height>ee)&&(pe=ee/Math.max(ce.width,ce.height)),pe<1)if(typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&P instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&P instanceof ImageBitmap||typeof VideoFrame<"u"&&P instanceof VideoFrame){const ve=Math.floor(pe*ce.width),Ve=Math.floor(pe*ce.height);h===void 0&&(h=g(ve,Ve));const Ee=S?g(ve,Ve):h;return Ee.width=ve,Ee.height=Ve,Ee.getContext("2d").drawImage(P,0,0,ve,Ve),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ce.width+"x"+ce.height+") to ("+ve+"x"+Ve+")."),Ee}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ce.width+"x"+ce.height+")."),P;return P}function m(P){return P.generateMipmaps&&P.minFilter!==Gt&&P.minFilter!==Ot}function p(P){s.generateMipmap(P)}function y(P,S,ee,pe,ce=!1){if(P!==null){if(s[P]!==void 0)return s[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let ve=S;if(S===s.RED&&(ee===s.FLOAT&&(ve=s.R32F),ee===s.HALF_FLOAT&&(ve=s.R16F),ee===s.UNSIGNED_BYTE&&(ve=s.R8)),S===s.RED_INTEGER&&(ee===s.UNSIGNED_BYTE&&(ve=s.R8UI),ee===s.UNSIGNED_SHORT&&(ve=s.R16UI),ee===s.UNSIGNED_INT&&(ve=s.R32UI),ee===s.BYTE&&(ve=s.R8I),ee===s.SHORT&&(ve=s.R16I),ee===s.INT&&(ve=s.R32I)),S===s.RG&&(ee===s.FLOAT&&(ve=s.RG32F),ee===s.HALF_FLOAT&&(ve=s.RG16F),ee===s.UNSIGNED_BYTE&&(ve=s.RG8)),S===s.RG_INTEGER&&(ee===s.UNSIGNED_BYTE&&(ve=s.RG8UI),ee===s.UNSIGNED_SHORT&&(ve=s.RG16UI),ee===s.UNSIGNED_INT&&(ve=s.RG32UI),ee===s.BYTE&&(ve=s.RG8I),ee===s.SHORT&&(ve=s.RG16I),ee===s.INT&&(ve=s.RG32I)),S===s.RGB&&ee===s.UNSIGNED_INT_5_9_9_9_REV&&(ve=s.RGB9_E5),S===s.RGBA){const Ve=ce?Tr:ht.getTransfer(pe);ee===s.FLOAT&&(ve=s.RGBA32F),ee===s.HALF_FLOAT&&(ve=s.RGBA16F),ee===s.UNSIGNED_BYTE&&(ve=Ve===Mt?s.SRGB8_ALPHA8:s.RGBA8),ee===s.UNSIGNED_SHORT_4_4_4_4&&(ve=s.RGBA4),ee===s.UNSIGNED_SHORT_5_5_5_1&&(ve=s.RGB5_A1)}return(ve===s.R16F||ve===s.R32F||ve===s.RG16F||ve===s.RG32F||ve===s.RGBA16F||ve===s.RGBA32F)&&e.get("EXT_color_buffer_float"),ve}function _(P,S){let ee;return P?S===null||S===ss||S===rs?ee=s.DEPTH24_STENCIL8:S===gn?ee=s.DEPTH32F_STENCIL8:S===Sr&&(ee=s.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):S===null||S===ss||S===rs?ee=s.DEPTH_COMPONENT24:S===gn?ee=s.DEPTH_COMPONENT32F:S===Sr&&(ee=s.DEPTH_COMPONENT16),ee}function x(P,S){return m(P)===!0||P.isFramebufferTexture&&P.minFilter!==Gt&&P.minFilter!==Ot?Math.log2(Math.max(S.width,S.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?S.mipmaps.length:1}function A(P){const S=P.target;S.removeEventListener("dispose",A),E(S),S.isVideoTexture&&u.delete(S)}function b(P){const S=P.target;S.removeEventListener("dispose",b),w(S)}function E(P){const S=n.get(P);if(S.__webglInit===void 0)return;const ee=P.source,pe=d.get(ee);if(pe){const ce=pe[S.__cacheKey];ce.usedTimes--,ce.usedTimes===0&&I(P),Object.keys(pe).length===0&&d.delete(ee)}n.remove(P)}function I(P){const S=n.get(P);s.deleteTexture(S.__webglTexture);const ee=P.source,pe=d.get(ee);delete pe[S.__cacheKey],o.memory.textures--}function w(P){const S=n.get(P);if(P.depthTexture&&P.depthTexture.dispose(),P.isWebGLCubeRenderTarget)for(let pe=0;pe<6;pe++){if(Array.isArray(S.__webglFramebuffer[pe]))for(let ce=0;ce=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+i.maxTextures),M+=1,P}function G(P){const S=[];return S.push(P.wrapS),S.push(P.wrapT),S.push(P.wrapR||0),S.push(P.magFilter),S.push(P.minFilter),S.push(P.anisotropy),S.push(P.internalFormat),S.push(P.format),S.push(P.type),S.push(P.generateMipmaps),S.push(P.premultiplyAlpha),S.push(P.flipY),S.push(P.unpackAlignment),S.push(P.colorSpace),S.join()}function q(P,S){const ee=n.get(P);if(P.isVideoTexture&&le(P),P.isRenderTargetTexture===!1&&P.version>0&&ee.__version!==P.version){const pe=P.image;if(pe===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(pe.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ze(ee,P,S);return}}t.bindTexture(s.TEXTURE_2D,ee.__webglTexture,s.TEXTURE0+S)}function ae(P,S){const ee=n.get(P);if(P.version>0&&ee.__version!==P.version){ze(ee,P,S);return}t.bindTexture(s.TEXTURE_2D_ARRAY,ee.__webglTexture,s.TEXTURE0+S)}function Q(P,S){const ee=n.get(P);if(P.version>0&&ee.__version!==P.version){ze(ee,P,S);return}t.bindTexture(s.TEXTURE_3D,ee.__webglTexture,s.TEXTURE0+S)}function oe(P,S){const ee=n.get(P);if(P.version>0&&ee.__version!==P.version){U(ee,P,S);return}t.bindTexture(s.TEXTURE_CUBE_MAP,ee.__webglTexture,s.TEXTURE0+S)}const B={[Mr]:s.REPEAT,[Mn]:s.CLAMP_TO_EDGE,[br]:s.MIRRORED_REPEAT},Me={[Gt]:s.NEAREST,[Qc]:s.NEAREST_MIPMAP_NEAREST,[Ds]:s.NEAREST_MIPMAP_LINEAR,[Ot]:s.LINEAR,[hr]:s.LINEAR_MIPMAP_NEAREST,[zn]:s.LINEAR_MIPMAP_LINEAR},be={[Jf]:s.NEVER,[np]:s.ALWAYS,[Kf]:s.LESS,[lu]:s.LEQUAL,[jf]:s.EQUAL,[tp]:s.GEQUAL,[Qf]:s.GREATER,[ep]:s.NOTEQUAL};function Ae(P,S){if(S.type===gn&&e.has("OES_texture_float_linear")===!1&&(S.magFilter===Ot||S.magFilter===hr||S.magFilter===Ds||S.magFilter===zn||S.minFilter===Ot||S.minFilter===hr||S.minFilter===Ds||S.minFilter===zn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),s.texParameteri(P,s.TEXTURE_WRAP_S,B[S.wrapS]),s.texParameteri(P,s.TEXTURE_WRAP_T,B[S.wrapT]),(P===s.TEXTURE_3D||P===s.TEXTURE_2D_ARRAY)&&s.texParameteri(P,s.TEXTURE_WRAP_R,B[S.wrapR]),s.texParameteri(P,s.TEXTURE_MAG_FILTER,Me[S.magFilter]),s.texParameteri(P,s.TEXTURE_MIN_FILTER,Me[S.minFilter]),S.compareFunction&&(s.texParameteri(P,s.TEXTURE_COMPARE_MODE,s.COMPARE_REF_TO_TEXTURE),s.texParameteri(P,s.TEXTURE_COMPARE_FUNC,be[S.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===Gt||S.minFilter!==Ds&&S.minFilter!==zn||S.type===gn&&e.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||n.get(S).__currentAnisotropy){const ee=e.get("EXT_texture_filter_anisotropic");s.texParameterf(P,ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,i.getMaxAnisotropy())),n.get(S).__currentAnisotropy=S.anisotropy}}}function ge(P,S){let ee=!1;P.__webglInit===void 0&&(P.__webglInit=!0,S.addEventListener("dispose",A));const pe=S.source;let ce=d.get(pe);ce===void 0&&(ce={},d.set(pe,ce));const ve=G(S);if(ve!==P.__cacheKey){ce[ve]===void 0&&(ce[ve]={texture:s.createTexture(),usedTimes:0},o.memory.textures++,ee=!0),ce[ve].usedTimes++;const Ve=ce[P.__cacheKey];Ve!==void 0&&(ce[P.__cacheKey].usedTimes--,Ve.usedTimes===0&&I(S)),P.__cacheKey=ve,P.__webglTexture=ce[ve].texture}return ee}function ze(P,S,ee){let pe=s.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(pe=s.TEXTURE_2D_ARRAY),S.isData3DTexture&&(pe=s.TEXTURE_3D);const ce=ge(P,S),ve=S.source;t.bindTexture(pe,P.__webglTexture,s.TEXTURE0+ee);const Ve=n.get(ve);if(ve.version!==Ve.__version||ce===!0){t.activeTexture(s.TEXTURE0+ee);const Ee=ht.getPrimaries(ht.workingColorSpace),Te=S.colorSpace===ti?null:ht.getPrimaries(S.colorSpace),Qe=S.colorSpace===ti||Ee===Te?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,S.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,S.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,Qe);let xe=v(S.image,!1,i.maxTextureSize);xe=k(S,xe);const Ue=r.convert(S.format,S.colorSpace),st=r.convert(S.type);let Je=y(S.internalFormat,Ue,st,S.colorSpace,S.isVideoTexture);Ae(pe,S);let Re;const rt=S.mipmaps,at=S.isVideoTexture!==!0,Rt=Ve.__version===void 0||ce===!0,z=ve.dataReady,Ie=x(S,xe);if(S.isDepthTexture)Je=_(S.format===os,S.type),Rt&&(at?t.texStorage2D(s.TEXTURE_2D,1,Je,xe.width,xe.height):t.texImage2D(s.TEXTURE_2D,0,Je,xe.width,xe.height,0,Ue,st,null));else if(S.isDataTexture)if(rt.length>0){at&&Rt&&t.texStorage2D(s.TEXTURE_2D,Ie,Je,rt[0].width,rt[0].height);for(let de=0,_e=rt.length;de<_e;de++)Re=rt[de],at?z&&t.texSubImage2D(s.TEXTURE_2D,de,0,0,Re.width,Re.height,Ue,st,Re.data):t.texImage2D(s.TEXTURE_2D,de,Je,Re.width,Re.height,0,Ue,st,Re.data);S.generateMipmaps=!1}else at?(Rt&&t.texStorage2D(s.TEXTURE_2D,Ie,Je,xe.width,xe.height),z&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,xe.width,xe.height,Ue,st,xe.data)):t.texImage2D(s.TEXTURE_2D,0,Je,xe.width,xe.height,0,Ue,st,xe.data);else if(S.isCompressedTexture)if(S.isCompressedArrayTexture){at&&Rt&&t.texStorage3D(s.TEXTURE_2D_ARRAY,Ie,Je,rt[0].width,rt[0].height,xe.depth);for(let de=0,_e=rt.length;de<_e;de++)if(Re=rt[de],S.format!==un)if(Ue!==null)if(at){if(z)if(S.layerUpdates.size>0){for(const we of S.layerUpdates){const et=Re.width*Re.height;t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,de,0,0,we,Re.width,Re.height,1,Ue,Re.data.slice(et*we,et*(we+1)),0,0)}S.clearLayerUpdates()}else t.compressedTexSubImage3D(s.TEXTURE_2D_ARRAY,de,0,0,0,Re.width,Re.height,xe.depth,Ue,Re.data,0,0)}else t.compressedTexImage3D(s.TEXTURE_2D_ARRAY,de,Je,Re.width,Re.height,xe.depth,0,Re.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else at?z&&t.texSubImage3D(s.TEXTURE_2D_ARRAY,de,0,0,0,Re.width,Re.height,xe.depth,Ue,st,Re.data):t.texImage3D(s.TEXTURE_2D_ARRAY,de,Je,Re.width,Re.height,xe.depth,0,Ue,st,Re.data)}else{at&&Rt&&t.texStorage2D(s.TEXTURE_2D,Ie,Je,rt[0].width,rt[0].height);for(let de=0,_e=rt.length;de<_e;de++)Re=rt[de],S.format!==un?Ue!==null?at?z&&t.compressedTexSubImage2D(s.TEXTURE_2D,de,0,0,Re.width,Re.height,Ue,Re.data):t.compressedTexImage2D(s.TEXTURE_2D,de,Je,Re.width,Re.height,0,Re.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):at?z&&t.texSubImage2D(s.TEXTURE_2D,de,0,0,Re.width,Re.height,Ue,st,Re.data):t.texImage2D(s.TEXTURE_2D,de,Je,Re.width,Re.height,0,Ue,st,Re.data)}else if(S.isDataArrayTexture)if(at){if(Rt&&t.texStorage3D(s.TEXTURE_2D_ARRAY,Ie,Je,xe.width,xe.height,xe.depth),z)if(S.layerUpdates.size>0){let de;switch(st){case s.UNSIGNED_BYTE:switch(Ue){case s.ALPHA:de=1;break;case s.LUMINANCE:de=1;break;case s.LUMINANCE_ALPHA:de=2;break;case s.RGB:de=3;break;case s.RGBA:de=4;break;default:throw new Error(`Unknown texel size for format ${Ue}.`)}break;case s.UNSIGNED_SHORT_4_4_4_4:case s.UNSIGNED_SHORT_5_5_5_1:case s.UNSIGNED_SHORT_5_6_5:de=1;break;default:throw new Error(`Unknown texel size for type ${st}.`)}const _e=xe.width*xe.height*de;for(const we of S.layerUpdates)t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,we,xe.width,xe.height,1,Ue,st,xe.data.slice(_e*we,_e*(we+1)));S.clearLayerUpdates()}else t.texSubImage3D(s.TEXTURE_2D_ARRAY,0,0,0,0,xe.width,xe.height,xe.depth,Ue,st,xe.data)}else t.texImage3D(s.TEXTURE_2D_ARRAY,0,Je,xe.width,xe.height,xe.depth,0,Ue,st,xe.data);else if(S.isData3DTexture)at?(Rt&&t.texStorage3D(s.TEXTURE_3D,Ie,Je,xe.width,xe.height,xe.depth),z&&t.texSubImage3D(s.TEXTURE_3D,0,0,0,0,xe.width,xe.height,xe.depth,Ue,st,xe.data)):t.texImage3D(s.TEXTURE_3D,0,Je,xe.width,xe.height,xe.depth,0,Ue,st,xe.data);else if(S.isFramebufferTexture){if(Rt)if(at)t.texStorage2D(s.TEXTURE_2D,Ie,Je,xe.width,xe.height);else{let de=xe.width,_e=xe.height;for(let we=0;we>=1,_e>>=1}}else if(rt.length>0){if(at&&Rt){const de=O(rt[0]);t.texStorage2D(s.TEXTURE_2D,Ie,Je,de.width,de.height)}for(let de=0,_e=rt.length;de<_e;de++)Re=rt[de],at?z&&t.texSubImage2D(s.TEXTURE_2D,de,0,0,Ue,st,Re):t.texImage2D(s.TEXTURE_2D,de,Je,Ue,st,Re);S.generateMipmaps=!1}else if(at){if(Rt){const de=O(xe);t.texStorage2D(s.TEXTURE_2D,Ie,Je,de.width,de.height)}z&&t.texSubImage2D(s.TEXTURE_2D,0,0,0,Ue,st,xe)}else t.texImage2D(s.TEXTURE_2D,0,Je,Ue,st,xe);m(S)&&p(pe),Ve.__version=ve.version,S.onUpdate&&S.onUpdate(S)}P.__version=S.version}function U(P,S,ee){if(S.image.length!==6)return;const pe=ge(P,S),ce=S.source;t.bindTexture(s.TEXTURE_CUBE_MAP,P.__webglTexture,s.TEXTURE0+ee);const ve=n.get(ce);if(ce.version!==ve.__version||pe===!0){t.activeTexture(s.TEXTURE0+ee);const Ve=ht.getPrimaries(ht.workingColorSpace),Ee=S.colorSpace===ti?null:ht.getPrimaries(S.colorSpace),Te=S.colorSpace===ti||Ve===Ee?s.NONE:s.BROWSER_DEFAULT_WEBGL;s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,S.flipY),s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),s.pixelStorei(s.UNPACK_ALIGNMENT,S.unpackAlignment),s.pixelStorei(s.UNPACK_COLORSPACE_CONVERSION_WEBGL,Te);const Qe=S.isCompressedTexture||S.image[0].isCompressedTexture,xe=S.image[0]&&S.image[0].isDataTexture,Ue=[];for(let _e=0;_e<6;_e++)!Qe&&!xe?Ue[_e]=v(S.image[_e],!0,i.maxCubemapSize):Ue[_e]=xe?S.image[_e].image:S.image[_e],Ue[_e]=k(S,Ue[_e]);const st=Ue[0],Je=r.convert(S.format,S.colorSpace),Re=r.convert(S.type),rt=y(S.internalFormat,Je,Re,S.colorSpace),at=S.isVideoTexture!==!0,Rt=ve.__version===void 0||pe===!0,z=ce.dataReady;let Ie=x(S,st);Ae(s.TEXTURE_CUBE_MAP,S);let de;if(Qe){at&&Rt&&t.texStorage2D(s.TEXTURE_CUBE_MAP,Ie,rt,st.width,st.height);for(let _e=0;_e<6;_e++){de=Ue[_e].mipmaps;for(let we=0;we0&&Ie++;const _e=O(Ue[0]);t.texStorage2D(s.TEXTURE_CUBE_MAP,Ie,rt,_e.width,_e.height)}for(let _e=0;_e<6;_e++)if(xe){at?z&&t.texSubImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,0,0,Ue[_e].width,Ue[_e].height,Je,Re,Ue[_e].data):t.texImage2D(s.TEXTURE_CUBE_MAP_POSITIVE_X+_e,0,rt,Ue[_e].width,Ue[_e].height,0,Je,Re,Ue[_e].data);for(let we=0;we>ve),Ue=Math.max(1,S.height>>ve);ce===s.TEXTURE_3D||ce===s.TEXTURE_2D_ARRAY?t.texImage3D(ce,ve,Te,xe,Ue,S.depth,0,Ve,Ee,null):t.texImage2D(ce,ve,Te,xe,Ue,0,Ve,Ee,null)}t.bindFramebuffer(s.FRAMEBUFFER,P),te(S)?a.framebufferTexture2DMultisampleEXT(s.FRAMEBUFFER,pe,ce,n.get(ee).__webglTexture,0,$(S)):(ce===s.TEXTURE_2D||ce>=s.TEXTURE_CUBE_MAP_POSITIVE_X&&ce<=s.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&s.framebufferTexture2D(s.FRAMEBUFFER,pe,ce,n.get(ee).__webglTexture,ve),t.bindFramebuffer(s.FRAMEBUFFER,null)}function R(P,S,ee){if(s.bindRenderbuffer(s.RENDERBUFFER,P),S.depthBuffer){const pe=S.depthTexture,ce=pe&&pe.isDepthTexture?pe.type:null,ve=_(S.stencilBuffer,ce),Ve=S.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Ee=$(S);te(S)?a.renderbufferStorageMultisampleEXT(s.RENDERBUFFER,Ee,ve,S.width,S.height):ee?s.renderbufferStorageMultisample(s.RENDERBUFFER,Ee,ve,S.width,S.height):s.renderbufferStorage(s.RENDERBUFFER,ve,S.width,S.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,Ve,s.RENDERBUFFER,P)}else{const pe=S.textures;for(let ce=0;ce1;if(Ve||(pe.__webglTexture===void 0&&(pe.__webglTexture=s.createTexture()),pe.__version=S.version,o.memory.textures++),ve){ee.__webglFramebuffer=[];for(let Ee=0;Ee<6;Ee++)if(S.mipmaps&&S.mipmaps.length>0){ee.__webglFramebuffer[Ee]=[];for(let Te=0;Te0){ee.__webglFramebuffer=[];for(let Ee=0;Ee0&&te(P)===!1){ee.__webglMultisampledFramebuffer=s.createFramebuffer(),ee.__webglColorRenderbuffer=[],t.bindFramebuffer(s.FRAMEBUFFER,ee.__webglMultisampledFramebuffer);for(let Ee=0;Ee0)for(let Te=0;Te0)for(let Te=0;Te0){if(te(P)===!1){const S=P.textures,ee=P.width,pe=P.height;let ce=s.COLOR_BUFFER_BIT;const ve=P.stencilBuffer?s.DEPTH_STENCIL_ATTACHMENT:s.DEPTH_ATTACHMENT,Ve=n.get(P),Ee=S.length>1;if(Ee)for(let Te=0;Te0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function le(P){const S=o.render.frame;u.get(P)!==S&&(u.set(P,S),P.update())}function k(P,S){const ee=P.colorSpace,pe=P.format,ce=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||ee!==ci&&ee!==ti&&(ht.getTransfer(ee)===Mt?(pe!==un||ce!==li)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ee)),S}function O(P){return typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement?(c.width=P.naturalWidth||P.width,c.height=P.naturalHeight||P.height):typeof VideoFrame<"u"&&P instanceof VideoFrame?(c.width=P.displayWidth,c.height=P.displayHeight):(c.width=P.width,c.height=P.height),c}this.allocateTextureUnit=V,this.resetTextureUnits=F,this.setTexture2D=q,this.setTexture2DArray=ae,this.setTexture3D=Q,this.setTextureCube=oe,this.rebindTextures=he,this.setupRenderTarget=J,this.updateRenderTargetMipmap=L,this.updateMultisampleRenderTarget=H,this.setupDepthRenderbuffer=ie,this.setupFrameBufferTexture=D,this.useMultisampledRTT=te}function yp(s,e){function t(n,i=ti){let r;const o=ht.getTransfer(i);if(n===li)return s.UNSIGNED_BYTE;if(n===tu)return s.UNSIGNED_SHORT_4_4_4_4;if(n===nu)return s.UNSIGNED_SHORT_5_5_5_1;if(n===Of)return s.UNSIGNED_INT_5_9_9_9_REV;if(n===Df)return s.BYTE;if(n===Uf)return s.SHORT;if(n===Sr)return s.UNSIGNED_SHORT;if(n===eu)return s.INT;if(n===ss)return s.UNSIGNED_INT;if(n===gn)return s.FLOAT;if(n===Wr)return s.HALF_FLOAT;if(n===Ff)return s.ALPHA;if(n===kf)return s.RGB;if(n===un)return s.RGBA;if(n===Bf)return s.LUMINANCE;if(n===zf)return s.LUMINANCE_ALPHA;if(n===ts)return s.DEPTH_COMPONENT;if(n===os)return s.DEPTH_STENCIL;if(n===iu)return s.RED;if(n===su)return s.RED_INTEGER;if(n===Vf)return s.RG;if(n===ru)return s.RG_INTEGER;if(n===ou)return s.RGBA_INTEGER;if(n===sa||n===ra||n===oa||n===aa)if(o===Mt)if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),r!==null){if(n===sa)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===ra)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===oa)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===aa)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(r=e.get("WEBGL_compressed_texture_s3tc"),r!==null){if(n===sa)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===ra)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===oa)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===aa)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===ic||n===sc||n===rc||n===oc)if(r=e.get("WEBGL_compressed_texture_pvrtc"),r!==null){if(n===ic)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===sc)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===rc)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===oc)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===ac||n===lc||n===cc)if(r=e.get("WEBGL_compressed_texture_etc"),r!==null){if(n===ac||n===lc)return o===Mt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===cc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===uc||n===hc||n===dc||n===fc||n===pc||n===mc||n===gc||n===vc||n===_c||n===yc||n===xc||n===Mc||n===bc||n===Sc)if(r=e.get("WEBGL_compressed_texture_astc"),r!==null){if(n===uc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===hc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===dc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===fc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===pc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===mc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===gc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===vc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===_c)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===yc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===xc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Mc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===bc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Sc)return o===Mt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===la||n===wc||n===Ac)if(r=e.get("EXT_texture_compression_bptc"),r!==null){if(n===la)return o===Mt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===wc)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Ac)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Hf||n===Tc||n===Ec||n===Cc)if(r=e.get("EXT_texture_compression_rgtc"),r!==null){if(n===la)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Tc)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Ec)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Cc)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===rs?s.UNSIGNED_INT_24_8:s[n]!==void 0?s[n]:null}return{convert:t}}class xp extends Ut{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Fs extends ct{constructor(){super(),this.isGroup=!0,this.type="Group"}}const iM={type:"move"};class Nl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Fs,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 Fs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Fs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N),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 n of e.hand.values())this._getHandJoint(t,n)}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,n){let i=null,r=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 v of e.hand.values()){const m=t.getJointPose(v,n),p=this._getHandJoint(c,v);m!==null&&(p.matrix.fromArray(m.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=m.radius),p.visible=m!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),f=.02,g=.005;c.inputState.pinching&&d>f+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=f-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&r!==null&&(i=r),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(iM)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Fs;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const sM=` void main() { gl_Position = vec4( position, 1.0 ); }`,rM=` 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 oM{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){const i=new Pt,r=e.properties.get(i);r.__webglTexture=t.texture,(t.depthNear!=n.depthNear||t.depthFar!=n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Ln({vertexShader:sM,fragmentShader:rM,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Nt(new Xs(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}}class aM extends ui{constructor(e,t){super();const n=this;let i=null,r=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,d=null,f=null,g=null;const v=new oM,m=t.getContextAttributes();let p=null,y=null;const _=[],x=[],A=new se;let b=null;const E=new Ut;E.layers.enable(1),E.viewport=new gt;const I=new Ut;I.layers.enable(2),I.viewport=new gt;const w=[E,I],M=new xp;M.layers.enable(1),M.layers.enable(2);let F=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(U){let D=_[U];return D===void 0&&(D=new Nl,_[U]=D),D.getTargetRaySpace()},this.getControllerGrip=function(U){let D=_[U];return D===void 0&&(D=new Nl,_[U]=D),D.getGripSpace()},this.getHand=function(U){let D=_[U];return D===void 0&&(D=new Nl,_[U]=D),D.getHandSpace()};function G(U){const D=x.indexOf(U.inputSource);if(D===-1)return;const R=_[D];R!==void 0&&(R.update(U.inputSource,U.frame,c||o),R.dispatchEvent({type:U.type,data:U.inputSource}))}function q(){i.removeEventListener("select",G),i.removeEventListener("selectstart",G),i.removeEventListener("selectend",G),i.removeEventListener("squeeze",G),i.removeEventListener("squeezestart",G),i.removeEventListener("squeezeend",G),i.removeEventListener("end",q),i.removeEventListener("inputsourceschange",ae);for(let U=0;U<_.length;U++){const D=x[U];D!==null&&(x[U]=null,_[U].disconnect(D))}F=null,V=null,v.reset(),e.setRenderTarget(p),f=null,d=null,h=null,i=null,y=null,ze.stop(),n.isPresenting=!1,e.setPixelRatio(b),e.setSize(A.width,A.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(U){r=U,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(U){a=U,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(U){c=U},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return h},this.getFrame=function(){return g},this.getSession=function(){return i},this.setSession=async function(U){if(i=U,i!==null){if(p=e.getRenderTarget(),i.addEventListener("select",G),i.addEventListener("selectstart",G),i.addEventListener("selectend",G),i.addEventListener("squeeze",G),i.addEventListener("squeezestart",G),i.addEventListener("squeezeend",G),i.addEventListener("end",q),i.addEventListener("inputsourceschange",ae),m.xrCompatible!==!0&&await t.makeXRCompatible(),b=e.getPixelRatio(),e.getSize(A),i.renderState.layers===void 0){const D={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};f=new XRWebGLLayer(i,t,D),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),y=new In(f.framebufferWidth,f.framebufferHeight,{format:un,type:li,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let D=null,R=null,T=null;m.depth&&(T=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,D=m.stencil?os:ts,R=m.stencil?rs:ss);const ie={colorFormat:t.RGBA8,depthFormat:T,scaleFactor:r};h=new XRWebGLBinding(i,t),d=h.createProjectionLayer(ie),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),y=new In(d.textureWidth,d.textureHeight,{format:un,type:li,depthTexture:new mu(d.textureWidth,d.textureHeight,R,void 0,void 0,void 0,void 0,void 0,void 0,D),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1})}y.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await i.requestReferenceSpace(a),ze.setContext(i),ze.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function ae(U){for(let D=0;D=0&&(x[T]=null,_[T].disconnect(R))}for(let D=0;D=x.length){x.push(R),T=he;break}else if(x[he]===null){x[he]=R,T=he;break}if(T===-1)break}const ie=_[T];ie&&ie.connect(R)}}const Q=new N,oe=new N;function B(U,D,R){Q.setFromMatrixPosition(D.matrixWorld),oe.setFromMatrixPosition(R.matrixWorld);const T=Q.distanceTo(oe),ie=D.projectionMatrix.elements,he=R.projectionMatrix.elements,J=ie[14]/(ie[10]-1),L=ie[14]/(ie[10]+1),X=(ie[9]+1)/ie[5],K=(ie[9]-1)/ie[5],H=(ie[8]-1)/ie[0],$=(he[8]+1)/he[0],te=J*H,le=J*$,k=T/(-H+$),O=k*-H;D.matrixWorld.decompose(U.position,U.quaternion,U.scale),U.translateX(O),U.translateZ(k),U.matrixWorld.compose(U.position,U.quaternion,U.scale),U.matrixWorldInverse.copy(U.matrixWorld).invert();const P=J+k,S=L+k,ee=te-O,pe=le+(T-O),ce=X*L/S*P,ve=K*L/S*P;U.projectionMatrix.makePerspective(ee,pe,ce,ve,P,S),U.projectionMatrixInverse.copy(U.projectionMatrix).invert()}function Me(U,D){D===null?U.matrixWorld.copy(U.matrix):U.matrixWorld.multiplyMatrices(D.matrixWorld,U.matrix),U.matrixWorldInverse.copy(U.matrixWorld).invert()}this.updateCamera=function(U){if(i===null)return;v.texture!==null&&(U.near=v.depthNear,U.far=v.depthFar),M.near=I.near=E.near=U.near,M.far=I.far=E.far=U.far,(F!==M.near||V!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),F=M.near,V=M.far,E.near=F,E.far=V,I.near=F,I.far=V,E.updateProjectionMatrix(),I.updateProjectionMatrix(),U.updateProjectionMatrix());const D=U.parent,R=M.cameras;Me(M,D);for(let T=0;T0&&(m.alphaTest.value=p.alphaTest);const y=e.get(p),_=y.envMap,x=y.envMapRotation;_&&(m.envMap.value=_,Vi.copy(x),Vi.x*=-1,Vi.y*=-1,Vi.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(Vi.y*=-1,Vi.z*=-1),m.envMapRotation.value.setFromMatrix4(lM.makeRotationFromEuler(Vi)),m.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=p.reflectivity,m.ior.value=p.ior,m.refractionRatio.value=p.refractionRatio),p.lightMap&&(m.lightMap.value=p.lightMap,m.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,m.lightMapTransform)),p.aoMap&&(m.aoMap.value=p.aoMap,m.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,m.aoMapTransform))}function o(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform))}function a(m,p){m.dashSize.value=p.dashSize,m.totalSize.value=p.dashSize+p.gapSize,m.scale.value=p.scale}function l(m,p,y,_){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.size.value=p.size*y,m.scale.value=_*.5,p.map&&(m.map.value=p.map,t(p.map,m.uvTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function c(m,p){m.diffuse.value.copy(p.color),m.opacity.value=p.opacity,m.rotation.value=p.rotation,p.map&&(m.map.value=p.map,t(p.map,m.mapTransform)),p.alphaMap&&(m.alphaMap.value=p.alphaMap,t(p.alphaMap,m.alphaMapTransform)),p.alphaTest>0&&(m.alphaTest.value=p.alphaTest)}function u(m,p){m.specular.value.copy(p.specular),m.shininess.value=Math.max(p.shininess,1e-4)}function h(m,p){p.gradientMap&&(m.gradientMap.value=p.gradientMap)}function d(m,p){m.metalness.value=p.metalness,p.metalnessMap&&(m.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,m.metalnessMapTransform)),m.roughness.value=p.roughness,p.roughnessMap&&(m.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,m.roughnessMapTransform)),p.envMap&&(m.envMapIntensity.value=p.envMapIntensity)}function f(m,p,y){m.ior.value=p.ior,p.sheen>0&&(m.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),m.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(m.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,m.sheenColorMapTransform)),p.sheenRoughnessMap&&(m.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,m.sheenRoughnessMapTransform))),p.clearcoat>0&&(m.clearcoat.value=p.clearcoat,m.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(m.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,m.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(m.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===nn&&m.clearcoatNormalScale.value.negate())),p.dispersion>0&&(m.dispersion.value=p.dispersion),p.iridescence>0&&(m.iridescence.value=p.iridescence,m.iridescenceIOR.value=p.iridescenceIOR,m.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(m.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,m.iridescenceMapTransform)),p.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),p.transmission>0&&(m.transmission.value=p.transmission,m.transmissionSamplerMap.value=y.texture,m.transmissionSamplerSize.value.set(y.width,y.height),p.transmissionMap&&(m.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,m.transmissionMapTransform)),m.thickness.value=p.thickness,p.thicknessMap&&(m.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=p.attenuationDistance,m.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(m.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(m.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=p.specularIntensity,m.specularColor.value.copy(p.specularColor),p.specularColorMap&&(m.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,m.specularColorMapTransform)),p.specularIntensityMap&&(m.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,p){p.matcap&&(m.matcap.value=p.matcap)}function v(m,p){const y=e.get(p).light;m.referencePosition.value.setFromMatrixPosition(y.matrixWorld),m.nearDistance.value=y.shadow.camera.near,m.farDistance.value=y.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function uM(s,e,t,n){let i={},r={},o=[];const a=s.getParameter(s.MAX_UNIFORM_BUFFER_BINDINGS);function l(y,_){const x=_.program;n.uniformBlockBinding(y,x)}function c(y,_){let x=i[y.id];x===void 0&&(g(y),x=u(y),i[y.id]=x,y.addEventListener("dispose",m));const A=_.program;n.updateUBOMapping(y,A);const b=e.render.frame;r[y.id]!==b&&(d(y),r[y.id]=b)}function u(y){const _=h();y.__bindingPointIndex=_;const x=s.createBuffer(),A=y.__size,b=y.usage;return s.bindBuffer(s.UNIFORM_BUFFER,x),s.bufferData(s.UNIFORM_BUFFER,A,b),s.bindBuffer(s.UNIFORM_BUFFER,null),s.bindBufferBase(s.UNIFORM_BUFFER,_,x),x}function h(){for(let y=0;y0&&(x+=A-b),y.__size=x,y.__cache={},this}function v(y){const _={boundary:0,storage:0};return typeof y=="number"||typeof y=="boolean"?(_.boundary=4,_.storage=4):y.isVector2?(_.boundary=8,_.storage=8):y.isVector3||y.isColor?(_.boundary=16,_.storage=12):y.isVector4?(_.boundary=16,_.storage=16):y.isMatrix3?(_.boundary=48,_.storage=48):y.isMatrix4?(_.boundary=64,_.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),_}function m(y){const _=y.target;_.removeEventListener("dispose",m);const x=o.indexOf(_.__bindingPointIndex);o.splice(x,1),s.deleteBuffer(i[_.id]),delete i[_.id],delete r[_.id]}function p(){for(const y in i)s.deleteBuffer(i[y]);o=[],i={},r={}}return{bind:l,update:c,dispose:p}}class ha{constructor(e={}){const{canvas:t=rp(),context:n=null,depth:i=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let d;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");d=n.getContextAttributes().alpha}else d=o;const f=new Uint32Array(4),g=new Int32Array(4);let v=null,m=null;const p=[],y=[];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=ln,this.toneMapping=Hn,this.toneMappingExposure=1;const _=this;let x=!1,A=0,b=0,E=null,I=-1,w=null;const M=new gt,F=new gt;let V=null;const G=new Pe(0);let q=0,ae=t.width,Q=t.height,oe=1,B=null,Me=null;const be=new gt(0,0,ae,Q),Ae=new gt(0,0,ae,Q);let ge=!1;const ze=new Yr;let U=!1,D=!1;const R=new qe,T=new N,ie={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let he=!1;function J(){return E===null?oe:1}let L=n;function X(C,W){return t.getContext(C,W)}try{const C={alpha:!0,depth:i,stencil:r,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Hr}`),t.addEventListener("webglcontextlost",Ie,!1),t.addEventListener("webglcontextrestored",de,!1),t.addEventListener("webglcontextcreationerror",_e,!1),L===null){const W="webgl2";if(L=X(W,C),L===null)throw X(W)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(C){throw console.error("THREE.WebGLRenderer: "+C.message),C}let K,H,$,te,le,k,O,P,S,ee,pe,ce,ve,Ve,Ee,Te,Qe,xe,Ue,st,Je,Re,rt,at;function Rt(){K=new Sy(L),K.init(),Re=new yp(L,K),H=new vy(L,K,e,Re),$=new tM(L),te=new Ty(L),le=new Gx,k=new nM(L,K,$,le,H,Re,te),O=new yy(_),P=new by(_),S=new Nv(L),rt=new my(L,S),ee=new wy(L,S,te,rt),pe=new Cy(L,ee,S,te),Ue=new Ey(L,H,k),Te=new _y(le),ce=new Hx(_,O,P,K,H,rt,Te),ve=new cM(_,le),Ve=new $x,Ee=new Kx(K),xe=new py(_,O,P,$,pe,d,l),Qe=new eM(_,pe,H),at=new uM(L,te,H,$),st=new gy(L,K,te),Je=new Ay(L,K,te),te.programs=ce.programs,_.capabilities=H,_.extensions=K,_.properties=le,_.renderLists=Ve,_.shadowMap=Qe,_.state=$,_.info=te}Rt();const z=new aM(_,L);this.xr=z,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){const C=K.get("WEBGL_lose_context");C&&C.loseContext()},this.forceContextRestore=function(){const C=K.get("WEBGL_lose_context");C&&C.restoreContext()},this.getPixelRatio=function(){return oe},this.setPixelRatio=function(C){C!==void 0&&(oe=C,this.setSize(ae,Q,!1))},this.getSize=function(C){return C.set(ae,Q)},this.setSize=function(C,W,ne=!0){if(z.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}ae=C,Q=W,t.width=Math.floor(C*oe),t.height=Math.floor(W*oe),ne===!0&&(t.style.width=C+"px",t.style.height=W+"px"),this.setViewport(0,0,C,W)},this.getDrawingBufferSize=function(C){return C.set(ae*oe,Q*oe).floor()},this.setDrawingBufferSize=function(C,W,ne){ae=C,Q=W,oe=ne,t.width=Math.floor(C*ne),t.height=Math.floor(W*ne),this.setViewport(0,0,C,W)},this.getCurrentViewport=function(C){return C.copy(M)},this.getViewport=function(C){return C.copy(be)},this.setViewport=function(C,W,ne,re){C.isVector4?be.set(C.x,C.y,C.z,C.w):be.set(C,W,ne,re),$.viewport(M.copy(be).multiplyScalar(oe).round())},this.getScissor=function(C){return C.copy(Ae)},this.setScissor=function(C,W,ne,re){C.isVector4?Ae.set(C.x,C.y,C.z,C.w):Ae.set(C,W,ne,re),$.scissor(F.copy(Ae).multiplyScalar(oe).round())},this.getScissorTest=function(){return ge},this.setScissorTest=function(C){$.setScissorTest(ge=C)},this.setOpaqueSort=function(C){B=C},this.setTransparentSort=function(C){Me=C},this.getClearColor=function(C){return C.copy(xe.getClearColor())},this.setClearColor=function(){xe.setClearColor.apply(xe,arguments)},this.getClearAlpha=function(){return xe.getClearAlpha()},this.setClearAlpha=function(){xe.setClearAlpha.apply(xe,arguments)},this.clear=function(C=!0,W=!0,ne=!0){let re=0;if(C){let Z=!1;if(E!==null){const Se=E.texture.format;Z=Se===ou||Se===ru||Se===su}if(Z){const Se=E.texture.type,Le=Se===li||Se===ss||Se===Sr||Se===rs||Se===tu||Se===nu,Oe=xe.getClearColor(),He=xe.getClearAlpha(),Ke=Oe.r,je=Oe.g,Xe=Oe.b;Le?(f[0]=Ke,f[1]=je,f[2]=Xe,f[3]=He,L.clearBufferuiv(L.COLOR,0,f)):(g[0]=Ke,g[1]=je,g[2]=Xe,g[3]=He,L.clearBufferiv(L.COLOR,0,g))}else re|=L.COLOR_BUFFER_BIT}W&&(re|=L.DEPTH_BUFFER_BIT),ne&&(re|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),L.clear(re)},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",de,!1),t.removeEventListener("webglcontextcreationerror",_e,!1),Ve.dispose(),Ee.dispose(),le.dispose(),O.dispose(),P.dispose(),pe.dispose(),rt.dispose(),at.dispose(),ce.dispose(),z.dispose(),z.removeEventListener("sessionstart",On),z.removeEventListener("sessionend",Fn),Di.stop()};function Ie(C){C.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function de(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;const C=te.autoReset,W=Qe.enabled,ne=Qe.autoUpdate,re=Qe.needsUpdate,Z=Qe.type;Rt(),te.autoReset=C,Qe.enabled=W,Qe.autoUpdate=ne,Qe.needsUpdate=re,Qe.type=Z}function _e(C){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",C.statusMessage)}function we(C){const W=C.target;W.removeEventListener("dispose",we),et(W)}function et(C){ut(C),le.remove(C)}function ut(C){const W=le.get(C).programs;W!==void 0&&(W.forEach(function(ne){ce.releaseProgram(ne)}),C.isShaderMaterial&&ce.releaseShaderCache(C))}this.renderBufferDirect=function(C,W,ne,re,Z,Se){W===null&&(W=ie);const Le=Z.isMesh&&Z.matrixWorld.determinant()<0,Oe=Fm(C,W,ne,re,Z);$.setMaterial(re,Le);let He=ne.index,Ke=1;if(re.wireframe===!0){if(He=ee.getWireframeAttribute(ne),He===void 0)return;Ke=2}const je=ne.drawRange,Xe=ne.attributes.position;let dt=je.start*Ke,wt=(je.start+je.count)*Ke;Se!==null&&(dt=Math.max(dt,Se.start*Ke),wt=Math.min(wt,(Se.start+Se.count)*Ke)),He!==null?(dt=Math.max(dt,0),wt=Math.min(wt,He.count)):Xe!=null&&(dt=Math.max(dt,0),wt=Math.min(wt,Xe.count));const At=wt-dt;if(At<0||At===1/0)return;rt.setup(Z,re,Oe,ne,He);let dn,mt=st;if(He!==null&&(dn=S.get(He),mt=Je,mt.setIndex(dn)),Z.isMesh)re.wireframe===!0?($.setLineWidth(re.wireframeLinewidth*J()),mt.setMode(L.LINES)):mt.setMode(L.TRIANGLES);else if(Z.isLine){let We=re.linewidth;We===void 0&&(We=1),$.setLineWidth(We*J()),Z.isLineSegments?mt.setMode(L.LINES):Z.isLineLoop?mt.setMode(L.LINE_LOOP):mt.setMode(L.LINE_STRIP)}else Z.isPoints?mt.setMode(L.POINTS):Z.isSprite&&mt.setMode(L.TRIANGLES);if(Z.isBatchedMesh)Z._multiDrawInstances!==null?mt.renderMultiDrawInstances(Z._multiDrawStarts,Z._multiDrawCounts,Z._multiDrawCount,Z._multiDrawInstances):mt.renderMultiDraw(Z._multiDrawStarts,Z._multiDrawCounts,Z._multiDrawCount);else if(Z.isInstancedMesh)mt.renderInstances(dt,At,Z.count);else if(ne.isInstancedBufferGeometry){const We=ne._maxInstanceCount!==void 0?ne._maxInstanceCount:1/0,jt=Math.min(ne.instanceCount,We);mt.renderInstances(dt,At,jt)}else mt.render(dt,At)};function It(C,W,ne){C.transparent===!0&&C.side===En&&C.forceSinglePass===!1?(C.side=nn,C.needsUpdate=!0,so(C,W,ne),C.side=oi,C.needsUpdate=!0,so(C,W,ne),C.side=En):so(C,W,ne)}this.compile=function(C,W,ne=null){ne===null&&(ne=C),m=Ee.get(ne),m.init(W),y.push(m),ne.traverseVisible(function(Z){Z.isLight&&Z.layers.test(W.layers)&&(m.pushLight(Z),Z.castShadow&&m.pushShadow(Z))}),C!==ne&&C.traverseVisible(function(Z){Z.isLight&&Z.layers.test(W.layers)&&(m.pushLight(Z),Z.castShadow&&m.pushShadow(Z))}),m.setupLights();const re=new Set;return C.traverse(function(Z){const Se=Z.material;if(Se)if(Array.isArray(Se))for(let Le=0;Le{function Se(){if(re.forEach(function(Le){le.get(Le).currentProgram.isReady()&&re.delete(Le)}),re.size===0){Z(C);return}setTimeout(Se,10)}K.get("KHR_parallel_shader_compile")!==null?Se():setTimeout(Se,10)})};let Bt=null;function vt(C){Bt&&Bt(C)}function On(){Di.stop()}function Fn(){Di.start()}const Di=new fp;Di.setAnimationLoop(vt),typeof self<"u"&&Di.setContext(self),this.setAnimationLoop=function(C){Bt=C,z.setAnimationLoop(C),C===null?Di.stop():Di.start()},z.addEventListener("sessionstart",On),z.addEventListener("sessionend",Fn),this.render=function(C,W){if(W!==void 0&&W.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(x===!0)return;if(C.matrixWorldAutoUpdate===!0&&C.updateMatrixWorld(),W.parent===null&&W.matrixWorldAutoUpdate===!0&&W.updateMatrixWorld(),z.enabled===!0&&z.isPresenting===!0&&(z.cameraAutoUpdate===!0&&z.updateCamera(W),W=z.getCamera()),C.isScene===!0&&C.onBeforeRender(_,C,W,E),m=Ee.get(C,y.length),m.init(W),y.push(m),R.multiplyMatrices(W.projectionMatrix,W.matrixWorldInverse),ze.setFromProjectionMatrix(R),D=this.localClippingEnabled,U=Te.init(this.clippingPlanes,D),v=Ve.get(C,p.length),v.init(),p.push(v),z.enabled===!0&&z.isPresenting===!0){const Se=_.xr.getDepthSensingMesh();Se!==null&&rl(Se,W,-1/0,_.sortObjects)}rl(C,W,0,_.sortObjects),v.finish(),_.sortObjects===!0&&v.sort(B,Me),he=z.enabled===!1||z.isPresenting===!1||z.hasDepthSensing()===!1,he&&xe.addToRenderList(v,C),this.info.render.frame++,U===!0&&Te.beginShadows();const ne=m.state.shadowsArray;Qe.render(ne,C,W),U===!0&&Te.endShadows(),this.info.autoReset===!0&&this.info.reset();const re=v.opaque,Z=v.transmissive;if(m.setupLights(),W.isArrayCamera){const Se=W.cameras;if(Z.length>0)for(let Le=0,Oe=Se.length;Le0&&Zu(re,Z,C,W),he&&xe.render(C),Yu(v,C,W);E!==null&&(k.updateMultisampleRenderTarget(E),k.updateRenderTargetMipmap(E)),C.isScene===!0&&C.onAfterRender(_,C,W),rt.resetDefaultState(),I=-1,w=null,y.pop(),y.length>0?(m=y[y.length-1],U===!0&&Te.setGlobalState(_.clippingPlanes,m.state.camera)):m=null,p.pop(),p.length>0?v=p[p.length-1]:v=null};function rl(C,W,ne,re){if(C.visible===!1)return;if(C.layers.test(W.layers)){if(C.isGroup)ne=C.renderOrder;else if(C.isLOD)C.autoUpdate===!0&&C.update(W);else if(C.isLight)m.pushLight(C),C.castShadow&&m.pushShadow(C);else if(C.isSprite){if(!C.frustumCulled||ze.intersectsSprite(C)){re&&T.setFromMatrixPosition(C.matrixWorld).applyMatrix4(R);const Le=pe.update(C),Oe=C.material;Oe.visible&&v.push(C,Le,Oe,ne,T.z,null)}}else if((C.isMesh||C.isLine||C.isPoints)&&(!C.frustumCulled||ze.intersectsObject(C))){const Le=pe.update(C),Oe=C.material;if(re&&(C.boundingSphere!==void 0?(C.boundingSphere===null&&C.computeBoundingSphere(),T.copy(C.boundingSphere.center)):(Le.boundingSphere===null&&Le.computeBoundingSphere(),T.copy(Le.boundingSphere.center)),T.applyMatrix4(C.matrixWorld).applyMatrix4(R)),Array.isArray(Oe)){const He=Le.groups;for(let Ke=0,je=He.length;Ke0&&io(Z,W,ne),Se.length>0&&io(Se,W,ne),Le.length>0&&io(Le,W,ne),$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),$.setPolygonOffset(!1)}function Zu(C,W,ne,re){if((ne.isScene===!0?ne.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[re.id]===void 0&&(m.state.transmissionRenderTarget[re.id]=new In(1,1,{generateMipmaps:!0,type:K.has("EXT_color_buffer_half_float")||K.has("EXT_color_buffer_float")?Wr:li,minFilter:zn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ht.workingColorSpace}));const Se=m.state.transmissionRenderTarget[re.id],Le=re.viewport||M;Se.setSize(Le.z,Le.w);const Oe=_.getRenderTarget();_.setRenderTarget(Se),_.getClearColor(G),q=_.getClearAlpha(),q<1&&_.setClearColor(16777215,.5),he?xe.render(ne):_.clear();const He=_.toneMapping;_.toneMapping=Hn;const Ke=re.viewport;if(re.viewport!==void 0&&(re.viewport=void 0),m.setupLightsView(re),U===!0&&Te.setGlobalState(_.clippingPlanes,re),io(C,ne,re),k.updateMultisampleRenderTarget(Se),k.updateRenderTargetMipmap(Se),K.has("WEBGL_multisampled_render_to_texture")===!1){let je=!1;for(let Xe=0,dt=W.length;Xe0),Xe=!!ne.morphAttributes.position,dt=!!ne.morphAttributes.normal,wt=!!ne.morphAttributes.color;let At=Hn;re.toneMapped&&(E===null||E.isXRRenderTarget===!0)&&(At=_.toneMapping);const dn=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,mt=dn!==void 0?dn.length:0,We=le.get(re),jt=m.state.lights;if(U===!0&&(D===!0||C!==w)){const yn=C===w&&re.id===I;Te.setState(re,C,yn)}let _t=!1;re.version===We.__version?(We.needsLights&&We.lightsStateVersion!==jt.state.version||We.outputColorSpace!==Oe||Z.isBatchedMesh&&We.batching===!1||!Z.isBatchedMesh&&We.batching===!0||Z.isBatchedMesh&&We.batchingColor===!0&&Z.colorTexture===null||Z.isBatchedMesh&&We.batchingColor===!1&&Z.colorTexture!==null||Z.isInstancedMesh&&We.instancing===!1||!Z.isInstancedMesh&&We.instancing===!0||Z.isSkinnedMesh&&We.skinning===!1||!Z.isSkinnedMesh&&We.skinning===!0||Z.isInstancedMesh&&We.instancingColor===!0&&Z.instanceColor===null||Z.isInstancedMesh&&We.instancingColor===!1&&Z.instanceColor!==null||Z.isInstancedMesh&&We.instancingMorph===!0&&Z.morphTexture===null||Z.isInstancedMesh&&We.instancingMorph===!1&&Z.morphTexture!==null||We.envMap!==He||re.fog===!0&&We.fog!==Se||We.numClippingPlanes!==void 0&&(We.numClippingPlanes!==Te.numPlanes||We.numIntersection!==Te.numIntersection)||We.vertexAlphas!==Ke||We.vertexTangents!==je||We.morphTargets!==Xe||We.morphNormals!==dt||We.morphColors!==wt||We.toneMapping!==At||We.morphTargetsCount!==mt)&&(_t=!0):(_t=!0,We.__version=re.version);let Yn=We.currentProgram;_t===!0&&(Yn=so(re,W,Z));let ro=!1,Ui=!1,ol=!1;const zt=Yn.getUniforms(),pi=We.uniforms;if($.useProgram(Yn.program)&&(ro=!0,Ui=!0,ol=!0),re.id!==I&&(I=re.id,Ui=!0),ro||w!==C){zt.setValue(L,"projectionMatrix",C.projectionMatrix),zt.setValue(L,"viewMatrix",C.matrixWorldInverse);const yn=zt.map.cameraPosition;yn!==void 0&&yn.setValue(L,T.setFromMatrixPosition(C.matrixWorld)),H.logarithmicDepthBuffer&&zt.setValue(L,"logDepthBufFC",2/(Math.log(C.far+1)/Math.LN2)),(re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshLambertMaterial||re.isMeshBasicMaterial||re.isMeshStandardMaterial||re.isShaderMaterial)&&zt.setValue(L,"isOrthographic",C.isOrthographicCamera===!0),w!==C&&(w=C,Ui=!0,ol=!0)}if(Z.isSkinnedMesh){zt.setOptional(L,Z,"bindMatrix"),zt.setOptional(L,Z,"bindMatrixInverse");const yn=Z.skeleton;yn&&(yn.boneTexture===null&&yn.computeBoneTexture(),zt.setValue(L,"boneTexture",yn.boneTexture,k))}Z.isBatchedMesh&&(zt.setOptional(L,Z,"batchingTexture"),zt.setValue(L,"batchingTexture",Z._matricesTexture,k),zt.setOptional(L,Z,"batchingColorTexture"),Z._colorsTexture!==null&&zt.setValue(L,"batchingColorTexture",Z._colorsTexture,k));const al=ne.morphAttributes;if((al.position!==void 0||al.normal!==void 0||al.color!==void 0)&&Ue.update(Z,ne,Yn),(Ui||We.receiveShadow!==Z.receiveShadow)&&(We.receiveShadow=Z.receiveShadow,zt.setValue(L,"receiveShadow",Z.receiveShadow)),re.isMeshGouraudMaterial&&re.envMap!==null&&(pi.envMap.value=He,pi.flipEnvMap.value=He.isCubeTexture&&He.isRenderTargetTexture===!1?-1:1),re.isMeshStandardMaterial&&re.envMap===null&&W.environment!==null&&(pi.envMapIntensity.value=W.environmentIntensity),Ui&&(zt.setValue(L,"toneMappingExposure",_.toneMappingExposure),We.needsLights&&km(pi,ol),Se&&re.fog===!0&&ve.refreshFogUniforms(pi,Se),ve.refreshMaterialUniforms(pi,re,oe,Q,m.state.transmissionRenderTarget[C.id]),ua.upload(L,Ku(We),pi,k)),re.isShaderMaterial&&re.uniformsNeedUpdate===!0&&(ua.upload(L,Ku(We),pi,k),re.uniformsNeedUpdate=!1),re.isSpriteMaterial&&zt.setValue(L,"center",Z.center),zt.setValue(L,"modelViewMatrix",Z.modelViewMatrix),zt.setValue(L,"normalMatrix",Z.normalMatrix),zt.setValue(L,"modelMatrix",Z.matrixWorld),re.isShaderMaterial||re.isRawShaderMaterial){const yn=re.uniformsGroups;for(let ll=0,zm=yn.length;ll0&&k.useMultisampledRTT(C)===!1?Z=le.get(C).__webglMultisampledFramebuffer:Array.isArray(je)?Z=je[ne]:Z=je,M.copy(C.viewport),F.copy(C.scissor),V=C.scissorTest}else M.copy(be).multiplyScalar(oe).floor(),F.copy(Ae).multiplyScalar(oe).floor(),V=ge;if($.bindFramebuffer(L.FRAMEBUFFER,Z)&&re&&$.drawBuffers(C,Z),$.viewport(M),$.scissor(F),$.setScissorTest(V),Se){const He=le.get(C.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+W,He.__webglTexture,ne)}else if(Le){const He=le.get(C.texture),Ke=W||0;L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,He.__webglTexture,ne||0,Ke)}I=-1},this.readRenderTargetPixels=function(C,W,ne,re,Z,Se,Le){if(!(C&&C.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Oe=le.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&Le!==void 0&&(Oe=Oe[Le]),Oe){$.bindFramebuffer(L.FRAMEBUFFER,Oe);try{const He=C.texture,Ke=He.format,je=He.type;if(!H.textureFormatReadable(Ke)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!H.textureTypeReadable(je)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}W>=0&&W<=C.width-re&&ne>=0&&ne<=C.height-Z&&L.readPixels(W,ne,re,Z,Re.convert(Ke),Re.convert(je),Se)}finally{const He=E!==null?le.get(E).__webglFramebuffer:null;$.bindFramebuffer(L.FRAMEBUFFER,He)}}},this.readRenderTargetPixelsAsync=async function(C,W,ne,re,Z,Se,Le){if(!(C&&C.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Oe=le.get(C).__webglFramebuffer;if(C.isWebGLCubeRenderTarget&&Le!==void 0&&(Oe=Oe[Le]),Oe){$.bindFramebuffer(L.FRAMEBUFFER,Oe);try{const He=C.texture,Ke=He.format,je=He.type;if(!H.textureFormatReadable(Ke))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!H.textureTypeReadable(je))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(W>=0&&W<=C.width-re&&ne>=0&&ne<=C.height-Z){const Xe=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,Xe),L.bufferData(L.PIXEL_PACK_BUFFER,Se.byteLength,L.STREAM_READ),L.readPixels(W,ne,re,Z,Re.convert(Ke),Re.convert(je),0),L.flush();const dt=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);await sv(L,dt,4);try{L.bindBuffer(L.PIXEL_PACK_BUFFER,Xe),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,Se)}finally{L.deleteBuffer(Xe),L.deleteSync(dt)}return Se}}finally{const He=E!==null?le.get(E).__webglFramebuffer:null;$.bindFramebuffer(L.FRAMEBUFFER,He)}}},this.copyFramebufferToTexture=function(C,W=null,ne=0){C.isTexture!==!0&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),W=arguments[0]||null,C=arguments[1]);const re=Math.pow(2,-ne),Z=Math.floor(C.image.width*re),Se=Math.floor(C.image.height*re),Le=W!==null?W.x:0,Oe=W!==null?W.y:0;k.setTexture2D(C,0),L.copyTexSubImage2D(L.TEXTURE_2D,ne,0,0,Le,Oe,Z,Se),$.unbindTexture()},this.copyTextureToTexture=function(C,W,ne=null,re=null,Z=0){C.isTexture!==!0&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),re=arguments[0]||null,C=arguments[1],W=arguments[2],Z=arguments[3]||0,ne=null);let Se,Le,Oe,He,Ke,je;ne!==null?(Se=ne.max.x-ne.min.x,Le=ne.max.y-ne.min.y,Oe=ne.min.x,He=ne.min.y):(Se=C.image.width,Le=C.image.height,Oe=0,He=0),re!==null?(Ke=re.x,je=re.y):(Ke=0,je=0);const Xe=Re.convert(W.format),dt=Re.convert(W.type);k.setTexture2D(W,0),L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,W.flipY),L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),L.pixelStorei(L.UNPACK_ALIGNMENT,W.unpackAlignment);const wt=L.getParameter(L.UNPACK_ROW_LENGTH),At=L.getParameter(L.UNPACK_IMAGE_HEIGHT),dn=L.getParameter(L.UNPACK_SKIP_PIXELS),mt=L.getParameter(L.UNPACK_SKIP_ROWS),We=L.getParameter(L.UNPACK_SKIP_IMAGES),jt=C.isCompressedTexture?C.mipmaps[Z]:C.image;L.pixelStorei(L.UNPACK_ROW_LENGTH,jt.width),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,jt.height),L.pixelStorei(L.UNPACK_SKIP_PIXELS,Oe),L.pixelStorei(L.UNPACK_SKIP_ROWS,He),C.isDataTexture?L.texSubImage2D(L.TEXTURE_2D,Z,Ke,je,Se,Le,Xe,dt,jt.data):C.isCompressedTexture?L.compressedTexSubImage2D(L.TEXTURE_2D,Z,Ke,je,jt.width,jt.height,Xe,jt.data):L.texSubImage2D(L.TEXTURE_2D,Z,Ke,je,Xe,dt,jt),L.pixelStorei(L.UNPACK_ROW_LENGTH,wt),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,At),L.pixelStorei(L.UNPACK_SKIP_PIXELS,dn),L.pixelStorei(L.UNPACK_SKIP_ROWS,mt),L.pixelStorei(L.UNPACK_SKIP_IMAGES,We),Z===0&&W.generateMipmaps&&L.generateMipmap(L.TEXTURE_2D),$.unbindTexture()},this.copyTextureToTexture3D=function(C,W,ne=null,re=null,Z=0){C.isTexture!==!0&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),ne=arguments[0]||null,re=arguments[1]||null,C=arguments[2],W=arguments[3],Z=arguments[4]||0);let Se,Le,Oe,He,Ke,je,Xe,dt,wt;const At=C.isCompressedTexture?C.mipmaps[Z]:C.image;ne!==null?(Se=ne.max.x-ne.min.x,Le=ne.max.y-ne.min.y,Oe=ne.max.z-ne.min.z,He=ne.min.x,Ke=ne.min.y,je=ne.min.z):(Se=At.width,Le=At.height,Oe=At.depth,He=0,Ke=0,je=0),re!==null?(Xe=re.x,dt=re.y,wt=re.z):(Xe=0,dt=0,wt=0);const dn=Re.convert(W.format),mt=Re.convert(W.type);let We;if(W.isData3DTexture)k.setTexture3D(W,0),We=L.TEXTURE_3D;else if(W.isDataArrayTexture||W.isCompressedArrayTexture)k.setTexture2DArray(W,0),We=L.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,W.flipY),L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),L.pixelStorei(L.UNPACK_ALIGNMENT,W.unpackAlignment);const jt=L.getParameter(L.UNPACK_ROW_LENGTH),_t=L.getParameter(L.UNPACK_IMAGE_HEIGHT),Yn=L.getParameter(L.UNPACK_SKIP_PIXELS),ro=L.getParameter(L.UNPACK_SKIP_ROWS),Ui=L.getParameter(L.UNPACK_SKIP_IMAGES);L.pixelStorei(L.UNPACK_ROW_LENGTH,At.width),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,At.height),L.pixelStorei(L.UNPACK_SKIP_PIXELS,He),L.pixelStorei(L.UNPACK_SKIP_ROWS,Ke),L.pixelStorei(L.UNPACK_SKIP_IMAGES,je),C.isDataTexture||C.isData3DTexture?L.texSubImage3D(We,Z,Xe,dt,wt,Se,Le,Oe,dn,mt,At.data):W.isCompressedArrayTexture?L.compressedTexSubImage3D(We,Z,Xe,dt,wt,Se,Le,Oe,dn,At.data):L.texSubImage3D(We,Z,Xe,dt,wt,Se,Le,Oe,dn,mt,At),L.pixelStorei(L.UNPACK_ROW_LENGTH,jt),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,_t),L.pixelStorei(L.UNPACK_SKIP_PIXELS,Yn),L.pixelStorei(L.UNPACK_SKIP_ROWS,ro),L.pixelStorei(L.UNPACK_SKIP_IMAGES,Ui),Z===0&&W.generateMipmaps&&L.generateMipmap(We),$.unbindTexture()},this.initRenderTarget=function(C){le.get(C).__webglFramebuffer===void 0&&k.setupRenderTarget(C)},this.initTexture=function(C){C.isCubeTexture?k.setTextureCube(C,0):C.isData3DTexture?k.setTexture3D(C,0):C.isDataArrayTexture||C.isCompressedArrayTexture?k.setTexture2DArray(C,0):k.setTexture2D(C,0),$.unbindTexture()},this.resetState=function(){A=0,b=0,E=null,$.reset(),rt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Vn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===Ra?"display-p3":"srgb",t.unpackColorSpace=ht.workingColorSpace===$r?"display-p3":"srgb"}}class Ua{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Pe(e),this.density=t}clone(){return new Ua(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Oa{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Pe(e),this.near=t,this.far=n}clone(){return new Oa(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Fa extends ct{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 _n,this.environmentIntensity=1,this.environmentRotation=new _n,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 ka{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Pr,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=vn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return uu("THREE.InterleavedBuffer: 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.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;ie.far||t.push({distance:l,point:Qs.clone(),uv:mn.getInterpolation(Qs,Co,tr,Po,Hh,Dl,Gh,new se),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Ro(s,e,t,n,i,r){Is.subVectors(s,t).addScalar(.5).multiply(n),i!==void 0?(er.x=r*Is.x-i*Is.y,er.y=i*Is.x+r*Is.y):er.copy(Is),s.copy(e),s.x+=er.x,s.y+=er.y,s.applyMatrix4(Mp)}const Io=new N,Wh=new N;class Sp extends ct{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){Io.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Io);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Io.setFromMatrixPosition(e.matrixWorld),Wh.setFromMatrixPosition(this.matrixWorld);const n=Io.distanceTo(Wh)/e.zoom;t[0].object.visible=!0;let i,r;for(i=1,r=t.length;i=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i=n.length&&n.push({start:-1,count:-1,z:-1});const r=n[this.index];i.push(r),this.index++,r.start=e.start,r.count=e.count,r.z=t}reset(){this.list.length=0,this.index=0}}const Ns="batchId",Mi=new qe,Fl=new qe,vM=new qe,_M=new Pe(1,1,1),Qh=new qe,kl=new Yr,Do=new sn,Hi=new Zt,sr=new N,ed=new N,yM=new N,Bl=new gM,Yt=new Nt,Uo=[];function xM(s,e,t=0){const n=e.itemSize;if(s.isInterleavedBufferAttribute||s.array.constructor!==e.array.constructor){const i=s.count;for(let r=0;r65536?new Uint32Array(r):new Uint16Array(r);t.setIndex(new pt(a,1))}const o=i>65536?new Uint32Array(n):new Uint16Array(n);t.setAttribute(Ns,new pt(o,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(Ns))throw new Error(`BatchedMesh: Geometry cannot use attribute "${Ns}"`);const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(n===Ns)continue;if(!e.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new sn);const e=this._geometryCount,t=this.boundingBox,n=this._active;t.makeEmpty();for(let i=0;i=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let r=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(r=o[o.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,r===null?i.vertexStart=0:i.vertexStart=r.vertexStart+r.vertexCount;const c=e.getIndex(),u=c!==null;if(u&&(n===-1?i.indexCount=c.count:i.indexCount=n,r===null?i.indexStart=0:i.indexStart=r.indexStart+r.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._visibility,d=this._active,f=this._matricesTexture,g=this._matricesTexture.image.data,v=this._colorsTexture;h.push(!0),d.push(!0);const m=this._geometryCount;this._geometryCount++,vM.toArray(g,m*16),f.needsUpdate=!0,v!==null&&(_M.toArray(v.image.data,m*4),v.needsUpdate=!0),o.push(i),a.push({start:u?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new sn,sphereInitialized:!1,sphere:new Zt});const p=this.geometry.getAttribute(Ns);for(let y=0;y=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=n.getIndex()!==null,r=n.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const f in n.attributes){if(f===Ns)continue;const g=t.getAttribute(f),v=n.getAttribute(f);xM(g,v,l);const m=g.itemSize;for(let p=g.count,y=c;p=t.length||t[e]===!1?this:(t[e]=!1,this._visibilityChanged=!0,this)}getInstanceCountAt(e){return this._multiDrawInstances===null?null:this._multiDrawInstances[e]}setInstanceCountAt(e,t){return this._multiDrawInstances===null&&(this._multiDrawInstances=new Int32Array(this._maxGeometryCount).fill(1)),this._multiDrawInstances[e]=t,e}getBoundingBoxAt(e,t){if(this._active[e]===!1)return null;const i=this._bounds[e],r=i.box,o=this.geometry;if(i.boxInitialized===!1){r.makeEmpty();const a=o.index,l=o.attributes.position,c=this._drawRanges[e];for(let u=c.start,h=c.start+c.count;u=o||n[e]===!1?this:(t.toArray(r,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const n=this._active,i=this._matricesTexture.image.data,r=this._geometryCount;return e>=r||n[e]===!1?null:t.fromArray(i,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const n=this._active,i=this._colorsTexture,r=this._colorsTexture.image.data,o=this._geometryCount;return e>=o||n[e]===!1?this:(t.toArray(r,e*4),i.needsUpdate=!0,this)}getColorAt(e,t){const n=this._active,i=this._colorsTexture.image.data,r=this._geometryCount;return e>=r||n[e]===!1?null:t.fromArray(i,e*4)}setVisibleAt(e,t){const n=this._visibility,i=this._active,r=this._geometryCount;return e>=r||i[e]===!1||n[e]===t?this:(n[e]=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._visibility,n=this._active,i=this._geometryCount;return e>=i||n[e]===!1?!1:t[e]}raycast(e,t){const n=this._visibility,i=this._active,r=this._drawRanges,o=this._geometryCount,a=this.matrixWorld,l=this.geometry;Yt.material=this.material,Yt.geometry.index=l.index,Yt.geometry.attributes=l.attributes,Yt.geometry.boundingBox===null&&(Yt.geometry.boundingBox=new sn),Yt.geometry.boundingSphere===null&&(Yt.geometry.boundingSphere=new Zt);for(let c=0;c({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._visibility=e._visibility.slice(),this._active=e._active.slice(),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxGeometryCount=e._maxGeometryCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._active,c=this._visibility,u=this._multiDrawStarts,h=this._multiDrawCounts,d=this._drawRanges,f=this.perObjectFrustumCulled;f&&(Qh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),kl.setFromProjectionMatrix(Qh,e.coordinateSystem));let g=0;if(this.sortObjects){Fl.copy(this.matrixWorld).invert(),sr.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Fl),ed.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Fl);for(let p=0,y=c.length;p0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;rn)return;zl.applyMatrix4(s.matrixWorld);const l=e.ray.origin.distanceTo(zl);if(!(le.far))return{distance:l,point:nd.clone().applyMatrix4(s.matrixWorld),index:i,face:null,faceIndex:null,object:s}}const id=new N,sd=new N;class qn extends Pi{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,n=[];for(let i=0,r=t.count;i0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=i.length;ri.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class MM extends Pt{constructor(e,t,n,i,r,o,a,l,c){super(e,t,n,i,r,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Ot,this.magFilter=r!==void 0?r:Ot,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class bM extends Pt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Gt,this.minFilter=Gt,this.generateMipmaps=!1,this.needsUpdate=!0}}class za extends Pt{constructor(e,t,n,i,r,o,a,l,c,u,h,d){super(null,o,a,l,c,u,i,r,h,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class SM extends za{constructor(e,t,n,i,r,o){super(e,t,n,r,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Mn,this.layerUpdates=new Set}addLayerUpdates(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class wM extends za{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,ai),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class AM extends Pt{constructor(e,t,n,i,r,o,a,l,c){super(e,t,n,i,r,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Dn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let o;t?o=t:o=e*n[r-1];let a=0,l=r-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=n[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===o)return i/(r-1);const u=n[i],d=n[i+1]-u,f=(o-u)/d;return(i+f)/(r-1)}getTangent(e,t){let i=e-1e-4,r=e+1e-4;i<0&&(i=0),r>1&&(r=1);const o=this.getPoint(i),a=this.getPoint(r),l=t||(o.isVector2?new se:new N);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new N,i=[],r=[],o=[],a=new N,l=new qe;for(let f=0;f<=e;f++){const g=f/e;i[f]=this.getTangentAt(g,new N)}r[0]=new N,o[0]=new N;let c=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);u<=c&&(c=u,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),d<=c&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),o[0].crossVectors(i[0],r[0]);for(let f=1;f<=e;f++){if(r[f]=r[f-1].clone(),o[f]=o[f-1].clone(),a.crossVectors(i[f-1],i[f]),a.length()>Number.EPSILON){a.normalize();const g=Math.acos(Et(i[f-1].dot(i[f]),-1,1));r[f].applyMatrix4(l.makeRotationAxis(a,g))}o[f].crossVectors(i[f],r[f])}if(t===!0){let f=Math.acos(Et(r[0].dot(r[e]),-1,1));f/=e,i[0].dot(a.crossVectors(r[0],r[e]))>0&&(f=-f);for(let g=1;g<=e;g++)r[g].applyMatrix4(l.makeRotationAxis(i[g],f*g)),o[g].crossVectors(i[g],r[g])}return{tangents:i,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Va extends Dn{constructor(e=0,t=0,n=1,i=1,r=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new se){const n=t,i=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(a)/r)+1)*r:l===0&&a===r-1&&(a=r-2,l=1);let c,u;this.closed||a>0?c=i[(a-1)%r]:(zo.subVectors(i[0],i[1]).add(i[0]),c=zo);const h=i[a%r],d=i[(a+1)%r];if(this.closed||a+2i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(ad(a,l.x,c.x,u.x,h.x),ad(a,l.y,c.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const o=i[r]-n,a=this.curves[r],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Zr extends it{constructor(e=[new se(0,-.5),new se(.5,0),new se(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Et(i,0,Math.PI*2);const r=[],o=[],a=[],l=[],c=[],u=1/t,h=new N,d=new se,f=new N,g=new N,v=new N;let m=0,p=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:m=e[y+1].x-e[y].x,p=e[y+1].y-e[y].y,f.x=p*1,f.y=-m,f.z=p*0,v.copy(f),f.normalize(),l.push(f.x,f.y,f.z);break;case e.length-1:l.push(v.x,v.y,v.z);break;default:m=e[y+1].x-e[y].x,p=e[y+1].y-e[y].y,f.x=p*1,f.y=-m,f.z=p*0,g.copy(f),f.x+=v.x,f.y+=v.y,f.z+=v.z,f.normalize(),l.push(f.x,f.y,f.z),v.copy(g)}for(let y=0;y<=t;y++){const _=n+y*u*i,x=Math.sin(_),A=Math.cos(_);for(let b=0;b<=e.length-1;b++){h.x=e[b].x*x,h.y=e[b].y,h.z=e[b].x*A,o.push(h.x,h.y,h.z),d.x=y/t,d.y=b/(e.length-1),a.push(d.x,d.y);const E=l[3*b+0]*x,I=l[3*b+1],w=l[3*b+0]*A;c.push(E,I,w)}}for(let y=0;y0&&_(!0),t>0&&_(!1)),this.setIndex(u),this.setAttribute("position",new Ne(h,3)),this.setAttribute("normal",new Ne(d,3)),this.setAttribute("uv",new Ne(f,2));function y(){const x=new N,A=new N;let b=0;const E=(t-e)/n;for(let I=0;I<=r;I++){const w=[],M=I/r,F=M*(t-e)+e;for(let V=0;V<=i;V++){const G=V/i,q=G*l+a,ae=Math.sin(q),Q=Math.cos(q);A.x=F*ae,A.y=-M*n+m,A.z=F*Q,h.push(A.x,A.y,A.z),x.set(ae,E,Q).normalize(),d.push(x.x,x.y,x.z),f.push(G,1-M),w.push(g++)}v.push(w)}for(let I=0;I.9&&E<.1&&(_<.2&&(o[y+0]+=1),x<.2&&(o[y+2]+=1),A<.2&&(o[y+4]+=1))}}function d(y){r.push(y.x,y.y,y.z)}function f(y,_){const x=y*3;_.x=e[x+0],_.y=e[x+1],_.z=e[x+2]}function g(){const y=new N,_=new N,x=new N,A=new N,b=new se,E=new se,I=new se;for(let w=0,M=0;w80*t){a=c=s[0],l=u=s[1];for(let g=t;gc&&(c=h),d>u&&(u=d);f=Math.max(c-a,u-l),f=f!==0?32767/f:0}return Lr(r,o,t,a,l,f,0),o}};function Up(s,e,t,n,i){let r,o;if(i===ZM(s,e,t,n)>0)for(r=e;r=e;r-=n)o=ld(r,s[r],s[r+1],o);return o&&Xa(o,o.next)&&(Dr(o),o=o.next),o}function ls(s,e){if(!s)return s;e||(e=s);let t=s,n;do if(n=!1,!t.steiner&&(Xa(t,t.next)||St(t.prev,t,t.next)===0)){if(Dr(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Lr(s,e,t,n,i,r,o){if(!s)return;!o&&r&&GM(s,n,i,r);let a=s,l,c;for(;s.prev!==s.next;){if(l=s.prev,c=s.next,r?UM(s,n,i,r):DM(s)){e.push(l.i/t|0),e.push(s.i/t|0),e.push(c.i/t|0),Dr(s),s=c.next,a=c.next;continue}if(s=c,s===a){o?o===1?(s=OM(ls(s),e,t),Lr(s,e,t,n,i,r,2)):o===2&&FM(s,e,t,n,i,r):Lr(ls(s),e,t,n,i,r,1);break}}}function DM(s){const e=s.prev,t=s,n=s.next;if(St(e,t,n)>=0)return!1;const i=e.x,r=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=ir?i>o?i:o:r>o?r:o,f=a>l?a>c?a:c:l>c?l:c;let g=n.next;for(;g!==e;){if(g.x>=u&&g.x<=d&&g.y>=h&&g.y<=f&&ks(i,a,r,l,o,c,g.x,g.y)&&St(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function UM(s,e,t,n){const i=s.prev,r=s,o=s.next;if(St(i,r,o)>=0)return!1;const a=i.x,l=r.x,c=o.x,u=i.y,h=r.y,d=o.y,f=al?a>c?a:c:l>c?l:c,m=u>h?u>d?u:d:h>d?h:d,p=Dc(f,g,e,t,n),y=Dc(v,m,e,t,n);let _=s.prevZ,x=s.nextZ;for(;_&&_.z>=p&&x&&x.z<=y;){if(_.x>=f&&_.x<=v&&_.y>=g&&_.y<=m&&_!==i&&_!==o&&ks(a,u,l,h,c,d,_.x,_.y)&&St(_.prev,_,_.next)>=0||(_=_.prevZ,x.x>=f&&x.x<=v&&x.y>=g&&x.y<=m&&x!==i&&x!==o&&ks(a,u,l,h,c,d,x.x,x.y)&&St(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;_&&_.z>=p;){if(_.x>=f&&_.x<=v&&_.y>=g&&_.y<=m&&_!==i&&_!==o&&ks(a,u,l,h,c,d,_.x,_.y)&&St(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;x&&x.z<=y;){if(x.x>=f&&x.x<=v&&x.y>=g&&x.y<=m&&x!==i&&x!==o&&ks(a,u,l,h,c,d,x.x,x.y)&&St(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function OM(s,e,t){let n=s;do{const i=n.prev,r=n.next.next;!Xa(i,r)&&Op(i,n,n.next,r)&&Nr(i,r)&&Nr(r,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(r.i/t|0),Dr(n),Dr(n.next),n=s=r),n=n.next}while(n!==s);return ls(n)}function FM(s,e,t,n,i,r){let o=s;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&XM(o,a)){let l=Fp(o,a);o=ls(o,o.next),l=ls(l,l.next),Lr(o,e,t,n,i,r,0),Lr(l,e,t,n,i,r,0);return}a=a.next}o=o.next}while(o!==s)}function kM(s,e,t,n){const i=[];let r,o,a,l,c;for(r=0,o=e.length;r=t.next.y&&t.next.y!==t.y){const d=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=r&&d>n&&(n=d,i=t.x=t.x&&t.x>=l&&r!==t.x&&ks(oi.x||t.x===i.x&&HM(i,t)))&&(i=t,u=h)),t=t.next;while(t!==a);return i}function HM(s,e){return St(s.prev,s,e.prev)<0&&St(e.next,s,s.next)<0}function GM(s,e,t,n){let i=s;do i.z===0&&(i.z=Dc(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,WM(i)}function WM(s){let e,t,n,i,r,o,a,l,c=1;do{for(t=s,s=null,r=null,o=0;t;){for(o++,n=t,a=0,e=0;e0||l>0&&n;)a!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,l--),r?r.nextZ=i:s=i,i.prevZ=r,r=i;t=n}r.nextZ=null,c*=2}while(o>1);return s}function Dc(s,e,t,n,i){return s=(s-t)*i|0,e=(e-n)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,s|e<<1}function $M(s){let e=s,t=s;do(e.x=(s-o)*(r-a)&&(s-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(r-a)>=(i-o)*(n-a)}function XM(s,e){return s.next.i!==e.i&&s.prev.i!==e.i&&!qM(s,e)&&(Nr(s,e)&&Nr(e,s)&&YM(s,e)&&(St(s.prev,s,e.prev)||St(s,e.prev,e))||Xa(s,e)&&St(s.prev,s,s.next)>0&&St(e.prev,e,e.next)>0)}function St(s,e,t){return(e.y-s.y)*(t.x-e.x)-(e.x-s.x)*(t.y-e.y)}function Xa(s,e){return s.x===e.x&&s.y===e.y}function Op(s,e,t,n){const i=$o(St(s,e,t)),r=$o(St(s,e,n)),o=$o(St(t,n,s)),a=$o(St(t,n,e));return!!(i!==r&&o!==a||i===0&&Wo(s,t,e)||r===0&&Wo(s,n,e)||o===0&&Wo(t,s,n)||a===0&&Wo(t,e,n))}function Wo(s,e,t){return e.x<=Math.max(s.x,t.x)&&e.x>=Math.min(s.x,t.x)&&e.y<=Math.max(s.y,t.y)&&e.y>=Math.min(s.y,t.y)}function $o(s){return s>0?1:s<0?-1:0}function qM(s,e){let t=s;do{if(t.i!==s.i&&t.next.i!==s.i&&t.i!==e.i&&t.next.i!==e.i&&Op(t,t.next,s,e))return!0;t=t.next}while(t!==s);return!1}function Nr(s,e){return St(s.prev,s,s.next)<0?St(s,e,s.next)>=0&&St(s,s.prev,e)>=0:St(s,e,s.prev)<0||St(s,s.next,e)<0}function YM(s,e){let t=s,n=!1;const i=(s.x+e.x)/2,r=(s.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&i<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==s);return n}function Fp(s,e){const t=new Uc(s.i,s.x,s.y),n=new Uc(e.i,e.x,e.y),i=s.next,r=e.prev;return s.next=e,e.prev=s,t.next=i,i.prev=t,n.next=t,t.prev=n,r.next=n,n.prev=r,n}function ld(s,e,t,n){const i=new Uc(s,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Dr(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Uc(s,e,t){this.i=s,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ZM(s,e,t,n){let i=0;for(let r=e,o=t-n;r2&&s[e-1].equals(s[0])&&s.pop()}function ud(s,e){for(let t=0;tNumber.EPSILON){const ce=Math.sqrt(ee),ve=Math.sqrt(P*P+S*S),Ve=K.x-O/ce,Ee=K.y+k/ce,Te=H.x-S/ve,Qe=H.y+P/ve,xe=((Te-Ve)*S-(Qe-Ee)*P)/(k*S-O*P);$=Ve+k*xe-X.x,te=Ee+O*xe-X.y;const Ue=$*$+te*te;if(Ue<=2)return new se($,te);le=Math.sqrt(Ue/2)}else{let ce=!1;k>Number.EPSILON?P>Number.EPSILON&&(ce=!0):k<-Number.EPSILON?P<-Number.EPSILON&&(ce=!0):Math.sign(O)===Math.sign(S)&&(ce=!0),ce?($=-O,te=k,le=Math.sqrt(ee)):($=k,te=O,le=Math.sqrt(ee/2))}return new se($/le,te/le)}const Me=[];for(let X=0,K=q.length,H=K-1,$=X+1;X=0;X--){const K=X/m,H=f*Math.cos(K*Math.PI/2),$=g*Math.sin(K*Math.PI/2)+v;for(let te=0,le=q.length;te=0;){const $=H;let te=H-1;te<0&&(te=X.length-1);for(let le=0,k=u+m*2;le0)&&f.push(_,x,b),(p!==n-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}}class Hp extends Kt{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Pe(16777215),this.specular=new Pe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ii,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new _n,this.combine=Gr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,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.flatShading=e.flatShading,this.fog=e.fog,this}}class Gp extends Kt{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Pe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ii,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,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.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class Wp extends Kt{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ii,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class $p extends Kt{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ii,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new _n,this.combine=Gr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,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.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,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.flatShading=e.flatShading,this.fog=e.fog,this}}class Xp extends Kt{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Pe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ii,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class qp extends rn{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Qi(s,e,t){return!s||!t&&s.constructor===e?s:typeof e.BYTES_PER_ELEMENT=="number"?new e(s):Array.prototype.slice.call(s)}function Yp(s){return ArrayBuffer.isView(s)&&!(s instanceof DataView)}function Zp(s){function e(i,r){return s[i]-s[r]}const t=s.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function Oc(s,e,t){const n=s.length,i=new s.constructor(n);for(let r=0,o=0;o!==n;++r){const a=t[r]*e;for(let l=0;l!==e;++l)i[o++]=s[a+l]}return i}function Cu(s,e,t,n){let i=1,r=s[0];for(;r!==void 0&&r[n]===void 0;)r=s[i++];if(r===void 0)return;let o=r[n];if(o!==void 0)if(Array.isArray(o))do o=r[n],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=s[i++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[n],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=s[i++];while(r!==void 0);else do o=r[n],o!==void 0&&(e.push(r.time),t.push(o)),r=s[i++];while(r!==void 0)}function QM(s,e,t,n,i=30){const r=s.clone();r.name=e;const o=[];for(let l=0;l=n)){h.push(c.times[f]);for(let v=0;vr.tracks[l].times[0]&&(a=r.tracks[l].times[0]);for(let l=0;l=a.times[g]){const p=g*h+u,y=p+h-u;v=a.values.slice(p,y)}else{const p=a.createInterpolant(),y=u,_=h-u;p.evaluate(r),v=p.resultBuffer.slice(y,_)}l==="quaternion"&&new hn().fromArray(v).normalize().conjugate().toArray(v);const m=c.times.length;for(let p=0;p=r)){const a=t[1];e=r)break t}o=n,n=0;break n}break e}for(;n>>1;et;)--o;if(++o,r!==0||o!==i){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=n.slice(r,o),this.values=this.values.slice(r*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 n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const l=n[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(i!==void 0&&Yp(i))for(let a=0,l=i.length;a!==l;++a){const c=i[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(),n=this.getValueSize(),i=this.getInterpolation()===ca,r=e.length-1;let o=1;for(let a=1;a0){e[o]=e[r];for(let a=r*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Un.prototype.TimeBufferType=Float32Array;Un.prototype.ValueBufferType=Float32Array;Un.prototype.DefaultInterpolation=ya;class us extends Un{constructor(e,t,n){super(e,t,n)}}us.prototype.ValueTypeName="bool";us.prototype.ValueBufferType=Array;us.prototype.DefaultInterpolation=wr;us.prototype.InterpolantFactoryMethodLinear=void 0;us.prototype.InterpolantFactoryMethodSmooth=void 0;class Ru extends Un{}Ru.prototype.ValueTypeName="color";class Ur extends Un{}Ur.prototype.ValueTypeName="number";class jp extends jr{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t);let c=e*a;for(let u=c+a;c!==u;c+=4)hn.slerpFlat(r,0,o,c-a,o,c,l);return r}}class Qr extends Un{InterpolantFactoryMethodLinear(e){return new jp(this.times,this.values,this.getValueSize(),e)}}Qr.prototype.ValueTypeName="quaternion";Qr.prototype.InterpolantFactoryMethodSmooth=void 0;class hs extends Un{constructor(e,t,n){super(e,t,n)}}hs.prototype.ValueTypeName="string";hs.prototype.ValueBufferType=Array;hs.prototype.DefaultInterpolation=wr;hs.prototype.InterpolantFactoryMethodLinear=void 0;hs.prototype.InterpolantFactoryMethodSmooth=void 0;class Or extends Un{}Or.prototype.ValueTypeName="vector";class Fr{constructor(e="",t=-1,n=[],i=Pa){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=vn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(ib(n[o]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=n.length;r!==o;++r)t.push(Un.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,o=[];for(let a=0;a1){const h=u[1];let d=i[h];d||(i[h]=d=[]),d.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,d,f,g,v){if(f.length!==0){const m=[],p=[];Cu(f,m,p,g),m.length!==0&&v.push(new h(d,m,p))}},i=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h{t&&t(r),this.manager.itemEnd(e)},0),r;if(ei[e]!==void 0){ei[e].push({onLoad:t,onProgress:n,onError:i});return}ei[e]=[],ei[e].push({onLoad:t,onProgress:n,onError:i});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=ei[e],h=c.body.getReader(),d=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=d?parseInt(d):0,g=f!==0;let v=0;const m=new ReadableStream({start(p){y();function y(){h.read().then(({done:_,value:x})=>{if(_)p.close();else{v+=x.byteLength;const A=new ProgressEvent("progress",{lengthComputable:g,loaded:v,total:f});for(let b=0,E=u.length;b{p.error(_)})}}});return new Response(m)}else throw new sb(`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 h=/charset="?([^;"\s]*)"?/i.exec(a),d=h&&h[1]?h[1].toLowerCase():void 0,f=new TextDecoder(d);return c.arrayBuffer().then(g=>f.decode(g))}}}).then(c=>{ii.add(e,c);const u=ei[e];delete ei[e];for(let h=0,d=u.length;h{const u=ei[e];if(u===void 0)throw this.manager.itemError(e),c;delete ei[e];for(let h=0,d=u.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class rb extends on{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new $n(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(r.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const r in e.uniforms){const o=e.uniforms[r];switch(i.uniforms[r]={},o.type){case"t":i.uniforms[r].value=n(o.value);break;case"c":i.uniforms[r].value=new Pe().setHex(o.value);break;case"v2":i.uniforms[r].value=new se().fromArray(o.value);break;case"v3":i.uniforms[r].value=new N().fromArray(o.value);break;case"v4":i.uniforms[r].value=new gt().fromArray(o.value);break;case"m3":i.uniforms[r].value=new Ze().fromArray(o.value);break;case"m4":i.uniforms[r].value=new qe().fromArray(o.value);break;default:i.uniforms[r].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const r in e.extensions)i.extensions[r]=e.extensions[r];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let r=e.normalScale;Array.isArray(r)===!1&&(r=[r,r]),i.normalScale=new se().fromArray(r)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new se().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:Bp,SpriteMaterial:_u,RawShaderMaterial:zp,ShaderMaterial:Ln,PointsMaterial:xu,MeshPhysicalMaterial:Vp,MeshStandardMaterial:Eu,MeshPhongMaterial:Hp,MeshToonMaterial:Gp,MeshNormalMaterial:Wp,MeshLambertMaterial:$p,MeshDepthMaterial:gu,MeshDistanceMaterial:vu,MeshBasicMaterial:hi,MeshMatcapMaterial:Xp,LineDashedMaterial:qp,LineBasicMaterial:rn,Material:Kt};return new t[e]}}class Fc{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 n=0,i=e.length;n0){const l=new Iu(t);r=new kr(l),r.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){i=new kr(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o{const m=new sn;m.min.fromArray(v.boxMin),m.max.fromArray(v.boxMax);const p=new Zt;return p.radius=v.sphereRadius,p.center.fromArray(v.sphereCenter),{boxInitialized:v.boxInitialized,box:m,sphereInitialized:v.sphereInitialized,sphere:p}}),o._maxGeometryCount=e.maxGeometryCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new Sp;break;case"Line":o=new Pi(a(e.geometry),l(e.material));break;case"LineLoop":o=new Ep(a(e.geometry),l(e.material));break;case"LineSegments":o=new qn(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new Cp(a(e.geometry),l(e.material));break;case"Sprite":o=new bp(l(e.material));break;case"Group":o=new Fs;break;case"Bone":o=new yu;break;default:o=new ct}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const d=e.children;for(let f=0;f"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,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=ii.get(e);if(o!==void 0){if(r.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),r.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){t&&t(o),r.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(r.options,{colorSpaceConversion:"none"}))}).then(function(c){return ii.add(e,c),t&&t(c),r.manager.itemEnd(e),c}).catch(function(c){i&&i(c),ii.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});ii.add(e,l),r.manager.itemStart(e)}}let Xo;class Nu{static getContext(){return Xo===void 0&&(Xo=new(window.AudioContext||window.webkitAudioContext)),Xo}static setContext(e){Xo=e}}class gb extends on{constructor(e){super(e)}load(e,t,n,i){const r=this,o=new $n(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);Nu.getContext().decodeAudioData(c,function(h){t(h)}).catch(a)}catch(c){a(c)}},n,i);function a(l){i?i(l):console.error(l),r.manager.itemError(e)}}}const _d=new qe,yd=new qe,Gi=new qe;class vb{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ut,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ut,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Gi.copy(e.projectionMatrix);const i=t.eyeSep/2,r=i*t.near/t.focus,o=t.near*Math.tan(ns*t.fov*.5)/t.zoom;let a,l;yd.elements[12]=-i,_d.elements[12]=i,a=-o*t.aspect+r,l=o*t.aspect+r,Gi.elements[0]=2*t.near/(l-a),Gi.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Gi),a=-o*t.aspect-r,l=o*t.aspect-r,Gi.elements[0]=2*t.near/(l-a),Gi.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Gi)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(yd),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(_d)}}class nl{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=xd(),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=xd();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function xd(){return(typeof performance>"u"?Date:performance).now()}const Wi=new N,Md=new hn,_b=new N,$i=new N;class yb extends ct{constructor(){super(),this.type="AudioListener",this.context=Nu.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new nl}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,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Wi,Md,_b),$i.set(0,0,-1).applyQuaternion(Md),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Wi.x,i),t.positionY.linearRampToValueAtTime(Wi.y,i),t.positionZ.linearRampToValueAtTime(Wi.z,i),t.forwardX.linearRampToValueAtTime($i.x,i),t.forwardY.linearRampToValueAtTime($i.y,i),t.forwardZ.linearRampToValueAtTime($i.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Wi.x,Wi.y,Wi.z),t.setOrientation($i.x,$i.y,$i.z,n.x,n.y,n.z)}}class um extends ct{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(){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.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&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,o=i;r!==o;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let o=0;o!==r;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){hn.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const o=this._workIndex*r;hn.multiplyQuaternionsFlat(e,o,e,t,e,n),hn.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,r){const o=1-i;for(let a=0;a!==r;++a){const l=t+a;e[l]=e[l]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const Du="\\[\\]\\.:\\/",Sb=new RegExp("["+Du+"]","g"),Uu="[^"+Du+"]",wb="[^"+Du.replace("\\.","")+"]",Ab=/((?:WC+[\/:])*)/.source.replace("WC",Uu),Tb=/(WCOD+)?/.source.replace("WCOD",wb),Eb=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Uu),Cb=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Uu),Pb=new RegExp("^"+Ab+Tb+Eb+Cb+"$"),Rb=["material","materials","bones","map"];class Ib{constructor(e,t,n){const i=n||lt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class lt{constructor(e,t,n){this.path=t,this.parsedPath=n||lt.parseTrackName(t),this.node=lt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new lt.Composite(e,t,n):new lt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Sb,"")}static parseTrackName(e){const t=Pb.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const r=n.nodeName.substring(i+1);Rb.indexOf(r)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=r)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(r){for(let o=0;o=r){const h=r++,d=e[h];t[d.uuid]=u,e[u]=d,t[c]=h,e[h]=l;for(let f=0,g=i;f!==g;++f){const v=n[f],m=v[h],p=v[u];v[u]=m,v[h]=p}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h0&&(t[f.uuid]=h),e[h]=f,e.pop();for(let g=0,v=i;g!==v;++g){const m=n[g];m[h]=m[d],m.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(i!==void 0)return r[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);i=r.length,n[e]=i,o.push(e),a.push(t),r.push(h);for(let d=u,f=l.length;d!==f;++d){const g=l[d];h[d]=new lt(g,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,r=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=n,o[n]=l,o.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}}class dm{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,o=r.length,a=new Array(o),l={endingStart:Ji,endingEnd:Ji};for(let c=0;c!==o;++c){const u=r[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Wf,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,r=e._clip.duration,o=r/i,a=i/r;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=r,l[1]=r+n,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const l=(e-r)*n;l<0||n===0?t=0:(this._startTime=null,t=n*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case au:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Pa:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const o=n===$f;if(e===0)return r===-1?i:o&&(r&1)===1?t-i:i;if(n===Gf){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,r+=Math.abs(a);const l=this.repetitions-r;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(r&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Ki,i.endingEnd=Ki):(e?i.endingStart=this.zeroSlopeAtStart?Ki:Ji:i.endingStart=Ar,t?i.endingEnd=this.zeroSlopeAtEnd?Ki:Ji:i.endingEnd=Ar)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,l[0]=t,a[1]=r+e,l[1]=n,this}}const Nb=new Float32Array(1);class Db extends ui{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,o=e._propertyBindings,a=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==r;++h){const d=i[h],f=d.name;let g=u[f];if(g!==void 0)++g.referenceCount,o[h]=g;else{if(g=o[h],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,l,f));continue}const v=t&&t._propertyBindings[h].binding.parsedPath;g=new hm(lt.create(n,f,v),d.ValueTypeName,d.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,l,f),o[h]=g}a[h].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,r=this._actionsByClip[i];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,e,r,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.max.y)}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}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))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ad).distanceTo(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}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 Td=new N,qo=new N;class Vb{constructor(e=new N,t=new N){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Td.subVectors(e,this.start),qo.subVectors(this.end,this.start);const n=qo.dot(qo);let r=qo.dot(Td)/n;return t&&(r=Et(r,0,1)),r}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Ed=new N;class Hb extends ct{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new it,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let h=0;h.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Ld.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Ld,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class tS extends qn{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new it;i.setAttribute("position",new Ne(t,3)),i.setAttribute("color",new Ne(n,3));const r=new rn({vertexColors:!0,toneMapped:!1});super(i,r),this.type="AxesHelper"}setColors(e,t,n){const i=new Pe,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Si{constructor(){this.type="ShapePath",this.color=new Pe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Ti,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,o){return this.currentPath.bezierCurveTo(e,t,n,i,r,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(p){const y=[];for(let _=0,x=p.length;_Number.EPSILON){if(M<0&&(E=y[b],w=-w,I=y[A],M=-M),p.yI.y)continue;if(p.y===E.y){if(p.x===E.x)return!0}else{const F=M*(p.x-E.x)-w*(p.y-E.y);if(F===0)return!0;if(F<0)continue;x=!x}}else{if(p.y!==E.y)continue;if(I.x<=p.x&&p.x<=E.x||E.x<=p.x&&p.x<=I.x)return!0}}return x}const i=Pn.isClockWise,r=this.subPaths;if(r.length===0)return[];let o,a,l;const c=[];if(r.length===1)return a=r[0],l=new Ei,l.curves=a.curves,c.push(l),c;let u=!i(r[0].getPoints());u=e?!u:u;const h=[],d=[];let f=[],g=0,v;d[g]=void 0,f[g]=[];for(let p=0,y=r.length;p1){let p=!1,y=0;for(let _=0,x=d.length;_0&&p===!1&&(f=h)}let m;for(let p=0,y=d.length;p{s.delete(i)};return{on:i=>{s.add(i);const r=()=>e(i);return Xn(r),{off:r}},off:e,trigger:(...i)=>Promise.all(Array.from(s).map(r=>r(...i)))}}function bt(s){return typeof s=="function"?s():j(s)}const Bc=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const sS=s=>s!=null,rS=Object.prototype.toString,oS=s=>rS.call(s)==="[object Object]",zc=()=>{};function aS(s,e){function t(...n){return new Promise((i,r)=>{Promise.resolve(s(()=>e.apply(this,n),{fn:e,thisArg:this,args:n})).then(i).catch(r)})}return t}function lS(s,e={}){let t,n,i=zc;const r=a=>{clearTimeout(a),i(),i=zc};return a=>{const l=bt(s),c=bt(e.maxWait);return t&&r(t),l<=0||c!==void 0&&c<=0?(n&&(r(n),n=null),Promise.resolve(a())):new Promise((u,h)=>{i=e.rejectOnCancel?h:u,c&&!n&&(n=setTimeout(()=>{t&&r(t),n=null,u(a())},c)),t=setTimeout(()=>{n&&r(n),n=null,u(a())},l)})}}function cS(s,e,t=!1){return e.reduce((n,i)=>(i in s&&(!t||s[i]!==void 0)&&(n[i]=s[i]),n),{})}function uS(s){return ma()}function hS(s,e=200,t={}){return aS(lS(e,t),s)}function Nd(s,e=200,t={}){const n=Ge(s.value),i=hS(()=>{n.value=s.value},e,t);return Ct(s,()=>i()),n}function dS(s,e={}){if(!$d(s))return Vm(s);const t=Array.isArray(s.value)?Array.from({length:s.value.length}):{};for(const n in s.value)t[n]=Hm(()=>({get(){return s.value[n]},set(i){var r;if((r=bt(e.replaceRef))!=null?r:!0)if(Array.isArray(s.value)){const a=[...s.value];a[n]=i,s.value=a}else{const a={...s.value,[n]:i};Object.setPrototypeOf(a,Object.getPrototypeOf(s.value)),s.value=a}else s.value[n]=i}}));return t}function Fu(s,e=!0,t){uS()?Nn(s,t):e?s():qc(s)}function fS(s,e=1e3,t={}){const{immediate:n=!0,immediateCallback:i=!1}=t;let r=null;const o=Ge(!1);function a(){r&&(clearInterval(r),r=null)}function l(){o.value=!1,a()}function c(){const u=bt(e);u<=0||(o.value=!0,i&&s(),a(),r=setInterval(s,u))}if(n&&Bc&&c(),$d(e)||typeof e=="function"){const u=Ct(e,()=>{o.value&&Bc&&c()});Xn(u)}return Xn(l),{isActive:o,pause:l,resume:c}}function Cn(s){var e;const t=bt(s);return(e=t==null?void 0:t.$el)!=null?e:t}const di=Bc?window:void 0;function Br(...s){let e,t,n,i;if(typeof s[0]=="string"||Array.isArray(s[0])?([t,n,i]=s,e=di):[e,t,n,i]=s,!e)return zc;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const r=[],o=()=>{r.forEach(u=>u()),r.length=0},a=(u,h,d,f)=>(u.addEventListener(h,d,f),()=>u.removeEventListener(h,d,f)),l=Ct(()=>[Cn(e),bt(i)],([u,h])=>{if(o(),!u)return;const d=oS(h)?{...h}:h;r.push(...t.flatMap(f=>n.map(g=>a(u,f,g,d))))},{immediate:!0,flush:"post"}),c=()=>{l(),o()};return Xn(c),c}function pS(){const s=Ge(!1),e=ma();return e&&Nn(()=>{s.value=!0},e),s}function il(s){const e=pS();return ke(()=>(e.value,!!s()))}function mS(s,e,t={}){const{window:n=di,...i}=t;let r;const o=il(()=>n&&"MutationObserver"in n),a=()=>{r&&(r.disconnect(),r=void 0)},l=ke(()=>{const d=bt(s),f=(Array.isArray(d)?d:[d]).map(Cn).filter(sS);return new Set(f)}),c=Ct(()=>l.value,d=>{a(),o.value&&d.size&&(r=new MutationObserver(e),d.forEach(f=>r.observe(f,i)))},{immediate:!0,flush:"post"}),u=()=>r==null?void 0:r.takeRecords(),h=()=>{a(),c()};return Xn(h),{isSupported:o,stop:h,takeRecords:u}}function ku(s,e={}){const{immediate:t=!0,fpsLimit:n=void 0,window:i=di}=e,r=Ge(!1),o=n?1e3/n:null;let a=0,l=null;function c(d){if(!r.value||!i)return;a||(a=d);const f=d-a;if(o&&ft&&"matchMedia"in t&&typeof t.matchMedia=="function");let i;const r=Ge(!1),o=c=>{r.value=c.matches},a=()=>{i&&("removeEventListener"in i?i.removeEventListener("change",o):i.removeListener(o))},l=Ri(()=>{n.value&&(a(),i=t.matchMedia(bt(s)),"addEventListener"in i?i.addEventListener("change",o):i.addListener(o),r.value=i.matches)});return Xn(()=>{l(),a(),i=void 0}),r}function vS(s={}){const{window:e=di}=s,t=Ge(1);if(e){let n=function(){t.value=e.devicePixelRatio,i(),r=e.matchMedia(`(resolution: ${t.value}dppx)`),r.addEventListener("change",n,{once:!0})},i=function(){r==null||r.removeEventListener("change",n)},r;n(),Xn(i)}return{pixelRatio:t}}function gm(s,e,t={}){const{window:n=di,...i}=t;let r;const o=il(()=>n&&"ResizeObserver"in n),a=()=>{r&&(r.disconnect(),r=void 0)},l=ke(()=>Array.isArray(s)?s.map(h=>Cn(h)):[Cn(s)]),c=Ct(l,h=>{if(a(),o.value&&n){r=new ResizeObserver(e);for(const d of h)d&&r.observe(d,i)}},{immediate:!0,flush:"post"}),u=()=>{a(),c()};return Xn(u),{isSupported:o,stop:u}}function _S(s,e={}){const{reset:t=!0,windowResize:n=!0,windowScroll:i=!0,immediate:r=!0}=e,o=Ge(0),a=Ge(0),l=Ge(0),c=Ge(0),u=Ge(0),h=Ge(0),d=Ge(0),f=Ge(0);function g(){const v=Cn(s);if(!v){t&&(o.value=0,a.value=0,l.value=0,c.value=0,u.value=0,h.value=0,d.value=0,f.value=0);return}const m=v.getBoundingClientRect();o.value=m.height,a.value=m.bottom,l.value=m.left,c.value=m.right,u.value=m.top,h.value=m.width,d.value=m.x,f.value=m.y}return gm(s,g),Ct(()=>Cn(s),v=>!v&&g()),mS(s,g,{attributeFilter:["style","class"]}),i&&Br("scroll",g,{capture:!0,passive:!0}),n&&Br("resize",g,{passive:!0}),Fu(()=>{r&&g()}),{height:o,bottom:a,left:l,right:c,top:u,width:h,x:d,y:f,update:g}}function yS(s,e={width:0,height:0},t={}){const{window:n=di,box:i="content-box"}=t,r=ke(()=>{var h,d;return(d=(h=Cn(s))==null?void 0:h.namespaceURI)==null?void 0:d.includes("svg")}),o=Ge(e.width),a=Ge(e.height),{stop:l}=gm(s,([h])=>{const d=i==="border-box"?h.borderBoxSize:i==="content-box"?h.contentBoxSize:h.devicePixelContentBoxSize;if(n&&r.value){const f=Cn(s);if(f){const g=f.getBoundingClientRect();o.value=g.width,a.value=g.height}}else if(d){const f=Array.isArray(d)?d:[d];o.value=f.reduce((g,{inlineSize:v})=>g+v,0),a.value=f.reduce((g,{blockSize:v})=>g+v,0)}else o.value=h.contentRect.width,a.value=h.contentRect.height},t);Fu(()=>{const h=Cn(s);h&&(o.value="offsetWidth"in h?h.offsetWidth:e.width,a.value="offsetHeight"in h?h.offsetHeight:e.height)});const c=Ct(()=>Cn(s),h=>{o.value=h?e.width:0,a.value=h?e.height:0});function u(){l(),c()}return{width:o,height:a,stop:u}}function xS(s){var e;const t=Ge(0);if(typeof performance>"u")return t;const n=(e=s==null?void 0:s.every)!=null?e:10;let i=performance.now(),r=0;return ku(()=>{if(r+=1,r>=n){const o=performance.now(),a=o-i;t.value=Math.round(1e3/(a/r)),i=o,r=0}}),t}function MS(s={}){const e=Ge(),t=il(()=>typeof performance<"u"&&"memory"in performance);if(t.value){const{interval:n=1e3}=s;fS(()=>{e.value=performance.memory},n,{immediate:s.immediate,immediateCallback:s.immediateCallback})}return{isSupported:t,memory:e}}const vm={x:0,y:0,pointerId:0,pressure:0,tiltX:0,tiltY:0,width:0,height:0,twist:0,pointerType:null},bS=Object.keys(vm);function SS(s={}){const{target:e=di}=s,t=Ge(!1),n=Ge(s.initialValue||{});Object.assign(n.value,vm,n.value);const i=r=>{t.value=!0,!(s.pointerTypes&&!s.pointerTypes.includes(r.pointerType))&&(n.value=cS(r,bS,!1))};if(e){const r={passive:!0};Br(e,["pointerdown","pointermove","pointerup"],i,r),Br(e,"pointerleave",()=>t.value=!1,r)}return{...dS(n),isInside:t}}function wS(s={}){const{window:e=di,initialWidth:t=Number.POSITIVE_INFINITY,initialHeight:n=Number.POSITIVE_INFINITY,listenOrientation:i=!0,includeScrollbar:r=!0}=s,o=Ge(t),a=Ge(n),l=()=>{e&&(r?(o.value=e.innerWidth,a.value=e.innerHeight):(o.value=e.document.documentElement.clientWidth,a.value=e.document.documentElement.clientHeight))};if(l(),Fu(l),Br("resize",l,{passive:!0}),i){const c=gS("(orientation: portrait)");Ct(c,()=>l())}return{width:o,height:a}}var AS=Object.defineProperty,TS=(s,e,t)=>e in s?AS(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,Dd=(s,e,t)=>(TS(s,typeof e!="symbol"?e+"":e,t),t);const ES="@tresjs/core",CS="module",PS="4.0.2",RS="pnpm@9.1.4",IS="Declarative ThreeJS using Vue Components",LS="Alvaro Saburido (https://github.com/alvarosabu/)",NS="MIT",DS=["vue","3d","threejs","three","threejs-vue"],US=!1,OS={".":{types:"./dist/index.d.ts",import:"./dist/tres.js",require:"./dist/tres.umd.cjs"},"./components":{types:"./dist/src/components/index.d.ts"},"./composables":{types:"./dist/src/composables/index.d.ts"},"./types":{types:"./dist/src/types/index.d.ts"},"./utils":{types:"./dist/src/utils/index.d.ts"},"./*":"./*"},FS="./dist/tres.js",kS="./dist/tres.js",BS="./dist/index.d.ts",zS=["*.d.ts","dist"],VS={access:"public"},HS={dev:"cd playground && npm run dev",build:"vite build",playground:"cd playground && npm run dev",test:"vitest","test:ci":"vitest run","test:ui":"vitest --ui --coverage.enabled=true",release:"release-it",coverage:"vitest run --coverage",lint:"eslint .","lint:fix":"eslint . --fix","docs:dev":"vitepress dev docs","docs:build":"vitepress build docs","docs:serve":"vitepress serve docs","docs:preview":"vitepress preview docs","docs:contributors":"esno scripts/update-contributors.ts",prepare:"node .husky/install.mjs"},GS={three:">=0.133",vue:">=3.4"},WS={"@alvarosabu/utils":"^3.2.0","@vue/devtools-api":"^6.6.2","@vueuse/core":"^10.10.0"},$S={"@release-it/conventional-changelog":"^8.0.1","@stackblitz/sdk":"^1.10.0","@tresjs/cientos":"3.9.0","@tresjs/eslint-config":"^1.1.0","@types/three":"^0.165.0","@typescript-eslint/eslint-plugin":"^7.11.0","@typescript-eslint/parser":"^7.11.0","@vitejs/plugin-vue":"^5.0.5","@vitest/coverage-c8":"^0.33.0","@vitest/coverage-v8":"^1.6.0","@vitest/ui":"^1.6.0","@vue/test-utils":"^2.4.6",eslint:"^9.4.0","eslint-plugin-vue":"^9.26.0",esno:"^4.7.0",gsap:"^3.12.5",husky:"^9.0.11",jsdom:"^24.1.0",kolorist:"^1.8.0",ohmyfetch:"^0.4.21",pathe:"^1.1.2","release-it":"^17.3.0","rollup-plugin-analyzer":"^4.0.0","rollup-plugin-copy":"^3.5.0","rollup-plugin-visualizer":"^5.12.0",three:"^0.165.0",unocss:"^0.60.4",unplugin:"^1.10.1","unplugin-vue-components":"^0.27.0",vite:"^5.2.12","vite-plugin-banner":"^0.7.1","vite-plugin-dts":"3.9.1","vite-plugin-inspect":"^0.8.4","vite-plugin-require-transform":"^1.0.21","vite-svg-loader":"^5.1.0",vitepress:"1.2.2",vitest:"^1.6.0",vue:"^3.4.27","vue-demi":"^0.14.8"},XS={name:ES,type:CS,version:PS,packageManager:RS,description:IS,author:LS,license:NS,keywords:DS,sideEffects:US,exports:OS,main:FS,module:kS,types:BS,files:zS,publishConfig:VS,scripts:HS,peerDependencies:GS,dependencies:WS,devDependencies:$S},qS=({sizes:s})=>{const e=Ge([]),t=ke(()=>e.value[0]),n=o=>{const a=o instanceof Xr?o:e.value.find(c=>c.uuid===o);if(!a)return;const l=e.value.filter(({uuid:c})=>c!==a.uuid);e.value=[a,...l]},i=(o,a=!1)=>{e.value.some(({uuid:l})=>l===o.uuid)||(a?n(o):e.value.push(o))},r=o=>{e.value=e.value.filter(({uuid:a})=>a!==o.uuid)};return Ri(()=>{s.aspectRatio.value&&e.value.forEach(o=>{!o.manual&&(o instanceof Ut||YS(o))&&(o instanceof Ut?o.aspect=s.aspectRatio.value:(o.left=s.width.value*-.5,o.right=s.width.value*.5,o.top=s.height.value*.5,o.bottom=s.height.value*-.5),o.updateProjectionMatrix())})}),Wn(()=>{e.value=[]}),{camera:t,cameras:e,registerCamera:i,deregisterCamera:r,setCameraActive:n}};function YS(s){return s.hasOwnProperty("isOrthographicCamera")&&s.isOrthographicCamera}const _m=An(),ym=An(),Bu=An(),mr=new nl;let da=0,fa=0;const{pause:ZS,resume:Ud,isActive:JS}=ku(()=>{_m.trigger({delta:da,elapsed:fa,clock:mr}),ym.trigger({delta:da,elapsed:fa,clock:mr}),Bu.trigger({delta:da,elapsed:fa,clock:mr})},{immediate:!1});Bu.on(()=>{da=mr.getDelta(),fa=mr.getElapsedTime()});let Od=!1;const KS=()=>(Od||(Od=!0,Ud()),{onBeforeLoop:_m.on,onLoop:ym.on,onAfterLoop:Bu.on,pause:ZS,resume:Ud,isActive:JS}),Qo="[TresJS ▲ ■ ●] ";function eo(){function s(...n){typeof n[0]=="string"?n[0]=Qo+n[0]:n.unshift(Qo),console.error(...n)}function e(...n){typeof n[0]=="string"?n[0]=Qo+n[0]:n.unshift(Qo),console.warn(...n)}function t(n,i){}return{logError:s,logWarning:e,logMessage:t}}function jS(s){return s instanceof Pe?s:Array.isArray(s)?new Pe(...s):new Pe(s)}class QS extends Nt{constructor(...e){super(...e),Dd(this,"type","HightlightMesh"),Dd(this,"createTime"),this.createTime=Date.now()}onBeforeRender(){const e=(Date.now()-this.createTime)/1e3,t=1+.07*Math.sin(2.5*e);this.scale.set(t,t,t)}}const xm=(s,e)=>{for(const t of Object.keys(e))e[t]instanceof Object&&Object.assign(e[t],xm(s[t],e[t]));return Object.assign(s||{},e),s},ew="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot",tw=sw(ew);function Fd(s){return s&&s.nodeType===1}function ea(s){return s.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const nw=/\B([A-Z])/g;function iw(s){return s.replace(nw,"-$1").toLowerCase()}function sw(s,e){const t=Object.create(null),n=s.split(",");for(let i=0;i!!t[i]}const kd=(s,e)=>{if(!e)return;const t=Array.isArray(e)?e:e.match(/([^[.\]])+/g);return t==null?void 0:t.reduce((n,i)=>n&&n[i],s)},rw=(s,e,t)=>{const n=Array.isArray(e)?e:e.match(/([^[.\]])+/g);n&&n.reduce((i,r,o)=>(i[r]===void 0&&(i[r]={}),o===n.length-1&&(i[r]=t),i[r]),s)};function Mm(s,e){if(Fd(s)&&Fd(e)){const i=s.attributes,r=e.attributes;return i.length!==r.length?!1:Array.from(i).every(({name:o,value:a})=>e.getAttribute(o)===a)}if(s===e)return!0;if(s===null||typeof s!="object"||e===null||typeof e!="object")return!1;const t=Object.keys(s),n=Object.keys(e);if(t.length!==n.length)return!1;for(const i of t)if(!n.includes(i)||!Mm(s[i],e[i]))return!1;return!0}function ow(s,e){if(!Array.isArray(s)||!Array.isArray(e)||s.length!==e.length)return!1;for(let t=0;t{if(l.uuid===e)return l;for(const c of l.children){const u=i(c);if(u)return u}},r=i(s);if(!r){console.warn("Object with UUID not found in the scene.");return}let o=r;for(let l=0;lzu(n)),!(s instanceof Fa)){const n=s;s&&((t=s.dispose)==null||t.call(s)),n.geometry&&(n.geometry.dispose(),delete n.geometry),Array.isArray(n.material)?(n.material.forEach(i=>Bd(i)),delete n.material):n.material&&(Bd(n.material),delete n.material)}}const uw=Number.parseInt(Hr.replace("dev","")),ta={realistic:{shadows:!0,physicallyCorrectLights:!0,outputColorSpace:ln,toneMapping:Ea,toneMappingExposure:3,shadowMap:{enabled:!0,type:jc}},flat:{toneMapping:Hn,toneMappingExposure:1}};function hw({canvas:s,options:e,contextParts:{sizes:t,render:n,invalidate:i,advance:r}}){const o=ke(()=>({alpha:bt(e.alpha)??!0,depth:bt(e.depth),canvas:Cn(s),context:bt(e.context),stencil:bt(e.stencil),antialias:bt(e.antialias)??!0,precision:bt(e.precision),powerPreference:bt(e.powerPreference),premultipliedAlpha:bt(e.premultipliedAlpha),preserveDrawingBuffer:bt(e.preserveDrawingBuffer),logarithmicDepthBuffer:bt(e.logarithmicDepthBuffer),failIfMajorPerformanceCaveat:bt(e.failIfMajorPerformanceCaveat)})),a=Rn(new ha(o.value));function l(){e.renderMode==="on-demand"&&i()}Ct(o,()=>{a.value.dispose(),a.value=new ha(o.value),l()}),Ct([t.width,t.height],()=>{a.value.setSize(t.width.value,t.height.value),l()},{immediate:!0}),Ct(()=>e.clearColor,l);const{pixelRatio:c}=vS();Ct(c,()=>{a.value.setPixelRatio(c.value)});const{logError:u}=eo(),h=(()=>{const f=new ha,g={shadowMap:{enabled:f.shadowMap.enabled,type:f.shadowMap.type},toneMapping:f.toneMapping,toneMappingExposure:f.toneMappingExposure,outputColorSpace:f.outputColorSpace};return f.dispose(),g})(),d=bt(e.renderMode);return d==="on-demand"&&i(),d==="manual"&&setTimeout(()=>{r()},100),Ri(()=>{const f=bt(e.preset);f&&(f in ta||u(`Renderer Preset must be one of these: ${Object.keys(ta).join(", ")}`),xm(a.value,ta[f])),d==="always"&&(n.frames.value=Math.max(1,n.frames.value));const g=(p,y)=>{const _=bt(p),x=()=>{if(f)return kd(ta[f],y)};if(_!==void 0)return _;const A=x();return A!==void 0?A:kd(h,y)},v=(p,y)=>rw(a.value,y,g(p,y));v(e.shadows,"shadowMap.enabled"),v(e.toneMapping??Ea,"toneMapping"),v(e.shadowMapType,"shadowMap.type"),uw<150&&v(!e.useLegacyLights,"physicallyCorrectLights"),v(e.outputColorSpace,"outputColorSpace"),v(e.toneMappingExposure,"toneMappingExposure");const m=g(e.clearColor,"clearColor");m&&a.value.setClearColor(m?jS(m):new Pe(0))}),Wn(()=>{a.value.dispose(),a.value.forceContextLoss()}),{renderer:a}}const na=s=>typeof s=="function",dw=s=>s.constructor===Array;function fw(s){const e={nodes:{},materials:{}};return s&&s.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material)}),e}async function pw(s,e,t,n,i){const{logError:r}=eo(),o=new s,a=(Array.isArray(e)?e:[e]).map(l=>new Promise((c,u)=>{o.load(l,h=>{h.scene&&Object.assign(h,fw(h.scene)),c(h)},n,h=>u(r("[useLoader] - Failed to load resource",h)))}));return dw(e)?await Promise.all(a):await a[0]}const mw=(s,e)=>{const t=ke(()=>e.renderer.value.domElement),n=Rn([]),{x:i,y:r}=SS({target:t}),o=ke(()=>s.value.filter(ge=>{var ze;return((ze=ge.__tres)==null?void 0:ze.eventCount)>0}));let a=0;const{width:l,height:c,top:u,left:h}=_S(t),d=({x:ge,y:ze})=>{if(t.value)return{x:(ge-h.value)/l.value*2-1,y:-((ze-u.value)/c.value)*2+1}},f=({x:ge,y:ze})=>{if(e.camera.value)return e.raycaster.value.setFromCamera(new se(ge,ze),e.camera.value),n.value=e.raycaster.value.intersectObjects(o.value,!0),n.value},g=ge=>{const ze=d({x:(ge==null?void 0:ge.clientX)??i.value,y:(ge==null?void 0:ge.clientY)??r.value});return ze?f(ze)||[]:[]},v=An(),m=An(),p=An(),y=An(),_=An(),x=An(),A=An(),b=An();function E(ge){const ze={};for(const U in ge)typeof U!="function"&&(ze[U]=ge[U]);return ze}const I=(ge,ze)=>{var U,D,R;const T=E(ze),ie=new N(ze==null?void 0:ze.clientX,ze==null?void 0:ze.clientY,0).unproject((U=e.camera)==null?void 0:U.value);ge.trigger({...T,intersections:n.value,unprojectedPoint:ie,ray:(D=e.raycaster)==null?void 0:D.value.ray,camera:(R=e.camera)==null?void 0:R.value,sourceEvent:ze,delta:a,stopPropagating:!1})};let w;const M=ge=>{g(ge),I(p,ge),w=ge},F=()=>{w&&M(w)};let V,G,q;const ae=ge=>{var ze;V=(ze=n.value[0])==null?void 0:ze.object,a=0,G=new se((ge==null?void 0:ge.clientX)??i.value,(ge==null?void 0:ge.clientY)??r.value),I(_,ge)};let Q,oe=!1;const B=ge=>{var ze,U,D;ge instanceof PointerEvent&&(n.value.length===0&&I(x,ge),V===((ze=n.value[0])==null?void 0:ze.object)&&(q=new se((ge==null?void 0:ge.clientX)??i.value,(ge==null?void 0:ge.clientY)??r.value),a=G==null?void 0:G.distanceTo(q),ge.button===0?(I(v,ge),Q===((U=n.value[0])==null?void 0:U.object)?oe=!0:(Q=(D=n.value[0])==null?void 0:D.object,oe=!1)):ge.button===2&&I(A,ge)),I(y,ge))},Me=ge=>{oe&&(I(m,ge),Q=void 0,oe=!1)},be=ge=>I(p,ge),Ae=ge=>I(b,ge);return t.value.addEventListener("pointerup",B),t.value.addEventListener("pointerdown",ae),t.value.addEventListener("pointermove",M),t.value.addEventListener("pointerleave",be),t.value.addEventListener("dblclick",Me),t.value.addEventListener("wheel",Ae),Wn(()=>{t!=null&&t.value&&(t.value.removeEventListener("pointerup",B),t.value.removeEventListener("pointerdown",ae),t.value.removeEventListener("pointermove",M),t.value.removeEventListener("pointerleave",be),t.value.removeEventListener("dblclick",Me),t.value.removeEventListener("wheel",Ae))}),{intersects:n,onClick:ge=>v.on(ge).off,onDblClick:ge=>m.on(ge).off,onContextMenu:ge=>A.on(ge).off,onPointerMove:ge=>p.on(ge).off,onPointerUp:ge=>y.on(ge).off,onPointerDown:ge=>_.on(ge).off,onPointerMissed:ge=>x.on(ge).off,onWheel:ge=>b.on(ge).off,forceUpdate:F}};function Vu(s){let e=0;return s.traverse(t=>{if(t.isMesh&&t.geometry){const n=t.geometry,i=n.attributes.position.count*3*Float32Array.BYTES_PER_ELEMENT,r=n.index?n.index.count*Uint32Array.BYTES_PER_ELEMENT:0,o=n.attributes.normal?n.attributes.normal.count*3*Float32Array.BYTES_PER_ELEMENT:0,a=n.attributes.uv?n.attributes.uv.count*2*Float32Array.BYTES_PER_ELEMENT:0,l=i+r+o+a;e+=l}}),e}function gw(s){return(s/1024).toFixed(2)}const Vc=Ge({}),Hc=s=>Object.assign(Vc.value,s);function vw(s,e,t=10){const n=bt(s)?wS():yS(ke(()=>bt(e).parentElement)),i=gr(Nd(n.width,t)),r=gr(Nd(n.height,t)),o=ke(()=>i.value/r.value);return{height:r,width:i,aspectRatio:o}}function Zl(){const s=new Map,e=new Set;let t=0,n=!1;const i=()=>{const o=Array.from(s.entries()).sort((a,l)=>{const c=a[1].priority-l[1].priority;return c===0?a[1].addI-l[1].addI:c});e.clear(),o.forEach(a=>e.add(a[0]))},r=o=>{s.delete(o),e.delete(o)};return{on:(o,a=0)=>{s.set(o,{priority:a,addI:t++});const l=()=>r(o);return Xn(l),n=!0,{off:l}},off:r,trigger:(...o)=>{n&&(i(),n=!1),e.forEach(a=>a(...o))},dispose:()=>{s.clear(),e.clear()},get count(){return s.size}}}function _w(){const s=new nl(!1),e=Ge(!1),t=Ge(!1);let n;const i=ip.generateUUID();let r=null;const o=Zl(),a=Zl(),l=Zl();let c={};function u(_){c=_}function h(_,x,A=0){switch(x){case"before":return o.on(_,A);case"render":return r||(r=_),a.dispose(),a.on(_);case"after":return l.on(_,A)}}function d(){e.value||(s.start(),e.value=!0,y())}function f(){e.value&&(s.stop(),cancelAnimationFrame(n),e.value=!1)}function g(){s.stop(),e.value=!1}function v(){s.start(),e.value=!0}function m(){t.value=!0}function p(){t.value=!1}function y(){const _=s.getDelta(),x=s.getElapsedTime(),A={camera:j(c.camera),scene:j(c.scene),renderer:j(c.renderer),raycaster:j(c.raycaster),controls:j(c.controls),invalidate:c.invalidate,advance:c.advance},b={delta:_,elapsed:x,clock:s,...A};e.value&&o.trigger(b),t.value||(a.count?a.trigger(b):r&&r(b)),e.value&&l.trigger(b),n=requestAnimationFrame(y)}return{loopId:i,register:(_,x,A)=>h(_,x,A),start:d,stop:f,pause:g,resume:v,pauseRender:m,resumeRender:p,isRenderPaused:t,isActive:e,setContext:u}}function yw({scene:s,canvas:e,windowSize:t,disableRender:n,rendererOptions:i,emit:r}){const{logWarning:o}=eo(),a=Rn(s),l=vw(t,e),{camera:c,cameras:u,registerCamera:h,deregisterCamera:d,setCameraActive:f}=qS({sizes:l,scene:s}),g={mode:Ge(i.renderMode||"always"),priority:Ge(0),frames:Ge(0),maxFrames:60,canBeInvalidated:ke(()=>g.mode.value==="on-demand"&&g.frames.value===0)};function v(G=1){i.renderMode==="on-demand"?g.frames.value=Math.min(g.maxFrames,g.frames.value+G):o("`invalidate` can only be used when `renderMode` is set to `on-demand`")}function m(){i.renderMode==="manual"?g.frames.value=1:o("`advance` can only be used when `renderMode` is set to `manual`")}const{renderer:p}=hw({scene:s,canvas:e,options:i,emit:r,contextParts:{sizes:l,camera:c,render:g,invalidate:v,advance:m},disableRender:n}),y={sizes:l,scene:a,camera:c,cameras:gr(u),renderer:p,raycaster:Rn(new fm),controls:Ge(null),perf:{maxFrames:160,fps:{value:0,accumulator:[]},memory:{currentMem:0,allocatedMem:0,accumulator:[]}},render:g,advance:m,extend:Hc,invalidate:v,registerCamera:h,setCameraActive:f,deregisterCamera:d,loop:_w()};vr("useTres",y),y.scene.value.__tres={root:y},y.loop.register(()=>{c.value&&g.frames.value>0&&(p.value.render(s,c.value),r("render",y.renderer.value)),g.priority.value=0,g.mode.value==="always"?g.frames.value=1:g.frames.value=Math.max(0,g.frames.value-1)},"render"),y.loop.start(),Wn(()=>{y.loop.stop()});const _=100,x=xS({every:_}),{isSupported:A,memory:b}=MS({interval:_}),E=160;let I=performance.now();const w=({timestamp:G})=>{y.scene.value&&(y.perf.memory.allocatedMem=Vu(y.scene.value)),G-I>=_&&(I=G,y.perf.fps.accumulator.push(x.value),y.perf.fps.accumulator.length>E&&y.perf.fps.accumulator.shift(),y.perf.fps.value=x.value,A.value&&b.value&&(y.perf.memory.accumulator.push(b.value.usedJSHeapSize/1024/1024),y.perf.memory.accumulator.length>E&&y.perf.memory.accumulator.shift(),y.perf.memory.currentMem=y.perf.memory.accumulator.reduce((q,ae)=>q+ae,0)/y.perf.memory.accumulator.length))};let M=0;const F=1,{pause:V}=ku(({delta:G})=>{window.__TRES__DEVTOOLS__&&(w({timestamp:performance.now()}),M+=G,M>=F&&(window.__TRES__DEVTOOLS__.cb(y),M=0))},{immediate:!0});return Wn(()=>{V()}),y}function xw(){const s=zr("useTres");if(!s)throw new Error("useTresContext must be used together with useTresContextProvider");return s}function Mw(s,e,t){const n=Rn(),i=Rn();s&&(n.value=s),e&&(i.value=e);const r=ke(()=>n.value?n.value.children:[]);function o(A,b){if(Array.isArray(A))for(const E of A)E(b);typeof A=="function"&&A(b)}function a(A,b){const E=[],I=()=>b.stopPropagating=!0;b.stopPropagation=I;for(const w of b==null?void 0:b.intersections){if(b.stopPropagating)return;b={...b,...w};const{object:M}=w;b.eventObject=M,o(M[A],b),E.push(M);let F=M.parent;for(;F!==null&&!b.stopPropagating&&!E.includes(F);)b.eventObject=F,o(F[A],b),E.push(F),F=F.parent;const V=iw(A.slice(2));t(V,{intersection:w,event:b})}}const{onClick:l,onDblClick:c,onContextMenu:u,onPointerMove:h,onPointerDown:d,onPointerUp:f,onPointerMissed:g,onWheel:v,forceUpdate:m}=mw(r,e);f(A=>a("onPointerUp",A)),d(A=>a("onPointerDown",A)),l(A=>a("onClick",A)),c(A=>a("onDoubleClick",A)),u(A=>a("onContextMenu",A)),v(A=>a("onWheel",A));let p=[];h(A=>{const b=A.intersections.map(({object:I})=>I),E=A.intersections;p.forEach(({object:I})=>{b.includes(I)||(A.intersections=p,a("onPointerLeave",A),a("onPointerOut",A))}),A.intersections=E,A.intersections.forEach(({object:I})=>{p.includes(I)||(a("onPointerEnter",A),a("onPointerOver",A))}),a("onPointerMove",A),p=A.intersections});const y=[];g(A=>{const b=()=>A.stopPropagating=!0;A.stopPropagation=b,y.forEach(E=>{A.stopPropagating||(A.eventObject=E,o(E.onPointerMissed,A))}),t("pointer-missed",{event:A})});function _(A){y.push(A)}function x(A){const b=y.indexOf(A);b>-1&&y.splice(b,1)}return e.eventManager={forceUpdate:m,registerPointerMissedObject:_,deregisterPointerMissedObject:x},{forceUpdate:m,registerPointerMissedObject:_,deregisterPointerMissedObject:x}}const{logError:zd}=eo(),Vd=["onClick","onContextMenu","onPointerMove","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut","onDoubleClick","onPointerDown","onPointerUp","onPointerCancel","onPointerMissed","onLostPointerCapture","onWheel"];function Hd(s){var e;const t=(e=s==null?void 0:s.__tres)==null?void 0:e.root;t&&t.render&&t.render.canBeInvalidated.value&&t.invalidate()}const bw=()=>{let s=null;function e(l,c,u,h){if(h||(h={}),h.args||(h.args=[]),l==="template"||tw(l))return null;let d=l.replace("Tres",""),f;if(l==="primitive"){(h==null?void 0:h.object)===void 0&&zd("Tres primitives need a prop 'object'");const g=h.object;d=g.type,f=Object.assign(g.clone(),{type:d})}else{const g=Vc.value[d];g||zd(`${d} is not defined on the THREE namespace. Use extend to add it to the catalog.`),f=new g(...h.args)}return f?(f.isCamera&&(h!=null&&h.position||f.position.set(3,3,3),h!=null&&h.lookAt||f.lookAt(0,0,0)),(h==null?void 0:h.attach)===void 0&&(f.isMaterial?f.attach="material":f.isBufferGeometry&&(f.attach="geometry")),f.__tres={...f.__tres,type:d,memoizedProps:h,eventCount:0,disposable:!0,primitive:l==="primitive"},f.isObject3D&&f.__tres&&(h!=null&&h.material||h!=null&&h.geometry)&&(f.__tres.disposable=!1),f):null}function t(l,c){var u,h,d,f,g;if(!l)return;c&&c.isScene&&(s=c),s&&l.__tres&&(l.__tres.root=s.__tres.root);const v=c||s;if(l!=null&&l.isObject3D){const{registerCamera:m}=(u=l==null?void 0:l.__tres)==null?void 0:u.root;l!=null&&l.isCamera&&m(l),l.onPointerMissed&&(h=l==null?void 0:l.__tres)!=null&&h.root&&((g=(f=(d=l==null?void 0:l.__tres)==null?void 0:d.root)==null?void 0:f.eventManager)==null||g.registerPointerMissedObject(l))}l!=null&&l.isObject3D&&v!=null&&v.isObject3D?(v.add(l),l.dispatchEvent({type:"added"})):l!=null&&l.isFog?v.fog=l:typeof(l==null?void 0:l.attach)=="string"&&(l.__previousAttach=l[v==null?void 0:v.attach],v&&(v[l.attach]=l))}function n(l){var c,u,h,d;if(!l)return;const f=l.__tres;if(l.parent=l.parent||s,l.isObject3D){const g=v=>{var m,p;const y=(p=(m=l==null?void 0:l.__tres)==null?void 0:m.root)==null?void 0:p.deregisterCamera;v.isCamera&&(y==null||y(v))};(c=l.removeFromParent)==null||c.call(l),l.traverse(v=>{var m,p;g(v),v.onPointerMissed&&((p=(m=f==null?void 0:f.root)==null?void 0:m.eventManager)==null||p.deregisterPointerMissedObject(v))}),g(l),Hd(l),!((u=l.__tres)!=null&&u.primitive)&&(h=l.__tres)!=null&&h.disposable&&zu(l),(d=l.dispose)==null||d.call(l)}}function i(l,c,u,h){var d,f;if(l){let g=l,v=c;if((d=l==null?void 0:l.__tres)!=null&&d.primitive&&v==="object"&&u!==null){const _=e("primitive",void 0,void 0,{object:h});for(const x in _){if(x==="uuid")continue;const A=l[x],b=_[x];!(A!=null&&A.set)&&!na(A)?l[x]=b:A.constructor===b.constructor&&A!=null&&A.copy?A==null||A.copy(b):Array.isArray(b)?A.set(...b):!A.isColor&&A.setScalar?A.setScalar(b):A.set(b)}_!=null&&_.__tres&&(_.__tres.root=s==null?void 0:s.__tres.root),_!=null&&_.isGroup?(l.geometry=void 0,l.material=void 0):delete l.isGroup}if(l!=null&&l.isObject3D&&v==="blocks-pointer-events"){h||h===""?l[v]=h:delete l[v];return}Vd.includes(c)&&(l.__tres.eventCount+=1);let m=ea(v),p=g==null?void 0:g[m];if(v==="args"){const _=l,x=u??[],A=h??[],b=((f=l==null?void 0:l.__tres)==null?void 0:f.type)||l.type;b&&x.length&&!ow(x,A)&&(g=Object.assign(_,new Vc.value[b](...h)));return}if(g.type==="BufferGeometry"){if(v==="args")return;g.setAttribute(ea(v),new pt(...h));return}if(v.includes("-")&&p===void 0){const _=v.split("-");p=_.reduce((x,A)=>x[ea(A)],g),v=_.pop(),m=v,p!=null&&p.set||(g=_.reduce((x,A)=>x[ea(A)],g))}let y=h;if(y===""&&(y=!0),na(p)){Vd.includes(c)||(Array.isArray(y)?l[m](...y):l[m](y)),m.startsWith("on")&&na(y)&&(g[m]=y);return}!(p!=null&&p.set)&&!na(p)?g[m]=y:p.constructor===y.constructor&&p!=null&&p.copy?p==null||p.copy(y):Array.isArray(y)?p.set(...y):!p.isColor&&p.setScalar?p.setScalar(y):p.set(y),Hd(l)}}function r(l){return(l==null?void 0:l.parent)||null}function o(l){const c=new ct;return c.name=l,c.__tres={type:"Comment"},c.__tres.root=s==null?void 0:s.__tres.root,c}function a(l){if(!l)return null;const c=l.parent||s,u=c.children.indexOf(l);return c.children[u+1]||null}return{insert:t,remove:n,createElement:e,patchProp:i,parentNode:r,createText:()=>{},createComment:o,setText:()=>{},setElementText:()=>{},nextSibling:a,querySelector:()=>{},setScopeId:()=>{},cloneNode:()=>{},insertStaticContent:()=>{}}};function Sw(){return bm().__VUE_DEVTOOLS_GLOBAL_HOOK__}function bm(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const ww=typeof Proxy=="function",Aw="devtools-plugin:setup",Tw="plugin:settings:set";let ar,Gc;function Ew(){var s;return ar!==void 0||(typeof window<"u"&&window.performance?(ar=!0,Gc=window.performance):typeof globalThis<"u"&&!((s=globalThis.perf_hooks)===null||s===void 0)&&s.performance?(ar=!0,Gc=globalThis.perf_hooks.performance):ar=!1),ar}function Cw(){return Ew()?Gc.now():Date.now()}class Pw{constructor(e,t){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=t;const n={};if(e.settings)for(const o in e.settings){const a=e.settings[o];n[o]=a.defaultValue}const i=`__vue-devtools-plugin-settings__${e.id}`;let r=Object.assign({},n);try{const o=localStorage.getItem(i),a=JSON.parse(o);Object.assign(r,a)}catch{}this.fallbacks={getSettings(){return r},setSettings(o){try{localStorage.setItem(i,JSON.stringify(o))}catch{}r=o},now(){return Cw()}},t&&t.on(Tw,(o,a)=>{o===this.plugin.id&&this.fallbacks.setSettings(a)}),this.proxiedOn=new Proxy({},{get:(o,a)=>this.target?this.target.on[a]:(...l)=>{this.onQueue.push({method:a,args:l})}}),this.proxiedTarget=new Proxy({},{get:(o,a)=>this.target?this.target[a]:a==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(a)?(...l)=>(this.targetQueue.push({method:a,args:l,resolve:()=>{}}),this.fallbacks[a](...l)):(...l)=>new Promise(c=>{this.targetQueue.push({method:a,args:l,resolve:c})})})}async setRealTarget(e){this.target=e;for(const t of this.onQueue)this.target.on[t.method](...t.args);for(const t of this.targetQueue)t.resolve(await this.target[t.method](...t.args))}}function Rw(s,e){const t=s,n=bm(),i=Sw(),r=ww&&t.enableEarlyProxy;if(i&&(n.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!r))i.emit(Aw,s,e);else{const o=r?new Pw(t,i):null;(n.__VUE_DEVTOOLS_PLUGINS__=n.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:t,setupFn:e,proxy:o}),o&&e(o.proxiedTarget)}}function Iw(s,e){const t=`▲ ■ ●${s}`;typeof Gd=="function"?Gd(t,e):console.log(t)}function Gd(s,e){throw new Error(s+e)}const Sm=s=>{const e={id:s.uuid,label:s.type,children:[],tags:[]};s.name!==""&&e.tags.push({label:s.name,textColor:5750629,backgroundColor:15793395});const t=Vu(s);return t>0&&e.tags.push({label:`${gw(t)} KB`,textColor:15707189,backgroundColor:16775644,tooltip:"Memory usage"}),s.type.includes("Light")&&(e.tags.push({label:`${s.intensity}`,textColor:9738662,backgroundColor:16316922,tooltip:"Intensity"}),e.tags.push({label:`#${s.color.getHexString()}`,textColor:9738662,backgroundColor:16316922,tooltip:"Color"})),s.type.includes("Camera")&&(e.tags.push({label:`${s.fov}°`,textColor:9738662,backgroundColor:16316922,tooltip:"Field of view"}),e.tags.push({label:`x: ${Math.round(s.position.x)} y: ${Math.round(s.position.y)} z: ${Math.round(s.position.z)}`,textColor:9738662,backgroundColor:16316922,tooltip:"Position"})),e};function wm(s,e,t=""){s.children.forEach(n=>{if(n.type==="HightlightMesh"||t&&!n.type.includes(t)&&!n.name.includes(t))return;const i=Sm(n);e.children.push(i),wm(n,i,t)})}const Lw=[],lr="tres:inspector",Nw=$m({sceneGraph:null});function Dw(s,e){Rw({id:"dev.esm.tres",label:"TresJS 🪐",logo:"https://raw.githubusercontent.com/Tresjs/tres/main/public/favicon.svg",packageName:"tresjs",homepage:"https://tresjs.org",componentStateTypes:Lw,app:s},t=>{typeof t.now!="function"&&Iw("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html."),t.addInspector({id:lr,label:"TresJS 🪐",icon:"account_tree",treeFilterPlaceholder:"Search instances"}),setInterval(()=>{t.sendInspectorTree(lr)},1e3),setInterval(()=>{t.notifyComponentUpdate()},5e3),t.on.getInspectorTree(r=>{if(r.inspectorId===lr){const o=Sm(e.scene.value);wm(e.scene.value,o,r.filter),Nw.sceneGraph=o,r.rootNodes=[o]}});let n=null,i=null;t.on.getInspectorState(r=>{var o;if(r.inspectorId===lr){const[a]=e.scene.value.getObjectsByProperty("uuid",r.nodeId);if(!a)return;if(i&&n&&n.parent&&i.remove(n),a.isMesh){const l=lw(a);a.add(l),n=l,i=a}r.state={object:[{key:"uuid",editable:!0,value:a.uuid},{key:"name",editable:!0,value:a.name},{key:"type",editable:!0,value:a.type},{key:"position",editable:!0,value:a.position},{key:"rotation",editable:!0,value:a.rotation},{key:"scale",editable:!0,value:a.scale},{key:"geometry",value:a.geometry},{key:"material",value:a.material},{key:"color",editable:!0,value:a.color},{key:"intensity",editable:!0,value:a.intensity},{key:"castShadow",editable:!0,value:a.castShadow},{key:"receiveShadow",editable:!0,value:a.receiveShadow},{key:"frustumCulled",editable:!0,value:a.frustumCulled},{key:"matrixAutoUpdate",editable:!0,value:a.matrixAutoUpdate},{key:"matrixWorldNeedsUpdate",editable:!0,value:a.matrixWorldNeedsUpdate},{key:"matrixWorld",value:a.matrixWorld},{key:"visible",editable:!0,value:a.visible}]},a.isScene&&(r.state.info={memory:Vu(a),objects:a.children.length,calls:e.renderer.value.info.render.calls,triangles:e.renderer.value.info.render.triangles,points:e.renderer.value.info.render.points,lines:e.renderer.value.info.render.lines},r.state.programs=((o=e.renderer.value.info.programs)==null?void 0:o.map(l=>({key:l.name,value:{...l,vertexShader:l.vertexShader,attributes:l.getAttributes(),uniforms:l.getUniforms()}})))||[])}}),t.on.editInspectorState(r=>{r.inspectorId===lr&&aw(e.scene.value,r.nodeId,r.path,r.state.value)})})}const Uw=["data-scene","data-tres"],Ow=Be({__name:"TresCanvas",props:{shadows:{type:Boolean,default:void 0},clearColor:{},toneMapping:{},shadowMapType:{},useLegacyLights:{type:Boolean,default:void 0},outputColorSpace:{},toneMappingExposure:{},renderMode:{default:"always"},camera:{},preset:{},windowSize:{type:Boolean,default:void 0},disableRender:{type:Boolean,default:void 0},context:{},precision:{},alpha:{type:Boolean,default:void 0},premultipliedAlpha:{type:Boolean},antialias:{type:Boolean,default:void 0},stencil:{type:Boolean,default:void 0},preserveDrawingBuffer:{type:Boolean,default:void 0},powerPreference:{},depth:{type:Boolean,default:void 0},logarithmicDepthBuffer:{type:Boolean,default:void 0},failIfMajorPerformanceCaveat:{type:Boolean,default:void 0}},emits:["render","click","double-click","context-menu","pointer-move","pointer-up","pointer-down","pointer-enter","pointer-leave","pointer-over","pointer-out","pointer-missed","wheel"],setup(s,{expose:e,emit:t}){var n;const i=s,r=t,o=Xd(),{logWarning:a}=eo(),l=Ge(),c=Rn(new Fa),u=(n=ma())==null?void 0:n.appContext.app;Hc(iS);const h=m=>Be({setup(){var p;const y=(p=ma())==null?void 0:p.appContext;return y&&(y.app=u),vr("useTres",m),vr("extend",Hc),typeof window<"u"&&Dw(y==null?void 0:y.app,m),()=>eh(xt,null,o!=null&&o.default?o.default():[])}}),d=m=>{const p=h(m),{render:y}=Xm(bw());y(eh(p),c.value)},f=(m,p=!1)=>{zu(m.scene.value),p&&(m.renderer.value.dispose(),m.renderer.value.renderLists.dispose(),m.renderer.value.forceContextLoss()),c.value.__tres={root:m},d(m)},g=ke(()=>i.disableRender),v=Rn(null);return e({context:v,dispose:()=>f(v.value,!0)}),Nn(()=>{const m=l;v.value=yw({scene:c.value,canvas:m,windowSize:i.windowSize??!1,disableRender:g.value??!1,rendererOptions:i,emit:r}),Mw(c.value,v.value,r);const{registerCamera:p,camera:y,cameras:_,deregisterCamera:x}=v.value;d(v.value);const A=()=>{const b=new Ut(45,window.innerWidth/window.innerHeight,.1,1e3);b.position.set(3,3,3),b.lookAt(0,0,0),p(b);const E=Ri(()=>{_.value.length>=2&&(b.removeFromParent(),x(b),E==null||E())})};Ct(()=>i.camera,(b,E)=>{b&&p(b),E&&(E.removeFromParent(),x(E))},{immediate:!0}),y.value||(a("No camera found. Creating a default perspective camera. To have full control over a camera, please add one to the scene."),A())}),Wn(()=>{f(v.value)}),(m,p)=>(Y(),fe("canvas",{ref_key:"canvas",ref:l,"data-scene":c.value.uuid,class:yt(m.$attrs.class),"data-tres":`tresjs ${j(XS).version}`,style:Yc({display:"block",width:"100%",height:"100%",position:m.windowSize?"fixed":"relative",top:0,left:0,pointerEvents:"auto",touchAction:"none",...m.$attrs.style})},null,14,Uw))}}),Fw=ln;class Sa extends on{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit="px"}load(e,t,n,i){const r=this,o=new $n(r.manager);o.setPath(r.path),o.setRequestHeader(r.requestHeader),o.setWithCredentials(r.withCredentials),o.load(e,function(a){try{t(r.parse(a))}catch(l){i?i(l):console.error(l),r.manager.itemError(e)}},n,i)}parse(e){const t=this;function n(U,D){if(U.nodeType!==1)return;const R=x(U);let T=!1,ie=null;switch(U.nodeName){case"svg":D=g(U,D);break;case"style":r(U);break;case"g":D=g(U,D);break;case"path":D=g(U,D),U.hasAttribute("d")&&(ie=i(U));break;case"rect":D=g(U,D),ie=l(U);break;case"polygon":D=g(U,D),ie=c(U);break;case"polyline":D=g(U,D),ie=u(U);break;case"circle":D=g(U,D),ie=h(U);break;case"ellipse":D=g(U,D),ie=d(U);break;case"line":D=g(U,D),ie=f(U);break;case"defs":T=!0;break;case"use":D=g(U,D);const L=(U.getAttributeNS("http://www.w3.org/1999/xlink","href")||"").substring(1),X=U.viewportElement.getElementById(L);X?n(X,D):console.warn("SVGLoader: 'use node' references non-existent node id: "+L);break}ie&&(D.fill!==void 0&&D.fill!=="none"&&ie.color.setStyle(D.fill,Fw),b(ie,Ae),V.push(ie),ie.userData={node:U,style:D});const he=U.childNodes;for(let J=0;J0?Ae.copy(q[q.length-1]):Ae.identity())}function i(U){const D=new Si,R=new se,T=new se,ie=new se;let he=!0,J=!1;const L=U.getAttribute("d");if(L===""||L==="none")return null;const X=L.match(/[a-df-z][^a-df-z]*/ig);for(let K=0,H=X.length;K0&&(R.copy(ie),D.currentPath.currentPoint.copy(R),he=!0);break;default:console.warn($)}J=!1}return D}function r(U){if(!(!U.sheet||!U.sheet.cssRules||!U.sheet.cssRules.length))for(let D=0;Die.trim());for(let ie=0;ieJ!==""));G[T[ie]]=Object.assign(G[T[ie]]||{},he)}}}function o(U,D,R,T,ie,he,J,L){if(D==0||R==0){U.lineTo(L.x,L.y);return}T=T*Math.PI/180,D=Math.abs(D),R=Math.abs(R);const X=(J.x-L.x)/2,K=(J.y-L.y)/2,H=Math.cos(T)*X+Math.sin(T)*K,$=-Math.sin(T)*X+Math.cos(T)*K;let te=D*D,le=R*R;const k=H*H,O=$*$,P=k/te+O/le;if(P>1){const xe=Math.sqrt(P);D=xe*D,R=xe*R,te=D*D,le=R*R}const S=te*O+le*k,ee=(te*le-S)/S;let pe=Math.sqrt(Math.max(0,ee));ie===he&&(pe=-pe);const ce=pe*D*$/R,ve=-pe*R*H/D,Ve=Math.cos(T)*ce-Math.sin(T)*ve+(J.x+L.x)/2,Ee=Math.sin(T)*ce+Math.cos(T)*ve+(J.y+L.y)/2,Te=a(1,0,(H-ce)/D,($-ve)/R),Qe=a((H-ce)/D,($-ve)/R,(-H-ce)/D,(-$-ve)/R)%(Math.PI*2);U.currentPath.absellipse(Ve,Ee,D,R,Te,Te+Qe,he===0,T)}function a(U,D,R,T){const ie=U*R+D*T,he=Math.sqrt(U*U+D*D)*Math.sqrt(R*R+T*T);let J=Math.acos(Math.max(-1,Math.min(1,ie/he)));return U*T-D*R<0&&(J=-J),J}function l(U){const D=_(U.getAttribute("x")||0),R=_(U.getAttribute("y")||0),T=_(U.getAttribute("rx")||U.getAttribute("ry")||0),ie=_(U.getAttribute("ry")||U.getAttribute("rx")||0),he=_(U.getAttribute("width")),J=_(U.getAttribute("height")),L=1-.551915024494,X=new Si;return X.moveTo(D+T,R),X.lineTo(D+he-T,R),(T!==0||ie!==0)&&X.bezierCurveTo(D+he-T*L,R,D+he,R+ie*L,D+he,R+ie),X.lineTo(D+he,R+J-ie),(T!==0||ie!==0)&&X.bezierCurveTo(D+he,R+J-ie*L,D+he-T*L,R+J,D+he-T,R+J),X.lineTo(D+T,R+J),(T!==0||ie!==0)&&X.bezierCurveTo(D+T*L,R+J,D,R+J-ie*L,D,R+J-ie),X.lineTo(D,R+ie),(T!==0||ie!==0)&&X.bezierCurveTo(D,R+ie*L,D+T*L,R,D+T,R),X}function c(U){function D(he,J,L){const X=_(J),K=_(L);ie===0?T.moveTo(X,K):T.lineTo(X,K),ie++}const R=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,T=new Si;let ie=0;return U.getAttribute("points").replace(R,D),T.currentPath.autoClose=!0,T}function u(U){function D(he,J,L){const X=_(J),K=_(L);ie===0?T.moveTo(X,K):T.lineTo(X,K),ie++}const R=/([+-]?\d*\.?\d+(?:e[+-]?\d+)?)(?:,|\s)([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/g,T=new Si;let ie=0;return U.getAttribute("points").replace(R,D),T.currentPath.autoClose=!1,T}function h(U){const D=_(U.getAttribute("cx")||0),R=_(U.getAttribute("cy")||0),T=_(U.getAttribute("r")||0),ie=new Ti;ie.absarc(D,R,T,0,Math.PI*2);const he=new Si;return he.subPaths.push(ie),he}function d(U){const D=_(U.getAttribute("cx")||0),R=_(U.getAttribute("cy")||0),T=_(U.getAttribute("rx")||0),ie=_(U.getAttribute("ry")||0),he=new Ti;he.absellipse(D,R,T,ie,0,Math.PI*2);const J=new Si;return J.subPaths.push(he),J}function f(U){const D=_(U.getAttribute("x1")||0),R=_(U.getAttribute("y1")||0),T=_(U.getAttribute("x2")||0),ie=_(U.getAttribute("y2")||0),he=new Si;return he.moveTo(D,R),he.lineTo(T,ie),he.currentPath.autoClose=!1,he}function g(U,D){D=Object.assign({},D);let R={};if(U.hasAttribute("class")){const J=U.getAttribute("class").split(/\s/).filter(Boolean).map(L=>L.trim());for(let L=0;L0&&D.premultiply(q[q.length-1]),Ae.copy(D),q.push(D),D}function A(U){const D=new Ze,R=ae;if(U.nodeName==="use"&&(U.hasAttribute("x")||U.hasAttribute("y"))){const T=_(U.getAttribute("x")),ie=_(U.getAttribute("y"));D.translate(T,ie)}if(U.hasAttribute("transform")){const T=U.getAttribute("transform").split(")");for(let ie=T.length-1;ie>=0;ie--){const he=T[ie].trim();if(he==="")continue;const J=he.indexOf("("),L=he.length;if(J>0&&J=1){const H=K[0];let $=0;K.length>=2&&($=K[1]),R.translate(H,$)}break;case"rotate":if(K.length>=1){let H=0,$=0,te=0;H=K[0]*Math.PI/180,K.length>=3&&($=K[1],te=K[2]),Q.makeTranslation(-$,-te),oe.makeRotation(H),B.multiplyMatrices(oe,Q),Q.makeTranslation($,te),R.multiplyMatrices(Q,B)}break;case"scale":if(K.length>=1){const H=K[0];let $=H;K.length>=2&&($=K[1]),R.scale(H,$)}break;case"skewX":K.length===1&&R.set(1,Math.tan(K[0]*Math.PI/180),0,0,1,0,0,0,1);break;case"skewY":K.length===1&&R.set(1,0,0,Math.tan(K[0]*Math.PI/180),1,0,0,0,1);break;case"matrix":K.length===6&&R.set(K[0],K[2],K[4],K[1],K[3],K[5],0,0,1);break}}D.premultiply(R)}}return D}function b(U,D){function R(J){be.set(J.x,J.y,1).applyMatrix3(D),J.set(be.x,be.y)}function T(J){const L=J.xRadius,X=J.yRadius,K=Math.cos(J.aRotation),H=Math.sin(J.aRotation),$=new N(L*K,L*H,0),te=new N(-X*H,X*K,0),le=$.applyMatrix3(D),k=te.applyMatrix3(D),O=ae.set(le.x,k.x,0,le.y,k.y,0,0,0,1),P=Q.copy(O).invert(),pe=oe.copy(P).transpose().multiply(P).elements,ce=F(pe[0],pe[1],pe[4]),ve=Math.sqrt(ce.rt1),Ve=Math.sqrt(ce.rt2);if(J.xRadius=1/ve,J.yRadius=1/Ve,J.aRotation=Math.atan2(ce.sn,ce.cs),!((J.aEndAngle-J.aStartAngle)%(2*Math.PI){const{x:Je,y:Re}=new N(Math.cos(st),Math.sin(st),0).applyMatrix3(xe);return Math.atan2(Re,Je)};J.aStartAngle=Ue(J.aStartAngle),J.aEndAngle=Ue(J.aEndAngle),E(D)&&(J.aClockwise=!J.aClockwise)}}function ie(J){const L=w(D),X=M(D);J.xRadius*=L,J.yRadius*=X;const K=L>Number.EPSILON?Math.atan2(D.elements[1],D.elements[0]):Math.atan2(-D.elements[3],D.elements[4]);J.aRotation+=K,E(D)&&(J.aStartAngle*=-1,J.aEndAngle*=-1,J.aClockwise=!J.aClockwise)}const he=U.subPaths;for(let J=0,L=he.length;JNumber.EPSILON}function w(U){const D=U.elements;return Math.sqrt(D[0]*D[0]+D[1]*D[1])}function M(U){const D=U.elements;return Math.sqrt(D[3]*D[3]+D[4]*D[4])}function F(U,D,R){let T,ie,he,J,L;const X=U+R,K=U-R,H=Math.sqrt(K*K+4*D*D);return X>0?(T=.5*(X+H),L=1/T,ie=U*L*R-D*L*D):X<0?ie=.5*(X-H):(T=.5*H,ie=-.5*H),K>0?he=K+H:he=K-H,Math.abs(he)>2*Math.abs(D)?(L=-2*D/he,J=1/Math.sqrt(1+L*L),he=L*J):Math.abs(D)===0?(he=1,J=0):(L=-.5*he/D,he=1/Math.sqrt(1+L*L),J=L*he),K>0&&(L=he,he=-J,J=L),{rt1:T,rt2:ie,cs:he,sn:J}}const V=[],G={},q=[],ae=new Ze,Q=new Ze,oe=new Ze,B=new Ze,Me=new se,be=new N,Ae=new Ze,ge=new DOMParser().parseFromString(e,"image/svg+xml");return n(ge.documentElement,{fill:"#000",fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:"miter",strokeLineCap:"butt",strokeMiterLimit:4}),{paths:V,xml:ge.documentElement}}static createShapes(e){const n={ORIGIN:0,DESTINATION:1,BETWEEN:2,LEFT:3,RIGHT:4,BEHIND:5,BEYOND:6},i={loc:n.ORIGIN,t:0};function r(v,m,p,y){const _=v.x,x=m.x,A=p.x,b=y.x,E=v.y,I=m.y,w=p.y,M=y.y,F=(b-A)*(E-w)-(M-w)*(_-A),V=(x-_)*(E-w)-(I-E)*(_-A),G=(M-w)*(x-_)-(b-A)*(I-E),q=F/G,ae=V/G;if(G===0&&F!==0||q<=0||q>=1||ae<0||ae>1)return null;if(F===0&&G===0){for(let Q=0;Q<2;Q++)if(o(Q===0?p:y,v,m),i.loc==n.ORIGIN){const oe=Q===0?p:y;return{x:oe.x,y:oe.y,t:i.t}}else if(i.loc==n.BETWEEN){const oe=+(_+i.t*(x-_)).toPrecision(10),B=+(E+i.t*(I-E)).toPrecision(10);return{x:oe,y:B,t:i.t}}return null}else{for(let B=0;B<2;B++)if(o(B===0?p:y,v,m),i.loc==n.ORIGIN){const Me=B===0?p:y;return{x:Me.x,y:Me.y,t:i.t}}const Q=+(_+q*(x-_)).toPrecision(10),oe=+(E+q*(I-E)).toPrecision(10);return{x:Q,y:oe,t:q}}}function o(v,m,p){const y=p.x-m.x,_=p.y-m.y,x=v.x-m.x,A=v.y-m.y,b=y*A-x*_;if(v.x===m.x&&v.y===m.y){i.loc=n.ORIGIN,i.t=0;return}if(v.x===p.x&&v.y===p.y){i.loc=n.DESTINATION,i.t=1;return}if(b<-Number.EPSILON){i.loc=n.LEFT;return}if(b>Number.EPSILON){i.loc=n.RIGHT;return}if(y*x<0||_*A<0){i.loc=n.BEHIND;return}if(Math.sqrt(y*y+_*_)M.t<=w.t+Number.EPSILON&&M.t>=w.t-Number.EPSILON)===void 0&&(p.push(w),y.push(new se(w.x,w.y)))}}return y}function l(v,m,p){const y=new se;m.getCenter(y);const _=[];return p.forEach(x=>{x.boundingBox.containsPoint(y)&&a(v,x.points).forEach(b=>{_.push({identifier:x.identifier,isCW:x.isCW,point:b})})}),_.sort((x,A)=>x.point.x-A.point.x),_}function c(v,m,p,y,_){(_==null||_==="")&&(_="nonzero");const x=new se;v.boundingBox.getCenter(x);const A=[new se(p,x.y),new se(y,x.y)],b=l(A,v.boundingBox,m);b.sort((V,G)=>V.point.x-G.point.x);const E=[],I=[];b.forEach(V=>{V.identifier===v.identifier?E.push(V):I.push(V)});const w=E[0].point.x,M=[];let F=0;for(;F0&&M[M.length-1]===I[F].identifier?M.pop():M.push(I[F].identifier),F++;if(M.push(v.identifier),_==="evenodd"){const V=M.length%2===0,G=M[M.length-2];return{identifier:v.identifier,isHole:V,for:G}}else if(_==="nonzero"){let V=!0,G=null,q=null;for(let ae=0;ae{const m=v.getPoints();let p=-999999999,y=999999999,_=-999999999,x=999999999;for(let A=0;Ap&&(p=b.y),b.y_&&(_=b.x),b.x=x&&(u=x-1),{curves:v.curves,points:m,isCW:Pn.isClockWise(m),identifier:-1,boundingBox:new pm(new se(x,y),new se(_,p))}});d=d.filter(v=>v.points.length>1);for(let v=0;vc(v,d,u,h,e.userData?e.userData.style.fillRule:void 0)),g=[];return d.forEach(v=>{if(!f[v.identifier].isHole){const p=new Ei;p.curves=v.curves,f.filter(_=>_.isHole&&_.for===v.identifier).forEach(_=>{const x=d[_.identifier],A=new Ti;A.curves=x.curves,p.holes.push(A)}),g.push(p)}}),g}static getStrokeStyle(e,t,n,i,r){return e=e!==void 0?e:1,t=t!==void 0?t:"#000",n=n!==void 0?n:"miter",i=i!==void 0?i:"butt",r=r!==void 0?r:4,{strokeColor:t,strokeWidth:e,strokeLineJoin:n,strokeLineCap:i,strokeMiterLimit:r}}static pointsToStroke(e,t,n,i){const r=[],o=[],a=[];if(Sa.pointsToStrokeWithBuffers(e,t,n,i,r,o,a)===0)return null;const l=new it;return l.setAttribute("position",new Ne(r,3)),l.setAttribute("normal",new Ne(o,3)),l.setAttribute("uv",new Ne(a,2)),l}static pointsToStrokeWithBuffers(e,t,n,i,r,o,a,l){const c=new se,u=new se,h=new se,d=new se,f=new se,g=new se,v=new se,m=new se,p=new se,y=new se,_=new se,x=new se,A=new se,b=new se,E=new se,I=new se,w=new se;n=n!==void 0?n:12,i=i!==void 0?i:.001,l=l!==void 0?l:0,e=K(e);const M=e.length;if(M<2)return 0;const F=e[0].equals(e[M-1]);let V,G=e[0],q;const ae=t.strokeWidth/2,Q=1/(M-1);let oe=0,B,Me,be,Ae,ge=!1,ze=0,U=l*3,D=l*2;R(e[0],e[1],c).multiplyScalar(ae),m.copy(e[0]).sub(c),p.copy(e[0]).add(c),y.copy(m),_.copy(p);for(let H=1;HNumber.EPSILON){const le=ae/te;h.multiplyScalar(-le),d.subVectors(V,G),f.copy(d).setLength(le).add(h),I.copy(f).negate();const k=f.length(),O=d.length();d.divideScalar(O),g.subVectors(q,V);const P=g.length();switch(g.divideScalar(P),d.dot(I)=i&&te.push(H[le]);return te.push(H[H.length-1]),te}}}const kw=`// // Description : Array and textureless GLSL 2D/3D/4D simplex // noise functions. // Author : Ian McEwan, Ashima Arts. // Maintainer : stegu // Lastmod : 20201014 (stegu) // License : Copyright (C) 2011 Ashima Arts. All rights reserved. // Distributed under the MIT License. See LICENSE file. // https://github.com/ashima/webgl-noise // https://github.com/stegu/webgl-noise // 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)+10.0)*x); } vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; } float snoise(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); // First corner vec3 i = floor(v + dot(v, C.yyy) ); vec3 x0 = v - i + dot(i, C.xxx) ; // Other corners 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 ); // x0 = x0 - 0.0 + 0.0 * C.xxx; // x1 = x0 - i1 + 1.0 * C.xxx; // x2 = x0 - i2 + 2.0 * C.xxx; // x3 = x0 - 1.0 + 3.0 * C.xxx; vec3 x1 = x0 - i1 + C.xxx; vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y // Permutations 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 )); // Gradients: 7x7 points over a square, mapped onto an octahedron. // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294) float n_ = 0.142857142857; // 1.0/7.0 vec3 ns = n_ * D.wyz - D.xzx; vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7) vec4 x_ = floor(j * ns.z); vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N) 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 = vec4(lessThan(b0,0.0))*2.0 - 1.0; //vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0; 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); //Normalise gradients 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; // Mix final noise value vec4 m = max(0.5 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0); m = m * m; return 105.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3) ) ); } // demo code: // float color(vec2 xy) { return 0.7 * snoise(vec3(xy, 0.3*iTime)); } // void mainImage(out vec4 fragColor, in vec2 fragCoord) { // vec2 p = (fragCoord.xy/iResolution.y) * 2.0 - 1.0; // vec3 xyz = vec3(p, 0); // vec2 step = vec2(1.3, 1.7); // float n = color(xyz.xy); // n += 0.5 * color(xyz.xy * 2.0 - step); // n += 0.25 * color(xyz.xy * 4.0 - 2.0 * step); // n += 0.125 * color(xyz.xy * 8.0 - 3.0 * step); // n += 0.0625 * color(xyz.xy * 16.0 - 4.0 * step); // n += 0.03125 * color(xyz.xy * 32.0 - 5.0 * step); // fragColor.xyz = vec3(0.5 + 0.5 * vec3(n, n, n)); // } `,Bw=` varying vec2 vUv; void main() { vec4 modelPosition = modelMatrix * vec4(position, 1.0); vec4 viewPosition = viewMatrix * modelPosition; gl_Position = projectionMatrix * viewPosition; vUv = uv; } `,zw=Be({__name:"Background",props:{mask:{}},async setup(s){let e,t;const n=s,{renderer:i,sizes:r}=xw(),{paths:o}=([e,t]=qm(()=>pw(Sa,"/circuit-board.svg")),e=await e,t(),e),a=o.map(p=>Sa.createShapes(p)).reduce((p,y)=>[...p,...y]),l=ke(()=>Math.ceil(r.height.value/304)),c=ke(()=>Math.ceil(r.width.value/304)),u=Ge(new se(1/0,1/0));function h(p){const{x:y,y:_,height:x}=i.value.domElement.getBoundingClientRect();u.value=new se(p.screenX-y,x+_+(window.outerHeight-window.innerHeight)-p.screenY),g.value&&g.value.children.forEach(A=>{A.material.uniforms.uMouse.value=u.value})}function d(p){p.relatedTarget||(u.value=new se(1/0,1/0),g.value&&g.value.children.forEach(y=>{y.material.uniforms.uMouse.value=u.value}))}Nn(()=>{window.addEventListener("mousemove",h),window.addEventListener("mouseout",d)}),Wn(()=>{window.removeEventListener("mousemove",h),window.removeEventListener("mouseout",d)});const{onLoop:f}=KS();f(({elapsed:p})=>{g.value&&g.value.children.forEach(y=>{y.material.uniforms.uTime.value=p})});const g=Rn(null),v={uColor:ke(()=>n.mask==null?new N:new N(.23,.26,.32)),uTime:{value:0},uMouse:{value:new se(1/0,1/0)}},m=` ${kw} precision mediump float; uniform float uTime; uniform vec2 uMouse; uniform vec3 uColor; varying vec2 vUv; void main() { float dist = distance(gl_FragCoord.xy, uMouse); float alpha = max(0., 1. - dist / 304.); alpha += max(0., snoise(vec3(gl_FragCoord.xy / 304., uTime / 4.))); gl_FragColor = vec4(mix(uColor, vec3(0.), alpha), uColor == vec3(0.) ? alpha : 1.); } `;return(p,y)=>{const _=cn("TresShapeGeometry"),x=cn("TresShaderMaterial"),A=cn("TresMesh"),b=cn("TresGroup");return j(i)?(Y(),$e(b,{key:0,ref_key:"groupRef",ref:g,renderOrder:1},{default:ye(()=>[(Y(!0),fe(xt,null,Jt(l.value*c.value,E=>(Y(),$e(A,{position:[(E%c.value-c.value/2)*304,(Math.floor((E-1)/c.value)-l.value/2)*304,1]},{default:ye(()=>[Fe(_,{args:[j(a)]},null,8,["args"]),Fe(x,{vertexShader:Bw,fragmentShader:m,uniforms:v,blending:j(ga),stencilWrite:p.mask!=null,stencilRef:p.mask??0,stencilFunc:j(Zf),stencilFail:j(Bn),stencilZFail:j(Bn),stencilZPass:j(Bn)},null,8,["blending","stencilWrite","stencilRef","stencilFunc","stencilFail","stencilZFail","stencilZPass"])]),_:2},1032,["position"]))),256))]),_:1},512)):De("",!0)}}}),Vw=Be({__name:"VPBadge",props:{text:{},type:{default:"tip"}},setup(s){return(e,t)=>(Y(),fe("span",{class:yt(["VPBadge",e.type])},[ue(e.$slots,"default",{},()=>[Ht(ft(e.text),1)])],2))}}),Hw={key:0,class:"VPBackdrop"},Gw=Be({__name:"VPBackdrop",props:{show:{type:Boolean}},setup(s){return(e,t)=>(Y(),$e(Zc,{name:"fade"},{default:ye(()=>[e.show?(Y(),fe("div",Hw)):De("",!0)]),_:1}))}}),Ww=Ye(Gw,[["__scopeId","data-v-c79a1216"]]),ot=Ym;function $w(s,e){let t,n=!1;return()=>{t&&clearTimeout(t),n?t=setTimeout(s,e):(s(),(n=!0)&&setTimeout(()=>n=!1,e))}}function Wc(s){return/^\//.test(s)?s:`/${s}`}function Hu(s){const{pathname:e,search:t,hash:n,protocol:i}=new URL(s,"http://a.com");if(Zm(s)||s.startsWith("#")||!i.startsWith("http")||!Jm(e))return s;const{site:r}=ot(),o=e.endsWith("/")||e.endsWith(".html")?s:s.replace(/(?:(^\.+)\/)?.*$/,`$1${e.replace(/(\.md)?$/,r.value.cleanUrls?"":".html")}${t}${n}`);return Jc(o)}function to({correspondingLink:s=!1}={}){const{site:e,localeIndex:t,page:n,theme:i,hash:r}=ot(),o=ke(()=>{var l,c;return{label:(l=e.value.locales[t.value])==null?void 0:l.label,link:((c=e.value.locales[t.value])==null?void 0:c.link)||(t.value==="root"?"/":`/${t.value}/`)}});return{localeLinks:ke(()=>Object.entries(e.value.locales).flatMap(([l,c])=>o.value.label===c.label?[]:{text:c.label,link:Xw(c.link||(l==="root"?"/":`/${l}/`),i.value.i18nRouting!==!1&&s,n.value.relativePath.slice(o.value.link.length-1),!e.value.cleanUrls)+r.value})),currentLang:o}}function Xw(s,e,t,n){return e?s.replace(/\/$/,"")+Wc(t.replace(/(^|\/)index\.md$/,"$1").replace(/\.md$/,n?".html":"")):s}const qw=s=>(Wt("data-v-d6be1790"),s=s(),$t(),s),Yw={class:"NotFound"},Zw={class:"code"},Jw={class:"title"},Kw=qw(()=>me("div",{class:"divider"},null,-1)),jw={class:"quote"},Qw={class:"action"},e1=["href","aria-label"],t1=Be({__name:"NotFound",setup(s){const{theme:e}=ot(),{currentLang:t}=to();return(n,i)=>{var r,o,a,l,c;return Y(),fe("div",Yw,[me("p",Zw,ft(((r=j(e).notFound)==null?void 0:r.code)??"404"),1),me("h1",Jw,ft(((o=j(e).notFound)==null?void 0:o.title)??"PAGE NOT FOUND"),1),Kw,me("blockquote",jw,ft(((a=j(e).notFound)==null?void 0:a.quote)??"But if you don't change your direction, and if you keep looking, you may end up where you are heading."),1),me("div",Qw,[me("a",{class:"link",href:j(Jc)(j(t).link),"aria-label":((l=j(e).notFound)==null?void 0:l.linkLabel)??"go to home"},ft(((c=j(e).notFound)==null?void 0:c.linkText)??"Take me home"),9,e1)])])}}}),n1=Ye(t1,[["__scopeId","data-v-d6be1790"]]);function Am(s,e){if(Array.isArray(s))return pa(s);if(s==null)return[];e=Wc(e);const t=Object.keys(s).sort((i,r)=>r.split("/").length-i.split("/").length).find(i=>e.startsWith(Wc(i))),n=t?s[t]:[];return Array.isArray(n)?pa(n):pa(n.items,n.base)}function i1(s){const e=[];let t=0;for(const n in s){const i=s[n];if(i.items){t=e.push(i);continue}e[t]||e.push({items:[]}),e[t].items.push(i)}return e}function s1(s){const e=[];function t(n){for(const i of n)i.text&&i.link&&e.push({text:i.text,link:i.link,docFooterText:i.docFooterText}),i.items&&t(i.items)}return t(s),e}function $c(s,e){return Array.isArray(e)?e.some(t=>$c(s,t)):is(s,e.link)?!0:e.items?$c(s,e.items):!1}function pa(s,e){return[...s].map(t=>{const n={...t},i=n.base||e;return i&&n.link&&(n.link=i+n.link),n.items&&(n.items=pa(n.items,i)),n})}function fi(){const{frontmatter:s,page:e,theme:t}=ot(),n=Kl("(min-width: 960px)"),i=Ge(!1),r=ke(()=>{const v=t.value.sidebar,m=e.value.relativePath;return v?Am(v,m):[]}),o=Ge(r.value);Ct(r,(v,m)=>{JSON.stringify(v)!==JSON.stringify(m)&&(o.value=r.value)});const a=ke(()=>s.value.sidebar!==!1&&o.value.length>0&&s.value.layout!=="home"),l=ke(()=>c?s.value.aside==null?t.value.aside==="left":s.value.aside==="left":!1),c=ke(()=>s.value.layout==="home"?!1:s.value.aside!=null?!!s.value.aside:t.value.aside!==!1),u=ke(()=>a.value&&n.value),h=ke(()=>a.value?i1(o.value):[]);function d(){i.value=!0}function f(){i.value=!1}function g(){i.value?f():d()}return{isOpen:i,sidebar:o,sidebarGroups:h,hasSidebar:a,hasAside:c,leftAside:l,isSidebarEnabled:u,open:d,close:f,toggle:g}}function r1(s,e){let t;Ri(()=>{t=s.value?document.activeElement:void 0}),Nn(()=>{window.addEventListener("keyup",n)}),Wn(()=>{window.removeEventListener("keyup",n)});function n(i){i.key==="Escape"&&s.value&&(e(),t==null||t.focus())}}function o1(s){const{page:e,hash:t}=ot(),n=Ge(!1),i=ke(()=>s.value.collapsed!=null),r=ke(()=>!!s.value.link),o=Ge(!1),a=()=>{o.value=is(e.value.relativePath,s.value.link)};Ct([e,s,t],a),Nn(a);const l=ke(()=>o.value?!0:s.value.items?$c(e.value.relativePath,s.value.items):!1),c=ke(()=>!!(s.value.items&&s.value.items.length));Ri(()=>{n.value=!!(i.value&&s.value.collapsed)}),qd(()=>{(o.value||l.value)&&(n.value=!1)});function u(){i.value&&(n.value=!n.value)}return{collapsed:n,collapsible:i,isLink:r,isActiveLink:o,hasActiveLink:l,hasChildren:c,toggle:u}}function a1(){const{hasSidebar:s}=fi(),e=Kl("(min-width: 960px)"),t=Kl("(min-width: 1280px)");return{isAsideEnabled:ke(()=>!t.value&&!e.value?!1:s.value?t.value:e.value)}}const Xc=[];function Tm(s){return typeof s.outline=="object"&&!Array.isArray(s.outline)&&s.outline.label||s.outlineTitle||"On this page"}function Gu(s){const e=[...document.querySelectorAll(".VPDoc :where(h1,h2,h3,h4,h5,h6)")].filter(t=>t.id&&t.hasChildNodes()).map(t=>{const n=Number(t.tagName[1]);return{element:t,title:l1(t),link:"#"+t.id,level:n}});return c1(e,s)}function l1(s){let e="";for(const t of s.childNodes)if(t.nodeType===1){if(t.classList.contains("VPBadge")||t.classList.contains("header-anchor")||t.classList.contains("ignore-header"))continue;e+=t.textContent}else t.nodeType===3&&(e+=t.textContent);return e.trim()}function c1(s,e){if(e===!1)return[];const t=(typeof e=="object"&&!Array.isArray(e)?e.level:e)||2,[n,i]=typeof t=="number"?[t,t]:t==="deep"?[2,6]:t;s=s.filter(o=>o.level>=n&&o.level<=i),Xc.length=0;for(const{element:o,link:a}of s)Xc.push({element:o,link:a});const r=[];e:for(let o=0;o=0;l--){const c=s[l];if(c.level{requestAnimationFrame(r),window.addEventListener("scroll",n)}),Km(()=>{o(location.hash)}),Wn(()=>{window.removeEventListener("scroll",n)});function r(){if(!t.value)return;const a=window.scrollY,l=window.innerHeight,c=document.body.offsetHeight,u=Math.abs(a+l-c)<1,h=Xc.map(({element:f,link:g})=>({link:g,top:h1(f)})).filter(({top:f})=>!Number.isNaN(f)).sort((f,g)=>f.top-g.top);if(!h.length){o(null);return}if(a<1){o(null);return}if(u){o(h[h.length-1].link);return}let d=null;for(const{link:f,top:g}of h){if(g>a+jm()+4)break;d=f}o(d)}function o(a){i&&i.classList.remove("active"),a==null?i=null:i=s.value.querySelector(`a[href="${decodeURIComponent(a)}"]`);const l=i;l?(l.classList.add("active"),e.value.style.top=l.offsetTop+39+"px",e.value.style.opacity="1"):(e.value.style.top="33px",e.value.style.opacity="0")}}function h1(s){let e=0;for(;s!==document.body;){if(s===null)return NaN;e+=s.offsetTop,s=s.offsetParent}return e}const d1=["href","title"],f1=Be({__name:"VPDocOutlineItem",props:{headers:{},root:{type:Boolean}},setup(s){function e({target:t}){const n=t.href.split("#")[1],i=document.getElementById(decodeURIComponent(n));i==null||i.focus({preventScroll:!0})}return(t,n)=>{const i=cn("VPDocOutlineItem",!0);return Y(),fe("ul",{class:yt(["VPDocOutlineItem",t.root?"root":"nested"])},[(Y(!0),fe(xt,null,Jt(t.headers,({children:r,link:o,title:a})=>(Y(),fe("li",null,[me("a",{class:"outline-link",href:o,onClick:e,title:a},ft(a),9,d1),r!=null&&r.length?(Y(),$e(i,{key:0,headers:r},null,8,["headers"])):De("",!0)]))),256))],2)}}}),Em=Ye(f1,[["__scopeId","data-v-b933a997"]]),p1={class:"content"},m1={"aria-level":"2",class:"outline-title",id:"doc-outline-aria-label",role:"heading"},g1=Be({__name:"VPDocAsideOutline",setup(s){const{frontmatter:e,theme:t}=ot(),n=Rn([]);Aa(()=>{n.value=Gu(e.value.outline??t.value.outline)});const i=Ge(),r=Ge();return u1(i,r),(o,a)=>(Y(),fe("nav",{"aria-labelledby":"doc-outline-aria-label",class:yt(["VPDocAsideOutline",{"has-outline":n.value.length>0}]),ref_key:"container",ref:i},[me("div",p1,[me("div",{class:"outline-marker",ref_key:"marker",ref:r},null,512),me("div",m1,ft(j(Tm)(j(t))),1),Fe(Em,{headers:n.value,root:!0},null,8,["headers"])])],2))}}),v1=Ye(g1,[["__scopeId","data-v-a5bbad30"]]),_1={class:"VPDocAsideCarbonAds"},y1=Be({__name:"VPDocAsideCarbonAds",props:{carbonAds:{}},setup(s){const e=()=>null;return(t,n)=>(Y(),fe("div",_1,[Fe(j(e),{"carbon-ads":t.carbonAds},null,8,["carbon-ads"])]))}}),x1=s=>(Wt("data-v-3f215769"),s=s(),$t(),s),M1={class:"VPDocAside"},b1=x1(()=>me("div",{class:"spacer"},null,-1)),S1=Be({__name:"VPDocAside",setup(s){const{theme:e}=ot();return(t,n)=>(Y(),fe("div",M1,[ue(t.$slots,"aside-top",{},void 0,!0),ue(t.$slots,"aside-outline-before",{},void 0,!0),Fe(v1),ue(t.$slots,"aside-outline-after",{},void 0,!0),b1,ue(t.$slots,"aside-ads-before",{},void 0,!0),j(e).carbonAds?(Y(),$e(y1,{key:0,"carbon-ads":j(e).carbonAds},null,8,["carbon-ads"])):De("",!0),ue(t.$slots,"aside-ads-after",{},void 0,!0),ue(t.$slots,"aside-bottom",{},void 0,!0)]))}}),w1=Ye(S1,[["__scopeId","data-v-3f215769"]]);function A1(){const{theme:s,page:e}=ot();return ke(()=>{const{text:t="Edit this page",pattern:n=""}=s.value.editLink||{};let i;return typeof n=="function"?i=n(e.value):i=n.replace(/:path/g,e.value.filePath),{url:i,text:t}})}function T1(){const{page:s,theme:e,frontmatter:t}=ot();return ke(()=>{var c,u,h,d,f,g,v,m;const n=Am(e.value.sidebar,s.value.relativePath),i=s1(n),r=E1(i,p=>p.link.replace(/[?#].*$/,"")),o=r.findIndex(p=>is(s.value.relativePath,p.link)),a=((c=e.value.docFooter)==null?void 0:c.prev)===!1&&!t.value.prev||t.value.prev===!1,l=((u=e.value.docFooter)==null?void 0:u.next)===!1&&!t.value.next||t.value.next===!1;return{prev:a?void 0:{text:(typeof t.value.prev=="string"?t.value.prev:typeof t.value.prev=="object"?t.value.prev.text:void 0)??((h=r[o-1])==null?void 0:h.docFooterText)??((d=r[o-1])==null?void 0:d.text),link:(typeof t.value.prev=="object"?t.value.prev.link:void 0)??((f=r[o-1])==null?void 0:f.link)},next:l?void 0:{text:(typeof t.value.next=="string"?t.value.next:typeof t.value.next=="object"?t.value.next.text:void 0)??((g=r[o+1])==null?void 0:g.docFooterText)??((v=r[o+1])==null?void 0:v.text),link:(typeof t.value.next=="object"?t.value.next.link:void 0)??((m=r[o+1])==null?void 0:m.link)}}})}function E1(s,e){const t=new Set;return s.filter(n=>{const i=e(n);return t.has(i)?!1:t.add(i)})}const Gn=Be({__name:"VPLink",props:{tag:{},href:{},noIcon:{type:Boolean},target:{},rel:{}},setup(s){const e=s,t=ke(()=>e.tag??(e.href?"a":"span")),n=ke(()=>e.href&&Yd.test(e.href)||e.target==="_blank");return(i,r)=>(Y(),$e(Bs(t.value),{class:yt(["VPLink",{link:i.href,"vp-external-link-icon":n.value,"no-icon":i.noIcon}]),href:i.href?j(Hu)(i.href):void 0,target:i.target??(n.value?"_blank":void 0),rel:i.rel??(n.value?"noreferrer":void 0)},{default:ye(()=>[ue(i.$slots,"default")]),_:3},8,["class","href","target","rel"]))}}),C1={class:"VPLastUpdated"},P1=["datetime"],R1=Be({__name:"VPDocFooterLastUpdated",setup(s){const{theme:e,page:t,frontmatter:n,lang:i}=ot(),r=ke(()=>new Date(n.value.lastUpdated??t.value.lastUpdated)),o=ke(()=>r.value.toISOString()),a=Ge("");return Nn(()=>{Ri(()=>{var l,c,u;a.value=new Intl.DateTimeFormat((c=(l=e.value.lastUpdated)==null?void 0:l.formatOptions)!=null&&c.forceLocale?i.value:void 0,((u=e.value.lastUpdated)==null?void 0:u.formatOptions)??{dateStyle:"short",timeStyle:"short"}).format(r.value)})}),(l,c)=>{var u;return Y(),fe("p",C1,[Ht(ft(((u=j(e).lastUpdated)==null?void 0:u.text)||j(e).lastUpdatedText||"Last updated")+": ",1),me("time",{datetime:o.value},ft(a.value),9,P1)])}}}),I1=Ye(R1,[["__scopeId","data-v-7e05ebdb"]]),Cm=s=>(Wt("data-v-d4a0bba5"),s=s(),$t(),s),L1={key:0,class:"VPDocFooter"},N1={key:0,class:"edit-info"},D1={key:0,class:"edit-link"},U1=Cm(()=>me("span",{class:"vpi-square-pen edit-link-icon"},null,-1)),O1={key:1,class:"last-updated"},F1={key:1,class:"prev-next","aria-labelledby":"doc-footer-aria-label"},k1=Cm(()=>me("span",{class:"visually-hidden",id:"doc-footer-aria-label"},"Pager",-1)),B1={class:"pager"},z1=["innerHTML"],V1=["innerHTML"],H1={class:"pager"},G1=["innerHTML"],W1=["innerHTML"],$1=Be({__name:"VPDocFooter",setup(s){const{theme:e,page:t,frontmatter:n}=ot(),i=A1(),r=T1(),o=ke(()=>e.value.editLink&&n.value.editLink!==!1),a=ke(()=>t.value.lastUpdated&&n.value.lastUpdated!==!1),l=ke(()=>o.value||a.value||r.value.prev||r.value.next);return(c,u)=>{var h,d,f,g;return l.value?(Y(),fe("footer",L1,[ue(c.$slots,"doc-footer-before",{},void 0,!0),o.value||a.value?(Y(),fe("div",N1,[o.value?(Y(),fe("div",D1,[Fe(Gn,{class:"edit-link-button",href:j(i).url,"no-icon":!0},{default:ye(()=>[U1,Ht(" "+ft(j(i).text),1)]),_:1},8,["href"])])):De("",!0),a.value?(Y(),fe("div",O1,[Fe(I1)])):De("",!0)])):De("",!0),(h=j(r).prev)!=null&&h.link||(d=j(r).next)!=null&&d.link?(Y(),fe("nav",F1,[k1,me("div",B1,[(f=j(r).prev)!=null&&f.link?(Y(),$e(Gn,{key:0,class:"pager-link prev",href:j(r).prev.link},{default:ye(()=>{var v;return[me("span",{class:"desc",innerHTML:((v=j(e).docFooter)==null?void 0:v.prev)||"Previous page"},null,8,z1),me("span",{class:"title",innerHTML:j(r).prev.text},null,8,V1)]}),_:1},8,["href"])):De("",!0)]),me("div",H1,[(g=j(r).next)!=null&&g.link?(Y(),$e(Gn,{key:0,class:"pager-link next",href:j(r).next.link},{default:ye(()=>{var v;return[me("span",{class:"desc",innerHTML:((v=j(e).docFooter)==null?void 0:v.next)||"Next page"},null,8,G1),me("span",{class:"title",innerHTML:j(r).next.text},null,8,W1)]}),_:1},8,["href"])):De("",!0)])])):De("",!0)])):De("",!0)}}}),X1=Ye($1,[["__scopeId","data-v-d4a0bba5"]]),q1=s=>(Wt("data-v-39a288b8"),s=s(),$t(),s),Y1={class:"container"},Z1=q1(()=>me("div",{class:"aside-curtain"},null,-1)),J1={class:"aside-container"},K1={class:"aside-content"},j1={class:"content"},Q1={class:"content-container"},eA={class:"main"},tA=Be({__name:"VPDoc",setup(s){const{theme:e}=ot(),t=Vr(),{hasSidebar:n,hasAside:i,leftAside:r}=fi(),o=ke(()=>t.path.replace(/[./]+/g,"_").replace(/_html$/,""));return(a,l)=>{const c=cn("Content");return Y(),fe("div",{class:yt(["VPDoc",{"has-sidebar":j(n),"has-aside":j(i)}])},[ue(a.$slots,"doc-top",{},void 0,!0),me("div",Y1,[j(i)?(Y(),fe("div",{key:0,class:yt(["aside",{"left-aside":j(r)}])},[Z1,me("div",J1,[me("div",K1,[Fe(w1,null,{"aside-top":ye(()=>[ue(a.$slots,"aside-top",{},void 0,!0)]),"aside-bottom":ye(()=>[ue(a.$slots,"aside-bottom",{},void 0,!0)]),"aside-outline-before":ye(()=>[ue(a.$slots,"aside-outline-before",{},void 0,!0)]),"aside-outline-after":ye(()=>[ue(a.$slots,"aside-outline-after",{},void 0,!0)]),"aside-ads-before":ye(()=>[ue(a.$slots,"aside-ads-before",{},void 0,!0)]),"aside-ads-after":ye(()=>[ue(a.$slots,"aside-ads-after",{},void 0,!0)]),_:3})])])],2)):De("",!0),me("div",j1,[me("div",Q1,[ue(a.$slots,"doc-before",{},void 0,!0),me("main",eA,[Fe(c,{class:yt(["vp-doc",[o.value,j(e).externalLinkIcon&&"external-link-icon-enabled"]])},null,8,["class"])]),Fe(X1,null,{"doc-footer-before":ye(()=>[ue(a.$slots,"doc-footer-before",{},void 0,!0)]),_:3}),ue(a.$slots,"doc-after",{},void 0,!0)])])]),ue(a.$slots,"doc-bottom",{},void 0,!0)],2)}}}),nA=Ye(tA,[["__scopeId","data-v-39a288b8"]]),iA=Be({__name:"VPButton",props:{tag:{},size:{default:"medium"},theme:{default:"brand"},text:{},href:{},target:{},rel:{}},setup(s){const e=s,t=ke(()=>e.href&&Yd.test(e.href)),n=ke(()=>e.tag||e.href?"a":"button");return(i,r)=>(Y(),$e(Bs(n.value),{class:yt(["VPButton",[i.size,i.theme]]),href:i.href?j(Hu)(i.href):void 0,target:e.target??(t.value?"_blank":void 0),rel:e.rel??(t.value?"noreferrer":void 0)},{default:ye(()=>[Ht(ft(i.text),1)]),_:1},8,["class","href","target","rel"]))}}),sA=Ye(iA,[["__scopeId","data-v-cad61b99"]]),rA=["src","alt"],oA=Be({inheritAttrs:!1,__name:"VPImage",props:{image:{},alt:{}},setup(s){return(e,t)=>{const n=cn("VPImage",!0);return e.image?(Y(),fe(xt,{key:0},[typeof e.image=="string"||"src"in e.image?(Y(),fe("img",ia({key:0,class:"VPImage"},typeof e.image=="string"?e.$attrs:{...e.image,...e.$attrs},{src:j(Jc)(typeof e.image=="string"?e.image:e.image.src),alt:e.alt??(typeof e.image=="string"?"":e.image.alt||"")}),null,16,rA)):(Y(),fe(xt,{key:1},[Fe(n,ia({class:"dark",image:e.image.dark,alt:e.image.alt},e.$attrs),null,16,["image","alt"]),Fe(n,ia({class:"light",image:e.image.light,alt:e.image.alt},e.$attrs),null,16,["image","alt"])],64))],64)):De("",!0)}}}),wa=Ye(oA,[["__scopeId","data-v-8426fc1a"]]),aA=s=>(Wt("data-v-303bb580"),s=s(),$t(),s),lA={class:"container"},cA={class:"main"},uA={key:0,class:"name"},hA=["innerHTML"],dA=["innerHTML"],fA=["innerHTML"],pA={key:0,class:"actions"},mA={key:0,class:"image"},gA={class:"image-container"},vA=aA(()=>me("div",{class:"image-bg"},null,-1)),_A=Be({__name:"VPHero",props:{name:{},text:{},tagline:{},image:{},actions:{}},setup(s){const e=zr("hero-image-slot-exists");return(t,n)=>(Y(),fe("div",{class:yt(["VPHero",{"has-image":t.image||j(e)}])},[me("div",lA,[me("div",cA,[ue(t.$slots,"home-hero-info-before",{},void 0,!0),ue(t.$slots,"home-hero-info",{},()=>[t.name?(Y(),fe("h1",uA,[me("span",{innerHTML:t.name,class:"clip"},null,8,hA)])):De("",!0),t.text?(Y(),fe("p",{key:1,innerHTML:t.text,class:"text"},null,8,dA)):De("",!0),t.tagline?(Y(),fe("p",{key:2,innerHTML:t.tagline,class:"tagline"},null,8,fA)):De("",!0)],!0),ue(t.$slots,"home-hero-info-after",{},void 0,!0),t.actions?(Y(),fe("div",pA,[(Y(!0),fe(xt,null,Jt(t.actions,i=>(Y(),fe("div",{key:i.link,class:"action"},[Fe(sA,{tag:"a",size:"medium",theme:i.theme,text:i.text,href:i.link,target:i.target,rel:i.rel},null,8,["theme","text","href","target","rel"])]))),128))])):De("",!0),ue(t.$slots,"home-hero-actions-after",{},void 0,!0)]),t.image||j(e)?(Y(),fe("div",mA,[me("div",gA,[vA,ue(t.$slots,"home-hero-image",{},()=>[t.image?(Y(),$e(wa,{key:0,class:"image-src",image:t.image},null,8,["image"])):De("",!0)],!0)])])):De("",!0)])],2))}}),yA=Ye(_A,[["__scopeId","data-v-303bb580"]]),xA=Be({__name:"VPHomeHero",setup(s){const{frontmatter:e}=ot();return(t,n)=>j(e).hero?(Y(),$e(yA,{key:0,class:"VPHomeHero",name:j(e).hero.name,text:j(e).hero.text,tagline:j(e).hero.tagline,image:j(e).hero.image,actions:j(e).hero.actions},{"home-hero-info-before":ye(()=>[ue(t.$slots,"home-hero-info-before")]),"home-hero-info":ye(()=>[ue(t.$slots,"home-hero-info")]),"home-hero-info-after":ye(()=>[ue(t.$slots,"home-hero-info-after")]),"home-hero-actions-after":ye(()=>[ue(t.$slots,"home-hero-actions-after")]),"home-hero-image":ye(()=>[ue(t.$slots,"home-hero-image")]),_:3},8,["name","text","tagline","image","actions"])):De("",!0)}}),MA=s=>(Wt("data-v-a3976bdc"),s=s(),$t(),s),bA={class:"box"},SA={key:0,class:"icon"},wA=["innerHTML"],AA=["innerHTML"],TA=["innerHTML"],EA={key:4,class:"link-text"},CA={class:"link-text-value"},PA=MA(()=>me("span",{class:"vpi-arrow-right link-text-icon"},null,-1)),RA=Be({__name:"VPFeature",props:{icon:{},title:{},details:{},link:{},linkText:{},rel:{},target:{}},setup(s){return(e,t)=>(Y(),$e(Gn,{class:"VPFeature",href:e.link,rel:e.rel,target:e.target,"no-icon":!0,tag:e.link?"a":"div"},{default:ye(()=>[me("article",bA,[typeof e.icon=="object"&&e.icon.wrap?(Y(),fe("div",SA,[Fe(wa,{image:e.icon,alt:e.icon.alt,height:e.icon.height||48,width:e.icon.width||48},null,8,["image","alt","height","width"])])):typeof e.icon=="object"?(Y(),$e(wa,{key:1,image:e.icon,alt:e.icon.alt,height:e.icon.height||48,width:e.icon.width||48},null,8,["image","alt","height","width"])):e.icon?(Y(),fe("div",{key:2,class:"icon",innerHTML:e.icon},null,8,wA)):De("",!0),me("h2",{class:"title",innerHTML:e.title},null,8,AA),e.details?(Y(),fe("p",{key:3,class:"details",innerHTML:e.details},null,8,TA)):De("",!0),e.linkText?(Y(),fe("div",EA,[me("p",CA,[Ht(ft(e.linkText)+" ",1),PA])])):De("",!0)])]),_:1},8,["href","rel","target","tag"]))}}),IA=Ye(RA,[["__scopeId","data-v-a3976bdc"]]),LA={key:0,class:"VPFeatures"},NA={class:"container"},DA={class:"items"},UA=Be({__name:"VPFeatures",props:{features:{}},setup(s){const e=s,t=ke(()=>{const n=e.features.length;if(n){if(n===2)return"grid-2";if(n===3)return"grid-3";if(n%3===0)return"grid-6";if(n>3)return"grid-4"}else return});return(n,i)=>n.features?(Y(),fe("div",LA,[me("div",NA,[me("div",DA,[(Y(!0),fe(xt,null,Jt(n.features,r=>(Y(),fe("div",{key:r.title,class:yt(["item",[t.value]])},[Fe(IA,{icon:r.icon,title:r.title,details:r.details,link:r.link,"link-text":r.linkText,rel:r.rel,target:r.target},null,8,["icon","title","details","link","link-text","rel","target"])],2))),128))])])])):De("",!0)}}),OA=Ye(UA,[["__scopeId","data-v-a6181336"]]),FA=Be({__name:"VPHomeFeatures",setup(s){const{frontmatter:e}=ot();return(t,n)=>j(e).features?(Y(),$e(OA,{key:0,class:"VPHomeFeatures",features:j(e).features},null,8,["features"])):De("",!0)}}),kA=Be({__name:"VPHomeContent",setup(s){const{width:e}=Qm({initialWidth:0,includeScrollbar:!1});return(t,n)=>(Y(),fe("div",{class:"vp-doc container",style:Yc(j(e)?{"--vp-offset":`calc(50% - ${j(e)/2}px)`}:{})},[ue(t.$slots,"default",{},void 0,!0)],4))}}),BA=Ye(kA,[["__scopeId","data-v-8e2d4988"]]),zA={class:"VPHome"},VA=Be({__name:"VPHome",setup(s){const{frontmatter:e}=ot();return(t,n)=>{const i=cn("Content");return Y(),fe("div",zA,[ue(t.$slots,"home-hero-before",{},void 0,!0),Fe(xA,null,{"home-hero-info-before":ye(()=>[ue(t.$slots,"home-hero-info-before",{},void 0,!0)]),"home-hero-info":ye(()=>[ue(t.$slots,"home-hero-info",{},void 0,!0)]),"home-hero-info-after":ye(()=>[ue(t.$slots,"home-hero-info-after",{},void 0,!0)]),"home-hero-actions-after":ye(()=>[ue(t.$slots,"home-hero-actions-after",{},void 0,!0)]),"home-hero-image":ye(()=>[ue(t.$slots,"home-hero-image",{},void 0,!0)]),_:3}),ue(t.$slots,"home-hero-after",{},void 0,!0),ue(t.$slots,"home-features-before",{},void 0,!0),Fe(FA),ue(t.$slots,"home-features-after",{},void 0,!0),j(e).markdownStyles!==!1?(Y(),$e(BA,{key:0},{default:ye(()=>[Fe(i)]),_:1})):(Y(),$e(i,{key:1}))])}}}),HA=Ye(VA,[["__scopeId","data-v-686f80a6"]]),GA={},WA={class:"VPPage"};function $A(s,e){const t=cn("Content");return Y(),fe("div",WA,[ue(s.$slots,"page-top"),Fe(t),ue(s.$slots,"page-bottom")])}const XA=Ye(GA,[["render",$A]]),qA=Be({__name:"VPContent",setup(s){const{page:e,frontmatter:t}=ot(),{hasSidebar:n}=fi();return(i,r)=>(Y(),fe("div",{class:yt(["VPContent",{"has-sidebar":j(n),"is-home":j(t).layout==="home"}]),id:"VPContent"},[j(e).isNotFound?ue(i.$slots,"not-found",{key:0},()=>[Fe(n1)],!0):j(t).layout==="page"?(Y(),$e(XA,{key:1},{"page-top":ye(()=>[ue(i.$slots,"page-top",{},void 0,!0)]),"page-bottom":ye(()=>[ue(i.$slots,"page-bottom",{},void 0,!0)]),_:3})):j(t).layout==="home"?(Y(),$e(HA,{key:2},{"home-hero-before":ye(()=>[ue(i.$slots,"home-hero-before",{},void 0,!0)]),"home-hero-info-before":ye(()=>[ue(i.$slots,"home-hero-info-before",{},void 0,!0)]),"home-hero-info":ye(()=>[ue(i.$slots,"home-hero-info",{},void 0,!0)]),"home-hero-info-after":ye(()=>[ue(i.$slots,"home-hero-info-after",{},void 0,!0)]),"home-hero-actions-after":ye(()=>[ue(i.$slots,"home-hero-actions-after",{},void 0,!0)]),"home-hero-image":ye(()=>[ue(i.$slots,"home-hero-image",{},void 0,!0)]),"home-hero-after":ye(()=>[ue(i.$slots,"home-hero-after",{},void 0,!0)]),"home-features-before":ye(()=>[ue(i.$slots,"home-features-before",{},void 0,!0)]),"home-features-after":ye(()=>[ue(i.$slots,"home-features-after",{},void 0,!0)]),_:3})):j(t).layout&&j(t).layout!=="doc"?(Y(),$e(Bs(j(t).layout),{key:3})):(Y(),$e(nA,{key:4},{"doc-top":ye(()=>[ue(i.$slots,"doc-top",{},void 0,!0)]),"doc-bottom":ye(()=>[ue(i.$slots,"doc-bottom",{},void 0,!0)]),"doc-footer-before":ye(()=>[ue(i.$slots,"doc-footer-before",{},void 0,!0)]),"doc-before":ye(()=>[ue(i.$slots,"doc-before",{},void 0,!0)]),"doc-after":ye(()=>[ue(i.$slots,"doc-after",{},void 0,!0)]),"aside-top":ye(()=>[ue(i.$slots,"aside-top",{},void 0,!0)]),"aside-outline-before":ye(()=>[ue(i.$slots,"aside-outline-before",{},void 0,!0)]),"aside-outline-after":ye(()=>[ue(i.$slots,"aside-outline-after",{},void 0,!0)]),"aside-ads-before":ye(()=>[ue(i.$slots,"aside-ads-before",{},void 0,!0)]),"aside-ads-after":ye(()=>[ue(i.$slots,"aside-ads-after",{},void 0,!0)]),"aside-bottom":ye(()=>[ue(i.$slots,"aside-bottom",{},void 0,!0)]),_:3}))],2))}}),YA=Ye(qA,[["__scopeId","data-v-1428d186"]]),ZA={class:"container"},JA=["innerHTML"],KA=["innerHTML"],jA=Be({__name:"VPFooter",setup(s){const{theme:e,frontmatter:t}=ot(),{hasSidebar:n}=fi();return(i,r)=>j(e).footer&&j(t).footer!==!1?(Y(),fe("footer",{key:0,class:yt(["VPFooter",{"has-sidebar":j(n)}])},[me("div",ZA,[j(e).footer.message?(Y(),fe("p",{key:0,class:"message",innerHTML:j(e).footer.message},null,8,JA)):De("",!0),j(e).footer.copyright?(Y(),fe("p",{key:1,class:"copyright",innerHTML:j(e).footer.copyright},null,8,KA)):De("",!0)])],2)):De("",!0)}}),QA=Ye(jA,[["__scopeId","data-v-e315a0ad"]]);function eT(){const{theme:s,frontmatter:e}=ot(),t=Rn([]),n=ke(()=>t.value.length>0);return Aa(()=>{t.value=Gu(e.value.outline??s.value.outline)}),{headers:t,hasLocalNav:n}}const tT=s=>(Wt("data-v-17a5e62e"),s=s(),$t(),s),nT={class:"menu-text"},iT=tT(()=>me("span",{class:"vpi-chevron-right icon"},null,-1)),sT={class:"header"},rT={class:"outline"},oT=Be({__name:"VPLocalNavOutlineDropdown",props:{headers:{},navHeight:{}},setup(s){const e=s,{theme:t}=ot(),n=Ge(!1),i=Ge(0),r=Ge(),o=Ge();function a(h){var d;(d=r.value)!=null&&d.contains(h.target)||(n.value=!1)}Ct(n,h=>{if(h){document.addEventListener("click",a);return}document.removeEventListener("click",a)}),jl("Escape",()=>{n.value=!1}),Aa(()=>{n.value=!1});function l(){n.value=!n.value,i.value=window.innerHeight+Math.min(window.scrollY-e.navHeight,0)}function c(h){h.target.classList.contains("outline-link")&&(o.value&&(o.value.style.transition="none"),qc(()=>{n.value=!1}))}function u(){n.value=!1,window.scrollTo({top:0,left:0,behavior:"smooth"})}return(h,d)=>(Y(),fe("div",{class:"VPLocalNavOutlineDropdown",style:Yc({"--vp-vh":i.value+"px"}),ref_key:"main",ref:r},[h.headers.length>0?(Y(),fe("button",{key:0,onClick:l,class:yt({open:n.value})},[me("span",nT,ft(j(Tm)(j(t))),1),iT],2)):(Y(),fe("button",{key:1,onClick:u},ft(j(t).returnToTopLabel||"Return to top"),1)),Fe(Zc,{name:"flyout"},{default:ye(()=>[n.value?(Y(),fe("div",{key:0,ref_key:"items",ref:o,class:"items",onClick:c},[me("div",sT,[me("a",{class:"top-link",href:"#",onClick:u},ft(j(t).returnToTopLabel||"Return to top"),1)]),me("div",rT,[Fe(Em,{headers:h.headers},null,8,["headers"])])],512)):De("",!0)]),_:1})],4))}}),aT=Ye(oT,[["__scopeId","data-v-17a5e62e"]]),lT=s=>(Wt("data-v-a6f0e41e"),s=s(),$t(),s),cT={class:"container"},uT=["aria-expanded"],hT=lT(()=>me("span",{class:"vpi-align-left menu-icon"},null,-1)),dT={class:"menu-text"},fT=Be({__name:"VPLocalNav",props:{open:{type:Boolean}},emits:["open-menu"],setup(s){const{theme:e,frontmatter:t}=ot(),{hasSidebar:n}=fi(),{headers:i}=eT(),{y:r}=Zd(),o=Ge(0);Nn(()=>{o.value=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--vp-nav-height"))}),Aa(()=>{i.value=Gu(t.value.outline??e.value.outline)});const a=ke(()=>i.value.length===0),l=ke(()=>a.value&&!n.value),c=ke(()=>({VPLocalNav:!0,"has-sidebar":n.value,empty:a.value,fixed:l.value}));return(u,h)=>j(t).layout!=="home"&&(!l.value||j(r)>=o.value)?(Y(),fe("div",{key:0,class:yt(c.value)},[me("div",cT,[j(n)?(Y(),fe("button",{key:0,class:"menu","aria-expanded":u.open,"aria-controls":"VPSidebarNav",onClick:h[0]||(h[0]=d=>u.$emit("open-menu"))},[hT,me("span",dT,ft(j(e).sidebarMenuLabel||"Menu"),1)],8,uT)):De("",!0),Fe(aT,{headers:j(i),navHeight:o.value},null,8,["headers","navHeight"])])],2)):De("",!0)}}),pT=Ye(fT,[["__scopeId","data-v-a6f0e41e"]]);function mT(){const s=Ge(!1);function e(){s.value=!0,window.addEventListener("resize",i)}function t(){s.value=!1,window.removeEventListener("resize",i)}function n(){s.value?t():e()}function i(){window.outerWidth>=768&&t()}const r=Vr();return Ct(()=>r.path,t),{isScreenOpen:s,openScreen:e,closeScreen:t,toggleScreen:n}}const gT={},vT={class:"VPSwitch",type:"button",role:"switch"},_T={class:"check"},yT={key:0,class:"icon"};function xT(s,e){return Y(),fe("button",vT,[me("span",_T,[s.$slots.default?(Y(),fe("span",yT,[ue(s.$slots,"default",{},void 0,!0)])):De("",!0)])])}const MT=Ye(gT,[["render",xT],["__scopeId","data-v-1d5665e3"]]),Pm=s=>(Wt("data-v-d1f28634"),s=s(),$t(),s),bT=Pm(()=>me("span",{class:"vpi-sun sun"},null,-1)),ST=Pm(()=>me("span",{class:"vpi-moon moon"},null,-1)),wT=Be({__name:"VPSwitchAppearance",setup(s){const{isDark:e,theme:t}=ot(),n=zr("toggle-appearance",()=>{e.value=!e.value}),i=ke(()=>e.value?t.value.lightModeSwitchTitle||"Switch to light theme":t.value.darkModeSwitchTitle||"Switch to dark theme");return(r,o)=>(Y(),$e(MT,{title:i.value,class:"VPSwitchAppearance","aria-checked":j(e),onClick:j(n)},{default:ye(()=>[bT,ST]),_:1},8,["title","aria-checked","onClick"]))}}),Wu=Ye(wT,[["__scopeId","data-v-d1f28634"]]),AT={key:0,class:"VPNavBarAppearance"},TT=Be({__name:"VPNavBarAppearance",setup(s){const{site:e}=ot();return(t,n)=>j(e).appearance&&j(e).appearance!=="force-dark"?(Y(),fe("div",AT,[Fe(Wu)])):De("",!0)}}),ET=Ye(TT,[["__scopeId","data-v-e6aabb21"]]),$u=Ge();let Rm=!1,Jl=0;function CT(s){const e=Ge(!1);if(Ta){!Rm&&PT(),Jl++;const t=Ct($u,n=>{var i,r,o;n===s.el.value||(i=s.el.value)!=null&&i.contains(n)?(e.value=!0,(r=s.onFocus)==null||r.call(s)):(e.value=!1,(o=s.onBlur)==null||o.call(s))});Wn(()=>{t(),Jl--,Jl||RT()})}return gr(e)}function PT(){document.addEventListener("focusin",Im),Rm=!0,$u.value=document.activeElement}function RT(){document.removeEventListener("focusin",Im)}function Im(){$u.value=document.activeElement}const IT={class:"VPMenuLink"},LT=Be({__name:"VPMenuLink",props:{item:{}},setup(s){const{page:e}=ot();return(t,n)=>(Y(),fe("div",IT,[Fe(Gn,{class:yt({active:j(is)(j(e).relativePath,t.item.activeMatch||t.item.link,!!t.item.activeMatch)}),href:t.item.link,target:t.item.target,rel:t.item.rel},{default:ye(()=>[Ht(ft(t.item.text),1)]),_:1},8,["class","href","target","rel"])]))}}),sl=Ye(LT,[["__scopeId","data-v-43f1e123"]]),NT={class:"VPMenuGroup"},DT={key:0,class:"title"},UT=Be({__name:"VPMenuGroup",props:{text:{},items:{}},setup(s){return(e,t)=>(Y(),fe("div",NT,[e.text?(Y(),fe("p",DT,ft(e.text),1)):De("",!0),(Y(!0),fe(xt,null,Jt(e.items,n=>(Y(),fe(xt,null,["link"in n?(Y(),$e(sl,{key:0,item:n},null,8,["item"])):De("",!0)],64))),256))]))}}),OT=Ye(UT,[["__scopeId","data-v-69e747b5"]]),FT={class:"VPMenu"},kT={key:0,class:"items"},BT=Be({__name:"VPMenu",props:{items:{}},setup(s){return(e,t)=>(Y(),fe("div",FT,[e.items?(Y(),fe("div",kT,[(Y(!0),fe(xt,null,Jt(e.items,n=>(Y(),fe(xt,{key:n.text},["link"in n?(Y(),$e(sl,{key:0,item:n},null,8,["item"])):(Y(),$e(OT,{key:1,text:n.text,items:n.items},null,8,["text","items"]))],64))),128))])):De("",!0),ue(e.$slots,"default",{},void 0,!0)]))}}),zT=Ye(BT,[["__scopeId","data-v-e7ea1737"]]),VT=s=>(Wt("data-v-b6c34ac9"),s=s(),$t(),s),HT=["aria-expanded","aria-label"],GT={key:0,class:"text"},WT=["innerHTML"],$T=VT(()=>me("span",{class:"vpi-chevron-down text-icon"},null,-1)),XT={key:1,class:"vpi-more-horizontal icon"},qT={class:"menu"},YT=Be({__name:"VPFlyout",props:{icon:{},button:{},label:{},items:{}},setup(s){const e=Ge(!1),t=Ge();CT({el:t,onBlur:n});function n(){e.value=!1}return(i,r)=>(Y(),fe("div",{class:"VPFlyout",ref_key:"el",ref:t,onMouseenter:r[1]||(r[1]=o=>e.value=!0),onMouseleave:r[2]||(r[2]=o=>e.value=!1)},[me("button",{type:"button",class:"button","aria-haspopup":"true","aria-expanded":e.value,"aria-label":i.label,onClick:r[0]||(r[0]=o=>e.value=!e.value)},[i.button||i.icon?(Y(),fe("span",GT,[i.icon?(Y(),fe("span",{key:0,class:yt([i.icon,"option-icon"])},null,2)):De("",!0),i.button?(Y(),fe("span",{key:1,innerHTML:i.button},null,8,WT)):De("",!0),$T])):(Y(),fe("span",XT))],8,HT),me("div",qT,[Fe(zT,{items:i.items},{default:ye(()=>[ue(i.$slots,"default",{},void 0,!0)]),_:3},8,["items"])])],544))}}),Xu=Ye(YT,[["__scopeId","data-v-b6c34ac9"]]),ZT=["href","aria-label","innerHTML"],JT=Be({__name:"VPSocialLink",props:{icon:{},link:{},ariaLabel:{}},setup(s){const e=s,t=ke(()=>typeof e.icon=="object"?e.icon.svg:``);return(n,i)=>(Y(),fe("a",{class:"VPSocialLink no-icon",href:n.link,"aria-label":n.ariaLabel??(typeof n.icon=="string"?n.icon:""),target:"_blank",rel:"noopener",innerHTML:t.value},null,8,ZT))}}),KT=Ye(JT,[["__scopeId","data-v-eee4e7cb"]]),jT={class:"VPSocialLinks"},QT=Be({__name:"VPSocialLinks",props:{links:{}},setup(s){return(e,t)=>(Y(),fe("div",jT,[(Y(!0),fe(xt,null,Jt(e.links,({link:n,icon:i,ariaLabel:r})=>(Y(),$e(KT,{key:n,icon:i,link:n,ariaLabel:r},null,8,["icon","link","ariaLabel"]))),128))]))}}),qu=Ye(QT,[["__scopeId","data-v-7bc22406"]]),eE={key:0,class:"group translations"},tE={class:"trans-title"},nE={key:1,class:"group"},iE={class:"item appearance"},sE={class:"label"},rE={class:"appearance-action"},oE={key:2,class:"group"},aE={class:"item social-links"},lE=Be({__name:"VPNavBarExtra",setup(s){const{site:e,theme:t}=ot(),{localeLinks:n,currentLang:i}=to({correspondingLink:!0}),r=ke(()=>n.value.length&&i.value.label||e.value.appearance||t.value.socialLinks);return(o,a)=>r.value?(Y(),$e(Xu,{key:0,class:"VPNavBarExtra",label:"extra navigation"},{default:ye(()=>[j(n).length&&j(i).label?(Y(),fe("div",eE,[me("p",tE,ft(j(i).label),1),(Y(!0),fe(xt,null,Jt(j(n),l=>(Y(),$e(sl,{key:l.link,item:l},null,8,["item"]))),128))])):De("",!0),j(e).appearance&&j(e).appearance!=="force-dark"?(Y(),fe("div",nE,[me("div",iE,[me("p",sE,ft(j(t).darkModeSwitchLabel||"Appearance"),1),me("div",rE,[Fe(Wu)])])])):De("",!0),j(t).socialLinks?(Y(),fe("div",oE,[me("div",aE,[Fe(qu,{class:"social-links-list",links:j(t).socialLinks},null,8,["links"])])])):De("",!0)]),_:1})):De("",!0)}}),cE=Ye(lE,[["__scopeId","data-v-d0bd9dde"]]),uE=s=>(Wt("data-v-e5dd9c1c"),s=s(),$t(),s),hE=["aria-expanded"],dE=uE(()=>me("span",{class:"container"},[me("span",{class:"top"}),me("span",{class:"middle"}),me("span",{class:"bottom"})],-1)),fE=[dE],pE=Be({__name:"VPNavBarHamburger",props:{active:{type:Boolean}},emits:["click"],setup(s){return(e,t)=>(Y(),fe("button",{type:"button",class:yt(["VPNavBarHamburger",{active:e.active}]),"aria-label":"mobile navigation","aria-expanded":e.active,"aria-controls":"VPNavScreen",onClick:t[0]||(t[0]=n=>e.$emit("click"))},fE,10,hE))}}),mE=Ye(pE,[["__scopeId","data-v-e5dd9c1c"]]),gE=["innerHTML"],vE=Be({__name:"VPNavBarMenuLink",props:{item:{}},setup(s){const{page:e}=ot();return(t,n)=>(Y(),$e(Gn,{class:yt({VPNavBarMenuLink:!0,active:j(is)(j(e).relativePath,t.item.activeMatch||t.item.link,!!t.item.activeMatch)}),href:t.item.link,noIcon:t.item.noIcon,target:t.item.target,rel:t.item.rel,tabindex:"0"},{default:ye(()=>[me("span",{innerHTML:t.item.text},null,8,gE)]),_:1},8,["class","href","noIcon","target","rel"]))}}),_E=Ye(vE,[["__scopeId","data-v-9c663999"]]),yE=Be({__name:"VPNavBarMenuGroup",props:{item:{}},setup(s){const e=s,{page:t}=ot(),n=r=>"link"in r?is(t.value.relativePath,r.link,!!e.item.activeMatch):r.items.some(n),i=ke(()=>n(e.item));return(r,o)=>(Y(),$e(Xu,{class:yt({VPNavBarMenuGroup:!0,active:j(is)(j(t).relativePath,r.item.activeMatch,!!r.item.activeMatch)||i.value}),button:r.item.text,items:r.item.items},null,8,["class","button","items"]))}}),xE=s=>(Wt("data-v-7f418b0f"),s=s(),$t(),s),ME={key:0,"aria-labelledby":"main-nav-aria-label",class:"VPNavBarMenu"},bE=xE(()=>me("span",{id:"main-nav-aria-label",class:"visually-hidden"},"Main Navigation",-1)),SE=Be({__name:"VPNavBarMenu",setup(s){const{theme:e}=ot();return(t,n)=>j(e).nav?(Y(),fe("nav",ME,[bE,(Y(!0),fe(xt,null,Jt(j(e).nav,i=>(Y(),fe(xt,{key:i.text},["link"in i?(Y(),$e(_E,{key:0,item:i},null,8,["item"])):(Y(),$e(yE,{key:1,item:i},null,8,["item"]))],64))),128))])):De("",!0)}}),wE=Ye(SE,[["__scopeId","data-v-7f418b0f"]]);function AE(s){const{localeIndex:e,theme:t}=ot();function n(i){var g,v,m;const r=i.split("."),o=(g=t.value.search)==null?void 0:g.options,a=o&&typeof o=="object",l=a&&((m=(v=o.locales)==null?void 0:v[e.value])==null?void 0:m.translations)||null,c=a&&o.translations||null;let u=l,h=c,d=s;const f=r.pop();for(const p of r){let y=null;const _=d==null?void 0:d[p];_&&(y=d=_);const x=h==null?void 0:h[p];x&&(y=h=x);const A=u==null?void 0:u[p];A&&(y=u=A),_||(d=y),x||(h=y),A||(u=y)}return(u==null?void 0:u[f])??(h==null?void 0:h[f])??(d==null?void 0:d[f])??""}return n}const TE=["aria-label"],EE={class:"DocSearch-Button-Container"},CE=me("span",{class:"vp-icon DocSearch-Search-Icon"},null,-1),PE={class:"DocSearch-Button-Placeholder"},RE=me("span",{class:"DocSearch-Button-Keys"},[me("kbd",{class:"DocSearch-Button-Key"}),me("kbd",{class:"DocSearch-Button-Key"},"K")],-1),Wd=Be({__name:"VPNavBarSearchButton",setup(s){const t=AE({button:{buttonText:"Search",buttonAriaLabel:"Search"}});return(n,i)=>(Y(),fe("button",{type:"button",class:"DocSearch DocSearch-Button","aria-label":j(t)("button.buttonAriaLabel")},[me("span",EE,[CE,me("span",PE,ft(j(t)("button.buttonText")),1)]),RE],8,TE))}}),IE={class:"VPNavBarSearch"},LE={id:"local-search"},NE={key:1,id:"docsearch"},DE=Be({__name:"VPNavBarSearch",setup(s){const e=eg(()=>tg(()=>import("./VPLocalSearchBox.CuzPtg3-.js"),__vite__mapDeps([0,1]))),t=()=>null,{theme:n}=ot(),i=Ge(!1),r=Ge(!1);Nn(()=>{});function o(){i.value||(i.value=!0,setTimeout(a,16))}function a(){const h=new Event("keydown");h.key="k",h.metaKey=!0,window.dispatchEvent(h),setTimeout(()=>{document.querySelector(".DocSearch-Modal")||a()},16)}function l(h){const d=h.target,f=d.tagName;return d.isContentEditable||f==="INPUT"||f==="SELECT"||f==="TEXTAREA"}const c=Ge(!1);jl("k",h=>{(h.ctrlKey||h.metaKey)&&(h.preventDefault(),c.value=!0)}),jl("/",h=>{l(h)||(h.preventDefault(),c.value=!0)});const u="local";return(h,d)=>{var f;return Y(),fe("div",IE,[j(u)==="local"?(Y(),fe(xt,{key:0},[c.value?(Y(),$e(j(e),{key:0,onClose:d[0]||(d[0]=g=>c.value=!1)})):De("",!0),me("div",LE,[Fe(Wd,{onClick:d[1]||(d[1]=g=>c.value=!0)})])],64)):j(u)==="algolia"?(Y(),fe(xt,{key:1},[i.value?(Y(),$e(j(t),{key:0,algolia:((f=j(n).search)==null?void 0:f.options)??j(n).algolia,onVnodeBeforeMount:d[2]||(d[2]=g=>r.value=!0)},null,8,["algolia"])):De("",!0),r.value?De("",!0):(Y(),fe("div",NE,[Fe(Wd,{onClick:o})]))],64)):De("",!0)])}}}),UE=Be({__name:"VPNavBarSocialLinks",setup(s){const{theme:e}=ot();return(t,n)=>j(e).socialLinks?(Y(),$e(qu,{key:0,class:"VPNavBarSocialLinks",links:j(e).socialLinks},null,8,["links"])):De("",!0)}}),OE=Ye(UE,[["__scopeId","data-v-0394ad82"]]),FE=["href","rel","target"],kE={key:1},BE={key:2},zE=Be({__name:"VPNavBarTitle",setup(s){const{site:e,theme:t}=ot(),{hasSidebar:n}=fi(),{currentLang:i}=to(),r=ke(()=>{var l;return typeof t.value.logoLink=="string"?t.value.logoLink:(l=t.value.logoLink)==null?void 0:l.link}),o=ke(()=>{var l;return typeof t.value.logoLink=="string"||(l=t.value.logoLink)==null?void 0:l.rel}),a=ke(()=>{var l;return typeof t.value.logoLink=="string"||(l=t.value.logoLink)==null?void 0:l.target});return(l,c)=>(Y(),fe("div",{class:yt(["VPNavBarTitle",{"has-sidebar":j(n)}])},[me("a",{class:"title",href:r.value??j(Hu)(j(i).link),rel:o.value,target:a.value},[ue(l.$slots,"nav-bar-title-before",{},void 0,!0),j(t).logo?(Y(),$e(wa,{key:0,class:"logo",image:j(t).logo},null,8,["image"])):De("",!0),j(t).siteTitle?(Y(),fe("span",kE,ft(j(t).siteTitle),1)):j(t).siteTitle===void 0?(Y(),fe("span",BE,ft(j(e).title),1)):De("",!0),ue(l.$slots,"nav-bar-title-after",{},void 0,!0)],8,FE)],2))}}),VE=Ye(zE,[["__scopeId","data-v-ab179fa1"]]),HE={class:"items"},GE={class:"title"},WE=Be({__name:"VPNavBarTranslations",setup(s){const{theme:e}=ot(),{localeLinks:t,currentLang:n}=to({correspondingLink:!0});return(i,r)=>j(t).length&&j(n).label?(Y(),$e(Xu,{key:0,class:"VPNavBarTranslations",icon:"vpi-languages",label:j(e).langMenuLabel||"Change language"},{default:ye(()=>[me("div",HE,[me("p",GE,ft(j(n).label),1),(Y(!0),fe(xt,null,Jt(j(t),o=>(Y(),$e(sl,{key:o.link,item:o},null,8,["item"]))),128))])]),_:1},8,["label"])):De("",!0)}}),$E=Ye(WE,[["__scopeId","data-v-88af2de4"]]),XE=s=>(Wt("data-v-ccf7ddec"),s=s(),$t(),s),qE={class:"wrapper"},YE={class:"container"},ZE={class:"title"},JE={class:"content"},KE={class:"content-body"},jE=XE(()=>me("div",{class:"divider"},[me("div",{class:"divider-line"})],-1)),QE=Be({__name:"VPNavBar",props:{isScreenOpen:{type:Boolean}},emits:["toggle-screen"],setup(s){const{y:e}=Zd(),{hasSidebar:t}=fi(),{frontmatter:n}=ot(),i=Ge({});return qd(()=>{i.value={"has-sidebar":t.value,home:n.value.layout==="home",top:e.value===0}}),(r,o)=>(Y(),fe("div",{class:yt(["VPNavBar",i.value])},[me("div",qE,[me("div",YE,[me("div",ZE,[Fe(VE,null,{"nav-bar-title-before":ye(()=>[ue(r.$slots,"nav-bar-title-before",{},void 0,!0)]),"nav-bar-title-after":ye(()=>[ue(r.$slots,"nav-bar-title-after",{},void 0,!0)]),_:3})]),me("div",JE,[me("div",KE,[ue(r.$slots,"nav-bar-content-before",{},void 0,!0),Fe(DE,{class:"search"}),Fe(wE,{class:"menu"}),Fe($E,{class:"translations"}),Fe(ET,{class:"appearance"}),Fe(OE,{class:"social-links"}),Fe(cE,{class:"extra"}),ue(r.$slots,"nav-bar-content-after",{},void 0,!0),Fe(mE,{class:"hamburger",active:r.isScreenOpen,onClick:o[0]||(o[0]=a=>r.$emit("toggle-screen"))},null,8,["active"])])])])]),jE],2))}}),eC=Ye(QE,[["__scopeId","data-v-ccf7ddec"]]),tC={key:0,class:"VPNavScreenAppearance"},nC={class:"text"},iC=Be({__name:"VPNavScreenAppearance",setup(s){const{site:e,theme:t}=ot();return(n,i)=>j(e).appearance&&j(e).appearance!=="force-dark"?(Y(),fe("div",tC,[me("p",nC,ft(j(t).darkModeSwitchLabel||"Appearance"),1),Fe(Wu)])):De("",!0)}}),sC=Ye(iC,[["__scopeId","data-v-2d7af913"]]),rC=Be({__name:"VPNavScreenMenuLink",props:{item:{}},setup(s){const e=zr("close-screen");return(t,n)=>(Y(),$e(Gn,{class:"VPNavScreenMenuLink",href:t.item.link,target:t.item.target,rel:t.item.rel,onClick:j(e),innerHTML:t.item.text},null,8,["href","target","rel","onClick","innerHTML"]))}}),oC=Ye(rC,[["__scopeId","data-v-7f31e1f6"]]),aC=Be({__name:"VPNavScreenMenuGroupLink",props:{item:{}},setup(s){const e=zr("close-screen");return(t,n)=>(Y(),$e(Gn,{class:"VPNavScreenMenuGroupLink",href:t.item.link,target:t.item.target,rel:t.item.rel,onClick:j(e)},{default:ye(()=>[Ht(ft(t.item.text),1)]),_:1},8,["href","target","rel","onClick"]))}}),Lm=Ye(aC,[["__scopeId","data-v-19976ae1"]]),lC={class:"VPNavScreenMenuGroupSection"},cC={key:0,class:"title"},uC=Be({__name:"VPNavScreenMenuGroupSection",props:{text:{},items:{}},setup(s){return(e,t)=>(Y(),fe("div",lC,[e.text?(Y(),fe("p",cC,ft(e.text),1)):De("",!0),(Y(!0),fe(xt,null,Jt(e.items,n=>(Y(),$e(Lm,{key:n.text,item:n},null,8,["item"]))),128))]))}}),hC=Ye(uC,[["__scopeId","data-v-8133b170"]]),dC=s=>(Wt("data-v-ff6087d4"),s=s(),$t(),s),fC=["aria-controls","aria-expanded"],pC=["innerHTML"],mC=dC(()=>me("span",{class:"vpi-plus button-icon"},null,-1)),gC=["id"],vC={key:1,class:"group"},_C=Be({__name:"VPNavScreenMenuGroup",props:{text:{},items:{}},setup(s){const e=s,t=Ge(!1),n=ke(()=>`NavScreenGroup-${e.text.replace(" ","-").toLowerCase()}`);function i(){t.value=!t.value}return(r,o)=>(Y(),fe("div",{class:yt(["VPNavScreenMenuGroup",{open:t.value}])},[me("button",{class:"button","aria-controls":n.value,"aria-expanded":t.value,onClick:i},[me("span",{class:"button-text",innerHTML:r.text},null,8,pC),mC],8,fC),me("div",{id:n.value,class:"items"},[(Y(!0),fe(xt,null,Jt(r.items,a=>(Y(),fe(xt,{key:a.text},["link"in a?(Y(),fe("div",{key:a.text,class:"item"},[Fe(Lm,{item:a},null,8,["item"])])):(Y(),fe("div",vC,[Fe(hC,{text:a.text,items:a.items},null,8,["text","items"])]))],64))),128))],8,gC)],2))}}),yC=Ye(_C,[["__scopeId","data-v-ff6087d4"]]),xC={key:0,class:"VPNavScreenMenu"},MC=Be({__name:"VPNavScreenMenu",setup(s){const{theme:e}=ot();return(t,n)=>j(e).nav?(Y(),fe("nav",xC,[(Y(!0),fe(xt,null,Jt(j(e).nav,i=>(Y(),fe(xt,{key:i.text},["link"in i?(Y(),$e(oC,{key:0,item:i},null,8,["item"])):(Y(),$e(yC,{key:1,text:i.text||"",items:i.items},null,8,["text","items"]))],64))),128))])):De("",!0)}}),bC=Be({__name:"VPNavScreenSocialLinks",setup(s){const{theme:e}=ot();return(t,n)=>j(e).socialLinks?(Y(),$e(qu,{key:0,class:"VPNavScreenSocialLinks",links:j(e).socialLinks},null,8,["links"])):De("",!0)}}),Nm=s=>(Wt("data-v-858fe1a4"),s=s(),$t(),s),SC=Nm(()=>me("span",{class:"vpi-languages icon lang"},null,-1)),wC=Nm(()=>me("span",{class:"vpi-chevron-down icon chevron"},null,-1)),AC={class:"list"},TC=Be({__name:"VPNavScreenTranslations",setup(s){const{localeLinks:e,currentLang:t}=to({correspondingLink:!0}),n=Ge(!1);function i(){n.value=!n.value}return(r,o)=>j(e).length&&j(t).label?(Y(),fe("div",{key:0,class:yt(["VPNavScreenTranslations",{open:n.value}])},[me("button",{class:"title",onClick:i},[SC,Ht(" "+ft(j(t).label)+" ",1),wC]),me("ul",AC,[(Y(!0),fe(xt,null,Jt(j(e),a=>(Y(),fe("li",{key:a.link,class:"item"},[Fe(Gn,{class:"link",href:a.link},{default:ye(()=>[Ht(ft(a.text),1)]),_:2},1032,["href"])]))),128))])],2)):De("",!0)}}),EC=Ye(TC,[["__scopeId","data-v-858fe1a4"]]),CC={class:"container"},PC=Be({__name:"VPNavScreen",props:{open:{type:Boolean}},setup(s){const e=Ge(null),t=Jd(Ta?document.body:null);return(n,i)=>(Y(),$e(Zc,{name:"fade",onEnter:i[0]||(i[0]=r=>t.value=!0),onAfterLeave:i[1]||(i[1]=r=>t.value=!1)},{default:ye(()=>[n.open?(Y(),fe("div",{key:0,class:"VPNavScreen",ref_key:"screen",ref:e,id:"VPNavScreen"},[me("div",CC,[ue(n.$slots,"nav-screen-content-before",{},void 0,!0),Fe(MC,{class:"menu"}),Fe(EC,{class:"translations"}),Fe(sC,{class:"appearance"}),Fe(bC,{class:"social-links"}),ue(n.$slots,"nav-screen-content-after",{},void 0,!0)])],512)):De("",!0)]),_:3}))}}),RC=Ye(PC,[["__scopeId","data-v-cc5739dd"]]),IC={key:0,class:"VPNav"},LC=Be({__name:"VPNav",setup(s){const{isScreenOpen:e,closeScreen:t,toggleScreen:n}=mT(),{frontmatter:i}=ot(),r=ke(()=>i.value.navbar!==!1);return vr("close-screen",t),Ri(()=>{Ta&&document.documentElement.classList.toggle("hide-nav",!r.value)}),(o,a)=>r.value?(Y(),fe("header",IC,[Fe(eC,{"is-screen-open":j(e),onToggleScreen:j(n)},{"nav-bar-title-before":ye(()=>[ue(o.$slots,"nav-bar-title-before",{},void 0,!0)]),"nav-bar-title-after":ye(()=>[ue(o.$slots,"nav-bar-title-after",{},void 0,!0)]),"nav-bar-content-before":ye(()=>[ue(o.$slots,"nav-bar-content-before",{},void 0,!0)]),"nav-bar-content-after":ye(()=>[ue(o.$slots,"nav-bar-content-after",{},void 0,!0)]),_:3},8,["is-screen-open","onToggleScreen"]),Fe(RC,{open:j(e)},{"nav-screen-content-before":ye(()=>[ue(o.$slots,"nav-screen-content-before",{},void 0,!0)]),"nav-screen-content-after":ye(()=>[ue(o.$slots,"nav-screen-content-after",{},void 0,!0)]),_:3},8,["open"])])):De("",!0)}}),NC=Ye(LC,[["__scopeId","data-v-ae24b3ad"]]),Dm=s=>(Wt("data-v-b8d55f3b"),s=s(),$t(),s),DC=["role","tabindex"],UC=Dm(()=>me("div",{class:"indicator"},null,-1)),OC=["onKeydown"],FC=Dm(()=>me("span",{class:"vpi-chevron-right caret-icon"},null,-1)),kC=[FC],BC={key:1,class:"items"},zC=Be({__name:"VPSidebarItem",props:{item:{},depth:{}},setup(s){const e=s,{collapsed:t,collapsible:n,isLink:i,isActiveLink:r,hasActiveLink:o,hasChildren:a,toggle:l}=o1(ke(()=>e.item)),c=ke(()=>a.value?"section":"div"),u=ke(()=>i.value?"a":"div"),h=ke(()=>a.value?e.depth+2===7?"p":`h${e.depth+2}`:"p"),d=ke(()=>i.value?void 0:"button"),f=ke(()=>[[`level-${e.depth}`],{collapsible:n.value},{collapsed:t.value},{"is-link":i.value},{"is-active":r.value},{"has-active":o.value}]);function g(m){"key"in m&&m.key!=="Enter"||!e.item.link&&l()}function v(){e.item.link&&l()}return(m,p)=>{const y=cn("VPSidebarItem",!0);return Y(),$e(Bs(c.value),{class:yt(["VPSidebarItem",f.value])},{default:ye(()=>[m.item.text?(Y(),fe("div",ia({key:0,class:"item",role:d.value},ng(m.item.items?{click:g,keydown:g}:{},!0),{tabindex:m.item.items&&0}),[UC,m.item.link?(Y(),$e(Gn,{key:0,tag:u.value,class:"link",href:m.item.link,rel:m.item.rel,target:m.item.target},{default:ye(()=>[(Y(),$e(Bs(h.value),{class:"text",innerHTML:m.item.text},null,8,["innerHTML"]))]),_:1},8,["tag","href","rel","target"])):(Y(),$e(Bs(h.value),{key:1,class:"text",innerHTML:m.item.text},null,8,["innerHTML"])),m.item.collapsed!=null&&m.item.items&&m.item.items.length?(Y(),fe("div",{key:2,class:"caret",role:"button","aria-label":"toggle section",onClick:v,onKeydown:ig(v,["enter"]),tabindex:"0"},kC,40,OC)):De("",!0)],16,DC)):De("",!0),m.item.items&&m.item.items.length?(Y(),fe("div",BC,[m.depth<5?(Y(!0),fe(xt,{key:0},Jt(m.item.items,_=>(Y(),$e(y,{key:_.text,item:_,depth:m.depth+1},null,8,["item","depth"]))),128)):De("",!0)])):De("",!0)]),_:1},8,["class"])}}}),VC=Ye(zC,[["__scopeId","data-v-b8d55f3b"]]),Um=s=>(Wt("data-v-575e6a36"),s=s(),$t(),s),HC=Um(()=>me("div",{class:"curtain"},null,-1)),GC={class:"nav",id:"VPSidebarNav","aria-labelledby":"sidebar-aria-label",tabindex:"-1"},WC=Um(()=>me("span",{class:"visually-hidden",id:"sidebar-aria-label"}," Sidebar Navigation ",-1)),$C=Be({__name:"VPSidebar",props:{open:{type:Boolean}},setup(s){const e=s,{sidebarGroups:t,hasSidebar:n}=fi(),i=Ge(null),r=Jd(Ta?document.body:null);return Ct([e,i],()=>{var o;e.open?(r.value=!0,(o=i.value)==null||o.focus()):r.value=!1},{immediate:!0,flush:"post"}),(o,a)=>j(n)?(Y(),fe("aside",{key:0,class:yt(["VPSidebar",{open:o.open}]),ref_key:"navEl",ref:i,onClick:a[0]||(a[0]=sg(()=>{},["stop"]))},[HC,me("nav",GC,[WC,ue(o.$slots,"sidebar-nav-before",{},void 0,!0),(Y(!0),fe(xt,null,Jt(j(t),l=>(Y(),fe("div",{key:l.text,class:"group"},[Fe(VC,{item:l,depth:0},null,8,["item"])]))),128)),ue(o.$slots,"sidebar-nav-after",{},void 0,!0)])],2)):De("",!0)}}),XC=Ye($C,[["__scopeId","data-v-575e6a36"]]),qC=Be({__name:"VPSkipLink",setup(s){const e=Vr(),t=Ge();Ct(()=>e.path,()=>t.value.focus());function n({target:i}){const r=document.getElementById(decodeURIComponent(i.hash).slice(1));if(r){const o=()=>{r.removeAttribute("tabindex"),r.removeEventListener("blur",o)};r.setAttribute("tabindex","-1"),r.addEventListener("blur",o),r.focus(),window.scrollTo(0,0)}}return(i,r)=>(Y(),fe(xt,null,[me("span",{ref_key:"backToTop",ref:t,tabindex:"-1"},null,512),me("a",{href:"#VPContent",class:"VPSkipLink visually-hidden",onClick:n}," Skip to content ")],64))}}),YC=Ye(qC,[["__scopeId","data-v-0f60ec36"]]),ZC=Be({__name:"Layout",setup(s){const{isOpen:e,open:t,close:n}=fi(),i=Vr();Ct(()=>i.path,n),r1(e,n);const{frontmatter:r}=ot(),o=Xd(),a=ke(()=>!!o["home-hero-image"]);return vr("hero-image-slot-exists",a),(l,c)=>{const u=cn("Content");return j(r).layout!==!1?(Y(),fe("div",{key:0,class:yt(["Layout",j(r).pageClass])},[ue(l.$slots,"layout-top",{},void 0,!0),Fe(YC),Fe(Ww,{class:"backdrop",show:j(e),onClick:j(n)},null,8,["show","onClick"]),Fe(NC,null,{"nav-bar-title-before":ye(()=>[ue(l.$slots,"nav-bar-title-before",{},void 0,!0)]),"nav-bar-title-after":ye(()=>[ue(l.$slots,"nav-bar-title-after",{},void 0,!0)]),"nav-bar-content-before":ye(()=>[ue(l.$slots,"nav-bar-content-before",{},void 0,!0)]),"nav-bar-content-after":ye(()=>[ue(l.$slots,"nav-bar-content-after",{},void 0,!0)]),"nav-screen-content-before":ye(()=>[ue(l.$slots,"nav-screen-content-before",{},void 0,!0)]),"nav-screen-content-after":ye(()=>[ue(l.$slots,"nav-screen-content-after",{},void 0,!0)]),_:3}),Fe(pT,{open:j(e),onOpenMenu:j(t)},null,8,["open","onOpenMenu"]),Fe(XC,{open:j(e)},{"sidebar-nav-before":ye(()=>[ue(l.$slots,"sidebar-nav-before",{},void 0,!0)]),"sidebar-nav-after":ye(()=>[ue(l.$slots,"sidebar-nav-after",{},void 0,!0)]),_:3},8,["open"]),Fe(YA,null,{"page-top":ye(()=>[ue(l.$slots,"page-top",{},void 0,!0)]),"page-bottom":ye(()=>[ue(l.$slots,"page-bottom",{},void 0,!0)]),"not-found":ye(()=>[ue(l.$slots,"not-found",{},void 0,!0)]),"home-hero-before":ye(()=>[ue(l.$slots,"home-hero-before",{},void 0,!0)]),"home-hero-info-before":ye(()=>[ue(l.$slots,"home-hero-info-before",{},void 0,!0)]),"home-hero-info":ye(()=>[ue(l.$slots,"home-hero-info",{},void 0,!0)]),"home-hero-info-after":ye(()=>[ue(l.$slots,"home-hero-info-after",{},void 0,!0)]),"home-hero-actions-after":ye(()=>[ue(l.$slots,"home-hero-actions-after",{},void 0,!0)]),"home-hero-image":ye(()=>[ue(l.$slots,"home-hero-image",{},void 0,!0)]),"home-hero-after":ye(()=>[ue(l.$slots,"home-hero-after",{},void 0,!0)]),"home-features-before":ye(()=>[ue(l.$slots,"home-features-before",{},void 0,!0)]),"home-features-after":ye(()=>[ue(l.$slots,"home-features-after",{},void 0,!0)]),"doc-footer-before":ye(()=>[ue(l.$slots,"doc-footer-before",{},void 0,!0)]),"doc-before":ye(()=>[ue(l.$slots,"doc-before",{},void 0,!0)]),"doc-after":ye(()=>[ue(l.$slots,"doc-after",{},void 0,!0)]),"doc-top":ye(()=>[ue(l.$slots,"doc-top",{},void 0,!0)]),"doc-bottom":ye(()=>[ue(l.$slots,"doc-bottom",{},void 0,!0)]),"aside-top":ye(()=>[ue(l.$slots,"aside-top",{},void 0,!0)]),"aside-bottom":ye(()=>[ue(l.$slots,"aside-bottom",{},void 0,!0)]),"aside-outline-before":ye(()=>[ue(l.$slots,"aside-outline-before",{},void 0,!0)]),"aside-outline-after":ye(()=>[ue(l.$slots,"aside-outline-after",{},void 0,!0)]),"aside-ads-before":ye(()=>[ue(l.$slots,"aside-ads-before",{},void 0,!0)]),"aside-ads-after":ye(()=>[ue(l.$slots,"aside-ads-after",{},void 0,!0)]),_:3}),Fe(QA),ue(l.$slots,"layout-bottom",{},void 0,!0)],2)):(Y(),$e(u,{key:1}))}}}),JC=Ye(ZC,[["__scopeId","data-v-5d98c3a5"]]),Om={Layout:JC,enhanceApp:({app:s})=>{s.component("Badge",Vw)}},KC=Be({__name:"HighlightTargetedHeading",setup(s){function e(){if(!window||!window.location||!window.location.hash)return;const n=decodeURIComponent(window.location.hash);if(!n)return;let i;try{i=document.querySelector(n)}catch(r){console.error(r);return}i&&(i.classList.contains("VPNolebaseHighlightTargetedHeading")||i.classList.add("VPNolebaseHighlightTargetedHeading"),i.classList.remove("VPNolebaseHighlightTargetedHeadingAnimated"),setTimeout(()=>{i&&i.classList.add("VPNolebaseHighlightTargetedHeadingAnimated")},10))}const t=Vr();return Nn(e),Ct(t,async()=>{await qc(),e()}),rg("hashchange",e),(n,i)=>ue(n.$slots,"default")}}),no=s=>(Wt("data-v-19eb9e26"),s=s(),$t(),s),jC={class:"background"},QC={class:"vp-doc"},eP=no(()=>me("a",{class:"h-card",rel:"me",href:"/about"},[me("img",{src:ag,alt:""}),Ht("The Paper Pilot")],-1)),tP=no(()=>me("a",{rel:"license",href:"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"CC BY-NC-SA 4.0",-1)),nP=no(()=>me("div",null,"Any and all opinions listed here are my own and not representative of my employers; future, past and present.",-1)),iP=no(()=>me("div",null,[me("a",{href:"https://resume.incremental.social/thepaperpilot/thepaperpilot"},"Resume"),Ht(" (not actively seeking new opportunities).")],-1)),sP=no(()=>me("div",null,[Ht("Site built from "),me("a",{href:"https://code.incremental.social/thepaperpilot/pages/commit/2a46a347dbf69f5d6ce736d0ab7fc7afab662621"},"this commit"),Ht(" on "),me("time",null,"Saturday, June 29, 2024 at 01:32:20"),Ht(". "),me("a",{href:"https://www.thepaperpilot.org/licenses.txt"},"Legal disclaimers"),Ht(".")],-1)),rP=Be({__name:"Layout",setup(s){return(e,t)=>{const n=cn("TresOrthographicCamera"),i=cn("TresAmbientLight"),r=cn("ClientOnly");return Y(),$e(j(Om).Layout,null,{"layout-top":ye(()=>[Fe(j(KC)),Fe(r,null,{default:ye(()=>[me("div",jC,[Fe(j(Ow),null,{default:ye(()=>[Fe(n,{position:[0,0,10]}),Fe(i,{intensity:1}),(Y(),$e(og,null,{default:ye(()=>[Fe(zw)]),_:1}))]),_:1})])]),_:1})]),"layout-bottom":ye(()=>[me("footer",QC,[me("div",null,[Ht("CC "+ft(new Date().getFullYear())+" ",1),eP,Ht(". "),tP,Ht(".")]),nP,iP,sP])]),_:1})}}}),oP=Ye(rP,[["__scopeId","data-v-19eb9e26"]]),lP={...Om,Layout:oP};export{Pc as A,Bn as K,es as N,xg as R,N as V,zw as _,lP as a,AE as c,kw as n,xw as r,Ow as t,ot as u};