%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home2/rezakur1/ai.rezakurnia.com/assets/
Upload File :
Create Path :
Current File : //home2/rezakur1/ai.rezakurnia.com/assets/Auth3DScene-DjHLKTKg.js

import{k as fn,l as Z4,g as j4,r as Ve,j as nt}from"./index-CYXd_ywS.js";import{u as J4}from"./with-selector-DIjl9Exq.js";/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const _l="187",K4={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Q4={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ky=0,_m=1,Hy=2,ew=3,Vy=0,ol=1,gc=2,Ba=3,Sr=0,Vn=1,Di=2,Oi=0,ll=1,xm=2,ym=3,Sm=4,Gy=5,tw=6,Fa=100,Wy=101,Xy=102,qy=103,$y=104,Yy=200,Zy=201,jy=202,Jy=203,km=204,Hm=205,Ky=206,Qy=207,e3=208,t3=209,n3=210,i3=211,s3=212,r3=213,a3=214,rf=0,Ic=1,af=2,hl=3,of=4,lf=5,cf=6,uf=7,Jc=0,o3=1,l3=2,Qi=0,Vm=1,Gm=2,Wm=3,td=4,Xm=5,qm=6,$m=7,bm="attached",c3="detached",nd=300,br=301,qa=302,vc=303,_c=304,Pc=1e3,Fi=1001,Lc=1002,dn=1003,Ym=1004,nw=1004,nl=1005,iw=1005,an=1006,xc=1007,sw=1007,Ps=1008,rw=1008,Mn=1009,Zm=1010,jm=1011,fl=1012,id=1013,ds=1014,oi=1015,ps=1016,sd=1017,rd=1018,Qr=1020,Jm=35902,Km=35899,Qm=1021,eg=1022,Mi=1023,Mr=1026,js=1027,ad=1028,Kc=1029,ea=1030,od=1031,aw=1032,ld=1033,yc=33776,Sc=33777,bc=33778,Mc=33779,hf=35840,ff=35841,df=35842,pf=35843,mf=36196,gf=37492,vf=37496,_f=37488,xf=37489,Nc=37490,yf=37491,Sf=37808,bf=37809,Mf=37810,wf=37811,Tf=37812,Ef=37813,Af=37814,Cf=37815,Rf=37816,If=37817,Pf=37818,Lf=37819,Nf=37820,Df=37821,Uf=36492,Ff=36494,Of=36495,Bf=36283,zf=36284,Dc=36285,kf=36286,u3=2200,h3=2201,f3=2202,Uc=2300,Hf=2301,Qh=2302,Mm=2303,za=2400,ka=2401,Fc=2402,cd=2500,tg=2501,ow=0,lw=1,cw=2,ia=3200,uw=3201,hw=3202,fw=3203,wr=0,d3=1,Is="",Zt="srgb",ta="srgb-linear",Oc="linear",en="srgb",dw="",pw="rg",mw="ga",gw=0,ef=7680,vw=7681,_w=7682,xw=7683,yw=34055,Sw=34056,bw=5386,Mw=512,ww=513,Tw=514,Ew=515,Aw=516,Cw=517,Rw=518,p3=519,m3=512,g3=513,v3=514,ng=515,_3=516,x3=517,ig=518,sg=519,ud=35044,Iw=35048,Pw=35040,Lw=35045,Nw=35049,Dw=35041,Uw=35046,Fw=35050,Ow=35042,Bw="100",wm="300 es",Ki=2e3,$a=2001,zw={COMPUTE:"compute",RENDER:"render"},kw={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},Hw={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},Vw={TEXTURE_COMPARE:"depthTextureCompare"},Gw={NONE:0,SHARED:1,FULL:2};function Ww(i){for(let e=i.length-1;e>=0;--e)if(i[e]>=65535)return!0;return!1}const Xw={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function il(i,e){return new Xw[i](e)}function y3(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}function Bc(i){return document.createElementNS("http://www.w3.org/1999/xhtml",i)}function S3(){const i=Bc("canvas");return i.style.display="block",i}const R_={};let na=null;function qw(i){na=i}function $w(){return na}function zc(...i){const e="THREE."+i.shift();na?na("log",e,...i):console.log(e,...i)}function b3(i){const e=i[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=i[1];t&&t.isStackTrace?i[0]+=" "+t.getLocation():i[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return i}function Fe(...i){i=b3(i);const e="THREE."+i.shift();if(na)na("warn",e,...i);else{const t=i[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...i)}}function it(...i){i=b3(i);const e="THREE."+i.shift();if(na)na("error",e,...i);else{const t=i[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...i)}}function xr(...i){const e=i.join(" ");e in R_||(R_[e]=!0,Fe(...i))}function Yw(i,e,t){return new Promise(function(n,r){function o(){switch(i.clientWaitSync(e,i.SYNC_FLUSH_COMMANDS_BIT,0)){case i.WAIT_FAILED:r();break;case i.TIMEOUT_EXPIRED:setTimeout(o,t);break;default:n()}}setTimeout(o,t)})}const Zw={[rf]:rf,[af]:cf,[of]:of,[hl]:lf,[Ic]:Ic,[cf]:af,[uf]:uf,[lf]:hl};class Bi{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){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const r=n[e];if(r!==void 0){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const r=n.slice(0);for(let o=0,l=r.length;o<l;o++)r[o].call(this,e);e.target=null}}}const hi=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let I_=1234567;const Ga=Math.PI/180,dl=180/Math.PI;function ms(){const i=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(hi[i&255]+hi[i>>8&255]+hi[i>>16&255]+hi[i>>24&255]+"-"+hi[e&255]+hi[e>>8&255]+"-"+hi[e>>16&15|64]+hi[e>>24&255]+"-"+hi[t&63|128]+hi[t>>8&255]+"-"+hi[t>>16&255]+hi[t>>24&255]+hi[n&255]+hi[n>>8&255]+hi[n>>16&255]+hi[n>>24&255]).toLowerCase()}function ft(i,e,t){return Math.max(e,Math.min(t,i))}function rg(i,e){return(i%e+e)%e}function jw(i,e,t,n,r){return n+(i-e)*(r-n)/(t-e)}function Jw(i,e,t){return i!==e?(t-i)/(e-i):0}function wc(i,e,t){return(1-t)*i+t*e}function Kw(i,e,t,n){return wc(i,e,1-Math.exp(-t*n))}function Qw(i,e=1){return e-Math.abs(rg(i,e*2)-e)}function eT(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*(3-2*i))}function tT(i,e,t){return i<=e?0:i>=t?1:(i=(i-e)/(t-e),i*i*i*(i*(i*6-15)+10))}function nT(i,e){return i+Math.floor(Math.random()*(e-i+1))}function iT(i,e){return i+Math.random()*(e-i)}function sT(i){return i*(.5-Math.random())}function rT(i){i!==void 0&&(I_=i);let e=I_+=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 aT(i){return i*Ga}function oT(i){return i*dl}function lT(i){return i>0&&Number.isInteger(i)&&2**Math.round(Math.log2(i))===i}function cT(i){return Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))}function M3(i){return Math.pow(2,Math.floor(Math.log(i)/Math.LN2))}function uT(i,e,t,n,r){const o=Math.cos,l=Math.sin,c=o(t/2),h=l(t/2),d=o((e+n)/2),p=l((e+n)/2),g=o((e-n)/2),v=l((e-n)/2),_=o((n-e)/2),y=l((n-e)/2);switch(r){case"XYX":i.set(c*p,h*g,h*v,c*d);break;case"YZY":i.set(h*v,c*p,h*g,c*d);break;case"ZXZ":i.set(h*g,h*v,c*p,c*d);break;case"XZX":i.set(c*p,h*y,h*_,c*d);break;case"YXY":i.set(h*_,c*p,h*y,c*d);break;case"ZYZ":i.set(h*y,h*_,c*p,c*d);break;default:Fe("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function hd(i){switch(i.constructor){case Uint32Array:return 4294967295;case Uint16Array:return 65535;case Uint8Array:case Uint8ClampedArray:return 255;case Int32Array:return 2147483647;case Int16Array:return 32767;case Int8Array:return 127;default:return}}function Ha(i,e){if(e.constructor===Float32Array)return i;const t=hd(e);if(t===void 0)throw new Error("THREE.MathUtils: Invalid component type.");return Math.max(i/t,-1)}function pi(i,e){if(e.constructor===Float32Array)return i;const t=hd(e);if(t===void 0)throw new Error("THREE.MathUtils: Invalid component type.");return Math.round(i*t)}const Vf={DEG2RAD:Ga,RAD2DEG:dl,generateUUID:ms,clamp:ft,euclideanModulo:rg,mapLinear:jw,inverseLerp:Jw,lerp:wc,damp:Kw,pingpong:Qw,smoothstep:eT,smootherstep:tT,randInt:nT,randFloat:iT,randFloatSpread:sT,seededRandom:rT,degToRad:aT,radToDeg:oT,isPowerOfTwo:lT,ceilPowerOfTwo:cT,floorPowerOfTwo:M3,setQuaternionFromProperEuler:uT,normalize:pi,denormalize:Ha},Wg=class Wg{constructor(e=0,t=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("THREE.Vector2: 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("THREE.Vector2: 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,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=ft(this.x,e.x,t.x),this.y=ft(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=ft(this.x,e,t),this.y=ft(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ft(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(ft(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),r=Math.sin(t),o=this.x-e.x,l=this.y-e.y;return this.x=o*n-l*r+e.x,this.y=o*r+l*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};Wg.prototype.isVector2=!0;let ue=Wg;class wi{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,o,l,c){let h=n[r+0],d=n[r+1],p=n[r+2],g=n[r+3],v=o[l+0],_=o[l+1],y=o[l+2],w=o[l+3];if(g!==w||h!==v||d!==_||p!==y){let b=h*v+d*_+p*y+g*w;b<0&&(v=-v,_=-_,y=-y,w=-w,b=-b);let S=1-c;if(b<.9995){const M=Math.acos(b),A=Math.sin(M);S=Math.sin(S*M)/A,c=Math.sin(c*M)/A,h=h*S+v*c,d=d*S+_*c,p=p*S+y*c,g=g*S+w*c}else{h=h*S+v*c,d=d*S+_*c,p=p*S+y*c,g=g*S+w*c;const M=1/Math.sqrt(h*h+d*d+p*p+g*g);h*=M,d*=M,p*=M,g*=M}}e[t]=h,e[t+1]=d,e[t+2]=p,e[t+3]=g}static multiplyQuaternionsFlat(e,t,n,r,o,l){const c=n[r],h=n[r+1],d=n[r+2],p=n[r+3],g=o[l],v=o[l+1],_=o[l+2],y=o[l+3];return e[t]=c*y+p*g+h*_-d*v,e[t+1]=h*y+p*v+d*g-c*_,e[t+2]=d*y+p*_+c*v-h*g,e[t+3]=p*y-c*g-h*v-d*_,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,r=e._y,o=e._z,l=e._order,c=Math.cos,h=Math.sin,d=c(n/2),p=c(r/2),g=c(o/2),v=h(n/2),_=h(r/2),y=h(o/2);switch(l){case"XYZ":this._x=v*p*g+d*_*y,this._y=d*_*g-v*p*y,this._z=d*p*y+v*_*g,this._w=d*p*g-v*_*y;break;case"YXZ":this._x=v*p*g+d*_*y,this._y=d*_*g-v*p*y,this._z=d*p*y-v*_*g,this._w=d*p*g+v*_*y;break;case"ZXY":this._x=v*p*g-d*_*y,this._y=d*_*g+v*p*y,this._z=d*p*y+v*_*g,this._w=d*p*g-v*_*y;break;case"ZYX":this._x=v*p*g-d*_*y,this._y=d*_*g+v*p*y,this._z=d*p*y-v*_*g,this._w=d*p*g+v*_*y;break;case"YZX":this._x=v*p*g+d*_*y,this._y=d*_*g+v*p*y,this._z=d*p*y-v*_*g,this._w=d*p*g-v*_*y;break;case"XZY":this._x=v*p*g-d*_*y,this._y=d*_*g-v*p*y,this._z=d*p*y+v*_*g,this._w=d*p*g+v*_*y;break;default:Fe("Quaternion: .setFromEuler() encountered an unknown order: "+l)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],r=t[4],o=t[8],l=t[1],c=t[5],h=t[9],d=t[2],p=t[6],g=t[10],v=n+c+g;if(v>0){const _=.5/Math.sqrt(v+1);this._w=.25/_,this._x=(p-h)*_,this._y=(o-d)*_,this._z=(l-r)*_}else if(n>c&&n>g){const _=2*Math.sqrt(1+n-c-g);this._w=(p-h)/_,this._x=.25*_,this._y=(r+l)/_,this._z=(o+d)/_}else if(c>g){const _=2*Math.sqrt(1+c-n-g);this._w=(o-d)/_,this._x=(r+l)/_,this._y=.25*_,this._z=(h+p)/_}else{const _=2*Math.sqrt(1+g-n-c);this._w=(l-r)/_,this._x=(o+d)/_,this._y=(h+p)/_,this._z=.25*_}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ft(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,r=e._y,o=e._z,l=e._w,c=t._x,h=t._y,d=t._z,p=t._w;return this._x=n*p+l*c+r*d-o*h,this._y=r*p+l*h+o*c-n*d,this._z=o*p+l*d+n*h-r*c,this._w=l*p-n*c-r*h-o*d,this._onChangeCallback(),this}slerp(e,t){let n=e._x,r=e._y,o=e._z,l=e._w,c=this.dot(e);c<0&&(n=-n,r=-r,o=-o,l=-l,c=-c);let h=1-t;if(c<.9995){const d=Math.acos(c),p=Math.sin(d);h=Math.sin(h*d)/p,t=Math.sin(t*d)/p,this._x=this._x*h+n*t,this._y=this._y*h+r*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this._onChangeCallback()}else this._x=this._x*h+n*t,this._y=this._y*h+r*t,this._z=this._z*h+o*t,this._w=this._w*h+l*t,this.normalize();return 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(),r=Math.sqrt(1-n),o=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),o*Math.sin(t),o*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}}const Xg=class Xg{constructor(e=0,t=0,n=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("THREE.Vector3: 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("THREE.Vector3: 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(P_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(P_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,r=this.z,o=e.elements;return this.x=o[0]*t+o[3]*n+o[6]*r,this.y=o[1]*t+o[4]*n+o[7]*r,this.z=o[2]*t+o[5]*n+o[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,r=this.z,o=e.elements,l=1/(o[3]*t+o[7]*n+o[11]*r+o[15]);return this.x=(o[0]*t+o[4]*n+o[8]*r+o[12])*l,this.y=(o[1]*t+o[5]*n+o[9]*r+o[13])*l,this.z=(o[2]*t+o[6]*n+o[10]*r+o[14])*l,this}applyQuaternion(e){const t=this.x,n=this.y,r=this.z,o=e.x,l=e.y,c=e.z,h=e.w,d=2*(l*r-c*n),p=2*(c*t-o*r),g=2*(o*n-l*t);return this.x=t+h*d+l*g-c*p,this.y=n+h*p+c*d-o*g,this.z=r+h*g+o*p-l*d,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,r=this.z,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*r,this.y=o[1]*t+o[5]*n+o[9]*r,this.z=o[2]*t+o[6]*n+o[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=ft(this.x,e.x,t.x),this.y=ft(this.y,e.y,t.y),this.z=ft(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=ft(this.x,e,t),this.y=ft(this.y,e,t),this.z=ft(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ft(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,r=e.y,o=e.z,l=t.x,c=t.y,h=t.z;return this.x=r*h-o*c,this.y=o*l-n*h,this.z=n*c-r*l,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 M0.copy(this).projectOnVector(e),this.sub(M0)}reflect(e){return this.sub(M0.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(ft(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*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(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,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}};Xg.prototype.isVector3=!0;let O=Xg;const M0=new O,P_=new wi,qg=class qg{constructor(e,t,n,r,o,l,c,h,d){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,r,o,l,c,h,d)}set(e,t,n,r,o,l,c,h,d){const p=this.elements;return p[0]=e,p[1]=r,p[2]=c,p[3]=t,p[4]=o,p[5]=h,p[6]=n,p[7]=l,p[8]=d,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,r=t.elements,o=this.elements,l=n[0],c=n[3],h=n[6],d=n[1],p=n[4],g=n[7],v=n[2],_=n[5],y=n[8],w=r[0],b=r[3],S=r[6],M=r[1],A=r[4],E=r[7],N=r[2],P=r[5],T=r[8];return o[0]=l*w+c*M+h*N,o[3]=l*b+c*A+h*P,o[6]=l*S+c*E+h*T,o[1]=d*w+p*M+g*N,o[4]=d*b+p*A+g*P,o[7]=d*S+p*E+g*T,o[2]=v*w+_*M+y*N,o[5]=v*b+_*A+y*P,o[8]=v*S+_*E+y*T,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],r=e[2],o=e[3],l=e[4],c=e[5],h=e[6],d=e[7],p=e[8];return t*l*p-t*c*d-n*o*p+n*c*h+r*o*d-r*l*h}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],o=e[3],l=e[4],c=e[5],h=e[6],d=e[7],p=e[8],g=p*l-c*d,v=c*h-p*o,_=d*o-l*h,y=t*g+n*v+r*_;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/y;return e[0]=g*w,e[1]=(r*d-p*n)*w,e[2]=(c*n-r*l)*w,e[3]=v*w,e[4]=(p*t-r*h)*w,e[5]=(r*o-c*t)*w,e[6]=_*w,e[7]=(n*h-d*t)*w,e[8]=(l*t-n*o)*w,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,r,o,l,c){const h=Math.cos(o),d=Math.sin(o);return this.set(n*h,n*d,-n*(h*l+d*c)+l+e,-r*d,r*h,-r*(-d*l+h*c)+c+t,0,0,1),this}scale(e,t){return xr("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(w0.makeScale(e,t)),this}rotate(e){return xr("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(w0.makeRotation(-e)),this}translate(e,t){return xr("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(w0.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 r=0;r<9;r++)if(t[r]!==n[r])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)}};qg.prototype.isMatrix3=!0;let _t=qg;const w0=new _t,L_=new _t().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),N_=new _t().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function hT(){const i={enabled:!0,workingColorSpace:ta,spaces:{},convert:function(r,o,l){return this.enabled===!1||o===l||!o||!l||(this.spaces[o].transfer===en&&(r.r=yr(r.r),r.g=yr(r.g),r.b=yr(r.b)),this.spaces[o].primaries!==this.spaces[l].primaries&&(r.applyMatrix3(this.spaces[o].toXYZ),r.applyMatrix3(this.spaces[l].fromXYZ)),this.spaces[l].transfer===en&&(r.r=cl(r.r),r.g=cl(r.g),r.b=cl(r.b))),r},workingToColorSpace:function(r,o){return this.convert(r,this.workingColorSpace,o)},colorSpaceToWorking:function(r,o){return this.convert(r,o,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Is?Oc:this.spaces[r].transfer},getToneMappingMode:function(r){return this.spaces[r].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(r,o=this.workingColorSpace){return r.fromArray(this.spaces[o].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,o,l){return r.copy(this.spaces[l].fromXYZ).multiply(this.spaces[o].toXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return i.define({[ta]:{primaries:e,whitePoint:n,transfer:Oc,toXYZ:L_,fromXYZ:N_,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:Zt},outputColorSpaceConfig:{drawingBufferColorSpace:Zt}},[Zt]:{primaries:e,whitePoint:n,transfer:en,toXYZ:L_,fromXYZ:N_,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:Zt}}}),i}const Lt=hT();function yr(i){return i<.04045?i*.0773993808:Math.pow(i*.9478672986+.0521327014,2.4)}function cl(i){return i<.0031308?i*12.92:1.055*Math.pow(i,.41666)-.055}let Do;class w3{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Do===void 0&&(Do=Bc("canvas")),Do.width=e.width,Do.height=e.height;const r=Do.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=Do}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Bc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const r=n.getImageData(0,0,e.width,e.height),o=r.data;for(let l=0;l<o.length;l++)o[l]=yr(o[l]/255)*255;return n.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(yr(t[n]/255)*255):t[n]=yr(t[n]);return{data:t,width:e.width,height:e.height}}else return Fe("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let fT=0;class Js{constructor(e=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:fT++}),this.uuid=ms(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width||0,t.height||0,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},r=this.data;if(r!==null){let o;if(Array.isArray(r)){o=[];for(let l=0,c=r.length;l<c;l++)r[l].isDataTexture?o.push(T0(r[l].image)):o.push(T0(r[l]))}else o=T0(r);n.url=o}return t||(e.images[this.uuid]=n),n}}function T0(i){return typeof HTMLImageElement<"u"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&i instanceof ImageBitmap?w3.getDataURL(i):i.data?{data:Array.from(i.data),width:i.width,height:i.height,type:i.data.constructor.name}:(Fe("Texture: Unable to serialize Texture."),{})}class dT extends Js{constructor(e=null){xr('Source: "Source" has been renamed to "TextureSource". Please update your code to use "THREE.TextureSource" instead.'),super(e),this.isSource=!0}}let pT=0;const E0=new O;class pn extends Bi{constructor(e=pn.DEFAULT_IMAGE,t=pn.DEFAULT_MAPPING,n=Fi,r=Fi,o=an,l=Ps,c=Mi,h=Mn,d=pn.DEFAULT_ANISOTROPY,p=Is){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:pT++}),this.uuid=ms(),this.name="",this.source=new Js(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=o,this.minFilter=l,this.anisotropy=d,this.format=c,this.internalFormat=null,this.type=h,this.offset=new ue(0,0),this.repeat=new ue(1,1),this.center=new ue(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new _t,this.generateMipmaps=!0,this.mipmapsAutoUpdate=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=p,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.isPMREMTexture=!1,this.normalized=!1}get width(){return this.source.getSize(E0).x}get height(){return this.source.getSize(E0).y}get depth(){return this.source.getSize(E0).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.mipmapsAutoUpdate=e.mipmapsAutoUpdate,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isPMREMTexture=e.isPMREMTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Fe(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Fe(`Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,mipmapsAutoUpdate:this.mipmapsAutoUpdate,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==nd)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Pc:e.x=e.x-Math.floor(e.x);break;case Fi:e.x=e.x<0?0:1;break;case Lc: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 Pc:e.y=e.y-Math.floor(e.y);break;case Fi:e.y=e.y<0?0:1;break;case Lc: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++}}pn.DEFAULT_IMAGE=null;pn.DEFAULT_MAPPING=nd;pn.DEFAULT_ANISOTROPY=1;const $g=class $g{constructor(e=0,t=0,n=0,r=1){this.x=e,this.y=t,this.z=n,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("THREE.Vector4: 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("THREE.Vector4: 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,r=this.z,o=this.w,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*r+l[12]*o,this.y=l[1]*t+l[5]*n+l[9]*r+l[13]*o,this.z=l[2]*t+l[6]*n+l[10]*r+l[14]*o,this.w=l[3]*t+l[7]*n+l[11]*r+l[15]*o,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,o;const h=e.elements,d=h[0],p=h[4],g=h[8],v=h[1],_=h[5],y=h[9],w=h[2],b=h[6],S=h[10];if(Math.abs(p-v)<.01&&Math.abs(g-w)<.01&&Math.abs(y-b)<.01){if(Math.abs(p+v)<.1&&Math.abs(g+w)<.1&&Math.abs(y+b)<.1&&Math.abs(d+_+S-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const A=(d+1)/2,E=(_+1)/2,N=(S+1)/2,P=(p+v)/4,T=(g+w)/4,C=(y+b)/4;return A>E&&A>N?A<.01?(n=0,r=.707106781,o=.707106781):(n=Math.sqrt(A),r=P/n,o=T/n):E>N?E<.01?(n=.707106781,r=0,o=.707106781):(r=Math.sqrt(E),n=P/r,o=C/r):N<.01?(n=.707106781,r=.707106781,o=0):(o=Math.sqrt(N),n=T/o,r=C/o),this.set(n,r,o,t),this}let M=Math.sqrt((b-y)*(b-y)+(g-w)*(g-w)+(v-p)*(v-p));return Math.abs(M)<.001&&(M=1),this.x=(b-y)/M,this.y=(g-w)/M,this.z=(v-p)/M,this.w=Math.acos((d+_+S-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=ft(this.x,e.x,t.x),this.y=ft(this.y,e.y,t.y),this.z=ft(this.z,e.z,t.z),this.w=ft(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=ft(this.x,e,t),this.y=ft(this.y,e,t),this.z=ft(this.z,e,t),this.w=ft(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(ft(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,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}};$g.prototype.isVector4=!0;let Kt=$g;class ag extends Bi{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:an,depthBuffer:!0,stencilBuffer:!1,resolveColorBuffer:!0,resolveDepthBuffer:!0,resolveStencilBuffer:!0,storeMultisampledColorBuffer:!0,storeMultisampledDepthBuffer:!0,storeMultisampledStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1,useArrayDepthTexture:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new Kt(0,0,e,t),this.scissorTest=!1,this.viewport=new Kt(0,0,e,t),this.textures=[];const r=n.count;for(let o=0;o<r;o++)this.textures[o]=new pn({width:e,height:t,depth:n.depth}),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveColorBuffer=n.resolveColorBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.storeMultisampledColorBuffer=n.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=n.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=n.storeMultisampledStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview,this.useArrayDepthTexture=n.useArrayDepthTexture}_setTextureOptions(e={}){const t={minFilter:an,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.mipmapsAutoUpdate!==void 0&&(t.mipmapsAutoUpdate=e.mipmapsAutoUpdate),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&this._depthTexture.renderTarget===this&&(this._depthTexture.renderTarget=null),e!==null&&e.renderTarget===null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let r=0,o=this.textures.length;r<o;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=n,this.textures[r].isData3DTexture!==!0&&(this.textures[r].isArrayTexture=this.textures[r].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const r=Object.assign({},e.textures[t].image);this.textures[t].source=new Js(r)}if(this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveColorBuffer=e.resolveColorBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,this.storeMultisampledColorBuffer=e.storeMultisampledColorBuffer,this.storeMultisampledDepthBuffer=e.storeMultisampledDepthBuffer,this.storeMultisampledStencilBuffer=e.storeMultisampledStencilBuffer,e.depthTexture!==null)if(e.depthTexture.renderTarget===e){const t=e.depthTexture.clone();t.renderTarget=null,this.depthTexture=t}else this.depthTexture=e.depthTexture;else this.depthTexture=null;return this.samples=e.samples,this.multiview=e.multiview,this.useArrayDepthTexture=e.useArrayDepthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}class gn extends ag{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class fd extends pn{constructor(e=null,t=1,n=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=dn,this.minFilter=dn,this.wrapR=Fi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class mT extends gn{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new fd(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}class dd extends pn{constructor(e=null,t=1,n=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:r},this.magFilter=dn,this.minFilter=dn,this.wrapR=Fi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}}class gT extends gn{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new dd(null,e,t,n),this._setTextureOptions(r),this.texture.isRenderTargetTexture=!0}}const ed=class ed{constructor(e,t,n,r,o,l,c,h,d,p,g,v,_,y,w,b){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,r,o,l,c,h,d,p,g,v,_,y,w,b)}set(e,t,n,r,o,l,c,h,d,p,g,v,_,y,w,b){const S=this.elements;return S[0]=e,S[4]=t,S[8]=n,S[12]=r,S[1]=o,S[5]=l,S[9]=c,S[13]=h,S[2]=d,S[6]=p,S[10]=g,S[14]=v,S[3]=_,S[7]=y,S[11]=w,S[15]=b,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 ed().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 this.determinantAffine()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinantAffine()===0)return this.identity();const t=this.elements,n=e.elements,r=1/Uo.setFromMatrixColumn(e,0).length(),o=1/Uo.setFromMatrixColumn(e,1).length(),l=1/Uo.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*o,t[5]=n[5]*o,t[6]=n[6]*o,t[7]=0,t[8]=n[8]*l,t[9]=n[9]*l,t[10]=n[10]*l,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,r=e.y,o=e.z,l=Math.cos(n),c=Math.sin(n),h=Math.cos(r),d=Math.sin(r),p=Math.cos(o),g=Math.sin(o);if(e.order==="XYZ"){const v=l*p,_=l*g,y=c*p,w=c*g;t[0]=h*p,t[4]=-h*g,t[8]=d,t[1]=_+y*d,t[5]=v-w*d,t[9]=-c*h,t[2]=w-v*d,t[6]=y+_*d,t[10]=l*h}else if(e.order==="YXZ"){const v=h*p,_=h*g,y=d*p,w=d*g;t[0]=v+w*c,t[4]=y*c-_,t[8]=l*d,t[1]=l*g,t[5]=l*p,t[9]=-c,t[2]=_*c-y,t[6]=w+v*c,t[10]=l*h}else if(e.order==="ZXY"){const v=h*p,_=h*g,y=d*p,w=d*g;t[0]=v-w*c,t[4]=-l*g,t[8]=y+_*c,t[1]=_+y*c,t[5]=l*p,t[9]=w-v*c,t[2]=-l*d,t[6]=c,t[10]=l*h}else if(e.order==="ZYX"){const v=l*p,_=l*g,y=c*p,w=c*g;t[0]=h*p,t[4]=y*d-_,t[8]=v*d+w,t[1]=h*g,t[5]=w*d+v,t[9]=_*d-y,t[2]=-d,t[6]=c*h,t[10]=l*h}else if(e.order==="YZX"){const v=l*h,_=l*d,y=c*h,w=c*d;t[0]=h*p,t[4]=w-v*g,t[8]=y*g+_,t[1]=g,t[5]=l*p,t[9]=-c*p,t[2]=-d*p,t[6]=_*g+y,t[10]=v-w*g}else if(e.order==="XZY"){const v=l*h,_=l*d,y=c*h,w=c*d;t[0]=h*p,t[4]=-g,t[8]=d*p,t[1]=v*g+w,t[5]=l*p,t[9]=_*g-y,t[2]=y*g-_,t[6]=c*p,t[10]=w*g+v}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(vT,e,_T)}lookAt(e,t,n){const r=this.elements;return ji.subVectors(e,t),ji.lengthSq()===0&&(ji.z=1),ji.normalize(),Xr.crossVectors(n,ji),Xr.lengthSq()===0&&(Math.abs(n.z)===1?ji.x+=1e-4:ji.z+=1e-4,ji.normalize(),Xr.crossVectors(n,ji)),Xr.normalize(),rh.crossVectors(ji,Xr),r[0]=Xr.x,r[4]=rh.x,r[8]=ji.x,r[1]=Xr.y,r[5]=rh.y,r[9]=ji.y,r[2]=Xr.z,r[6]=rh.z,r[10]=ji.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,r=t.elements,o=this.elements,l=n[0],c=n[4],h=n[8],d=n[12],p=n[1],g=n[5],v=n[9],_=n[13],y=n[2],w=n[6],b=n[10],S=n[14],M=n[3],A=n[7],E=n[11],N=n[15],P=r[0],T=r[4],C=r[8],F=r[12],D=r[1],B=r[5],W=r[9],Z=r[13],z=r[2],X=r[6],Q=r[10],q=r[14],fe=r[3],Y=r[7],he=r[11],pe=r[15];return o[0]=l*P+c*D+h*z+d*fe,o[4]=l*T+c*B+h*X+d*Y,o[8]=l*C+c*W+h*Q+d*he,o[12]=l*F+c*Z+h*q+d*pe,o[1]=p*P+g*D+v*z+_*fe,o[5]=p*T+g*B+v*X+_*Y,o[9]=p*C+g*W+v*Q+_*he,o[13]=p*F+g*Z+v*q+_*pe,o[2]=y*P+w*D+b*z+S*fe,o[6]=y*T+w*B+b*X+S*Y,o[10]=y*C+w*W+b*Q+S*he,o[14]=y*F+w*Z+b*q+S*pe,o[3]=M*P+A*D+E*z+N*fe,o[7]=M*T+A*B+E*X+N*Y,o[11]=M*C+A*W+E*Q+N*he,o[15]=M*F+A*Z+E*q+N*pe,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],r=e[8],o=e[12],l=e[1],c=e[5],h=e[9],d=e[13],p=e[2],g=e[6],v=e[10],_=e[14],y=e[3],w=e[7],b=e[11],S=e[15],M=h*_-d*v,A=c*_-d*g,E=c*v-h*g,N=l*_-d*p,P=l*v-h*p,T=l*g-c*p;return t*(w*M-b*A+S*E)-n*(y*M-b*N+S*P)+r*(y*A-w*N+S*T)-o*(y*E-w*P+b*T)}determinantAffine(){const e=this.elements,t=e[0],n=e[4],r=e[8],o=e[1],l=e[5],c=e[9],h=e[2],d=e[6],p=e[10];return t*(l*p-c*d)-n*(o*p-c*h)+r*(o*d-l*h)}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 r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],r=e[2],o=e[3],l=e[4],c=e[5],h=e[6],d=e[7],p=e[8],g=e[9],v=e[10],_=e[11],y=e[12],w=e[13],b=e[14],S=e[15],M=t*c-n*l,A=t*h-r*l,E=t*d-o*l,N=n*h-r*c,P=n*d-o*c,T=r*d-o*h,C=p*w-g*y,F=p*b-v*y,D=p*S-_*y,B=g*b-v*w,W=g*S-_*w,Z=v*S-_*b,z=M*Z-A*W+E*B+N*D-P*F+T*C;if(z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const X=1/z;return e[0]=(c*Z-h*W+d*B)*X,e[1]=(r*W-n*Z-o*B)*X,e[2]=(w*T-b*P+S*N)*X,e[3]=(v*P-g*T-_*N)*X,e[4]=(h*D-l*Z-d*F)*X,e[5]=(t*Z-r*D+o*F)*X,e[6]=(b*E-y*T-S*A)*X,e[7]=(p*T-v*E+_*A)*X,e[8]=(l*W-c*D+d*C)*X,e[9]=(n*D-t*W-o*C)*X,e[10]=(y*P-w*E+S*M)*X,e[11]=(g*E-p*P-_*M)*X,e[12]=(c*F-l*B-h*C)*X,e[13]=(t*B-n*F+r*C)*X,e[14]=(w*A-y*N-b*M)*X,e[15]=(p*N-g*A+v*M)*X,this}scale(e){const t=this.elements,n=e.x,r=e.y,o=e.z;return t[0]*=n,t[4]*=r,t[8]*=o,t[1]*=n,t[5]*=r,t[9]*=o,t[2]*=n,t[6]*=r,t[10]*=o,t[3]*=n,t[7]*=r,t[11]*=o,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],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}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),r=Math.sin(t),o=1-n,l=e.x,c=e.y,h=e.z,d=o*l,p=o*c;return this.set(d*l+n,d*c-r*h,d*h+r*c,0,d*c+r*h,p*c+n,p*h-r*l,0,d*h-r*c,p*h+r*l,o*h*h+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,r,o,l){return this.set(1,n,o,0,e,1,l,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){const r=this.elements,o=t._x,l=t._y,c=t._z,h=t._w,d=o+o,p=l+l,g=c+c,v=o*d,_=o*p,y=o*g,w=l*p,b=l*g,S=c*g,M=h*d,A=h*p,E=h*g,N=n.x,P=n.y,T=n.z;return r[0]=(1-(w+S))*N,r[1]=(_+E)*N,r[2]=(y-A)*N,r[3]=0,r[4]=(_-E)*P,r[5]=(1-(v+S))*P,r[6]=(b+M)*P,r[7]=0,r[8]=(y+A)*T,r[9]=(b-M)*T,r[10]=(1-(v+w))*T,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){const r=this.elements;e.x=r[12],e.y=r[13],e.z=r[14];const o=this.determinantAffine();if(o===0)return n.set(1,1,1),t.identity(),this;let l=Uo.set(r[0],r[1],r[2]).length();const c=Uo.set(r[4],r[5],r[6]).length(),h=Uo.set(r[8],r[9],r[10]).length();o<0&&(l=-l),Ts.copy(this);const d=1/l,p=1/c,g=1/h;return Ts.elements[0]*=d,Ts.elements[1]*=d,Ts.elements[2]*=d,Ts.elements[4]*=p,Ts.elements[5]*=p,Ts.elements[6]*=p,Ts.elements[8]*=g,Ts.elements[9]*=g,Ts.elements[10]*=g,t.setFromRotationMatrix(Ts),n.x=l,n.y=c,n.z=h,this}makePerspective(e,t,n,r,o,l,c=Ki,h=!1){const d=this.elements,p=2*o/(t-e),g=2*o/(n-r),v=(t+e)/(t-e),_=(n+r)/(n-r);let y,w;if(h)y=o/(l-o),w=l*o/(l-o);else if(c===Ki)y=-(l+o)/(l-o),w=-2*l*o/(l-o);else if(c===$a)y=-l/(l-o),w=-l*o/(l-o);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+c);return d[0]=p,d[4]=0,d[8]=v,d[12]=0,d[1]=0,d[5]=g,d[9]=_,d[13]=0,d[2]=0,d[6]=0,d[10]=y,d[14]=w,d[3]=0,d[7]=0,d[11]=-1,d[15]=0,this}makeOrthographic(e,t,n,r,o,l,c=Ki,h=!1){const d=this.elements,p=2/(t-e),g=2/(n-r),v=-(t+e)/(t-e),_=-(n+r)/(n-r);let y,w;if(h)y=1/(l-o),w=l/(l-o);else if(c===Ki)y=-2/(l-o),w=-(l+o)/(l-o);else if(c===$a)y=-1/(l-o),w=-o/(l-o);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+c);return d[0]=p,d[4]=0,d[8]=0,d[12]=v,d[1]=0,d[5]=g,d[9]=0,d[13]=_,d[2]=0,d[6]=0,d[10]=y,d[14]=w,d[3]=0,d[7]=0,d[11]=0,d[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let r=0;r<16;r++)if(t[r]!==n[r])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}};ed.prototype.isMatrix4=!0;let gt=ed;const Uo=new O,Ts=new gt,vT=new O(0,0,0),_T=new O(1,1,1),Xr=new O,rh=new O,ji=new O,D_=new gt,U_=new wi;class Ns{constructor(e=0,t=0,n=0,r=Ns.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const r=e.elements,o=r[0],l=r[4],c=r[8],h=r[1],d=r[5],p=r[9],g=r[2],v=r[6],_=r[10];switch(t){case"XYZ":this._y=Math.asin(ft(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-p,_),this._z=Math.atan2(-l,o)):(this._x=Math.atan2(v,d),this._z=0);break;case"YXZ":this._x=Math.asin(-ft(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(c,_),this._z=Math.atan2(h,d)):(this._y=Math.atan2(-g,o),this._z=0);break;case"ZXY":this._x=Math.asin(ft(v,-1,1)),Math.abs(v)<.9999999?(this._y=Math.atan2(-g,_),this._z=Math.atan2(-l,d)):(this._y=0,this._z=Math.atan2(h,o));break;case"ZYX":this._y=Math.asin(-ft(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(v,_),this._z=Math.atan2(h,o)):(this._x=0,this._z=Math.atan2(-l,d));break;case"YZX":this._z=Math.asin(ft(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(-p,d),this._y=Math.atan2(-g,o)):(this._x=0,this._y=Math.atan2(c,_));break;case"XZY":this._z=Math.asin(-ft(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(v,d),this._y=Math.atan2(c,o)):(this._x=Math.atan2(-p,_),this._y=0);break;default:Fe("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return D_.makeRotationFromQuaternion(e),this.setFromRotationMatrix(D_,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return U_.setFromEuler(this),this.setFromQuaternion(U_,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}}Ns.DEFAULT_ORDER="XYZ";class pl{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let xT=0;const F_=new O,Fo=new wi,ur=new gt,ah=new O,Kl=new O,yT=new O,ST=new wi,O_=new O(1,0,0),B_=new O(0,1,0),z_=new O(0,0,1),k_={type:"added"},bT={type:"removed"},Oo={type:"childadded",child:null},A0={type:"childremoved",child:null};class Wt extends Bi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:xT++}),this.uuid=ms(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Wt.DEFAULT_UP.clone();const e=new O,t=new Ns,n=new wi,r=new O(1,1,1);function o(){n.setFromEuler(t,!1)}function l(){t.setFromQuaternion(n,void 0,!1)}t._onChange(o),n._onChange(l),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new gt},normalMatrix:{value:new _t}}),this.matrix=new gt,this.matrixWorld=new gt,this.matrixAutoUpdate=Wt.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Wt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new pl,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale),this.pivot!==null&&this.position.copy(this.pivot).applyMatrix4(this.matrix).sub(this.pivot)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return Fo.setFromAxisAngle(e,t),this.quaternion.multiply(Fo),this}rotateOnWorldAxis(e,t){return Fo.setFromAxisAngle(e,t),this.quaternion.premultiply(Fo),this}rotateX(e){return this.rotateOnAxis(O_,e)}rotateY(e){return this.rotateOnAxis(B_,e)}rotateZ(e){return this.rotateOnAxis(z_,e)}translateOnAxis(e,t){return F_.copy(e).applyQuaternion(this.quaternion),this.position.add(F_.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(O_,e)}translateY(e){return this.translateOnAxis(B_,e)}translateZ(e){return this.translateOnAxis(z_,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(ur.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?ah.copy(e):ah.set(e,t,n);const r=this.parent;this.updateWorldMatrix(!0,!1),Kl.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ur.lookAt(Kl,ah,this.up):ur.lookAt(ah,Kl,this.up),this.quaternion.setFromRotationMatrix(ur),r&&(ur.extractRotation(r.matrixWorld),Fo.setFromRotationMatrix(ur),this.quaternion.premultiply(Fo.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(it("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(k_),Oo.child=e,this.dispatchEvent(Oo),Oo.child=null):it("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(bT),A0.child=e,this.dispatchEvent(A0),A0.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),ur.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),ur.multiply(e.parent.matrixWorld)),e.applyMatrix4(ur),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(k_),Oo.child=e,this.dispatchEvent(Oo),Oo.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,r=this.children.length;n<r;n++){const l=this.children[n].getObjectByProperty(e,t);if(l!==void 0)return l}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const r=this.children;for(let o=0,l=r.length;o<l;o++)r[o].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Kl,e,yT),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Kl,ST,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}intersectsFrustum(){return!0}traverse(e){e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,r=e.z,o=this.matrix.elements;o[12]+=t-o[0]*t-o[4]*n-o[8]*r,o[13]+=n-o[1]*t-o[5]*n-o[9]*r,o[14]+=r-o[2]*t-o[6]*n-o[10]*r}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,r=t.length;n<r;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t,n=!1){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||n)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,n=!0),t===!0){const o=this.children;for(let l=0,c=o.length;l<c;l++)o[l].updateWorldMatrix(!1,!0,n)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,r.name=this.name,r.castShadow=this.castShadow,r.receiveShadow=this.receiveShadow,r.visible=this.visible,r.frustumCulled=this.frustumCulled,r.renderOrder=this.renderOrder,r.static=this.static,r.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.pivot!==null&&(r.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(r.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(r.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(c=>({...c,boundingBox:c.boundingBox?c.boundingBox.toJSON():void 0,boundingSphere:c.boundingSphere?c.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(c=>({...c})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function o(c,h){return c[h.uuid]===void 0&&(c[h.uuid]=h.toJSON(e)),h.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=o(e.geometries,this.geometry);const c=this.geometry.parameters;if(c!==void 0&&c.shapes!==void 0){const h=c.shapes;if(Array.isArray(h))for(let d=0,p=h.length;d<p;d++){const g=h[d];o(e.shapes,g)}else o(e.shapes,h)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(o(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const c=[];for(let h=0,d=this.material.length;h<d;h++)c.push(o(e.materials,this.material[h]));r.material=c}else r.material=o(e.materials,this.material);if(this.children.length>0){r.children=[];for(let c=0;c<this.children.length;c++)r.children.push(this.children[c].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let c=0;c<this.animations.length;c++){const h=this.animations[c];r.animations.push(o(e.animations,h))}}if(t){const c=l(e.geometries),h=l(e.materials),d=l(e.textures),p=l(e.images),g=l(e.shapes),v=l(e.skeletons),_=l(e.animations),y=l(e.nodes);c.length>0&&(n.geometries=c),h.length>0&&(n.materials=h),d.length>0&&(n.textures=d),p.length>0&&(n.images=p),g.length>0&&(n.shapes=g),v.length>0&&(n.skeletons=v),_.length>0&&(n.animations=_),y.length>0&&(n.nodes=y)}return n.object=r,n;function l(c){const h=[];for(const d in c){const p=c[d];delete p.metadata,h.push(p)}return h}}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.pivot=e.pivot!==null?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const r=e.children[n];this.add(r.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}}Wt.DEFAULT_UP=new O(0,1,0);Wt.DEFAULT_MATRIX_AUTO_UPDATE=!0;Wt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class sl extends Wt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const MT={type:"move"};class tf{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new sl,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 sl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new O,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new O),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new sl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new O,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new O,this._grip.eventsEnabled=!1),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 r=null,o=null,l=null;const c=this._targetRay,h=this._grip,d=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(d&&e.hand){l=!0;for(const w of e.hand.values()){const b=t.getJointPose(w,n),S=this._getHandJoint(d,w);b!==null&&(S.matrix.fromArray(b.transform.matrix),S.matrix.decompose(S.position,S.quaternion,S.scale),S.matrixWorldNeedsUpdate=!0,S.jointRadius=b.radius),S.visible=b!==null}const p=d.joints["index-finger-tip"],g=d.joints["thumb-tip"],v=p.position.distanceTo(g.position),_=.02,y=.005;d.inputState.pinching&&v>_+y?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!d.inputState.pinching&&v<=_-y&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else h!==null&&e.gripSpace&&(o=t.getPose(e.gripSpace,n),o!==null&&(h.matrix.fromArray(o.transform.matrix),h.matrix.decompose(h.position,h.quaternion,h.scale),h.matrixWorldNeedsUpdate=!0,o.linearVelocity?(h.hasLinearVelocity=!0,h.linearVelocity.copy(o.linearVelocity)):h.hasLinearVelocity=!1,o.angularVelocity?(h.hasAngularVelocity=!0,h.angularVelocity.copy(o.angularVelocity)):h.hasAngularVelocity=!1,h.eventsEnabled&&h.dispatchEvent({type:"gripUpdated",data:e,target:this})));c!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&o!==null&&(r=o),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.quaternion,c.scale),c.matrixWorldNeedsUpdate=!0,r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1,this.dispatchEvent(MT)))}return c!==null&&(c.visible=r!==null),h!==null&&(h.visible=o!==null),d!==null&&(d.visible=l!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new sl;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const T3={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},qr={h:0,s:0,l:0},oh={h:0,s:0,l:0};function C0(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*6*(2/3-t):i}class Ge{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 r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Zt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Lt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=Lt.workingColorSpace){return this.r=e,this.g=t,this.b=n,Lt.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=Lt.workingColorSpace){if(e=rg(e,1),t=ft(t,0,1),n=ft(n,0,1),t===0)this.r=this.g=this.b=n;else{const o=n<=.5?n*(1+t):n+t-n*t,l=2*n-o;this.r=C0(l,o,e+1/3),this.g=C0(l,o,e),this.b=C0(l,o,e-1/3)}return Lt.colorSpaceToWorking(this,r),this}setStyle(e,t=Zt){function n(o){o!==void 0&&parseFloat(o)<1&&Fe("Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let o;const l=r[1],c=r[2];switch(l){case"rgb":case"rgba":if(o=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(255,parseInt(o[1],10))/255,Math.min(255,parseInt(o[2],10))/255,Math.min(255,parseInt(o[3],10))/255,t);if(o=/^\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(c))return n(o[4]),this.setRGB(Math.min(100,parseFloat(o[1]))/100,Math.min(100,parseFloat(o[2]))/100,Math.min(100,parseFloat(o[3]))/100,t);break;case"hsl":case"hsla":if(o=/^\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*,\s*(\d+(?:\.\d+)?|\.\d+)\%\s*(?:,\s*(\d+(?:\.\d+)?|\.\d+)\s*)?$/.exec(c))return n(o[4]),this.setHSL(parseFloat(o[1])/360,parseFloat(o[2])/100,parseFloat(o[3])/100,t);break;default:Fe("Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const o=r[1],l=o.length;if(l===3)return this.setRGB(parseInt(o.charAt(0),16)/15,parseInt(o.charAt(1),16)/15,parseInt(o.charAt(2),16)/15,t);if(l===6)return this.setHex(parseInt(o,16),t);Fe("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Zt){const n=T3[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Fe("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=yr(e.r),this.g=yr(e.g),this.b=yr(e.b),this}copyLinearToSRGB(e){return this.r=cl(e.r),this.g=cl(e.g),this.b=cl(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Zt){return Lt.workingToColorSpace(fi.copy(this),e),Math.round(ft(fi.r*255,0,255))*65536+Math.round(ft(fi.g*255,0,255))*256+Math.round(ft(fi.b*255,0,255))}getHexString(e=Zt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Lt.workingColorSpace){Lt.workingToColorSpace(fi.copy(this),t);const n=fi.r,r=fi.g,o=fi.b,l=Math.max(n,r,o),c=Math.min(n,r,o);let h,d;const p=(c+l)/2;if(c===l)h=0,d=0;else{const g=l-c;switch(d=p<=.5?g/(l+c):g/(2-l-c),l){case n:h=(r-o)/g+(r<o?6:0);break;case r:h=(o-n)/g+2;break;case o:h=(n-r)/g+4;break}h/=6}return e.h=h,e.s=d,e.l=p,e}getRGB(e,t=Lt.workingColorSpace){return Lt.workingToColorSpace(fi.copy(this),t),e.r=fi.r,e.g=fi.g,e.b=fi.b,e}getStyle(e=Zt){Lt.workingToColorSpace(fi.copy(this),e);const t=fi.r,n=fi.g,r=fi.b;return e!==Zt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(r*255)})`}offsetHSL(e,t,n){return this.getHSL(qr),this.setHSL(qr.h+e,qr.s+t,qr.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(qr),e.getHSL(oh);const n=wc(qr.h,oh.h,t),r=wc(qr.s,oh.s,t),o=wc(qr.l,oh.l,t);return this.setHSL(n,r,o),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,r=this.b,o=e.elements;return this.r=o[0]*t+o[3]*n+o[6]*r,this.g=o[1]*t+o[4]*n+o[7]*r,this.b=o[2]*t+o[5]*n+o[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const fi=new Ge;Ge.NAMES=T3;class pd{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ge(e),this.density=t}clone(){return new pd(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class md{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Ge(e),this.near=t,this.far=n}clone(){return new md(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class kc extends Wt{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 Ns,this.environmentIntensity=1,this.environmentRotation=new Ns,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),this.background=e.background!==null?e.background.clone():null,this.environment=e.environment!==null?e.environment.clone():null,this.fog=e.fog!==null?e.fog.clone():null,this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),this.overrideMaterial=e.overrideMaterial!==null?e.overrideMaterial.clone():null,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t.object.backgroundBlurriness=this.backgroundBlurriness,t.object.backgroundIntensity=this.backgroundIntensity,t.object.backgroundRotation=this.backgroundRotation.toArray(),t.object.environmentIntensity=this.environmentIntensity,t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Es=new O,hr=new O,R0=new O,fr=new O,Bo=new O,zo=new O,H_=new O,I0=new O,P0=new O,L0=new O,N0=new Kt,D0=new Kt,U0=new Kt;class Ui{constructor(e=new O,t=new O,n=new O){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,r){r.subVectors(n,t),Es.subVectors(e,t),r.cross(Es);const o=r.lengthSq();return o>0?r.multiplyScalar(1/Math.sqrt(o)):r.set(0,0,0)}static getBarycoord(e,t,n,r,o){Es.subVectors(r,t),hr.subVectors(n,t),R0.subVectors(e,t);const l=Es.dot(Es),c=Es.dot(hr),h=Es.dot(R0),d=hr.dot(hr),p=hr.dot(R0),g=l*d-c*c;if(g===0)return o.set(0,0,0),null;const v=1/g,_=(d*h-c*p)*v,y=(l*p-c*h)*v;return o.set(1-_-y,y,_)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,fr)===null?!1:fr.x>=0&&fr.y>=0&&fr.x+fr.y<=1}static getInterpolation(e,t,n,r,o,l,c,h){return this.getBarycoord(e,t,n,r,fr)===null?(h.x=0,h.y=0,"z"in h&&(h.z=0),"w"in h&&(h.w=0),null):(h.setScalar(0),h.addScaledVector(o,fr.x),h.addScaledVector(l,fr.y),h.addScaledVector(c,fr.z),h)}static getInterpolatedAttribute(e,t,n,r,o,l){return N0.setScalar(0),D0.setScalar(0),U0.setScalar(0),N0.fromBufferAttribute(e,t),D0.fromBufferAttribute(e,n),U0.fromBufferAttribute(e,r),l.setScalar(0),l.addScaledVector(N0,o.x),l.addScaledVector(D0,o.y),l.addScaledVector(U0,o.z),l}static isFrontFacing(e,t,n,r){return Es.subVectors(n,t),hr.subVectors(e,t),Es.cross(hr).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Es.subVectors(this.c,this.b),hr.subVectors(this.a,this.b),Es.cross(hr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ui.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ui.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,r,o){return Ui.getInterpolation(e,this.a,this.b,this.c,t,n,r,o)}containsPoint(e){return Ui.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ui.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,r=this.b,o=this.c;let l,c;Bo.subVectors(r,n),zo.subVectors(o,n),I0.subVectors(e,n);const h=Bo.dot(I0),d=zo.dot(I0);if(h<=0&&d<=0)return t.copy(n);P0.subVectors(e,r);const p=Bo.dot(P0),g=zo.dot(P0);if(p>=0&&g<=p)return t.copy(r);const v=h*g-p*d;if(v<=0&&h>=0&&p<=0&&h-p>0)return l=h/(h-p),t.copy(n).addScaledVector(Bo,l);L0.subVectors(e,o);const _=Bo.dot(L0),y=zo.dot(L0);if(y>=0&&_<=y)return t.copy(o);const w=_*d-h*y;if(w<=0&&d>=0&&y<=0)return c=d/(d-y),t.copy(n).addScaledVector(zo,c);const b=p*y-_*g;if(b<=0&&g-p>=0&&_-y>=0)return H_.subVectors(o,r),c=(g-p)/(g-p+(_-y)),t.copy(r).addScaledVector(H_,c);const S=1/(b+w+v);return l=w*S,c=v*S,t.copy(n).addScaledVector(Bo,l).addScaledVector(zo,c)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class gi{constructor(e=new O(1/0,1/0,1/0),t=new O(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(As.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(As.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=As.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const o=n.getAttribute("position");if(t===!0&&o!==void 0&&e.isInstancedMesh!==!0&&e.isBatchedMesh!==!0)for(let l=0,c=o.count;l<c;l++)e.isMesh===!0?e.getVertexPosition(l,As):As.fromBufferAttribute(o,l),As.applyMatrix4(e.matrixWorld),this.expandByPoint(As);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),lh.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),lh.copy(n.boundingBox)),lh.applyMatrix4(e.matrixWorld),this.union(lh)}const r=e.children;for(let o=0,l=r.length;o<l;o++)this.expandByObject(r[o],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,As),As.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(Ql),ch.subVectors(this.max,Ql),ko.subVectors(e.a,Ql),Ho.subVectors(e.b,Ql),Vo.subVectors(e.c,Ql),$r.subVectors(Ho,ko),Yr.subVectors(Vo,Ho),Ta.subVectors(ko,Vo);let t=[0,-$r.z,$r.y,0,-Yr.z,Yr.y,0,-Ta.z,Ta.y,$r.z,0,-$r.x,Yr.z,0,-Yr.x,Ta.z,0,-Ta.x,-$r.y,$r.x,0,-Yr.y,Yr.x,0,-Ta.y,Ta.x,0];return!F0(t,ko,Ho,Vo,ch)||(t=[1,0,0,0,1,0,0,0,1],!F0(t,ko,Ho,Vo,ch))?!1:(uh.crossVectors($r,Yr),t=[uh.x,uh.y,uh.z],F0(t,ko,Ho,Vo,ch))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,As).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(As).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:(dr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),dr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),dr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),dr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),dr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),dr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),dr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),dr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(dr),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const dr=[new O,new O,new O,new O,new O,new O,new O,new O],As=new O,lh=new gi,ko=new O,Ho=new O,Vo=new O,$r=new O,Yr=new O,Ta=new O,Ql=new O,ch=new O,uh=new O,Ea=new O;function F0(i,e,t,n,r){for(let o=0,l=i.length-3;o<=l;o+=3){Ea.fromArray(i,o);const c=r.x*Math.abs(Ea.x)+r.y*Math.abs(Ea.y)+r.z*Math.abs(Ea.z),h=e.dot(Ea),d=t.dot(Ea),p=n.dot(Ea);if(Math.max(-Math.max(h,d,p),Math.min(h,d,p))>c)return!1}return!0}const _r=wT();function wT(){const i=new ArrayBuffer(4),e=new Float32Array(i),t=new Uint32Array(i),n=new Uint32Array(512),r=new Uint32Array(512);for(let h=0;h<256;++h){const d=h-127;d<-27?(n[h]=0,n[h|256]=32768,r[h]=24,r[h|256]=24):d<-14?(n[h]=1024>>-d-14,n[h|256]=1024>>-d-14|32768,r[h]=-d-1,r[h|256]=-d-1):d<=15?(n[h]=d+15<<10,n[h|256]=d+15<<10|32768,r[h]=13,r[h|256]=13):d<128?(n[h]=31744,n[h|256]=64512,r[h]=24,r[h|256]=24):(n[h]=31744,n[h|256]=64512,r[h]=13,r[h|256]=13)}const o=new Uint32Array(2048),l=new Uint32Array(64),c=new Uint32Array(64);for(let h=1;h<1024;++h){let d=h<<13,p=0;for(;(d&8388608)===0;)d<<=1,p-=8388608;d&=-8388609,p+=947912704,o[h]=d|p}for(let h=1024;h<2048;++h)o[h]=939524096+(h-1024<<13);for(let h=1;h<31;++h)l[h]=h<<23;l[31]=1199570944,l[32]=2147483648;for(let h=33;h<63;++h)l[h]=2147483648+(h-32<<23);l[63]=3347054592;for(let h=1;h<64;++h)h!==32&&(c[h]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:r,mantissaTable:o,exponentTable:l,offsetTable:c}}function Li(i){Math.abs(i)>65504&&Fe("DataUtils.toHalfFloat(): Value out of range."),i=ft(i,-65504,65504),_r.floatView[0]=i;const e=_r.uint32View[0],t=e>>23&511;return _r.baseTable[t]+((e&8388607)>>_r.shiftTable[t])}function hc(i){const e=i>>10;return _r.uint32View[0]=_r.mantissaTable[_r.offsetTable[e]+(i&1023)]+_r.exponentTable[e],_r.floatView[0]}class TT{static toHalfFloat(e){return Li(e)}static fromHalfFloat(e){return hc(e)}}const Bn=new O,hh=new ue;let ET=0;class on extends Bi{constructor(e,t,n=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:ET++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=ud,this.updateRanges=[],this.gpuType=oi,this.version=0,this._normalizationScale=e!==void 0?hd(e):void 0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this._normalizationScale=e._normalizationScale,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,o=this.itemSize;r<o;r++)this.array[e+r]=t.array[n+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)hh.fromBufferAttribute(this,t),hh.applyMatrix3(e),this.setXY(t,hh.x,hh.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Bn.fromBufferAttribute(this,t),Bn.applyMatrix3(e),this.setXYZ(t,Bn.x,Bn.y,Bn.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Bn.fromBufferAttribute(this,t),Bn.applyMatrix4(e),this.setXYZ(t,Bn.x,Bn.y,Bn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Bn.fromBufferAttribute(this,t),Bn.applyNormalMatrix(e),this.setXYZ(t,Bn.x,Bn.y,Bn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Bn.fromBufferAttribute(this,t),Bn.transformDirection(e),this.setXYZ(t,Bn.x,Bn.y,Bn.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=this._denormalize(n)),n}setComponent(e,t,n){return this.normalized&&(n=this._normalize(n)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=this._denormalize(t)),t}setX(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=this._denormalize(t)),t}setY(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=this._denormalize(t)),t}setZ(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=this._denormalize(t)),t}setW(e,t){return this.normalized&&(t=this._normalize(t)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=this._normalize(t),n=this._normalize(n)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=this._normalize(t),n=this._normalize(n),r=this._normalize(r)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this}setXYZW(e,t,n,r,o){return e*=this.itemSize,this.normalized&&(t=this._normalize(t),n=this._normalize(n),r=this._normalize(r),o=this._normalize(o)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=r,this.array[e+3]=o,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return e.name=this.name,e.usage=this.usage,e.gpuType=this.gpuType,e}dispose(){this.dispatchEvent({type:"dispose"})}_denormalize(e){const t=this._normalizationScale;return t!==void 0?Math.max(e/t,-1):Ha(e,this.array)}_normalize(e){const t=this._normalizationScale;return t!==void 0?Math.round(e*t):pi(e,this.array)}}class AT extends on{constructor(e,t,n){super(new Int8Array(e),t,n)}}class CT extends on{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class RT extends on{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class IT extends on{constructor(e,t,n){super(new Int16Array(e),t,n)}}class og extends on{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class PT extends on{constructor(e,t,n){super(new Int32Array(e),t,n)}}class lg extends on{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class LT extends on{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=hc(this.array[e*this.itemSize]);return this.normalized&&(t=Ha(t,this.array)),t}setX(e,t){return this.normalized&&(t=pi(t,this.array)),this.array[e*this.itemSize]=Li(t),this}getY(e){let t=hc(this.array[e*this.itemSize+1]);return this.normalized&&(t=Ha(t,this.array)),t}setY(e,t){return this.normalized&&(t=pi(t,this.array)),this.array[e*this.itemSize+1]=Li(t),this}getZ(e){let t=hc(this.array[e*this.itemSize+2]);return this.normalized&&(t=Ha(t,this.array)),t}setZ(e,t){return this.normalized&&(t=pi(t,this.array)),this.array[e*this.itemSize+2]=Li(t),this}getW(e){let t=hc(this.array[e*this.itemSize+3]);return this.normalized&&(t=Ha(t,this.array)),t}setW(e,t){return this.normalized&&(t=pi(t,this.array)),this.array[e*this.itemSize+3]=Li(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=pi(t,this.array),n=pi(n,this.array)),this.array[e+0]=Li(t),this.array[e+1]=Li(n),this}setXYZ(e,t,n,r){return e*=this.itemSize,this.normalized&&(t=pi(t,this.array),n=pi(n,this.array),r=pi(r,this.array)),this.array[e+0]=Li(t),this.array[e+1]=Li(n),this.array[e+2]=Li(r),this}setXYZW(e,t,n,r,o){return e*=this.itemSize,this.normalized&&(t=pi(t,this.array),n=pi(n,this.array),r=pi(r,this.array),o=pi(o,this.array)),this.array[e+0]=Li(t),this.array[e+1]=Li(n),this.array[e+2]=Li(r),this.array[e+3]=Li(o),this}}class Je extends on{constructor(e,t,n){super(new Float32Array(e),t,n)}}const NT=new gi,ec=new O,O0=new O;class li{constructor(e=new O,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):NT.setFromPoints(e).getCenter(n);let r=0;for(let o=0,l=e.length;o<l;o++)r=Math.max(r,n.distanceToSquared(e[o]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ec.subVectors(e,this.center);const t=ec.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),r=(n-this.radius)*.5;this.center.addScaledVector(ec,r/n),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(O0.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ec.copy(e.center).add(O0)),this.expandByPoint(ec.copy(e.center).sub(O0))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let DT=0;const cs=new gt,B0=new Wt,Go=new O,Ji=new gi,tc=new gi,Jn=new O;class bt extends Bi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:DT++}),this.uuid=ms(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Ww(e)?lg:og)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const o=new _t().getNormalMatrix(e);n.applyNormalMatrix(o),n.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(e){return cs.makeRotationFromQuaternion(e),this.applyMatrix4(cs),this}rotateX(e){return cs.makeRotationX(e),this.applyMatrix4(cs),this}rotateY(e){return cs.makeRotationY(e),this.applyMatrix4(cs),this}rotateZ(e){return cs.makeRotationZ(e),this.applyMatrix4(cs),this}translate(e,t,n){return cs.makeTranslation(e,t,n),this.applyMatrix4(cs),this}scale(e,t,n){return cs.makeScale(e,t,n),this.applyMatrix4(cs),this}lookAt(e){return B0.lookAt(e),B0.updateMatrix(),this.applyMatrix4(B0.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Go).negate(),this.translate(Go.x,Go.y,Go.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let r=0,o=e.length;r<o;r++){const l=e[r];n.push(l.x,l.y,l.z||0)}this.setAttribute("position",new Je(n,3))}else{const n=Math.min(e.length,t.count);for(let r=0;r<n;r++){const o=e[r];t.setXYZ(r,o.x,o.y,o.z||0)}e.length>t.count&&Fe("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new gi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){it("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new O(-1/0,-1/0,-1/0),new O(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,r=t.length;n<r;n++){const o=t[n];Ji.setFromBufferAttribute(o),this.morphTargetsRelative?(Jn.addVectors(this.boundingBox.min,Ji.min),this.boundingBox.expandByPoint(Jn),Jn.addVectors(this.boundingBox.max,Ji.max),this.boundingBox.expandByPoint(Jn)):(this.boundingBox.expandByPoint(Ji.min),this.boundingBox.expandByPoint(Ji.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&it('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new li);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){it("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new O,1/0);return}if(e){const n=this.boundingSphere.center;if(Ji.setFromBufferAttribute(e),t)for(let o=0,l=t.length;o<l;o++){const c=t[o];tc.setFromBufferAttribute(c),this.morphTargetsRelative?(Jn.addVectors(Ji.min,tc.min),Ji.expandByPoint(Jn),Jn.addVectors(Ji.max,tc.max),Ji.expandByPoint(Jn)):(Ji.expandByPoint(tc.min),Ji.expandByPoint(tc.max))}Ji.getCenter(n);let r=0;for(let o=0,l=e.count;o<l;o++)Jn.fromBufferAttribute(e,o),r=Math.max(r,n.distanceToSquared(Jn));if(t)for(let o=0,l=t.length;o<l;o++){const c=t[o],h=this.morphTargetsRelative;for(let d=0,p=c.count;d<p;d++)Jn.fromBufferAttribute(c,d),h&&(Go.fromBufferAttribute(e,d),Jn.add(Go)),r=Math.max(r,n.distanceToSquared(Jn))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&it('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){it("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,r=t.normal,o=t.uv;let l=this.getAttribute("tangent");(l===void 0||l.count!==n.count)&&(l=new on(new Float32Array(4*n.count),4),this.setAttribute("tangent",l));const c=[],h=[],d=new Uint8Array(n.count);for(let F=0;F<n.count;F++)c[F]=new O,h[F]=new O;const p=new O,g=new O,v=new O,_=new ue,y=new ue,w=new ue,b=new O,S=new O;function M(F,D,B){d[F]=d[D]=d[B]=1,p.fromBufferAttribute(n,F),g.fromBufferAttribute(n,D),v.fromBufferAttribute(n,B),_.fromBufferAttribute(o,F),y.fromBufferAttribute(o,D),w.fromBufferAttribute(o,B),g.sub(p),v.sub(p),y.sub(_),w.sub(_);const W=1/(y.x*w.y-w.x*y.y);isFinite(W)&&(b.copy(g).multiplyScalar(w.y).addScaledVector(v,-y.y).multiplyScalar(W),S.copy(v).multiplyScalar(y.x).addScaledVector(g,-w.x).multiplyScalar(W),c[F].add(b),c[D].add(b),c[B].add(b),h[F].add(S),h[D].add(S),h[B].add(S))}let A=this.groups;A.length===0&&(A=[{start:0,count:e.count}]);for(let F=0,D=A.length;F<D;++F){const B=A[F],W=B.start,Z=B.count;for(let z=W,X=W+Z;z<X;z+=3)M(e.getX(z+0),e.getX(z+1),e.getX(z+2))}const E=new O,N=new O,P=new O,T=new O;function C(F){P.fromBufferAttribute(r,F),T.copy(P);const D=c[F];E.copy(D),E.sub(P.multiplyScalar(P.dot(D))).normalize(),N.crossVectors(T,D);const W=N.dot(h[F])<0?-1:1;l.setXYZW(F,E.x,E.y,E.z,W)}for(let F=0,D=n.count;F<D;++F)d[F]&&C(F);this._transformed=!0}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0||n.count!==t.count)n=new on(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let v=0,_=n.count;v<_;v++)n.setXYZ(v,0,0,0);const r=new O,o=new O,l=new O,c=new O,h=new O,d=new O,p=new O,g=new O;if(e)for(let v=0,_=e.count;v<_;v+=3){const y=e.getX(v+0),w=e.getX(v+1),b=e.getX(v+2);r.fromBufferAttribute(t,y),o.fromBufferAttribute(t,w),l.fromBufferAttribute(t,b),p.subVectors(l,o),g.subVectors(r,o),p.cross(g),c.fromBufferAttribute(n,y),h.fromBufferAttribute(n,w),d.fromBufferAttribute(n,b),c.add(p),h.add(p),d.add(p),n.setXYZ(y,c.x,c.y,c.z),n.setXYZ(w,h.x,h.y,h.z),n.setXYZ(b,d.x,d.y,d.z)}else for(let v=0,_=t.count;v<_;v+=3)r.fromBufferAttribute(t,v+0),o.fromBufferAttribute(t,v+1),l.fromBufferAttribute(t,v+2),p.subVectors(l,o),g.subVectors(r,o),p.cross(g),n.setXYZ(v+0,p.x,p.y,p.z),n.setXYZ(v+1,p.x,p.y,p.z),n.setXYZ(v+2,p.x,p.y,p.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Jn.fromBufferAttribute(e,t),Jn.normalize(),e.setXYZ(t,Jn.x,Jn.y,Jn.z)}toNonIndexed(){function e(c,h){const d=c.array,p=c.itemSize,g=c.normalized,v=new d.constructor(h.length*p);let _=0,y=0;for(let w=0,b=h.length;w<b;w++){c.isInterleavedBufferAttribute?_=h[w]*c.data.stride+c.offset:_=h[w]*p;for(let S=0;S<p;S++)v[y++]=d[_++]}return new on(v,p,g)}if(this.index===null)return Fe("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new bt,n=this.index.array,r=this.attributes;for(const c in r){const h=r[c],d=e(h,n);t.setAttribute(c,d)}const o=this.morphAttributes;for(const c in o){const h=[],d=o[c];for(let p=0,g=d.length;p<g;p++){const v=d[p],_=e(v,n);h.push(_)}t.morphAttributes[c]=h}t.morphTargetsRelative=this.morphTargetsRelative;const l=this.groups;for(let c=0,h=l.length;c<h;c++){const d=l[c];t.addGroup(d.start,d.count,d.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,e.name=this.name,Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const h=this.parameters;for(const d in h)h[d]!==void 0&&(e[d]=h[d]);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 h in n){const d=n[h];e.data.attributes[h]=d.toJSON(e.data)}const r={};let o=!1;for(const h in this.morphAttributes){const d=this.morphAttributes[h],p=[];for(let g=0,v=d.length;g<v;g++){const _=d[g];p.push(_.toJSON(e.data))}p.length>0&&(r[h]=p,o=!0)}o&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const l=this.groups;l.length>0&&(e.data.groups=JSON.parse(JSON.stringify(l)));const c=this.boundingSphere;return c!==null&&(e.data.boundingSphere=c.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const r=e.attributes;for(const d in r){const p=r[d];this.setAttribute(d,p.clone(t))}const o=e.morphAttributes;for(const d in o){const p=[],g=o[d];for(let v=0,_=g.length;v<_;v++)p.push(g[v].clone(t));this.morphAttributes[d]=p}this.morphTargetsRelative=e.morphTargetsRelative;const l=e.groups;for(let d=0,p=l.length;d<p;d++){const g=l[d];this.addGroup(g.start,g.count,g.materialIndex)}const c=e.boundingBox;c!==null&&(this.boundingBox=c.clone());const h=e.boundingSphere;return h!==null&&(this.boundingSphere=h.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this._transformed=e._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}class gd{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ud,this.updateRanges=[],this.version=0,this.uuid=ms()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,o=this.stride;r<o;r++)this.array[e+r]=t.array[n+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={});const t=V_(this.array);e.arrayBuffers[t]===void 0&&(e.arrayBuffers[t]=this.array.slice(0).buffer);const n=new this.array.constructor(e.arrayBuffers[t]),r=new this.constructor(n,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){e.arrayBuffers===void 0&&(e.arrayBuffers={});const t=V_(this.array);e.arrayBuffers[t]===void 0&&(e.arrayBuffers[t]=Array.from(new Uint32Array(this.array.slice(0).buffer)));const n={uuid:this.uuid,buffer:t,type:this.array.constructor.name,stride:this.stride};return n.usage=this.usage,n}}function V_(i){return i.buffer._uuid===void 0&&(i.buffer._uuid=ms()),i.byteOffset===0&&i.byteLength===i.buffer.byteLength?i.buffer._uuid:i.buffer._uuid+":"+i.byteOffset+":"+i.byteLength}const Si=new O;class Ya{constructor(e,t,n,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=r,this._normalizationScale=e!==void 0?hd(e.array):void 0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)Si.fromBufferAttribute(this,t),Si.applyMatrix4(e),this.setXYZ(t,Si.x,Si.y,Si.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Si.fromBufferAttribute(this,t),Si.applyNormalMatrix(e),this.setXYZ(t,Si.x,Si.y,Si.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Si.fromBufferAttribute(this,t),Si.transformDirection(e),this.setXYZ(t,Si.x,Si.y,Si.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=this._denormalize(n)),n}setComponent(e,t,n){return this.normalized&&(n=this._normalize(n)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=this._normalize(t)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=this._normalize(t)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=this._normalize(t)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=this._normalize(t)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=this._denormalize(t)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=this._denormalize(t)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=this._denormalize(t)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=this._denormalize(t)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=this._normalize(t),n=this._normalize(n)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=this._normalize(t),n=this._normalize(n),r=this._normalize(r)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this}setXYZW(e,t,n,r,o){return e=e*this.data.stride+this.offset,this.normalized&&(t=this._normalize(t),n=this._normalize(n),r=this._normalize(r),o=this._normalize(o)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=r,this.data.array[e+3]=o,this}clone(e){if(e===void 0){zc("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)t.push(this.data.array[r+o])}return new on(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Ya(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){zc("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const r=n*this.data.stride+this.offset;for(let o=0;o<this.itemSize;o++)t.push(this.data.array[r+o])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}_denormalize(e){const t=this._normalizationScale;return t!==void 0?Math.max(e/t,-1):Ha(e,this.data.array)}_normalize(e){const t=this._normalizationScale;return t!==void 0?Math.round(e*t):pi(e,this.data.array)}}const z0=new O,UT=new O,FT=new _t;class gr{constructor(e=new O(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,r){return this.normal.set(e,t,n),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const r=z0.subVectors(n,t).cross(UT.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t,n=!0){const r=e.delta(z0),o=this.normal.dot(r);if(o===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const l=-(e.start.dot(this.normal)+this.constant)/o;return n===!0&&(l<0||l>1)?null:t.copy(e.start).addScaledVector(r,l)}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||FT.getNormalMatrix(e),r=this.coplanarPoint(z0).applyMatrix4(e),o=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(o),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)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(e){return this.normal.fromArray(e.normal),this.constant=e.constant,this}}let OT=0;class Gn extends Bi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:OT++}),this.uuid=ms(),this.name="",this.type="Material",this.blending=ll,this.side=Sr,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=km,this.blendDst=Hm,this.blendEquation=Fa,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Ge(0,0,0),this.blendAlpha=0,this.depthFunc=hl,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=p3,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ef,this.stencilZFail=ef,this.stencilZPass=ef,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Fe(`Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){Fe(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector2&&n&&n.isVector2||r&&r.isEuler&&n&&n.isEuler||r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,n.blending=this.blending,n.side=this.side,n.shadowSide=this.shadowSide,n.vertexColors=this.vertexColors,n.opacity=this.opacity,n.transparent=this.transparent,n.blendSrc=this.blendSrc,n.blendDst=this.blendDst,n.blendEquation=this.blendEquation,n.blendSrcAlpha=this.blendSrcAlpha,n.blendDstAlpha=this.blendDstAlpha,n.blendEquationAlpha=this.blendEquationAlpha,n.blendColor=this.blendColor.getHex(),n.blendAlpha=this.blendAlpha,n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.clipIntersection=this.clipIntersection,n.clipShadows=this.clipShadows,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,n.stencilWrite=this.stencilWrite,n.polygonOffset=this.polygonOffset,n.polygonOffsetFactor=this.polygonOffsetFactor,n.polygonOffsetUnits=this.polygonOffsetUnits,n.dithering=this.dithering,n.alphaTest=this.alphaTest,n.alphaHash=this.alphaHash,n.alphaToCoverage=this.alphaToCoverage,n.premultipliedAlpha=this.premultipliedAlpha,n.forceSinglePass=this.forceSinglePass,n.allowOverride=this.allowOverride,n.visible=this.visible,n.toneMapped=this.toneMapped,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&&(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.diffuseRoughness!==void 0&&(n.diffuseRoughness=this.diffuseRoughness),this.diffuseRoughnessMap&&this.diffuseRoughnessMap.isTexture&&(n.diffuseRoughnessMap=this.diffuseRoughnessMap.toJSON(e).uuid),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.retroreflectivity!==void 0&&(n.retroreflectivity=this.retroreflectivity),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessMinimum!==void 0&&(n.iridescenceThicknessMinimum=this.iridescenceThicknessMinimum),this.iridescenceThicknessMaximum!==void 0&&(n.iridescenceThicknessMaximum=this.iridescenceThicknessMaximum),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&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),Array.isArray(this.clippingPlanes)&&this.clippingPlanes.length>0&&(n.clippingPlanes=this.clippingPlanes.map(o=>o.toJSON())),this.rotation!==void 0&&(n.rotation=this.rotation),this.depthPacking!==void 0&&(n.depthPacking=this.depthPacking),this.linewidth!==void 0&&(n.linewidth=this.linewidth),this.linecap!==void 0&&(n.linecap=this.linecap),this.linejoin!==void 0&&(n.linejoin=this.linejoin),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.wireframe!==void 0&&(n.wireframe=this.wireframe),this.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==void 0&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading!==void 0&&(n.flatShading=this.flatShading),this.fog!==void 0&&(n.fog=this.fog),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(o){const l=[];for(const c in o){const h=o[c];delete h.metadata,l.push(h)}return l}if(t){const o=r(e.textures),l=r(e.images);o.length>0&&(n.textures=o),l.length>0&&(n.images=l)}return n}fromJSON(e,t){if(e.uuid!==void 0&&(this.uuid=e.uuid),e.name!==void 0&&(this.name=e.name),e.color!==void 0&&this.color!==void 0&&this.color.setHex(e.color),e.roughness!==void 0&&(this.roughness=e.roughness),e.metalness!==void 0&&(this.metalness=e.metalness),e.sheen!==void 0&&(this.sheen=e.sheen),e.sheenColor!==void 0&&(this.sheenColor=new Ge().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(this.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&this.emissive!==void 0&&this.emissive.setHex(e.emissive),e.specular!==void 0&&this.specular!==void 0&&this.specular.setHex(e.specular),e.specularIntensity!==void 0&&(this.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&this.specularColor!==void 0&&this.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(this.shininess=e.shininess),e.clearcoat!==void 0&&(this.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(this.clearcoatRoughness=e.clearcoatRoughness),e.diffuseRoughness!==void 0&&(this.diffuseRoughness=e.diffuseRoughness),e.dispersion!==void 0&&(this.dispersion=e.dispersion),e.retroreflectivity!==void 0&&(this.retroreflectivity=e.retroreflectivity),e.iridescence!==void 0&&(this.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(this.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessMinimum!==void 0&&(this.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum),e.iridescenceThicknessMaximum!==void 0&&(this.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum),e.iridescenceThicknessRange!==void 0&&(this.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],this.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1]),e.transmission!==void 0&&(this.transmission=e.transmission),e.thickness!==void 0&&(this.thickness=e.thickness),e.attenuationDistance!==void 0&&(this.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&this.attenuationColor!==void 0&&this.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(this.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(this.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(this.fog=e.fog),e.flatShading!==void 0&&(this.flatShading=e.flatShading),e.blending!==void 0&&(this.blending=e.blending),e.combine!==void 0&&(this.combine=e.combine),e.side!==void 0&&(this.side=e.side),e.shadowSide!==void 0&&(this.shadowSide=e.shadowSide),e.opacity!==void 0&&(this.opacity=e.opacity),e.transparent!==void 0&&(this.transparent=e.transparent),e.alphaTest!==void 0&&(this.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(this.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(this.depthFunc=e.depthFunc),e.depthTest!==void 0&&(this.depthTest=e.depthTest),e.depthWrite!==void 0&&(this.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(this.colorWrite=e.colorWrite),e.clippingPlanes!==void 0&&(this.clippingPlanes=e.clippingPlanes.map(n=>new gr().fromJSON(n))),e.clipIntersection!==void 0&&(this.clipIntersection=e.clipIntersection),e.clipShadows!==void 0&&(this.clipShadows=e.clipShadows),e.depthPacking!==void 0&&(this.depthPacking=e.depthPacking),e.blendSrc!==void 0&&(this.blendSrc=e.blendSrc),e.blendDst!==void 0&&(this.blendDst=e.blendDst),e.blendEquation!==void 0&&(this.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(this.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(this.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(this.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&this.blendColor!==void 0&&this.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(this.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(this.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(this.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(this.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(this.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(this.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(this.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(this.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(this.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(this.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(this.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(this.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(this.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(this.rotation=e.rotation),e.linewidth!==void 0&&(this.linewidth=e.linewidth),e.linecap!==void 0&&(this.linecap=e.linecap),e.linejoin!==void 0&&(this.linejoin=e.linejoin),e.dashSize!==void 0&&(this.dashSize=e.dashSize),e.gapSize!==void 0&&(this.gapSize=e.gapSize),e.scale!==void 0&&(this.scale=e.scale),e.polygonOffset!==void 0&&(this.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(this.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(this.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(this.dithering=e.dithering),e.alphaToCoverage!==void 0&&(this.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(this.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(this.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(this.allowOverride=e.allowOverride),e.visible!==void 0&&(this.visible=e.visible),e.toneMapped!==void 0&&(this.toneMapped=e.toneMapped),e.userData!==void 0&&(this.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?this.vertexColors=e.vertexColors>0:this.vertexColors=e.vertexColors),e.size!==void 0&&(this.size=e.size),e.sizeAttenuation!==void 0&&(this.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(this.map=t[e.map]||null),e.matcap!==void 0&&(this.matcap=t[e.matcap]||null),e.alphaMap!==void 0&&(this.alphaMap=t[e.alphaMap]||null),e.bumpMap!==void 0&&(this.bumpMap=t[e.bumpMap]||null),e.bumpScale!==void 0&&(this.bumpScale=e.bumpScale),e.normalMap!==void 0&&(this.normalMap=t[e.normalMap]||null),e.normalMapType!==void 0&&(this.normalMapType=e.normalMapType),e.normalScale!==void 0){let n=e.normalScale;Array.isArray(n)===!1&&(n=[n,n]),this.normalScale=new ue().fromArray(n)}return e.displacementMap!==void 0&&(this.displacementMap=t[e.displacementMap]||null),e.displacementScale!==void 0&&(this.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(this.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(this.roughnessMap=t[e.roughnessMap]||null),e.metalnessMap!==void 0&&(this.metalnessMap=t[e.metalnessMap]||null),e.emissiveMap!==void 0&&(this.emissiveMap=t[e.emissiveMap]||null),e.emissiveIntensity!==void 0&&(this.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(this.specularMap=t[e.specularMap]||null),e.specularIntensityMap!==void 0&&(this.specularIntensityMap=t[e.specularIntensityMap]||null),e.specularColorMap!==void 0&&(this.specularColorMap=t[e.specularColorMap]||null),e.envMap!==void 0&&(this.envMap=t[e.envMap]||null),e.envMapRotation!==void 0&&this.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(this.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(this.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(this.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(this.lightMap=t[e.lightMap]||null),e.lightMapIntensity!==void 0&&(this.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(this.aoMap=t[e.aoMap]||null),e.aoMapIntensity!==void 0&&(this.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(this.gradientMap=t[e.gradientMap]||null),e.clearcoatMap!==void 0&&(this.clearcoatMap=t[e.clearcoatMap]||null),e.clearcoatRoughnessMap!==void 0&&(this.clearcoatRoughnessMap=t[e.clearcoatRoughnessMap]||null),e.clearcoatNormalMap!==void 0&&(this.clearcoatNormalMap=t[e.clearcoatNormalMap]||null),e.clearcoatNormalScale!==void 0&&(this.clearcoatNormalScale=new ue().fromArray(e.clearcoatNormalScale)),e.diffuseRoughnessMap!==void 0&&(this.diffuseRoughnessMap=t[e.diffuseRoughnessMap]||null),e.iridescenceMap!==void 0&&(this.iridescenceMap=t[e.iridescenceMap]||null),e.iridescenceThicknessMap!==void 0&&(this.iridescenceThicknessMap=t[e.iridescenceThicknessMap]||null),e.transmissionMap!==void 0&&(this.transmissionMap=t[e.transmissionMap]||null),e.thicknessMap!==void 0&&(this.thicknessMap=t[e.thicknessMap]||null),e.anisotropyMap!==void 0&&(this.anisotropyMap=t[e.anisotropyMap]||null),e.sheenColorMap!==void 0&&(this.sheenColorMap=t[e.sheenColorMap]||null),e.sheenRoughnessMap!==void 0&&(this.sheenRoughnessMap=t[e.sheenRoughnessMap]||null),this}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 r=t.length;n=new Array(r);for(let o=0;o!==r;++o)n[o]=t[o].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class cg extends Gn{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Ge(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Wo;const nc=new O,Xo=new O,qo=new O,$o=new ue,ic=new ue,E3=new gt,fh=new O,sc=new O,dh=new O,G_=new ue,k0=new ue,W_=new ue;class A3 extends Wt{constructor(e=new cg){if(super(),this.isSprite=!0,this.type="Sprite",Wo===void 0){Wo=new bt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new gd(t,5);Wo.setIndex([0,1,2,0,2,3]),Wo.setAttribute("position",new Ya(n,3,0,!1)),Wo.setAttribute("uv",new Ya(n,2,3,!1))}this.geometry=Wo,this.material=e,this.center=new ue(.5,.5),this.count=1}intersectsFrustum(e){return e.intersectsSprite(this)}raycast(e,t){e.camera===null&&it('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Xo.setFromMatrixScale(this.matrixWorld),E3.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),qo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Xo.multiplyScalar(-qo.z);const n=this.material.rotation;let r,o;n!==0&&(o=Math.cos(n),r=Math.sin(n));const l=this.center;ph(fh.set(-.5,-.5,0),qo,l,Xo,r,o),ph(sc.set(.5,-.5,0),qo,l,Xo,r,o),ph(dh.set(.5,.5,0),qo,l,Xo,r,o),G_.set(0,0),k0.set(1,0),W_.set(1,1);let c=e.ray.intersectTriangle(fh,sc,dh,!1,nc);if(c===null&&(ph(sc.set(-.5,.5,0),qo,l,Xo,r,o),k0.set(0,1),c=e.ray.intersectTriangle(fh,dh,sc,!1,nc),c===null))return;const h=e.ray.origin.distanceTo(nc);h<e.near||h>e.far||t.push({distance:h,point:nc.clone(),uv:Ui.getInterpolation(nc,fh,sc,dh,G_,k0,W_,new ue),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}toJSON(e){const t=super.toJSON(e);return t.object.center=this.center.toArray(),t}}function ph(i,e,t,n,r,o){$o.subVectors(i,t).addScalar(.5).multiply(n),r!==void 0?(ic.x=o*$o.x-r*$o.y,ic.y=r*$o.x+o*$o.y):ic.copy($o),i.copy(e),i.x+=ic.x,i.y+=ic.y,i.applyMatrix4(E3)}const mh=new O,X_=new O;class C3 extends Wt{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,r=t.length;n<r;n++){const o=t[n];this.addLevel(o.object.clone(),o.distance,o.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const r=this.levels;let o;for(o=0;o<r.length&&!(t<r[o].distance);o++);return r.splice(o,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const r=t.splice(n,1);return this.remove(r[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,r;for(n=1,r=t.length;n<r;n++){let o=t[n].distance;if(t[n].object.visible&&(o-=o*t[n].hysteresis),e<o)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){mh.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(mh);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){mh.setFromMatrixPosition(e.matrixWorld),X_.setFromMatrixPosition(this.matrixWorld);const n=mh.distanceTo(X_)/e.zoom;t[0].object.visible=!0;let r,o;for(r=1,o=t.length;r<o;r++){let l=t[r].distance;if(t[r].object.visible&&(l-=l*t[r].hysteresis),n>=l)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<o;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);t.object.autoUpdate=this.autoUpdate,t.object.levels=[];const n=this.levels;for(let r=0,o=n.length;r<o;r++){const l=n[r];t.object.levels.push({object:l.object.uuid,distance:l.distance,hysteresis:l.hysteresis})}return t}}const pr=new O,H0=new O,gh=new O,vh=new O;class xl{constructor(e=new O,t=new O(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,pr)),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=pr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(pr.copy(this.origin).addScaledVector(this.direction,t),pr.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){H0.copy(e).add(t).multiplyScalar(.5),gh.copy(t).sub(e).normalize(),vh.copy(this.origin).sub(H0);const o=e.distanceTo(t)*.5,l=-this.direction.dot(gh),c=vh.dot(this.direction),h=-vh.dot(gh),d=vh.lengthSq(),p=Math.abs(1-l*l);let g,v,_,y;if(p>0)if(g=l*h-c,v=l*c-h,y=o*p,g>=0)if(v>=-y)if(v<=y){const w=1/p;g*=w,v*=w,_=g*(g+l*v+2*c)+v*(l*g+v+2*h)+d}else v=o,g=Math.max(0,-(l*v+c)),_=-g*g+v*(v+2*h)+d;else v=-o,g=Math.max(0,-(l*v+c)),_=-g*g+v*(v+2*h)+d;else v<=-y?(g=Math.max(0,-(-l*o+c)),v=g>0?-o:Math.min(Math.max(-o,-h),o),_=-g*g+v*(v+2*h)+d):v<=y?(g=0,v=Math.min(Math.max(-o,-h),o),_=v*(v+2*h)+d):(g=Math.max(0,-(l*o+c)),v=g>0?o:Math.min(Math.max(-o,-h),o),_=-g*g+v*(v+2*h)+d);else v=l>0?-o:o,g=Math.max(0,-(l*v+c)),_=-g*g+v*(v+2*h)+d;return n&&n.copy(this.origin).addScaledVector(this.direction,g),r&&r.copy(H0).addScaledVector(gh,v),_}intersectSphere(e,t){if(e.radius<0)return null;pr.subVectors(e.center,this.origin);const n=pr.dot(this.direction),r=pr.dot(pr)-n*n,o=e.radius*e.radius;if(r>o)return null;const l=Math.sqrt(o-r),c=n-l,h=n+l;return h<0?null:c<0?this.at(h,t):this.at(c,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const 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,r,o,l,c,h;const d=1/this.direction.x,p=1/this.direction.y,g=1/this.direction.z,v=this.origin;return d>=0?(n=(e.min.x-v.x)*d,r=(e.max.x-v.x)*d):(n=(e.max.x-v.x)*d,r=(e.min.x-v.x)*d),p>=0?(o=(e.min.y-v.y)*p,l=(e.max.y-v.y)*p):(o=(e.max.y-v.y)*p,l=(e.min.y-v.y)*p),n>l||o>r||((o>n||isNaN(n))&&(n=o),(l<r||isNaN(r))&&(r=l),g>=0?(c=(e.min.z-v.z)*g,h=(e.max.z-v.z)*g):(c=(e.max.z-v.z)*g,h=(e.min.z-v.z)*g),n>h||c>r)||((c>n||n!==n)&&(n=c),(h<r||r!==r)&&(r=h),r<0)?null:this.at(n>=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,pr)!==null}intersectTriangle(e,t,n,r,o){const l=this.origin,c=this.direction,h=c.x,d=c.y,p=c.z,g=e.x-l.x,v=e.y-l.y,_=e.z-l.z,y=t.x-l.x,w=t.y-l.y,b=t.z-l.z,S=n.x-l.x,M=n.y-l.y,A=n.z-l.z,E=Math.abs(h),N=Math.abs(d),P=Math.abs(p);let T,C,F,D,B,W,Z,z,X,Q,q,fe;if(E>=N&&E>=P?(F=h,W=g,X=y,fe=S,h>=0?(T=d,C=p,D=v,B=_,Z=w,z=b,Q=M,q=A):(T=p,C=d,D=_,B=v,Z=b,z=w,Q=A,q=M)):N>=P?(F=d,W=v,X=w,fe=M,d>=0?(T=p,C=h,D=_,B=g,Z=b,z=y,Q=A,q=S):(T=h,C=p,D=g,B=_,Z=y,z=b,Q=S,q=A)):(F=p,W=_,X=b,fe=A,p>=0?(T=h,C=d,D=g,B=v,Z=y,z=w,Q=S,q=M):(T=d,C=h,D=v,B=g,Z=w,z=y,Q=M,q=S)),F===0)return null;const Y=T/F,he=C/F,pe=1/F,We=D-Y*W,qe=B-he*W,ie=Z-Y*X,xe=z-he*X,Be=Q-Y*fe,et=q-he*fe,Ce=Be*xe-et*ie,tt=We*et-qe*Be,kt=ie*qe-xe*We;if(r){if(Ce<0||tt<0||kt<0)return null}else if((Ce<0||tt<0||kt<0)&&(Ce>0||tt>0||kt>0))return null;const at=Ce+tt+kt;if(at===0)return null;const yt=pe*(Ce*W+tt*X+kt*fe);return(at>0?yt<0:yt>0)?null:this.at(yt/at,o)}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 Ja extends Gn{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Ge(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 Ns,this.combine=Jc,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 q_=new gt,Aa=new xl,_h=new li,$_=new O,xh=new O,yh=new O,Sh=new O,V0=new O,bh=new O,Y_=new O,Mh=new O;class Wn extends Wt{constructor(e=new bt,t=new Ja){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0?this.morphTargetInfluences=e.morphTargetInfluences.slice():this.morphTargetInfluences=void 0,e.morphTargetDictionary!==void 0?this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary):this.morphTargetDictionary=void 0,this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=r.length;o<l;o++){const c=r[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=o}}}}getVertexPosition(e,t){const n=this.geometry,r=n.attributes.position,o=n.morphAttributes.position,l=n.morphTargetsRelative;t.fromBufferAttribute(r,e);const c=this.morphTargetInfluences;if(o&&c){bh.set(0,0,0);for(let h=0,d=o.length;h<d;h++){const p=c[h],g=o[h];p!==0&&(V0.fromBufferAttribute(g,e),l?bh.addScaledVector(V0,p):bh.addScaledVector(V0.sub(t),p))}t.add(bh)}return t}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){const n=this.geometry,r=this.material,o=this.matrixWorld;r!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),_h.copy(n.boundingSphere),_h.applyMatrix4(o),Aa.copy(e.ray).recast(e.near),!(_h.containsPoint(Aa.origin)===!1&&(Aa.intersectSphere(_h,$_)===null||Aa.origin.distanceToSquared($_)>(e.far-e.near)**2))&&(q_.copy(o).invert(),Aa.copy(e.ray).applyMatrix4(q_),!(n.boundingBox!==null&&Aa.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Aa)))}_computeIntersections(e,t,n){let r;const o=this.geometry,l=this.material,c=o.index,h=o.attributes.position,d=o.attributes.uv,p=o.attributes.uv1,g=o.attributes.normal,v=o.groups,_=o.drawRange;if(c!==null)if(Array.isArray(l))for(let y=0,w=v.length;y<w;y++){const b=v[y],S=l[b.materialIndex],M=Math.max(b.start,_.start),A=Math.min(c.count,Math.min(b.start+b.count,_.start+_.count));for(let E=M,N=A;E<N;E+=3){const P=c.getX(E),T=c.getX(E+1),C=c.getX(E+2);r=wh(this,S,e,n,d,p,g,P,T,C),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=b.materialIndex,t.push(r))}}else{const y=Math.max(0,_.start),w=Math.min(c.count,_.start+_.count);for(let b=y,S=w;b<S;b+=3){const M=c.getX(b),A=c.getX(b+1),E=c.getX(b+2);r=wh(this,l,e,n,d,p,g,M,A,E),r&&(r.faceIndex=Math.floor(b/3),t.push(r))}}else if(h!==void 0)if(Array.isArray(l))for(let y=0,w=v.length;y<w;y++){const b=v[y],S=l[b.materialIndex],M=Math.max(b.start,_.start),A=Math.min(h.count,Math.min(b.start+b.count,_.start+_.count));for(let E=M,N=A;E<N;E+=3){const P=E,T=E+1,C=E+2;r=wh(this,S,e,n,d,p,g,P,T,C),r&&(r.faceIndex=Math.floor(E/3),r.face.materialIndex=b.materialIndex,t.push(r))}}else{const y=Math.max(0,_.start),w=Math.min(h.count,_.start+_.count);for(let b=y,S=w;b<S;b+=3){const M=b,A=b+1,E=b+2;r=wh(this,l,e,n,d,p,g,M,A,E),r&&(r.faceIndex=Math.floor(b/3),t.push(r))}}}}function BT(i,e,t,n,r,o,l,c){let h;if(e.side===Vn?h=n.intersectTriangle(l,o,r,!0,c):h=n.intersectTriangle(r,o,l,e.side===Sr,c),h===null)return null;Mh.copy(c),Mh.applyMatrix4(i.matrixWorld);const d=t.ray.origin.distanceTo(Mh);return d<t.near||d>t.far?null:{distance:d,point:Mh.clone(),object:i}}function wh(i,e,t,n,r,o,l,c,h,d){i.getVertexPosition(c,xh),i.getVertexPosition(h,yh),i.getVertexPosition(d,Sh);const p=BT(i,e,t,n,xh,yh,Sh,Y_);if(p){const g=new O;Ui.getBarycoord(Y_,xh,yh,Sh,g),r&&(p.uv=Ui.getInterpolatedAttribute(r,c,h,d,g,new ue)),o&&(p.uv1=Ui.getInterpolatedAttribute(o,c,h,d,g,new ue)),l&&(p.normal=Ui.getInterpolatedAttribute(l,c,h,d,g,new O),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));const v={a:c,b:h,c:d,normal:new O,materialIndex:0};Ui.getNormal(xh,yh,Sh,v.normal),p.face=v,p.barycoord=g}return p}const rc=new Kt,Z_=new Kt,j_=new Kt,zT=new Kt,J_=new gt,Th=new O,G0=new li,K_=new gt,W0=new xl;class R3 extends Wn{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=bm,this.bindMatrix=new gt,this.bindMatrixInverse=new gt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new gi),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Th),this.boundingBox.expandByPoint(Th)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new li),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,Th),this.boundingSphere.expandByPoint(Th)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this}raycast(e,t){const n=this.material,r=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),G0.copy(this.boundingSphere),G0.applyMatrix4(r),e.ray.intersectsSphere(G0)!==!1&&(K_.copy(r).invert(),W0.copy(e.ray).applyMatrix4(K_),!(this.boundingBox!==null&&W0.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,W0)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Kt,t=this.geometry.attributes.skinWeight;for(let n=0,r=t.count;n<r;n++){e.fromBufferAttribute(t,n);const o=1/e.manhattanLength();o!==1/0?e.multiplyScalar(o):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===bm?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===c3?this.bindMatrixInverse.copy(this.bindMatrix).invert():Fe("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,r=this.geometry;Z_.fromBufferAttribute(r.attributes.skinIndex,e),j_.fromBufferAttribute(r.attributes.skinWeight,e),t.isVector4?(rc.copy(t),t.set(0,0,0,0)):(rc.set(t.x,t.y,t.z,1),t.set(0,0,0)),rc.applyMatrix4(this.bindMatrix);for(let o=0;o<4;o++){const l=j_.getComponent(o);if(l!==0){const c=Z_.getComponent(o);J_.multiplyMatrices(n.bones[c].matrixWorld,n.boneInverses[c]),t.addScaledVector(zT.copy(rc).applyMatrix4(J_),l)}}return t.isVector4&&(t.w=rc.w),t.applyMatrix4(this.bindMatrixInverse)}}class ug extends Wt{constructor(){super(),this.isBone=!0,this.type="Bone"}}class fs extends pn{constructor(e=null,t=1,n=1,r,o,l,c,h,d=dn,p=dn,g,v){super(null,l,c,h,d,p,r,o,g,v),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Q_=new gt,kT=new gt;class vd{constructor(e=[],t=[]){this.uuid=ms(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.previousBoneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){Fe("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,r=this.bones.length;n<r;n++)this.boneInverses.push(new gt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new gt;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,r=this.boneTexture;for(let o=0,l=e.length;o<l;o++){const c=e[o]?e[o].matrixWorld:kT;Q_.multiplyMatrices(c,t[o]),Q_.toArray(n,o*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new vd(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new fs(t,e,e,Mi,oi);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null),this.previousBoneTexture!==null&&(this.previousBoneTexture.dispose(),this.previousBoneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,r=e.bones.length;n<r;n++){const o=e.bones[n];let l=t[o];l===void 0&&(Fe("Skeleton: No bone found with UUID:",o),l=new ug),this.bones.push(l),this.boneInverses.push(new gt().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let r=0,o=t.length;r<o;r++){const l=t[r];e.bones.push(l.uuid);const c=n[r];e.boneInverses.push(c.toArray())}return e}}class ml extends on{constructor(e,t,n,r=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Yo=new gt,ex=new gt,Eh=[],tx=new gi,HT=new gt,ac=new Wn,oc=new li;class I3 extends Wn{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new ml(new Float32Array(n*16),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<n;r++)this.setMatrixAt(r,HT)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new gi),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Yo),tx.copy(e.boundingBox).applyMatrix4(Yo),this.boundingBox.union(tx)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new li),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Yo),oc.copy(e.boundingSphere).applyMatrix4(Yo),this.boundingSphere.union(oc)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),this.morphTexture=e.morphTexture!==null?e.morphTexture.clone():null,this.instanceColor=e.instanceColor!==null?e.instanceColor.clone():null,this.count=e.count,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,r=this.morphTexture.source.data.data,o=n.length+1,l=e*o+1;for(let c=0;c<n.length;c++)n[c]=r[l+c]}raycast(e,t){const n=this.matrixWorld,r=this.count;if(ac.geometry=this.geometry,ac.material=this.material,ac.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),oc.copy(this.boundingSphere),oc.applyMatrix4(n),e.ray.intersectsSphere(oc)!==!1))for(let o=0;o<r;o++){this.getMatrixAt(o,Yo),ex.multiplyMatrices(n,Yo),ac.matrixWorld=ex,ac.raycast(e,Eh);for(let l=0,c=Eh.length;l<c;l++){const h=Eh[l];h.instanceId=o,h.object=this,t.push(h)}Eh.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new ml(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){const n=t.morphTargetInfluences,r=n.length+1;this.morphTexture===null&&(this.morphTexture=new fs(new Float32Array(r*this.count),r,this.count,ad,oi));const o=this.morphTexture.source.data.data;let l=0;for(let d=0;d<n.length;d++)l+=n[d];const c=this.geometry.morphTargetsRelative?1:1-l,h=r*e;return o[h]=c,o.set(n,h+1),this}updateMorphTargets(){}dispose(){super.dispose(),this.instanceMatrix.dispose(),this.instanceColor!==null&&this.instanceColor.dispose(),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Ca=new li,VT=new ue(.5,.5),Ah=new O;class Za{constructor(e=new gr,t=new gr,n=new gr,r=new gr,o=new gr,l=new gr){this.planes=[e,t,n,r,o,l]}set(e,t,n,r,o,l){const c=this.planes;return c[0].copy(e),c[1].copy(t),c[2].copy(n),c[3].copy(r),c[4].copy(o),c[5].copy(l),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=Ki,n=!1){const r=this.planes,o=e.elements,l=o[0],c=o[1],h=o[2],d=o[3],p=o[4],g=o[5],v=o[6],_=o[7],y=o[8],w=o[9],b=o[10],S=o[11],M=o[12],A=o[13],E=o[14],N=o[15];if(r[0].setComponents(d-l,_-p,S-y,N-M).normalize(),r[1].setComponents(d+l,_+p,S+y,N+M).normalize(),r[2].setComponents(d+c,_+g,S+w,N+A).normalize(),r[3].setComponents(d-c,_-g,S-w,N-A).normalize(),n)r[4].setComponents(h,v,b,E).normalize(),r[5].setComponents(d-h,_-v,S-b,N-E).normalize();else if(r[4].setComponents(d-h,_-v,S-b,N-E).normalize(),t===Ki)r[5].setComponents(d+h,_+v,S+b,N+E).normalize();else if(t===$a)r[5].setComponents(h,v,b,E).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ca.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ca.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ca)}intersectsSprite(e){Ca.center.set(0,0,0);const t=VT.distanceTo(e.center);return Ca.radius=.7071067811865476+t,Ca.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ca)}intersectsSphere(e){const t=this.planes,n=e.center,r=-e.radius;for(let o=0;o<6;o++)if(t[o].distanceToPoint(n)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const r=t[n];if(Ah.x=r.normal.x>0?e.max.x:e.min.x,Ah.y=r.normal.y>0?e.max.y:e.min.y,Ah.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Ah)<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)}}const nx=new gt;class Qc{constructor(){this.coordinateSystem=Ki,this._frustums=[],this._count=0}setFromArrayCamera(e){const t=e.cameras,n=this._frustums;for(let r=0;r<t.length;r++){const o=t[r];nx.multiplyMatrices(o.projectionMatrix,o.matrixWorldInverse),n[r]===void 0&&(n[r]=new Za),n[r].setFromProjectionMatrix(nx,o.coordinateSystem,o.reversedDepth)}return this._count=t.length,this}getFrustum(e){return this._frustums[e]}intersectsObject(e){const t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsObject(e))return!0;return!1}intersectsSprite(e){const t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSprite(e))return!0;return!1}intersectsSphere(e){const t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsSphere(e))return!0;return!1}intersectsBox(e){const t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].intersectsBox(e))return!0;return!1}containsPoint(e){const t=this._frustums;for(let n=0;n<this._count;n++)if(t[n].containsPoint(e))return!0;return!1}copy(e){this.coordinateSystem=e.coordinateSystem;const t=this._frustums,n=e._frustums;for(let r=0;r<e._count;r++)t[r]===void 0&&(t[r]=new Za),t[r].copy(n[r]);return this._count=e._count,this}clone(){return new Qc().copy(this)}}function X0(i,e){return i-e}function GT(i,e){return i.z-e.z}function WT(i,e){return e.z-i.z}class XT{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,r){const o=this.pool,l=this.list;this.index>=o.length&&o.push({start:-1,count:-1,z:-1,index:-1});const c=o[this.index];l.push(c),this.index++,c.start=e,c.count=t,c.z=n,c.index=r}reset(){this.list.length=0,this.index=0}}const Pi=new gt,qT=new Ge(1,1,1),$T=new Za,YT=new Qc,Ch=new gi,Ra=new li,q0=new O,ix=new O,sx=new O,ZT=new O,$0=new XT,di=new Wn,Rh=[];function jT(i,e,t=0){const n=e.itemSize;if(i.isInterleavedBufferAttribute||i.array.constructor!==e.array.constructor){const r=i.count;for(let o=0;o<r;o++)for(let l=0;l<n;l++)e.setComponent(o+t,l,i.getComponent(o,l))}else e.array.set(i.array,t*n);e.needsUpdate=!0}function qs(i,e){if(i.constructor!==e.constructor){const t=Math.min(i.length,e.length);for(let n=0;n<t;n++)e[n]=i[n]}else{const t=Math.min(i.length,e.length);e.set(new i.constructor(i.buffer,0,t))}}class P3 extends Wn{constructor(e,t,n=t*2,r){super(new bt,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawBytesPerElement=1,this._mergedDrawCounts=new Int32Array(e),this._mergedDrawStarts=new Int32Array(e),this._mergedDrawInstanceCounts=new Int32Array(e),this._mergedDrawCount=0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._previousMatricesTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new fs(t,e,e,Mi,oi);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new fs(t,e,e,Kc,ds);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new fs(t,e,e,Mi,oi);n.colorSpace=Lt.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,r=this._maxIndexCount;if(this._geometryInitialized===!1){for(const o in e.attributes){const l=e.getAttribute(o),{array:c,itemSize:h,normalized:d}=l,p=new c.constructor(n*h),g=new on(p,h,d);t.setAttribute(o,g)}if(e.getIndex()!==null){const o=n>65535?new Uint32Array(r):new Uint16Array(r);t.setIndex(new on(o,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const r=e.getAttribute(n),o=t.getAttribute(n);if(r.itemSize!==o.itemSize||r.normalized!==o.normalized)throw new Error(`THREE.BatchedMesh: Added geometry attribute "${n}" has an inconsistent itemSize or normalized value.`)}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new gi);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;const o=t[n].geometryIndex;this.getMatrixAt(n,Pi),this.getBoundingBoxAt(o,Ch).applyMatrix4(Pi),e.union(Ch)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new li);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,r=t.length;n<r;n++){if(t[n].active===!1)continue;const o=t[n].geometryIndex;this.getMatrixAt(n,Pi),this.getBoundingSphereAt(o,Ra).applyMatrix4(Pi),e.union(Ra)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const n={visible:!0,active:!0,geometryIndex:e};let r=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(X0),r=this._availableInstanceIds.shift(),this._instanceInfo[r]=n):(r=this._instanceInfo.length,this._instanceInfo.push(n));const o=this._matricesTexture;Pi.identity().toArray(o.image.data,r*16),o.needsUpdate=!0;const l=this._colorsTexture;return l&&(qT.toArray(l.image.data,r*4),l.needsUpdate=!0),this._visibilityChanged=!0,r}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const r={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},o=this._geometryInfo;r.vertexStart=this._nextVertexStart,r.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const l=e.getIndex();if(l!==null&&(r.indexStart=this._nextIndexStart,r.reservedIndexCount=n===-1?l.count:n),r.indexStart!==-1&&r.indexStart+r.reservedIndexCount>this._maxIndexCount||r.vertexStart+r.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let h;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(X0),h=this._availableGeometryIds.shift(),o[h]=r):(h=this._geometryCount,this._geometryCount++,o.push(r)),this.setGeometryAt(h,e),this._nextIndexStart=r.indexStart+r.reservedIndexCount,this._nextVertexStart=r.vertexStart+r.reservedVertexCount,h}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,r=n.getIndex()!==null,o=n.getIndex(),l=t.getIndex(),c=this._geometryInfo[e];if(r&&l.count>c.reservedIndexCount||t.attributes.position.count>c.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const h=c.vertexStart,d=c.reservedVertexCount;c.vertexCount=t.getAttribute("position").count;for(const p in n.attributes){const g=t.getAttribute(p),v=n.getAttribute(p);jT(g,v,h);const _=g.itemSize;for(let y=g.count,w=d;y<w;y++){const b=h+y;for(let S=0;S<_;S++)v.setComponent(b,S,0)}v.needsUpdate=!0,v.addUpdateRange(h*_,d*_)}if(r){const p=c.indexStart,g=c.reservedIndexCount;c.indexCount=t.getIndex().count;for(let v=0;v<l.count;v++)o.setX(p+v,h+l.getX(v));for(let v=l.count,_=g;v<_;v++)o.setX(p+v,h);o.needsUpdate=!0,o.addUpdateRange(p,c.reservedIndexCount)}return c.start=r?c.indexStart:c.vertexStart,c.count=r?c.indexCount:c.vertexCount,c.boundingBox=null,t.boundingBox!==null&&(c.boundingBox=t.boundingBox.clone()),c.boundingSphere=null,t.boundingSphere!==null&&(c.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const n=this._instanceInfo;for(let r=0,o=n.length;r<o;r++)n[r].active&&n[r].geometryIndex===e&&this.deleteInstance(r);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,r=n.map((l,c)=>c).sort((l,c)=>n[l].vertexStart-n[c].vertexStart),o=this.geometry;for(let l=0,c=n.length;l<c;l++){const h=r[l],d=n[h];if(d.active!==!1){if(o.index!==null){if(d.indexStart!==t){const{indexStart:p,vertexStart:g,reservedIndexCount:v}=d,_=o.index,y=_.array,w=e-g;for(let b=p;b<p+v;b++)y[b]=y[b]+w;_.array.copyWithin(t,p,p+v),_.addUpdateRange(t,v),_.needsUpdate=!0,d.indexStart=t}t+=d.reservedIndexCount}if(d.vertexStart!==e){const{vertexStart:p,reservedVertexCount:g}=d,v=o.attributes;for(const _ in v){const y=v[_],{array:w,itemSize:b}=y;w.copyWithin(e*b,p*b,(p+g)*b),y.addUpdateRange(e*b,g*b),y.needsUpdate=!0}d.vertexStart=e}e+=d.reservedVertexCount,d.start=o.index?d.indexStart:d.vertexStart}}return this._nextIndexStart=t,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,r=this._geometryInfo[e];if(r.boundingBox===null){const o=new gi,l=n.index,c=n.attributes.position;for(let h=r.start,d=r.start+r.count;h<d;h++){let p=h;l&&(p=l.getX(p)),o.expandByPoint(q0.fromBufferAttribute(c,p))}r.boundingBox=o}return t.copy(r.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,r=this._geometryInfo[e];if(r.boundingSphere===null){const o=new li;this.getBoundingBoxAt(e,Ch),Ch.getCenter(o.center);const l=n.index,c=n.attributes.position;let h=0;for(let d=r.start,p=r.start+r.count;d<p;d++){let g=d;l&&(g=l.getX(g)),q0.fromBufferAttribute(c,g),h=Math.max(h,o.center.distanceToSquared(q0))}o.radius=Math.sqrt(h),r.boundingSphere=o}return t.copy(r.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,r=this._matricesTexture.image.data;return t.toArray(r,e*16),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null?t.isVector4?t.set(1,1,1,1):t.setRGB(1,1,1):t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this._visibilityChanged=!0,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(X0);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(e<n.length)throw new Error(`THREE.BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const r=new Int32Array(e),o=new Int32Array(e);qs(this._multiDrawCounts,r),qs(this._multiDrawStarts,o),this._multiDrawCounts=r,this._multiDrawStarts=o;const l=new Int32Array(e),c=new Int32Array(e),h=new Int32Array(e);qs(this._mergedDrawCounts,l),qs(this._mergedDrawStarts,c),qs(this._mergedDrawInstanceCounts,h),this._mergedDrawCounts=l,this._mergedDrawStarts=c,this._mergedDrawInstanceCounts=h,this._maxInstanceCount=e;const d=this._indirectTexture,p=this._matricesTexture,g=this._colorsTexture;d.dispose(),this._initIndirectTexture(),qs(d.image.data,this._indirectTexture.image.data),p.dispose(),this._initMatricesTexture(),qs(p.image.data,this._matricesTexture.image.data),g&&(g.dispose(),this._initColorsTexture(),qs(g.image.data,this._colorsTexture.image.data)),this._previousMatricesTexture!==null&&(this._previousMatricesTexture.dispose(),this._previousMatricesTexture=null)}setGeometrySize(e,t){const n=[...this._geometryInfo].filter(c=>c.active);if(Math.max(...n.map(c=>c.vertexStart+c.reservedVertexCount))>e)throw new Error(`THREE.BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map(h=>h.indexStart+h.reservedIndexCount))>t)throw new Error(`THREE.BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const o=this.geometry;o.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new bt,this._initializeGeometry(o));const l=this.geometry;o.index&&qs(o.index.array,l.index.array);for(const c in o.attributes)qs(o.attributes[c].array,l.attributes[c].array);this._visibilityChanged=!0}raycast(e,t){const n=this._instanceInfo,r=this._geometryInfo,o=this.matrixWorld,l=this.geometry;di.material=this.material,di.geometry.index=l.index,di.geometry.attributes=l.attributes,di.geometry.boundingBox===null&&(di.geometry.boundingBox=new gi),di.geometry.boundingSphere===null&&(di.geometry.boundingSphere=new li);for(let c=0,h=n.length;c<h;c++){if(!n[c].visible||!n[c].active)continue;const d=n[c].geometryIndex,p=r[d];di.geometry.setDrawRange(p.start,p.count),this.getMatrixAt(c,di.matrixWorld).premultiply(o),this.getBoundingBoxAt(d,di.geometry.boundingBox),this.getBoundingSphereAt(d,di.geometry.boundingSphere),di.raycast(e,Rh);for(let g=0,v=Rh.length;g<v;g++){const _=Rh[g];_.object=this,_.batchId=c,t.push(_)}Rh.length=0}di.material=null,di.geometry.index=null,di.geometry.attributes={},di.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._multiDrawBytesPerElement=e._multiDrawBytesPerElement,this._mergedDrawCounts=e._mergedDrawCounts.slice(),this._mergedDrawStarts=e._mergedDrawStarts.slice(),this._mergedDrawInstanceCounts=e._mergedDrawInstanceCounts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),e._colorsTexture!==null?(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()):this._colorsTexture=null,this}dispose(){super.dispose(),this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this._previousMatricesTexture!==null&&(this._previousMatricesTexture.dispose(),this._previousMatricesTexture=null)}_updateDrawParameters(e,t,n,r="multiDraw"){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=t.getIndex();let l=o===null?1:o.array.BYTES_PER_ELEMENT,c=1;n.wireframe&&(c=2,l=t.attributes.position.count>65535?4:2);const h=this._instanceInfo,d=this._multiDrawStarts,p=this._multiDrawCounts,g=this._mergedDrawStarts,v=this._mergedDrawCounts,_=this._mergedDrawInstanceCounts,y=this._geometryInfo,w=this.perObjectFrustumCulled,b=this._indirectTexture,S=b.image.data,M=e.isArrayCamera?YT:$T;w&&(e.isArrayCamera?M.setFromArrayCamera(e):(Pi.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse).multiply(this.matrixWorld),M.setFromProjectionMatrix(Pi,e.coordinateSystem,e.reversedDepth)));let A=0,E=0;if(this.sortObjects){Pi.copy(this.matrixWorld).invert(),ix.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Pi),sx.set(0,0,-1).transformDirection(e.matrixWorld).transformDirection(Pi);for(let T=0,C=h.length;T<C;T++)if(h[T].visible&&h[T].active){const F=h[T].geometryIndex;this.getMatrixAt(T,Pi),this.getBoundingSphereAt(F,Ra).applyMatrix4(Pi);let D=!1;if(w&&(D=!M.intersectsSphere(Ra)),!D){const B=y[F],W=ZT.subVectors(Ra.center,ix).dot(sx);$0.push(B.start,B.count,W,T)}}const N=$0.list,P=this.customSort;P===null?N.sort(n.transparent?WT:GT):P.call(this,N,e);for(let T=0,C=N.length;T<C;T++){const F=N[T],D=F.start*l*c,B=F.count*c;r==="merged"?E>0&&g[E-1]===D&&v[E-1]===B?_[E-1]++:(g[E]=D,v[E]=B,_[E]=1,E++):(d[A]=D,p[A]=B),S[A]=F.index,A++}$0.reset()}else for(let N=0,P=h.length;N<P;N++)if(h[N].visible&&h[N].active){const T=h[N].geometryIndex;let C=!1;if(w&&(this.getMatrixAt(N,Pi),this.getBoundingSphereAt(T,Ra).applyMatrix4(Pi),C=!M.intersectsSphere(Ra)),!C){const F=y[T],D=F.start*l*c,B=F.count*c;r==="merged"?E>0&&g[E-1]===D&&v[E-1]===B?_[E-1]++:(g[E]=D,v[E]=B,_[E]=1,E++):(d[A]=D,p[A]=B),S[A]=N,A++}}b.needsUpdate=!0,this._multiDrawCount=A,this._mergedDrawCount=E,this._multiDrawBytesPerElement=l,this._visibilityChanged=!1}onBeforeRender(e,t,n,r,o){e.isWebGPURenderer===!0?(this._visibilityChanged||this.perObjectFrustumCulled||this.sortObjects)&&(this._indirectTexture.needsUpdate=!0):this._updateDrawParameters(n,r,o)}onBeforeShadow(e,t,n,r,o,l){e.isWebGPURenderer!==!0&&this._updateDrawParameters(r,o,l)}}class vi extends Gn{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Ge(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Gf=new O,Wf=new O,rx=new gt,lc=new xl,Ih=new li,Y0=new O,ax=new O;class Tr extends Wt{constructor(e=new bt,t=new vi){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0?this.morphTargetInfluences=e.morphTargetInfluences.slice():this.morphTargetInfluences=void 0,e.morphTargetDictionary!==void 0?this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary):this.morphTargetDictionary=void 0,this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let r=1,o=t.count;r<o;r++)Gf.fromBufferAttribute(t,r-1),Wf.fromBufferAttribute(t,r),n[r]=n[r-1],n[r]+=Gf.distanceTo(Wf);e.setAttribute("lineDistance",new Je(n,1))}else Fe("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){const n=this.geometry,r=this.matrixWorld,o=e.params.Line.threshold,l=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Ih.copy(n.boundingSphere),Ih.applyMatrix4(r),Ih.radius+=o,e.ray.intersectsSphere(Ih)===!1)return;rx.copy(r).invert(),lc.copy(e.ray).applyMatrix4(rx);const c=o/((this.scale.x+this.scale.y+this.scale.z)/3),h=c*c,d=this.isLineSegments?2:1,p=n.index,v=n.attributes.position;if(p!==null){const _=Math.max(0,l.start),y=Math.min(p.count,l.start+l.count);for(let w=_,b=y-1;w<b;w+=d){const S=p.getX(w),M=p.getX(w+1),A=Ph(this,e,lc,h,S,M,w);A&&t.push(A)}if(this.isLineLoop){const w=p.getX(y-1),b=p.getX(_),S=Ph(this,e,lc,h,w,b,y-1);S&&t.push(S)}}else{const _=Math.max(0,l.start),y=Math.min(v.count,l.start+l.count);for(let w=_,b=y-1;w<b;w+=d){const S=Ph(this,e,lc,h,w,w+1,w);S&&t.push(S)}if(this.isLineLoop){const w=Ph(this,e,lc,h,y-1,_,y-1);w&&t.push(w)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=r.length;o<l;o++){const c=r[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=o}}}}}function Ph(i,e,t,n,r,o,l){const c=i.geometry.attributes.position;if(Gf.fromBufferAttribute(c,r),Wf.fromBufferAttribute(c,o),t.distanceSqToSegment(Gf,Wf,Y0,ax)>n)return;Y0.applyMatrix4(i.matrixWorld);const d=e.ray.origin.distanceTo(Y0);if(!(d<e.near||d>e.far))return{distance:d,point:ax.clone().applyMatrix4(i.matrixWorld),index:l,face:null,faceIndex:null,barycoord:null,object:i}}const ox=new O,lx=new O;class er extends Tr{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 r=0,o=t.count;r<o;r+=2)ox.fromBufferAttribute(t,r),lx.fromBufferAttribute(t,r+1),n[r]=r===0?0:n[r-1],n[r+1]=n[r]+ox.distanceTo(lx);e.setAttribute("lineDistance",new Je(n,1))}else Fe("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class L3 extends Tr{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class hg extends Gn{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Ge(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const cx=new gt,Tm=new xl,Lh=new li,Nh=new O;class N3 extends Wt{constructor(e=new bt,t=new hg){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0?this.morphTargetInfluences=e.morphTargetInfluences.slice():this.morphTargetInfluences=void 0,e.morphTargetDictionary!==void 0?this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary):this.morphTargetDictionary=void 0,this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}intersectsFrustum(e){return e.intersectsObject(this)}raycast(e,t){const n=this.geometry,r=this.matrixWorld,o=e.params.Points.threshold,l=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),Lh.copy(n.boundingSphere),Lh.applyMatrix4(r),Lh.radius+=o,e.ray.intersectsSphere(Lh)===!1)return;cx.copy(r).invert(),Tm.copy(e.ray).applyMatrix4(cx);const c=o/((this.scale.x+this.scale.y+this.scale.z)/3),h=c*c,d=n.index,g=n.attributes.position;if(d!==null){const v=Math.max(0,l.start),_=Math.min(d.count,l.start+l.count);for(let y=v,w=_;y<w;y++){const b=d.getX(y);Nh.fromBufferAttribute(g,b),ux(Nh,b,h,r,e,t,this)}}else{const v=Math.max(0,l.start),_=Math.min(g.count,l.start+l.count);for(let y=v,w=_;y<w;y++)Nh.fromBufferAttribute(g,y),ux(Nh,y,h,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const r=t[n[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let o=0,l=r.length;o<l;o++){const c=r[o].name||String(o);this.morphTargetInfluences.push(0),this.morphTargetDictionary[c]=o}}}}}function ux(i,e,t,n,r,o,l){const c=Tm.distanceSqToPoint(i);if(c<t){const h=new O;Tm.closestPointToPoint(i,h),h.applyMatrix4(n);const d=r.ray.origin.distanceTo(h);if(d<r.near||d>r.far)return;o.push({distance:d,distanceToRay:Math.sqrt(c),point:h,index:e,face:null,faceIndex:null,barycoord:null,object:l})}}class D3 extends pn{constructor(e,t,n,r,o=an,l=an,c,h,d){super(e,t,n,r,o,l,c,h,d),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const p=this;function g(){p.needsUpdate=!0,p._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(g))}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)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class JT extends D3{constructor(e,t,n,r,o,l,c,h){super({},e,t,n,r,o,l,c,h),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class KT extends pn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=dn,this.minFilter=dn,this.generateMipmaps=!1,this.needsUpdate=!0}copy(e){return super.copy(e),this.source=new Js(Object.assign({},e.image)),this}}class _d extends pn{constructor(e=[],t,n,r,o,l,c,h,d,p,g,v){super(null,l,c,h,d,p,r,o,g,v),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class QT extends _d{constructor(e,t,n,r,o,l){super(e,t,n,o,l),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Fi,this.layerUpdates=new Set}copy(e){return super.copy(e),this.wrapR=e.wrapR,this}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class eE extends _d{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,br),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class eu extends pn{constructor(e=[],t=br,n,r,o,l,c,h,d,p){super(e,t,n,r,o,l,c,h,d,p),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class tE extends pn{constructor(e,t,n,r,o,l,c,h,d){super(e,t,n,r,o,l,c,h,d),this.isCanvasTexture=!0,this.needsUpdate=!0}}class nE extends pn{constructor(e,t,n,r,o,l,c,h,d){super(e,t,n,r,o,l,c,h,d),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;const p=e?e.parentNode:null;p!==null&&"requestPaint"in p&&(p.onpaint=()=>{this.needsUpdate=!0},p.requestPaint())}dispose(){const e=this.image?this.image.parentNode:null;e!==null&&"onpaint"in e&&(e.onpaint=null),super.dispose()}}class Qs extends pn{constructor(e,t,n=ds,r,o,l,c=dn,h=dn,d,p=Mr,g=1){if(p!==Mr&&p!==js)throw new Error("THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const v={width:e,height:t,depth:g};super(v,r,o,l,c,h,p,n,d),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Js(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return t.compareFunction=this.compareFunction,t}}class fg extends Qs{constructor(e,t=ds,n=br,r,o,l=dn,c=dn,h,d=Mr){const p={width:e,height:e,depth:1},g=[p,p,p,p,p,p];super(e,e,t,n,r,o,l,c,h,d),this.image=g,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class dg extends pn{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Ka extends bt{constructor(e=1,t=1,n=1,r=1,o=1,l=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:o,depthSegments:l};const c=this;r=Math.floor(r),o=Math.floor(o),l=Math.floor(l);const h=[],d=[],p=[],g=[];let v=0,_=0;y("z","y","x",-1,-1,n,t,e,l,o,0),y("z","y","x",1,-1,n,t,-e,l,o,1),y("x","z","y",1,1,e,n,t,r,l,2),y("x","z","y",1,-1,e,n,-t,r,l,3),y("x","y","z",1,-1,e,t,n,r,o,4),y("x","y","z",-1,-1,e,t,-n,r,o,5),this.setIndex(h),this.setAttribute("position",new Je(d,3)),this.setAttribute("normal",new Je(p,3)),this.setAttribute("uv",new Je(g,2));function y(w,b,S,M,A,E,N,P,T,C,F){const D=E/T,B=N/C,W=E/2,Z=N/2,z=P/2,X=T+1,Q=C+1;let q=0,fe=0;const Y=new O;for(let he=0;he<Q;he++){const pe=he*B-Z;for(let We=0;We<X;We++){const qe=We*D-W;Y[w]=qe*M,Y[b]=pe*A,Y[S]=z,d.push(Y.x,Y.y,Y.z),Y[w]=0,Y[b]=0,Y[S]=P>0?1:-1,p.push(Y.x,Y.y,Y.z),g.push(We/T),g.push(1-he/C),q+=1}}for(let he=0;he<C;he++)for(let pe=0;pe<T;pe++){const We=v+pe+X*he,qe=v+pe+X*(he+1),ie=v+(pe+1)+X*(he+1),xe=v+(pe+1)+X*he;h.push(We,qe,xe),h.push(qe,ie,xe),fe+=6}c.addGroup(_,fe,F),_+=fe,v+=q}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ka(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class xd extends bt{constructor(e=1,t=1,n=4,r=8,o=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:r,heightSegments:o},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),r=Math.max(3,Math.floor(r)),o=Math.max(1,Math.floor(o));const l=[],c=[],h=[],d=[],p=t/2,g=Math.PI/2*e,v=t,_=2*g+v,y=n*2+o,w=r+1,b=new O,S=new O;for(let M=0;M<=y;M++){let A=0,E=0,N=0,P=0;if(M<=n){const F=M/n,D=F*Math.PI/2;E=-p-e*Math.cos(D),N=e*Math.sin(D),P=-e*Math.cos(D),A=F*g}else if(M<=n+o){const F=(M-n)/o;E=-p+F*t,N=e,P=0,A=g+F*v}else{const F=(M-n-o)/n,D=F*Math.PI/2;E=p+e*Math.sin(D),N=e*Math.cos(D),P=e*Math.sin(D),A=g+v+F*g}const T=Math.max(0,Math.min(1,A/_));let C=0;M===0?C=.5/r:M===y&&(C=-.5/r);for(let F=0;F<=r;F++){const D=F/r,B=D*Math.PI*2,W=Math.sin(B),Z=Math.cos(B);S.x=-N*Z,S.y=E,S.z=N*W,c.push(S.x,S.y,S.z),b.set(-N*Z,P,N*W),b.normalize(),h.push(b.x,b.y,b.z),d.push(D+C,T)}if(M>0){const F=(M-1)*w;for(let D=0;D<r;D++){const B=F+D,W=F+D+1,Z=M*w+D,z=M*w+D+1;l.push(B,W,Z),l.push(W,z,Z)}}}this.setIndex(l),this.setAttribute("position",new Je(c,3)),this.setAttribute("normal",new Je(h,3)),this.setAttribute("uv",new Je(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xd(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class yd extends bt{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);const o=[],l=[],c=[],h=[],d=new O,p=new ue;l.push(0,0,0),c.push(0,0,1),h.push(.5,.5);for(let g=0,v=3;g<=t;g++,v+=3){const _=n+g/t*r;d.x=e*Math.cos(_),d.y=e*Math.sin(_),l.push(d.x,d.y,d.z),c.push(0,0,1),p.x=(l[v]/e+1)/2,p.y=(l[v+1]/e+1)/2,h.push(p.x,p.y)}for(let g=1;g<=t;g++)o.push(g,g+1,0);this.setIndex(o),this.setAttribute("position",new Je(l,3)),this.setAttribute("normal",new Je(c,3)),this.setAttribute("uv",new Je(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new yd(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class tu extends bt{constructor(e=1,t=1,n=1,r=32,o=1,l=!1,c=0,h=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:o,openEnded:l,thetaStart:c,thetaLength:h};const d=this;r=Math.floor(r),o=Math.floor(o);const p=[],g=[],v=[],_=[];let y=0;const w=[],b=n/2;let S=0;M(),l===!1&&(e>0&&A(!0),t>0&&A(!1)),this.setIndex(p),this.setAttribute("position",new Je(g,3)),this.setAttribute("normal",new Je(v,3)),this.setAttribute("uv",new Je(_,2));function M(){const E=new O,N=new O;let P=0;const T=(t-e)/n;for(let C=0;C<=o;C++){const F=[],D=C/o,B=D*(t-e)+e;for(let W=0;W<=r;W++){const Z=W/r,z=Z*h+c,X=Math.sin(z),Q=Math.cos(z);N.x=B*X,N.y=-D*n+b,N.z=B*Q,g.push(N.x,N.y,N.z),E.set(X,T,Q).normalize(),v.push(E.x,E.y,E.z),_.push(Z,1-D),F.push(y++)}w.push(F)}for(let C=0;C<r;C++)for(let F=0;F<o;F++){const D=w[F][C],B=w[F+1][C],W=w[F+1][C+1],Z=w[F][C+1];(e>0||F!==0)&&(p.push(D,B,Z),P+=3),(t>0||F!==o-1)&&(p.push(B,W,Z),P+=3)}d.addGroup(S,P,0),S+=P}function A(E){const N=y,P=new ue,T=new O;let C=0;const F=E===!0?e:t,D=E===!0?1:-1;for(let W=1;W<=r;W++)g.push(0,b*D,0),v.push(0,D,0),_.push(.5,.5),y++;const B=y;for(let W=0;W<=r;W++){const z=W/r*h+c,X=Math.cos(z),Q=Math.sin(z);T.x=F*Q,T.y=b*D,T.z=F*X,g.push(T.x,T.y,T.z),v.push(0,D,0),P.x=X*.5+.5,P.y=Q*.5*D+.5,_.push(P.x,P.y),y++}for(let W=0;W<r;W++){const Z=N+W,z=B+W;E===!0?p.push(z,z+1,Z):p.push(z+1,z,Z),C+=3}d.addGroup(S,C,E===!0?1:2),S+=C}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new tu(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class nu extends tu{constructor(e=1,t=1,n=32,r=1,o=!1,l=0,c=Math.PI*2){super(0,e,t,n,r,o,l,c),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:r,openEnded:o,thetaStart:l,thetaLength:c}}static fromJSON(e){return new nu(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class sa extends bt{constructor(e=[],t=[],n=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:r};const o=[],l=[];c(r),d(n),p(),this.setAttribute("position",new Je(o,3)),this.setAttribute("normal",new Je(o.slice(),3)),this.setAttribute("uv",new Je(l,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function c(M){const A=new O,E=new O,N=new O;for(let P=0;P<t.length;P+=3)_(t[P+0],A),_(t[P+1],E),_(t[P+2],N),h(A,E,N,M)}function h(M,A,E,N){const P=N+1,T=[];for(let C=0;C<=P;C++){T[C]=[];const F=M.clone().lerp(E,C/P),D=A.clone().lerp(E,C/P),B=P-C;for(let W=0;W<=B;W++)W===0&&C===P?T[C][W]=F:T[C][W]=F.clone().lerp(D,W/B)}for(let C=0;C<P;C++)for(let F=0;F<2*(P-C)-1;F++){const D=Math.floor(F/2);F%2===0?(v(T[C][D+1]),v(T[C+1][D]),v(T[C][D])):(v(T[C][D+1]),v(T[C+1][D+1]),v(T[C+1][D]))}}function d(M){const A=new O;for(let E=0;E<o.length;E+=3)A.x=o[E+0],A.y=o[E+1],A.z=o[E+2],A.normalize().multiplyScalar(M),o[E+0]=A.x,o[E+1]=A.y,o[E+2]=A.z}function p(){const M=new O;for(let A=0;A<o.length;A+=3){M.x=o[A+0],M.y=o[A+1],M.z=o[A+2];const E=b(M)/2/Math.PI+.5,N=S(M)/Math.PI+.5;l.push(E,1-N)}y(),g()}function g(){for(let M=0;M<l.length;M+=6){const A=l[M+0],E=l[M+2],N=l[M+4],P=Math.max(A,E,N),T=Math.min(A,E,N);P>.9&&T<.1&&(A<.2&&(l[M+0]+=1),E<.2&&(l[M+2]+=1),N<.2&&(l[M+4]+=1))}}function v(M){o.push(M.x,M.y,M.z)}function _(M,A){const E=M*3;A.x=e[E+0],A.y=e[E+1],A.z=e[E+2]}function y(){const M=new O,A=new O,E=new O,N=new O,P=new ue,T=new ue,C=new ue;for(let F=0,D=0;F<o.length;F+=9,D+=6){M.set(o[F+0],o[F+1],o[F+2]),A.set(o[F+3],o[F+4],o[F+5]),E.set(o[F+6],o[F+7],o[F+8]),P.set(l[D+0],l[D+1]),T.set(l[D+2],l[D+3]),C.set(l[D+4],l[D+5]),N.copy(M).add(A).add(E).divideScalar(3);const B=b(N);w(P,D+0,M,B),w(T,D+2,A,B),w(C,D+4,E,B)}}function w(M,A,E,N){N<0&&M.x===1&&(l[A]=M.x-1),E.x===0&&E.z===0&&(l[A]=N/2/Math.PI+.5)}function b(M){return Math.atan2(M.z,-M.x)}function S(M){return Math.atan2(-M.y,Math.sqrt(M.x*M.x+M.z*M.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sa(e.vertices,e.indices,e.radius,e.detail)}}class Sd extends sa{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,r=1/n,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-n,0,-r,n,0,r,-n,0,r,n,-r,-n,0,-r,n,0,r,-n,0,r,n,0,-n,0,-r,n,0,-r,-n,0,r,n,0,r],l=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(o,l,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Sd(e.radius,e.detail)}}const Dh=new O,Uh=new O,Z0=new O,Fh=new Ui;class U3 extends bt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),o=Math.cos(Ga*t),l=e.getIndex(),c=e.getAttribute("position"),h=l?l.count:c.count,d=[0,0,0],p=["a","b","c"],g=new Array(3),v=new Map,_=[];for(let y=0;y<h;y+=3){l?(d[0]=l.getX(y),d[1]=l.getX(y+1),d[2]=l.getX(y+2)):(d[0]=y,d[1]=y+1,d[2]=y+2);const{a:w,b,c:S}=Fh;if(w.fromBufferAttribute(c,d[0]),b.fromBufferAttribute(c,d[1]),S.fromBufferAttribute(c,d[2]),Fh.getNormal(Z0),g[0]=`${Math.round(w.x*r)},${Math.round(w.y*r)},${Math.round(w.z*r)}`,g[1]=`${Math.round(b.x*r)},${Math.round(b.y*r)},${Math.round(b.z*r)}`,g[2]=`${Math.round(S.x*r)},${Math.round(S.y*r)},${Math.round(S.z*r)}`,!(g[0]===g[1]||g[1]===g[2]||g[2]===g[0]))for(let M=0;M<3;M++){const A=(M+1)%3,E=g[M],N=g[A],P=Fh[p[M]],T=Fh[p[A]],C=`${E}_${N}`,F=`${N}_${E}`,D=v.get(F);D?(Z0.dot(D.normal)<=o&&(_.push(P.x,P.y,P.z),_.push(T.x,T.y,T.z)),v.set(F,null)):v.has(C)||v.set(C,{index0:d[M],index1:d[A],normal:Z0.clone()})}}for(const y of v.values())if(y){const{index0:w,index1:b}=y;Dh.fromBufferAttribute(c,w),Uh.fromBufferAttribute(c,b),_.push(Dh.x,Dh.y,Dh.z),_.push(Uh.x,Uh.y,Uh.z)}this.setAttribute("position",new Je(_,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Ds{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Fe("Curve: .getPoint() not implemented.")}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,r=this.getPoint(0),o=0;t.push(0);for(let l=1;l<=e;l++)n=this.getPoint(l/e),o+=n.distanceTo(r),t.push(o),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let r=0;const o=n.length;let l;t?l=t:l=e*n[o-1];let c=0,h=o-1,d;for(;c<=h;)if(r=Math.floor(c+(h-c)/2),d=n[r]-l,d<0)c=r+1;else if(d>0)h=r-1;else{h=r;break}if(r=h,n[r]===l)return r/(o-1);const p=n[r],v=n[r+1]-p,_=(l-p)/v;return(r+_)/(o-1)}getTangent(e,t){let r=e-1e-4,o=e+1e-4;r<0&&(r=0),o>1&&(o=1);const l=this.getPoint(r),c=this.getPoint(o),h=t||(l.isVector2?new ue:new O);return h.copy(c).sub(l).normalize(),h}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new O,r=[],o=[],l=[],c=new O,h=new gt;for(let _=0;_<=e;_++){const y=_/e;r[_]=this.getTangentAt(y,new O)}o[0]=new O,l[0]=new O;let d=Number.MAX_VALUE;const p=Math.abs(r[0].x),g=Math.abs(r[0].y),v=Math.abs(r[0].z);p<=d&&(d=p,n.set(1,0,0)),g<=d&&(d=g,n.set(0,1,0)),v<=d&&n.set(0,0,1),c.crossVectors(r[0],n).normalize(),o[0].crossVectors(r[0],c),l[0].crossVectors(r[0],o[0]);for(let _=1;_<=e;_++){if(o[_]=o[_-1].clone(),l[_]=l[_-1].clone(),c.crossVectors(r[_-1],r[_]),c.length()>Number.EPSILON){c.normalize();const y=Math.acos(ft(r[_-1].dot(r[_]),-1,1));o[_].applyMatrix4(h.makeRotationAxis(c,y))}l[_].crossVectors(r[_],o[_])}if(t===!0){let _=Math.acos(ft(o[0].dot(o[e]),-1,1));_/=e,r[0].dot(c.crossVectors(o[0],o[e]))>0&&(_=-_);for(let y=1;y<=e;y++)o[y].applyMatrix4(h.makeRotationAxis(r[y],_*y)),l[y].crossVectors(r[y],o[y])}return{tangents:r,normals:o,binormals:l}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this.cacheArcLengths=null,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this.cacheArcLengths=null,this}}class bd extends Ds{constructor(e=0,t=0,n=1,r=1,o=0,l=Math.PI*2,c=!1,h=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=o,this.aEndAngle=l,this.aClockwise=c,this.aRotation=h}getPoint(e,t=new ue){const n=t,r=Math.PI*2;let o=this.aEndAngle-this.aStartAngle;const l=Math.abs(o)<Number.EPSILON;for(;o<0;)o+=r;for(;o>r;)o-=r;o<Number.EPSILON&&(l?o=0:o=r),this.aClockwise===!0&&!l&&(o===r?o=-r:o=o-r);const c=this.aStartAngle+e*o;let h=this.aX+this.xRadius*Math.cos(c),d=this.aY+this.yRadius*Math.sin(c);if(this.aRotation!==0){const p=Math.cos(this.aRotation),g=Math.sin(this.aRotation),v=h-this.aX,_=d-this.aY;h=v*p-_*g+this.aX,d=v*g+_*p+this.aY}return n.set(h,d)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class F3 extends bd{constructor(e,t,n,r,o,l){super(e,t,n,n,r,o,l),this.isArcCurve=!0,this.type="ArcCurve"}}function pg(){let i=0,e=0,t=0,n=0;function r(o,l,c,h){i=o,e=c,t=-3*o+3*l-2*c-h,n=2*o-2*l+c+h}return{initCatmullRom:function(o,l,c,h,d){r(l,c,d*(c-o),d*(h-l))},initNonuniformCatmullRom:function(o,l,c,h,d,p,g){let v=(l-o)/d-(c-o)/(d+p)+(c-l)/p,_=(c-l)/p-(h-l)/(p+g)+(h-c)/g;v*=p,_*=p,r(l,c,v,_)},calc:function(o){const l=o*o,c=l*o;return i+e*o+t*l+n*c}}}const hx=new O,fx=new O,j0=new pg,J0=new pg,K0=new pg;class O3 extends Ds{constructor(e=[],t=!1,n="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new O){const n=t,r=this.points,o=r.length,l=(o-(this.closed?0:1))*e;let c=Math.floor(l),h=l-c;this.closed?c+=c>0?0:(Math.floor(Math.abs(c)/o)+1)*o:h===0&&c===o-1&&(c=o-2,h=1);let d,p;this.closed||c>0?d=r[(c-1)%o]:(fx.subVectors(r[0],r[1]).add(r[0]),d=fx);const g=r[c%o],v=r[(c+1)%o];if(this.closed||c+2<o?p=r[(c+2)%o]:(hx.subVectors(r[o-1],r[o-2]).add(r[o-1]),p=hx),this.curveType==="centripetal"||this.curveType==="chordal"){const _=this.curveType==="chordal"?.5:.25;let y=Math.pow(d.distanceToSquared(g),_),w=Math.pow(g.distanceToSquared(v),_),b=Math.pow(v.distanceToSquared(p),_);w<1e-4&&(w=1),y<1e-4&&(y=w),b<1e-4&&(b=w),j0.initNonuniformCatmullRom(d.x,g.x,v.x,p.x,y,w,b),J0.initNonuniformCatmullRom(d.y,g.y,v.y,p.y,y,w,b),K0.initNonuniformCatmullRom(d.z,g.z,v.z,p.z,y,w,b)}else this.curveType==="catmullrom"&&(j0.initCatmullRom(d.x,g.x,v.x,p.x,this.tension),J0.initCatmullRom(d.y,g.y,v.y,p.y,this.tension),K0.initCatmullRom(d.z,g.z,v.z,p.z,this.tension));return n.set(j0.calc(h),J0.calc(h),K0.calc(h)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new O().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function dx(i,e,t,n,r){const o=(n-e)*.5,l=(r-t)*.5,c=i*i,h=i*c;return(2*t-2*n+o+l)*h+(-3*t+3*n-2*o-l)*c+o*i+t}function iE(i,e){const t=1-i;return t*t*e}function sE(i,e){return 2*(1-i)*i*e}function rE(i,e){return i*i*e}function Tc(i,e,t,n){return iE(i,e)+sE(i,t)+rE(i,n)}function aE(i,e){const t=1-i;return t*t*t*e}function oE(i,e){const t=1-i;return 3*t*t*i*e}function lE(i,e){return 3*(1-i)*i*i*e}function cE(i,e){return i*i*i*e}function Ec(i,e,t,n,r){return aE(i,e)+oE(i,t)+lE(i,n)+cE(i,r)}class mg extends Ds{constructor(e=new ue,t=new ue,n=new ue,r=new ue){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new ue){const n=t,r=this.v0,o=this.v1,l=this.v2,c=this.v3;return n.set(Ec(e,r.x,o.x,l.x,c.x),Ec(e,r.y,o.y,l.y,c.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class B3 extends Ds{constructor(e=new O,t=new O,n=new O,r=new O){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new O){const n=t,r=this.v0,o=this.v1,l=this.v2,c=this.v3;return n.set(Ec(e,r.x,o.x,l.x,c.x),Ec(e,r.y,o.y,l.y,c.y),Ec(e,r.z,o.z,l.z,c.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class gg extends Ds{constructor(e=new ue,t=new ue){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ue){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ue){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class z3 extends Ds{constructor(e=new O,t=new O){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new O){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new O){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class vg extends Ds{constructor(e=new ue,t=new ue,n=new ue){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ue){const n=t,r=this.v0,o=this.v1,l=this.v2;return n.set(Tc(e,r.x,o.x,l.x),Tc(e,r.y,o.y,l.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class _g extends Ds{constructor(e=new O,t=new O,n=new O){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new O){const n=t,r=this.v0,o=this.v1,l=this.v2;return n.set(Tc(e,r.x,o.x,l.x),Tc(e,r.y,o.y,l.y),Tc(e,r.z,o.z,l.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class xg extends Ds{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ue){const n=t,r=this.points,o=(r.length-1)*e,l=Math.floor(o),c=o-l,h=r[l===0?l:l-1],d=r[l],p=r[l>r.length-2?r.length-1:l+1],g=r[l>r.length-3?r.length-1:l+2];return n.set(dx(c,h.x,d.x,p.x,g.x),dx(c,h.y,d.y,p.y,g.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const r=e.points[t];this.points.push(new ue().fromArray(r))}return this}}var Xf=Object.freeze({__proto__:null,ArcCurve:F3,CatmullRomCurve3:O3,CubicBezierCurve:mg,CubicBezierCurve3:B3,EllipseCurve:bd,LineCurve:gg,LineCurve3:z3,QuadraticBezierCurve:vg,QuadraticBezierCurve3:_g,SplineCurve:xg});class k3 extends Ds{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1,this.cacheLengths=null}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Xf[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),r=this.getCurveLengths();let o=0;for(;o<r.length;){if(r[o]>=n){const l=r[o]-n,c=this.curves[o],h=c.getLength(),d=h===0?0:1-l/h;return c.getPointAt(d,t)}o++}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,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let r=0,o=this.curves;r<o.length;r++){const l=o[r],c=l.isEllipseCurve?e*2:l.isLineCurve||l.isLineCurve3?1:l.isSplineCurve?e*l.points.length:e,h=l.getPoints(c);for(let d=0;d<h.length;d++){const p=h[d];n&&n.equals(p)||(t.push(p),n=p)}}return this.autoClose&&t.length>1&&!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;t<n;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this.cacheLengths=null,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const r=e.curves[t];this.curves.push(new Xf[r.type]().fromJSON(r))}return this.cacheLengths=null,this}}class Hc extends k3{constructor(e){super(),this.type="Path",this.currentPoint=new ue,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new gg(this.currentPoint.clone(),new ue(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){const o=new vg(this.currentPoint.clone(),new ue(e,t),new ue(n,r));return this.curves.push(o),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,o,l){const c=new mg(this.currentPoint.clone(),new ue(e,t),new ue(n,r),new ue(o,l));return this.curves.push(c),this.currentPoint.set(o,l),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new xg(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,o,l){const c=this.currentPoint.x,h=this.currentPoint.y;return this.absarc(e+c,t+h,n,r,o,l),this}absarc(e,t,n,r,o,l){return this.absellipse(e,t,n,n,r,o,l),this}ellipse(e,t,n,r,o,l,c,h){const d=this.currentPoint.x,p=this.currentPoint.y;return this.absellipse(e+d,t+p,n,r,o,l,c,h),this}absellipse(e,t,n,r,o,l,c,h){const d=new bd(e,t,n,r,o,l,c,h);if(this.curves.length>0){const g=d.getPoint(0);g.equals(this.currentPoint)||this.lineTo(g.x,g.y)}this.curves.push(d);const p=d.getPoint(1);return this.currentPoint.copy(p),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 iu extends Hc{constructor(e){super(e),this.uuid=ms(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const r=e.holes[t];this.holes.push(new Hc().fromJSON(r))}return this}}function uE(i,e,t=2){const n=e&&e.length,r=n?e[0]*t:i.length;let o=H3(i,0,r,t,!0);const l=[];if(!o||o.next===o.prev)return l;let c,h,d;if(n&&(o=mE(i,e,o,t)),i.length>80*t){c=i[0],h=i[1];let p=c,g=h;for(let v=t;v<r;v+=t){const _=i[v],y=i[v+1];_<c&&(c=_),y<h&&(h=y),_>p&&(p=_),y>g&&(g=y)}d=Math.max(p-c,g-h),d=d!==0?32767/d:0}return Vc(o,l,t,c,h,d,0),l}function H3(i,e,t,n,r){let o;if(r===EE(i,e,t,n)>0)for(let l=e;l<t;l+=n)o=px(l/n|0,i[l],i[l+1],o);else for(let l=t-n;l>=e;l-=n)o=px(l/n|0,i[l],i[l+1],o);return o&&gl(o,o.next)&&(Wc(o),o=o.next),o}function ja(i,e){if(!i)return i;e||(e=i);let t=i,n;do if(n=!1,!t.steiner&&(gl(t,t.next)||wn(t.prev,t,t.next)===0)){if(Wc(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Vc(i,e,t,n,r,o,l){if(!i)return;!l&&o&&yE(i,n,r,o);let c=i;for(;i.prev!==i.next;){const h=i.prev,d=i.next;if(o?fE(i,n,r,o):hE(i)){e.push(h.i,i.i,d.i),Wc(i),i=d.next,c=d.next;continue}if(i=d,i===c){l?l===1?(i=dE(ja(i),e),Vc(i,e,t,n,r,o,2)):l===2&&pE(i,e,t,n,r,o):Vc(ja(i),e,t,n,r,o,1);break}}}function hE(i){const e=i.prev,t=i,n=i.next;if(wn(e,t,n)>=0)return!1;const r=e.x,o=t.x,l=n.x,c=e.y,h=t.y,d=n.y,p=Math.min(r,o,l),g=Math.min(c,h,d),v=Math.max(r,o,l),_=Math.max(c,h,d);let y=n.next;for(;y!==e;){if(y.x>=p&&y.x<=v&&y.y>=g&&y.y<=_&&fc(r,c,o,h,l,d,y.x,y.y)&&wn(y.prev,y,y.next)>=0)return!1;y=y.next}return!0}function fE(i,e,t,n){const r=i.prev,o=i,l=i.next;if(wn(r,o,l)>=0)return!1;const c=r.x,h=o.x,d=l.x,p=r.y,g=o.y,v=l.y,_=Math.min(c,h,d),y=Math.min(p,g,v),w=Math.max(c,h,d),b=Math.max(p,g,v),S=Em(_,y,e,t,n),M=Em(w,b,e,t,n);let A=i.prevZ,E=i.nextZ;for(;A&&A.z>=S&&E&&E.z<=M;){if(A.x>=_&&A.x<=w&&A.y>=y&&A.y<=b&&A!==r&&A!==l&&fc(c,p,h,g,d,v,A.x,A.y)&&wn(A.prev,A,A.next)>=0||(A=A.prevZ,E.x>=_&&E.x<=w&&E.y>=y&&E.y<=b&&E!==r&&E!==l&&fc(c,p,h,g,d,v,E.x,E.y)&&wn(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;A&&A.z>=S;){if(A.x>=_&&A.x<=w&&A.y>=y&&A.y<=b&&A!==r&&A!==l&&fc(c,p,h,g,d,v,A.x,A.y)&&wn(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;E&&E.z<=M;){if(E.x>=_&&E.x<=w&&E.y>=y&&E.y<=b&&E!==r&&E!==l&&fc(c,p,h,g,d,v,E.x,E.y)&&wn(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function dE(i,e){let t=i;do{const n=t.prev,r=t.next.next;!gl(n,r)&&G3(n,t,t.next,r)&&Gc(n,r)&&Gc(r,n)&&(e.push(n.i,t.i,r.i),Wc(t),Wc(t.next),t=i=r),t=t.next}while(t!==i);return ja(t)}function pE(i,e,t,n,r,o){let l=i;do{let c=l.next.next;for(;c!==l.prev;){if(l.i!==c.i&&ME(l,c)){let h=W3(l,c);l=ja(l,l.next),h=ja(h,h.next),Vc(l,e,t,n,r,o,0),Vc(h,e,t,n,r,o,0);return}c=c.next}l=l.next}while(l!==i)}function mE(i,e,t,n){const r=[];for(let o=0,l=e.length;o<l;o++){const c=e[o]*n,h=o<l-1?e[o+1]*n:i.length,d=H3(i,c,h,n,!1);d===d.next&&(d.steiner=!0),r.push(bE(d))}r.sort(gE);for(let o=0;o<r.length;o++)t=vE(r[o],t);return t}function gE(i,e){let t=i.x-e.x;if(t===0&&(t=i.y-e.y,t===0)){const n=(i.next.y-i.y)/(i.next.x-i.x),r=(e.next.y-e.y)/(e.next.x-e.x);t=n-r}return t}function vE(i,e){const t=_E(i,e);if(!t)return e;const n=W3(t,i);return ja(n,n.next),ja(t,t.next)}function _E(i,e){let t=e;const n=i.x,r=i.y;let o=-1/0,l;if(gl(i,t))return t;do{if(gl(i,t.next))return t.next;if(r<=t.y&&r>=t.next.y&&t.next.y!==t.y){const g=t.x+(r-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(g<=n&&g>o&&(o=g,l=t.x<t.next.x?t:t.next,g===n))return l}t=t.next}while(t!==e);if(!l)return null;const c=l,h=l.x,d=l.y;let p=1/0;t=l;do{if(n>=t.x&&t.x>=h&&n!==t.x&&V3(r<d?n:o,r,h,d,r<d?o:n,r,t.x,t.y)){const g=Math.abs(r-t.y)/(n-t.x);Gc(t,i)&&(g<p||g===p&&(t.x>l.x||t.x===l.x&&xE(l,t)))&&(l=t,p=g)}t=t.next}while(t!==c);return l}function xE(i,e){return wn(i.prev,i,e.prev)<0&&wn(e.next,i,i.next)<0}function yE(i,e,t,n){let r=i;do r.z===0&&(r.z=Em(r.x,r.y,e,t,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,SE(r)}function SE(i){let e,t=1;do{let n=i,r;i=null;let o=null;for(e=0;n;){e++;let l=n,c=0;for(let d=0;d<t&&(c++,l=l.nextZ,!!l);d++);let h=t;for(;c>0||h>0&&l;)c!==0&&(h===0||!l||n.z<=l.z)?(r=n,n=n.nextZ,c--):(r=l,l=l.nextZ,h--),o?o.nextZ=r:i=r,r.prevZ=o,o=r;n=l}o.nextZ=null,t*=2}while(e>1);return i}function Em(i,e,t,n,r){return i=(i-t)*r|0,e=(e-n)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function bE(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function V3(i,e,t,n,r,o,l,c){return(r-l)*(e-c)>=(i-l)*(o-c)&&(i-l)*(n-c)>=(t-l)*(e-c)&&(t-l)*(o-c)>=(r-l)*(n-c)}function fc(i,e,t,n,r,o,l,c){return!(i===l&&e===c)&&V3(i,e,t,n,r,o,l,c)}function ME(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!wE(i,e)&&(Gc(i,e)&&Gc(e,i)&&TE(i,e)&&(wn(i.prev,i,e.prev)||wn(i,e.prev,e))||gl(i,e)&&wn(i.prev,i,i.next)>0&&wn(e.prev,e,e.next)>0)}function wn(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function gl(i,e){return i.x===e.x&&i.y===e.y}function G3(i,e,t,n){const r=Bh(wn(i,e,t)),o=Bh(wn(i,e,n)),l=Bh(wn(t,n,i)),c=Bh(wn(t,n,e));return!!(r!==o&&l!==c||r===0&&Oh(i,t,e)||o===0&&Oh(i,n,e)||l===0&&Oh(t,i,n)||c===0&&Oh(t,e,n))}function Oh(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function Bh(i){return i>0?1:i<0?-1:0}function wE(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&G3(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Gc(i,e){return wn(i.prev,i,i.next)<0?wn(i,e,i.next)>=0&&wn(i,i.prev,e)>=0:wn(i,e,i.prev)<0||wn(i,i.next,e)<0}function TE(i,e){let t=i,n=!1;const r=(i.x+e.x)/2,o=(i.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&r<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==i);return n}function W3(i,e){const t=Am(i.i,i.x,i.y),n=Am(e.i,e.x,e.y),r=i.next,o=e.prev;return i.next=e,e.prev=i,t.next=r,r.prev=t,n.next=t,t.prev=n,o.next=n,n.prev=o,n}function px(i,e,t,n){const r=Am(i,e,t);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Wc(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Am(i,e,t){return{i,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function EE(i,e,t,n){let r=0;for(let o=e,l=t-n;o<t;o+=n)r+=(i[l]-i[o])*(i[o+1]+i[l+1]),l=o;return r}class AE{static triangulate(e,t,n=2){return uE(e,t,n)}}class Ls{static area(e){const t=e.length;let n=0;for(let r=t-1,o=0;o<t;r=o++)n+=e[r].x*e[o].y-e[o].x*e[r].y;return n*.5}static isClockWise(e){return Ls.area(e)<0}static triangulateShape(e,t){const n=[],r=[],o=[];mx(e),gx(n,e);let l=e.length;t.forEach(mx);for(let h=0;h<t.length;h++)r.push(l),l+=t[h].length,gx(n,t[h]);const c=AE.triangulate(n,r);for(let h=0;h<c.length;h+=3)o.push(c.slice(h,h+3));return o}}function mx(i){const e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function gx(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}class Md extends bt{constructor(e=new iu([new ue(.5,.5),new ue(-.5,.5),new ue(-.5,-.5),new ue(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,r=[],o=[];for(let c=0,h=e.length;c<h;c++){const d=e[c];l(d)}this.setAttribute("position",new Je(r,3)),this.setAttribute("uv",new Je(o,2)),this.computeVertexNormals();function l(c){const h=[],d=t.curveSegments!==void 0?t.curveSegments:12,p=t.steps!==void 0?t.steps:1,g=t.depth!==void 0?t.depth:1;let v=t.bevelEnabled!==void 0?t.bevelEnabled:!0,_=t.bevelThickness!==void 0?t.bevelThickness:.2,y=t.bevelSize!==void 0?t.bevelSize:_-.1,w=t.bevelOffset!==void 0?t.bevelOffset:0,b=t.bevelSegments!==void 0?t.bevelSegments:3;const S=t.extrudePath,M=t.UVGenerator!==void 0?t.UVGenerator:CE;let A,E=!1,N,P,T,C;if(S){A=S.getSpacedPoints(p),E=!0,v=!1;const de=S.isCatmullRomCurve3?S.closed:!1;N=S.computeFrenetFrames(p,de),P=new O,T=new O,C=new O}v||(b=0,_=0,y=0,w=0);const F=c.extractPoints(d);let D=F.shape;const B=F.holes;if(!Ls.isClockWise(D)){D=D.reverse();for(let de=0,we=B.length;de<we;de++){const ye=B[de];Ls.isClockWise(ye)&&(B[de]=ye.reverse())}}function Z(de){const ye=10000000000000001e-36;let ke=de[0];for(let Ne=1;Ne<=de.length;Ne++){const ht=Ne%de.length,$e=de[ht],mt=$e.x-ke.x,Tt=$e.y-ke.y,Ft=mt*mt+Tt*Tt,G=Math.max(Math.abs($e.x),Math.abs($e.y),Math.abs(ke.x),Math.abs(ke.y)),un=ye*G*G;if(Ft<=un){de.splice(ht,1),Ne--;continue}ke=$e}}Z(D),B.forEach(Z);const z=B.length,X=D;for(let de=0;de<z;de++){const we=B[de];D=D.concat(we)}function Q(de,we,ye){return we||it("ExtrudeGeometry: vec does not exist"),de.clone().addScaledVector(we,ye)}const q=D.length;function fe(de,we,ye){let ke,Ne,ht;const $e=de.x-we.x,mt=de.y-we.y,Tt=ye.x-de.x,Ft=ye.y-de.y,G=$e*$e+mt*mt,un=$e*Ft-mt*Tt;if(Math.abs(un)>Number.EPSILON){const vt=Math.sqrt(G),xt=Math.sqrt(Tt*Tt+Ft*Ft),Re=we.x-mt/vt,hn=we.y+$e/vt,st=ye.x-Ft/xt,ot=ye.y+Tt/xt,U=((st-Re)*Ft-(ot-hn)*Tt)/($e*Ft-mt*Tt);ke=Re+$e*U-de.x,Ne=hn+mt*U-de.y;const I=ke*ke+Ne*Ne;if(I<=2)return new ue(ke,Ne);ht=Math.sqrt(I/2)}else{let vt=!1;$e>Number.EPSILON?Tt>Number.EPSILON&&(vt=!0):$e<-Number.EPSILON?Tt<-Number.EPSILON&&(vt=!0):Math.sign(mt)===Math.sign(Ft)&&(vt=!0),vt?(ke=-mt,Ne=$e,ht=Math.sqrt(G)):(ke=$e,Ne=mt,ht=Math.sqrt(G/2))}return new ue(ke/ht,Ne/ht)}const Y=[];for(let de=0,we=X.length,ye=we-1,ke=de+1;de<we;de++,ye++,ke++)ye===we&&(ye=0),ke===we&&(ke=0),Y[de]=fe(X[de],X[ye],X[ke]);const he=[];let pe,We=Y.concat();for(let de=0,we=z;de<we;de++){const ye=B[de];pe=[];for(let ke=0,Ne=ye.length,ht=Ne-1,$e=ke+1;ke<Ne;ke++,ht++,$e++)ht===Ne&&(ht=0),$e===Ne&&($e=0),pe[ke]=fe(ye[ke],ye[ht],ye[$e]);he.push(pe),We=We.concat(pe)}let qe;if(b===0)qe=Ls.triangulateShape(X,B);else{const de=[],we=[];for(let ye=0;ye<b;ye++){const ke=ye/b,Ne=_*Math.cos(ke*Math.PI/2),ht=y*Math.sin(ke*Math.PI/2)+w;for(let $e=0,mt=X.length;$e<mt;$e++){const Tt=Q(X[$e],Y[$e],ht);tt(Tt.x,Tt.y,-Ne),ke===0&&de.push(Tt)}for(let $e=0,mt=z;$e<mt;$e++){const Tt=B[$e];pe=he[$e];const Ft=[];for(let G=0,un=Tt.length;G<un;G++){const vt=Q(Tt[G],pe[G],ht);tt(vt.x,vt.y,-Ne),ke===0&&Ft.push(vt)}ke===0&&we.push(Ft)}}qe=Ls.triangulateShape(de,we)}const ie=qe.length,xe=y+w;for(let de=0;de<q;de++){const we=v?Q(D[de],We[de],xe):D[de];E?(T.copy(N.normals[0]).multiplyScalar(we.x),P.copy(N.binormals[0]).multiplyScalar(we.y),C.copy(A[0]).add(T).add(P),tt(C.x,C.y,C.z)):tt(we.x,we.y,0)}for(let de=1;de<=p;de++)for(let we=0;we<q;we++){const ye=v?Q(D[we],We[we],xe):D[we];E?(T.copy(N.normals[de]).multiplyScalar(ye.x),P.copy(N.binormals[de]).multiplyScalar(ye.y),C.copy(A[de]).add(T).add(P),tt(C.x,C.y,C.z)):tt(ye.x,ye.y,g/p*de)}for(let de=b-1;de>=0;de--){const we=de/b,ye=_*Math.cos(we*Math.PI/2),ke=y*Math.sin(we*Math.PI/2)+w;for(let Ne=0,ht=X.length;Ne<ht;Ne++){const $e=Q(X[Ne],Y[Ne],ke);tt($e.x,$e.y,g+ye)}for(let Ne=0,ht=B.length;Ne<ht;Ne++){const $e=B[Ne];pe=he[Ne];for(let mt=0,Tt=$e.length;mt<Tt;mt++){const Ft=Q($e[mt],pe[mt],ke);E?tt(Ft.x,Ft.y+A[p-1].y,A[p-1].x+ye):tt(Ft.x,Ft.y,g+ye)}}}Be(),et();function Be(){const de=r.length/3;if(v){let we=0,ye=q*we;for(let ke=0;ke<ie;ke++){const Ne=qe[ke];kt(Ne[2]+ye,Ne[1]+ye,Ne[0]+ye)}we=p+b*2,ye=q*we;for(let ke=0;ke<ie;ke++){const Ne=qe[ke];kt(Ne[0]+ye,Ne[1]+ye,Ne[2]+ye)}}else{for(let we=0;we<ie;we++){const ye=qe[we];kt(ye[2],ye[1],ye[0])}for(let we=0;we<ie;we++){const ye=qe[we];kt(ye[0]+q*p,ye[1]+q*p,ye[2]+q*p)}}n.addGroup(de,r.length/3-de,0)}function et(){const de=r.length/3;let we=0;Ce(X,we),we+=X.length;for(let ye=0,ke=B.length;ye<ke;ye++){const Ne=B[ye];Ce(Ne,we),we+=Ne.length}n.addGroup(de,r.length/3-de,1)}function Ce(de,we){let ye=de.length;for(;--ye>=0;){const ke=ye;let Ne=ye-1;Ne<0&&(Ne=de.length-1);for(let ht=0,$e=p+b*2;ht<$e;ht++){const mt=q*ht,Tt=q*(ht+1),Ft=we+ke+mt,G=we+Ne+mt,un=we+Ne+Tt,vt=we+ke+Tt;at(Ft,G,un,vt)}}}function tt(de,we,ye){h.push(de),h.push(we),h.push(ye)}function kt(de,we,ye){yt(de),yt(we),yt(ye);const ke=r.length/3,Ne=M.generateTopUV(n,r,ke-3,ke-2,ke-1);pt(Ne[0]),pt(Ne[1]),pt(Ne[2])}function at(de,we,ye,ke){yt(de),yt(we),yt(ke),yt(we),yt(ye),yt(ke);const Ne=r.length/3,ht=M.generateSideWallUV(n,r,Ne-6,Ne-3,Ne-2,Ne-1);pt(ht[0]),pt(ht[1]),pt(ht[3]),pt(ht[1]),pt(ht[2]),pt(ht[3])}function yt(de){r.push(h[de*3+0]),r.push(h[de*3+1]),r.push(h[de*3+2])}function pt(de){o.push(de.x),o.push(de.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return RE(t,n,e)}static fromJSON(e,t){const n=[];for(let o=0,l=e.shapes.length;o<l;o++){const c=t[e.shapes[o]];n.push(c)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new Xf[r.type]().fromJSON(r)),new Md(n,e.options)}}const CE={generateTopUV:function(i,e,t,n,r){const o=e[t*3],l=e[t*3+1],c=e[n*3],h=e[n*3+1],d=e[r*3],p=e[r*3+1];return[new ue(o,l),new ue(c,h),new ue(d,p)]},generateSideWallUV:function(i,e,t,n,r,o){const l=e[t*3],c=e[t*3+1],h=e[t*3+2],d=e[n*3],p=e[n*3+1],g=e[n*3+2],v=e[r*3],_=e[r*3+1],y=e[r*3+2],w=e[o*3],b=e[o*3+1],S=e[o*3+2];return Math.abs(c-p)<Math.abs(l-d)?[new ue(l,1-h),new ue(d,1-g),new ue(v,1-y),new ue(w,1-S)]:[new ue(c,1-h),new ue(p,1-g),new ue(_,1-y),new ue(b,1-S)]}};function RE(i,e,t){if(t.shapes=[],Array.isArray(i))for(let n=0,r=i.length;n<r;n++){const o=i[n];t.shapes.push(o.uuid)}else t.shapes.push(i.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class wd extends sa{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2,r=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,o,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new wd(e.radius,e.detail)}}class Td extends bt{constructor(e=[new ue(0,-.5),new ue(.5,0),new ue(0,.5)],t=12,n=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:r},t=Math.floor(t),r=ft(r,0,Math.PI*2);const o=[],l=[],c=[],h=[],d=[],p=1/t,g=new O,v=new ue,_=new O,y=new O,w=new O;let b=0,S=0;for(let M=0;M<=e.length-1;M++)switch(M){case 0:b=e[M+1].x-e[M].x,S=e[M+1].y-e[M].y,_.x=S*1,_.y=-b,_.z=S*0,w.copy(_),_.normalize(),h.push(_.x,_.y,_.z);break;case e.length-1:w.normalize(),h.push(w.x,w.y,w.z);break;default:b=e[M+1].x-e[M].x,S=e[M+1].y-e[M].y,_.x=S*1,_.y=-b,_.z=S*0,y.copy(_),_.x+=w.x,_.y+=w.y,_.z+=w.z,_.normalize(),h.push(_.x,_.y,_.z),w.copy(y)}for(let M=0;M<=t;M++){const A=n+M*p*r,E=Math.sin(A),N=Math.cos(A);for(let P=0;P<=e.length-1;P++){g.x=e[P].x*E,g.y=e[P].y,g.z=e[P].x*N,l.push(g.x,g.y,g.z),v.x=M/t,v.y=P/(e.length-1),c.push(v.x,v.y);const T=h[3*P+0]*E,C=h[3*P+1],F=h[3*P+0]*N;d.push(T,C,F)}}for(let M=0;M<t;M++)for(let A=0;A<e.length-1;A++){const E=A+M*e.length,N=E,P=E+e.length,T=E+e.length+1,C=E+1;o.push(N,P,C),o.push(T,C,P)}this.setIndex(o),this.setAttribute("position",new Je(l,3)),this.setAttribute("uv",new Je(c,2)),this.setAttribute("normal",new Je(d,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Td(e.points,e.segments,e.phiStart,e.phiLength)}}class su extends sa{constructor(e=1,t=0){const n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(n,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new su(e.radius,e.detail)}}class yl extends bt{constructor(e=1,t=1,n=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:r};const o=e/2,l=t/2,c=Math.floor(n),h=Math.floor(r),d=c+1,p=h+1,g=e/c,v=t/h,_=[],y=[],w=[],b=[];for(let S=0;S<p;S++){const M=S*v-l;for(let A=0;A<d;A++){const E=A*g-o;y.push(E,-M,0),w.push(0,0,1),b.push(A/c),b.push(1-S/h)}}for(let S=0;S<h;S++)for(let M=0;M<c;M++){const A=M+d*S,E=M+d*(S+1),N=M+1+d*(S+1),P=M+1+d*S;_.push(A,E,P),_.push(E,N,P)}this.setIndex(_),this.setAttribute("position",new Je(y,3)),this.setAttribute("normal",new Je(w,3)),this.setAttribute("uv",new Je(b,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new yl(e.width,e.height,e.widthSegments,e.heightSegments)}}class Ed extends bt{constructor(e=.5,t=1,n=32,r=1,o=0,l=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:r,thetaStart:o,thetaLength:l},n=Math.max(3,n),r=Math.max(1,r);const c=[],h=[],d=[],p=[];let g=e;const v=(t-e)/r,_=new O,y=new ue;for(let w=0;w<=r;w++){for(let b=0;b<=n;b++){const S=o+b/n*l;_.x=g*Math.cos(S),_.y=g*Math.sin(S),h.push(_.x,_.y,_.z),d.push(0,0,1),y.x=(_.x/t+1)/2,y.y=(_.y/t+1)/2,p.push(y.x,y.y)}g+=v}for(let w=0;w<r;w++){const b=w*(n+1);for(let S=0;S<n;S++){const M=S+b,A=M,E=M+n+1,N=M+n+2,P=M+1;c.push(A,E,P),c.push(E,N,P)}}this.setIndex(c),this.setAttribute("position",new Je(h,3)),this.setAttribute("normal",new Je(d,3)),this.setAttribute("uv",new Je(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ed(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Ad extends bt{constructor(e=new iu([new ue(0,.5),new ue(-.5,-.5),new ue(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],r=[],o=[],l=[];let c=0,h=0;if(Array.isArray(e)===!1)d(e);else for(let p=0;p<e.length;p++)d(e[p]),this.addGroup(c,h,p),c+=h,h=0;this.setIndex(n),this.setAttribute("position",new Je(r,3)),this.setAttribute("normal",new Je(o,3)),this.setAttribute("uv",new Je(l,2));function d(p){const g=r.length/3,v=p.extractPoints(t);let _=v.shape;const y=v.holes;Ls.isClockWise(_)===!1&&(_=_.reverse());for(let b=0,S=y.length;b<S;b++){const M=y[b];Ls.isClockWise(M)===!0&&(y[b]=M.reverse())}const w=Ls.triangulateShape(_,y);for(let b=0,S=y.length;b<S;b++){const M=y[b];_=_.concat(M)}for(let b=0,S=_.length;b<S;b++){const M=_[b];r.push(M.x,M.y,0),o.push(0,0,1),l.push(M.x,M.y)}for(let b=0,S=w.length;b<S;b++){const M=w[b],A=M[0]+g,E=M[1]+g,N=M[2]+g;n.push(A,E,N),h+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return IE(t,e)}static fromJSON(e,t){const n=[];for(let r=0,o=e.shapes.length;r<o;r++){const l=t[e.shapes[r]];n.push(l)}return new Ad(n,e.curveSegments)}}function IE(i,e){if(e.shapes=[],Array.isArray(i))for(let t=0,n=i.length;t<n;t++){const r=i[t];e.shapes.push(r.uuid)}else e.shapes.push(i.uuid);return e}class ru extends bt{constructor(e=1,t=32,n=16,r=0,o=Math.PI*2,l=0,c=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:o,thetaStart:l,thetaLength:c},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const h=Math.min(l+c,Math.PI);let d=0;const p=[],g=new O,v=new O,_=[],y=[],w=[],b=[];for(let S=0;S<=n;S++){const M=[],A=S/n,E=l+A*c,N=e*Math.cos(E),P=Math.sqrt(e*e-N*N);let T=0;S===0&&l===0?T=.5/t:S===n&&h===Math.PI&&(T=-.5/t);for(let C=0;C<=t;C++){const F=C/t,D=r+F*o;g.x=-P*Math.cos(D),g.y=N,g.z=P*Math.sin(D),y.push(g.x,g.y,g.z),v.copy(g).normalize(),w.push(v.x,v.y,v.z),b.push(F+T,1-A),M.push(d++)}p.push(M)}for(let S=0;S<n;S++)for(let M=0;M<t;M++){const A=p[S][M+1],E=p[S][M],N=p[S+1][M],P=p[S+1][M+1];(S!==0||l>0)&&_.push(A,E,P),(S!==n-1||h<Math.PI)&&_.push(E,N,P)}this.setIndex(_),this.setAttribute("position",new Je(y,3)),this.setAttribute("normal",new Je(w,3)),this.setAttribute("uv",new Je(b,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ru(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class Cd extends sa{constructor(e=1,t=0){const n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(n,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Cd(e.radius,e.detail)}}class Rd extends bt{constructor(e=1,t=.4,n=12,r=48,o=Math.PI*2,l=0,c=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:o,thetaStart:l,thetaLength:c},n=Math.floor(n),r=Math.floor(r);const h=[],d=[],p=[],g=[],v=new O,_=new O,y=new O;for(let w=0;w<=n;w++){const b=l+w/n*c;for(let S=0;S<=r;S++){const M=S/r*o;_.x=(e+t*Math.cos(b))*Math.cos(M),_.y=(e+t*Math.cos(b))*Math.sin(M),_.z=t*Math.sin(b),d.push(_.x,_.y,_.z),v.x=e*Math.cos(M),v.y=e*Math.sin(M),y.subVectors(_,v).normalize(),p.push(y.x,y.y,y.z),g.push(S/r),g.push(w/n)}}for(let w=1;w<=n;w++)for(let b=1;b<=r;b++){const S=(r+1)*w+b-1,M=(r+1)*(w-1)+b-1,A=(r+1)*(w-1)+b,E=(r+1)*w+b;h.push(S,M,E),h.push(M,A,E)}this.setIndex(h),this.setAttribute("position",new Je(d,3)),this.setAttribute("normal",new Je(p,3)),this.setAttribute("uv",new Je(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Rd(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc,e.thetaStart,e.thetaLength)}}class Id extends bt{constructor(e=1,t=.4,n=64,r=8,o=2,l=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:r,p:o,q:l},n=Math.floor(n),r=Math.floor(r);const c=[],h=[],d=[],p=[],g=new O,v=new O,_=new O,y=new O,w=new O,b=new O,S=new O;for(let A=0;A<=n;++A){const E=A/n*o*Math.PI*2;M(E,o,l,e,_),M(E+.01,o,l,e,y),b.subVectors(y,_),S.addVectors(y,_),w.crossVectors(b,S),S.crossVectors(w,b),w.normalize(),S.normalize();for(let N=0;N<=r;++N){const P=N/r*Math.PI*2,T=-t*Math.cos(P),C=t*Math.sin(P);g.x=_.x+(T*S.x+C*w.x),g.y=_.y+(T*S.y+C*w.y),g.z=_.z+(T*S.z+C*w.z),h.push(g.x,g.y,g.z),v.subVectors(g,_).normalize(),d.push(v.x,v.y,v.z),p.push(A/n),p.push(N/r)}}for(let A=1;A<=n;A++)for(let E=1;E<=r;E++){const N=(r+1)*(A-1)+(E-1),P=(r+1)*A+(E-1),T=(r+1)*A+E,C=(r+1)*(A-1)+E;c.push(N,P,C),c.push(P,T,C)}this.setIndex(c),this.setAttribute("position",new Je(h,3)),this.setAttribute("normal",new Je(d,3)),this.setAttribute("uv",new Je(p,2));function M(A,E,N,P,T){const C=Math.cos(A),F=Math.sin(A),D=N/E*A,B=Math.cos(D);T.x=P*(2+B)*.5*C,T.y=P*(2+B)*F*.5,T.z=P*Math.sin(D)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Id(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class Pd extends bt{constructor(e=new _g(new O(-1,-1,0),new O(-1,1,0),new O(1,1,0)),t=64,n=1,r=8,o=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:r,closed:o};const l=e.computeFrenetFrames(t,o);this.tangents=l.tangents,this.normals=l.normals,this.binormals=l.binormals;const c=new O,h=new O,d=new ue;let p=new O;const g=[],v=[],_=[],y=[];w(),this.setIndex(y),this.setAttribute("position",new Je(g,3)),this.setAttribute("normal",new Je(v,3)),this.setAttribute("uv",new Je(_,2));function w(){for(let A=0;A<t;A++)b(A);b(o===!1?t:0),M(),S()}function b(A){p=e.getPointAt(A/t,p);const E=l.normals[A],N=l.binormals[A];for(let P=0;P<=r;P++){const T=P/r*Math.PI*2,C=Math.sin(T),F=-Math.cos(T);h.x=F*E.x+C*N.x,h.y=F*E.y+C*N.y,h.z=F*E.z+C*N.z,h.normalize(),v.push(h.x,h.y,h.z),c.x=p.x+n*h.x,c.y=p.y+n*h.y,c.z=p.z+n*h.z,g.push(c.x,c.y,c.z)}}function S(){for(let A=1;A<=t;A++)for(let E=1;E<=r;E++){const N=(r+1)*(A-1)+(E-1),P=(r+1)*A+(E-1),T=(r+1)*A+E,C=(r+1)*(A-1)+E;y.push(N,P,C),y.push(P,T,C)}}function M(){for(let A=0;A<=t;A++)for(let E=0;E<=r;E++)d.x=A/t,d.y=E/r,_.push(d.x,d.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new Pd(new Xf[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class X3 extends bt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],n=new Set,r=new O,o=new O;if(e.index!==null){const l=e.attributes.position,c=e.index;let h=e.groups;h.length===0&&(h=[{start:0,count:c.count,materialIndex:0}]);for(let d=0,p=h.length;d<p;++d){const g=h[d],v=g.start,_=g.count;for(let y=v,w=v+_;y<w;y+=3)for(let b=0;b<3;b++){const S=c.getX(y+b),M=c.getX(y+(b+1)%3);r.fromBufferAttribute(l,S),o.fromBufferAttribute(l,M),vx(r,o,n)===!0&&(t.push(r.x,r.y,r.z),t.push(o.x,o.y,o.z))}}}else{const l=e.attributes.position;for(let c=0,h=l.count/3;c<h;c++)for(let d=0;d<3;d++){const p=3*c+d,g=3*c+(d+1)%3;r.fromBufferAttribute(l,p),o.fromBufferAttribute(l,g),vx(r,o,n)===!0&&(t.push(r.x,r.y,r.z),t.push(o.x,o.y,o.z))}}this.setAttribute("position",new Je(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function vx(i,e,t){const n=`${i.x},${i.y},${i.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${i.x},${i.y},${i.z}`;return t.has(n)===!0||t.has(r)===!0?!1:(t.add(n),t.add(r),!0)}var _x=Object.freeze({__proto__:null,BoxGeometry:Ka,CapsuleGeometry:xd,CircleGeometry:yd,ConeGeometry:nu,CylinderGeometry:tu,DodecahedronGeometry:Sd,EdgesGeometry:U3,ExtrudeGeometry:Md,IcosahedronGeometry:wd,LatheGeometry:Td,OctahedronGeometry:su,PlaneGeometry:yl,PolyhedronGeometry:sa,RingGeometry:Ed,ShapeGeometry:Ad,SphereGeometry:ru,TetrahedronGeometry:Cd,TorusGeometry:Rd,TorusKnotGeometry:Id,TubeGeometry:Pd,WireframeGeometry:X3});class q3 extends Gn{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Ge(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}function vl(i){const e={};for(const t in i){e[t]={};for(const n in i[t]){const r=i[t][n];if(xx(r))r.isRenderTargetTexture?(Fe("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=r.clone();else if(Array.isArray(r))if(xx(r[0])){const o=[];for(let l=0,c=r.length;l<c;l++)o[l]=r[l].clone();e[t][n]=o}else e[t][n]=r.slice();else e[t][n]=r}}return e}function bi(i){const e={};for(let t=0;t<i.length;t++){const n=vl(i[t]);for(const r in n)e[r]=n[r]}return e}function xx(i){return i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)}function PE(i){const e=[];for(let t=0;t<i.length;t++)e.push(i[t].clone());return e}function $3(i){const e=i.getRenderTarget();return e===null?i.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:Lt.workingColorSpace}const Y3={clone:vl,merge:bi};var LE=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,NE=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class Qn extends Gn{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=LE,this.fragmentShader=NE,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=vl(e.uniforms),this.uniformsGroups=PE(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const l=this.uniforms[r].value;l&&l.isTexture?t.uniforms[r]={type:"t",value:l.toJSON(e).uuid}:l&&l.isColor?t.uniforms[r]={type:"c",value:l.getHex()}:l&&l.isVector2?t.uniforms[r]={type:"v2",value:l.toArray()}:l&&l.isVector3?t.uniforms[r]={type:"v3",value:l.toArray()}:l&&l.isVector4?t.uniforms[r]={type:"v4",value:l.toArray()}:l&&l.isMatrix3?t.uniforms[r]={type:"m3",value:l.toArray()}:l&&l.isMatrix4?t.uniforms[r]={type:"m4",value:l.toArray()}:t.uniforms[r]={value:l}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const r in this.extensions)this.extensions[r]===!0&&(n[r]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}fromJSON(e,t){if(super.fromJSON(e,t),e.uniforms!==void 0)for(const n in e.uniforms){const r=e.uniforms[n];switch(this.uniforms[n]={},r.type){case"t":this.uniforms[n].value=t[r.value]||null;break;case"c":this.uniforms[n].value=new Ge().setHex(r.value);break;case"v2":this.uniforms[n].value=new ue().fromArray(r.value);break;case"v3":this.uniforms[n].value=new O().fromArray(r.value);break;case"v4":this.uniforms[n].value=new Kt().fromArray(r.value);break;case"m3":this.uniforms[n].value=new _t().fromArray(r.value);break;case"m4":this.uniforms[n].value=new gt().fromArray(r.value);break;default:this.uniforms[n].value=r.value}}if(e.defines!==void 0&&(this.defines=e.defines),e.vertexShader!==void 0&&(this.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(this.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(this.glslVersion=e.glslVersion),e.extensions!==void 0)for(const n in e.extensions)this.extensions[n]=e.extensions[n];return e.lights!==void 0&&(this.lights=e.lights),e.clipping!==void 0&&(this.clipping=e.clipping),this}}class yg extends Qn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Sg extends Gn{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Ge(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wr,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ns,this.envMapIntensity=1,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.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,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.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,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 Z3 extends Sg{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ue(1,1),this.clearcoatNormalMap=null,this.diffuseRoughnessMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return ft(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessMinimum=100,this.iridescenceThicknessMaximum=400,this.iridescenceThicknessMap=null,this.sheenColor=new Ge(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Ge(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Ge(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._diffuseRoughness=0,this._dispersion=0,this._iridescence=0,this._retroreflectivity=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=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 diffuseRoughness(){return this._diffuseRoughness}set diffuseRoughness(e){this._diffuseRoughness>0!=e>0&&this.version++,this._diffuseRoughness=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 retroreflectivity(){return this._retroreflectivity}set retroreflectivity(e){this._retroreflectivity>0!=e>0&&this.version++,this._retroreflectivity=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}get iridescenceThicknessRange(){return xr('MeshPhysicalMaterial: The "iridescenceThicknessRange" property has been replaced by "iridescenceThicknessMinimum" and "iridescenceThicknessMaximum".'),[this.iridescenceThicknessMinimum,this.iridescenceThicknessMaximum]}set iridescenceThicknessRange(e){xr('MeshPhysicalMaterial: The "iridescenceThicknessRange" property has been replaced by "iridescenceThicknessMinimum" and "iridescenceThicknessMaximum".'),this.iridescenceThicknessMinimum=e[0],this.iridescenceThicknessMaximum=e[1]}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.diffuseRoughness=e.diffuseRoughness,this.diffuseRoughnessMap=e.diffuseRoughnessMap,this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessMinimum=e.iridescenceThicknessMinimum,this.iridescenceThicknessMaximum=e.iridescenceThicknessMaximum,this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.retroreflectivity=e.retroreflectivity,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 j3 extends Gn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ge(16777215),this.specular=new Ge(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wr,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ns,this.combine=Jc,this.reflectivity=1,this.envMapIntensity=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.envMapIntensity=e.envMapIntensity,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 J3 extends Gn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ge(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wr,this.normalScale=new ue(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 bg extends Gn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wr,this.normalScale=new ue(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 K3 extends Gn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ge(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wr,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ns,this.combine=Jc,this.reflectivity=1,this.envMapIntensity=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.envMapIntensity=e.envMapIntensity,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 Mg extends Gn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ia,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 wg extends Gn{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}}class Q3 extends Gn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ge(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wr,this.normalScale=new ue(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class eS extends vi{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 Cs(i,e){return!i||i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)}function rl(i){return i!==void 0&&i.inTangents!==void 0&&i.outTangents!==void 0}function tS(i){function e(r,o){return i[r]-i[o]}const t=i.length,n=new Array(t);for(let r=0;r!==t;++r)n[r]=r;return n.sort(e),n}function Cm(i,e,t){const n=i.length,r=new i.constructor(n);for(let o=0,l=0;l!==n;++o){const c=t[o]*e;for(let h=0;h!==e;++h)r[l++]=i[c+h]}return r}function nS(i,e,t,n){let r=1,o=i[0];for(;o!==void 0&&o[n]===void 0;)o=i[r++];if(o===void 0)return;let l=o[n];if(l!==void 0)if(Array.isArray(l))do l=o[n],l!==void 0&&(e.push(o.time),t.push(...l)),o=i[r++];while(o!==void 0);else if(l.toArray!==void 0)do l=o[n],l!==void 0&&(e.push(o.time),l.toArray(t,t.length)),o=i[r++];while(o!==void 0);else do l=o[n],l!==void 0&&(e.push(o.time),t.push(l)),o=i[r++];while(o!==void 0)}function DE(i,e,t,n,r=30){const o=i.clone();o.name=e;const l=[];for(let h=0;h<o.tracks.length;++h){const d=o.tracks[h],p=d.getValueSize(),g=[],v=[];for(let _=0;_<d.times.length;++_){const y=d.times[_]*r;if(!(y<t||y>=n)){g.push(d.times[_]);for(let w=0;w<p;++w)v.push(d.values[_*p+w])}}g.length!==0&&(d.times=Cs(g,d.times.constructor),d.values=Cs(v,d.values.constructor),l.push(d))}o.tracks=l;let c=1/0;for(let h=0;h<o.tracks.length;++h)c>o.tracks[h].times[0]&&(c=o.tracks[h].times[0]);for(let h=0;h<o.tracks.length;++h)o.tracks[h].shift(-1*c);return o.resetDuration(),o}function UE(i,e=0,t=i,n=30){n<=0&&(n=30);const r=t.tracks.length,o=e/n;for(let l=0;l<r;++l){const c=t.tracks[l],h=c.ValueTypeName;if(h==="bool"||h==="string")continue;const d=i.tracks.find(function(S){return S.name===c.name&&S.ValueTypeName===h});if(d===void 0)continue;let p=0;const g=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(p=g/3);let v=0;const _=d.getValueSize();d.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(v=_/3);const y=c.times.length-1;let w;if(o<=c.times[0]){const S=p,M=g-p;w=c.values.slice(S,M)}else if(o>=c.times[y]){const S=y*g+p,M=S+g-p;w=c.values.slice(S,M)}else{const S=c.createInterpolant();S.evaluate(o),w=S.resultBuffer.slice()}h==="quaternion"&&new wi().fromArray(w).normalize().conjugate().toArray(w);const b=d.times.length;for(let S=0;S<b;++S){const M=S*_+v;if(h==="quaternion")wi.multiplyQuaternionsFlat(d.values,M,w,0,d.values,M);else{const A=_-v*2;for(let E=0;E<A;++E)d.values[M+E]-=w[E]}}}return i.blendMode=tg,i}class FE{static convertArray(e,t){return Cs(e,t)}static isTypedArray(e){return y3(e)}static hasTangents(e){return rl(e)}static getKeyframeOrder(e){return tS(e)}static sortedArray(e,t,n){return Cm(e,t,n)}static flattenJSON(e,t,n,r){nS(e,t,n,r)}static subclip(e,t,n,r,o=30){return DE(e,t,n,r,o)}static makeClipAdditive(e,t=0,n=e,r=30){return UE(e,t,n,r)}}class Sl{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,r=t[n],o=t[n-1];e:{t:{let l;n:{i:if(!(e<r)){for(let c=n+2;;){if(r===void 0){if(e<o)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===c)break;if(o=r,r=t[++n],e<r)break t}l=t.length;break n}if(!(e>=o)){const c=t[1];e<c&&(n=2,o=c);for(let h=n-2;;){if(o===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===h)break;if(r=o,o=t[--n-1],e>=o)break t}l=n,n=0;break n}break e}for(;n<l;){const c=n+l>>>1;e<t[c]?l=c:n=c+1}if(r=t[n],o=t[n-1],o===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,o,r)}return this.interpolate_(n,o,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,r=this.valueSize,o=e*r;for(let l=0;l!==r;++l)t[l]=n[o+l];return t}interpolate_(){throw new Error("THREE.Interpolant: Call to abstract method.")}intervalChanged_(){}}class iS extends Sl{constructor(e,t,n,r){super(e,t,n,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:za,endingEnd:za}}intervalChanged_(e,t,n){const r=this.parameterPositions;let o=e-2,l=e+1,c=r[o],h=r[l];if(c===void 0)switch(this.getSettings_().endingStart){case ka:o=e,c=2*t-n;break;case Fc:o=r.length-2,c=t+r[o]-r[o+1];break;default:o=e,c=n}if(h===void 0)switch(this.getSettings_().endingEnd){case ka:l=e,h=2*n-t;break;case Fc:l=1,h=n+r[1]-r[0];break;default:l=e-1,h=t}const d=(n-t)*.5,p=this.valueSize;this._weightPrev=d/(t-c),this._weightNext=d/(h-n),this._offsetPrev=o*p,this._offsetNext=l*p}interpolate_(e,t,n,r){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=e*c,d=h-c,p=this._offsetPrev,g=this._offsetNext,v=this._weightPrev,_=this._weightNext,y=(n-t)/(r-t),w=y*y,b=w*y,S=-v*b+2*v*w-v*y,M=(1+v)*b+(-1.5-2*v)*w+(-.5+v)*y+1,A=(-1-_)*b+(1.5+_)*w+.5*y,E=_*b-_*w;for(let N=0;N!==c;++N)o[N]=S*l[p+N]+M*l[d+N]+A*l[h+N]+E*l[g+N];return o}}class Tg extends Sl{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=e*c,d=h-c,p=(n-t)/(r-t),g=1-p;for(let v=0;v!==c;++v)o[v]=l[d+v]*g+l[h+v]*p;return o}}class sS extends Sl{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class rS extends Sl{interpolate_(e,t,n,r){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=e*c,d=h-c,p=this.inTangents,g=this.outTangents;if(!p||!g){const y=(n-t)/(r-t),w=1-y;for(let b=0;b!==c;++b)o[b]=l[d+b]*w+l[h+b]*y;return o}const v=c*2,_=e-1;for(let y=0;y!==c;++y){const w=l[d+y],b=l[h+y],S=_*v+y*2,M=g[S],A=g[S+1],E=e*v+y*2,N=p[E],P=p[E+1],T=BE(n,t,M,N,r);o[y]=aS(T,w,A,P,b)}return o}}function aS(i,e,t,n,r){const o=1-i;return o*o*o*e+3*o*o*i*t+3*o*i*i*n+i*i*i*r}function OE(i,e,t,n,r){const o=1-i;return 3*o*o*(t-e)+6*o*i*(n-t)+3*i*i*(r-n)}function BE(i,e,t,n,r){let o=(i-e)/(r-e);for(let l=0;l<8;l++){const c=aS(o,e,t,n,r)-i;if(Math.abs(c)<1e-10)break;const h=OE(o,e,t,n,r);if(Math.abs(h)<1e-10)break;o=Math.max(0,Math.min(1,o-c/h))}return o}class gs{constructor(e,t,n,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Cs(t,this.TimeBufferType),this.values=Cs(n,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Cs(e.times,Array),values:Cs(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r),rl(e.settings)&&(n.settings={inTangents:Cs(e.settings.inTangents,Array),outTangents:Cs(e.settings.outTangents,Array)})}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new sS(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Tg(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new iS(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const t=new rS(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.inTangents=this.settings.inTangents,t.outTangents=this.settings.outTangents),t}setInterpolation(e){let t;switch(e){case Uc:t=this.InterpolantFactoryMethodDiscrete;break;case Hf:t=this.InterpolantFactoryMethodLinear;break;case Qh:t=this.InterpolantFactoryMethodSmooth;break;case Mm:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Fe("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Uc;case this.InterpolantFactoryMethodLinear:return Hf;case this.InterpolantFactoryMethodSmooth:return Qh;case this.InterpolantFactoryMethodBezier:return Mm}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]+=e;rl(this.settings)&&(yx(this.settings.inTangents,e),yx(this.settings.outTangents,e))}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,r=t.length;n!==r;++n)t[n]*=e;rl(this.settings)&&(Sx(this.settings.inTangents,e),Sx(this.settings.outTangents,e))}return this}trim(e,t){const n=this.times,r=n.length;let o=0,l=r-1;for(;o!==r&&n[o]<e;)++o;for(;l!==-1&&n[l]>t;)--l;if(++l,o!==0||l!==r){o>=l&&(l=Math.max(l,1),o=l-1);const c=this.getValueSize();this.times=n.slice(o,l),this.values=this.values.slice(o*c,l*c)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(it("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,r=this.values,o=n.length;o===0&&(it("KeyframeTrack: Track is empty.",this),e=!1);let l=null;for(let c=0;c!==o;c++){const h=n[c];if(typeof h=="number"&&isNaN(h)){it("KeyframeTrack: Time is not a valid number.",this,c,h),e=!1;break}if(l!==null&&l>h){it("KeyframeTrack: Out of order keys.",this,c,h,l),e=!1;break}l=h}if(r!==void 0&&y3(r))for(let c=0,h=r.length;c!==h;++c){const d=r[c];if(isNaN(d)){it("KeyframeTrack: Value is not a valid number.",this,c,d),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===Qh,o=e.length-1;let l=1;for(let c=1;c<o;++c){let h=!1;const d=e[c],p=e[c+1];if(d!==p&&(c!==1||d!==e[0]))if(r)h=!0;else{const g=c*n,v=g-n,_=g+n;for(let y=0;y!==n;++y){const w=t[g+y];if(w!==t[v+y]||w!==t[_+y]){h=!0;break}}}if(h){if(c!==l){e[l]=e[c];const g=c*n,v=l*n;for(let _=0;_!==n;++_)t[v+_]=t[g+_]}++l}}if(o>0){e[l]=e[o];for(let c=o*n,h=l*n,d=0;d!==n;++d)t[h+d]=t[c+d];++l}return l!==e.length?(this.times=e.slice(0,l),this.values=t.slice(0,l*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,rl(this.settings)&&(r.settings={inTangents:this.settings.inTangents.slice(),outTangents:this.settings.outTangents.slice()}),r}}function yx(i,e){for(let t=0,n=i.length;t!==n;t+=2)i[t]+=e}function Sx(i,e){for(let t=0,n=i.length;t!==n;t+=2)i[t]*=e}gs.prototype.ValueTypeName="";gs.prototype.TimeBufferType=Float32Array;gs.prototype.ValueBufferType=Float32Array;gs.prototype.DefaultInterpolation=Hf;class Qa extends gs{constructor(e,t,n){super(e,t,n)}}Qa.prototype.ValueTypeName="bool";Qa.prototype.ValueBufferType=Array;Qa.prototype.DefaultInterpolation=Uc;Qa.prototype.InterpolantFactoryMethodLinear=void 0;Qa.prototype.InterpolantFactoryMethodSmooth=void 0;class Eg extends gs{constructor(e,t,n,r){super(e,t,n,r)}}Eg.prototype.ValueTypeName="color";class Ld extends gs{constructor(e,t,n,r){super(e,t,n,r)}}Ld.prototype.ValueTypeName="number";class oS extends Sl{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,h=(n-t)/(r-t);let d=e*c;for(let p=d+c;d!==p;d+=4)wi.slerpFlat(o,0,l,d-c,l,d,h);return o}}class Nd extends gs{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new oS(this.times,this.values,this.getValueSize(),e)}}Nd.prototype.ValueTypeName="quaternion";Nd.prototype.InterpolantFactoryMethodSmooth=void 0;class eo extends gs{constructor(e,t,n){super(e,t,n)}}eo.prototype.ValueTypeName="string";eo.prototype.ValueBufferType=Array;eo.prototype.DefaultInterpolation=Uc;eo.prototype.InterpolantFactoryMethodLinear=void 0;eo.prototype.InterpolantFactoryMethodSmooth=void 0;class Ag extends gs{constructor(e,t,n,r){super(e,t,n,r)}}Ag.prototype.ValueTypeName="vector";class Xc{constructor(e="",t=-1,n=[],r=cd){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=ms(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,r=1/(e.fps||1);for(let l=0,c=n.length;l!==c;++l)t.push(kE(n[l]).scale(r));const o=new this(e.name,e.duration,t,e.blendMode);return o.uuid=e.uuid,o.userData=JSON.parse(e.userData||"{}"),o}static toJSON(e){const t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let o=0,l=n.length;o!==l;++o)t.push(gs.toJSON(n[o]));return r}static CreateFromMorphTargetSequence(e,t,n,r){const o=t.length,l=[];for(let c=0;c<o;c++){let h=[],d=[];h.push((c+o-1)%o,c,(c+1)%o),d.push(0,1,0);const p=tS(h);h=Cm(h,1,p),d=Cm(d,1,p),!r&&h[0]===0&&(h.push(o),d.push(d[0])),l.push(new Ld(".morphTargetInfluences["+t[c].name+"]",h,d).scale(1/n))}return new this(e,-1,l)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const r=e;n=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const r={},o=/^([\w-]*?)([\d]+)$/;for(let c=0,h=e.length;c<h;c++){const d=e[c],p=d.name.match(o);if(p&&p.length>1){const g=p[1];let v=r[g];v||(r[g]=v=[]),v.push(d)}}const l=[];for(const c in r)l.push(this.CreateFromMorphTargetSequence(c,r[c],t,n));return l}resetDuration(){const e=this.tracks;let t=0;for(let n=0,r=e.length;n!==r;++n){const o=this.tracks[n];t=Math.max(t,o.times[o.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function zE(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ld;case"vector":case"vector2":case"vector3":case"vector4":return Ag;case"color":return Eg;case"quaternion":return Nd;case"bool":case"boolean":return Qa;case"string":return eo}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function kE(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=zE(i.type);if(i.times===void 0){const n=[],r=[];nS(i.keys,n,r,"value"),i.times=n,i.values=r}let t;return e.parse!==void 0?t=e.parse(i):t=new e(i.name,i.times,i.values,i.interpolation),rl(i.settings)&&(t.settings={inTangents:Cs(i.settings.inTangents,Float32Array),outTangents:Cs(i.settings.outTangents,Float32Array)}),t}const Ks={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(bx(i)||(this.files[i]=e))},get:function(i){if(this.enabled!==!1&&!bx(i))return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}};function bx(i){try{const e=i.slice(i.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class Cg{constructor(e,t,n){const r=this;let o=!1,l=0,c=0,h;const d=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(p){c++,o===!1&&r.onStart!==void 0&&r.onStart(p,l,c),o=!0},this.itemEnd=function(p){l++,r.onProgress!==void 0&&r.onProgress(p,l,c),l===c&&(o=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(p){r.onError!==void 0&&r.onError(p)},this.resolveURL=function(p){return p=p.normalize("NFC"),h?h(p):p},this.setURLModifier=function(p){return h=p,this},this.addHandler=function(p,g){return d.push(p,g),this},this.removeHandler=function(p){const g=d.indexOf(p);return g!==-1&&d.splice(g,2),this},this.getHandler=function(p){for(let g=0,v=d.length;g<v;g+=2){const _=d[g],y=d[g+1];if(_.global&&(_.lastIndex=0),_.test(p))return y}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const lS=new Cg;class zi{constructor(e){this.manager=e!==void 0?e:lS,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},this.priority="auto",this.cache="default",typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){const n=this;return new Promise(function(r,o){n.load(e,r,t,o)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}setPriority(e){return this.priority=e,this}setCache(e){return this.cache=e,this}abort(){return this}}zi.DEFAULT_MATERIAL_NAME="__DEFAULT";const mr={};class HE extends Error{constructor(e,t){super(e),this.response=t}}class Er extends zi{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=Ks.get(`file:${e}`);if(o!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(o),this.manager.itemEnd(e)},0);return}if(mr[e]!==void 0){mr[e].push({onLoad:t,onProgress:n,onError:r});return}mr[e]=[],mr[e].push({onLoad:t,onProgress:n,onError:r});const l=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",priority:this.priority,cache:this.cache,signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),c=this.mimeType,h=this.responseType;fetch(l).then(d=>{if(d.status===200||d.status===0){if(d.status===0&&Fe("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||d.body===void 0||d.body.getReader===void 0)return d;const p=mr[e],g=d.body.getReader(),v=d.headers.get("X-File-Size")||d.headers.get("Content-Length"),_=v?parseInt(v):0,y=_!==0;let w=0;const b=new ReadableStream({start(S){M();function M(){g.read().then(({done:A,value:E})=>{if(A)S.close();else{w+=E.byteLength;const N=new ProgressEvent("progress",{lengthComputable:y,loaded:w,total:_});for(let P=0,T=p.length;P<T;P++){const C=p[P];C.onProgress&&C.onProgress(N)}S.enqueue(E),M()}},A=>{S.error(A)})}}});return new Response(b)}else throw new HE(`fetch for "${d.url}" responded with ${d.status}: ${d.statusText}`,d)}).then(d=>{switch(h){case"arraybuffer":return d.arrayBuffer();case"blob":return d.blob();case"document":return d.text().then(p=>new DOMParser().parseFromString(p,c));case"json":return d.json();default:if(c==="")return d.text();{const g=/charset="?([^;"\s]*)"?/i.exec(c),v=g&&g[1]?g[1].toLowerCase():void 0,_=new TextDecoder(v);return d.arrayBuffer().then(y=>_.decode(y))}}}).then(d=>{Ks.add(`file:${e}`,d);const p=mr[e];delete mr[e];for(let g=0,v=p.length;g<v;g++){const _=p[g];_.onLoad&&_.onLoad(d)}}).catch(d=>{const p=mr[e];if(p===void 0)throw this.manager.itemError(e),d;delete mr[e];for(let g=0,v=p.length;g<v;g++){const _=p[g];_.onError&&_.onError(d)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class VE extends zi{constructor(e){super(e)}load(e,t,n,r){const o=this,l=new Er(this.manager);l.setPriority(this.priority),l.setCache(this.cache),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){r?r(h):it(h),o.manager.itemError(e)}},n,r)}parse(e){const t=[];for(let n=0;n<e.length;n++){const r=Xc.parse(e[n]);t.push(r)}return t}}class GE extends zi{constructor(e){super(e)}load(e,t,n,r){const o=this,l=[],c=new _d,h=new Er(this.manager);h.setPriority(this.priority),h.setCache(this.cache),h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(o.withCredentials);let d=0;function p(g){h.load(e[g],function(v){const _=o.parse(v,!0);l[g]={width:_.width,height:_.height,format:_.format,mipmaps:_.mipmaps},d+=1,d===6&&(_.mipmapCount===1&&(c.minFilter=an),c.image=l,c.format=_.format,c.needsUpdate=!0,t&&t(c))},n,r)}if(Array.isArray(e))for(let g=0,v=e.length;g<v;++g)p(g);else h.load(e,function(g){const v=o.parse(g,!0);if(v.isCubemap){const _=v.mipmaps.length/v.mipmapCount;for(let y=0;y<_;y++){l[y]={mipmaps:[]};for(let w=0;w<v.mipmapCount;w++)l[y].mipmaps.push(v.mipmaps[y*v.mipmapCount+w]),l[y].format=v.format,l[y].width=v.width,l[y].height=v.height}c.image=l}else c.image.width=v.width,c.image.height=v.height,c.mipmaps=v.mipmaps;v.mipmapCount===1&&(c.minFilter=an),c.format=v.format,c.needsUpdate=!0,t&&t(c)},n,r);return c}}const Zo=new WeakMap;class qc extends zi{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=Ks.get(`image:${e}`);if(l!==void 0){if(l.complete===!0)o.manager.itemStart(e),setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0);else{let g=Zo.get(l);g===void 0&&(g=[],Zo.set(l,g)),g.push({onLoad:t,onError:r})}return l}const c=Bc("img");function h(){p(),t&&t(this);const g=Zo.get(this)||[];for(let v=0;v<g.length;v++){const _=g[v];_.onLoad&&_.onLoad(this)}Zo.delete(this),o.manager.itemEnd(e)}function d(g){p(),r&&r(g),Ks.remove(`image:${e}`);const v=Zo.get(this)||[];for(let _=0;_<v.length;_++){const y=v[_];y.onError&&y.onError(g)}Zo.delete(this),o.manager.itemError(e),o.manager.itemEnd(e)}function p(){c.removeEventListener("load",h,!1),c.removeEventListener("error",d,!1)}return c.addEventListener("load",h,!1),c.addEventListener("error",d,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(c.crossOrigin=this.crossOrigin),Ks.add(`image:${e}`,c),o.manager.itemStart(e),c.fetchPriority=this.priority,c.src=e,c}}class WE extends zi{constructor(e){super(e)}load(e,t,n,r){const o=new eu;o.colorSpace=Zt;const l=new qc(this.manager);l.setPriority(this.priority),l.setCache(this.cache),l.setCrossOrigin(this.crossOrigin),l.setPath(this.path);let c=0;function h(d){l.load(e[d],function(p){o.images[d]=p,c++,c===6&&(o.needsUpdate=!0,t&&t(o))},void 0,r)}for(let d=0;d<e.length;++d)h(d);return o}}class XE extends zi{constructor(e){super(e)}load(e,t,n,r){const o=this,l=new fs,c=new Er(this.manager);return c.setPriority(this.priority),c.setCache(this.cache),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setPath(this.path),c.setWithCredentials(o.withCredentials),c.load(e,function(h){let d;try{d=o.parse(h)}catch(p){r!==void 0?r(p):it(p);return}o._applyTexData(l,d),t&&t(l,d)},n,r),l}createDataTexture(e){const t=new fs;return this._applyTexData(t,this.parse(e)),t}_applyTexData(e,t){t.image!==void 0?e.image=t.image:t.data!==void 0&&(e.image.width=t.width,e.image.height=t.height,e.image.data=t.data),e.wrapS=t.wrapS!==void 0?t.wrapS:Fi,e.wrapT=t.wrapT!==void 0?t.wrapT:Fi,e.magFilter=t.magFilter!==void 0?t.magFilter:an,e.minFilter=t.minFilter!==void 0?t.minFilter:an,e.anisotropy=t.anisotropy!==void 0?t.anisotropy:1,t.colorSpace!==void 0&&(e.colorSpace=t.colorSpace),t.flipY!==void 0&&(e.flipY=t.flipY),t.format!==void 0&&(e.format=t.format),t.type!==void 0&&(e.type=t.type),t.mipmaps!==void 0&&(e.mipmaps=t.mipmaps,e.minFilter=Ps),t.mipmapCount===1&&(e.minFilter=an),t.generateMipmaps!==void 0&&(e.generateMipmaps=t.generateMipmaps),e.needsUpdate=!0}}class qE extends zi{constructor(e){super(e)}load(e,t,n,r){const o=new pn,l=new qc(this.manager);return l.setPriority(this.priority),l.setCache(this.cache),l.setCrossOrigin(this.crossOrigin),l.setPath(this.path),l.load(e,function(c){o.image=c,o.needsUpdate=!0,t!==void 0&&t(o)},n,r),o}}class ra extends Wt{static registerNode(e){this.prototype._lightNode=e}constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Ge(e),this.intensity=t}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class cS extends ra{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Wt.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Ge(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const Q0=new gt,Mx=new O,wx=new O;class Dd{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ue(512,512),this.mapType=Mn,this.map=null,this.mapPass=null,this.matrix=new gt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Za,this._frameExtents=new ue(1,1),this._viewportCount=1,this._viewports=[new Kt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getCamera(){return this.camera}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera;Mx.setFromMatrixPosition(e.matrixWorld),t.position.copy(Mx),wx.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(wx),t.updateMatrixWorld(),this._updateMatrix(t,this.matrix,this._frustum)}_updateMatrix(e,t,n,r){Q0.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),n.setFromProjectionMatrix(Q0,e.coordinateSystem,e.reversedDepth);const o=this._frameExtents,l=r?r.z/o.x:1,c=r?r.w/o.y:1,h=r?r.x/o.x:0,d=r?r.y/o.y:0;e.coordinateSystem===$a||e.reversedDepth?t.set(.5*l,0,0,.5*l+h,0,.5*c,0,.5*c+d,0,0,1,0,0,0,0,1):t.set(.5*l,0,0,.5*l+h,0,.5*c,0,.5*c+d,0,0,.5,.5,0,0,0,1),t.multiply(Q0)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.mapType=e.mapType,this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return e.intensity=this.intensity,e.bias=this.bias,e.normalBias=this.normalBias,e.radius=this.radius,e.blurSamples=this.blurSamples,e.mapSize=this.mapSize.toArray(),e.mapType=this.mapType,e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const zh=new O,kh=new wi,$s=new O;class Ud extends Wt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new gt,this.projectionMatrix=new gt,this.projectionMatrixInverse=new gt,this.coordinateSystem=Ki,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(zh,kh,$s),$s.x===1&&$s.y===1&&$s.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(zh,kh,$s.set(1,1,1)).invert()}updateWorldMatrix(e,t,n=!1){super.updateWorldMatrix(e,t,n),this.matrixWorld.decompose(zh,kh,$s),$s.x===1&&$s.y===1&&$s.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(zh,kh,$s.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const Zr=new O,Tx=new ue,Ex=new ue;class Kn extends Ud{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=dl*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ga*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return dl*2*Math.atan(Math.tan(Ga*.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){Zr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Zr.x,Zr.y).multiplyScalar(-e/Zr.z),Zr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Zr.x,Zr.y).multiplyScalar(-e/Zr.z)}getViewSize(e,t){return this.getViewBounds(e,Tx,Ex),t.subVectors(Ex,Tx)}setViewOffset(e,t,n,r,o,l){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=r,this.view.width=o,this.view.height=l,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Ga*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,o=-.5*r;const l=this.view;if(this.view!==null&&this.view.enabled){const h=l.fullWidth,d=l.fullHeight;o+=l.offsetX*r/h,t-=l.offsetY*n/d,r*=l.width/h,n*=l.height/d}const c=this.filmOffset;c!==0&&(o+=e*c/this.getFilmWidth()),this.projectionMatrix.makePerspective(o,o+r,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class $E extends Dd{constructor(){super(new Kn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=dl*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,o=e.distance||t.far;(n!==t.fov||r!==t.aspect||o!==t.far)&&(t.fov=n,t.aspect=r,t.far=o,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this.aspect=e.aspect,this}toJSON(){const e=super.toJSON();return e.focus=this.focus,e.aspect=this.aspect,e}}class uS extends ra{constructor(e,t,n=0,r=Math.PI/3,o=0,l=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Wt.DEFAULT_UP),this.updateMatrix(),this.target=new Wt,this.distance=n,this.angle=r,this.penumbra=o,this.decay=l,this.map=null,this.shadow=new $E}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class YE extends Dd{constructor(){super(new Kn(90,1,.5,500)),this.isPointLightShadow=!0}}class hS extends ra{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=r,this.shadow=new YE}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class bl extends Ud{constructor(e=-1,t=1,n=1,r=-1,o=.1,l=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=r,this.near=o,this.far=l,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,r,o,l){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=r,this.view.width=o,this.view.height=l,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,r=(this.top+this.bottom)/2;let o=n-e,l=n+e,c=r+t,h=r-t;if(this.view!==null&&this.view.enabled){const d=(this.right-this.left)/this.view.fullWidth/this.zoom,p=(this.top-this.bottom)/this.view.fullHeight/this.zoom;o+=d*this.view.offsetX,l=o+d*this.view.width,c-=p*this.view.offsetY,h=c-p*this.view.height}this.projectionMatrix.makeOrthographic(o,l,c,h,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class ZE extends Dd{constructor(){super(new bl(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class fS extends ra{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Wt.DEFAULT_UP),this.updateMatrix(),this.target=new Wt,this.shadow=new ZE}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class dS extends ra{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class pS extends ra{constructor(e,t,n=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Rg{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new O)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,r=e.y,o=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.282095),t.addScaledVector(l[1],.488603*r),t.addScaledVector(l[2],.488603*o),t.addScaledVector(l[3],.488603*n),t.addScaledVector(l[4],1.092548*(n*r)),t.addScaledVector(l[5],1.092548*(r*o)),t.addScaledVector(l[6],.315392*(3*o*o-1)),t.addScaledVector(l[7],1.092548*(n*o)),t.addScaledVector(l[8],.546274*(n*n-r*r)),t}getIrradianceAt(e,t){const n=e.x,r=e.y,o=e.z,l=this.coefficients;return t.copy(l[0]).multiplyScalar(.886227),t.addScaledVector(l[1],2*.511664*r),t.addScaledVector(l[2],2*.511664*o),t.addScaledVector(l[3],2*.511664*n),t.addScaledVector(l[4],2*.429043*n*r),t.addScaledVector(l[5],2*.429043*r*o),t.addScaledVector(l[6],.743125*o*o-.247708),t.addScaledVector(l[7],2*.429043*n*o),t.addScaledVector(l[8],.429043*(n*n-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const n=e.x,r=e.y,o=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*o,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*o,t[6]=.315392*(3*o*o-1),t[7]=1.092548*n*o,t[8]=.546274*(n*n-r*r)}}class mS extends ra{constructor(e=new Rg,t=1){super(void 0,t),this.isLightProbe=!0,this.type="LightProbe",this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}const Ax={};class Fd extends zi{constructor(e){super(e),this.textures={}}load(e,t,n,r){const o=this,l=new Er(o.manager);l.setPriority(o.priority),l.setCache(o.cache),l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){r?r(h):it(h),o.manager.itemError(e)}},n,r)}parse(e){const t=this.createMaterialFromType(e.type);return t.fromJSON(e,this.textures),t}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Fd.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:q3,SpriteMaterial:cg,RawShaderMaterial:yg,ShaderMaterial:Qn,PointsMaterial:hg,MeshPhysicalMaterial:Z3,MeshStandardMaterial:Sg,MeshPhongMaterial:j3,MeshToonMaterial:J3,MeshNormalMaterial:bg,MeshLambertMaterial:K3,MeshDepthMaterial:Mg,MeshDistanceMaterial:wg,MeshBasicMaterial:Ja,MeshMatcapMaterial:Q3,LineDashedMaterial:eS,LineBasicMaterial:vi,Material:Gn,...Ax}[e];let r;return n===void 0?(xr(`MaterialLoader: Unknown material type "${e}". Use .registerMaterial() before starting the deserialization process.`),r=new Gn):r=new n,r}static registerMaterial(e,t){Ax[e]=t}}class Rm{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class gS extends bt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class vS extends zi{constructor(e){super(e)}load(e,t,n,r){const o=this,l=new Er(o.manager);l.setPriority(o.priority),l.setCache(o.cache),l.setPath(o.path),l.setRequestHeader(o.requestHeader),l.setWithCredentials(o.withCredentials),l.load(e,function(c){try{t(o.parse(JSON.parse(c)))}catch(h){r?r(h):it(h),o.manager.itemError(e)}},n,r)}parse(e){const t={},n={};function r(_,y){if(t[y]!==void 0)return t[y];const b=_.interleavedBuffers[y],S=o(_,b.buffer),M=il(b.type,S),A=new gd(M,b.stride);return A.uuid=b.uuid,b.usage!==void 0&&A.setUsage(b.usage),t[y]=A,A}function o(_,y){if(n[y]!==void 0)return n[y];const b=_.arrayBuffers[y],S=new Uint32Array(b).buffer;return n[y]=S,S}const l=e.isInstancedBufferGeometry?new gS:new bt,c=e.data.index;if(c!==void 0){const _=il(c.type,c.array);l.setIndex(new on(_,1))}const h=e.data.attributes;for(const _ in h){const y=h[_];let w;if(y.isInterleavedBufferAttribute){const b=r(e.data,y.data);w=new Ya(b,y.itemSize,y.offset,y.normalized)}else{const b=il(y.type,y.array),S=y.isInstancedBufferAttribute?ml:on;w=new S(b,y.itemSize,y.normalized)}y.name!==void 0&&(w.name=y.name),y.usage!==void 0&&w.setUsage(y.usage),y.gpuType!==void 0&&(w.gpuType=y.gpuType),l.setAttribute(_,w)}const d=e.data.morphAttributes;if(d)for(const _ in d){const y=d[_],w=[];for(let b=0,S=y.length;b<S;b++){const M=y[b];let A;if(M.isInterleavedBufferAttribute){const E=r(e.data,M.data);A=new Ya(E,M.itemSize,M.offset,M.normalized)}else{const E=il(M.type,M.array);A=new on(E,M.itemSize,M.normalized)}M.name!==void 0&&(A.name=M.name),M.usage!==void 0&&A.setUsage(M.usage),M.gpuType!==void 0&&(A.gpuType=M.gpuType),w.push(A)}l.morphAttributes[_]=w}e.data.morphTargetsRelative&&(l.morphTargetsRelative=!0);const g=e.data.groups||e.data.drawcalls||e.data.offsets;if(g!==void 0)for(let _=0,y=g.length;_!==y;++_){const w=g[_];l.addGroup(w.start,w.count,w.materialIndex)}const v=e.data.boundingSphere;return v!==void 0&&(l.boundingSphere=new li().fromJSON(v)),e.name&&(l.name=e.name),e.userData&&(l.userData=e.userData),l}}const em={};class jE extends zi{constructor(e){super(e)}load(e,t,n,r){const o=this,l=this.path===""?Rm.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||l;const c=new Er(this.manager);c.setPriority(this.priority),c.setCache(this.cache),c.setPath(this.path),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(h){let d=null;try{d=JSON.parse(h)}catch(g){r!==void 0&&r(g),it("ObjectLoader: Can't parse "+e+".",g.message);return}const p=d.metadata;if(p===void 0||p.type===void 0||p.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),it("ObjectLoader: Can't load "+e);return}o.parse(d,t)},n,r)}async loadAsync(e,t){const n=this,r=this.path===""?Rm.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const o=new Er(this.manager);o.setPriority(this.priority),o.setCache(this.cache),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials);const l=await o.loadAsync(e,t);let c;try{c=JSON.parse(l)}catch(d){throw new Error("THREE.ObjectLoader: Can't parse "+e+". "+d.message)}const h=c.metadata;if(h===void 0||h.type===void 0||h.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await n.parseAsync(c)}parse(e,t){const n=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),o=this.parseGeometries(e.geometries,r),l=this.parseImages(e.images,function(){t!==void 0&&t(d)}),c=this.parseTextures(e.textures,l),h=this.parseMaterials(e.materials,c),d=this.parseObject(e.object,o,h,c,n),p=this.parseSkeletons(e.skeletons,d);if(this.bindSkeletons(d,p),this.bindLightTargets(d),t!==void 0){let g=!1;for(const v in l)if(l[v].data instanceof HTMLImageElement){g=!0;break}g===!1&&t(d)}return d}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,n),o=await this.parseImagesAsync(e.images),l=this.parseTextures(e.textures,o),c=this.parseMaterials(e.materials,l),h=this.parseObject(e.object,r,c,l,t),d=this.parseSkeletons(e.skeletons,h);return this.bindSkeletons(h,d),this.bindLightTargets(h),h}static registerGeometry(e,t){em[e]=t}parseShapes(e){const t={};if(e!==void 0)for(let n=0,r=e.length;n<r;n++){const o=new iu().fromJSON(e[n]);t[o.uuid]=o}return t}parseSkeletons(e,t){const n={},r={};if(t.traverse(function(o){o.isBone&&(r[o.uuid]=o)}),e!==void 0)for(let o=0,l=e.length;o<l;o++){const c=new vd().fromJSON(e[o],r);n[c.uuid]=c}return n}parseGeometries(e,t){const n={};if(e!==void 0){const r=new vS;for(let o=0,l=e.length;o<l;o++){let c;const h=e[o];switch(h.type){case"BufferGeometry":case"InstancedBufferGeometry":c=r.parse(h);break;default:h.type in _x?c=_x[h.type].fromJSON(h,t):h.type in em?c=em[h.type].fromJSON(h,t):Fe(`ObjectLoader: Unknown geometry type "${h.type}". Use .registerGeometry() before starting the deserialization process.`)}c.uuid=h.uuid,h.name!==void 0&&(c.name=h.name),h.userData!==void 0&&(c.userData=h.userData),n[h.uuid]=c}}return n}parseMaterials(e,t){const n={},r={};if(e!==void 0){const o=new Fd;o.setTextures(t);for(let l=0,c=e.length;l<c;l++){const h=e[l];n[h.uuid]===void 0&&(n[h.uuid]=o.parse(h)),r[h.uuid]=n[h.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let n=0;n<e.length;n++){const r=e[n],o=Xc.parse(r);t[o.uuid]=o}return t}parseImages(e,t){const n=this,r={};let o;function l(h){return h=n.manager.resolveURL(h),n.manager.itemStart(h),o.load(h,function(){n.manager.itemEnd(h)},void 0,function(){n.manager.itemError(h),n.manager.itemEnd(h)})}function c(h){if(typeof h=="string"){const d=h,p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(d)?d:n.resourcePath+d;return l(p)}else return h.data?{data:il(h.type,h.data),width:h.width,height:h.height}:null}if(e!==void 0&&e.length>0){const h=new Cg(t);o=new qc(h),o.setPriority(this.priority),o.setCache(this.cache),o.setCrossOrigin(this.crossOrigin);for(let d=0,p=e.length;d<p;d++){const g=e[d],v=g.url;if(Array.isArray(v)){const _=[];for(let y=0,w=v.length;y<w;y++){const b=v[y],S=c(b);S!==null&&(S instanceof HTMLImageElement?_.push(S):_.push(new fs(S.data,S.width,S.height)))}r[g.uuid]=new Js(_)}else{const _=c(g.url);r[g.uuid]=new Js(_)}}}return r}async parseImagesAsync(e){const t=this,n={};let r;async function o(l){if(typeof l=="string"){const c=l,h=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:t.resourcePath+c;return await r.loadAsync(h)}else return l.data?{data:il(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){r=new qc(this.manager),r.setPriority(this.priority),r.setCache(this.cache),r.setCrossOrigin(this.crossOrigin);for(let l=0,c=e.length;l<c;l++){const h=e[l],d=h.url;if(Array.isArray(d)){const p=[];for(let g=0,v=d.length;g<v;g++){const _=d[g],y=await o(_);y!==null&&(y instanceof HTMLImageElement?p.push(y):p.push(new fs(y.data,y.width,y.height)))}n[h.uuid]=new Js(p)}else{const p=await o(h.url);n[h.uuid]=new Js(p)}}}return n}parseTextures(e,t){function n(o,l){return typeof o=="number"?o:(Fe("ObjectLoader.parseTexture: Constant should be in numeric form.",o),l[o])}const r={};if(e!==void 0)for(let o=0,l=e.length;o<l;o++){const c=e[o];c.image===void 0&&Fe('ObjectLoader: No "image" specified for',c.uuid),t[c.image]===void 0&&Fe("ObjectLoader: Undefined image",c.image);const h=t[c.image],d=h.data;let p;Array.isArray(d)?(p=new eu,d.length===6&&(p.needsUpdate=!0)):(d&&d.data?p=new fs:p=new pn,d&&(p.needsUpdate=!0)),p.source=h,p.uuid=c.uuid,c.name!==void 0&&(p.name=c.name),c.mapping!==void 0&&(p.mapping=n(c.mapping,JE)),c.channel!==void 0&&(p.channel=c.channel),c.offset!==void 0&&p.offset.fromArray(c.offset),c.repeat!==void 0&&p.repeat.fromArray(c.repeat),c.center!==void 0&&p.center.fromArray(c.center),c.rotation!==void 0&&(p.rotation=c.rotation),c.wrap!==void 0&&(p.wrapS=n(c.wrap[0],Cx),p.wrapT=n(c.wrap[1],Cx)),c.format!==void 0&&(p.format=c.format),c.internalFormat!==void 0&&(p.internalFormat=c.internalFormat),c.type!==void 0&&(p.type=c.type),c.colorSpace!==void 0&&(p.colorSpace=c.colorSpace),c.minFilter!==void 0&&(p.minFilter=n(c.minFilter,Rx)),c.magFilter!==void 0&&(p.magFilter=n(c.magFilter,Rx)),c.anisotropy!==void 0&&(p.anisotropy=c.anisotropy),c.flipY!==void 0&&(p.flipY=c.flipY),c.generateMipmaps!==void 0&&(p.generateMipmaps=c.generateMipmaps),c.mipmapsAutoUpdate!==void 0&&(p.mipmapsAutoUpdate=c.mipmapsAutoUpdate),c.premultiplyAlpha!==void 0&&(p.premultiplyAlpha=c.premultiplyAlpha),c.unpackAlignment!==void 0&&(p.unpackAlignment=c.unpackAlignment),c.compareFunction!==void 0&&(p.compareFunction=c.compareFunction),c.normalized!==void 0&&(p.normalized=c.normalized),c.userData!==void 0&&(p.userData=c.userData),r[c.uuid]=p}return r}parseObject(e,t,n,r,o){let l;function c(v){return t[v]===void 0&&Fe("ObjectLoader: Undefined geometry",v),t[v]}function h(v){if(v!==void 0){if(Array.isArray(v)){const _=[];for(let y=0,w=v.length;y<w;y++){const b=v[y];n[b]===void 0&&Fe("ObjectLoader: Undefined material",b),_.push(n[b])}return _}return n[v]===void 0&&Fe("ObjectLoader: Undefined material",v),n[v]}}function d(v){return r[v]===void 0&&Fe("ObjectLoader: Undefined texture",v),r[v]}let p,g;switch(e.type){case"Scene":l=new kc,e.background!==void 0&&(Number.isInteger(e.background)?l.background=new Ge(e.background):l.background=d(e.background)),e.environment!==void 0&&(l.environment=d(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?l.fog=new md(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(l.fog=new pd(e.fog.color,e.fog.density)),e.fog.name!==""&&(l.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(l.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(l.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&l.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(l.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&l.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":l=new Kn(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(l.focus=e.focus),e.zoom!==void 0&&(l.zoom=e.zoom),e.filmGauge!==void 0&&(l.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(l.filmOffset=e.filmOffset),e.view!==void 0&&(l.view=Object.assign({},e.view));break;case"OrthographicCamera":l=new bl(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(l.zoom=e.zoom),e.view!==void 0&&(l.view=Object.assign({},e.view));break;case"AmbientLight":l=new dS(e.color,e.intensity);break;case"DirectionalLight":l=new fS(e.color,e.intensity),l.target=e.target||"";break;case"PointLight":l=new hS(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":l=new pS(e.color,e.intensity,e.width,e.height);break;case"SpotLight":l=new uS(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),l.target=e.target||"",e.map!==void 0&&(l.map=d(e.map));break;case"HemisphereLight":l=new cS(e.color,e.groundColor,e.intensity);break;case"LightProbe":const v=new Rg().fromArray(e.sh);l=new mS(v,e.intensity);break;case"SkinnedMesh":p=c(e.geometry),g=h(e.material),l=new R3(p,g),e.bindMode!==void 0&&(l.bindMode=e.bindMode),e.bindMatrix!==void 0&&l.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(l.skeleton=e.skeleton);break;case"Mesh":p=c(e.geometry),g=h(e.material),l=new Wn(p,g);break;case"InstancedMesh":p=c(e.geometry),g=h(e.material);const _=e.count,y=e.instanceMatrix,w=e.instanceColor;l=new I3(p,g,_),l.instanceMatrix=new ml(new Float32Array(y.array),16),w!==void 0&&(l.instanceColor=new ml(new Float32Array(w.array),w.itemSize));break;case"BatchedMesh":p=c(e.geometry),g=h(e.material),l=new P3(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,g),l.geometry=p,l.perObjectFrustumCulled=e.perObjectFrustumCulled,l.sortObjects=e.sortObjects,l._drawRanges=e.drawRanges,l._reservedRanges=e.reservedRanges,l._geometryInfo=e.geometryInfo.map(b=>{let S=null,M=null;return b.boundingBox!==void 0&&(S=new gi().fromJSON(b.boundingBox)),b.boundingSphere!==void 0&&(M=new li().fromJSON(b.boundingSphere)),{...b,boundingBox:S,boundingSphere:M}}),l._instanceInfo=e.instanceInfo,l._availableInstanceIds=e.availableInstanceIds,l._availableGeometryIds=e.availableGeometryIds,l._nextIndexStart=e.nextIndexStart,l._nextVertexStart=e.nextVertexStart,l._geometryCount=e.geometryCount,l._maxInstanceCount=e.maxInstanceCount,l._maxVertexCount=e.maxVertexCount,l._maxIndexCount=e.maxIndexCount,l._geometryInitialized=e.geometryInitialized,l._matricesTexture=d(e.matricesTexture.uuid),l._indirectTexture=d(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(l._colorsTexture=d(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(l.boundingSphere=new li().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(l.boundingBox=new gi().fromJSON(e.boundingBox));break;case"LOD":l=new C3;break;case"Line":l=new Tr(c(e.geometry),h(e.material));break;case"LineLoop":l=new L3(c(e.geometry),h(e.material));break;case"LineSegments":l=new er(c(e.geometry),h(e.material));break;case"PointCloud":case"Points":l=new N3(c(e.geometry),h(e.material));break;case"Sprite":l=new A3(h(e.material)),e.center!==void 0&&l.center.fromArray(e.center);break;case"Group":l=new sl;break;case"Bone":l=new ug;break;default:l=new Wt}if(l.uuid=e.uuid,e.name!==void 0&&(l.name=e.name),e.pivot!==void 0&&(l.pivot=new O().fromArray(e.pivot)),e.matrix!==void 0?(l.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(l.matrixAutoUpdate=e.matrixAutoUpdate),l.matrixAutoUpdate&&(l.matrix.decompose(l.position,l.quaternion,l.scale),l.pivot!==null&&l.position.copy(l.pivot).applyMatrix4(l.matrix).sub(l.pivot))):(e.position!==void 0&&l.position.fromArray(e.position),e.rotation!==void 0&&l.rotation.fromArray(e.rotation),e.quaternion!==void 0&&l.quaternion.fromArray(e.quaternion),e.scale!==void 0&&l.scale.fromArray(e.scale)),e.up!==void 0&&l.up.fromArray(e.up),e.morphTargetDictionary!==void 0&&(l.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(l.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(l.castShadow=e.castShadow),e.receiveShadow!==void 0&&(l.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(l.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(l.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(l.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(l.shadow.radius=e.shadow.radius),e.shadow.blurSamples!==void 0&&(l.shadow.blurSamples=e.shadow.blurSamples),e.shadow.focus!==void 0&&(l.shadow.focus=e.shadow.focus),e.shadow.aspect!==void 0&&(l.shadow.aspect=e.shadow.aspect),e.shadow.mapSize!==void 0&&l.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.mapType!==void 0&&(l.shadow.mapType=e.shadow.mapType),e.shadow.camera!==void 0&&(l.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(l.visible=e.visible),e.frustumCulled!==void 0&&(l.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(l.renderOrder=e.renderOrder),e.static!==void 0&&(l.static=e.static),e.userData!==void 0&&(l.userData=e.userData),e.layers!==void 0&&(l.layers.mask=e.layers),e.children!==void 0){const v=e.children;for(let _=0;_<v.length;_++)l.add(this.parseObject(v[_],t,n,r,o))}if(e.animations!==void 0){const v=e.animations;for(let _=0;_<v.length;_++){const y=v[_];l.animations.push(o[y])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(l.autoUpdate=e.autoUpdate);const v=e.levels;for(let _=0;_<v.length;_++){const y=v[_],w=l.getObjectByProperty("uuid",y.object);w!==void 0&&l.addLevel(w,y.distance,y.hysteresis)}}return l}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(n){if(n.isSkinnedMesh===!0&&n.skeleton!==void 0){const r=t[n.skeleton];r===void 0?Fe("ObjectLoader: No skeleton found with UUID:",n.skeleton):n.bind(r,n.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,r=e.getObjectByProperty("uuid",n);r!==void 0?t.target=r:t.target=new Wt}})}}const JE={UVMapping:nd,CubeReflectionMapping:br,CubeRefractionMapping:qa,EquirectangularReflectionMapping:vc,EquirectangularRefractionMapping:_c},Cx={RepeatWrapping:Pc,ClampToEdgeWrapping:Fi,MirroredRepeatWrapping:Lc},Rx={NearestFilter:dn,NearestMipmapNearestFilter:Ym,NearestMipmapLinearFilter:nl,LinearFilter:an,LinearMipmapNearestFilter:xc,LinearMipmapLinearFilter:Ps},tm=new WeakMap;class KE extends zi{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&Fe("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Fe("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const o=this,l=Ks.get(`image-bitmap:${e}`);if(l!==void 0){if(o.manager.itemStart(e),l.then){l.then(d=>{tm.has(l)===!0?(r&&r(tm.get(l)),o.manager.itemError(e),o.manager.itemEnd(e)):(t&&t(d),o.manager.itemEnd(e))});return}setTimeout(function(){t&&t(l),o.manager.itemEnd(e)},0);return}const c={};c.credentials=this.withCredentials||this.crossOrigin!=="anonymous"?"include":"same-origin",c.headers=this.requestHeader,c.priority=this.priority,c.cache=this.cache,c.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const h=fetch(e,c).then(function(d){return d.blob()}).then(function(d){return createImageBitmap(d,Object.assign({},o.options,{colorSpaceConversion:"none"}))}).then(function(d){return Ks.add(`image-bitmap:${e}`,d),t&&t(d),o.manager.itemEnd(e),d}).catch(function(d){r&&r(d),tm.set(h,d),Ks.remove(`image-bitmap:${e}`),o.manager.itemError(e),o.manager.itemEnd(e)});Ks.add(`image-bitmap:${e}`,h),o.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Hh;class Ig{static getContext(){return Hh===void 0&&(Hh=new(window.AudioContext||window.webkitAudioContext)),Hh}static setContext(e){Hh=e}}class QE extends zi{constructor(e){super(e)}load(e,t,n,r){const o=this,l=new Er(this.manager);l.setPriority(this.priority),l.setCache(this.cache),l.setResponseType("arraybuffer"),l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(h){try{const d=h.slice(0),p=Ig.getContext(),g=e+"#decode";o.manager.itemStart(g),p.decodeAudioData(d,function(v){t(v),o.manager.itemEnd(g)}).catch(function(v){c(v),o.manager.itemEnd(g)})}catch(d){c(d)}},n,r);function c(h){r?r(h):it(h),o.manager.itemError(e)}}}const Ix=new gt,Px=new gt,Ia=new gt;class e5{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Kn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Kn,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,Ia.copy(e.projectionMatrix);const r=t.eyeSep/2,o=r*t.near/t.focus,l=t.near*Math.tan(Ga*t.fov*.5)/t.zoom;let c,h;Px.elements[12]=-r,Ix.elements[12]=r,c=-l*t.aspect+o,h=l*t.aspect+o,Ia.elements[0]=2*t.near/(h-c),Ia.elements[8]=(h+c)/(h-c),this.cameraL.projectionMatrix.copy(Ia),c=-l*t.aspect-o,h=l*t.aspect-o,Ia.elements[0]=2*t.near/(h-c),Ia.elements[8]=(h+c)/(h-c),this.cameraR.projectionMatrix.copy(Ia)}this.cameraL.matrix.copy(e.matrixWorld).multiply(Px),this.cameraL.matrixWorldNeedsUpdate=!0,this.cameraR.matrix.copy(e.matrixWorld).multiply(Ix),this.cameraR.matrixWorldNeedsUpdate=!0}}const jo=-90,Jo=1;class qf extends Wt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Kn(jo,Jo,e,t);r.layers=this.layers,this.add(r);const o=new Kn(jo,Jo,e,t);o.layers=this.layers,this.add(o);const l=new Kn(jo,Jo,e,t);l.layers=this.layers,this.add(l);const c=new Kn(jo,Jo,e,t);c.layers=this.layers,this.add(c);const h=new Kn(jo,Jo,e,t);h.layers=this.layers,this.add(h);const d=new Kn(jo,Jo,e,t);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,r,o,l,c,h]=t;for(const d of t)this.remove(d);if(e===Ki)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),o.up.set(0,0,-1),o.lookAt(0,1,0),l.up.set(0,0,1),l.lookAt(0,-1,0),c.up.set(0,1,0),c.lookAt(0,0,1),h.up.set(0,1,0),h.lookAt(0,0,-1);else if(e===$a)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),o.up.set(0,0,1),o.lookAt(0,1,0),l.up.set(0,0,-1),l.lookAt(0,-1,0),c.up.set(0,-1,0),c.lookAt(0,0,1),h.up.set(0,-1,0),h.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const d of t)this.add(d),d.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[o,l,c,h,d,p]=this.children,g=e.getRenderTarget(),v=e.getActiveCubeFace(),_=e.getActiveMipmapLevel(),y=e.xr.enabled;e.xr.enabled=!1;const w=n.texture.mipmapsAutoUpdate;n.texture.mipmapsAutoUpdate=!1;let b=!1;e.isWebGLRenderer===!0?b=e.state.buffers.depth.getReversed():b=e.reversedDepthBuffer,e.setRenderTarget(n,0,r),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,1,r),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,2,r),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,3,r),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(n,4,r),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,d),n.texture.mipmapsAutoUpdate=w,e.setRenderTarget(n,5,r),b&&e.autoClear===!1&&e.clearDepth(),e.render(t,p),e.setRenderTarget(g,v,_),e.xr.enabled=y,n.texture.needsPMREMUpdate=!0}}class _S extends Kn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e,this.perCameraFrustumCulled=!1}}let xS=class{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=t5.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}};function t5(){this._document.hidden===!1&&this.reset()}const Pa=new O,nm=new wi,n5=new O,La=new O,Na=new O;class i5 extends Wt{constructor(){super(),this.type="AudioListener",this.context=Ig.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new xS}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),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(Pa,nm,n5),La.set(0,0,-1).applyQuaternion(nm),Na.set(0,1,0).applyQuaternion(nm),t.positionX){const n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Pa.x,n),t.positionY.linearRampToValueAtTime(Pa.y,n),t.positionZ.linearRampToValueAtTime(Pa.z,n),t.forwardX.linearRampToValueAtTime(La.x,n),t.forwardY.linearRampToValueAtTime(La.y,n),t.forwardZ.linearRampToValueAtTime(La.z,n),t.upX.linearRampToValueAtTime(Na.x,n),t.upY.linearRampToValueAtTime(Na.y,n),t.upZ.linearRampToValueAtTime(Na.z,n)}else t.setPosition(Pa.x,Pa.y,Pa.z),t.setOrientation(La.x,La.y,La.z,Na.x,Na.y,Na.z)}}class yS extends Wt{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){Fe("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){Fe("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){Fe("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){Fe("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){Fe("Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?(Fe("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){Fe("Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(Fe("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const Da=new O,Lx=new wi,s5=new O,Ua=new O;class r5 extends yS{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Da,Lx,s5),Ua.set(0,0,1).applyQuaternion(Lx);const t=this.panner;if(t.positionX){const n=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(Da.x,n),t.positionY.linearRampToValueAtTime(Da.y,n),t.positionZ.linearRampToValueAtTime(Da.z,n),t.orientationX.linearRampToValueAtTime(Ua.x,n),t.orientationY.linearRampToValueAtTime(Ua.y,n),t.orientationZ.linearRampToValueAtTime(Ua.z,n)}else t.setPosition(Da.x,Da.y,Da.z),t.setOrientation(Ua.x,Ua.y,Ua.z)}}class a5{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class SS{constructor(e,t,n){this.binding=e,this.valueSize=n;let r,o,l;switch(t){case"quaternion":r=this._slerp,o=this._slerpAdditive,l=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":r=this._select,o=this._select,l=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:r=this._lerp,o=this._lerpAdditive,l=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=o,this._setIdentity=l,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,r=this.valueSize,o=e*r+r;let l=this.cumulativeWeight;if(l===0){for(let c=0;c!==r;++c)n[o+c]=n[c];l=t}else{l+=t;const c=t/l;this._mixBufferRegion(n,o,0,c,r)}this.cumulativeWeight=l}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,r=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,r=e*t+t,o=this.cumulativeWeight,l=this.cumulativeWeightAdditive,c=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,o<1){const h=t*this._origIndex;this._mixBufferRegion(n,r,h,1-o,t)}l>0&&this._mixBufferRegionAdditive(n,r,this._addIndex*t,1,t);for(let h=t,d=t+t;h!==d;++h)if(n[h]!==n[h+t]){c.setValue(n,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,r=n*this._origIndex;e.getValue(t,r);for(let o=n,l=r;o!==l;++o)t[o]=t[r+o%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<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,r,o){if(r>=.5)for(let l=0;l!==o;++l)e[t+l]=e[n+l]}_slerp(e,t,n,r){wi.slerpFlat(e,t,e,t,e,n,r)}_slerpAdditive(e,t,n,r,o){const l=this._workIndex*o;wi.multiplyQuaternionsFlat(e,l,e,t,e,n),wi.slerpFlat(e,t,e,t,e,l,r)}_lerp(e,t,n,r,o){const l=1-r;for(let c=0;c!==o;++c){const h=t+c;e[h]=e[h]*l+e[n+c]*r}}_lerpAdditive(e,t,n,r,o){for(let l=0;l!==o;++l){const c=t+l;e[c]=e[c]+e[n+l]*r}}}const Pg="\\[\\]\\.:\\/",o5=new RegExp("["+Pg+"]","g"),Lg="[^"+Pg+"]",l5="[^"+Pg.replace("\\.","")+"]",c5=/((?:WC+[\/:])*)/.source.replace("WC",Lg),u5=/(WCOD+)?/.source.replace("WCOD",l5),h5=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Lg),f5=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Lg),d5=new RegExp("^"+c5+u5+h5+f5+"$"),p5=["material","materials","bones","map"];class m5{constructor(e,t,n){const r=n||Gt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,o=n.length;r!==o;++r)n[r].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 Gt{constructor(e,t,n){this.path=t,this.parsedPath=n||Gt.parseTrackName(t),this.node=Gt.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 Gt.Composite(e,t,n):new Gt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(o5,"")}static parseTrackName(e){const t=d5.exec(e);if(t===null)throw new Error("THREE.PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const o=n.nodeName.substring(r+1);p5.indexOf(o)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=o)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("THREE.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(o){for(let l=0;l<o.length;l++){const c=o[l];if(c.name===t||c.uuid===t)return c;const h=n(c.children);if(h)return h}return null},r=n(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let r=0,o=n.length;r!==o;++r)e[t++]=n[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let r=0,o=n.length;r!==o;++r)n[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,o=n.length;r!==o;++r)n[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let r=0,o=n.length;r!==o;++r)n[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,r=t.propertyName;let o=t.propertyIndex;if(e||(e=Gt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Fe("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let d=t.objectIndex;switch(n){case"materials":if(!e.material){it("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){it("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){it("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let p=0;p<e.length;p++)if(e[p].name===d){d=p;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){it("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){it("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){it("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(d!==void 0){if(e[d]===void 0){it("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[d]}}const l=e[r];if(l===void 0){const d=t.nodeName;it("PropertyBinding: Trying to update property for track: "+d+"."+r+" but it wasn't found.",e);return}let c=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?c=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(c=this.Versioning.MatrixWorldNeedsUpdate);let h=this.BindingType.Direct;if(o!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){it("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){it("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[o]!==void 0&&(o=e.morphTargetDictionary[o])}h=this.BindingType.ArrayElement,this.resolvedProperty=l,this.propertyIndex=o}else l.fromArray!==void 0&&l.toArray!==void 0?(h=this.BindingType.HasFromToArray,this.resolvedProperty=l):Array.isArray(l)?(h=this.BindingType.EntireArray,this.resolvedProperty=l):this.propertyName=r;this.getValue=this.GetterByBindingType[h],this.setValue=this.SetterByBindingTypeAndVersioning[h][c]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Gt.Composite=m5;Gt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Gt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Gt.prototype.GetterByBindingType=[Gt.prototype._getValue_direct,Gt.prototype._getValue_array,Gt.prototype._getValue_arrayElement,Gt.prototype._getValue_toArray];Gt.prototype.SetterByBindingTypeAndVersioning=[[Gt.prototype._setValue_direct,Gt.prototype._setValue_direct_setNeedsUpdate,Gt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Gt.prototype._setValue_array,Gt.prototype._setValue_array_setNeedsUpdate,Gt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Gt.prototype._setValue_arrayElement,Gt.prototype._setValue_arrayElement_setNeedsUpdate,Gt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Gt.prototype._setValue_fromArray,Gt.prototype._setValue_fromArray_setNeedsUpdate,Gt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class g5{constructor(){this.isAnimationObjectGroup=!0,this.uuid=ms(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let n=0,r=arguments.length;n!==r;++n)e[arguments[n].uuid]=n;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,r=this._parsedPaths,o=this._bindings,l=o.length;let c,h=e.length,d=this.nCachedObjects_;for(let p=0,g=arguments.length;p!==g;++p){const v=arguments[p],_=v.uuid;let y=t[_];if(y===void 0){y=h++,t[_]=y,e.push(v);for(let w=0,b=l;w!==b;++w)o[w].push(new Gt(v,n[w],r[w]))}else if(y<d){c=e[y];const w=--d,b=e[w];t[b.uuid]=y,e[y]=b,t[_]=w,e[w]=v;for(let S=0,M=l;S!==M;++S){const A=o[S],E=A[w];let N=A[y];A[y]=E,N===void 0&&(N=new Gt(v,n[S],r[S])),A[w]=N}}else e[y]!==c&&it("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=d}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let o=this.nCachedObjects_;for(let l=0,c=arguments.length;l!==c;++l){const h=arguments[l],d=h.uuid,p=t[d];if(p!==void 0&&p>=o){const g=o++,v=e[g];t[v.uuid]=p,e[p]=v,t[d]=g,e[g]=h;for(let _=0,y=r;_!==y;++_){const w=n[_],b=w[g],S=w[p];w[p]=b,w[g]=S}}}this.nCachedObjects_=o}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,r=n.length;let o=this.nCachedObjects_,l=e.length;for(let c=0,h=arguments.length;c!==h;++c){const d=arguments[c],p=d.uuid,g=t[p];if(g!==void 0)if(delete t[p],g<o){const v=--o,_=e[v],y=--l,w=e[y];g!==v&&(t[_.uuid]=g),e[g]=_,v!==y&&(t[w.uuid]=v),e[v]=w,e.pop();for(let b=0,S=r;b!==S;++b){const M=n[b],A=M[v],E=M[y];M[g]=A,M[v]=E,M.pop()}}else{const v=--l,_=e[v];g!==v&&(t[_.uuid]=g),e[g]=_,e.pop();for(let y=0,w=r;y!==w;++y){const b=n[y];b[g]=b[v],b.pop()}}}this.nCachedObjects_=o}subscribe_(e,t){const n=this._bindingsIndicesByPath;let r=n[e];const o=this._bindings;if(r!==void 0)return o[r];const l=this._paths,c=this._parsedPaths,h=this._objects,d=h.length,p=this.nCachedObjects_,g=new Array(d);r=o.length,n[e]=r,l.push(e),c.push(t),o.push(g);for(let v=p,_=h.length;v!==_;++v){const y=h[v];g[v]=new Gt(y,e,t)}return g}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const r=this._paths,o=this._parsedPaths,l=this._bindings,c=l.length-1,h=l[c],d=r[c];t[d]=n,l[n]=h,l.pop(),o[n]=o[c],o.pop(),r[n]=r[c],r.pop()}}}class bS{constructor(e,t,n=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=r;const o=t.tracks,l=o.length,c=new Array(l),h={endingStart:za,endingEnd:za};for(let d=0;d!==l;++d){const p=o[d].createInterpolant(null);c[d]=p,p.settings=h}this._interpolantSettings=h,this._interpolants=c,this._propertyBindings=new Array(l),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._restoreTimeScale=null,this._weightInterpolant=null,this.loop=h3,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=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const r=this._clip.duration,o=e._clip.duration,l=o/r,c=r/o;e._restoreTimeScale=e.timeScale,this._restoreTimeScale=this.timeScale,e.warp(1,l,t),this.warp(c,1,t)}return this}crossFadeTo(e,t,n=!1){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 r=this._mixer,o=r.time,l=this.timeScale;let c=this._timeScaleInterpolant;c===null&&(c=r._lendControlInterpolant(),this._timeScaleInterpolant=c);const h=c.parameterPositions,d=c.sampleValues;return h[0]=o,h[1]=o+n,d[0]=e/l,d[1]=t/l,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this._restoreTimeScale=null,this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,r){if(!this.enabled){this._updateWeight(e);return}const o=this._startTime;if(o!==null){const h=(e-o)*n;h<0||n===0?t=0:(this._startTime=null,t=n*h)}t*=this._updateTimeScale(e);const l=this._updateTime(t),c=this._updateWeight(e);if(c>0){const h=this._interpolants,d=this._propertyBindings;switch(this.blendMode){case tg:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),d[p].accumulateAdditive(c);break;case cd:default:for(let p=0,g=h.length;p!==g;++p)h[p].evaluate(l),d[p].accumulate(r,c)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(this.stopFading(),r===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 r=n.evaluate(e)[0];t*=r,e>n.parameterPositions[1]&&(t===0?this.paused=!0:(this._restoreTimeScale!==null&&(t=this._restoreTimeScale),this.timeScale=t),this.stopWarping())}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let r=this.time+e,o=this._loopCount;const l=n===f3;if(e===0)return o===-1?r:l&&(o&1)===1?t-r:r;if(n===u3){o===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(o===-1&&(e>=0?(o=0,this._setEndings(!0,this.repetitions===0,l)):this._setEndings(this.repetitions===0,!0,l)),r>=t||r<0){const c=Math.floor(r/t);r-=t*c,o+=Math.abs(c);const h=this.repetitions-o;if(h<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(h===1){const d=e<0;this._setEndings(d,!d,l)}else this._setEndings(!1,!1,l);this._loopCount=o,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:c})}}else this._loopCount=o,this.time=r;if(l&&(o&1)===1)return t-r}return r}_setEndings(e,t,n){const r=this._interpolantSettings;n?(r.endingStart=ka,r.endingEnd=ka):(e?r.endingStart=this.zeroSlopeAtStart?ka:za:r.endingStart=Fc,t?r.endingEnd=this.zeroSlopeAtEnd?ka:za:r.endingEnd=Fc)}_scheduleFading(e,t,n){const r=this._mixer,o=r.time;let l=this._weightInterpolant;l===null&&(l=r._lendControlInterpolant(),this._weightInterpolant=l);const c=l.parameterPositions,h=l.sampleValues;return c[0]=o,h[0]=t,c[1]=o+e,h[1]=n,this}}const v5=new Float32Array(1);class _5 extends Bi{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,r=e._clip.tracks,o=r.length,l=e._propertyBindings,c=e._interpolants,h=n.uuid,d=this._bindingsByRootAndName;let p=d[h];p===void 0&&(p={},d[h]=p);for(let g=0;g!==o;++g){const v=r[g],_=v.name;let y=p[_];if(y!==void 0)++y.referenceCount,l[g]=y;else{if(y=l[g],y!==void 0){y._cacheIndex===null&&(++y.referenceCount,this._addInactiveBinding(y,h,_));continue}const w=t&&t._propertyBindings[g].binding.parsedPath;y=new SS(Gt.create(n,_,w),v.ValueTypeName,v.getValueSize()),++y.referenceCount,this._addInactiveBinding(y,h,_),l[g]=y}c[g].resultBuffer=y.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,r=e._clip.uuid,o=this._actionsByClip[r];this._bindAction(e,o&&o.knownActions[0]),this._addInactiveAction(e,r,n)}const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const o=t[n];o.useCount++===0&&(this._lendBinding(o),o.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const o=t[n];--o.useCount===0&&(o.restoreOriginalState(),this._takeBackBinding(o))}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<this._nActiveActions}_addInactiveAction(e,t,n){const r=this._actions,o=this._actionsByClip;let l=o[t];if(l===void 0)l={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,o[t]=l;else{const c=l.knownActions;e._byClipCacheIndex=c.length,c.push(e)}e._cacheIndex=r.length,r.push(e),l.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],r=e._cacheIndex;n._cacheIndex=r,t[r]=n,t.pop(),e._cacheIndex=null;const o=e._clip.uuid,l=this._actionsByClip,c=l[o],h=c.knownActions,d=h[h.length-1],p=e._byClipCacheIndex;d._byClipCacheIndex=p,h[p]=d,h.pop(),e._byClipCacheIndex=null;const g=c.actionByRoot,v=(e._localRoot||this._root).uuid;delete g[v],h.length===0&&delete l[o],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,r=t.length;n!==r;++n){const o=t[n];--o.referenceCount===0&&this._removeInactiveBinding(o)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,r=this._nActiveActions++,o=t[r];e._cacheIndex=r,t[r]=e,o._cacheIndex=n,t[n]=o}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,r=--this._nActiveActions,o=t[r];e._cacheIndex=r,t[r]=e,o._cacheIndex=n,t[n]=o}_addInactiveBinding(e,t,n){const r=this._bindingsByRootAndName,o=this._bindings;let l=r[t];l===void 0&&(l={},r[t]=l),l[n]=e,e._cacheIndex=o.length,o.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,r=n.rootNode.uuid,o=n.path,l=this._bindingsByRootAndName,c=l[r],h=t[t.length-1],d=e._cacheIndex;h._cacheIndex=d,t[d]=h,t.pop(),delete c[o],Object.keys(c).length===0&&delete l[r]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,r=this._nActiveBindings++,o=t[r];e._cacheIndex=r,t[r]=e,o._cacheIndex=n,t[n]=o}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,r=--this._nActiveBindings,o=t[r];e._cacheIndex=r,t[r]=e,o._cacheIndex=n,t[n]=o}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Tg(new Float32Array(2),new Float32Array(2),1,v5),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,r=--this._nActiveControlInterpolants,o=t[r];e.__cacheIndex=r,t[r]=e,o.__cacheIndex=n,t[n]=o}clipAction(e,t,n){const r=t||this._root,o=r.uuid;let l=typeof e=="string"?Xc.findByName(r,e):e;const c=l!==null?l.uuid:e,h=this._actionsByClip[c];let d=null;if(n===void 0&&(l!==null?n=l.blendMode:n=cd),h!==void 0){const g=h.actionByRoot[o];if(g!==void 0&&g.blendMode===n)return g;d=h.knownActions[0],l===null&&(l=d._clip)}if(l===null)return null;const p=new bS(this,l,t,n);return this._bindAction(p,d),this._addInactiveAction(p,c,o),p}existingAction(e,t){const n=t||this._root,r=n.uuid,o=typeof e=="string"?Xc.findByName(n,e):e,l=o?o.uuid:e,c=this._actionsByClip[l];return c!==void 0&&c.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,r=this.time+=e,o=Math.sign(e),l=this._accuIndex^=1;for(let d=0;d!==n;++d)t[d]._update(r,e,o,l);const c=this._bindings,h=this._nActiveBindings;for(let d=0;d!==h;++d)c[d].apply(l);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,r=this._actionsByClip,o=r[n];if(o!==void 0){const l=o.knownActions;for(let c=0,h=l.length;c!==h;++c){const d=l[c];this._deactivateAction(d);const p=d._cacheIndex,g=t[t.length-1];d._cacheIndex=null,d._byClipCacheIndex=null,g._cacheIndex=p,t[p]=g,t.pop(),this._removeInactiveBindingsForAction(d)}delete r[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const l in n){const c=n[l].actionByRoot,h=c[t];h!==void 0&&(this._deactivateAction(h),this._removeInactiveAction(h))}const r=this._bindingsByRootAndName,o=r[t];if(o!==void 0)for(const l in o){const c=o[l];c.restoreOriginalState(),this._removeInactiveBinding(c)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class x5 extends ag{constructor(e=1,t=1,n=1,r={}){super(e,t,r),this.isRenderTarget3D=!0,this.depth=n;for(let o=0;o<this.textures.length;o++){const l=new dd(null,e,t,n);l.isRenderTargetTexture=!0,l.renderTarget=this,this.textures[o]=l}this._setTextureOptions(r)}}class zt{constructor(e){this.value=e}clone(){return new zt(this.value.clone===void 0?this.value:this.value.clone())}}let y5=0;class S5 extends Bi{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:y5++}),this.name="",this.usage=ud,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,r=t.length;n<r;n++){const o=t[n];Array.isArray(o)?this.uniforms.push(o.map(l=>l.clone())):this.uniforms.push(o.clone())}return this}clone(){return new this.constructor().copy(this)}}class b5 extends gd{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class M5{constructor(e,t,n,r,o,l=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=r,this.count=o,this.normalized=l,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Nx=new gt;class MS{constructor(e,t,n=0,r=1/0){this.ray=new xl(e,t),this.near=n,this.far=r,this.camera=null,this.layers=new pl,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,t.projectionMatrix.elements[14]).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):it("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Nx.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Nx),this}intersectObject(e,t=!0,n=[]){return Im(e,this,n,t),n.sort(Dx),n}intersectObjects(e,t=!0,n=[]){for(let r=0,o=e.length;r<o;r++)Im(e[r],this,n,t);return n.sort(Dx),n}}function Dx(i,e){return i.distance-e.distance}function Im(i,e,t,n){let r=!0;if(i.layers.test(e.layers)&&i.raycast(e,t)===!1&&(r=!1),r===!0&&n===!0){const o=i.children;for(let l=0,c=o.length;l<c;l++)Im(o[l],e,t,!0)}}class wS{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,Fe("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}class w5{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=ft(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(ft(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class T5{constructor(e=1,t=0,n=0){this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return new this.constructor().copy(this)}}const Yg=class Yg{constructor(e,t,n,r){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,n,r)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,r){const o=this.elements;return o[0]=e,o[2]=t,o[1]=n,o[3]=r,this}};Yg.prototype.isMatrix2=!0;let Pm=Yg;const Ux=new ue;class TS{constructor(e=new ue(1/0,1/0),t=new ue(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Ux.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.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.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ux).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 Fx=new O,Vh=new O,Ko=new O,Qo=new O,im=new O,E5=new O,A5=new O;class C5{constructor(e=new O,t=new O){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){Fx.subVectors(e,this.start),Vh.subVectors(this.end,this.start);const n=Vh.dot(Vh);if(n===0)return 0;let o=Vh.dot(Fx)/n;return t&&(o=ft(o,0,1)),o}closestPointToPoint(e,t,n){const r=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(r).add(this.start)}distanceSqToLine3(e,t=E5,n=A5){const r=10000000000000001e-32;let o,l;const c=this.start,h=e.start,d=this.end,p=e.end;Ko.subVectors(d,c),Qo.subVectors(p,h),im.subVectors(c,h);const g=Ko.dot(Ko),v=Qo.dot(Qo),_=Qo.dot(im);if(g<=r&&v<=r)return t.copy(c),n.copy(h),t.distanceToSquared(n);if(g<=r)o=0,l=_/v,l=ft(l,0,1);else{const y=Ko.dot(im);if(v<=r)l=0,o=ft(-y/g,0,1);else{const w=Ko.dot(Qo),b=g*v-w*w;b!==0?o=ft((w*_-y*v)/b,0,1):o=0,l=(w*o+_)/v,l<0?(l=0,o=ft(-y/g,0,1)):l>1&&(l=1,o=ft((w-y)/g,0,1))}}return t.copy(c).addScaledVector(Ko,o),n.copy(h).addScaledVector(Qo,l),t.distanceToSquared(n)}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 Ox=new O;class R5 extends Wt{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new bt,r=[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 l=0,c=1,h=32;l<h;l++,c++){const d=l/h*Math.PI*2,p=c/h*Math.PI*2;r.push(Math.cos(d),Math.sin(d),1,Math.cos(p),Math.sin(p),1)}n.setAttribute("position",new Je(r,3));const o=new vi({fog:!1,toneMapped:!1});this.cone=new er(n,o),this.add(this.cone),this.update()}dispose(){super.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorldNeedsUpdate=!0;const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Ox.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Ox),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const jr=new O,Gh=new gt,sm=new gt;class I5 extends er{constructor(e){const t=ES(e),n=new bt,r=[],o=[];for(let d=0;d<t.length;d++){const p=t[d];p.parent&&p.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),o.push(0,0,0),o.push(0,0,0))}n.setAttribute("position",new Je(r,3)),n.setAttribute("color",new Je(o,3));const l=new vi({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(n,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const c=new Ge(255),h=new Ge(65280);this.setColors(c,h)}updateMatrixWorld(e){const t=this.bones,n=this.geometry,r=n.getAttribute("position");sm.copy(this.root.matrixWorld).invert();for(let o=0,l=0;o<t.length;o++){const c=t[o];c.parent&&c.parent.isBone&&(Gh.multiplyMatrices(sm,c.matrixWorld),jr.setFromMatrixPosition(Gh),r.setXYZ(l,jr.x,jr.y,jr.z),Gh.multiplyMatrices(sm,c.parent.matrixWorld),jr.setFromMatrixPosition(Gh),r.setXYZ(l+1,jr.x,jr.y,jr.z),l+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const r=this.geometry.getAttribute("color");for(let o=0;o<r.count;o+=2)r.setXYZ(o,e.r,e.g,e.b),r.setXYZ(o+1,t.r,t.g,t.b);return r.needsUpdate=!0,this}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}function ES(i){const e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push(...ES(i.children[t]));return e}class P5 extends Wn{constructor(e,t,n){const r=new ru(t,4,2),o=new Ja({wireframe:!0,fog:!1,toneMapped:!1});super(r,o),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}update(){this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const L5=new O,Bx=new Ge,zx=new Ge;class N5 extends Wt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const r=new su(t);r.rotateY(Math.PI*.5),this.material=new Ja({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const o=r.getAttribute("position"),l=new Float32Array(o.count*3);r.setAttribute("color",new on(l,3)),this.add(new Wn(r,this.material)),this.update()}dispose(){super.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Bx.copy(this.light.color),zx.copy(this.light.groundColor);for(let n=0,r=t.count;n<r;n++){const o=n<r/2?Bx:zx;t.setXYZ(n,o.r,o.g,o.b)}t.needsUpdate=!0}this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),e.lookAt(L5.setFromMatrixPosition(this.light.matrixWorld).negate())}}class D5 extends er{constructor(e=10,t=10,n=4473924,r=8947848){n=new Ge(n),r=new Ge(r);const o=t/2,l=e/t,c=e/2,h=[],d=[];for(let v=0,_=0,y=-c;v<=t;v++,y+=l){h.push(-c,0,y,c,0,y),h.push(y,0,-c,y,0,c);const w=v===o?n:r;w.toArray(d,_),_+=3,w.toArray(d,_),_+=3,w.toArray(d,_),_+=3,w.toArray(d,_),_+=3}const p=new bt;p.setAttribute("position",new Je(h,3)),p.setAttribute("color",new Je(d,3));const g=new vi({vertexColors:!0,toneMapped:!1});super(p,g),this.type="GridHelper"}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}class U5 extends er{constructor(e=10,t=16,n=8,r=64,o=4473924,l=8947848){o=new Ge(o),l=new Ge(l);const c=[],h=[];if(t>1)for(let g=0;g<t;g++){const v=g/t*(Math.PI*2),_=Math.sin(v)*e,y=Math.cos(v)*e;c.push(0,0,0),c.push(_,0,y);const w=g&1?o:l;h.push(w.r,w.g,w.b),h.push(w.r,w.g,w.b)}for(let g=0;g<n;g++){const v=g&1?o:l,_=e-e/n*g;for(let y=0;y<r;y++){let w=y/r*(Math.PI*2),b=Math.sin(w)*_,S=Math.cos(w)*_;c.push(b,0,S),h.push(v.r,v.g,v.b),w=(y+1)/r*(Math.PI*2),b=Math.sin(w)*_,S=Math.cos(w)*_,c.push(b,0,S),h.push(v.r,v.g,v.b)}}const d=new bt;d.setAttribute("position",new Je(c,3)),d.setAttribute("color",new Je(h,3));const p=new vi({vertexColors:!0,toneMapped:!1});super(d,p),this.type="PolarGridHelper"}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}const kx=new O,Wh=new O,Hx=new O;class F5 extends Wt{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new bt;r.setAttribute("position",new Je([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const o=new vi({fog:!1,toneMapped:!1});this.lightPlane=new Tr(r,o),this.add(this.lightPlane),r=new bt,r.setAttribute("position",new Je([0,0,0,0,0,1],3)),this.targetLine=new Tr(r,o),this.add(this.targetLine),this.update()}dispose(){super.dispose(),this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.matrixWorldNeedsUpdate=!0,this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),kx.setFromMatrixPosition(this.light.matrixWorld),Wh.setFromMatrixPosition(this.light.target.matrixWorld),Hx.subVectors(Wh,kx),this.lightPlane.lookAt(Wh),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Wh),this.targetLine.scale.z=Hx.length()}}const Xh=new O,An=new Ud;class O5 extends er{constructor(e){const t=new bt,n=new vi({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],o=[],l={};c("n1","n2"),c("n2","n4"),c("n4","n3"),c("n3","n1"),c("f1","f2"),c("f2","f4"),c("f4","f3"),c("f3","f1"),c("n1","f1"),c("n2","f2"),c("n3","f3"),c("n4","f4"),c("p","n1"),c("p","n2"),c("p","n3"),c("p","n4"),c("u1","u2"),c("u2","u3"),c("u3","u1"),c("c","t"),c("p","c"),c("cn1","cn2"),c("cn3","cn4"),c("cf1","cf2"),c("cf3","cf4");function c(y,w){h(y),h(w)}function h(y){r.push(0,0,0),o.push(0,0,0),l[y]===void 0&&(l[y]=[]),l[y].push(r.length/3-1)}t.setAttribute("position",new Je(r,3)),t.setAttribute("color",new Je(o,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=l,this.update();const d=new Ge(16755200),p=new Ge(16711680),g=new Ge(43775),v=new Ge(16777215),_=new Ge(3355443);this.setColors(d,p,g,v,_)}setColors(e,t,n,r,o){const c=this.geometry.getAttribute("color");return c.setXYZ(0,e.r,e.g,e.b),c.setXYZ(1,e.r,e.g,e.b),c.setXYZ(2,e.r,e.g,e.b),c.setXYZ(3,e.r,e.g,e.b),c.setXYZ(4,e.r,e.g,e.b),c.setXYZ(5,e.r,e.g,e.b),c.setXYZ(6,e.r,e.g,e.b),c.setXYZ(7,e.r,e.g,e.b),c.setXYZ(8,e.r,e.g,e.b),c.setXYZ(9,e.r,e.g,e.b),c.setXYZ(10,e.r,e.g,e.b),c.setXYZ(11,e.r,e.g,e.b),c.setXYZ(12,e.r,e.g,e.b),c.setXYZ(13,e.r,e.g,e.b),c.setXYZ(14,e.r,e.g,e.b),c.setXYZ(15,e.r,e.g,e.b),c.setXYZ(16,e.r,e.g,e.b),c.setXYZ(17,e.r,e.g,e.b),c.setXYZ(18,e.r,e.g,e.b),c.setXYZ(19,e.r,e.g,e.b),c.setXYZ(20,e.r,e.g,e.b),c.setXYZ(21,e.r,e.g,e.b),c.setXYZ(22,e.r,e.g,e.b),c.setXYZ(23,e.r,e.g,e.b),c.setXYZ(24,t.r,t.g,t.b),c.setXYZ(25,t.r,t.g,t.b),c.setXYZ(26,t.r,t.g,t.b),c.setXYZ(27,t.r,t.g,t.b),c.setXYZ(28,t.r,t.g,t.b),c.setXYZ(29,t.r,t.g,t.b),c.setXYZ(30,t.r,t.g,t.b),c.setXYZ(31,t.r,t.g,t.b),c.setXYZ(32,n.r,n.g,n.b),c.setXYZ(33,n.r,n.g,n.b),c.setXYZ(34,n.r,n.g,n.b),c.setXYZ(35,n.r,n.g,n.b),c.setXYZ(36,n.r,n.g,n.b),c.setXYZ(37,n.r,n.g,n.b),c.setXYZ(38,r.r,r.g,r.b),c.setXYZ(39,r.r,r.g,r.b),c.setXYZ(40,o.r,o.g,o.b),c.setXYZ(41,o.r,o.g,o.b),c.setXYZ(42,o.r,o.g,o.b),c.setXYZ(43,o.r,o.g,o.b),c.setXYZ(44,o.r,o.g,o.b),c.setXYZ(45,o.r,o.g,o.b),c.setXYZ(46,o.r,o.g,o.b),c.setXYZ(47,o.r,o.g,o.b),c.setXYZ(48,o.r,o.g,o.b),c.setXYZ(49,o.r,o.g,o.b),c.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,n=1,r=1;let o,l;if(An.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)o=1,l=0;else if(this.camera.coordinateSystem===Ki)o=-1,l=1;else if(this.camera.coordinateSystem===$a)o=0,l=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Ln("c",t,e,An,0,0,o),Ln("t",t,e,An,0,0,l),Ln("n1",t,e,An,-n,-r,o),Ln("n2",t,e,An,n,-r,o),Ln("n3",t,e,An,-n,r,o),Ln("n4",t,e,An,n,r,o),Ln("f1",t,e,An,-n,-r,l),Ln("f2",t,e,An,n,-r,l),Ln("f3",t,e,An,-n,r,l),Ln("f4",t,e,An,n,r,l),Ln("u1",t,e,An,n*.7,r*1.1,o),Ln("u2",t,e,An,-n*.7,r*1.1,o),Ln("u3",t,e,An,0,r*2,o),Ln("cf1",t,e,An,-n,0,l),Ln("cf2",t,e,An,n,0,l),Ln("cf3",t,e,An,0,-r,l),Ln("cf4",t,e,An,0,r,l),Ln("cn1",t,e,An,-n,0,o),Ln("cn2",t,e,An,n,0,o),Ln("cn3",t,e,An,0,-r,o),Ln("cn4",t,e,An,0,r,o),e.getAttribute("position").needsUpdate=!0}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}function Ln(i,e,t,n,r,o,l){Xh.set(r,o,l).unproject(n);const c=e[i];if(c!==void 0){const h=t.getAttribute("position");for(let d=0,p=c.length;d<p;d++)h.setXYZ(c[d],Xh.x,Xh.y,Xh.z)}}const qh=new gi;class B5 extends er{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(24),o=new bt;o.setIndex(new on(n,1)),o.setAttribute("position",new on(r,3)),super(o,new vi({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&qh.setFromObject(this.object),qh.isEmpty())return;const e=qh.min,t=qh.max,n=this.geometry.attributes.position,r=n.array;r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=e.x,r[4]=t.y,r[5]=t.z,r[6]=e.x,r[7]=e.y,r[8]=t.z,r[9]=t.x,r[10]=e.y,r[11]=t.z,r[12]=t.x,r[13]=t.y,r[14]=e.z,r[15]=e.x,r[16]=t.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=t.x,r[22]=e.y,r[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}class z5 extends er{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],o=new bt;o.setIndex(new on(n,1)),o.setAttribute("position",new Je(r,3)),super(o,new vi({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}class k5 extends Tr{constructor(e,t=1,n=16776960){const r=n,o=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],l=new bt;l.setAttribute("position",new Je(o,3)),l.computeBoundingSphere(),super(l,new vi({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const c=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],h=new bt;h.setAttribute("position",new Je(c,3)),h.computeBoundingSphere(),this.add(new Wn(h,new Ja({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Vx=new O;let $h,rm;class H5 extends Wt{constructor(e=new O(0,0,1),t=new O(0,0,0),n=1,r=16776960,o=n*.2,l=o*.2){super(),this.type="ArrowHelper",$h===void 0&&($h=new bt,$h.setAttribute("position",new Je([0,0,0,0,1,0],3)),rm=new nu(.5,1,5,1),rm.translate(0,-.5,0)),this.position.copy(t),this.line=new Tr($h,new vi({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Wn(rm,new Ja({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,o,l)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Vx.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Vx,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(){super.dispose(),this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class V5 extends er{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],r=new bt;r.setAttribute("position",new Je(t,3)),r.setAttribute("color",new Je(n,3));const o=new vi({vertexColors:!0,toneMapped:!1});super(r,o),this.type="AxesHelper"}setColors(e,t,n){const r=new Ge,o=this.geometry.attributes.color.array;return r.set(e),r.toArray(o,0),r.toArray(o,3),r.set(t),r.toArray(o,6),r.toArray(o,9),r.set(n),r.toArray(o,12),r.toArray(o,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){super.dispose(),this.geometry.dispose(),this.material.dispose()}}class G5{constructor(){this.type="ShapePath",this.color=new Ge,this.subPaths=[],this.currentPath=null,this.userData={}}moveTo(e,t){return this.currentPath=new Hc,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,r){return this.currentPath.quadraticCurveTo(e,t,n,r),this}bezierCurveTo(e,t,n,r,o,l){return this.currentPath.bezierCurveTo(e,t,n,r,o,l),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(){function e(h,d){let p=!1;const g=d.length;for(let v=0,_=g-1;v<g;_=v++){const y=d[v],w=d[_];y.y>h.y!=w.y>h.y&&h.x<(w.x-y.x)*(h.y-y.y)/(w.y-y.y)+y.x&&(p=!p)}return p}function t(h,d){const p=d.getCenter(new ue);if(e(p,h))return p;const g=p.y,v=[],_=h.length;for(let y=0;y<_;y++){const w=h[y],b=h[(y+1)%_];if(w.y>g!=b.y>g){const S=w.x+(g-w.y)*(b.x-w.x)/(b.y-w.y);v.push(S)}}return v.length>1&&(v.sort((y,w)=>y-w),p.x=(v[0]+v[1])/2),p}let n=this.userData.style&&this.userData.style.fillRule||"nonzero";n!=="nonzero"&&n!=="evenodd"&&(Fe('Fill-rule "'+n+'" is not supported, falling back to "nonzero".'),n="nonzero");const r=n==="nonzero"?(h=>h!==0):(h=>(h&1)!==0),o=[];for(const h of this.subPaths){const d=h.getPoints();if(d.length<3)continue;const p=Ls.area(d);if(p===0)continue;const g=new TS;for(let v=0;v<d.length;v++)g.expandByPoint(d[v]);o.push({subPath:h,points:d,boundingBox:g,interiorPoint:t(d,g),absArea:Math.abs(p),winding:p<0?-1:1,container:null,exclude:!1,role:null})}o.sort((h,d)=>d.absArea-h.absArea);for(let h=0;h<o.length;h++){const d=o[h];let p=0;for(let g=h-1;g>=0;g--){const v=o[g];if(v.boundingBox.containsBox(d.boundingBox)&&e(d.interiorPoint,v.points)){d.container=v.exclude?v.container:v,p=v.winding,d.winding+=p;break}}r(d.winding)===r(p)&&(d.exclude=!0)}for(const h of o)h.exclude||(h.role=h.container===null||h.container.role==="hole"?"outer":"hole");const l=[],c=new Map;for(const h of o){if(h.exclude||h.role!=="outer")continue;const d=new iu;d.curves=h.subPath.curves,l.push(d),c.set(h,d)}for(const h of o){if(h.exclude||h.role!=="hole")continue;const d=c.get(h.container);if(!d)continue;const p=new Hc;p.curves=h.subPath.curves,d.holes.push(p)}return l}}class W5 extends Bi{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function X5(i,e){const t=i.image&&i.image.width?i.image.width/i.image.height:1;return t>e?(i.repeat.x=1,i.repeat.y=t/e,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2):(i.repeat.x=e/t,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0),i}function q5(i,e){const t=i.image&&i.image.width?i.image.width/i.image.height:1;return t>e?(i.repeat.x=e/t,i.repeat.y=1,i.offset.x=(1-i.repeat.x)/2,i.offset.y=0):(i.repeat.x=1,i.repeat.y=t/e,i.offset.x=0,i.offset.y=(1-i.repeat.y)/2),i}function $5(i){return i.repeat.x=1,i.repeat.y=1,i.offset.x=0,i.offset.y=0,i}function Lm(i,e,t,n){const r=Y5(n);switch(t){case Qm:return i*e;case ad:return i*e/r.components*r.byteLength;case Kc:return i*e/r.components*r.byteLength;case ea:return i*e*2/r.components*r.byteLength;case od:return i*e*2/r.components*r.byteLength;case eg:return i*e*3/r.components*r.byteLength;case Mi:return i*e*4/r.components*r.byteLength;case ld:return i*e*4/r.components*r.byteLength;case yc:case Sc:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case bc:case Mc:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case ff:case pf:return Math.max(i,16)*Math.max(e,8)/4;case hf:case df:return Math.max(i,8)*Math.max(e,8)/2;case mf:case gf:case _f:case xf:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*8;case vf:case Nc:case yf:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case Sf:return Math.floor((i+3)/4)*Math.floor((e+3)/4)*16;case bf:return Math.floor((i+4)/5)*Math.floor((e+3)/4)*16;case Mf:return Math.floor((i+4)/5)*Math.floor((e+4)/5)*16;case wf:return Math.floor((i+5)/6)*Math.floor((e+4)/5)*16;case Tf:return Math.floor((i+5)/6)*Math.floor((e+5)/6)*16;case Ef:return Math.floor((i+7)/8)*Math.floor((e+4)/5)*16;case Af:return Math.floor((i+7)/8)*Math.floor((e+5)/6)*16;case Cf:return Math.floor((i+7)/8)*Math.floor((e+7)/8)*16;case Rf:return Math.floor((i+9)/10)*Math.floor((e+4)/5)*16;case If:return Math.floor((i+9)/10)*Math.floor((e+5)/6)*16;case Pf:return Math.floor((i+9)/10)*Math.floor((e+7)/8)*16;case Lf:return Math.floor((i+9)/10)*Math.floor((e+9)/10)*16;case Nf:return Math.floor((i+11)/12)*Math.floor((e+9)/10)*16;case Df:return Math.floor((i+11)/12)*Math.floor((e+11)/12)*16;case Uf:case Ff:case Of:return Math.ceil(i/4)*Math.ceil(e/4)*16;case Bf:case zf:return Math.ceil(i/4)*Math.ceil(e/4)*8;case Dc:case kf:return Math.ceil(i/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Y5(i){switch(i){case Mn:case Zm:return{byteLength:1,components:1};case fl:case jm:case ps:return{byteLength:2,components:1};case sd:case rd:return{byteLength:2,components:4};case ds:case id:case oi:return{byteLength:4,components:1};case Jm:case Km:return{byteLength:4,components:3}}throw new Error(`THREE.TextureUtils: Unknown texture type ${i}.`)}class Z5{static contain(e,t){return X5(e,t)}static cover(e,t){return q5(e,t)}static fill(e){return $5(e)}static getByteLength(e,t,n,r){return Lm(e,t,n,r)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:_l}}));typeof window<"u"&&(window.__THREE__?Fe("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=_l);/**
 * @license
 * Copyright 2010-2026 Three.js Authors
 * SPDX-License-Identifier: MIT
 */function AS(){let i=null,e=!1,t=null,n=null;function r(o,l){n=i.requestAnimationFrame(r),t(o,l)}return{start:function(){e!==!0&&t!==null&&i!==null&&(n=i.requestAnimationFrame(r),e=!0)},stop:function(){i!==null&&i.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(o){t=o},setContext:function(o){i=o}}}function j5(i){const e=new WeakMap;function t(c,h){const d=c.array,p=c.usage,g=d.byteLength,v=i.createBuffer();i.bindBuffer(h,v),i.bufferData(h,d,p),c.onUploadCallback();let _;if(d instanceof Float32Array)_=i.FLOAT;else if(typeof Float16Array<"u"&&d instanceof Float16Array)_=i.HALF_FLOAT;else if(d instanceof Uint16Array)c.isFloat16BufferAttribute?_=i.HALF_FLOAT:_=i.UNSIGNED_SHORT;else if(d instanceof Int16Array)_=i.SHORT;else if(d instanceof Uint32Array)_=i.UNSIGNED_INT;else if(d instanceof Int32Array)_=i.INT;else if(d instanceof Int8Array)_=i.BYTE;else if(d instanceof Uint8Array)_=i.UNSIGNED_BYTE;else if(d instanceof Uint8ClampedArray)_=i.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:v,type:_,bytesPerElement:d.BYTES_PER_ELEMENT,version:c.version,size:g}}function n(c,h,d){const p=h.array,g=h.updateRanges;if(i.bindBuffer(d,c),g.length===0)i.bufferSubData(d,0,p);else{g.sort((_,y)=>_.start-y.start);let v=0;for(let _=1;_<g.length;_++){const y=g[v],w=g[_];w.start<=y.start+y.count+1?y.count=Math.max(y.count,w.start+w.count-y.start):(++v,g[v]=w)}g.length=v+1;for(let _=0,y=g.length;_<y;_++){const w=g[_];i.bufferSubData(d,w.start*p.BYTES_PER_ELEMENT,p,w.start,w.count)}h.clearUpdateRanges()}h.onUploadCallback()}function r(c){return c.isInterleavedBufferAttribute&&(c=c.data),e.get(c)}function o(c){c.isInterleavedBufferAttribute&&(c=c.data);const h=e.get(c);h&&(i.deleteBuffer(h.buffer),e.delete(c))}function l(c,h){if(c.isInterleavedBufferAttribute&&(c=c.data),c.isGLBufferAttribute){const p=e.get(c);(!p||p.version<c.version)&&e.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}const d=e.get(c);if(d===void 0)e.set(c,t(c,h));else if(d.version<c.version){if(d.size!==c.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");n(d.buffer,c,h),d.version=c.version}}return{get:r,remove:o,update:l}}var J5=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,K5=`#ifdef USE_ALPHAHASH
	const float ALPHA_HASH_SCALE = 0.05;
	float hash2D( vec2 value ) {
		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	}
	float hash3D( vec3 value ) {
		return hash2D( vec2( hash2D( value.xy ), value.z ) );
	}
	float getAlphaHashThreshold( vec3 position ) {
		float maxDeriv = max(
			length( dFdx( position.xyz ) ),
			length( dFdy( position.xyz ) )
		);
		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		vec2 pixScales = vec2(
			exp2( floor( log2( pixScale ) ) ),
			exp2( ceil( log2( pixScale ) ) )
		);
		vec2 alpha = vec2(
			hash3D( floor( pixScales.x * position.xyz ) ),
			hash3D( floor( pixScales.y * position.xyz ) )
		);
		float lerpFactor = fract( log2( pixScale ) );
		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		float a = min( lerpFactor, 1.0 - lerpFactor );
		vec3 cases = vec3(
			x * x / ( 2.0 * a * ( 1.0 - a ) ),
			( x - 0.5 * a ) / ( 1.0 - a ),
			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		);
		float threshold = ( x < ( 1.0 - a ) )
			? ( ( x < a ) ? cases.x : cases.y )
			: cases.z;
		return clamp( threshold , 1.0e-6, 1.0 );
	}
#endif`,Q5=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,e6=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,t6=`#ifdef USE_ALPHATEST
	#ifdef ALPHA_TO_COVERAGE
	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
	if ( diffuseColor.a == 0.0 ) discard;
	#else
	if ( diffuseColor.a < alphaTest ) discard;
	#endif
#endif`,n6=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,i6=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_CLEARCOAT ) 
		clearcoatSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_SHEEN ) 
		sheenSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,s6=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,r6=`#ifdef USE_BATCHING
	#if ! defined( GL_ANGLE_multi_draw )
	#define gl_DrawID _gl_DrawID
	uniform int _gl_DrawID;
	#endif
	uniform highp sampler2D batchingTexture;
	uniform highp usampler2D batchingIdTexture;
	mat4 getBatchingMatrix( const in float i ) {
		int size = textureSize( batchingTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
	float getIndirectIndex( const in int i ) {
		int size = textureSize( batchingIdTexture, 0 ).x;
		int x = i % size;
		int y = i / size;
		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
	}
#endif
#ifdef USE_BATCHING_COLOR
	uniform sampler2D batchingColorTexture;
	vec4 getBatchingColor( const in float i ) {
		int size = textureSize( batchingColorTexture, 0 ).x;
		int j = int( i );
		int x = j % size;
		int y = j / size;
		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
	}
#endif`,a6=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,o6=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,l6=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,c6=`float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
} // validated`,u6=`#ifdef USE_IRIDESCENCE
	const mat3 XYZ_TO_REC709 = mat3(
		 3.2404542, -0.9692660,  0.0556434,
		-1.5371385,  1.8760108, -0.2040259,
		-0.4985314,  0.0415560,  1.0572252
	);
	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		vec3 sqrtF0 = sqrt( fresnel0 );
		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	}
	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	}
	float IorToFresnel0( float transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	}
	vec3 evalSensitivity( float OPD, vec3 shift ) {
		float phase = 2.0 * PI * OPD * 1.0e-9;
		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
		xyz /= 1.0685e-7;
		vec3 rgb = XYZ_TO_REC709 * xyz;
		return rgb;
	}
	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		vec3 I;
		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		float cosTheta2Sq = 1.0 - sinTheta2Sq;
		if ( cosTheta2Sq < 0.0 ) {
			return vec3( 1.0 );
		}
		float cosTheta2 = sqrt( cosTheta2Sq );
		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		float T121 = 1.0 - R12;
		float phi12 = 0.0;
		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
		float phi21 = PI - phi12;
		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		vec3 phi23 = vec3( 0.0 );
		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		vec3 phi = vec3( phi21 ) + phi23;
		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		vec3 r123 = sqrt( R123 );
		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		vec3 C0 = R12 + Rs;
		I = C0;
		vec3 Cm = Rs - T121;
		for ( int m = 1; m <= 2; ++ m ) {
			Cm *= r123;
			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			I += Cm * Sm;
		}
		return max( I, vec3( 0.0 ) );
	}
#endif`,h6=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vBumpMapUv );
		vec2 dSTdy = dFdy( vBumpMapUv );
		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,f6=`#if NUM_CLIPPING_PLANES > 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`,d6=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,p6=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,m6=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,g6=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#endif`,v6=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#endif`,_6=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec4 vColor;
#endif`,x6=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	vColor = vec4( 1.0 );
#endif
#ifdef USE_COLOR_ALPHA
	vColor *= color;
#elif defined( USE_COLOR )
	vColor.rgb *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.rgb *= instanceColor.rgb;
#endif
#ifdef USE_BATCHING_COLOR
	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
#endif`,y6=`#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 );
}
#define inverseTransformDirection transformDirectionByInverseViewMatrix
vec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {
	return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );
}
vec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {
	return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );
}
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`,S6=`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;
#endif`,b6=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,M6=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,w6=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,T6=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,E6="gl_FragColor = linearToOutputTexel( gl_FragColor );",A6=`vec4 LinearTransferOETF( in vec4 value ) {
	return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 sRGBTransferOETF( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,C6=`#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 = transformNormalByInverseViewMatrix( 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 * reflectVec );
		#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
#endif`,R6=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform mat3 envMapRotation;
	uniform samplerCube envMap;
	#ifdef ENVMAP_TYPE_PMREM
		float roughnessToMip( const in float roughness ) {
			float r = clamp( roughness, 0.0, 1.0 );
			return ENVMAP_MAX_LOD * r * ( 2.0 - r );
		}
	#endif
#endif`,I6=`#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`,P6=`#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`,L6=`#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 = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,N6=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,D6=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,U6=`#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`,F6=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,O6=`#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
}`,B6=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,z6=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,k6=`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`,H6=`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 = transformNormalByInverseViewMatrix( 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_SUN_LIGHTS > 0
	struct SunLight {
		vec3 direction;
		vec3 color;
	};
	uniform SunLight sunLights[ NUM_SUN_LIGHTS ];
	void getSunLightInfo( const in SunLight sunLight, out IncidentLight light ) {
		light.color = sunLight.color;
		light.direction = sunLight.direction;
		light.visible = true;
	}
#endif
#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
#include <lightprobes_pars_fragment>`,V6=`#ifdef USE_ENVMAP
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#ifdef ENVMAP_TYPE_PMREM
			vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );
			vec4 envMapColor = textureLod( envMap, envMapRotation * worldNormal, ENVMAP_MAX_LOD );
			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_PMREM
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
			reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );
			vec4 envMapColor = textureLod( envMap, envMapRotation * reflectVec, roughnessToMip( roughness ) );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	#ifdef USE_RETROREFLECTION
		vec3 getIBLRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
			#ifdef ENVMAP_TYPE_PMREM
				vec3 retroVec = normalize( mix( viewDir, normal, pow4( roughness ) ) );
				retroVec = transformDirectionByInverseViewMatrix( retroVec, viewMatrix );
				vec4 envMapColor = textureLod( envMap, envMapRotation * retroVec, roughnessToMip( roughness ) );
				return envMapColor.rgb * envMapIntensity;
			#else
				return vec3( 0.0 );
			#endif
		}
	#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_PMREM
				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
		}
		#ifdef USE_RETROREFLECTION
			vec3 getIBLAnisotropyRetroRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
				#ifdef ENVMAP_TYPE_PMREM
					vec3 bentNormal = cross( bitangent, viewDir );
					bentNormal = normalize( cross( bentNormal, bitangent ) );
					bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
					return getIBLRetroRadiance( viewDir, bentNormal, roughness );
				#else
					return vec3( 0.0 );
				#endif
			}
		#endif
	#endif
#endif`,G6=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,W6=`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`,X6=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,q6=`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`,$6=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
material.metalness = 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.045 );
material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef USE_DIFFUSE_ROUGHNESS
	float diffuseRoughnessFactor = diffuseRoughness;
	#ifdef USE_DIFFUSE_ROUGHNESSMAP
		diffuseRoughnessFactor *= texture2D( diffuseRoughnessMap, vDiffuseRoughnessMapUv ).r;
	#endif
	material.diffuseRoughness = saturate( diffuseRoughnessFactor );
#endif
#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 = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = vec3( 0.04 );
	material.specularColorBlended = mix( material.specularColor, 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.045 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
	material.dispersion = dispersion;
#endif
#ifdef USE_RETROREFLECTION
	material.retroreflectivity = retroreflectivity;
#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.0001, 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`,Y6=`uniform sampler2D dfgLUT;
struct PhysicalMaterial {
	vec3 diffuseColor;
	vec3 diffuseContribution;
	vec3 specularColor;
	vec3 specularColorBlended;
	float roughness;
	float metalness;
	float specularF90;
	float dispersion;
	vec2 dfg;
	vec3 multiScatteringCompensation;
	#ifdef USE_DIFFUSE_ROUGHNESS
		float diffuseRoughness;
	#endif
	#ifdef USE_RETROREFLECTION
		float retroreflectivity;
	#endif
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0Dielectric;
		vec3 iridescenceF0Metallic;
	#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 );
}
#ifdef USE_DIFFUSE_ROUGHNESS
	const float EON_EPSILON = 1e-7;
	float FON_DirectionalAlbedo( const in float mu, const in float roughness, const in float A ) {
		float muComp = 1.0 - mu;
		float gOverPi = muComp * ( 0.0571085289 + muComp * ( 0.491881867 + muComp * ( - 0.332181442 + muComp * 0.0714429953 ) ) );
		return A * ( 1.0 + roughness * gOverPi );
	}
	vec3 BRDF_EON( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 diffuseColor, const in float roughness ) {
		vec3 rho = saturate( diffuseColor );
		if ( roughness <= EON_EPSILON ) return BRDF_Lambert( rho );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float s = dot( lightDir, viewDir ) - dotNL * dotNV;
		float sOverT = ( s > 0.0 ) ? s / max( max( dotNL, dotNV ), EON_EPSILON ) : s;
		float A = 1.0 / ( 1.0 + ( 0.5 - 2.0 / ( 3.0 * PI ) ) * roughness );
		vec3 singleScatter = rho * RECIPROCAL_PI * A * ( 1.0 + roughness * sOverT );
		float averageAlbedo = A * ( 1.0 + ( 2.0 / 3.0 - 28.0 / ( 15.0 * PI ) ) * roughness );
		float albedoV = FON_DirectionalAlbedo( dotNV, roughness, A );
		float albedoL = FON_DirectionalAlbedo( dotNL, roughness, A );
		vec3 rhoMultiScatter = rho * rho * averageAlbedo / max( vec3( EON_EPSILON ), vec3( 1.0 ) - rho * ( 1.0 - averageAlbedo ) );
		vec3 multiScatter = rhoMultiScatter * RECIPROCAL_PI
			* max( EON_EPSILON, 1.0 - albedoV )
			* max( EON_EPSILON, 1.0 - albedoL )
			/ max( EON_EPSILON, 1.0 - averageAlbedo );
		return singleScatter + multiScatter;
	}
	vec3 EON_DirectionalAlbedo( const in vec3 diffuseColor, const in float roughness, const in float dotNV ) {
		vec3 rho = saturate( diffuseColor );
		if ( roughness <= EON_EPSILON ) return rho;
		float A = 1.0 / ( 1.0 + ( 0.5 - 2.0 / ( 3.0 * PI ) ) * roughness );
		float directionalAlbedo = FON_DirectionalAlbedo( dotNV, roughness, A );
		float averageAlbedo = A * ( 1.0 + ( 2.0 / 3.0 - 28.0 / ( 15.0 * PI ) ) * roughness );
		vec3 rhoMultiScatter = rho * rho * averageAlbedo / max( vec3( EON_EPSILON ), vec3( 1.0 ) - rho * ( 1.0 - averageAlbedo ) );
		return rho * directionalAlbedo + rhoMultiScatter * ( 1.0 - directionalAlbedo );
	}
#endif
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 ) );
		return 0.5 / max( gv + gl, EPSILON );
	}
	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 = max( material.clearcoatRoughness, 0.045 );
		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.specularColorBlended;
	float f90 = material.specularF90;
	float roughness = max( material.roughness, 0.045 );
	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 alphaT = max( material.alphaT, alpha );
		float V = V_GGX_SmithCorrelated_Anisotropic( alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		float D = D_GGX_Anisotropic( 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 * transpose( 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 rInv = 1.0 / ( roughness + 0.1 );
	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
	float DG = exp( a * dotNV + b );
	return saturate( DG );
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec2 fab, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec2 fab, const in vec3 specularColor, const in float specularF90, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
	#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.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
		#ifdef USE_CLEARCOAT
			vec3 Ncc = geometryClearcoatNormal;
			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
			mat3 mInvClearcoat = mat3(
				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
				vec3(             0, 1,             0 ),
				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
			);
			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
		#endif
	}
#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 );
 
 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
 
 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
 
 		irradiance *= sheenEnergyComp;
 
 	#endif
	vec3 specularBRDF = BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
	#ifdef USE_RETROREFLECTION
		vec3 retroViewDir = reflect( - geometryViewDir, geometryNormal );
		vec3 retroSpecularBRDF = BRDF_GGX( directLight.direction, retroViewDir, geometryNormal, material );
		specularBRDF = mix( specularBRDF, retroSpecularBRDF, saturate( material.retroreflectivity ) );
	#endif
	reflectedLight.directSpecular += irradiance * specularBRDF * material.multiScatteringCompensation;
	vec3 halfDir = normalize( directLight.direction + geometryViewDir );
	float dotVH = saturate( dot( geometryViewDir, halfDir ) );
	vec3 F = F_Schlick( material.specularColor, material.specularF90, dotVH );
	#ifdef USE_RETROREFLECTION
		vec3 retroHalfDir = normalize( directLight.direction + retroViewDir );
		float dotRetroVH = saturate( dot( retroViewDir, retroHalfDir ) );
		vec3 retroF = F_Schlick( material.specularColor, material.specularF90, dotRetroVH );
		F = mix( F, retroF, saturate( material.retroreflectivity ) );
	#endif
	#ifdef USE_DIFFUSE_ROUGHNESS
		vec3 diffuseBRDF = BRDF_EON( directLight.direction, geometryViewDir, geometryNormal, material.diffuseColor, material.diffuseRoughness ) * ( 1.0 - material.metalness );
	#else
		vec3 diffuseBRDF = BRDF_Lambert( material.diffuseContribution );
	#endif
	reflectedLight.directDiffuse += irradiance * diffuseBRDF * ( 1.0 - F );
}
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 ) {
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScattering, multiScattering );
	#else
		computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScattering, multiScattering );
	#endif
	#ifdef USE_DIFFUSE_ROUGHNESS
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		vec3 diffuseAlbedo = EON_DirectionalAlbedo( material.diffuseColor, material.diffuseRoughness, dotNV ) * ( 1.0 - material.metalness );
		vec3 diffuse = irradiance * RECIPROCAL_PI * diffuseAlbedo * ( 1.0 - singleScattering - multiScattering );
	#else
		vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution ) * ( 1.0 - singleScattering - multiScattering );
	#endif
	#ifdef USE_SHEEN
		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
		sheenSpecularIndirect += irradiance * material.sheenColor * sheenAlbedo * RECIPROCAL_PI;
		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
		diffuse *= sheenEnergyComp;
	#endif
	reflectedLight.indirectDiffuse += diffuse;
}
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 ) * RECIPROCAL_PI;
 	#endif
	vec3 singleScatteringDielectric = vec3( 0.0 );
	vec3 multiScatteringDielectric = vec3( 0.0 );
	vec3 singleScatteringMetallic = vec3( 0.0 );
	vec3 multiScatteringMetallic = vec3( 0.0 );
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( material.dfg, material.specularColor, material.specularF90, material.iridescence, material.iridescenceF0Dielectric, singleScatteringDielectric, multiScatteringDielectric );
		computeMultiscatteringIridescence( material.dfg, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceF0Metallic, singleScatteringMetallic, multiScatteringMetallic );
	#else
		computeMultiscattering( material.dfg, material.specularColor, material.specularF90, singleScatteringDielectric, multiScatteringDielectric );
		computeMultiscattering( material.dfg, material.diffuseColor, material.specularF90, singleScatteringMetallic, multiScatteringMetallic );
	#endif
	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
	#ifdef USE_DIFFUSE_ROUGHNESS
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		vec3 diffuse = EON_DirectionalAlbedo( material.diffuseColor, material.diffuseRoughness, dotNV ) * ( 1.0 - material.metalness ) * ( 1.0 - totalScatteringDielectric );
	#else
		vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
	#endif
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	vec3 indirectSpecular = radiance * singleScattering;
	indirectSpecular += multiScattering * cosineWeightedIrradiance;
	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
	#ifdef USE_SHEEN
		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
		indirectSpecular *= sheenEnergyComp;
		indirectDiffuse *= sheenEnergyComp;
	#endif
	reflectedLight.indirectSpecular += indirectSpecular;
	reflectedLight.indirectDiffuse += indirectDiffuse;
}
#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 );
}`,Z6=`
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 ) {
		vec3 iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		vec3 iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
		material.iridescenceFresnel = mix( iridescenceFresnelDielectric, iridescenceFresnelMetallic, material.metalness );
		material.iridescenceF0Dielectric = Schlick_to_F0( iridescenceFresnelDielectric, 1.0, dotNVi );
		material.iridescenceF0Metallic = Schlick_to_F0( iridescenceFresnelMetallic, 1.0, dotNVi );
	}
#endif
#ifdef STANDARD
	float dotNVms = saturate( dot( geometryNormal, geometryViewDir ) );
	material.dfg = texture2D( dfgLUT, vec2( material.roughness, dotNVms ) ).rg;
	#if ( NUM_SUN_LIGHTS > 0 || NUM_DIR_LIGHTS > 0 || NUM_POINT_LIGHTS > 0 || NUM_SPOT_LIGHTS > 0 )
		float EssMs = material.dfg.x + material.dfg.y;
		material.multiScatteringCompensation = 1.0 + material.specularColorBlended * ( 1.0 / EssMs - 1.0 );
	#endif
#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 ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometryPosition, directLight );
		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SUN_LIGHTS > 0 ) && defined( RE_Direct )
	SunLight sunLight;
	#if defined( USE_SHADOWMAP ) && NUM_SUN_LIGHT_SHADOWS > 0
	SunLightShadow sunLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SUN_LIGHTS; i ++ ) {
		sunLight = sunLights[ i ];
		getSunLightInfo( sunLight, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SUN_LIGHT_SHADOWS )
		sunLightShadow = sunLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getSunShadow( sunShadowMap[ i ], sunLightShadow, UNROLLED_LOOP_INDEX ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	#if defined( USE_LIGHT_PROBES )
		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	#endif
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		}
		#pragma unroll_loop_end
	#endif
	#if NUM_LIGHT_PROBE_GRIDS > 0
		vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
		vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );
		int probeGrid = - 1;
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_LIGHT_PROBE_GRIDS; i ++ ) {
			if ( isInsideLightProbeGrid( probeWorldPos, probeWorldNormal, probesMin[ i ], probesMax[ i ], probesResolution[ i ] ) ) probeGrid = UNROLLED_LOOP_INDEX;
		}
		#pragma unroll_loop_end
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_LIGHT_PROBE_GRIDS; i ++ ) {
			if ( probeGrid == UNROLLED_LOOP_INDEX ) irradiance += getLightProbeGridIrradiance( probesSH[ i ], probesMin[ i ], probesMax[ i ], probesResolution[ i ], probeWorldPos, probeWorldNormal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,j6=`#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( ENVMAP_TYPE_PMREM )
		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
			iblIrradiance += getIBLIrradiance( geometryNormal );
		#endif
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	#ifdef USE_ANISOTROPY
		vec3 iblRadiance = getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	#else
		vec3 iblRadiance = getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	#endif
	#ifdef USE_RETROREFLECTION
		#ifdef USE_ANISOTROPY
			vec3 retroIBLRadiance = getIBLAnisotropyRetroRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
		#else
			vec3 retroIBLRadiance = getIBLRetroRadiance( geometryViewDir, geometryNormal, material.roughness );
		#endif
		iblRadiance = mix( iblRadiance, retroIBLRadiance, saturate( material.retroreflectivity ) );
	#endif
	radiance += iblRadiance;
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,J6=`#if defined( RE_IndirectDiffuse )
	#if defined( LAMBERT ) || defined( PHONG )
		irradiance += iblIrradiance;
	#endif
	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`,K6=`#if NUM_LIGHT_PROBE_GRIDS > 0
uniform highp sampler3D probesSH[ NUM_LIGHT_PROBE_GRIDS ];
uniform vec3 probesMin[ NUM_LIGHT_PROBE_GRIDS ];
uniform vec3 probesMax[ NUM_LIGHT_PROBE_GRIDS ];
uniform vec3 probesResolution[ NUM_LIGHT_PROBE_GRIDS ];
bool isInsideLightProbeGrid( vec3 worldPos, vec3 worldNormal, vec3 probesMin, vec3 probesMax, vec3 probesResolution ) {
	vec3 spacing = ( probesMax - probesMin ) / probesResolution;
	vec3 samplePos = worldPos + worldNormal * spacing * 0.5;
	vec3 margin = spacing * 0.01;
	return all( greaterThanEqual( samplePos, probesMin - margin ) ) && all( lessThanEqual( samplePos, probesMax + margin ) );
}
vec3 getLightProbeGridIrradiance( highp sampler3D probesSH, vec3 probesMin, vec3 probesMax, vec3 probesResolution, vec3 worldPos, vec3 worldNormal ) {
	vec3 res = probesResolution;
	vec3 gridRange = probesMax - probesMin;
	vec3 probeSpacing = gridRange / res;
	vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
	vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.5 / res, 1.0 - 0.5 / res );
	float nz          = res.z;
	float paddedSlices = nz + 2.0;
	float atlasDepth  = 7.0 * paddedSlices;
	float uvZBase     = uvw.z * nz + 1.0;
	vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase                       ) / atlasDepth ) );
	vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase +       paddedSlices   ) / atlasDepth ) );
	vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices   ) / atlasDepth ) );
	vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices   ) / atlasDepth ) );
	vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices   ) / atlasDepth ) );
	vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices   ) / atlasDepth ) );
	vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices   ) / atlasDepth ) );
	vec3 c0 = s0.xyz;
	vec3 c1 = vec3( s0.w, s1.xy );
	vec3 c2 = vec3( s1.zw, s2.x );
	vec3 c3 = s2.yzw;
	vec3 c4 = s3.xyz;
	vec3 c5 = vec3( s3.w, s4.xy );
	vec3 c6 = vec3( s4.zw, s5.x );
	vec3 c7 = s5.yzw;
	vec3 c8 = s6.xyz;
	float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
	vec3 result = c0 * 0.886227;
	result += c1 * 2.0 * 0.511664 * y;
	result += c2 * 2.0 * 0.511664 * z;
	result += c3 * 2.0 * 0.511664 * x;
	result += c4 * 2.0 * 0.429043 * x * y;
	result += c5 * 2.0 * 0.429043 * y * z;
	result += c6 * ( 0.743125 * z * z - 0.247708 );
	result += c7 * 2.0 * 0.429043 * x * z;
	result += c8 * 0.429043 * ( x * x - y * y );
	return max( result, vec3( 0.0 ) );
}
#endif`,Q6=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,eA=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,tA=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,nA=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,iA=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,sA=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,rA=`#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`,aA=`#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`,oA=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,lA=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,cA=`#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`,uA=`#if defined( USE_MORPHCOLORS )
	#if defined( USE_COLOR_ALPHA )
		vColor *= morphTargetBaseInfluence;
	#elif defined( USE_COLOR )
		vColor.rgb *= morphTargetBaseInfluence;
	#endif
	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.rgb += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,hA=`#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`,fA=`#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`,dA=`#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`,pA=`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
	#ifdef DOUBLE_SIDED
		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
	#ifdef DOUBLE_SIDED
		tbn2[0] *= faceDirection;
		tbn2[1] *= faceDirection;
	#endif
#endif
vec3 nonPerturbedNormal = normal;`,mA=`#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;
	#if defined( USE_PACKED_NORMALMAP )
		mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
	#endif
	mapN.xy *= normalScale;
	normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,gA=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,vA=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,_A=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
		#ifdef FLIP_SIDED
			vBitangent = - vBitangent;
		#endif
	#endif
#endif`,xA=`#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`,yA=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,SA=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,bA=`#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`,MA=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,wA=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,TA=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
	if( v <= 0.0 )
		return vec4( 0., 0., 0., 0. );
	if( v >= 1.0 )
		return vec4( 1., 1., 1., 1. );
	float vuf;
	float af = modf( v * PackFactors.a, vuf );
	float bf = modf( vuf * ShiftRight8, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
	if( v <= 0.0 )
		return vec3( 0., 0., 0. );
	if( v >= 1.0 )
		return vec3( 1., 1., 1. );
	float vuf;
	float bf = modf( v * PackFactors.b, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
	if( v <= 0.0 )
		return vec2( 0., 0. );
	if( v >= 1.0 )
		return vec2( 1., 1. );
	float vuf;
	float gf = modf( v * 256., vuf );
	return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
	return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
	#ifdef USE_REVERSED_DEPTH_BUFFER
	
		return depth * ( far - near ) - far;
	#else
		return depth * ( near - far ) - near;
	#endif
}
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 ) {
	
	#ifdef USE_REVERSED_DEPTH_BUFFER
		return ( near * far ) / ( ( near - far ) * depth - near );
	#else
		return ( near * far ) / ( ( far - near ) * depth - far );
	#endif
}`,EA=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,AA=`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;`,CA=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,RA=`#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`,IA=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,PA=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,LA=`#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_SUN_LIGHT_SHADOWS > 0
		#define SUN_LIGHT_CASCADES 2
		#if defined( SHADOWMAP_TYPE_PCF )
			uniform sampler2DShadow sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];
		#else
			uniform sampler2D sunShadowMap[ NUM_SUN_LIGHT_SHADOWS ];
		#endif
		uniform mat4 sunShadowMatrix[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];
		uniform vec4 sunShadowCascade[ NUM_SUN_LIGHT_SHADOWS * SUN_LIGHT_CASCADES ];
		varying vec4 vSunShadowWorldPosition;
		varying vec3 vSunShadowWorldNormal;
		struct SunLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SunLightShadow sunLightShadows[ NUM_SUN_LIGHT_SHADOWS ];
	#endif
	#if NUM_DIR_LIGHT_SHADOWS > 0
		#if defined( SHADOWMAP_TYPE_PCF )
			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		#else
			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		#endif
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		#if defined( SHADOWMAP_TYPE_PCF )
			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		#else
			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		#endif
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		#if defined( SHADOWMAP_TYPE_PCF )
			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		#elif defined( SHADOWMAP_TYPE_BASIC )
			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		#endif
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	#if defined( SHADOWMAP_TYPE_PCF )
		float interleavedGradientNoise( vec2 position ) {
			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
		}
		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
			const float goldenAngle = 2.399963229728653;
			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
			float theta = float( sampleIndex ) * goldenAngle + phi;
			return vec2( cos( theta ), sin( theta ) ) * r;
		}
	#endif
	#if defined( SHADOWMAP_TYPE_PCF )
		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
			float shadow = 1.0;
			shadowCoord.xyz /= shadowCoord.w;
			#ifdef USE_REVERSED_DEPTH_BUFFER
				shadowCoord.z -= shadowBias;
			#else
				shadowCoord.z += shadowBias;
			#endif
			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 ) {
				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
				vec2 radius = shadowRadius * texelSize;
				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
				shadow = (
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
				) * 0.2;
			}
			return mix( 1.0, shadow, shadowIntensity );
		}
	#elif defined( SHADOWMAP_TYPE_VSM )
		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
			float shadow = 1.0;
			shadowCoord.xyz /= shadowCoord.w;
			#ifdef USE_REVERSED_DEPTH_BUFFER
				shadowCoord.z -= shadowBias;
			#else
				shadowCoord.z += shadowBias;
			#endif
			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 ) {
				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
				float mean = distribution.x;
				float variance = distribution.y * distribution.y;
				#ifdef USE_REVERSED_DEPTH_BUFFER
					float hard_shadow = step( mean, shadowCoord.z );
				#else
					float hard_shadow = step( shadowCoord.z, mean );
				#endif
				
				if ( hard_shadow == 1.0 ) {
					shadow = 1.0;
				} else {
					variance = max( variance, 0.0000001 );
					float d = shadowCoord.z - mean;
					float p_max = variance / ( variance + d * d );
					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
					shadow = max( hard_shadow, p_max );
				}
			}
			return mix( 1.0, shadow, shadowIntensity );
		}
	#else
		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
			float shadow = 1.0;
			shadowCoord.xyz /= shadowCoord.w;
			#ifdef USE_REVERSED_DEPTH_BUFFER
				shadowCoord.z -= shadowBias;
			#else
				shadowCoord.z += shadowBias;
			#endif
			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 ) {
				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
				#ifdef USE_REVERSED_DEPTH_BUFFER
					shadow = step( depth, shadowCoord.z );
				#else
					shadow = step( shadowCoord.z, depth );
				#endif
			}
			return mix( 1.0, shadow, shadowIntensity );
		}
	#endif
	#if NUM_SUN_LIGHT_SHADOWS > 0
		float getSunShadow(
			#if defined( SHADOWMAP_TYPE_PCF )
				sampler2DShadow shadowMap,
			#else
				sampler2D shadowMap,
			#endif
			SunLightShadow sunLightShadow,
			int shadowIndex
		) {
			vec4 shadowWorldPosition = vec4( vSunShadowWorldPosition.xyz + vSunShadowWorldNormal * sunLightShadow.shadowNormalBias, 1.0 );
			float viewDepth = vSunShadowWorldPosition.w;
			int cascadeOffset = shadowIndex * SUN_LIGHT_CASCADES;
			float shadow = 1.0;
			for ( int i = SUN_LIGHT_CASCADES - 1; i >= 0; i -- ) {
				vec4 cascade = sunShadowCascade[ cascadeOffset + i ];
				if ( viewDepth >= cascade.x && viewDepth < cascade.y ) {
					float cascadeShadow = getShadow(
						shadowMap,
						sunLightShadow.shadowMapSize,
						sunLightShadow.shadowIntensity,
						sunLightShadow.shadowBias,
						sunLightShadow.shadowRadius,
						sunShadowMatrix[ cascadeOffset + i ] * shadowWorldPosition
					);
					shadow = mix( cascadeShadow, shadow, smoothstep( cascade.z, cascade.y, viewDepth ) );
				}
			}
			return shadow;
		}
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	#if defined( SHADOWMAP_TYPE_PCF )
	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		vec3 bd3D = normalize( lightToPosition );
		vec3 absVec = abs( lightToPosition );
		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
			float lightDistance = length( lightToPosition );
			float depthRange = shadowCameraFar - shadowCameraNear;
			#ifdef USE_REVERSED_DEPTH_BUFFER
				float depthA = - shadowCameraNear / depthRange - shadowBias;
				float depthB = shadowCameraNear * shadowCameraFar / ( depthRange * lightDistance );
			#else
				float depthA = shadowCameraFar / depthRange + shadowBias;
				float depthB = - shadowCameraNear * shadowCameraFar / ( depthRange * lightDistance );
			#endif
			float texelSize = shadowRadius / shadowMapSize.x;
			vec3 absDir = abs( bd3D );
			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
			tangent = normalize( cross( bd3D, tangent ) );
			vec3 bitangent = cross( bd3D, tangent );
			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
			shadow = 0.0;
			for ( int i = 0; i < 5; i ++ ) {
				vec2 offset = vogelDiskSample( i, 5, phi );
				vec3 direction = bd3D + ( tangent * offset.x + bitangent * offset.y ) * texelSize;
				vec3 absDirection = abs( direction );
				float dp = depthA + depthB / max( max( absDirection.x, absDirection.y ), absDirection.z );
				shadow += texture( shadowMap, vec4( direction, dp ) );
			}
			shadow *= 0.2;
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	#elif defined( SHADOWMAP_TYPE_BASIC )
	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		vec3 absVec = abs( lightToPosition );
		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
			dp += shadowBias;
			vec3 bd3D = normalize( lightToPosition );
			float depth = textureCube( shadowMap, bd3D ).r;
			#ifdef USE_REVERSED_DEPTH_BUFFER
				depth = 1.0 - depth;
			#endif
			shadow = step( dp, depth );
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	#endif
	#endif
#endif`,NA=`#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_SUN_LIGHT_SHADOWS > 0
		varying vec4 vSunShadowWorldPosition;
		varying vec3 vSunShadowWorldNormal;
	#endif
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,DA=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SUN_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
	#ifdef HAS_NORMAL
		vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );
	#else
		vec3 shadowWorldNormal = vec3( 0.0 );
	#endif
	vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
	#if NUM_SUN_LIGHT_SHADOWS > 0
		vSunShadowWorldPosition = vec4( worldPosition.xyz, - mvPosition.z );
		vSunShadowWorldNormal = shadowWorldNormal;
	#endif
	#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`,UA=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_SUN_LIGHT_SHADOWS > 0
	SunLightShadow sunLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SUN_LIGHT_SHADOWS; i ++ ) {
		sunLight = sunLightShadows[ i ];
		shadow *= receiveShadow ? getSunShadow( sunShadowMap[ i ], sunLight, UNROLLED_LOOP_INDEX ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,FA=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,OA=`#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`,BA=`#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`,zA=`#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`,kA=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,HA=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,VA=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,GA=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
	vec3( 1.6605, - 0.1246, - 0.0182 ),
	vec3( - 0.5876, 1.1329, - 0.1006 ),
	vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
	vec3( 0.6274, 0.0691, 0.0164 ),
	vec3( 0.3293, 0.9195, 0.0880 ),
	vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
	vec3 x2 = x * x;
	vec3 x4 = x2 * x2;
	return + 15.5 * x4 * x2
		- 40.14 * x4 * x
		+ 31.96 * x4
		- 6.868 * x2 * x
		+ 0.4298 * x2
		+ 0.1191 * x
		- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
	const mat3 AgXInsetMatrix = mat3(
		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
	);
	const mat3 AgXOutsetMatrix = mat3(
		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
	);
	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
	color *= toneMappingExposure;
	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
	color = AgXInsetMatrix * color;
	color = max( color, 1e-10 );	color = log2( color );
	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
	color = clamp( color, 0.0, 1.0 );
	color = agxDefaultContrastApprox( color );
	color = AgXOutsetMatrix * color;
	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
	color = clamp( color, 0.0, 1.0 );
	return color;
}
vec3 NeutralToneMapping( vec3 color ) {
	const float StartCompression = 0.8 - 0.04;
	const float Desaturation = 0.15;
	color *= toneMappingExposure;
	float x = min( color.r, min( color.g, color.b ) );
	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
	color -= offset;
	float peak = max( color.r, max( color.g, color.b ) );
	if ( peak < StartCompression ) return color;
	float d = 1. - StartCompression;
	float newPeak = 1. - d * d / ( peak + d - StartCompression );
	color *= newPeak / peak;
	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
	return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,WA=`#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 = transformNormalByInverseViewMatrix( normal, viewMatrix );
	vec4 transmitted = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, 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`,XA=`#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`,qA=`#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_DIFFUSE_ROUGHNESSMAP
	varying vec2 vDiffuseRoughnessMapUv;
#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`,$A=`#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_DIFFUSE_ROUGHNESSMAP
	uniform mat3 diffuseRoughnessMapTransform;
	varying vec2 vDiffuseRoughnessMapUv;
#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`,YA=`#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_DIFFUSE_ROUGHNESSMAP
	vDiffuseRoughnessMapUv = ( diffuseRoughnessMapTransform * vec3( DIFFUSE_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`,ZA=`#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 jA=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,JA=`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 <tonemapping_fragment>
	#include <colorspace_fragment>
}`,KA=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,QA=`uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <envmap_common_pars_fragment>
void main() {
	#ifdef ENVMAP_TYPE_PMREM
		vec4 texColor = textureLod( envMap, backgroundRotation * vWorldDirection, roughnessToMip( backgroundBlurriness ) );
	#else
		vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,e8=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,t8=`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 <tonemapping_fragment>
	#include <colorspace_fragment>
}`,n8=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`,i8=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <logdepthbuf_fragment>
	#ifdef USE_REVERSED_DEPTH_BUFFER
		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
	#else
		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
	#endif
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#elif DEPTH_PACKING == 3202
		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
	#elif DEPTH_PACKING == 3203
		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
	#endif
}`,s8=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,r8=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
}`,a8=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,o8=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,l8=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,c8=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,u8=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinbase_vertex>
		#include <skinnormal_vertex>
		#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,h8=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	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 <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,f8=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,d8=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_lambert_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,p8=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,m8=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	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 <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,g8=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	vViewPosition = - mvPosition.xyz;
#endif
}`,v8=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,_8=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,x8=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,y8=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,S8=`#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_DIFFUSE_ROUGHNESS
	uniform float diffuseRoughness;
	#ifdef USE_DIFFUSE_ROUGHNESSMAP
		uniform sampler2D diffuseRoughnessMap;
	#endif
#endif
#ifdef USE_DISPERSION
	uniform float dispersion;
#endif
#ifdef USE_RETROREFLECTION
	uniform float retroreflectivity;
#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 <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
 
		outgoingLight = outgoingLight + 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 <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,b8=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,M8=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,w8=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#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 <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,T8=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,E8=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,A8=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	#include <logdepthbuf_fragment>
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,C8=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix[ 3 ];
	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,R8=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,Et={alphahash_fragment:J5,alphahash_pars_fragment:K5,alphamap_fragment:Q5,alphamap_pars_fragment:e6,alphatest_fragment:t6,alphatest_pars_fragment:n6,aomap_fragment:i6,aomap_pars_fragment:s6,batching_pars_vertex:r6,batching_vertex:a6,begin_vertex:o6,beginnormal_vertex:l6,bsdfs:c6,iridescence_fragment:u6,bumpmap_pars_fragment:h6,clipping_planes_fragment:f6,clipping_planes_pars_fragment:d6,clipping_planes_pars_vertex:p6,clipping_planes_vertex:m6,color_fragment:g6,color_pars_fragment:v6,color_pars_vertex:_6,color_vertex:x6,common:y6,defaultnormal_vertex:S6,displacementmap_pars_vertex:b6,displacementmap_vertex:M6,emissivemap_fragment:w6,emissivemap_pars_fragment:T6,colorspace_fragment:E6,colorspace_pars_fragment:A6,envmap_fragment:C6,envmap_common_pars_fragment:R6,envmap_pars_fragment:I6,envmap_pars_vertex:P6,envmap_physical_pars_fragment:V6,envmap_vertex:L6,fog_vertex:N6,fog_pars_vertex:D6,fog_fragment:U6,fog_pars_fragment:F6,gradientmap_pars_fragment:O6,lightmap_pars_fragment:B6,lights_lambert_fragment:z6,lights_lambert_pars_fragment:k6,lights_pars_begin:H6,lights_toon_fragment:G6,lights_toon_pars_fragment:W6,lights_phong_fragment:X6,lights_phong_pars_fragment:q6,lights_physical_fragment:$6,lights_physical_pars_fragment:Y6,lights_fragment_begin:Z6,lights_fragment_maps:j6,lights_fragment_end:J6,lightprobes_pars_fragment:K6,logdepthbuf_fragment:Q6,logdepthbuf_pars_fragment:eA,logdepthbuf_pars_vertex:tA,logdepthbuf_vertex:nA,map_fragment:iA,map_pars_fragment:sA,map_particle_fragment:rA,map_particle_pars_fragment:aA,metalnessmap_fragment:oA,metalnessmap_pars_fragment:lA,morphinstance_vertex:cA,morphcolor_vertex:uA,morphnormal_vertex:hA,morphtarget_pars_vertex:fA,morphtarget_vertex:dA,normal_fragment_begin:pA,normal_fragment_maps:mA,normal_pars_fragment:gA,normal_pars_vertex:vA,normal_vertex:_A,normalmap_pars_fragment:xA,clearcoat_normal_fragment_begin:yA,clearcoat_normal_fragment_maps:SA,clearcoat_pars_fragment:bA,iridescence_pars_fragment:MA,opaque_fragment:wA,packing:TA,premultiplied_alpha_fragment:EA,project_vertex:AA,dithering_fragment:CA,dithering_pars_fragment:RA,roughnessmap_fragment:IA,roughnessmap_pars_fragment:PA,shadowmap_pars_fragment:LA,shadowmap_pars_vertex:NA,shadowmap_vertex:DA,shadowmask_pars_fragment:UA,skinbase_vertex:FA,skinning_pars_vertex:OA,skinning_vertex:BA,skinnormal_vertex:zA,specularmap_fragment:kA,specularmap_pars_fragment:HA,tonemapping_fragment:VA,tonemapping_pars_fragment:GA,transmission_fragment:WA,transmission_pars_fragment:XA,uv_pars_fragment:qA,uv_pars_vertex:$A,uv_vertex:YA,worldpos_vertex:ZA,background_vert:jA,background_frag:JA,backgroundCube_vert:KA,backgroundCube_frag:QA,cube_vert:e8,cube_frag:t8,depth_vert:n8,depth_frag:i8,distance_vert:s8,distance_frag:r8,equirect_vert:a8,equirect_frag:o8,linedashed_vert:l8,linedashed_frag:c8,meshbasic_vert:u8,meshbasic_frag:h8,meshlambert_vert:f8,meshlambert_frag:d8,meshmatcap_vert:p8,meshmatcap_frag:m8,meshnormal_vert:g8,meshnormal_frag:v8,meshphong_vert:_8,meshphong_frag:x8,meshphysical_vert:y8,meshphysical_frag:S8,meshtoon_vert:b8,meshtoon_frag:M8,points_vert:w8,points_frag:T8,shadow_vert:E8,shadow_frag:A8,sprite_vert:C8,sprite_frag:R8},He={common:{diffuse:{value:new Ge(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new _t},alphaMap:{value:null},alphaMapTransform:{value:new _t},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new _t}},envmap:{envMap:{value:null},envMapRotation:{value:new _t},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new _t}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new _t}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new _t},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new _t},normalScale:{value:new ue(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new _t},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new _t}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new _t}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new _t}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ge(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},sunLights:{value:[],properties:{direction:{},color:{}}},sunLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},sunShadowMatrix:{value:[]},sunShadowCascade:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:[]},probesMin:{value:[]},probesMax:{value:[]},probesResolution:{value:[]}},points:{diffuse:{value:new Ge(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new _t},alphaTest:{value:0},uvTransform:{value:new _t}},sprite:{diffuse:{value:new Ge(16777215)},opacity:{value:1},center:{value:new ue(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new _t},alphaMap:{value:null},alphaMapTransform:{value:new _t},alphaTest:{value:0}}},Rs={basic:{uniforms:bi([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.fog]),vertexShader:Et.meshbasic_vert,fragmentShader:Et.meshbasic_frag},lambert:{uniforms:bi([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.fog,He.lights,{emissive:{value:new Ge(0)},envMapIntensity:{value:1}}]),vertexShader:Et.meshlambert_vert,fragmentShader:Et.meshlambert_frag},phong:{uniforms:bi([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.fog,He.lights,{emissive:{value:new Ge(0)},specular:{value:new Ge(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Et.meshphong_vert,fragmentShader:Et.meshphong_frag},standard:{uniforms:bi([He.common,He.envmap,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.roughnessmap,He.metalnessmap,He.fog,He.lights,{emissive:{value:new Ge(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Et.meshphysical_vert,fragmentShader:Et.meshphysical_frag},toon:{uniforms:bi([He.common,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.gradientmap,He.fog,He.lights,{emissive:{value:new Ge(0)}}]),vertexShader:Et.meshtoon_vert,fragmentShader:Et.meshtoon_frag},matcap:{uniforms:bi([He.common,He.bumpmap,He.normalmap,He.displacementmap,He.fog,{matcap:{value:null}}]),vertexShader:Et.meshmatcap_vert,fragmentShader:Et.meshmatcap_frag},points:{uniforms:bi([He.points,He.fog]),vertexShader:Et.points_vert,fragmentShader:Et.points_frag},dashed:{uniforms:bi([He.common,He.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Et.linedashed_vert,fragmentShader:Et.linedashed_frag},depth:{uniforms:bi([He.common,He.displacementmap]),vertexShader:Et.depth_vert,fragmentShader:Et.depth_frag},normal:{uniforms:bi([He.common,He.bumpmap,He.normalmap,He.displacementmap,{opacity:{value:1}}]),vertexShader:Et.meshnormal_vert,fragmentShader:Et.meshnormal_frag},sprite:{uniforms:bi([He.sprite,He.fog]),vertexShader:Et.sprite_vert,fragmentShader:Et.sprite_frag},background:{uniforms:{uvTransform:{value:new _t},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Et.background_vert,fragmentShader:Et.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new _t}},vertexShader:Et.backgroundCube_vert,fragmentShader:Et.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Et.cube_vert,fragmentShader:Et.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Et.equirect_vert,fragmentShader:Et.equirect_frag},distance:{uniforms:bi([He.common,He.displacementmap,{referencePosition:{value:new O},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Et.distance_vert,fragmentShader:Et.distance_frag},shadow:{uniforms:bi([He.lights,He.fog,{color:{value:new Ge(0)},opacity:{value:1}}]),vertexShader:Et.shadow_vert,fragmentShader:Et.shadow_frag}};Rs.physical={uniforms:bi([Rs.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new _t},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new _t},clearcoatNormalScale:{value:new ue(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new _t},diffuseRoughness:{value:0},diffuseRoughnessMap:{value:null},diffuseRoughnessMapTransform:{value:new _t},dispersion:{value:0},retroreflectivity:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new _t},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new _t},sheen:{value:0},sheenColor:{value:new Ge(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new _t},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new _t},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new _t},transmissionSamplerSize:{value:new ue},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new _t},attenuationDistance:{value:0},attenuationColor:{value:new Ge(0)},specularColor:{value:new Ge(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new _t},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new _t},anisotropyVector:{value:new ue},anisotropyMap:{value:null},anisotropyMapTransform:{value:new _t}}]),vertexShader:Et.meshphysical_vert,fragmentShader:Et.meshphysical_frag};const Yh={r:0,b:0,g:0},I8=new gt,CS=new _t;CS.set(-1,0,0,0,1,0,0,0,1);function P8(i,e,t,n,r,o){const l=new Ge(0);let c=r===!0?0:1,h,d,p=null,g=0,v=null;function _(M){let A=M.isScene===!0?M.background:null;if(A&&A.isTexture){const E=M.backgroundBlurriness>0;A=e.get(A,E)}return A}function y(M){let A=!1;const E=_(M);E===null?b(l,c):E&&E.isColor&&(b(E,1),A=!0);const N=i.xr.getEnvironmentBlendMode();N==="additive"?t.buffers.color.setClear(0,0,0,1,o):N==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,o),(i.autoClear||A)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),i.clear(i.autoClearColor,i.autoClearDepth,i.autoClearStencil))}function w(M,A){const E=_(A);E&&E.isCubeTexture?(d===void 0&&(d=new Wn(new Ka(1,1,1),new Qn({name:"BackgroundCubeMaterial",uniforms:vl(Rs.backgroundCube.uniforms),vertexShader:Rs.backgroundCube.vertexShader,fragmentShader:Rs.backgroundCube.fragmentShader,side:Vn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(N,P,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(d)),d.material.uniforms.envMap.value=E,d.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(I8.makeRotationFromEuler(A.backgroundRotation)).transpose(),E.isRenderTargetTexture===!1&&d.material.uniforms.backgroundRotation.value.premultiply(CS),d.material.toneMapped=Lt.getTransfer(E.colorSpace)!==en,(p!==E||g!==E.version||v!==i.toneMapping)&&(d.material.needsUpdate=!0,p=E,g=E.version,v=i.toneMapping),d.layers.enableAll(),M.unshift(d,d.geometry,d.material,0,0,null)):E&&E.isTexture&&(h===void 0&&(h=new Wn(new yl(2,2),new Qn({name:"BackgroundMaterial",uniforms:vl(Rs.background.uniforms),vertexShader:Rs.background.vertexShader,fragmentShader:Rs.background.fragmentShader,side:Sr,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(h)),h.material.uniforms.t2D.value=E,h.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,h.material.toneMapped=Lt.getTransfer(E.colorSpace)!==en,E.matrixAutoUpdate===!0&&E.updateMatrix(),h.material.uniforms.uvTransform.value.copy(E.matrix),(p!==E||g!==E.version||v!==i.toneMapping)&&(h.material.needsUpdate=!0,p=E,g=E.version,v=i.toneMapping),h.layers.enableAll(),M.unshift(h,h.geometry,h.material,0,0,null))}function b(M,A){M.getRGB(Yh,$3(i)),t.buffers.color.setClear(Yh.r,Yh.g,Yh.b,A,o)}function S(){d!==void 0&&(d.geometry.dispose(),d.material.dispose(),d=void 0),h!==void 0&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}return{getClearColor:function(){return l},setClearColor:function(M,A=1){l.set(M),c=A,b(l,c)},getClearAlpha:function(){return c},setClearAlpha:function(M){c=M,b(l,c)},render:y,addToRenderList:w,dispose:S}}function L8(i,e){const t=i.getParameter(i.MAX_VERTEX_ATTRIBS),n={},r=v(null);let o=r,l=!1;function c(B,W,Z,z,X){let Q=!1;const q=g(B,z,Z,W);o!==q&&(o=q,d(o.object)),Q=_(B,z,Z,X),Q&&y(B,z,Z,X),X!==null&&e.update(X,i.ELEMENT_ARRAY_BUFFER),(Q||l)&&(l=!1,E(B,W,Z,z),X!==null&&i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e.get(X).buffer))}function h(){return i.createVertexArray()}function d(B){return i.bindVertexArray(B)}function p(B){return i.deleteVertexArray(B)}function g(B,W,Z,z){const X=z.wireframe===!0;let Q=n[W.id];Q===void 0&&(Q={},n[W.id]=Q);const q=B.isInstancedMesh===!0?B.id:0;let fe=Q[q];fe===void 0&&(fe={},Q[q]=fe);let Y=fe[Z.id];Y===void 0&&(Y={},fe[Z.id]=Y);let he=Y[X];return he===void 0&&(he=v(h()),Y[X]=he),he}function v(B){const W=[],Z=[],z=[];for(let X=0;X<t;X++)W[X]=0,Z[X]=0,z[X]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:W,enabledAttributes:Z,attributeDivisors:z,object:B,attributes:{},index:null}}function _(B,W,Z,z){const X=o.attributes,Q=W.attributes;let q=0;const fe=Z.getAttributes();for(const Y in fe)if(fe[Y].location>=0){const pe=X[Y];let We=Q[Y];if(We===void 0&&(Y==="instanceMatrix"&&B.instanceMatrix&&(We=B.instanceMatrix),Y==="instanceColor"&&B.instanceColor&&(We=B.instanceColor)),pe===void 0||pe.attribute!==We||We&&pe.data!==We.data)return!0;q++}return o.attributesNum!==q||o.index!==z}function y(B,W,Z,z){const X={},Q=W.attributes;let q=0;const fe=Z.getAttributes();for(const Y in fe)if(fe[Y].location>=0){let pe=Q[Y];pe===void 0&&(Y==="instanceMatrix"&&B.instanceMatrix&&(pe=B.instanceMatrix),Y==="instanceColor"&&B.instanceColor&&(pe=B.instanceColor));const We={};We.attribute=pe,pe&&pe.data&&(We.data=pe.data),X[Y]=We,q++}o.attributes=X,o.attributesNum=q,o.index=z}function w(){const B=o.newAttributes;for(let W=0,Z=B.length;W<Z;W++)B[W]=0}function b(B){S(B,0)}function S(B,W){const Z=o.newAttributes,z=o.enabledAttributes,X=o.attributeDivisors;Z[B]=1,z[B]===0&&(i.enableVertexAttribArray(B),z[B]=1),X[B]!==W&&(i.vertexAttribDivisor(B,W),X[B]=W)}function M(){const B=o.newAttributes,W=o.enabledAttributes;for(let Z=0,z=W.length;Z<z;Z++)W[Z]!==B[Z]&&(i.disableVertexAttribArray(Z),W[Z]=0)}function A(B,W,Z,z,X,Q,q){q===!0?i.vertexAttribIPointer(B,W,Z,X,Q):i.vertexAttribPointer(B,W,Z,z,X,Q)}function E(B,W,Z,z){w();const X=z.attributes,Q=Z.getAttributes(),q=W.defaultAttributeValues;for(const fe in Q){const Y=Q[fe];if(Y.location>=0){let he=X[fe];if(he===void 0&&(fe==="instanceMatrix"&&B.instanceMatrix&&(he=B.instanceMatrix),fe==="instanceColor"&&B.instanceColor&&(he=B.instanceColor)),he!==void 0){const pe=he.normalized,We=he.itemSize,qe=e.get(he);if(qe===void 0)continue;const ie=qe.buffer,xe=qe.type,Be=qe.bytesPerElement,et=xe===i.INT||xe===i.UNSIGNED_INT||he.gpuType===id;if(he.isInterleavedBufferAttribute){const Ce=he.data,tt=Ce.isInterleavedBuffer===!0?Ce.stride:Ce.itemSize,kt=he.offset;if(Ce.isInstancedInterleavedBuffer||Ce.isInstancedBufferAttribute){for(let at=0;at<Y.locationSize;at++)S(Y.location+at,Ce.meshPerAttribute);B.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=Ce.meshPerAttribute*Ce.count)}else for(let at=0;at<Y.locationSize;at++)b(Y.location+at);i.bindBuffer(i.ARRAY_BUFFER,ie);for(let at=0;at<Y.locationSize;at++)A(Y.location+at,We/Y.locationSize,xe,pe,tt*Be,(kt+We/Y.locationSize*at)*Be,et)}else{if(he.isInstancedBufferAttribute){for(let Ce=0;Ce<Y.locationSize;Ce++)S(Y.location+Ce,he.meshPerAttribute);B.isInstancedMesh!==!0&&z._maxInstanceCount===void 0&&(z._maxInstanceCount=he.meshPerAttribute*he.count)}else for(let Ce=0;Ce<Y.locationSize;Ce++)b(Y.location+Ce);i.bindBuffer(i.ARRAY_BUFFER,ie);for(let Ce=0;Ce<Y.locationSize;Ce++)A(Y.location+Ce,We/Y.locationSize,xe,pe,We*Be,We/Y.locationSize*Ce*Be,et)}}else if(q!==void 0){const pe=q[fe];if(pe!==void 0)switch(pe.length){case 2:i.vertexAttrib2fv(Y.location,pe);break;case 3:i.vertexAttrib3fv(Y.location,pe);break;case 4:i.vertexAttrib4fv(Y.location,pe);break;default:i.vertexAttrib1fv(Y.location,pe)}}}}M()}function N(){F();for(const B in n){const W=n[B];for(const Z in W){const z=W[Z];for(const X in z){const Q=z[X];for(const q in Q)p(Q[q].object),delete Q[q];delete z[X]}}delete n[B]}}function P(B){if(n[B.id]===void 0)return;const W=n[B.id];for(const Z in W){const z=W[Z];for(const X in z){const Q=z[X];for(const q in Q)p(Q[q].object),delete Q[q];delete z[X]}}delete n[B.id]}function T(B){for(const W in n){const Z=n[W];for(const z in Z){const X=Z[z];if(X[B.id]===void 0)continue;const Q=X[B.id];for(const q in Q)p(Q[q].object),delete Q[q];delete X[B.id]}}}function C(B){for(const W in n){const Z=n[W],z=B.isInstancedMesh===!0?B.id:0,X=Z[z];if(X!==void 0){for(const Q in X){const q=X[Q];for(const fe in q)p(q[fe].object),delete q[fe];delete X[Q]}delete Z[z],Object.keys(Z).length===0&&delete n[W]}}}function F(){D(),l=!0,o!==r&&(o=r,d(o.object))}function D(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:c,reset:F,resetDefaultState:D,dispose:N,releaseStatesOfGeometry:P,releaseStatesOfObject:C,releaseStatesOfProgram:T,initAttributes:w,enableAttribute:b,disableUnusedAttributes:M}}function N8(i,e,t){let n;function r(h){n=h}function o(h,d){i.drawArrays(n,h,d),t.update(d,n,1)}function l(h,d,p){p!==0&&(i.drawArraysInstanced(n,h,d,p),t.update(d,n,p))}function c(h,d,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,h,0,d,0,p);let v=0;for(let _=0;_<p;_++)v+=d[_];t.update(v,n,1)}this.setMode=r,this.render=o,this.renderInstances=l,this.renderMultiDraw=c}function D8(i,e,t,n){let r;function o(){if(r!==void 0)return r;if(e.has("EXT_texture_filter_anisotropic")===!0){const T=e.get("EXT_texture_filter_anisotropic");r=i.getParameter(T.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function l(T){return!(T!==Mi&&n.convert(T)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_FORMAT))}function c(T){const C=T===ps&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(T!==Mn&&T!==oi&&!C&&n.convert(T)!==i.getParameter(i.IMPLEMENTATION_COLOR_READ_TYPE))}function h(T){if(T==="highp"){if(i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision>0)return"highp";T="mediump"}return T==="mediump"&&i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT).precision>0&&i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let d=t.precision!==void 0?t.precision:"highp";const p=h(d);p!==d&&(Fe("WebGLRenderer:",d,"not supported, using",p,"instead."),d=p);const g=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),v=t.logarithmicDepthBuffer===!0&&g===!1;t.reversedDepthBuffer===!0&&g===!1&&Fe("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),t.logarithmicDepthBuffer===!0&&g===!0&&Fe("WebGLRenderer: Logarithmic depth buffer is ignored when reversed depth buffer is enabled.");const _=i.getParameter(i.MAX_TEXTURE_IMAGE_UNITS),y=i.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),w=i.getParameter(i.MAX_TEXTURE_SIZE),b=i.getParameter(i.MAX_CUBE_MAP_TEXTURE_SIZE),S=i.getParameter(i.MAX_VERTEX_ATTRIBS),M=i.getParameter(i.MAX_VERTEX_UNIFORM_VECTORS),A=i.getParameter(i.MAX_VARYING_VECTORS),E=i.getParameter(i.MAX_FRAGMENT_UNIFORM_VECTORS),N=i.getParameter(i.MAX_SAMPLES),P=i.getParameter(i.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:o,getMaxPrecision:h,textureFormatReadable:l,textureTypeReadable:c,precision:d,logarithmicDepthBuffer:v,reversedDepthBuffer:g,maxTextures:_,maxVertexTextures:y,maxTextureSize:w,maxCubemapSize:b,maxAttributes:S,maxVertexUniforms:M,maxVaryings:A,maxFragmentUniforms:E,maxSamples:N,samples:P}}function U8(i){const e=this;let t=null,n=0,r=!1,o=!1;const l=new gr,c=new _t,h={value:null,needsUpdate:!1};this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(g,v){const _=g.length!==0||v||n!==0||r;return r=v,n=g.length,_},this.beginShadows=function(){o=!0,p(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(g,v){t=p(g,v,0)},this.setState=function(g,v,_){const y=g.clippingPlanes,w=g.clipIntersection,b=g.clipShadows,S=i.get(g);if(!r||y===null||y.length===0||o&&!b)o?p(null):d();else{const M=o?0:n,A=M*4;let E=S.clippingState||null;h.value=E,E=p(y,v,A,_);for(let N=0;N!==A;++N)E[N]=t[N];S.clippingState=E,this.numIntersection=w?this.numPlanes:0,this.numPlanes+=M}};function d(){h.value!==t&&(h.value=t,h.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function p(g,v,_,y){const w=g!==null?g.length:0;let b=null;if(w!==0){if(b=h.value,y!==!0||b===null){const S=_+w*4,M=v.matrixWorldInverse;c.getNormalMatrix(M),(b===null||b.length<S)&&(b=new Float32Array(S));for(let A=0,E=_;A!==w;++A,E+=4)l.copy(g[A]).applyMatrix4(M,c),l.normal.toArray(b,E),b[E+3]=l.constant}h.value=b,h.needsUpdate=!0}return e.numPlanes=w,e.numIntersection=0,b}}class Od extends gn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new eu(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const 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 <begin_vertex>
					#include <project_vertex>

				}
			`,fragmentShader:`

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include <common>

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`},r=new Ka(5,5,5),o=new Qn({name:"CubemapFromEquirect",uniforms:vl(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Vn,blending:Oi});o.uniforms.tEquirect.value=t;const l=new Wn(r,o),c=t.minFilter;return t.minFilter===Ps&&(t.minFilter=an),new qf(1,10,this).update(e,l),t.minFilter=c,l.geometry.dispose(),l.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){const o=e.getRenderTarget();for(let l=0;l<6;l++)e.setRenderTarget(this,l),e.clear(t,n,r);e.setRenderTarget(o)}}const Gx=256,F8=3,O8=20,RS=256,IS=16,B8=3,z8=new O,k8=new Ge;class $c{constructor(e){this._renderer=e,this._cubeSize=0,this._sourceTarget=null,this._cubeCamera=new qf(1,10,null),this._boxMesh=new Wn(new Ka(5,5,5),null),this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null,this._integrationMaterial=null}fromScene(e,t=0,n=.1,r=100,o={}){const{size:l=256,position:c=z8}=o,h=this._renderer;this._setSize(l);const d=this._allocateTarget(),p=this._getSourceTarget(!0);t>0&&(p.texture.mipmapsAutoUpdate=!1);const g=h.autoClear,v=h.autoClearColor,_=h.autoClearDepth,y=h.autoClearStencil,w=e.background;h.autoClear=!0,h.autoClearColor=!0,h.autoClearDepth=!0,h.autoClearStencil=!0,w===null&&(e.background=h.getClearColor(k8));const b=new qf(n,r,p);return b.position.copy(c),b.update(h,e),h.autoClear=g,h.autoClearColor=v,h.autoClearDepth=_,h.autoClearStencil=y,e.background=w,t>0&&(p.texture.mipmapsAutoUpdate=!0,this._blur(d,t)),this._applyPMREM(d),d}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=qx(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Xx(),this._compileMaterial(this._equirectMaterial))}dispose(){this._sourceTarget!==null&&this._sourceTarget.dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._integrationMaterial!==null&&this._integrationMaterial.dispose(),this._boxMesh.geometry.dispose()}static lodToRoughness(e,t){return t>0?1-Math.sqrt(1-e/t):0}_setSize(e){this._cubeSize=Math.max(Gx,M3(e))}_fromTexture(e,t){e.mapping===br||e.mapping===qa?this._setSize(e.image.length===0?Gx:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4);const n=t||this._allocateTarget();return this._textureToCubemap(e),this._applyPMREM(n),n}_allocateTarget(){const e=this._cubeSize,t=Wx(e,!1,!1),n=Math.log2(e)-F8;for(let r=0;r<=n;r++)t.texture.mipmaps.push({width:e>>r,height:e>>r});return t.texture.name="PMREM",t.texture.isPMREMTexture=!0,t}_getSourceTarget(e=!1){const t=this._cubeSize,n=this._sourceTarget;return(n===null||n.width!==t||e&&n.depthBuffer===!1)&&(n!==null&&n.dispose(),this._sourceTarget=Wx(t,!0,e)),this._sourceTarget}_compileMaterial(e){this._boxMesh.material=e,this._renderer.compile(this._boxMesh,this._cubeCamera.children[0])}_renderCube(e,t,n){const r=this._boxMesh,o=this._cubeCamera;r.material=n,o.renderTarget=e,o.activeMipmapLevel=t;const l=e.width>>t;e.viewport.set(0,0,l,l),o.update(this._renderer,r),e.viewport.set(0,0,e.width,e.height)}_textureToCubemap(e){let t;e.mapping===br||e.mapping===qa?(this._cubemapMaterial===null&&(this._cubemapMaterial=qx()),t=this._cubemapMaterial,t.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):(this._equirectMaterial===null&&(this._equirectMaterial=Xx()),t=this._equirectMaterial),t.uniforms.envMap.value=e,this._renderCube(this._getSourceTarget(),0,t)}_applyPMREM(e){this._ggxMaterial===null&&(this._ggxMaterial=H8(),this._integrationMaterial=V8());const t=this._cubeSize,n=e.texture.mipmaps.length-1,r=this._ggxMaterial.uniforms;r.envMap.value=this._sourceTarget.texture;const o=this._integrationMaterial.uniforms;o.envMap.value=this._sourceTarget.texture,o.sourceLod.value=Math.log2(t/IS);for(let l=0;l<=n;l++){const c=$c.lodToRoughness(l,n);if(l>n-B8)o.roughness.value=c,this._renderCube(e,l,this._integrationMaterial);else{const h=c>0?Math.log2(t)+.5*Math.log2(6/(RS*Math.pow(c,4)))+.5:0;r.roughness.value=c,r.lodBias.value=h,this._renderCube(e,l,this._ggxMaterial)}}}_blur(e,t){this._blurMaterial===null&&(this._blurMaterial=G8());const n=this._blurMaterial,r=n.uniforms,o=this._sourceTarget;r.sigma.value=Math.min(t,Math.PI)/Math.SQRT2,r.envMap.value=o.texture,this._renderCube(e,0,n),r.envMap.value=e.texture,this._renderCube(o,0,n)}}function Wx(i,e,t){return new Od(i,{minFilter:Ps,generateMipmaps:e,type:ps,colorSpace:ta,depthBuffer:t})}function au(i,e,t){return new Qn({name:i,uniforms:e,vertexShader:Et.cube_vert,fragmentShader:t,side:Vn,blending:Oi,depthTest:!1,depthWrite:!1})}function H8(){return au("PMREMGGXConvolution",{envMap:{value:null},roughness:{value:0},lodBias:{value:0}},`

		#define GGX_SAMPLES ${RS}u

		varying vec3 vWorldDirection;

		uniform samplerCube envMap;
		uniform float roughness;
		uniform float lodBias;

		#include <common>

		// Van der Corput radical inverse
		float radicalInverse_VdC( uint bits ) {

			bits = ( bits << 16u ) | ( bits >> 16u );
			bits = ( ( bits & 0x55555555u ) << 1u ) | ( ( bits & 0xAAAAAAAAu ) >> 1u );
			bits = ( ( bits & 0x33333333u ) << 2u ) | ( ( bits & 0xCCCCCCCCu ) >> 2u );
			bits = ( ( bits & 0x0F0F0F0Fu ) << 4u ) | ( ( bits & 0xF0F0F0F0u ) >> 4u );
			bits = ( ( bits & 0x00FF00FFu ) << 8u ) | ( ( bits & 0xFF00FF00u ) >> 8u );
			return float( bits ) * 2.3283064365386963e-10; // / 0x100000000

		}

		// Hammersley sequence
		vec2 hammersley( uint i, uint N ) {

			return vec2( float( i ) / float( N ), radicalInverse_VdC( i ) );

		}

		void main() {

			vec3 N = normalize( vWorldDirection );

			// For very low roughness, just sample the environment directly
			if ( roughness < 0.001 ) {

				gl_FragColor = vec4( textureLod( envMap, N, 0.0 ).rgb, 1.0 );
				return;

			}

			float alpha = roughness * roughness;
			float alpha2 = alpha * alpha;

			// Tangent space basis for VNDF sampling
			vec3 up = abs( N.z ) < 0.999 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 1.0, 0.0, 0.0 );
			vec3 tangent = normalize( cross( up, N ) );
			vec3 bitangent = cross( N, tangent );

			vec3 prefilteredColor = vec3( 0.0 );
			float totalWeight = 0.0;

			for ( uint i = 0u; i < GGX_SAMPLES; i ++ ) {

				vec2 Xi = hammersley( i, GGX_SAMPLES );

				// With V = N, sample the reflected direction directly.
				float invQ = 1.0 / ( 1.0 - Xi.x + alpha2 * Xi.x );
				float NdotL = ( 1.0 - Xi.x - alpha2 * Xi.x ) * invQ;

				if ( NdotL > 0.0 ) {

					float phi = 2.0 * PI * Xi.y;
					float sinTheta = 2.0 * alpha * sqrt( Xi.x * ( 1.0 - Xi.x ) ) * invQ;
					vec3 L = N * NdotL + ( tangent * cos( phi ) + bitangent * sin( phi ) ) * sinTheta;

					// Match the source mip to the sample's solid angle. The terms
					// independent of the sample are precomputed in lodBias.
					float d = alpha2 * invQ;
					float lod = max( log2( d ) + lodBias, 0.0 );

					// Weight by NdotL for the split-sum approximation
					prefilteredColor += textureLod( envMap, L, lod ).rgb * NdotL;
					totalWeight += NdotL;

				}

			}

			gl_FragColor = vec4( prefilteredColor / totalWeight, 1.0 );

		}
	`)}function V8(){return au("PMREMGGXIntegration",{envMap:{value:null},roughness:{value:0},sourceLod:{value:0},sourceSize:{value:IS}},`

		varying vec3 vWorldDirection;

		uniform samplerCube envMap;
		uniform float roughness;
		uniform float sourceLod;
		uniform int sourceSize;

		void main() {

			vec3 N = normalize( vWorldDirection );

			float alpha = roughness * roughness;
			float alpha2 = alpha * alpha;

			float texelSize = 2.0 / float( sourceSize );

			vec3 prefilteredColor = vec3( 0.0 );
			float totalWeight = 0.0;

			// Pair opposite texels: only the one in N's hemisphere contributes.
			for ( int face = 0; face < 3; face ++ ) {

				for ( int y = 0; y < sourceSize; y ++ ) {

					for ( int x = 0; x < sourceSize; x ++ ) {

						vec2 uv = ( vec2( x, y ) + 0.5 ) * texelSize - 1.0;
						vec3 texelDirection = face == 0 ? vec3( 1.0, uv ) : ( face == 1 ? vec3( uv.x, 1.0, uv.y ) : vec3( uv, 1.0 ) );

						float invDistance = inversesqrt( 1.0 + dot( uv, uv ) );
						float NdotL = dot( N, texelDirection );
						texelDirection *= NdotL < 0.0 ? - 1.0 : 1.0;
						NdotL = abs( NdotL ) * invDistance;

						// With V = N, NdotH squared is ( 1 + NdotL ) / 2. Common factors
						// in the GGX distribution and texel solid angle cancel when normalized.
						float d = 1.0 + alpha2 + ( alpha2 - 1.0 ) * NdotL;
						float weight = NdotL * invDistance * invDistance * invDistance / ( d * d );

						prefilteredColor += textureLod( envMap, texelDirection, sourceLod ).rgb * weight;
						totalWeight += weight;

					}

				}

			}

			gl_FragColor = vec4( prefilteredColor / totalWeight, 1.0 );

		}
	`)}function G8(){return au("PMREMSphericalGaussianBlur",{envMap:{value:null},sigma:{value:0}},`

		#define SAMPLES ${O8}
		#define GOLDEN_ANGLE 2.39996322973

		varying vec3 vWorldDirection;

		uniform samplerCube envMap;
		uniform float sigma;

		#include <common>

		void main() {

			vec3 outputDirection = normalize( vWorldDirection );

			vec3 up = abs( outputDirection.z ) < 0.999 ? vec3( 0.0, 0.0, 1.0 ) : vec3( 1.0, 0.0, 0.0 );
			vec3 tangent = normalize( cross( up, outputDirection ) );
			vec3 bitangent = cross( outputDirection, tangent );

			// Truncate the kernel at three standard deviations or at the antipode.
			float thetaMax = min( 3.0 * sigma, PI );
			float truncation = 1.0 - exp( - 0.5 * thetaMax * thetaMax / ( sigma * sigma ) );

			vec3 accumColor = vec3( 0.0 );
			float accumWeight = 0.0;

			for ( int i = 0; i < SAMPLES; i ++ ) {

				// Stratified inverse-CDF sampling of the Gaussian, placed on a golden-angle spiral.
				float stratum = ( float( i ) + 0.5 ) / float( SAMPLES );
				float theta = sigma * sqrt( - 2.0 * log( 1.0 - stratum * truncation ) );
				float phi = float( i ) * GOLDEN_ANGLE;

				vec3 offset = cos( phi ) * tangent + sin( phi ) * bitangent;
				vec3 sampleDirection = cos( theta ) * outputDirection + sin( theta ) * offset;

				// Correct the planar sample density to solid angle.
				float weight = sin( theta ) / theta;

				accumColor += weight * textureLod( envMap, sampleDirection, 0.0 ).rgb;
				accumWeight += weight;

			}

			gl_FragColor = vec4( accumColor / accumWeight, 1.0 );

		}
	`)}function Xx(){return au("PMREMEquirectangularToCubemap",{envMap:{value:null}},`

		varying vec3 vWorldDirection;

		uniform sampler2D envMap;

		#include <common>

		void main() {

			// Average four subpixel samples to preserve small, bright features.
			vec3 direction = normalize( vWorldDirection );
			vec3 dx = dFdx( direction ) * 0.25;
			vec3 dy = dFdy( direction ) * 0.25;

			vec3 color = textureLod( envMap, equirectUv( normalize( direction - dx - dy ) ), 0.0 ).rgb;
			color += textureLod( envMap, equirectUv( normalize( direction + dx - dy ) ), 0.0 ).rgb;
			color += textureLod( envMap, equirectUv( normalize( direction - dx + dy ) ), 0.0 ).rgb;
			color += textureLod( envMap, equirectUv( normalize( direction + dx + dy ) ), 0.0 ).rgb;
			gl_FragColor = vec4( color * 0.25, 1.0 );

		}
	`)}function qx(){return au("PMREMCubemapToCubemap",{envMap:{value:null},flipEnvMap:{value:-1}},`

		varying vec3 vWorldDirection;

		uniform samplerCube envMap;
		uniform float flipEnvMap;

		void main() {

			gl_FragColor = vec4( textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ).rgb, 1.0 );

		}
	`)}function W8(i){let e=new WeakMap,t=new WeakMap,n=null;function r(v,_=!1){return v==null?null:_?l(v):o(v)}function o(v){if(v&&v.isTexture){const _=v.mapping;if(_===vc||_===_c)if(e.has(v)){const y=e.get(v).texture;return c(y,v.mapping)}else{const y=v.image;if(y&&y.height>0){const w=new Od(y.height);return w.fromEquirectangularTexture(i,v),e.set(v,w),v.addEventListener("dispose",d),c(w.texture,v.mapping)}else return null}}return v}function l(v){if(v&&v.isTexture&&v.isPMREMTexture!==!0){const _=v.mapping,y=_===vc||_===_c,w=_===br||_===qa;if(y||w){let b=t.get(v);const S=b!==void 0?b.texture.pmremVersion:0;if(v.isRenderTargetTexture&&v.pmremVersion!==S)return n===null&&(n=new $c(i)),b=y?n.fromEquirectangular(v,b):n.fromCubemap(v,b),b.texture.pmremVersion=v.pmremVersion,t.set(v,b),b.texture;if(b!==void 0)return b.texture;{const M=v.image;return y&&M&&M.height>0||w&&M&&h(M)?(n===null&&(n=new $c(i)),b=y?n.fromEquirectangular(v):n.fromCubemap(v),b.texture.pmremVersion=v.pmremVersion,t.set(v,b),v.addEventListener("dispose",p),b.texture):null}}}return v}function c(v,_){return _===vc?v.mapping=br:_===_c&&(v.mapping=qa),v}function h(v){let _=0;const y=6;for(let w=0;w<y;w++)v[w]!==void 0&&_++;return _===y}function d(v){const _=v.target;_.removeEventListener("dispose",d);const y=e.get(_);y!==void 0&&(e.delete(_),y.dispose())}function p(v){const _=v.target;_.removeEventListener("dispose",p);const y=t.get(_);y!==void 0&&(t.delete(_),y.dispose())}function g(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:g}}function X8(i){const e={};function t(n){if(e[n]!==void 0)return e[n];const r=i.getExtension(n);return e[n]=r,r}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const r=t(n);return r===null&&xr("WebGLRenderer: "+n+" extension not supported."),r}}}function q8(i,e,t,n){const r={},o=new WeakMap,l=new FinalizationRegistry(y=>delete r[y]);function c(y){h(y.target)}function h(y){y.index!==null&&e.remove(y.index);for(const b in y.attributes)e.remove(y.attributes[b]);y.removeEventListener("dispose",c),delete r[y.id],l.unregister(y);const w=o.get(y);w&&(e.remove(w),o.delete(y)),n.releaseStatesOfGeometry(y),y.isInstancedBufferGeometry===!0&&delete y._maxInstanceCount,t.memory.geometries--}function d(y,w){return r[w.id]!==void 0||(w.addEventListener("dispose",c),r[w.id]=new WeakRef(w),l.register(w,w.id,w),t.memory.geometries++),w}function p(y){const w=y.attributes;for(const b in w)e.update(w[b],i.ARRAY_BUFFER)}function g(y){const w=y.index,b=y.attributes.position;let S=0;if(b===void 0)return;const M=w!==null?w.array.length:b.array.length/3-1,A=b.count>=65535?lg:og,E=new A(Math.ceil(M/3)*6,1),N=E.array;if(w!==null){const T=w.array;S=w.version;for(let C=0,F=0;C<M;C+=3){const D=T[C+0],B=T[C+1],W=T[C+2];N[F++]=D,N[F++]=B,N[F++]=B,N[F++]=W,N[F++]=W,N[F++]=D}}else{S=b.version;for(let T=0,C=0;T<M;T+=3){const F=T+0,D=T+1,B=T+2;N[C++]=F,N[C++]=D,N[C++]=D,N[C++]=B,N[C++]=B,N[C++]=F}}E.version=S;const P=o.get(y);P&&e.remove(P),o.set(y,E)}function v(y){const w=o.get(y);if(w){const b=y.index;b!==null&&w.version<b.version&&g(y)}else g(y);return o.get(y)}function _(){for(const y in r){const w=r[y].deref();w!==void 0&&h(w)}}return{get:d,update:p,getWireframeAttribute:v,dispose:_}}function $8(i,e,t){let n;function r(g){n=g}let o,l;function c(g){o=g.type,l=g.bytesPerElement}function h(g,v){i.drawElements(n,v,o,g*l),t.update(v,n,1)}function d(g,v,_){_!==0&&(i.drawElementsInstanced(n,v,o,g*l,_),t.update(v,n,_))}function p(g,v,_){if(_===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,v,0,o,g,0,_);let w=0;for(let b=0;b<_;b++)w+=v[b];t.update(w,n,1)}this.setMode=r,this.setIndex=c,this.render=h,this.renderInstances=d,this.renderMultiDraw=p}function Y8(i){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(o,l,c){switch(t.calls++,l){case i.TRIANGLES:t.triangles+=c*(o/3);break;case i.LINES:t.lines+=c*(o/2);break;case i.LINE_STRIP:t.lines+=c*(o-1);break;case i.LINE_LOOP:t.lines+=c*o;break;case i.POINTS:t.points+=c*o;break;default:it("WebGLInfo: Unknown draw mode:",l);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:n}}function Z8(i,e,t){const n=new WeakMap,r=new Kt;function o(l,c,h){const d=l.morphTargetInfluences,p=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,g=p!==void 0?p.length:0;let v=n.get(c);if(v===void 0||v.count!==g){let F=function(){T.dispose(),n.delete(c),c.removeEventListener("dispose",F)};v!==void 0&&v.texture.dispose();const _=c.morphAttributes.position!==void 0,y=c.morphAttributes.normal!==void 0,w=c.morphAttributes.color!==void 0,b=c.morphAttributes.position||[],S=c.morphAttributes.normal||[],M=c.morphAttributes.color||[];let A=0;_===!0&&(A=1),y===!0&&(A=2),w===!0&&(A=3);let E=c.attributes.position.count*A,N=1;E>e.maxTextureSize&&(N=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const P=new Float32Array(E*N*4*g),T=new fd(P,E,N,g);T.type=oi,T.needsUpdate=!0;const C=A*4;for(let D=0;D<g;D++){const B=b[D],W=S[D],Z=M[D],z=E*N*4*D;for(let X=0;X<B.count;X++){const Q=X*C;_===!0&&(r.fromBufferAttribute(B,X),P[z+Q+0]=r.x,P[z+Q+1]=r.y,P[z+Q+2]=r.z,P[z+Q+3]=0),y===!0&&(r.fromBufferAttribute(W,X),P[z+Q+4]=r.x,P[z+Q+5]=r.y,P[z+Q+6]=r.z,P[z+Q+7]=0),w===!0&&(r.fromBufferAttribute(Z,X),P[z+Q+8]=r.x,P[z+Q+9]=r.y,P[z+Q+10]=r.z,P[z+Q+11]=Z.itemSize===4?r.w:1)}}v={count:g,texture:T,size:new ue(E,N)},n.set(c,v),c.addEventListener("dispose",F)}if(l.isInstancedMesh===!0&&l.morphTexture!==null)h.getUniforms().setValue(i,"morphTexture",l.morphTexture,t);else{let _=0;for(let w=0;w<d.length;w++)_+=d[w];const y=c.morphTargetsRelative?1:1-_;h.getUniforms().setValue(i,"morphTargetBaseInfluence",y),h.getUniforms().setValue(i,"morphTargetInfluences",d)}h.getUniforms().setValue(i,"morphTargetsTexture",v.texture,t),h.getUniforms().setValue(i,"morphTargetsTextureSize",v.size)}return{update:o}}function j8(i,e,t,n,r){let o=new WeakMap;function l(d){const p=r.render.frame,g=d.geometry,v=e.get(d,g);if(o.get(v)!==p&&(e.update(v),o.set(v,p)),d.isInstancedMesh&&(d.hasEventListener("dispose",h)===!1&&d.addEventListener("dispose",h),o.get(d)!==p&&(t.update(d.instanceMatrix,i.ARRAY_BUFFER),d.instanceColor!==null&&t.update(d.instanceColor,i.ARRAY_BUFFER),o.set(d,p))),d.isSkinnedMesh){const _=d.skeleton;o.get(_)!==p&&(_.update(),o.set(_,p))}return v}function c(){o=new WeakMap}function h(d){const p=d.target;p.removeEventListener("dispose",h),n.releaseStatesOfObject(p),t.remove(p.instanceMatrix),p.instanceColor!==null&&t.remove(p.instanceColor)}return{update:l,dispose:c}}const J8={[Vm]:"LINEAR_TONE_MAPPING",[Gm]:"REINHARD_TONE_MAPPING",[Wm]:"CINEON_TONE_MAPPING",[td]:"ACES_FILMIC_TONE_MAPPING",[qm]:"AGX_TONE_MAPPING",[$m]:"NEUTRAL_TONE_MAPPING",[Xm]:"CUSTOM_TONE_MAPPING"};function K8(i,e,t,n,r,o){const l=new gn(e,t,{type:i,depthBuffer:r,stencilBuffer:o,samples:n?4:0,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,resolveDepthBuffer:!1,resolveStencilBuffer:!1});let c=null,h=null,d=null;const p=new bt;p.setAttribute("position",new Je([-1,3,0,-1,-1,0,3,-1,0],3)),p.setAttribute("uv",new Je([0,2,0,0,2,0],2));const g=new yg({uniforms:{tDiffuse:{value:null}},vertexShader:`
			precision highp float;

			uniform mat4 modelViewMatrix;
			uniform mat4 projectionMatrix;

			attribute vec3 position;
			attribute vec2 uv;

			varying vec2 vUv;

			void main() {
				vUv = uv;
				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
			}`,fragmentShader:`
			precision highp float;

			uniform sampler2D tDiffuse;

			varying vec2 vUv;

			#include <tonemapping_pars_fragment>
			#include <colorspace_pars_fragment>

			void main() {
				gl_FragColor = texture2D( tDiffuse, vUv );

				#ifdef LINEAR_TONE_MAPPING
					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
				#elif defined( REINHARD_TONE_MAPPING )
					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
				#elif defined( CINEON_TONE_MAPPING )
					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
				#elif defined( ACES_FILMIC_TONE_MAPPING )
					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
				#elif defined( AGX_TONE_MAPPING )
					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
				#elif defined( NEUTRAL_TONE_MAPPING )
					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
				#elif defined( CUSTOM_TONE_MAPPING )
					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
				#endif

				#ifdef SRGB_TRANSFER
					gl_FragColor = sRGBTransferOETF( gl_FragColor );
				#endif
			}`,depthTest:!1,depthWrite:!1}),v=new Wn(p,g),_=new bl(-1,1,1,-1,0,1);let y=null,w=null,b=!1,S,M=null,A=[],E=!1;this.setSize=function(N,P){l.setSize(N,P),c!==null&&c.setSize(N,P),h!==null&&h.setSize(N,P);for(let T=0;T<A.length;T++){const C=A[T];C.setSize&&C.setSize(N,P)}},this.setEffects=function(N){A=N,E=A.length>0&&A[0].isRenderPass===!0;const P=l.width,T=l.height;A.length>0&&c===null&&(c=new gn(P,T,{type:ps,depthBuffer:!1,stencilBuffer:!1}),h=new gn(P,T,{type:ps,depthBuffer:!1,stencilBuffer:!1}));const C=r===!0&&A.some(F=>F.needsDepthTexture===!0);C!==(l.depthTexture!==null)&&(C===!0&&d===null&&(d=new Qs(P,T),o===!0&&(d.format=js,d.type=Qr)),l.dispose(),l.depthTexture=C?d:null,l.resolveDepthBuffer=C,l.storeMultisampledDepthBuffer=C);for(let F=0;F<A.length;F++){const D=A[F];D.setSize&&D.setSize(P,T),C&&D.needsDepthTexture===!0&&D.setDepthTexture&&D.setDepthTexture(d)}},this.begin=function(N,P){if(b||N.toneMapping===Qi&&A.length===0)return!1;if(M=P,P!==null){const T=P.width,C=P.height;(l.width!==T||l.height!==C)&&this.setSize(T,C)}return E===!1&&N.setRenderTarget(l),S=N.toneMapping,N.toneMapping=Qi,!0},this.hasRenderPass=function(){return E},this.end=function(N,P){N.toneMapping=S,b=!0;let T=l,C=c;for(let F=0;F<A.length;F++){const D=A[F];D.enabled!==!1&&(D.render(N,C,T,P),D.needsSwap!==!1&&(T=C,C=C===c?h:c))}if(y!==N.outputColorSpace||w!==N.toneMapping){y=N.outputColorSpace,w=N.toneMapping,g.defines={},Lt.getTransfer(y)===en&&(g.defines.SRGB_TRANSFER="");const F=J8[w];F&&(g.defines[F]=""),g.needsUpdate=!0}g.uniforms.tDiffuse.value=T.texture,N.setRenderTarget(M),N.render(v,_),M=null,b=!1},this.isCompositing=function(){return b},this.dispose=function(){l.dispose(),c!==null&&c.dispose(),h!==null&&h.dispose(),p.dispose(),g.dispose()}}const PS=new pn,LS=new Qs(1,1),NS=new fg(1),DS=new fd,US=new dd,FS=new eu,$x=[],Yx=[],Zx=new Float32Array(16),jx=new Float32Array(9),Jx=new Float32Array(4);function Ml(i,e,t){const n=i[0];if(n<=0||n>0)return i;const r=e*t;let o=$x[r];if(o===void 0&&(o=new Float32Array(r),$x[r]=o),e!==0){n.toArray(o,0);for(let l=1,c=0;l!==e;++l)c+=t,i[l].toArray(o,c)}return o}function Xn(i,e){if(i.length!==e.length)return!1;for(let t=0,n=i.length;t<n;t++)if(i[t]!==e[t])return!1;return!0}function qn(i,e){for(let t=0,n=e.length;t<n;t++)i[t]=e[t]}function Bd(i,e){let t=Yx[e];t===void 0&&(t=new Int32Array(e),Yx[e]=t);for(let n=0;n!==e;++n)t[n]=i.allocateTextureUnit();return t}function Q8(i,e){const t=this.cache;t[0]!==e&&(i.uniform1f(this.addr,e),t[0]=e)}function e7(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Xn(t,e))return;i.uniform2fv(this.addr,e),qn(t,e)}}function t7(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(i.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Xn(t,e))return;i.uniform3fv(this.addr,e),qn(t,e)}}function n7(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Xn(t,e))return;i.uniform4fv(this.addr,e),qn(t,e)}}function i7(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Xn(t,e))return;i.uniformMatrix2fv(this.addr,!1,e),qn(t,e)}else{if(Xn(t,n))return;Jx.set(n),i.uniformMatrix2fv(this.addr,!1,Jx),qn(t,n)}}function s7(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Xn(t,e))return;i.uniformMatrix3fv(this.addr,!1,e),qn(t,e)}else{if(Xn(t,n))return;jx.set(n),i.uniformMatrix3fv(this.addr,!1,jx),qn(t,n)}}function r7(i,e){const t=this.cache,n=e.elements;if(n===void 0){if(Xn(t,e))return;i.uniformMatrix4fv(this.addr,!1,e),qn(t,e)}else{if(Xn(t,n))return;Zx.set(n),i.uniformMatrix4fv(this.addr,!1,Zx),qn(t,n)}}function a7(i,e){const t=this.cache;t[0]!==e&&(i.uniform1i(this.addr,e),t[0]=e)}function o7(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Xn(t,e))return;i.uniform2iv(this.addr,e),qn(t,e)}}function l7(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Xn(t,e))return;i.uniform3iv(this.addr,e),qn(t,e)}}function c7(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Xn(t,e))return;i.uniform4iv(this.addr,e),qn(t,e)}}function u7(i,e){const t=this.cache;t[0]!==e&&(i.uniform1ui(this.addr,e),t[0]=e)}function h7(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(i.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Xn(t,e))return;i.uniform2uiv(this.addr,e),qn(t,e)}}function f7(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(i.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Xn(t,e))return;i.uniform3uiv(this.addr,e),qn(t,e)}}function d7(i,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(i.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Xn(t,e))return;i.uniform4uiv(this.addr,e),qn(t,e)}}function zd(i){return i.version===0&&(i.compareFunction=sg,i.needsUpdate=!0),i}function p7(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let o;this.type===i.SAMPLER_2D_SHADOW?o=zd(LS):o=PS,t.setTexture2D(e||o,r)}function m7(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture3D(e||US,r)}function g7(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r);let o;this.type===i.SAMPLER_CUBE_SHADOW?o=zd(NS):o=FS,t.setTextureCube(e||o,r)}function v7(i,e,t){const n=this.cache,r=t.allocateTextureUnit();n[0]!==r&&(i.uniform1i(this.addr,r),n[0]=r),t.setTexture2DArray(e||DS,r)}function _7(i){switch(i){case 5126:return Q8;case 35664:return e7;case 35665:return t7;case 35666:return n7;case 35674:return i7;case 35675:return s7;case 35676:return r7;case 5124:case 35670:return a7;case 35667:case 35671:return o7;case 35668:case 35672:return l7;case 35669:case 35673:return c7;case 5125:return u7;case 36294:return h7;case 36295:return f7;case 36296:return d7;case 35678:case 36198:case 36298:case 36306:case 35682:return p7;case 35679:case 36299:case 36307:return m7;case 35680:case 36300:case 36308:case 36293:return g7;case 36289:case 36303:case 36311:case 36292:return v7}}function x7(i,e){i.uniform1fv(this.addr,e)}function y7(i,e){const t=Ml(e,this.size,2);i.uniform2fv(this.addr,t)}function S7(i,e){const t=Ml(e,this.size,3);i.uniform3fv(this.addr,t)}function b7(i,e){const t=Ml(e,this.size,4);i.uniform4fv(this.addr,t)}function M7(i,e){const t=Ml(e,this.size,4);i.uniformMatrix2fv(this.addr,!1,t)}function w7(i,e){const t=Ml(e,this.size,9);i.uniformMatrix3fv(this.addr,!1,t)}function T7(i,e){const t=Ml(e,this.size,16);i.uniformMatrix4fv(this.addr,!1,t)}function E7(i,e){i.uniform1iv(this.addr,e)}function A7(i,e){i.uniform2iv(this.addr,e)}function C7(i,e){i.uniform3iv(this.addr,e)}function R7(i,e){i.uniform4iv(this.addr,e)}function I7(i,e){i.uniform1uiv(this.addr,e)}function P7(i,e){i.uniform2uiv(this.addr,e)}function L7(i,e){i.uniform3uiv(this.addr,e)}function N7(i,e){i.uniform4uiv(this.addr,e)}function D7(i,e,t){const n=this.cache,r=e.length,o=Bd(t,r);Xn(n,o)||(i.uniform1iv(this.addr,o),qn(n,o));let l;this.type===i.SAMPLER_2D_SHADOW?l=zd(LS):l=PS;for(let c=0;c!==r;++c)t.setTexture2D(e[c]||l,o[c])}function U7(i,e,t){const n=this.cache,r=e.length,o=Bd(t,r);Xn(n,o)||(i.uniform1iv(this.addr,o),qn(n,o));for(let l=0;l!==r;++l)t.setTexture3D(e[l]||US,o[l])}function F7(i,e,t){const n=this.cache,r=e.length,o=Bd(t,r);Xn(n,o)||(i.uniform1iv(this.addr,o),qn(n,o));let l;this.type===i.SAMPLER_CUBE_SHADOW?l=zd(NS):l=FS;for(let c=0;c!==r;++c)t.setTextureCube(e[c]||l,o[c])}function O7(i,e,t){const n=this.cache,r=e.length,o=Bd(t,r);Xn(n,o)||(i.uniform1iv(this.addr,o),qn(n,o));for(let l=0;l!==r;++l)t.setTexture2DArray(e[l]||DS,o[l])}function B7(i){switch(i){case 5126:return x7;case 35664:return y7;case 35665:return S7;case 35666:return b7;case 35674:return M7;case 35675:return w7;case 35676:return T7;case 5124:case 35670:return E7;case 35667:case 35671:return A7;case 35668:case 35672:return C7;case 35669:case 35673:return R7;case 5125:return I7;case 36294:return P7;case 36295:return L7;case 36296:return N7;case 35678:case 36198:case 36298:case 36306:case 35682:return D7;case 35679:case 36299:case 36307:return U7;case 35680:case 36300:case 36308:case 36293:return F7;case 36289:case 36303:case 36311:case 36292:return O7}}class z7{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=_7(t.type)}}class k7{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=B7(t.type)}}class H7{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const r=this.seq;for(let o=0,l=r.length;o!==l;++o){const c=r[o];c.setValue(e,t[c.id],n)}}}const am=/(\w+)(\])?(\[|\.)?/g;function Kx(i,e){i.seq.push(e),i.map[e.id]=e}function V7(i,e,t){const n=i.name,r=n.length;for(am.lastIndex=0;;){const o=am.exec(n),l=am.lastIndex;let c=o[1];const h=o[2]==="]",d=o[3];if(h&&(c=c|0),d===void 0||d==="["&&l+2===r){Kx(t,d===void 0?new z7(c,i,e):new k7(c,i,e));break}else{let g=t.map[c];g===void 0&&(g=new H7(c),Kx(t,g)),t=g}}}class nf{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let l=0;l<n;++l){const c=e.getActiveUniform(t,l),h=e.getUniformLocation(t,c.name);V7(c,h,this)}const r=[],o=[];for(const l of this.seq)l.type===e.SAMPLER_2D_SHADOW||l.type===e.SAMPLER_CUBE_SHADOW||l.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(l):o.push(l);r.length>0&&(this.seq=r.concat(o))}setValue(e,t,n,r){const o=this.map[t];o!==void 0&&o.setValue(e,n,r)}setOptional(e,t,n){const r=t[n];r!==void 0&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let o=0,l=t.length;o!==l;++o){const c=t[o],h=n[c.id];h.needsUpdate!==!1&&c.setValue(e,h.value,r)}}static seqWithValue(e,t){const n=[];for(let r=0,o=e.length;r!==o;++r){const l=e[r];l.id in t&&n.push(l)}return n}}function Qx(i,e,t){const n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}const G7=37297;let W7=0;function X7(i,e){const t=i.split(`
`),n=[],r=Math.max(e-6,0),o=Math.min(e+6,t.length);for(let l=r;l<o;l++){const c=l+1;n.push(`${c===e?">":" "} ${c}: ${t[l]}`)}return n.join(`
`)}const ey=new _t;function q7(i){Lt._getMatrix(ey,Lt.workingColorSpace,i);const e=`mat3( ${ey.elements.map(t=>t.toFixed(4))} )`;switch(Lt.getTransfer(i)){case Oc:return[e,"LinearTransferOETF"];case en:return[e,"sRGBTransferOETF"];default:return Fe("WebGLProgram: Unsupported color space: ",i),[e,"LinearTransferOETF"]}}function ty(i,e,t){const n=i.getShaderParameter(e,i.COMPILE_STATUS),o=(i.getShaderInfoLog(e)||"").trim();if(n&&o==="")return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const c=parseInt(l[1]);return t.toUpperCase()+`

`+o+`

`+X7(i.getShaderSource(e),c)}else return o}function $7(i,e){const t=q7(e);return[`vec4 ${i}( vec4 value ) {`,`	return ${t[1]}( vec4( ${t[0]} * value.rgb, value.a ) );`,"}"].join(`
`)}const Y7={[Vm]:"Linear",[Gm]:"Reinhard",[Wm]:"Cineon",[td]:"ACESFilmic",[qm]:"AgX",[$m]:"Neutral",[Xm]:"Custom"};function Z7(i,e){const t=Y7[e];return t===void 0?(Fe("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+i+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Zh=new O;function j7(){Lt.getLuminanceCoefficients(Zh);const i=Zh.x.toFixed(4),e=Zh.y.toFixed(4),t=Zh.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${i}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
`)}function J7(i){return[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(dc).join(`
`)}function K7(i){const e=[];for(const t in i){const n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
`)}function Q7(i,e){const t={},n=i.getProgramParameter(e,i.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const o=i.getActiveAttrib(e,r),l=o.name;let c=1;o.type===i.FLOAT_MAT2&&(c=2),o.type===i.FLOAT_MAT3&&(c=3),o.type===i.FLOAT_MAT4&&(c=4),t[l]={type:o.type,location:i.getAttribLocation(e,l),locationSize:c}}return t}function dc(i){return i!==""}function ny(i,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return i.replace(/NUM_SUN_LIGHTS/g,e.numSunLights).replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_SUN_LIGHT_SHADOWS/g,e.numSunLightShadows).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows).replace(/NUM_LIGHT_PROBE_GRIDS/g,e.numLightProbeGrids)}function iy(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const eC=/^[ \t]*#include +<([\w\d./]+)>/gm;function Nm(i){return i.replace(eC,tC)}function tC(i,e){const t=Et[e];if(t===void 0)throw new Error("THREE.WebGLProgram: Can not resolve #include <"+e+">");return Nm(t)}const nC=/#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 sy(i){return i.replace(nC,iC)}function iC(i,e,t,n){let r="";for(let o=parseInt(e);o<parseInt(t);o++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return r}function ry(i){let e=`precision ${i.precision} float;
	precision ${i.precision} int;
	precision ${i.precision} sampler2D;
	precision ${i.precision} samplerCube;
	precision ${i.precision} sampler3D;
	precision ${i.precision} sampler2DArray;
	precision ${i.precision} sampler2DShadow;
	precision ${i.precision} samplerCubeShadow;
	precision ${i.precision} sampler2DArrayShadow;
	precision ${i.precision} isampler2D;
	precision ${i.precision} isampler3D;
	precision ${i.precision} isamplerCube;
	precision ${i.precision} isampler2DArray;
	precision ${i.precision} usampler2D;
	precision ${i.precision} usampler3D;
	precision ${i.precision} usamplerCube;
	precision ${i.precision} usampler2DArray;
	`;return i.precision==="highp"?e+=`
#define HIGH_PRECISION`:i.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}const sC={[ol]:"SHADOWMAP_TYPE_PCF",[Ba]:"SHADOWMAP_TYPE_VSM"};function rC(i){return sC[i.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const aC={[qa]:"ENVMAP_MODE_REFRACTION"};function oC(i){return i.envMap===!1?"ENVMAP_MODE_REFLECTION":aC[i.envMapMode]||"ENVMAP_MODE_REFLECTION"}const lC={[Jc]:"ENVMAP_BLENDING_MULTIPLY",[o3]:"ENVMAP_BLENDING_MIX",[l3]:"ENVMAP_BLENDING_ADD"};function cC(i){return i.envMap===!1?"ENVMAP_BLENDING_NONE":lC[i.combine]||"ENVMAP_BLENDING_NONE"}function uC(i,e,t,n){const r=i.getContext(),o=t.defines;let l=t.vertexShader,c=t.fragmentShader;const h=rC(t),d=t.envMapPMREM===!0?"ENVMAP_TYPE_PMREM":"ENVMAP_TYPE_CUBE",p=oC(t),g=cC(t),v=J7(t),_=K7(o),y=r.createProgram();let w,b,S=t.glslVersion?"#version "+t.glslVersion+`
`:"";t.isRawShaderMaterial?(w=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(dc).join(`
`),w.length>0&&(w+=`
`),b=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(dc).join(`
`),b.length>0&&(b+=`
`)):(w=[ry(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+p:"",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.diffuseRoughnessMap?"#define USE_DIFFUSE_ROUGHNESSMAP":"",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.diffuseRoughnessMapUv?"#define DIFFUSE_ROUGHNESSMAP_UV "+t.diffuseRoughnessMapUv:"",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.vertexNormals?"#define HAS_NORMAL":"",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 "+h:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
`].filter(dc).join(`
`),b=[ry(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,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 "+d:"",t.envMap?"#define "+p:"",t.envMap?"#define "+g:"",t.envMapPMREM?"#define ENVMAP_MAX_LOD "+t.envMapMaxLod+".0":"",t.envMapPMREM?"#define ENVMAP_SIZE "+t.envMapSize+".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.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",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.diffuseRoughness?"#define USE_DIFFUSE_ROUGHNESS":"",t.diffuseRoughnessMap?"#define USE_DIFFUSE_ROUGHNESSMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.retroreflection?"#define USE_RETROREFLECTION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+h:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Qi?"#define TONE_MAPPING":"",t.toneMapping!==Qi?Et.tonemapping_pars_fragment:"",t.toneMapping!==Qi?Z7("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Et.colorspace_pars_fragment,$7("linearToOutputTexel",t.outputColorSpace),j7(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(dc).join(`
`)),l=Nm(l),l=ny(l,t),l=iy(l,t),c=Nm(c),c=ny(c,t),c=iy(c,t),l=sy(l),c=sy(c),t.isRawShaderMaterial!==!0&&(S=`#version 300 es
`,w=[v,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+w,b=["#define varying in",t.glslVersion===wm?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===wm?"":"#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(`
`)+`
`+b);const M=S+w+l,A=S+b+c,E=Qx(r,r.VERTEX_SHADER,M),N=Qx(r,r.FRAGMENT_SHADER,A);r.attachShader(y,E),r.attachShader(y,N),t.index0AttributeName!==void 0?r.bindAttribLocation(y,0,t.index0AttributeName):t.hasPositionAttribute===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);function P(D){if(i.debug.checkShaderErrors){const B=r.getProgramInfoLog(y)||"",W=r.getShaderInfoLog(E)||"",Z=r.getShaderInfoLog(N)||"",z=B.trim(),X=W.trim(),Q=Z.trim();let q=!0,fe=!0;if(r.getProgramParameter(y,r.LINK_STATUS)===!1)if(q=!1,typeof i.debug.onShaderError=="function")i.debug.onShaderError(r,y,E,N);else{const Y=ty(r,E,"vertex"),he=ty(r,N,"fragment");it("WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,r.VALIDATE_STATUS)+`

Material Name: `+D.name+`
Material Type: `+D.type+`

Program Info Log: `+z+`
`+Y+`
`+he)}else z!==""?Fe("WebGLProgram: Program Info Log:",z):(X===""||Q==="")&&(fe=!1);fe&&(D.diagnostics={runnable:q,programLog:z,vertexShader:{log:X,prefix:w},fragmentShader:{log:Q,prefix:b}})}r.deleteShader(E),r.deleteShader(N),T=new nf(r,y),C=Q7(r,y)}let T;this.getUniforms=function(){return T===void 0&&P(this),T};let C;this.getAttributes=function(){return C===void 0&&P(this),C};let F=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return F===!1&&(F=r.getProgramParameter(y,G7)),F},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=W7++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=E,this.fragmentShader=N,this}let hC=0;class fC{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){const r=this._getShaderCacheForMaterial(e);return r.has(t)===!1&&(r.add(t),t.usedTimes++),r.has(n)===!1&&(r.add(n),n.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}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}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 dC(e),t.set(e,n)),n}}class dC{constructor(e){this.id=hC++,this.code=e,this.usedTimes=0}}function pC(i){return i===ea||i===Nc||i===Dc}function mC(i,e,t,n,r,o){const l=new pl,c=new fC,h=new Set,d=[],p=new Map,g=n.logarithmicDepthBuffer,v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(T){return h.add(T),T===0?"uv":`uv${T}`}function y(T,C,F,D,B,W){const Z=D.fog,z=B.geometry,X=T.isMeshStandardMaterial||T.isMeshLambertMaterial||T.isMeshPhongMaterial?D.environment:null,Q=T.isMeshStandardMaterial||T.isMeshLambertMaterial&&!T.envMap||T.isMeshPhongMaterial&&!T.envMap,q=e.get(T.envMap||X,Q),fe=v[T.type];let Y=n.precision;T.precision!==null&&(Y=n.getMaxPrecision(T.precision),Y!==T.precision&&Fe("WebGLProgram.getParameters:",T.precision,"not supported, using",Y,"instead."));const he=z.morphAttributes.position||z.morphAttributes.normal||z.morphAttributes.color,pe=he!==void 0?he.length:0;let We=0;z.morphAttributes.position!==void 0&&(We=1),z.morphAttributes.normal!==void 0&&(We=2),z.morphAttributes.color!==void 0&&(We=3);let qe,ie,xe,Be;if(fe){const De=Rs[fe];qe=De.vertexShader,ie=De.fragmentShader}else{qe=T.vertexShader,ie=T.fragmentShader;const De=c.getVertexShaderStage(T),Xt=c.getFragmentShaderStage(T);c.update(T,De,Xt),xe=De.id,Be=Xt.id}const et=i.getRenderTarget(),Ce=i.state.buffers.depth.getReversed(),tt=B.isInstancedMesh===!0,kt=B.isBatchedMesh===!0,at=!!T.map,yt=!!T.matcap,pt=!!q,de=pt&&q.isPMREMTexture===!0,we=!!T.aoMap,ye=!!T.lightMap,ke=!!T.bumpMap&&T.wireframe===!1,Ne=!!T.normalMap,ht=!!T.displacementMap,$e=!!T.emissiveMap,mt=!!T.metalnessMap,Tt=!!T.roughnessMap,Ft=T.anisotropy>0,G=T.clearcoat>0,un=T.diffuseRoughness>0,vt=T.dispersion>0,xt=T.retroreflectivity>0,Re=T.iridescence>0,hn=T.sheen>0,st=T.transmission>0,ot=Ft&&!!T.anisotropyMap,U=G&&!!T.clearcoatMap,I=G&&!!T.clearcoatNormalMap,J=G&&!!T.clearcoatRoughnessMap,ge=un&&!!T.diffuseRoughnessMap,ce=Re&&!!T.iridescenceMap,Ae=Re&&!!T.iridescenceThicknessMap,Le=hn&&!!T.sheenColorMap,ae=hn&&!!T.sheenRoughnessMap,oe=!!T.specularMap,Ie=!!T.specularColorMap,H=!!T.specularIntensityMap,le=st&&!!T.transmissionMap,re=st&&!!T.thicknessMap,Pe=!!T.gradientMap,be=!!T.alphaMap,Te=T.alphaTest>0,Qe=!!T.alphaHash,Mt=!!T.extensions;let ve=Qi;T.toneMapped&&(et===null||et.isXRRenderTarget===!0)&&(ve=i.toneMapping);const rt=de?q.isCompressedCubeTexture?q.image[0].mipmaps:q.mipmaps:null,St={shaderID:fe,shaderType:T.type,shaderName:T.name,vertexShader:qe,fragmentShader:ie,defines:T.defines,customVertexShaderID:xe,customFragmentShaderID:Be,isRawShaderMaterial:T.isRawShaderMaterial===!0,glslVersion:T.glslVersion,precision:Y,batching:kt,batchingColor:kt&&B._colorsTexture!==null,instancing:tt,instancingColor:tt&&B.instanceColor!==null,instancingMorph:tt&&B.morphTexture!==null,outputColorSpace:et===null?i.outputColorSpace:et.isXRRenderTarget===!0?et.texture.colorSpace:Lt.workingColorSpace,alphaToCoverage:!!T.alphaToCoverage,map:at,matcap:yt,envMap:pt,envMapMode:pt&&q.mapping,envMapPMREM:de,envMapMaxLod:de?rt.length-1:null,envMapSize:de?rt[0].width:null,aoMap:we,lightMap:ye,bumpMap:ke,normalMap:Ne,displacementMap:ht,emissiveMap:$e,normalMapObjectSpace:Ne&&T.normalMapType===d3,normalMapTangentSpace:Ne&&T.normalMapType===wr,packedNormalMap:Ne&&T.normalMapType===wr&&pC(T.normalMap.format),metalnessMap:mt,roughnessMap:Tt,anisotropy:Ft,anisotropyMap:ot,clearcoat:G,clearcoatMap:U,clearcoatNormalMap:I,clearcoatRoughnessMap:J,diffuseRoughness:un,diffuseRoughnessMap:ge,dispersion:vt,retroreflection:xt,iridescence:Re,iridescenceMap:ce,iridescenceThicknessMap:Ae,sheen:hn,sheenColorMap:Le,sheenRoughnessMap:ae,specularMap:oe,specularColorMap:Ie,specularIntensityMap:H,transmission:st,transmissionMap:le,thicknessMap:re,gradientMap:Pe,opaque:T.transparent===!1&&T.blending===ll&&T.alphaToCoverage===!1,alphaMap:be,alphaTest:Te,alphaHash:Qe,combine:T.combine,mapUv:at&&_(T.map.channel),aoMapUv:we&&_(T.aoMap.channel),lightMapUv:ye&&_(T.lightMap.channel),bumpMapUv:ke&&_(T.bumpMap.channel),normalMapUv:Ne&&_(T.normalMap.channel),displacementMapUv:ht&&_(T.displacementMap.channel),emissiveMapUv:$e&&_(T.emissiveMap.channel),metalnessMapUv:mt&&_(T.metalnessMap.channel),roughnessMapUv:Tt&&_(T.roughnessMap.channel),anisotropyMapUv:ot&&_(T.anisotropyMap.channel),clearcoatMapUv:U&&_(T.clearcoatMap.channel),clearcoatNormalMapUv:I&&_(T.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:J&&_(T.clearcoatRoughnessMap.channel),diffuseRoughnessMapUv:ge&&_(T.diffuseRoughnessMap.channel),iridescenceMapUv:ce&&_(T.iridescenceMap.channel),iridescenceThicknessMapUv:Ae&&_(T.iridescenceThicknessMap.channel),sheenColorMapUv:Le&&_(T.sheenColorMap.channel),sheenRoughnessMapUv:ae&&_(T.sheenRoughnessMap.channel),specularMapUv:oe&&_(T.specularMap.channel),specularColorMapUv:Ie&&_(T.specularColorMap.channel),specularIntensityMapUv:H&&_(T.specularIntensityMap.channel),transmissionMapUv:le&&_(T.transmissionMap.channel),thicknessMapUv:re&&_(T.thicknessMap.channel),alphaMapUv:be&&_(T.alphaMap.channel),vertexTangents:!!z.attributes.tangent&&(Ne||Ft),vertexNormals:!!z.attributes.normal,vertexColors:T.vertexColors,vertexAlphas:T.vertexColors===!0&&!!z.attributes.color&&z.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!z.attributes.uv&&(at||be),fog:!!Z,useFog:T.fog===!0,fogExp2:!!Z&&Z.isFogExp2,flatShading:T.wireframe===!1&&(T.flatShading===!0||z.attributes.normal===void 0&&Ne===!1&&(T.isMeshLambertMaterial||T.isMeshPhongMaterial||T.isMeshStandardMaterial||T.isMeshPhysicalMaterial)),sizeAttenuation:T.sizeAttenuation===!0,logarithmicDepthBuffer:g,reversedDepthBuffer:Ce,skinning:B.isSkinnedMesh===!0,hasPositionAttribute:z.attributes.position!==void 0,morphTargets:z.morphAttributes.position!==void 0,morphNormals:z.morphAttributes.normal!==void 0,morphColors:z.morphAttributes.color!==void 0,morphTargetsCount:pe,morphTextureStride:We,numSunLights:C.sun.length,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numSpotLightMaps:C.spotLightMap.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numSunLightShadows:C.sunShadowMap.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numSpotLightShadowsWithMaps:C.numSpotLightShadowsWithMaps,numLightProbes:C.numLightProbes,numLightProbeGrids:W.filter(De=>De.texture!==null).length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:T.dithering,shadowMapEnabled:i.shadowMap.enabled&&F.length>0,shadowMapType:i.shadowMap.type,toneMapping:ve,decodeVideoTexture:at&&T.map.isVideoTexture===!0&&Lt.getTransfer(T.map.colorSpace)===en,decodeVideoTextureEmissive:$e&&T.emissiveMap.isVideoTexture===!0&&Lt.getTransfer(T.emissiveMap.colorSpace)===en,premultipliedAlpha:T.premultipliedAlpha,doubleSided:T.side===Di,flipSided:T.side===Vn,useDepthPacking:T.depthPacking>=0,depthPacking:T.depthPacking||0,index0AttributeName:T.index0AttributeName,extensionClipCullDistance:Mt&&T.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Mt&&T.extensions.multiDraw===!0||kt)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:T.customProgramCacheKey()};return St.vertexUv1s=h.has(1),St.vertexUv2s=h.has(2),St.vertexUv3s=h.has(3),h.clear(),St}function w(T){const C=[];if(T.shaderID?C.push(T.shaderID):(C.push(T.customVertexShaderID),C.push(T.customFragmentShaderID)),T.defines!==void 0)for(const F in T.defines)C.push(F),C.push(T.defines[F]);return T.isRawShaderMaterial===!1&&(b(C,T),S(C,T),C.push(i.outputColorSpace)),C.push(T.customProgramCacheKey),C.join()}function b(T,C){T.push(C.precision),T.push(C.outputColorSpace),T.push(C.envMapMode),T.push(C.envMapPMREM),T.push(C.envMapMaxLod),T.push(C.envMapSize),T.push(C.mapUv),T.push(C.alphaMapUv),T.push(C.lightMapUv),T.push(C.aoMapUv),T.push(C.bumpMapUv),T.push(C.normalMapUv),T.push(C.displacementMapUv),T.push(C.emissiveMapUv),T.push(C.metalnessMapUv),T.push(C.roughnessMapUv),T.push(C.anisotropyMapUv),T.push(C.clearcoatMapUv),T.push(C.clearcoatNormalMapUv),T.push(C.clearcoatRoughnessMapUv),T.push(C.diffuseRoughnessMapUv),T.push(C.iridescenceMapUv),T.push(C.iridescenceThicknessMapUv),T.push(C.sheenColorMapUv),T.push(C.sheenRoughnessMapUv),T.push(C.specularMapUv),T.push(C.specularColorMapUv),T.push(C.specularIntensityMapUv),T.push(C.transmissionMapUv),T.push(C.thicknessMapUv),T.push(C.combine),T.push(C.fogExp2),T.push(C.sizeAttenuation),T.push(C.morphTargetsCount),T.push(C.numSunLights),T.push(C.numDirLights),T.push(C.numPointLights),T.push(C.numSpotLights),T.push(C.numSpotLightMaps),T.push(C.numHemiLights),T.push(C.numRectAreaLights),T.push(C.numSunLightShadows),T.push(C.numDirLightShadows),T.push(C.numPointLightShadows),T.push(C.numSpotLightShadows),T.push(C.numSpotLightShadowsWithMaps),T.push(C.numLightProbes),T.push(C.numLightProbeGrids),T.push(C.shadowMapType),T.push(C.toneMapping),T.push(C.numClippingPlanes),T.push(C.numClipIntersection),T.push(C.depthPacking)}function S(T,C){l.disableAll(),C.instancing&&l.enable(0),C.instancingColor&&l.enable(1),C.instancingMorph&&l.enable(2),C.matcap&&l.enable(3),C.envMap&&l.enable(4),C.normalMapObjectSpace&&l.enable(5),C.normalMapTangentSpace&&l.enable(6),C.clearcoat&&l.enable(7),C.iridescence&&l.enable(8),C.alphaTest&&l.enable(9),C.vertexColors&&l.enable(10),C.vertexAlphas&&l.enable(11),C.vertexUv1s&&l.enable(12),C.vertexUv2s&&l.enable(13),C.vertexUv3s&&l.enable(14),C.vertexTangents&&l.enable(15),C.anisotropy&&l.enable(16),C.alphaHash&&l.enable(17),C.batching&&l.enable(18),C.dispersion&&l.enable(19),C.retroreflection&&l.enable(24),C.diffuseRoughness&&l.enable(25),C.batchingColor&&l.enable(20),C.gradientMap&&l.enable(21),C.packedNormalMap&&l.enable(22),C.vertexNormals&&l.enable(23),T.push(l.mask),l.disableAll(),C.fog&&l.enable(0),C.useFog&&l.enable(1),C.flatShading&&l.enable(2),C.logarithmicDepthBuffer&&l.enable(3),C.reversedDepthBuffer&&l.enable(4),C.skinning&&l.enable(5),C.morphTargets&&l.enable(6),C.morphNormals&&l.enable(7),C.morphColors&&l.enable(8),C.premultipliedAlpha&&l.enable(9),C.shadowMapEnabled&&l.enable(10),C.doubleSided&&l.enable(11),C.flipSided&&l.enable(12),C.useDepthPacking&&l.enable(13),C.dithering&&l.enable(14),C.transmission&&l.enable(15),C.sheen&&l.enable(16),C.opaque&&l.enable(17),C.pointsUvs&&l.enable(18),C.decodeVideoTexture&&l.enable(19),C.decodeVideoTextureEmissive&&l.enable(20),C.alphaToCoverage&&l.enable(21),C.numLightProbeGrids>0&&l.enable(22),C.hasPositionAttribute&&l.enable(23),T.push(l.mask)}function M(T){const C=v[T.type];let F;if(C){const D=Rs[C];F=Y3.clone(D.uniforms)}else F=T.uniforms;return F}function A(T,C){let F=p.get(C);return F!==void 0?++F.usedTimes:(F=new uC(i,C,T,r),d.push(F),p.set(C,F)),F}function E(T){if(--T.usedTimes===0){const C=d.indexOf(T);d[C]=d[d.length-1],d.pop(),p.delete(T.cacheKey),T.destroy()}}function N(T){c.remove(T)}function P(){c.dispose()}return{getParameters:y,getProgramCacheKey:w,getUniforms:M,acquireProgram:A,releaseProgram:E,releaseShaderCache:N,programs:d,dispose:P}}function gC(){let i=new WeakMap;function e(l){return i.has(l)}function t(l){let c=i.get(l);return c===void 0&&(c={},i.set(l,c)),c}function n(l){i.delete(l)}function r(l,c,h){i.get(l)[c]=h}function o(){i=new WeakMap}return{has:e,get:t,remove:n,update:r,dispose:o}}function vC(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.material.id!==e.material.id?i.material.id-e.material.id:i.materialVariant!==e.materialVariant?i.materialVariant-e.materialVariant:i.z!==e.z?i.z-e.z:i.id-e.id}function ay(i,e){return i.groupOrder!==e.groupOrder?i.groupOrder-e.groupOrder:i.renderOrder!==e.renderOrder?i.renderOrder-e.renderOrder:i.z!==e.z?e.z-i.z:i.id-e.id}function oy(){const i=[];let e=0;const t=[],n=[],r=[];function o(){e=0,t.length=0,n.length=0,r.length=0}function l(v){let _=0;return v.isInstancedMesh&&(_+=2),v.isSkinnedMesh&&(_+=1),_}function c(v,_,y,w,b,S){let M=i[e];return M===void 0?(M={id:v.id,object:v,geometry:_,material:y,materialVariant:l(v),groupOrder:w,renderOrder:v.renderOrder,z:b,group:S},i[e]=M):(M.id=v.id,M.object=v,M.geometry=_,M.material=y,M.materialVariant=l(v),M.groupOrder=w,M.renderOrder=v.renderOrder,M.z=b,M.group=S),e++,M}function h(v,_,y,w,b,S,M){M.reversedDepth===!0&&(b=-b);const A=c(v,_,y,w,b,S);y.transmission>0?n.push(A):y.transparent===!0?r.push(A):t.push(A)}function d(v,_,y,w,b,S){const M=c(v,_,y,w,b,S);y.transmission>0?n.unshift(M):y.transparent===!0?r.unshift(M):t.unshift(M)}function p(v,_){t.length>1&&t.sort(v||vC),n.length>1&&n.sort(_||ay),r.length>1&&r.sort(_||ay)}function g(){for(let v=e,_=i.length;v<_;v++){const y=i[v];if(y.id===null)break;y.id=null,y.object=null,y.geometry=null,y.material=null,y.group=null}}return{opaque:t,transmissive:n,transparent:r,init:o,push:h,unshift:d,finish:g,sort:p}}function _C(){let i=new WeakMap;function e(n,r){const o=i.get(n);let l;return o===void 0?(l=new oy,i.set(n,[l])):r>=o.length?(l=new oy,o.push(l)):l=o[r],l}function t(){i=new WeakMap}return{get:e,dispose:t}}function xC(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"SunLight":case"DirectionalLight":t={direction:new O,color:new Ge};break;case"SpotLight":t={position:new O,direction:new O,color:new Ge,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new O,color:new Ge,distance:0,decay:0};break;case"HemisphereLight":t={direction:new O,skyColor:new Ge,groundColor:new Ge};break;case"RectAreaLight":t={color:new Ge,position:new O,halfWidth:new O,halfHeight:new O};break}return i[e.id]=t,t}}}function yC(){const i={};return{get:function(e){if(i[e.id]!==void 0)return i[e.id];let t;switch(e.type){case"SunLight":case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ue,shadowCameraNear:1,shadowCameraFar:1e3};break}return i[e.id]=t,t}}}let SC=0;function bC(i,e){return(e.castShadow?2:0)-(i.castShadow?2:0)+(e.map?1:0)-(i.map?1:0)}function MC(i){const e=new xC,t=yC(),n={version:0,hash:{sunLength:-1,directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numSunShadows:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],sun:[],sunShadow:[],sunShadowMap:[],sunShadowMatrix:[],sunShadowCascade:[],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 d=0;d<9;d++)n.probe.push(new O);const r=new O,o=new gt,l=new gt;function c(d){let p=0,g=0,v=0;for(let W=0;W<9;W++)n.probe[W].set(0,0,0);let _=0,y=0,w=0,b=0,S=0,M=0,A=0,E=0,N=0,P=0,T=0,C=0,F=0,D=0;d.sort(bC);for(let W=0,Z=d.length;W<Z;W++){const z=d[W],X=z.color,Q=z.intensity,q=z.distance;let fe=null;if(z.shadow&&z.shadow.map&&(z.shadow.map.texture.format===ea?fe=z.shadow.map.texture:fe=z.shadow.map.depthTexture||z.shadow.map.texture),z.isAmbientLight)p+=X.r*Q,g+=X.g*Q,v+=X.b*Q;else if(z.isLightProbe){for(let Y=0;Y<9;Y++)n.probe[Y].addScaledVector(z.sh.coefficients[Y],Q);D++}else if(z.isSunLight){const Y=e.get(z);if(Y.color.copy(z.color).multiplyScalar(z.intensity),z.castShadow){const he=z.shadow,pe=t.get(z);pe.shadowIntensity=he.intensity,pe.shadowBias=he.bias,pe.shadowNormalBias=he.normalBias,pe.shadowRadius=he.radius,pe.shadowMapSize.copy(he.mapSize).multiply(he.getFrameExtents()),n.sunShadow[y]=pe,n.sunShadowMap[y]=fe;const We=he.getViewportCount();for(let qe=0;qe<We;qe++)n.sunShadowMatrix[w+qe]=he.getMatrix(qe),n.sunShadowCascade[w+qe]=he._cascadeData[qe];w+=We,y++}n.sun[_]=Y,_++}else if(z.isDirectionalLight){const Y=e.get(z);if(Y.color.copy(z.color).multiplyScalar(z.intensity),z.castShadow){const he=z.shadow,pe=t.get(z);pe.shadowIntensity=he.intensity,pe.shadowBias=he.bias,pe.shadowNormalBias=he.normalBias,pe.shadowRadius=he.radius,pe.shadowMapSize=he.mapSize,n.directionalShadow[b]=pe,n.directionalShadowMap[b]=fe,n.directionalShadowMatrix[b]=z.shadow.matrix,N++}n.directional[b]=Y,b++}else if(z.isSpotLight){const Y=e.get(z);Y.position.setFromMatrixPosition(z.matrixWorld),Y.color.copy(X).multiplyScalar(Q),Y.distance=q,Y.coneCos=Math.cos(z.angle),Y.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),Y.decay=z.decay,n.spot[M]=Y;const he=z.shadow;if(z.map&&(n.spotLightMap[C]=z.map,C++,he.updateMatrices(z),z.castShadow&&F++),n.spotLightMatrix[M]=he.matrix,z.castShadow){const pe=t.get(z);pe.shadowIntensity=he.intensity,pe.shadowBias=he.bias,pe.shadowNormalBias=he.normalBias,pe.shadowRadius=he.radius,pe.shadowMapSize=he.mapSize,n.spotShadow[M]=pe,n.spotShadowMap[M]=fe,T++}M++}else if(z.isRectAreaLight){const Y=e.get(z);Y.color.copy(X).multiplyScalar(Q),Y.halfWidth.set(z.width*.5,0,0),Y.halfHeight.set(0,z.height*.5,0),n.rectArea[A]=Y,A++}else if(z.isPointLight){const Y=e.get(z);if(Y.color.copy(z.color).multiplyScalar(z.intensity),Y.distance=z.distance,Y.decay=z.decay,z.castShadow){const he=z.shadow,pe=t.get(z);pe.shadowIntensity=he.intensity,pe.shadowBias=he.bias,pe.shadowNormalBias=he.normalBias,pe.shadowRadius=he.radius,pe.shadowMapSize=he.mapSize,pe.shadowCameraNear=he.camera.near,pe.shadowCameraFar=he.camera.far,n.pointShadow[S]=pe,n.pointShadowMap[S]=fe,n.pointShadowMatrix[S]=z.shadow.matrix,P++}n.point[S]=Y,S++}else if(z.isHemisphereLight){const Y=e.get(z);Y.skyColor.copy(z.color).multiplyScalar(Q),Y.groundColor.copy(z.groundColor).multiplyScalar(Q),n.hemi[E]=Y,E++}}A>0&&(i.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=He.LTC_FLOAT_1,n.rectAreaLTC2=He.LTC_FLOAT_2):(n.rectAreaLTC1=He.LTC_HALF_1,n.rectAreaLTC2=He.LTC_HALF_2)),n.ambient[0]=p,n.ambient[1]=g,n.ambient[2]=v;const B=n.hash;(B.sunLength!==_||B.directionalLength!==b||B.pointLength!==S||B.spotLength!==M||B.rectAreaLength!==A||B.hemiLength!==E||B.numSunShadows!==y||B.numDirectionalShadows!==N||B.numPointShadows!==P||B.numSpotShadows!==T||B.numSpotMaps!==C||B.numLightProbes!==D)&&(n.sun.length=_,n.directional.length=b,n.spot.length=M,n.rectArea.length=A,n.point.length=S,n.hemi.length=E,n.sunShadow.length=y,n.sunShadowMap.length=y,n.sunShadowMatrix.length=w,n.sunShadowCascade.length=w,n.directionalShadow.length=N,n.directionalShadowMap.length=N,n.directionalShadowMatrix.length=N,n.pointShadow.length=P,n.pointShadowMap.length=P,n.pointShadowMatrix.length=P,n.spotShadow.length=T,n.spotShadowMap.length=T,n.spotLightMatrix.length=T+C-F,n.spotLightMap.length=C,n.numSpotLightShadowsWithMaps=F,n.numLightProbes=D,B.sunLength=_,B.directionalLength=b,B.pointLength=S,B.spotLength=M,B.rectAreaLength=A,B.hemiLength=E,B.numSunShadows=y,B.numDirectionalShadows=N,B.numPointShadows=P,B.numSpotShadows=T,B.numSpotMaps=C,B.numLightProbes=D,n.version=SC++)}function h(d,p){let g=0,v=0,_=0,y=0,w=0,b=0;const S=p.matrixWorldInverse;for(let M=0,A=d.length;M<A;M++){const E=d[M];if(E.isSunLight){const N=n.sun[g];N.direction.setFromMatrixPosition(E.matrixWorld),N.direction.transformDirection(S),g++}else if(E.isDirectionalLight){const N=n.directional[v];N.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),N.direction.sub(r),N.direction.transformDirection(S),v++}else if(E.isSpotLight){const N=n.spot[y];N.position.setFromMatrixPosition(E.matrixWorld),N.position.applyMatrix4(S),N.direction.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(E.target.matrixWorld),N.direction.sub(r),N.direction.transformDirection(S),y++}else if(E.isRectAreaLight){const N=n.rectArea[w];N.position.setFromMatrixPosition(E.matrixWorld),N.position.applyMatrix4(S),l.identity(),o.copy(E.matrixWorld),o.premultiply(S),l.extractRotation(o),N.halfWidth.set(E.width*.5,0,0),N.halfHeight.set(0,E.height*.5,0),N.halfWidth.applyMatrix4(l),N.halfHeight.applyMatrix4(l),w++}else if(E.isPointLight){const N=n.point[_];N.position.setFromMatrixPosition(E.matrixWorld),N.position.applyMatrix4(S),_++}else if(E.isHemisphereLight){const N=n.hemi[b];N.direction.setFromMatrixPosition(E.matrixWorld),N.direction.transformDirection(S),b++}}}return{setup:c,setupView:h,state:n}}function ly(i){const e=new MC(i),t=[],n=[],r=[];function o(g){p.camera=g,t.length=0,n.length=0,r.length=0}function l(g){g.isLightProbeGrid?r.push(g):t.push(g)}function c(g){n.push(g)}function h(){e.setup(t),r.sort((g,v)=>g.priority-v.priority||g.id-v.id)}function d(g){e.setupView(t,g)}const p={lightsArray:t,shadowsArray:n,lightProbeGridArray:r,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:o,state:p,setupLights:h,setupLightsView:d,pushLight:l,pushShadow:c}}function wC(i){let e=new WeakMap;function t(r,o=0){const l=e.get(r);let c;return l===void 0?(c=new ly(i),e.set(r,[c])):o>=l.length?(c=new ly(i),l.push(c)):c=l[o],c}function n(){e=new WeakMap}return{get:t,dispose:n}}const TC=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,EC=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
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 = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
			mean += distribution.x;
			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
		#else
			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
			mean += depth;
			squared_mean += depth * depth;
		#endif
	}
	mean = mean / samples;
	squared_mean = squared_mean / samples;
	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
}`,AC=[new O(1,0,0),new O(-1,0,0),new O(0,1,0),new O(0,-1,0),new O(0,0,1),new O(0,0,-1)],CC=[new O(0,-1,0),new O(0,-1,0),new O(0,0,1),new O(0,0,-1),new O(0,-1,0),new O(0,-1,0)],cy=new gt,cc=new O,om=new O;function RC(i,e,t){let n=new Za;const r=new ue,o=new ue,l=new Kt,c=new Mg,h=new wg,d={},p=t.maxTextureSize,g={[Sr]:Vn,[Vn]:Sr,[Di]:Di},v=new Qn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ue},radius:{value:4}},vertexShader:TC,fragmentShader:EC}),_=v.clone();_.defines.HORIZONTAL_PASS=1;const y=new bt;y.setAttribute("position",new on(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const w=new Wn(y,v),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ol;let S=this.type;this.render=function(P,T,C){if(b.enabled===!1||b.autoUpdate===!1&&b.needsUpdate===!1||P.length===0)return;this.type===gc&&(Fe("WebGLShadowMap: PCFSoftShadowMap has been removed. Using PCFShadowMap instead."),this.type=ol);const F=i.getRenderTarget(),D=i.getActiveCubeFace(),B=i.getActiveMipmapLevel(),W=i.state;W.setBlending(Oi),W.buffers.depth.getReversed()===!0?W.buffers.color.setClear(0,0,0,0):W.buffers.color.setClear(1,1,1,1),W.buffers.depth.setTest(!0),W.setScissorTest(!1);const Z=S!==this.type;Z&&T.traverse(function(z){z.material&&(Array.isArray(z.material)?z.material.forEach(X=>X.needsUpdate=!0):z.material.needsUpdate=!0)});for(let z=0,X=P.length;z<X;z++){const Q=P[z],q=Q.shadow;if(q===void 0){Fe("WebGLShadowMap:",Q,"has no shadow.");continue}if(q.autoUpdate===!1&&q.needsUpdate===!1)continue;r.copy(q.mapSize);const fe=q.getFrameExtents();r.multiply(fe),o.copy(q.mapSize),(r.x>p||r.y>p)&&(r.x>p&&(o.x=Math.floor(p/fe.x),r.x=o.x*fe.x,q.mapSize.x=o.x),r.y>p&&(o.y=Math.floor(p/fe.y),r.y=o.y*fe.y,q.mapSize.y=o.y));const Y=i.state.buffers.depth.getReversed();if(q.camera._reversedDepth=Y,q.map===null||Z===!0){if(q.map!==null&&(q.map.depthTexture!==null&&(q.map.depthTexture.dispose(),q.map.depthTexture=null),q.map.dispose()),this.type===Ba){if(Q.isPointLight){Fe("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}q.map=new gn(r.x,r.y,{format:ea,type:ps,minFilter:an,magFilter:an,generateMipmaps:!1}),q.map.texture.name=Q.name+".shadowMap",q.map.depthTexture=new Qs(r.x,r.y,oi),q.map.depthTexture.name=Q.name+".shadowMapDepth",q.map.depthTexture.format=Mr,q.map.depthTexture.compareFunction=null,q.map.depthTexture.minFilter=dn,q.map.depthTexture.magFilter=dn}else Q.isPointLight?(q.map=new Od(r.x),q.map.depthTexture=new fg(r.x,ds)):(q.map=new gn(r.x,r.y),q.map.depthTexture=new Qs(r.x,r.y,ds)),q.map.depthTexture.name=Q.name+".shadowMap",q.map.depthTexture.format=Mr,this.type===ol?(q.map.depthTexture.compareFunction=Y?ig:ng,q.map.depthTexture.minFilter=an,q.map.depthTexture.magFilter=an):(q.map.depthTexture.compareFunction=null,q.map.depthTexture.minFilter=dn,q.map.depthTexture.magFilter=dn);q.camera.updateProjectionMatrix()}q.map.isWebGLCubeRenderTarget!==!0&&(q.map.width!==r.x||q.map.height!==r.y)&&q.map.setSize(r.x,r.y);const he=q.map.isWebGLCubeRenderTarget?6:q.getViewportCount();Q.isPointLight!==!0&&q.updateMatrices(Q,C);const pe=(q.camera.layers.mask&4294967294)!==0?q.camera.layers:C.layers;for(let We=0;We<he;We++){const qe=q.getCamera(We);if(Q.isPointLight){const ie=q.camera,xe=q.matrix,Be=Q.distance||ie.far;Be!==ie.far&&(ie.far=Be,ie.updateProjectionMatrix()),cc.setFromMatrixPosition(Q.matrixWorld),ie.position.copy(cc),om.copy(ie.position),om.add(AC[We]),ie.up.copy(CC[We]),ie.lookAt(om),ie.updateMatrixWorld(),xe.makeTranslation(-cc.x,-cc.y,-cc.z),cy.multiplyMatrices(ie.projectionMatrix,ie.matrixWorldInverse),q._frustum.setFromProjectionMatrix(cy,ie.coordinateSystem,ie.reversedDepth)}if(q.map.isWebGLCubeRenderTarget)i.setRenderTarget(q.map,We),i.clear();else{We===0&&(i.setRenderTarget(q.map),i.clear());const ie=q.getViewport(We);l.set(o.x*ie.x,o.y*ie.y,o.x*ie.z,o.y*ie.w),W.viewport(l)}n=q.getFrustum(We),E(T,C,qe,Q,pe,this.type)}q.isPointLightShadow!==!0&&this.type===Ba&&M(q,C),q.needsUpdate=!1}S=this.type,b.needsUpdate=!1,i.setRenderTarget(F,D,B)};function M(P,T){const C=e.update(w);v.defines.VSM_SAMPLES!==P.blurSamples&&(v.defines.VSM_SAMPLES=P.blurSamples,_.defines.VSM_SAMPLES=P.blurSamples,v.needsUpdate=!0,_.needsUpdate=!0),P.mapPass===null?P.mapPass=new gn(r.x,r.y,{format:ea,type:ps}):(P.mapPass.width!==P.map.width||P.mapPass.height!==P.map.height)&&P.mapPass.setSize(P.map.width,P.map.height),v.uniforms.shadow_pass.value=P.map.depthTexture,v.uniforms.resolution.value.set(P.map.width,P.map.height),v.uniforms.radius.value=P.radius,i.setRenderTarget(P.mapPass),i.clear(),i.renderBufferDirect(T,null,C,v,w,null),_.uniforms.shadow_pass.value=P.mapPass.texture,_.uniforms.resolution.value.set(P.map.width,P.map.height),_.uniforms.radius.value=P.radius,i.setRenderTarget(P.map),i.clear(),i.renderBufferDirect(T,null,C,_,w,null)}function A(P,T,C,F){let D=null;const B=C.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(B!==void 0)D=B;else if(D=C.isPointLight===!0?h:c,i.localClippingEnabled&&T.clipShadows===!0&&Array.isArray(T.clippingPlanes)&&T.clippingPlanes.length!==0||T.displacementMap&&T.displacementScale!==0||T.alphaMap&&T.alphaTest>0||T.map&&T.alphaTest>0||T.alphaToCoverage===!0){const W=D.uuid,Z=T.uuid;let z=d[W];z===void 0&&(z={},d[W]=z);let X=z[Z];X===void 0&&(X=D.clone(),z[Z]=X,T.addEventListener("dispose",N)),D=X}if(D.visible=T.visible,D.wireframe=T.wireframe,F===Ba?D.side=T.shadowSide!==null?T.shadowSide:T.side:D.side=T.shadowSide!==null?T.shadowSide:g[T.side],D.alphaMap=T.alphaMap,D.alphaTest=T.alphaToCoverage===!0?.5:T.alphaTest,D.map=T.map,D.clipShadows=T.clipShadows,D.clippingPlanes=T.clippingPlanes,D.clipIntersection=T.clipIntersection,D.displacementMap=T.displacementMap,D.displacementScale=T.displacementScale,D.displacementBias=T.displacementBias,D.wireframeLinewidth=T.wireframeLinewidth,D.linewidth=T.linewidth,C.isPointLight===!0&&D.isMeshDistanceMaterial===!0){const W=i.properties.get(D);W.light=C}return D}function E(P,T,C,F,D,B){if(P.visible===!1)return;if(P.layers.test(D)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&B===Ba)&&(!P.frustumCulled||P.intersectsFrustum(n))){P.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,P.matrixWorld);const z=e.update(P),X=P.material;if(Array.isArray(X)){const Q=z.groups;for(let q=0,fe=Q.length;q<fe;q++){const Y=Q[q],he=X[Y.materialIndex];if(he&&he.visible){const pe=A(P,he,F,B);P.onBeforeShadow(i,P,T,C,z,pe,Y),i.renderBufferDirect(C,null,z,pe,P,Y),P.onAfterShadow(i,P,T,C,z,pe,Y)}}}else if(X.visible){const Q=A(P,X,F,B);P.onBeforeShadow(i,P,T,C,z,Q,null),i.renderBufferDirect(C,null,z,Q,P,null),P.onAfterShadow(i,P,T,C,z,Q,null)}}const Z=P.children;for(let z=0,X=Z.length;z<X;z++)E(Z[z],T,C,F,D,B)}function N(P){P.target.removeEventListener("dispose",N);for(const C in d){const F=d[C],D=P.target.uuid;D in F&&(F[D].dispose(),delete F[D])}}}function IC(i,e){function t(){let H=!1;const le=new Kt;let re=null;const Pe=new Kt(0,0,0,0);return{setMask:function(be){re!==be&&!H&&(i.colorMask(be,be,be,be),re=be)},setLocked:function(be){H=be},setClear:function(be,Te,Qe,Mt,ve){ve===!0&&(be*=Mt,Te*=Mt,Qe*=Mt),le.set(be,Te,Qe,Mt),Pe.equals(le)===!1&&(i.clearColor(be,Te,Qe,Mt),Pe.copy(le))},reset:function(){H=!1,re=null,Pe.set(-1,0,0,0)}}}function n(){let H=!1,le=!1,re=null,Pe=null,be=null;return{setReversed:function(Te){if(le!==Te){const Qe=e.get("EXT_clip_control");Te?Qe.clipControlEXT(Qe.LOWER_LEFT_EXT,Qe.ZERO_TO_ONE_EXT):Qe.clipControlEXT(Qe.LOWER_LEFT_EXT,Qe.NEGATIVE_ONE_TO_ONE_EXT),le=Te;const Mt=be;be=null,this.setClear(Mt)}},getReversed:function(){return le},setTest:function(Te){Te?Ce(i.DEPTH_TEST):tt(i.DEPTH_TEST)},setMask:function(Te){re!==Te&&!H&&(i.depthMask(Te),re=Te)},setFunc:function(Te){if(le&&(Te=Zw[Te]),Pe!==Te){switch(Te){case rf:i.depthFunc(i.NEVER);break;case Ic:i.depthFunc(i.ALWAYS);break;case af:i.depthFunc(i.LESS);break;case hl:i.depthFunc(i.LEQUAL);break;case of:i.depthFunc(i.EQUAL);break;case lf:i.depthFunc(i.GEQUAL);break;case cf:i.depthFunc(i.GREATER);break;case uf:i.depthFunc(i.NOTEQUAL);break;default:i.depthFunc(i.LEQUAL)}Pe=Te}},setLocked:function(Te){H=Te},setClear:function(Te){be!==Te&&(be=Te,le&&(Te=1-Te),i.clearDepth(Te))},reset:function(){H=!1,re=null,Pe=null,be=null,le=!1}}}function r(){let H=!1,le=null,re=null,Pe=null,be=null,Te=null,Qe=null,Mt=null,ve=null;return{setTest:function(rt){H||(rt?Ce(i.STENCIL_TEST):tt(i.STENCIL_TEST))},setMask:function(rt){le!==rt&&!H&&(i.stencilMask(rt),le=rt)},setFunc:function(rt,St,De){(re!==rt||Pe!==St||be!==De)&&(i.stencilFunc(rt,St,De),re=rt,Pe=St,be=De)},setOp:function(rt,St,De){(Te!==rt||Qe!==St||Mt!==De)&&(i.stencilOp(rt,St,De),Te=rt,Qe=St,Mt=De)},setLocked:function(rt){H=rt},setClear:function(rt){ve!==rt&&(i.clearStencil(rt),ve=rt)},reset:function(){H=!1,le=null,re=null,Pe=null,be=null,Te=null,Qe=null,Mt=null,ve=null}}}const o=new t,l=new n,c=new r;let h={};const d=new WeakMap;let p={},g={},v={},_=new WeakMap,y=[],w=null,b=!1,S=null,M=null,A=null,E=null,N=null,P=null,T=null,C=new Ge(0,0,0),F=0,D=!1,B=null,W=null,Z=null,z=null,X=null;const Q=i.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,fe=0;const Y=i.getParameter(i.VERSION);Y.indexOf("WebGL")!==-1?(fe=parseFloat(/^WebGL (\d)/.exec(Y)[1]),q=fe>=1):Y.indexOf("OpenGL ES")!==-1&&(fe=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),q=fe>=2);let he=null,pe={};const We=i.getParameter(i.SCISSOR_BOX),qe=i.getParameter(i.VIEWPORT),ie=new Kt().fromArray(We),xe=new Kt().fromArray(qe);function Be(H,le,re,Pe){const be=new Uint8Array(4),Te=i.createTexture();i.bindTexture(H,Te),i.texParameteri(H,i.TEXTURE_MIN_FILTER,i.NEAREST),i.texParameteri(H,i.TEXTURE_MAG_FILTER,i.NEAREST);for(let Qe=0;Qe<re;Qe++)H===i.TEXTURE_3D||H===i.TEXTURE_2D_ARRAY?i.texImage3D(le,0,i.RGBA,1,1,Pe,0,i.RGBA,i.UNSIGNED_BYTE,be):i.texImage2D(le+Qe,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,be);return Te}const et={};et[i.TEXTURE_2D]=Be(i.TEXTURE_2D,i.TEXTURE_2D,1),et[i.TEXTURE_CUBE_MAP]=Be(i.TEXTURE_CUBE_MAP,i.TEXTURE_CUBE_MAP_POSITIVE_X,6),et[i.TEXTURE_2D_ARRAY]=Be(i.TEXTURE_2D_ARRAY,i.TEXTURE_2D_ARRAY,1,1),et[i.TEXTURE_3D]=Be(i.TEXTURE_3D,i.TEXTURE_3D,1,1),o.setClear(0,0,0,1),l.setClear(1),c.setClear(0),Ce(i.DEPTH_TEST),l.setFunc(hl),ke(!1),Ne(_m),Ce(i.CULL_FACE),we(Oi);function Ce(H){p[H]!==!0&&(i.enable(H),p[H]=!0)}function tt(H){p[H]!==!1&&(i.disable(H),p[H]=!1)}function kt(H,le){return v[H]!==le?(i.bindFramebuffer(H,le),v[H]=le,H===i.DRAW_FRAMEBUFFER&&(v[i.FRAMEBUFFER]=le),H===i.FRAMEBUFFER&&(v[i.DRAW_FRAMEBUFFER]=le),!0):!1}function at(H,le){let re=y,Pe=!1;if(H){re=_.get(le),re===void 0&&(re=[],_.set(le,re));const be=H.textures;if(re.length!==be.length||re[0]!==i.COLOR_ATTACHMENT0){for(let Te=0,Qe=be.length;Te<Qe;Te++)re[Te]=i.COLOR_ATTACHMENT0+Te;re.length=be.length,Pe=!0}}else re[0]!==i.BACK&&(re[0]=i.BACK,Pe=!0);Pe&&i.drawBuffers(re)}function yt(H){return w!==H?(i.useProgram(H),w=H,!0):!1}const pt={[Fa]:i.FUNC_ADD,[Wy]:i.FUNC_SUBTRACT,[Xy]:i.FUNC_REVERSE_SUBTRACT};pt[qy]=i.MIN,pt[$y]=i.MAX;const de={[Yy]:i.ZERO,[Zy]:i.ONE,[jy]:i.SRC_COLOR,[km]:i.SRC_ALPHA,[n3]:i.SRC_ALPHA_SATURATE,[e3]:i.DST_COLOR,[Ky]:i.DST_ALPHA,[Jy]:i.ONE_MINUS_SRC_COLOR,[Hm]:i.ONE_MINUS_SRC_ALPHA,[t3]:i.ONE_MINUS_DST_COLOR,[Qy]:i.ONE_MINUS_DST_ALPHA,[i3]:i.CONSTANT_COLOR,[s3]:i.ONE_MINUS_CONSTANT_COLOR,[r3]:i.CONSTANT_ALPHA,[a3]:i.ONE_MINUS_CONSTANT_ALPHA};function we(H,le,re,Pe,be,Te,Qe,Mt,ve,rt){if(H===Oi){b===!0&&(tt(i.BLEND),b=!1);return}if(b===!1&&(Ce(i.BLEND),b=!0),H!==Gy){if(H!==S||rt!==D){if((M!==Fa||N!==Fa)&&(i.blendEquation(i.FUNC_ADD),M=Fa,N=Fa),rt)switch(H){case ll:i.blendFuncSeparate(i.ONE,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case xm:i.blendFunc(i.ONE,i.ONE);break;case ym:i.blendFuncSeparate(i.ZERO,i.ONE_MINUS_SRC_COLOR,i.ZERO,i.ONE);break;case Sm:i.blendFuncSeparate(i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ZERO,i.ONE);break;default:it("WebGLState: Invalid blending: ",H);break}else switch(H){case ll:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA);break;case xm:i.blendFuncSeparate(i.SRC_ALPHA,i.ONE,i.ONE,i.ONE);break;case ym:it("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Sm:it("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:it("WebGLState: Invalid blending: ",H);break}A=null,E=null,P=null,T=null,C.set(0,0,0),F=0,S=H,D=rt}return}be=be||le,Te=Te||re,Qe=Qe||Pe,(le!==M||be!==N)&&(i.blendEquationSeparate(pt[le],pt[be]),M=le,N=be),(re!==A||Pe!==E||Te!==P||Qe!==T)&&(i.blendFuncSeparate(de[re],de[Pe],de[Te],de[Qe]),A=re,E=Pe,P=Te,T=Qe),(Mt.equals(C)===!1||ve!==F)&&(i.blendColor(Mt.r,Mt.g,Mt.b,ve),C.copy(Mt),F=ve),S=H,D=!1}function ye(H,le){H.side===Di?tt(i.CULL_FACE):Ce(i.CULL_FACE);let re=H.side===Vn;le&&(re=!re),ke(re),H.blending===ll&&H.transparent===!1?we(Oi):we(H.blending,H.blendEquation,H.blendSrc,H.blendDst,H.blendEquationAlpha,H.blendSrcAlpha,H.blendDstAlpha,H.blendColor,H.blendAlpha,H.premultipliedAlpha),l.setFunc(H.depthFunc),l.setTest(H.depthTest),l.setMask(H.depthWrite),o.setMask(H.colorWrite);const Pe=H.stencilWrite;c.setTest(Pe),Pe&&(c.setMask(H.stencilWriteMask),c.setFunc(H.stencilFunc,H.stencilRef,H.stencilFuncMask),c.setOp(H.stencilFail,H.stencilZFail,H.stencilZPass)),$e(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),H.alphaToCoverage===!0?Ce(i.SAMPLE_ALPHA_TO_COVERAGE):tt(i.SAMPLE_ALPHA_TO_COVERAGE)}function ke(H){B!==H&&(H?i.frontFace(i.CW):i.frontFace(i.CCW),B=H)}function Ne(H){H!==ky?(Ce(i.CULL_FACE),H!==W&&(H===_m?i.cullFace(i.BACK):H===Hy?i.cullFace(i.FRONT):i.cullFace(i.FRONT_AND_BACK))):tt(i.CULL_FACE),W=H}function ht(H){H!==Z&&(q&&i.lineWidth(H),Z=H)}function $e(H,le,re){H?(Ce(i.POLYGON_OFFSET_FILL),(z!==le||X!==re)&&(z=le,X=re,l.getReversed()&&(le=-le,re=-re),i.polygonOffset(le,re))):tt(i.POLYGON_OFFSET_FILL)}function mt(H){H?Ce(i.SCISSOR_TEST):tt(i.SCISSOR_TEST)}function Tt(H){H===void 0&&(H=i.TEXTURE0+Q-1),he!==H&&(i.activeTexture(H),he=H)}function Ft(H,le,re){re===void 0&&(he===null?re=i.TEXTURE0+Q-1:re=he);let Pe=pe[re];Pe===void 0&&(Pe={type:void 0,texture:void 0},pe[re]=Pe),(Pe.type!==H||Pe.texture!==le)&&(he!==re&&(i.activeTexture(re),he=re),i.bindTexture(H,le||et[H]),Pe.type=H,Pe.texture=le)}function G(){const H=pe[he];H!==void 0&&H.type!==void 0&&(i.bindTexture(H.type,null),H.type=void 0,H.texture=void 0)}function un(){try{i.compressedTexImage2D(...arguments)}catch(H){it("WebGLState:",H)}}function vt(){try{i.compressedTexImage3D(...arguments)}catch(H){it("WebGLState:",H)}}function xt(){try{i.texSubImage2D(...arguments)}catch(H){it("WebGLState:",H)}}function Re(){try{i.texSubImage3D(...arguments)}catch(H){it("WebGLState:",H)}}function hn(){try{i.compressedTexSubImage2D(...arguments)}catch(H){it("WebGLState:",H)}}function st(){try{i.compressedTexSubImage3D(...arguments)}catch(H){it("WebGLState:",H)}}function ot(){try{i.texStorage2D(...arguments)}catch(H){it("WebGLState:",H)}}function U(){try{i.texStorage3D(...arguments)}catch(H){it("WebGLState:",H)}}function I(){try{i.texImage2D(...arguments)}catch(H){it("WebGLState:",H)}}function J(){try{i.texImage3D(...arguments)}catch(H){it("WebGLState:",H)}}function ge(H){return g[H]!==void 0?g[H]:i.getParameter(H)}function ce(H,le){g[H]!==le&&(i.pixelStorei(H,le),g[H]=le)}function Ae(H){ie.equals(H)===!1&&(i.scissor(H.x,H.y,H.z,H.w),ie.copy(H))}function Le(H){xe.equals(H)===!1&&(i.viewport(H.x,H.y,H.z,H.w),xe.copy(H))}function ae(H,le){let re=d.get(le);re===void 0&&(re=new WeakMap,d.set(le,re));let Pe=re.get(H);Pe===void 0&&(Pe=i.getUniformBlockIndex(le,H.name),i.uniformBlockBinding(le,Pe,Pe),re.set(H,Pe))}function oe(H,le,re){const be=d.get(le).get(H);h[be]!==re&&(i.bindBufferBase(i.UNIFORM_BUFFER,be,re),h[be]=re)}function Ie(){i.disable(i.BLEND),i.disable(i.CULL_FACE),i.disable(i.DEPTH_TEST),i.disable(i.POLYGON_OFFSET_FILL),i.disable(i.SCISSOR_TEST),i.disable(i.STENCIL_TEST),i.disable(i.SAMPLE_ALPHA_TO_COVERAGE),i.blendEquation(i.FUNC_ADD),i.blendFunc(i.ONE,i.ZERO),i.blendFuncSeparate(i.ONE,i.ZERO,i.ONE,i.ZERO),i.blendColor(0,0,0,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(i.LESS),l.setReversed(!1),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(i.ALWAYS,0,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.KEEP),i.clearStencil(0),i.cullFace(i.BACK),i.frontFace(i.CCW),i.polygonOffset(0,0),i.activeTexture(i.TEXTURE0),i.bindFramebuffer(i.FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),i.pixelStorei(i.PACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_ALIGNMENT,4),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!1),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.BROWSER_DEFAULT_WEBGL),i.pixelStorei(i.PACK_ROW_LENGTH,0),i.pixelStorei(i.PACK_SKIP_PIXELS,0),i.pixelStorei(i.PACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_ROW_LENGTH,0),i.pixelStorei(i.UNPACK_IMAGE_HEIGHT,0),i.pixelStorei(i.UNPACK_SKIP_PIXELS,0),i.pixelStorei(i.UNPACK_SKIP_ROWS,0),i.pixelStorei(i.UNPACK_SKIP_IMAGES,0),p={},g={},he=null,pe={},v={},h={},_=new WeakMap,y=[],w=null,b=!1,S=null,M=null,A=null,E=null,N=null,P=null,T=null,C=new Ge(0,0,0),F=0,D=!1,B=null,W=null,Z=null,z=null,X=null,ie.set(0,0,i.canvas.width,i.canvas.height),xe.set(0,0,i.canvas.width,i.canvas.height),o.reset(),l.reset(),c.reset()}return{buffers:{color:o,depth:l,stencil:c},enable:Ce,disable:tt,bindFramebuffer:kt,drawBuffers:at,useProgram:yt,setBlending:we,setMaterial:ye,setFlipSided:ke,setCullFace:Ne,setLineWidth:ht,setPolygonOffset:$e,setScissorTest:mt,activeTexture:Tt,bindTexture:Ft,unbindTexture:G,compressedTexImage2D:un,compressedTexImage3D:vt,texImage2D:I,texImage3D:J,pixelStorei:ce,getParameter:ge,updateUBOMapping:ae,uniformBlockBinding:oe,texStorage2D:ot,texStorage3D:U,texSubImage2D:xt,texSubImage3D:Re,compressedTexSubImage2D:hn,compressedTexSubImage3D:st,scissor:Ae,viewport:Le,reset:Ie}}function PC(i,e,t,n,r,o,l){const c=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,h=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new ue,p=new WeakMap,g=new Set;let v;const _=new WeakMap,y=new Set,w=new FinalizationRegistry(U=>y.delete(U));let b=!1;try{b=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function S(U,I){return b?new OffscreenCanvas(U,I):Bc("canvas")}function M(U,I,J){let ge=1;const ce=ot(U);if((ce.width>J||ce.height>J)&&(ge=J/Math.max(ce.width,ce.height)),ge<1)if(typeof HTMLImageElement<"u"&&U instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&U instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&U instanceof ImageBitmap||typeof VideoFrame<"u"&&U instanceof VideoFrame){const Ae=Math.floor(ge*ce.width),Le=Math.floor(ge*ce.height);v===void 0&&(v=S(Ae,Le));const ae=I?S(Ae,Le):v;return ae.width=Ae,ae.height=Le,ae.getContext("2d").drawImage(U,0,0,Ae,Le),Fe("WebGLRenderer: Texture has been resized from ("+ce.width+"x"+ce.height+") to ("+Ae+"x"+Le+")."),ae}else return"data"in U&&Fe("WebGLRenderer: Image in DataTexture is too big ("+ce.width+"x"+ce.height+")."),U;return U}function A(U){return U.generateMipmaps}function E(U){i.generateMipmap(U)}function N(U){return U.isWebGLCubeRenderTarget?i.TEXTURE_CUBE_MAP:U.isWebGL3DRenderTarget?i.TEXTURE_3D:U.isWebGLArrayRenderTarget||U.isCompressedArrayTexture?i.TEXTURE_2D_ARRAY:i.TEXTURE_2D}function P(U,I,J,ge,ce,Ae=!1){if(U!==null){if(i[U]!==void 0)return i[U];Fe("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+U+"'")}let Le;ge&&(Le=e.get("EXT_texture_norm16"),Le||Fe("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let ae=I;if(I===i.RED&&(J===i.FLOAT&&(ae=i.R32F),J===i.HALF_FLOAT&&(ae=i.R16F),J===i.UNSIGNED_BYTE&&(ae=i.R8),J===i.UNSIGNED_SHORT&&Le&&(ae=Le.R16_EXT),J===i.SHORT&&Le&&(ae=Le.R16_SNORM_EXT)),I===i.RED_INTEGER&&(J===i.UNSIGNED_BYTE&&(ae=i.R8UI),J===i.UNSIGNED_SHORT&&(ae=i.R16UI),J===i.UNSIGNED_INT&&(ae=i.R32UI),J===i.BYTE&&(ae=i.R8I),J===i.SHORT&&(ae=i.R16I),J===i.INT&&(ae=i.R32I)),I===i.RG&&(J===i.FLOAT&&(ae=i.RG32F),J===i.HALF_FLOAT&&(ae=i.RG16F),J===i.UNSIGNED_BYTE&&(ae=i.RG8),J===i.UNSIGNED_SHORT&&Le&&(ae=Le.RG16_EXT),J===i.SHORT&&Le&&(ae=Le.RG16_SNORM_EXT)),I===i.RG_INTEGER&&(J===i.UNSIGNED_BYTE&&(ae=i.RG8UI),J===i.UNSIGNED_SHORT&&(ae=i.RG16UI),J===i.UNSIGNED_INT&&(ae=i.RG32UI),J===i.BYTE&&(ae=i.RG8I),J===i.SHORT&&(ae=i.RG16I),J===i.INT&&(ae=i.RG32I)),I===i.RGB_INTEGER&&(J===i.UNSIGNED_BYTE&&(ae=i.RGB8UI),J===i.UNSIGNED_SHORT&&(ae=i.RGB16UI),J===i.UNSIGNED_INT&&(ae=i.RGB32UI),J===i.BYTE&&(ae=i.RGB8I),J===i.SHORT&&(ae=i.RGB16I),J===i.INT&&(ae=i.RGB32I)),I===i.RGBA_INTEGER&&(J===i.UNSIGNED_BYTE&&(ae=i.RGBA8UI),J===i.UNSIGNED_SHORT&&(ae=i.RGBA16UI),J===i.UNSIGNED_INT&&(ae=i.RGBA32UI),J===i.BYTE&&(ae=i.RGBA8I),J===i.SHORT&&(ae=i.RGBA16I),J===i.INT&&(ae=i.RGBA32I)),I===i.RGB&&(J===i.UNSIGNED_SHORT&&Le&&(ae=Le.RGB16_EXT),J===i.SHORT&&Le&&(ae=Le.RGB16_SNORM_EXT),J===i.UNSIGNED_INT_5_9_9_9_REV&&(ae=i.RGB9_E5),J===i.UNSIGNED_INT_10F_11F_11F_REV&&(ae=i.R11F_G11F_B10F)),I===i.RGBA){const oe=Ae?Oc:Lt.getTransfer(ce);J===i.FLOAT&&(ae=i.RGBA32F),J===i.HALF_FLOAT&&(ae=i.RGBA16F),J===i.UNSIGNED_BYTE&&(ae=oe===en?i.SRGB8_ALPHA8:i.RGBA8),J===i.UNSIGNED_SHORT&&Le&&(ae=Le.RGBA16_EXT),J===i.SHORT&&Le&&(ae=Le.RGBA16_SNORM_EXT),J===i.UNSIGNED_SHORT_4_4_4_4&&(ae=i.RGBA4),J===i.UNSIGNED_SHORT_5_5_5_1&&(ae=i.RGB5_A1)}return(ae===i.R16F||ae===i.R32F||ae===i.RG16F||ae===i.RG32F||ae===i.RGBA16F||ae===i.RGBA32F)&&e.get("EXT_color_buffer_float"),ae}function T(U,I){let J;return U?I===null||I===ds||I===Qr?J=i.DEPTH24_STENCIL8:I===oi?J=i.DEPTH32F_STENCIL8:I===fl&&(J=i.DEPTH24_STENCIL8,Fe("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):I===null||I===ds||I===Qr?J=i.DEPTH_COMPONENT24:I===oi?J=i.DEPTH_COMPONENT32F:I===fl&&(J=i.DEPTH_COMPONENT16),J}function C(U,I){return A(U)===!0||U.isFramebufferTexture&&U.minFilter!==dn&&U.minFilter!==an?Math.log2(Math.max(I.width,I.height))+1:U.mipmaps.length>0?U.mipmaps.length:U.isCompressedTexture&&Array.isArray(U.image)?I.mipmaps.length:1}function F(U){const I=new WeakRef(U);n.get(U).__ref=I,y.add(I),w.register(U,I,I)}function D(U){const I=n.get(U).__ref;I!==void 0&&(y.delete(I),w.unregister(I))}function B(U){Z(U.target)}function W(U){z(U.target)}function Z(U){U.removeEventListener("dispose",B),D(U),Q(U),U.isVideoTexture&&p.delete(U),U.isHTMLTexture&&g.delete(U)}function z(U){U.removeEventListener("dispose",W),D(U),fe(U)}function X(){for(const U of y){const I=U.deref();I!==void 0&&(I.isRenderTarget===!0?z(I):Z(I))}y.clear(),g.clear()}function Q(U){const I=n.get(U);if(I.__webglInit===void 0)return;const J=U.source,ge=_.get(J);if(ge){const ce=ge[I.__cacheKey];ce.usedTimes--,ce.usedTimes===0&&q(U),Object.keys(ge).length===0&&_.delete(J)}n.remove(U)}function q(U){const I=n.get(U);i.deleteTexture(I.__webglTexture);const J=U.source,ge=_.get(J);delete ge[I.__cacheKey],l.memory.textures--}function fe(U){const I=n.get(U);I.__depthDisposeCallback&&I.__depthDisposeCallback();const J=U.depthTexture;if(J&&J.renderTarget===U&&Z(J),U.isWebGLCubeRenderTarget)for(let ce=0;ce<6;ce++){if(Array.isArray(I.__webglFramebuffer[ce]))for(let Ae=0;Ae<I.__webglFramebuffer[ce].length;Ae++)i.deleteFramebuffer(I.__webglFramebuffer[ce][Ae]);else i.deleteFramebuffer(I.__webglFramebuffer[ce]);I.__webglDepthbuffer&&i.deleteRenderbuffer(I.__webglDepthbuffer[ce])}else{if(Array.isArray(I.__webglFramebuffer))for(let ce=0;ce<I.__webglFramebuffer.length;ce++)i.deleteFramebuffer(I.__webglFramebuffer[ce]);else i.deleteFramebuffer(I.__webglFramebuffer);if(I.__webglDepthbuffer&&i.deleteRenderbuffer(I.__webglDepthbuffer),I.__webglMultisampledFramebuffer&&i.deleteFramebuffer(I.__webglMultisampledFramebuffer),I.__webglColorRenderbuffer)for(let ce=0;ce<I.__webglColorRenderbuffer.length;ce++)I.__webglColorRenderbuffer[ce]&&i.deleteRenderbuffer(I.__webglColorRenderbuffer[ce]);I.__webglDepthRenderbuffer&&i.deleteRenderbuffer(I.__webglDepthRenderbuffer)}const ge=U.textures;for(let ce=0,Ae=ge.length;ce<Ae;ce++){const Le=n.get(ge[ce]);Le.__webglTexture&&(i.deleteTexture(Le.__webglTexture),l.memory.textures--),n.remove(ge[ce])}n.remove(U)}let Y=0;function he(){Y=0}function pe(){return Y}function We(U){Y=U}function qe(){const U=Y;return U>=r.maxTextures&&Fe("WebGLTextures: Trying to use "+(U+1)+" texture units while this GPU supports only "+r.maxTextures),Y+=1,U}function ie(U){const I=[];return I.push(U.wrapS),I.push(U.wrapT),I.push(U.wrapR||0),I.push(U.magFilter),I.push(U.minFilter),I.push(U.anisotropy),I.push(U.internalFormat),I.push(U.format),I.push(U.type),I.push(U.generateMipmaps),I.push(U.mipmapsAutoUpdate),I.push(U.premultiplyAlpha),I.push(U.flipY),I.push(U.unpackAlignment),I.push(U.colorSpace),I.join()}function xe(U,I){const J=n.get(U);if(U.isVideoTexture&&hn(U),U.isRenderTargetTexture===!1&&U.isExternalTexture!==!0&&U.version>0&&J.__version!==U.version){const ge=U.image;if(ge===null)Fe("WebGLRenderer: Texture marked for update but no image data found.");else if(ge.complete===!1)Fe("WebGLRenderer: Texture marked for update but image is incomplete");else{ye(J,U,I);return}}else U.isExternalTexture&&(J.__webglTexture=U.sourceTexture?U.sourceTexture:null);t.bindTexture(i.TEXTURE_2D,J.__webglTexture,i.TEXTURE0+I)}function Be(U,I){const J=n.get(U);if(U.isRenderTargetTexture===!1&&U.version>0&&J.__version!==U.version){ye(J,U,I);return}else U.isExternalTexture&&(J.__webglTexture=U.sourceTexture?U.sourceTexture:null);t.bindTexture(i.TEXTURE_2D_ARRAY,J.__webglTexture,i.TEXTURE0+I)}function et(U,I){const J=n.get(U);if(U.isRenderTargetTexture===!1&&U.version>0&&J.__version!==U.version){ye(J,U,I);return}t.bindTexture(i.TEXTURE_3D,J.__webglTexture,i.TEXTURE0+I)}function Ce(U,I){const J=n.get(U);if(U.version>0&&J.__version!==U.version){ke(J,U,I);return}t.bindTexture(i.TEXTURE_CUBE_MAP,J.__webglTexture,i.TEXTURE0+I)}const tt={[Pc]:i.REPEAT,[Fi]:i.CLAMP_TO_EDGE,[Lc]:i.MIRRORED_REPEAT},kt={[dn]:i.NEAREST,[Ym]:i.NEAREST_MIPMAP_NEAREST,[nl]:i.NEAREST_MIPMAP_LINEAR,[an]:i.LINEAR,[xc]:i.LINEAR_MIPMAP_NEAREST,[Ps]:i.LINEAR_MIPMAP_LINEAR},at={[m3]:i.NEVER,[sg]:i.ALWAYS,[g3]:i.LESS,[ng]:i.LEQUAL,[v3]:i.EQUAL,[ig]:i.GEQUAL,[_3]:i.GREATER,[x3]:i.NOTEQUAL};function yt(U,I){if(I.type===oi&&e.has("OES_texture_float_linear")===!1&&(I.magFilter===an||I.magFilter===xc||I.magFilter===nl||I.magFilter===Ps||I.minFilter===an||I.minFilter===xc||I.minFilter===nl||I.minFilter===Ps)&&Fe("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),i.texParameteri(U,i.TEXTURE_WRAP_S,tt[I.wrapS]),i.texParameteri(U,i.TEXTURE_WRAP_T,tt[I.wrapT]),(U===i.TEXTURE_3D||U===i.TEXTURE_2D_ARRAY)&&i.texParameteri(U,i.TEXTURE_WRAP_R,tt[I.wrapR]),i.texParameteri(U,i.TEXTURE_MAG_FILTER,kt[I.magFilter]),i.texParameteri(U,i.TEXTURE_MIN_FILTER,kt[I.minFilter]),I.compareFunction&&(i.texParameteri(U,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE),i.texParameteri(U,i.TEXTURE_COMPARE_FUNC,at[I.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(I.magFilter===dn||I.minFilter!==nl&&I.minFilter!==Ps||I.type===oi&&e.has("OES_texture_float_linear")===!1)return;if(I.anisotropy>1||n.get(I).__currentAnisotropy){const J=e.get("EXT_texture_filter_anisotropic");i.texParameterf(U,J.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,r.getMaxAnisotropy())),n.get(I).__currentAnisotropy=I.anisotropy}}}function pt(U,I){let J=!1;U.__webglInit===void 0&&(U.__webglInit=!0,I.addEventListener("dispose",B),F(I));const ge=I.source;let ce=_.get(ge);ce===void 0&&(ce={},_.set(ge,ce));const Ae=ie(I);if(Ae!==U.__cacheKey){ce[Ae]===void 0&&(ce[Ae]={texture:i.createTexture(),usedTimes:0},l.memory.textures++,J=!0),ce[Ae].usedTimes++;const Le=ce[U.__cacheKey];Le!==void 0&&(ce[U.__cacheKey].usedTimes--,Le.usedTimes===0&&q(I)),U.__cacheKey=Ae,U.__webglTexture=ce[Ae].texture}return J}function de(U,I,J){return Math.floor(Math.floor(U/J)/I)}function we(U,I,J,ge){const Ae=U.updateRanges;if(Ae.length===0)t.texSubImage2D(i.TEXTURE_2D,0,0,0,I.width,I.height,J,ge,I.data);else{Ae.sort((H,le)=>H.start-le.start);let Le=0;for(let H=1;H<Ae.length;H++){const le=Ae[Le],re=Ae[H],Pe=le.start+le.count,be=de(re.start,I.width,4),Te=de(le.start,I.width,4);re.start<=Pe+1&&be===Te&&de(re.start+re.count-1,I.width,4)===be?le.count=Math.max(le.count,re.start+re.count-le.start):(++Le,Ae[Le]=re)}Ae.length=Le+1;const ae=t.getParameter(i.UNPACK_ROW_LENGTH),oe=t.getParameter(i.UNPACK_SKIP_PIXELS),Ie=t.getParameter(i.UNPACK_SKIP_ROWS);t.pixelStorei(i.UNPACK_ROW_LENGTH,I.width);for(let H=0,le=Ae.length;H<le;H++){const re=Ae[H],Pe=Math.floor(re.start/4),be=Math.ceil(re.count/4),Te=Pe%I.width,Qe=Math.floor(Pe/I.width),Mt=be,ve=1;t.pixelStorei(i.UNPACK_SKIP_PIXELS,Te),t.pixelStorei(i.UNPACK_SKIP_ROWS,Qe),t.texSubImage2D(i.TEXTURE_2D,0,Te,Qe,Mt,ve,J,ge,I.data)}U.clearUpdateRanges(),t.pixelStorei(i.UNPACK_ROW_LENGTH,ae),t.pixelStorei(i.UNPACK_SKIP_PIXELS,oe),t.pixelStorei(i.UNPACK_SKIP_ROWS,Ie)}}function ye(U,I,J){let ge=i.TEXTURE_2D;(I.isDataArrayTexture||I.isCompressedArrayTexture)&&(ge=i.TEXTURE_2D_ARRAY),I.isData3DTexture&&(ge=i.TEXTURE_3D);const ce=pt(U,I),Ae=I.source;t.bindTexture(ge,U.__webglTexture,i.TEXTURE0+J);const Le=n.get(Ae);if(Ae.version!==Le.__version||ce===!0){if(t.activeTexture(i.TEXTURE0+J),(typeof ImageBitmap<"u"&&I.image instanceof ImageBitmap)===!1){const ve=Lt.getPrimaries(Lt.workingColorSpace),rt=I.colorSpace===Is?null:Lt.getPrimaries(I.colorSpace),St=I.colorSpace===Is||ve===rt?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,I.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,St)}t.pixelStorei(i.UNPACK_ALIGNMENT,I.unpackAlignment);let oe=M(I.image,!1,r.maxTextureSize);oe=st(I,oe);const Ie=o.convert(I.format,I.colorSpace),H=o.convert(I.type);let le=P(I.internalFormat,Ie,H,I.normalized,I.colorSpace,I.isVideoTexture);yt(ge,I);let re;const Pe=I.mipmaps,be=I.isVideoTexture!==!0,Te=Le.__version===void 0||ce===!0,Qe=Ae.dataReady,Mt=C(I,oe);if(I.isDepthTexture)le=T(I.format===js,I.type),Te&&(be?t.texStorage2D(i.TEXTURE_2D,1,le,oe.width,oe.height):t.texImage2D(i.TEXTURE_2D,0,le,oe.width,oe.height,0,Ie,H,null));else if(I.isDataTexture)if(Pe.length>0){be&&Te&&t.texStorage2D(i.TEXTURE_2D,Mt,le,Pe[0].width,Pe[0].height);for(let ve=0,rt=Pe.length;ve<rt;ve++)re=Pe[ve],be?Qe&&t.texSubImage2D(i.TEXTURE_2D,ve,0,0,re.width,re.height,Ie,H,re.data):t.texImage2D(i.TEXTURE_2D,ve,le,re.width,re.height,0,Ie,H,re.data);I.generateMipmaps=!1}else be?(Te&&t.texStorage2D(i.TEXTURE_2D,Mt,le,oe.width,oe.height),Qe&&we(I,oe,Ie,H)):t.texImage2D(i.TEXTURE_2D,0,le,oe.width,oe.height,0,Ie,H,oe.data);else if(I.isCompressedTexture)if(I.isCompressedArrayTexture){be&&Te&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Mt,le,Pe[0].width,Pe[0].height,oe.depth);for(let ve=0,rt=Pe.length;ve<rt;ve++)if(re=Pe[ve],I.format!==Mi)if(Ie!==null)if(be){if(Qe)if(I.layerUpdates.size>0){const St=Lm(re.width,re.height,I.format,I.type);for(const De of I.layerUpdates){const Xt=re.data.subarray(De*St/re.data.BYTES_PER_ELEMENT,(De+1)*St/re.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,ve,0,0,De,re.width,re.height,1,Ie,Xt)}}else t.compressedTexSubImage3D(i.TEXTURE_2D_ARRAY,ve,0,0,0,re.width,re.height,oe.depth,Ie,re.data)}else t.compressedTexImage3D(i.TEXTURE_2D_ARRAY,ve,le,re.width,re.height,oe.depth,0,re.data,0,0);else Fe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else be?Qe&&t.texSubImage3D(i.TEXTURE_2D_ARRAY,ve,0,0,0,re.width,re.height,oe.depth,Ie,H,re.data):t.texImage3D(i.TEXTURE_2D_ARRAY,ve,le,re.width,re.height,oe.depth,0,Ie,H,re.data);I.layerUpdates.size>0&&I.clearLayerUpdates()}else{be&&Te&&t.texStorage2D(i.TEXTURE_2D,Mt,le,Pe[0].width,Pe[0].height);for(let ve=0,rt=Pe.length;ve<rt;ve++)re=Pe[ve],I.format!==Mi?Ie!==null?be?Qe&&t.compressedTexSubImage2D(i.TEXTURE_2D,ve,0,0,re.width,re.height,Ie,re.data):t.compressedTexImage2D(i.TEXTURE_2D,ve,le,re.width,re.height,0,re.data):Fe("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):be?Qe&&t.texSubImage2D(i.TEXTURE_2D,ve,0,0,re.width,re.height,Ie,H,re.data):t.texImage2D(i.TEXTURE_2D,ve,le,re.width,re.height,0,Ie,H,re.data)}else if(I.isDataArrayTexture)if(be){if(Te&&t.texStorage3D(i.TEXTURE_2D_ARRAY,Mt,le,oe.width,oe.height,oe.depth),Qe)if(I.layerUpdates.size>0){const ve=Lm(oe.width,oe.height,I.format,I.type);for(const rt of I.layerUpdates){const St=oe.data.subarray(rt*ve/oe.data.BYTES_PER_ELEMENT,(rt+1)*ve/oe.data.BYTES_PER_ELEMENT);t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,rt,oe.width,oe.height,1,Ie,H,St)}I.clearLayerUpdates()}else t.texSubImage3D(i.TEXTURE_2D_ARRAY,0,0,0,0,oe.width,oe.height,oe.depth,Ie,H,oe.data)}else t.texImage3D(i.TEXTURE_2D_ARRAY,0,le,oe.width,oe.height,oe.depth,0,Ie,H,oe.data);else if(I.isData3DTexture)be?(Te&&t.texStorage3D(i.TEXTURE_3D,Mt,le,oe.width,oe.height,oe.depth),Qe&&t.texSubImage3D(i.TEXTURE_3D,0,0,0,0,oe.width,oe.height,oe.depth,Ie,H,oe.data)):t.texImage3D(i.TEXTURE_3D,0,le,oe.width,oe.height,oe.depth,0,Ie,H,oe.data);else if(I.isFramebufferTexture){if(Te)if(be)t.texStorage2D(i.TEXTURE_2D,Mt,le,oe.width,oe.height);else{let ve=oe.width,rt=oe.height;for(let St=0;St<Mt;St++)t.texImage2D(i.TEXTURE_2D,St,le,ve,rt,0,Ie,H,null),ve>>=1,rt>>=1}}else if(I.isHTMLTexture){if("texElementImage2D"in i){const ve=i.canvas;if(ve.hasAttribute("layoutsubtree")||ve.setAttribute("layoutsubtree","true"),oe.parentNode!==ve){ve.appendChild(oe),g.add(I),ve.onpaint=rt=>{const St=rt.changedElements;for(const De of g)St.includes(De.image)&&(De.needsUpdate=!0)},ve.requestPaint();return}if(i.texElementImage2D.length===3)i.texElementImage2D(i.TEXTURE_2D,i.RGBA8,oe);else{const St=i.RGBA,De=i.RGBA,Xt=i.UNSIGNED_BYTE;i.texElementImage2D(i.TEXTURE_2D,0,St,De,Xt,oe)}i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE)}}else if(Pe.length>0){if(be&&Te){const ve=ot(Pe[0]);t.texStorage2D(i.TEXTURE_2D,Mt,le,ve.width,ve.height)}for(let ve=0,rt=Pe.length;ve<rt;ve++)re=Pe[ve],be?Qe&&t.texSubImage2D(i.TEXTURE_2D,ve,0,0,Ie,H,re):t.texImage2D(i.TEXTURE_2D,ve,le,Ie,H,re);I.generateMipmaps=!1}else if(be){if(Te){const ve=ot(oe);t.texStorage2D(i.TEXTURE_2D,Mt,le,ve.width,ve.height)}Qe&&t.texSubImage2D(i.TEXTURE_2D,0,0,0,Ie,H,oe)}else t.texImage2D(i.TEXTURE_2D,0,le,Ie,H,oe);A(I)&&I.mipmapsAutoUpdate===!0&&E(ge),Le.__version=Ae.version,I.onUpdate&&I.onUpdate(I)}U.__version=I.version}function ke(U,I,J){if(I.image.length!==6)return;const ge=pt(U,I),ce=I.source;t.bindTexture(i.TEXTURE_CUBE_MAP,U.__webglTexture,i.TEXTURE0+J);const Ae=n.get(ce);if(ce.version!==Ae.__version||ge===!0){t.activeTexture(i.TEXTURE0+J);const Le=Lt.getPrimaries(Lt.workingColorSpace),ae=I.colorSpace===Is?null:Lt.getPrimaries(I.colorSpace),oe=I.colorSpace===Is||Le===ae?i.NONE:i.BROWSER_DEFAULT_WEBGL;t.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,I.flipY),t.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),t.pixelStorei(i.UNPACK_ALIGNMENT,I.unpackAlignment),t.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,oe);const Ie=I.isCompressedTexture||I.image[0].isCompressedTexture,H=I.image[0]&&I.image[0].isDataTexture,le=[];for(let De=0;De<6;De++)!Ie&&!H?le[De]=M(I.image[De],!0,r.maxCubemapSize):le[De]=H?I.image[De].image:I.image[De],le[De]=st(I,le[De]);const re=le[0],Pe=o.convert(I.format,I.colorSpace),be=o.convert(I.type);let Te=P(I.internalFormat,Pe,be,I.normalized,I.colorSpace);const Qe=I.isVideoTexture!==!0,Mt=Ae.__version===void 0||ge===!0,ve=ce.dataReady;let rt=C(I,re);yt(i.TEXTURE_CUBE_MAP,I);let St;if(I.isDepthTexture){if(Te=T(I.format===js,I.type),Mt)if(Qe)t.texStorage2D(i.TEXTURE_CUBE_MAP,1,Te,re.width,re.height);else for(let De=0;De<6;De++)t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+De,0,Te,re.width,re.height,0,Pe,be,null)}else if(Ie){Qe&&Mt&&t.texStorage2D(i.TEXTURE_CUBE_MAP,rt,Te,re.width,re.height);for(let De=0;De<6;De++){St=le[De].mipmaps;for(let Xt=0;Xt<St.length;Xt++){const Rn=St[Xt];I.format!==Mi?Pe!==null?Qe?ve&&t.compressedTexSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+De,Xt,0,0,Rn.width,Rn.height,Pe,Rn.data):t.compressedTexImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+De,Xt,Te,Rn.width,Rn.height,0,Rn.data):Fe("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Qe?ve&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+De,Xt,0,0,Rn.width,Rn.height,Pe,be,Rn.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+De,Xt,Te,Rn.width,Rn.height,0,Pe,be,Rn.data)}}}else{if(St=I.mipmaps,Qe&&Mt){St.length>0&&rt++;const De=ot(le[0]);t.texStorage2D(i.TEXTURE_CUBE_MAP,rt,Te,De.width,De.height)}for(let De=0;De<6;De++)if(H){Qe?ve&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+De,0,0,0,le[De].width,le[De].height,Pe,be,le[De].data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+De,0,Te,le[De].width,le[De].height,0,Pe,be,le[De].data);for(let Xt=0;Xt<St.length;Xt++){const ki=St[Xt].image[De].image;Qe?ve&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+De,Xt+1,0,0,ki.width,ki.height,Pe,be,ki.data):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+De,Xt+1,Te,ki.width,ki.height,0,Pe,be,ki.data)}}else{Qe?ve&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+De,0,0,0,Pe,be,le[De]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+De,0,Te,Pe,be,le[De]);for(let Xt=0;Xt<St.length;Xt++){const Rn=St[Xt];Qe?ve&&t.texSubImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+De,Xt+1,0,0,Pe,be,Rn.image[De]):t.texImage2D(i.TEXTURE_CUBE_MAP_POSITIVE_X+De,Xt+1,Te,Pe,be,Rn.image[De])}}}A(I)&&I.mipmapsAutoUpdate===!0&&E(i.TEXTURE_CUBE_MAP),Ae.__version=ce.version,I.onUpdate&&I.onUpdate(I)}U.__version=I.version}function Ne(U,I,J,ge,ce,Ae){const Le=o.convert(J.format,J.colorSpace),ae=o.convert(J.type),oe=P(J.internalFormat,Le,ae,J.normalized,J.colorSpace),Ie=n.get(I),H=n.get(J);if(H.__renderTarget=I,!Ie.__hasExternalTextures){const le=Math.max(1,I.width>>Ae),re=Math.max(1,I.height>>Ae);ce===i.TEXTURE_3D||ce===i.TEXTURE_2D_ARRAY?t.texImage3D(ce,Ae,oe,le,re,I.depth,0,Le,ae,null):t.texImage2D(ce,Ae,oe,le,re,0,Le,ae,null)}t.bindFramebuffer(i.FRAMEBUFFER,U),Re(I)?c.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,ge,ce,H.__webglTexture,0,xt(I)):(ce===i.TEXTURE_2D||ce>=i.TEXTURE_CUBE_MAP_POSITIVE_X&&ce<=i.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&i.framebufferTexture2D(i.FRAMEBUFFER,ge,ce,H.__webglTexture,Ae),t.bindFramebuffer(i.FRAMEBUFFER,null)}function ht(U,I,J){if(i.bindRenderbuffer(i.RENDERBUFFER,U),I.depthBuffer){const ge=I.depthTexture,ce=ge&&ge.isDepthTexture?ge.type:null,Ae=T(I.stencilBuffer,ce),Le=I.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;Re(I)?c.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,xt(I),Ae,I.width,I.height):J?i.renderbufferStorageMultisample(i.RENDERBUFFER,xt(I),Ae,I.width,I.height):i.renderbufferStorage(i.RENDERBUFFER,Ae,I.width,I.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,Le,i.RENDERBUFFER,U)}else{const ge=I.textures;for(let ce=0;ce<ge.length;ce++){const Ae=ge[ce],Le=o.convert(Ae.format,Ae.colorSpace),ae=o.convert(Ae.type),oe=P(Ae.internalFormat,Le,ae,Ae.normalized,Ae.colorSpace);Re(I)?c.renderbufferStorageMultisampleEXT(i.RENDERBUFFER,xt(I),oe,I.width,I.height):J?i.renderbufferStorageMultisample(i.RENDERBUFFER,xt(I),oe,I.width,I.height):i.renderbufferStorage(i.RENDERBUFFER,oe,I.width,I.height)}}i.bindRenderbuffer(i.RENDERBUFFER,null)}function $e(U,I,J){const ge=I.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(i.FRAMEBUFFER,U),!(I.depthTexture&&I.depthTexture.isDepthTexture))throw new Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");const ce=n.get(I.depthTexture);ce.__renderTarget=I;const Ae=ge?I.depthTexture.image[0]:I.depthTexture.image;(!ce.__webglTexture||Ae.width!==I.width||Ae.height!==I.height)&&(Ae.width=I.width,Ae.height=I.height,I.depthTexture.needsUpdate=!0),ge?Ce(I.depthTexture,0):xe(I.depthTexture,0);const Le=ce.__webglTexture,ae=xt(I),oe=ge?i.TEXTURE_CUBE_MAP_POSITIVE_X+J:i.TEXTURE_2D,Ie=I.depthTexture.format===js?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;if(I.depthTexture.format===Mr)Re(I)?c.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ie,oe,Le,0,ae):i.framebufferTexture2D(i.FRAMEBUFFER,Ie,oe,Le,0);else if(I.depthTexture.format===js)Re(I)?c.framebufferTexture2DMultisampleEXT(i.FRAMEBUFFER,Ie,oe,Le,0,ae):i.framebufferTexture2D(i.FRAMEBUFFER,Ie,oe,Le,0);else throw new Error("THREE.WebGLTextures: Unknown depthTexture format.")}function mt(U){const I=n.get(U),J=U.isWebGLCubeRenderTarget===!0;if(I.__boundDepthTexture!==U.depthTexture){const ge=U.depthTexture;if(I.__depthDisposeCallback&&I.__depthDisposeCallback(),ge){const ce=()=>{delete I.__boundDepthTexture,delete I.__depthDisposeCallback,ge.removeEventListener("dispose",ce)};ge.addEventListener("dispose",ce),I.__depthDisposeCallback=ce}I.__boundDepthTexture=ge}if(U.depthTexture&&!I.__autoAllocateDepthBuffer)if(J)for(let ge=0;ge<6;ge++)$e(I.__webglFramebuffer[ge],U,ge);else U.texture.mipmaps.length>0?$e(I.__webglFramebuffer[0],U,0):$e(I.__webglFramebuffer,U,0);else if(J){I.__webglDepthbuffer=[];for(let ge=0;ge<6;ge++)if(t.bindFramebuffer(i.FRAMEBUFFER,I.__webglFramebuffer[ge]),I.__webglDepthbuffer[ge]===void 0)I.__webglDepthbuffer[ge]=i.createRenderbuffer(),ht(I.__webglDepthbuffer[ge],U,!1);else{const ce=U.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Ae=I.__webglDepthbuffer[ge];i.bindRenderbuffer(i.RENDERBUFFER,Ae),i.framebufferRenderbuffer(i.FRAMEBUFFER,ce,i.RENDERBUFFER,Ae)}}else if(U.texture.mipmaps.length>0?t.bindFramebuffer(i.FRAMEBUFFER,I.__webglFramebuffer[0]):t.bindFramebuffer(i.FRAMEBUFFER,I.__webglFramebuffer),I.__webglDepthbuffer===void 0)I.__webglDepthbuffer=i.createRenderbuffer(),ht(I.__webglDepthbuffer,U,!1);else{const ce=U.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Ae=I.__webglDepthbuffer;i.bindRenderbuffer(i.RENDERBUFFER,Ae),i.framebufferRenderbuffer(i.FRAMEBUFFER,ce,i.RENDERBUFFER,Ae)}t.bindFramebuffer(i.FRAMEBUFFER,null)}function Tt(U,I,J){const ge=n.get(U);I!==void 0&&Ne(ge.__webglFramebuffer,U,U.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,0),J!==void 0&&mt(U)}function Ft(U){const I=U.texture,J=n.get(U),ge=n.get(I);U.addEventListener("dispose",W),F(U);const ce=U.textures,Ae=U.isWebGLCubeRenderTarget===!0,Le=ce.length>1;if(Le||(ge.__webglTexture===void 0&&(ge.__webglTexture=i.createTexture()),ge.__version=I.version,l.memory.textures++),Ae){J.__webglFramebuffer=[];for(let ae=0;ae<6;ae++)if(I.mipmaps.length>0){J.__webglFramebuffer[ae]=[];for(let oe=0;oe<I.mipmaps.length;oe++)J.__webglFramebuffer[ae][oe]=i.createFramebuffer()}else J.__webglFramebuffer[ae]=i.createFramebuffer()}else{if(I.mipmaps.length>0){J.__webglFramebuffer=[];for(let ae=0;ae<I.mipmaps.length;ae++)J.__webglFramebuffer[ae]=i.createFramebuffer()}else J.__webglFramebuffer=i.createFramebuffer();if(Le)for(let ae=0,oe=ce.length;ae<oe;ae++){const Ie=n.get(ce[ae]);Ie.__webglTexture===void 0&&(Ie.__webglTexture=i.createTexture(),l.memory.textures++)}if(U.samples>0&&Re(U)===!1){J.__webglMultisampledFramebuffer=i.createFramebuffer(),J.__webglColorRenderbuffer=[],t.bindFramebuffer(i.FRAMEBUFFER,J.__webglMultisampledFramebuffer);for(let ae=0;ae<ce.length;ae++){const oe=ce[ae];J.__webglColorRenderbuffer[ae]=i.createRenderbuffer(),i.bindRenderbuffer(i.RENDERBUFFER,J.__webglColorRenderbuffer[ae]);const Ie=o.convert(oe.format,oe.colorSpace),H=o.convert(oe.type),le=P(oe.internalFormat,Ie,H,oe.normalized,oe.colorSpace,U.isXRRenderTarget===!0),re=xt(U);i.renderbufferStorageMultisample(i.RENDERBUFFER,re,le,U.width,U.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+ae,i.RENDERBUFFER,J.__webglColorRenderbuffer[ae])}i.bindRenderbuffer(i.RENDERBUFFER,null),U.depthBuffer&&(J.__webglDepthRenderbuffer=i.createRenderbuffer(),ht(J.__webglDepthRenderbuffer,U,!0)),t.bindFramebuffer(i.FRAMEBUFFER,null)}}if(Ae){t.bindTexture(i.TEXTURE_CUBE_MAP,ge.__webglTexture),yt(i.TEXTURE_CUBE_MAP,I);for(let ae=0;ae<6;ae++)if(I.mipmaps.length>0)for(let oe=0;oe<I.mipmaps.length;oe++)Ne(J.__webglFramebuffer[ae][oe],U,I,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ae,oe);else Ne(J.__webglFramebuffer[ae],U,I,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+ae,0);A(I)?E(i.TEXTURE_CUBE_MAP):I.mipmaps.length>0&&i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MAX_LEVEL,I.mipmaps.length-1),t.unbindTexture()}else if(Le){for(let ae=0,oe=ce.length;ae<oe;ae++){const Ie=ce[ae],H=n.get(Ie);let le=i.TEXTURE_2D;(U.isWebGL3DRenderTarget||U.isWebGLArrayRenderTarget)&&(le=U.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(le,H.__webglTexture),yt(le,Ie),Ne(J.__webglFramebuffer,U,Ie,i.COLOR_ATTACHMENT0+ae,le,0),A(Ie)&&E(le)}t.unbindTexture()}else{let ae=i.TEXTURE_2D;if((U.isWebGL3DRenderTarget||U.isWebGLArrayRenderTarget)&&(ae=U.isWebGL3DRenderTarget?i.TEXTURE_3D:i.TEXTURE_2D_ARRAY),t.bindTexture(ae,ge.__webglTexture),yt(ae,I),I.mipmaps.length>0)for(let oe=0;oe<I.mipmaps.length;oe++)Ne(J.__webglFramebuffer[oe],U,I,i.COLOR_ATTACHMENT0,ae,oe);else Ne(J.__webglFramebuffer,U,I,i.COLOR_ATTACHMENT0,ae,0);A(I)?E(ae):I.mipmaps.length>0&&i.texParameteri(ae,i.TEXTURE_MAX_LEVEL,I.mipmaps.length-1),t.unbindTexture()}U.depthBuffer&&mt(U)}function G(U){const I=U.textures;for(let J=0,ge=I.length;J<ge;J++){const ce=I[J];if(A(ce)&&ce.mipmapsAutoUpdate===!0){const Ae=N(U),Le=n.get(ce).__webglTexture;t.bindTexture(Ae,Le),E(Ae),t.unbindTexture()}}}const un=[];function vt(U){if(U.samples>0){if(Re(U)===!1){const I=U.textures,J=U.width,ge=U.height;let ce=i.COLOR_BUFFER_BIT;const Ae=U.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT,Le=n.get(U),ae=I.length>1;if(ae)for(let Ie=0;Ie<I.length;Ie++)t.bindFramebuffer(i.FRAMEBUFFER,Le.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ie,i.RENDERBUFFER,null),t.bindFramebuffer(i.FRAMEBUFFER,Le.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ie,i.TEXTURE_2D,null,0);t.bindFramebuffer(i.READ_FRAMEBUFFER,Le.__webglMultisampledFramebuffer),U.texture.mipmaps.length>0?t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Le.__webglFramebuffer[0]):t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Le.__webglFramebuffer);for(let Ie=0;Ie<I.length;Ie++){if(U.resolveDepthBuffer&&(U.depthBuffer&&(ce|=i.DEPTH_BUFFER_BIT),U.stencilBuffer&&U.resolveStencilBuffer&&(ce|=i.STENCIL_BUFFER_BIT)),ae){i.framebufferRenderbuffer(i.READ_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,Le.__webglColorRenderbuffer[Ie]);const H=n.get(I[Ie]).__webglTexture;i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,H,0)}i.blitFramebuffer(0,0,J,ge,0,0,J,ge,ce,i.NEAREST),h===!0&&(un.length=0,un.push(i.COLOR_ATTACHMENT0+Ie),U.depthBuffer&&U.storeMultisampledDepthBuffer===!1&&un.push(Ae),i.invalidateFramebuffer(i.READ_FRAMEBUFFER,un))}if(t.bindFramebuffer(i.READ_FRAMEBUFFER,null),t.bindFramebuffer(i.DRAW_FRAMEBUFFER,null),ae)for(let Ie=0;Ie<I.length;Ie++){t.bindFramebuffer(i.FRAMEBUFFER,Le.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ie,i.RENDERBUFFER,Le.__webglColorRenderbuffer[Ie]);const H=n.get(I[Ie]).__webglTexture;t.bindFramebuffer(i.FRAMEBUFFER,Le.__webglFramebuffer),i.framebufferTexture2D(i.DRAW_FRAMEBUFFER,i.COLOR_ATTACHMENT0+Ie,i.TEXTURE_2D,H,0)}t.bindFramebuffer(i.DRAW_FRAMEBUFFER,Le.__webglMultisampledFramebuffer)}else if(U.depthBuffer&&U.storeMultisampledDepthBuffer===!1&&h){const I=U.stencilBuffer?i.DEPTH_STENCIL_ATTACHMENT:i.DEPTH_ATTACHMENT;i.invalidateFramebuffer(i.DRAW_FRAMEBUFFER,[I])}}}function xt(U){return Math.min(r.maxSamples,U.samples)}function Re(U){const I=n.get(U);return U.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function hn(U){const I=l.render.frame;p.get(U)!==I&&(p.set(U,I),U.update())}function st(U,I){const J=U.colorSpace,ge=U.format,ce=U.type;return U.isCompressedTexture===!0||U.isVideoTexture===!0||J!==ta&&J!==Is&&(Lt.getTransfer(J)===en?(ge!==Mi||ce!==Mn)&&Fe("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):it("WebGLTextures: Unsupported texture color space:",J)),I}function ot(U){return typeof HTMLImageElement<"u"&&U instanceof HTMLImageElement?(d.width=U.naturalWidth||U.width,d.height=U.naturalHeight||U.height):typeof VideoFrame<"u"&&U instanceof VideoFrame?(d.width=U.displayWidth,d.height=U.displayHeight):(d.width=U.width,d.height=U.height),d}this.allocateTextureUnit=qe,this.resetTextureUnits=he,this.getTextureUnits=pe,this.setTextureUnits=We,this.setTexture2D=xe,this.setTexture2DArray=Be,this.setTexture3D=et,this.setTextureCube=Ce,this.rebindTextures=Tt,this.setupRenderTarget=Ft,this.updateRenderTargetMipmap=G,this.updateMultisampleRenderTarget=vt,this.setupDepthRenderbuffer=mt,this.setupFrameBufferTexture=Ne,this.useMultisampledRTT=Re,this.dispose=X}function OS(i,e){function t(n,r=Is){let o;const l=Lt.getTransfer(r);if(n===Mn)return i.UNSIGNED_BYTE;if(n===sd)return i.UNSIGNED_SHORT_4_4_4_4;if(n===rd)return i.UNSIGNED_SHORT_5_5_5_1;if(n===Jm)return i.UNSIGNED_INT_5_9_9_9_REV;if(n===Km)return i.UNSIGNED_INT_10F_11F_11F_REV;if(n===Zm)return i.BYTE;if(n===jm)return i.SHORT;if(n===fl)return i.UNSIGNED_SHORT;if(n===id)return i.INT;if(n===ds)return i.UNSIGNED_INT;if(n===oi)return i.FLOAT;if(n===ps)return i.HALF_FLOAT;if(n===Qm)return i.ALPHA;if(n===eg)return i.RGB;if(n===Mi)return i.RGBA;if(n===Mr)return i.DEPTH_COMPONENT;if(n===js)return i.DEPTH_STENCIL;if(n===ad)return i.RED;if(n===Kc)return i.RED_INTEGER;if(n===ea)return i.RG;if(n===od)return i.RG_INTEGER;if(n===ld)return i.RGBA_INTEGER;if(n===yc||n===Sc||n===bc||n===Mc)if(l===en)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(n===yc)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Sc)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===bc)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Mc)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(n===yc)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Sc)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===bc)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Mc)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===hf||n===ff||n===df||n===pf)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(n===hf)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===ff)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===df)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===pf)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===mf||n===gf||n===vf||n===_f||n===xf||n===Nc||n===yf)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(n===mf||n===gf)return l===en?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(n===vf)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC;if(n===_f)return o.COMPRESSED_R11_EAC;if(n===xf)return o.COMPRESSED_SIGNED_R11_EAC;if(n===Nc)return o.COMPRESSED_RG11_EAC;if(n===yf)return o.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===Sf||n===bf||n===Mf||n===wf||n===Tf||n===Ef||n===Af||n===Cf||n===Rf||n===If||n===Pf||n===Lf||n===Nf||n===Df)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(n===Sf)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===bf)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Mf)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===wf)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Tf)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ef)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Af)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Cf)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Rf)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===If)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Pf)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Lf)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Nf)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Df)return l===en?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===Uf||n===Ff||n===Of)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(n===Uf)return l===en?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ff)return o.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Of)return o.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===Bf||n===zf||n===Dc||n===kf)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(n===Bf)return o.COMPRESSED_RED_RGTC1_EXT;if(n===zf)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Dc)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===kf)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===Qr?i.UNSIGNED_INT_24_8:i[n]!==void 0?i[n]:null}return{convert:t}}const LC=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`,NC=`
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 DC{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new dg(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new Qn({vertexShader:LC,fragmentShader:NC,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Wn(new yl(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class UC extends Bi{constructor(e,t){super();const n=this;let r=null,o=1,l=null,c="local-floor",h=1,d=null,p=null,g=null,v=null,_=null,y=null;const w=typeof XRWebGLBinding<"u",b=new DC,S={},M=t.getContextAttributes();let A=null,E=null;const N=[],P=[],T=new ue;let C=null,F=null;const D=new Kn;D.viewport=new Kt;const B=new Kn;B.viewport=new Kt;const W=[D,B],Z=new _S;let z=null,X=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ie){let xe=N[ie];return xe===void 0&&(xe=new tf,N[ie]=xe),xe.getTargetRaySpace()},this.getControllerGrip=function(ie){let xe=N[ie];return xe===void 0&&(xe=new tf,N[ie]=xe),xe.getGripSpace()},this.getHand=function(ie){let xe=N[ie];return xe===void 0&&(xe=new tf,N[ie]=xe),xe.getHandSpace()};function Q(ie){const xe=P.indexOf(ie.inputSource);if(xe===-1)return;const Be=N[xe];Be!==void 0&&(Be.update(ie.inputSource,ie.frame,d||l),Be.dispatchEvent({type:ie.type,data:ie.inputSource}))}function q(){r.removeEventListener("select",Q),r.removeEventListener("selectstart",Q),r.removeEventListener("selectend",Q),r.removeEventListener("squeeze",Q),r.removeEventListener("squeezestart",Q),r.removeEventListener("squeezeend",Q),r.removeEventListener("end",q),r.removeEventListener("inputsourceschange",fe);for(let ie=0;ie<N.length;ie++){const xe=P[ie];xe!==null&&(P[ie]=null,N[ie].disconnect(xe))}z=null,X=null,b.reset();for(const ie in S)delete S[ie];if(e.setRenderTarget(A),_=null,v=null,g=null,r=null,E=null,qe.stop(),n.isPresenting=!1,e.setPixelRatio(C),e.setSize(T.width,T.height,!1),F!==null){const ie=F.camera;ie.fov=F.fov,ie.zoom=F.zoom,ie.updateProjectionMatrix(),F=null}n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ie){o=ie,n.isPresenting===!0&&Fe("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ie){c=ie,n.isPresenting===!0&&Fe("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||l},this.setReferenceSpace=function(ie){d=ie},this.getBaseLayer=function(){return v!==null?v:_},this.getBinding=function(){return g===null&&w&&(g=new XRWebGLBinding(r,t)),g},this.getFrame=function(){return y},this.getSession=function(){return r},this.setSession=async function(ie){if(r=ie,r!==null){if(A=e.getRenderTarget(),r.addEventListener("select",Q),r.addEventListener("selectstart",Q),r.addEventListener("selectend",Q),r.addEventListener("squeeze",Q),r.addEventListener("squeezestart",Q),r.addEventListener("squeezeend",Q),r.addEventListener("end",q),r.addEventListener("inputsourceschange",fe),M.xrCompatible!==!0&&await t.makeXRCompatible(),C=e.getPixelRatio(),e.getSize(T),w&&"createProjectionLayer"in XRWebGLBinding.prototype){let Be=null,et=null,Ce=null;M.depth&&(Ce=M.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Be=M.stencil?js:Mr,et=M.stencil?Qr:ds);const tt={colorFormat:t.RGBA8,depthFormat:Ce,scaleFactor:o};g=this.getBinding(),v=g.createProjectionLayer(tt),r.updateRenderState({layers:[v]}),e.setPixelRatio(1),e.setSize(v.textureWidth,v.textureHeight,!1),E=new gn(v.textureWidth,v.textureHeight,{format:Mi,type:Mn,depthTexture:new Qs(v.textureWidth,v.textureHeight,et,void 0,void 0,void 0,void 0,void 0,void 0,Be),stencilBuffer:M.stencil,colorSpace:e.outputColorSpace,samples:M.antialias?4:0,resolveDepthBuffer:v.ignoreDepthValues===!1,resolveStencilBuffer:v.ignoreDepthValues===!1,storeMultisampledDepthBuffer:v.ignoreDepthValues===!1,storeMultisampledStencilBuffer:v.ignoreDepthValues===!1})}else{const Be={antialias:M.antialias,alpha:!0,depth:M.depth,stencil:M.stencil,framebufferScaleFactor:o};_=new XRWebGLLayer(r,t,Be),r.updateRenderState({baseLayer:_}),e.setPixelRatio(1),e.setSize(_.framebufferWidth,_.framebufferHeight,!1),E=new gn(_.framebufferWidth,_.framebufferHeight,{format:Mi,type:Mn,colorSpace:e.outputColorSpace,stencilBuffer:M.stencil,resolveDepthBuffer:_.ignoreDepthValues===!1,resolveStencilBuffer:_.ignoreDepthValues===!1,storeMultisampledDepthBuffer:_.ignoreDepthValues===!1,storeMultisampledStencilBuffer:_.ignoreDepthValues===!1})}E.isXRRenderTarget=!0,this.setFoveation(h),d=null,l=await r.requestReferenceSpace(c),qe.setContext(r),qe.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode},this.getDepthTexture=function(){return b.getDepthTexture()};function fe(ie){for(let xe=0;xe<ie.removed.length;xe++){const Be=ie.removed[xe],et=P.indexOf(Be);et>=0&&(P[et]=null,N[et].disconnect(Be))}for(let xe=0;xe<ie.added.length;xe++){const Be=ie.added[xe];let et=P.indexOf(Be);if(et===-1){for(let tt=0;tt<N.length;tt++)if(tt>=P.length){P.push(Be),et=tt;break}else if(P[tt]===null){P[tt]=Be,et=tt;break}if(et===-1)break}const Ce=N[et];Ce&&Ce.connect(Be)}}function Y(ie,xe){xe===null?ie.matrixWorld.copy(ie.matrix):ie.matrixWorld.multiplyMatrices(xe.matrixWorld,ie.matrix),ie.matrixWorldInverse.copy(ie.matrixWorld).invert()}this.updateCamera=function(ie){if(r===null)return;let xe=ie.near,Be=ie.far;b.texture!==null&&(b.depthNear>0&&(xe=b.depthNear),b.depthFar>0&&(Be=b.depthFar)),Z.near=B.near=D.near=xe,Z.far=B.far=D.far=Be,(z!==Z.near||X!==Z.far)&&(r.updateRenderState({depthNear:Z.near,depthFar:Z.far}),z=Z.near,X=Z.far),Z.layers.mask=ie.layers.mask|6,D.layers.mask=Z.layers.mask&-5,B.layers.mask=Z.layers.mask&-3;const et=ie.parent,Ce=Z.cameras;Y(Z,et);for(let tt=0;tt<Ce.length;tt++)Y(Ce[tt],et);Z.projectionMatrix.copy(D.projectionMatrix),Z.projectionMatrixInverse.copy(D.projectionMatrixInverse),F===null&&ie.isPerspectiveCamera&&(F={camera:ie,fov:ie.fov,zoom:ie.zoom}),he(ie,Z,et)};function he(ie,xe,Be){Be===null?ie.matrix.copy(xe.matrixWorld):(ie.matrix.copy(Be.matrixWorld),ie.matrix.invert(),ie.matrix.multiply(xe.matrixWorld)),ie.matrix.decompose(ie.position,ie.quaternion,ie.scale),ie.updateMatrixWorld(!0),ie.projectionMatrix.copy(xe.projectionMatrix),ie.projectionMatrixInverse.copy(xe.projectionMatrixInverse),ie.isPerspectiveCamera&&(ie.fov=dl*2*Math.atan(1/ie.projectionMatrix.elements[5]),ie.zoom=1)}this.getCamera=function(){return Z},this.getFoveation=function(){if(!(v===null&&_===null))return h},this.setFoveation=function(ie){h=ie,v!==null&&(v.fixedFoveation=ie),_!==null&&_.fixedFoveation!==void 0&&(_.fixedFoveation=ie)},this.hasDepthSensing=function(){return b.texture!==null},this.getDepthSensingMesh=function(){return b.getMesh(Z)},this.getCameraTexture=function(ie){return S[ie]};let pe=null;function We(ie,xe){if(p=xe.getViewerPose(d||l),y=xe,p!==null){const Be=p.views;_!==null&&(e.setRenderTargetFramebuffer(E,_.framebuffer),e.setRenderTarget(E));let et=!1;Be.length!==Z.cameras.length&&(Z.cameras.length=0,et=!0);for(let at=0;at<Be.length;at++){const yt=Be[at];let pt=null;if(_!==null)pt=_.getViewport(yt);else{const we=g.getViewSubImage(v,yt);pt=we.viewport,at===0&&(e.setRenderTargetTextures(E,we.colorTexture,we.depthStencilTexture),e.setRenderTarget(E))}let de=W[at];de===void 0&&(de=new Kn,de.layers.enable(at),de.viewport=new Kt,W[at]=de),de.matrix.fromArray(yt.transform.matrix),de.matrix.decompose(de.position,de.quaternion,de.scale),de.projectionMatrix.fromArray(yt.projectionMatrix),de.projectionMatrixInverse.copy(de.projectionMatrix).invert(),de.viewport.set(pt.x,pt.y,pt.width,pt.height),at===0&&(Z.matrix.copy(de.matrix),Z.matrix.decompose(Z.position,Z.quaternion,Z.scale)),et===!0&&Z.cameras.push(de)}const Ce=r.enabledFeatures;if(Ce&&Ce.includes("depth-sensing")&&r.depthUsage=="gpu-optimized"&&w){g=n.getBinding();const at=g.getDepthInformation(Be[0]);at&&at.isValid&&at.texture&&b.init(at,r.renderState)}if(Ce&&Ce.includes("camera-access")&&w){e.state.unbindTexture(),g=n.getBinding();for(let at=0;at<Be.length;at++){const yt=Be[at].camera;if(yt){let pt=S[yt];pt||(pt=new dg,S[yt]=pt);const de=g.getCameraImage(yt);pt.sourceTexture=de}}}}for(let Be=0;Be<N.length;Be++){const et=P[Be],Ce=N[Be];et!==null&&Ce!==void 0&&Ce.update(et,xe,d||l)}pe&&pe(ie,xe),xe.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:xe}),y=null}const qe=new AS;qe.setAnimationLoop(We),this.setAnimationLoop=function(ie){pe=ie},this.dispose=function(){}}}const FC=new gt,BS=new _t;BS.set(-1,0,0,0,1,0,0,0,1);function OC(i,e){function t(b,S){b.matrixAutoUpdate===!0&&b.updateMatrix(),S.value.copy(b.matrix)}function n(b,S){S.color.getRGB(b.fogColor.value,$3(i)),S.isFog?(b.fogNear.value=S.near,b.fogFar.value=S.far):S.isFogExp2&&(b.fogDensity.value=S.density)}function r(b,S,M,A,E){S.isNodeMaterial?S.uniformsNeedUpdate=!1:S.isMeshBasicMaterial?o(b,S):S.isMeshLambertMaterial?(o(b,S),S.envMap&&(b.envMapIntensity.value=S.envMapIntensity)):S.isMeshToonMaterial?(o(b,S),g(b,S)):S.isMeshPhongMaterial?(o(b,S),p(b,S),S.envMap&&(b.envMapIntensity.value=S.envMapIntensity)):S.isMeshStandardMaterial?(o(b,S),v(b,S),S.isMeshPhysicalMaterial&&_(b,S,E)):S.isMeshMatcapMaterial?(o(b,S),y(b,S)):S.isMeshDepthMaterial?o(b,S):S.isMeshDistanceMaterial?(o(b,S),w(b,S)):S.isMeshNormalMaterial?o(b,S):S.isLineBasicMaterial?(l(b,S),S.isLineDashedMaterial&&c(b,S)):S.isPointsMaterial?h(b,S,M,A):S.isSpriteMaterial?d(b,S):S.isShadowMaterial?(b.color.value.copy(S.color),b.opacity.value=S.opacity):S.isShaderMaterial&&(S.uniformsNeedUpdate=!1)}function o(b,S){b.opacity.value=S.opacity,S.color&&b.diffuse.value.copy(S.color),S.emissive&&b.emissive.value.copy(S.emissive).multiplyScalar(S.emissiveIntensity),S.map&&(b.map.value=S.map,t(S.map,b.mapTransform)),S.alphaMap&&(b.alphaMap.value=S.alphaMap,t(S.alphaMap,b.alphaMapTransform)),S.bumpMap&&(b.bumpMap.value=S.bumpMap,t(S.bumpMap,b.bumpMapTransform),b.bumpScale.value=S.bumpScale,S.side===Vn&&(b.bumpScale.value*=-1)),S.normalMap&&(b.normalMap.value=S.normalMap,t(S.normalMap,b.normalMapTransform),b.normalScale.value.copy(S.normalScale),S.side===Vn&&b.normalScale.value.negate()),S.displacementMap&&(b.displacementMap.value=S.displacementMap,t(S.displacementMap,b.displacementMapTransform),b.displacementScale.value=S.displacementScale,b.displacementBias.value=S.displacementBias),S.emissiveMap&&(b.emissiveMap.value=S.emissiveMap,t(S.emissiveMap,b.emissiveMapTransform)),S.specularMap&&(b.specularMap.value=S.specularMap,t(S.specularMap,b.specularMapTransform)),S.alphaTest>0&&(b.alphaTest.value=S.alphaTest);const M=e.get(S),A=M.envMap,E=M.envMapRotation;A&&(b.envMap.value=A,b.envMapRotation.value.setFromMatrix4(FC.makeRotationFromEuler(E)).transpose(),A.isCubeTexture&&A.isRenderTargetTexture===!1&&b.envMapRotation.value.premultiply(BS),b.reflectivity.value=S.reflectivity,b.ior.value=S.ior,b.refractionRatio.value=S.refractionRatio),S.lightMap&&(b.lightMap.value=S.lightMap,b.lightMapIntensity.value=S.lightMapIntensity,t(S.lightMap,b.lightMapTransform)),S.aoMap&&(b.aoMap.value=S.aoMap,b.aoMapIntensity.value=S.aoMapIntensity,t(S.aoMap,b.aoMapTransform))}function l(b,S){b.diffuse.value.copy(S.color),b.opacity.value=S.opacity,S.map&&(b.map.value=S.map,t(S.map,b.mapTransform))}function c(b,S){b.dashSize.value=S.dashSize,b.totalSize.value=S.dashSize+S.gapSize,b.scale.value=S.scale}function h(b,S,M,A){b.diffuse.value.copy(S.color),b.opacity.value=S.opacity,b.size.value=S.size*M,b.scale.value=A*.5,S.map&&(b.map.value=S.map,t(S.map,b.uvTransform)),S.alphaMap&&(b.alphaMap.value=S.alphaMap,t(S.alphaMap,b.alphaMapTransform)),S.alphaTest>0&&(b.alphaTest.value=S.alphaTest)}function d(b,S){b.diffuse.value.copy(S.color),b.opacity.value=S.opacity,b.rotation.value=S.rotation,S.map&&(b.map.value=S.map,t(S.map,b.mapTransform)),S.alphaMap&&(b.alphaMap.value=S.alphaMap,t(S.alphaMap,b.alphaMapTransform)),S.alphaTest>0&&(b.alphaTest.value=S.alphaTest)}function p(b,S){b.specular.value.copy(S.specular),b.shininess.value=Math.max(S.shininess,1e-4)}function g(b,S){S.gradientMap&&(b.gradientMap.value=S.gradientMap)}function v(b,S){b.metalness.value=S.metalness,S.metalnessMap&&(b.metalnessMap.value=S.metalnessMap,t(S.metalnessMap,b.metalnessMapTransform)),b.roughness.value=S.roughness,S.roughnessMap&&(b.roughnessMap.value=S.roughnessMap,t(S.roughnessMap,b.roughnessMapTransform)),S.envMap&&(b.envMapIntensity.value=S.envMapIntensity)}function _(b,S,M){b.ior.value=S.ior,S.diffuseRoughness>0&&(b.diffuseRoughness.value=S.diffuseRoughness,S.diffuseRoughnessMap&&(b.diffuseRoughnessMap.value=S.diffuseRoughnessMap,t(S.diffuseRoughnessMap,b.diffuseRoughnessMapTransform))),S.sheen>0&&(b.sheenColor.value.copy(S.sheenColor).multiplyScalar(S.sheen),b.sheenRoughness.value=S.sheenRoughness,S.sheenColorMap&&(b.sheenColorMap.value=S.sheenColorMap,t(S.sheenColorMap,b.sheenColorMapTransform)),S.sheenRoughnessMap&&(b.sheenRoughnessMap.value=S.sheenRoughnessMap,t(S.sheenRoughnessMap,b.sheenRoughnessMapTransform))),S.clearcoat>0&&(b.clearcoat.value=S.clearcoat,b.clearcoatRoughness.value=S.clearcoatRoughness,S.clearcoatMap&&(b.clearcoatMap.value=S.clearcoatMap,t(S.clearcoatMap,b.clearcoatMapTransform)),S.clearcoatRoughnessMap&&(b.clearcoatRoughnessMap.value=S.clearcoatRoughnessMap,t(S.clearcoatRoughnessMap,b.clearcoatRoughnessMapTransform)),S.clearcoatNormalMap&&(b.clearcoatNormalMap.value=S.clearcoatNormalMap,t(S.clearcoatNormalMap,b.clearcoatNormalMapTransform),b.clearcoatNormalScale.value.copy(S.clearcoatNormalScale),S.side===Vn&&b.clearcoatNormalScale.value.negate())),S.dispersion>0&&(b.dispersion.value=S.dispersion),S.retroreflectivity>0&&(b.retroreflectivity.value=S.retroreflectivity),S.iridescence>0&&(b.iridescence.value=S.iridescence,b.iridescenceIOR.value=S.iridescenceIOR,b.iridescenceThicknessMinimum.value=S.iridescenceThicknessMinimum,b.iridescenceThicknessMaximum.value=S.iridescenceThicknessMaximum,S.iridescenceMap&&(b.iridescenceMap.value=S.iridescenceMap,t(S.iridescenceMap,b.iridescenceMapTransform)),S.iridescenceThicknessMap&&(b.iridescenceThicknessMap.value=S.iridescenceThicknessMap,t(S.iridescenceThicknessMap,b.iridescenceThicknessMapTransform))),S.transmission>0&&(b.transmission.value=S.transmission,b.transmissionSamplerMap.value=M.texture,b.transmissionSamplerSize.value.set(M.width,M.height),S.transmissionMap&&(b.transmissionMap.value=S.transmissionMap,t(S.transmissionMap,b.transmissionMapTransform)),b.thickness.value=S.thickness,S.thicknessMap&&(b.thicknessMap.value=S.thicknessMap,t(S.thicknessMap,b.thicknessMapTransform)),b.attenuationDistance.value=S.attenuationDistance,b.attenuationColor.value.copy(S.attenuationColor)),S.anisotropy>0&&(b.anisotropyVector.value.set(S.anisotropy*Math.cos(S.anisotropyRotation),S.anisotropy*Math.sin(S.anisotropyRotation)),S.anisotropyMap&&(b.anisotropyMap.value=S.anisotropyMap,t(S.anisotropyMap,b.anisotropyMapTransform))),b.specularIntensity.value=S.specularIntensity,b.specularColor.value.copy(S.specularColor),S.specularColorMap&&(b.specularColorMap.value=S.specularColorMap,t(S.specularColorMap,b.specularColorMapTransform)),S.specularIntensityMap&&(b.specularIntensityMap.value=S.specularIntensityMap,t(S.specularIntensityMap,b.specularIntensityMapTransform))}function y(b,S){S.matcap&&(b.matcap.value=S.matcap)}function w(b,S){const M=e.get(S).light;b.referencePosition.value.setFromMatrixPosition(M.matrixWorld),b.nearDistance.value=M.shadow.camera.near,b.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:r}}function BC(i,e,t,n){let r={},o={};function l(M,A){const E=A.program;n.uniformBlockBinding(M,E,r[M.id])}function c(M,A){let E=r[M.id];E===void 0&&(y(M),E=h(M),r[M.id]=E,M.addEventListener("dispose",b));const N=A.program;n.updateUBOMapping(M,N);const P=e.render.frame;o[M.id]!==P&&(d(M),o[M.id]=P)}function h(M){const A=i.createBuffer(),E=M.__size,N=M.usage;return i.bindBuffer(i.UNIFORM_BUFFER,A),i.bufferData(i.UNIFORM_BUFFER,E,N),i.bindBuffer(i.UNIFORM_BUFFER,null),A}function d(M){const A=r[M.id],E=M.uniforms,N=M.__cache;i.bindBuffer(i.UNIFORM_BUFFER,A);for(let P=0,T=E.length;P<T;P++){const C=E[P];if(Array.isArray(C))for(let F=0,D=C.length;F<D;F++)p(C[F],P,F,N);else p(C,P,0,N)}i.bindBuffer(i.UNIFORM_BUFFER,null)}function p(M,A,E,N){if(v(M,A,E,N)===!0){const P=M.__offset,T=M.value;if(Array.isArray(T)){let C=0;for(let F=0;F<T.length;F++){const D=T[F],B=w(D,!0);g(D,M.__data,C),C+=B.storage/Float32Array.BYTES_PER_ELEMENT}}else g(T,M.__data,0);i.bufferSubData(i.UNIFORM_BUFFER,P,M.__data)}}function g(M,A,E){typeof M=="number"||typeof M=="boolean"?A[E]=M:M.isMatrix3?(A[E]=M.elements[0],A[E+1]=M.elements[1],A[E+2]=M.elements[2],A[E+3]=0,A[E+4]=M.elements[3],A[E+5]=M.elements[4],A[E+6]=M.elements[5],A[E+7]=0,A[E+8]=M.elements[6],A[E+9]=M.elements[7],A[E+10]=M.elements[8],A[E+11]=0):ArrayBuffer.isView(M)?A.set(M.subarray(0,A.length-E),E):M.toArray(A,E)}function v(M,A,E,N){const P=M.value,T=A+"_"+E;if(Array.isArray(P)){N[T]===void 0&&(N[T]=[]);const C=N[T];let F=!1;for(let D=0;D<P.length;D++)_(P[D],C,D)===!0&&(F=!0);return F}return _(P,N,T)}function _(M,A,E){if(A[E]===void 0)return typeof M=="number"||typeof M=="boolean"?A[E]=M:ArrayBuffer.isView(M)?A[E]=M.slice():A[E]=M.clone(),!0;{const N=A[E];if(typeof M=="number"||typeof M=="boolean"){if(N!==M)return A[E]=M,!0}else{if(ArrayBuffer.isView(M))return!0;if(N.equals(M)===!1)return N.copy(M),!0}}return!1}function y(M){const A=M.uniforms;let E=0;const N=16;for(let T=0,C=A.length;T<C;T++){const F=Array.isArray(A[T])?A[T]:[A[T]];for(let D=0,B=F.length;D<B;D++){const W=F[D],Z=Array.isArray(W.value)?W.value:[W.value],z=Array.isArray(A[T])||Array.isArray(W.value);let X=E;for(let q=0,fe=Z.length;q<fe;q++){const Y=Z[q],he=w(Y,z),pe=E%N,We=pe%he.boundary,qe=pe+We;E+=We,qe!==0&&N-qe<he.storage&&(E+=N-qe),q===0&&(X=E),E+=he.storage}const Q=W.type==="int"?Int32Array:W.type==="uint"?Uint32Array:Float32Array;W.__data=new Q((E-X)/Float32Array.BYTES_PER_ELEMENT),W.__offset=X}}const P=E%N;return P>0&&(E+=N-P),M.__size=E,M.__cache={},this}function w(M,A){const E={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(E.boundary=4,E.storage=4):M.isVector2?(E.boundary=8,E.storage=8):M.isVector3||M.isColor?(E.boundary=16,E.storage=12):M.isVector4?(E.boundary=16,E.storage=16):M.isMatrix3?(E.boundary=16,E.storage=48):M.isMatrix4?(E.boundary=16,E.storage=64):M.isTexture?Fe("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(M)?(E.boundary=16,E.storage=M.byteLength):Fe("WebGLRenderer: Unsupported uniform value type.",M),A===!0&&(E.boundary=16,E.storage=Math.ceil(E.storage/16)*16),E}function b(M){const A=M.target;A.removeEventListener("dispose",b),i.deleteBuffer(r[A.id]),delete r[A.id],delete o[A.id]}function S(){for(const M in r)i.deleteBuffer(r[M]);r={},o={}}return{bind:l,update:c,dispose:S}}const zC=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Ys=null;function kC(){return Ys===null&&(Ys=new fs(zC,16,16,ea,ps),Ys.name="DFG_LUT",Ys.minFilter=an,Ys.magFilter=an,Ys.wrapS=Fi,Ys.wrapT=Fi,Ys.generateMipmaps=!1,Ys.needsUpdate=!0),Ys}class zS{constructor(e={}){const{canvas:t=S3(),context:n=null,depth:r=!0,stencil:o=!1,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:d=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reversedDepthBuffer:v=!1,outputBufferType:_=Mn}=e;this.isWebGLRenderer=!0;let y;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");y=n.getContextAttributes().alpha}else y=l;const w=_,b=new Set([ld,od,Kc]),S=new Set([Mn,ds,fl,Qr,sd,rd]),M=new Uint32Array(4),A=new Int32Array(4),E={textures:[],min:[],max:[],resolution:[]};let N=null,P=null;const T=[],C=[];let F=null;this.domElement=t,this.debug={checkShaderErrors:!0,diagnostics:{keywords:!1},onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Qi,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const D=this;let B=!1,W=null,Z=null,z=null,X=null;this._outputColorSpace=Zt;let Q=0,q=0,fe=null,Y=-1,he=null;const pe=new Kt,We=new Kt;let qe=null;const ie=new Ge(0);let xe=0,Be=t.width,et=t.height,Ce=1,tt=null,kt=null;const at=new Kt(0,0,Be,et),yt=new Kt(0,0,Be,et);let pt=!1;const de=new Za,we=new Qc;let ye=!1,ke=!1;const Ne=new gt,ht=new O,$e=new Kt,mt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Tt=!1;function Ft(){return fe===null?Ce:1}let G=n;function un(L,V){return t.getContext(L,V)}let vt,xt,Re,hn,st,ot,U,I,J,ge,ce,Ae,Le,ae,oe,Ie,H,le,re,Pe,be,Te,Qe;try{const L={alpha:!0,depth:r,stencil:o,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:d,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${_l}`),t.addEventListener("webglcontextlost",rt,!1),t.addEventListener("webglcontextrestored",St,!1),t.addEventListener("webglcontextcreationerror",De,!1),G===null){const V="webgl2";if(G=un(V,L),G===null)throw un(V)?new Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes."):new Error("THREE.WebGLRenderer: Error creating WebGL context.")}Mt()}catch(L){throw t.removeEventListener("webglcontextlost",rt,!1),t.removeEventListener("webglcontextrestored",St,!1),t.removeEventListener("webglcontextcreationerror",De,!1),it("WebGLRenderer: "+L.message),L}function Mt(){vt=new X8(G),vt.init(),be=new OS(G,vt),xt=new D8(G,vt,e,be),Re=new IC(G,vt),xt.reversedDepthBuffer&&v&&Re.buffers.depth.setReversed(!0),Z=G.createFramebuffer(),z=G.createFramebuffer(),X=G.createFramebuffer(),hn=new Y8(G),st=new gC,ot=new PC(G,vt,Re,st,xt,be,hn),U=new W8(D),I=new j5(G),Te=new L8(G,I),J=new q8(G,I,hn,Te),ge=new j8(G,J,I,Te,hn),le=new Z8(G,xt,ot),oe=new U8(st),ce=new mC(D,U,vt,xt,Te,oe),Ae=new OC(D,st),Le=new _C,ae=new wC(vt),H=new P8(D,U,Re,ge,y,h),Ie=new RC(D,ge,xt),Qe=new BC(G,hn,xt,Re),re=new N8(G,vt,hn),Pe=new $8(G,vt,hn),hn.programs=ce.programs,D.capabilities=xt,D.extensions=vt,D.properties=st,D.renderLists=Le,D.shadowMap=Ie,D.state=Re,D.info=hn}w!==Mn&&(F=new K8(w,t.width,t.height,c,r,o));const ve=new UC(D,G);this.xr=ve,this.getContext=function(){return G},this.getContextAttributes=function(){return G.getContextAttributes()},this.forceContextLoss=function(){const L=vt.get("WEBGL_lose_context");L&&L.loseContext()},this.forceContextRestore=function(){const L=vt.get("WEBGL_lose_context");L&&L.restoreContext()},this.getPixelRatio=function(){return Ce},this.setPixelRatio=function(L){L!==void 0&&(Ce=L,this.setSize(Be,et,!1))},this.getSize=function(L){return L.set(Be,et)},this.setSize=function(L,V,te=!0){if(ve.isPresenting){Fe("WebGLRenderer: Can't change size while VR device is presenting.");return}Be=L,et=V,t.width=Math.floor(L*Ce),t.height=Math.floor(V*Ce),te===!0&&(t.style.width=L+"px",t.style.height=V+"px"),F!==null&&F.setSize(t.width,t.height),this.setViewport(0,0,L,V)},this.getDrawingBufferSize=function(L){return L.set(Be*Ce,et*Ce).floor()},this.setDrawingBufferSize=function(L,V,te){Be=L,et=V,Ce=te,t.width=Math.floor(L*te),t.height=Math.floor(V*te),this.setViewport(0,0,L,V)},this.setEffects=function(L){if(w===Mn){it("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(L){for(let V=0;V<L.length;V++)if(L[V].isOutputPass===!0){Fe("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}F.setEffects(L||[])},this.getCurrentViewport=function(L){return L.copy(pe)},this.getViewport=function(L){return L.copy(at)},this.setViewport=function(L,V,te,j){L.isVector4?at.set(L.x,L.y,L.z,L.w):at.set(L,V,te,j),Re.viewport(pe.copy(at).multiplyScalar(Ft()).round())},this.getScissor=function(L){return L.copy(yt)},this.setScissor=function(L,V,te,j){L.isVector4?yt.set(L.x,L.y,L.z,L.w):yt.set(L,V,te,j),Re.scissor(We.copy(yt).multiplyScalar(Ft()).round())},this.getScissorTest=function(){return pt},this.setScissorTest=function(L){Re.setScissorTest(pt=L)},this.setOpaqueSort=function(L){tt=L},this.setTransparentSort=function(L){kt=L},this.getClearColor=function(L){return L.copy(H.getClearColor())},this.setClearColor=function(){H.setClearColor(...arguments)},this.getClearAlpha=function(){return H.getClearAlpha()},this.setClearAlpha=function(){H.setClearAlpha(...arguments)},this.clear=function(L=!0,V=!0,te=!0){let j=0;if(L){let K=!1;if(fe!==null){const Me=fe.texture.format;K=b.has(Me)}if(K){const Me=fe.texture.type,Oe=S.has(Me),Ee=H.getClearColor(),ze=H.getClearAlpha(),Ke=Ee.r,Ye=Ee.g,At=Ee.b;Oe?(M[0]=Ke,M[1]=Ye,M[2]=At,M[3]=ze,G.clearBufferuiv(G.COLOR,0,M)):(A[0]=Ke,A[1]=Ye,A[2]=At,A[3]=ze,G.clearBufferiv(G.COLOR,0,A))}else j|=G.COLOR_BUFFER_BIT}V&&(j|=G.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),te&&(j|=G.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),j!==0&&G.clear(j)},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.setNodesHandler=function(L){L.setRenderer(this),W=L},this.dispose=function(){t.removeEventListener("webglcontextlost",rt,!1),t.removeEventListener("webglcontextrestored",St,!1),t.removeEventListener("webglcontextcreationerror",De,!1),H.dispose(),Le.dispose(),ae.dispose(),ot.dispose(),st.dispose(),U.dispose(),ge.dispose(),J.dispose(),Te.dispose(),Qe.dispose(),ce.dispose(),ve.dispose(),ve.removeEventListener("sessionstart",aa),ve.removeEventListener("sessionend",oa),_s.stop()};function rt(L){L.preventDefault(),zc("WebGLRenderer: Context Lost."),B=!0}function St(){zc("WebGLRenderer: Context Restored."),B=!1;const L=hn.autoReset,V=Ie.enabled,te=Ie.autoUpdate,j=Ie.needsUpdate,K=Ie.type;Mt(),hn.autoReset=L,Ie.enabled=V,Ie.autoUpdate=te,Ie.needsUpdate=j,Ie.type=K}function De(L){it("WebGLRenderer: A WebGL context could not be created. Reason: ",L.statusMessage)}function Xt(L){const V=L.target;V.removeEventListener("dispose",Xt),Rn(V)}function Rn(L){ki(L),st.remove(L)}function ki(L){const V=st.get(L).programs;V!==void 0&&(V.forEach(function(te){ce.releaseProgram(te)}),L.isShaderMaterial&&ce.releaseShaderCache(L))}this.renderBufferDirect=function(L,V,te,j,K,Me){V===null&&(V=mt);const Oe=K.isMesh&&K.matrixWorld.determinantAffine()<0,Ee=ua(L,V,te,j,K);Re.setMaterial(j,Oe);let ze=te.index,Ke=1;if(j.wireframe===!0){if(ze=J.getWireframeAttribute(te),ze===void 0)return;Ke=2}const Ye=te.drawRange,At=te.attributes.position;let Ze=Ye.start*Ke,Ct=(Ye.start+Ye.count)*Ke;Me!==null&&(Ze=Math.max(Ze,Me.start*Ke),Ct=Math.min(Ct,(Me.start+Me.count)*Ke)),ze!==null?(Ze=Math.max(Ze,0),Ct=Math.min(Ct,ze.count)):At!=null&&(Ze=Math.max(Ze,0),Ct=Math.min(Ct,At.count));const vn=Ct-Ze;if(vn<0||vn===1/0)return;Te.setup(K,j,Ee,te,ze);let nn,jt=re;if(ze!==null&&(nn=I.get(ze),jt=Pe,jt.setIndex(nn)),K.isMesh)j.wireframe===!0?(Re.setLineWidth(j.wireframeLinewidth*Ft()),jt.setMode(G.LINES)):jt.setMode(G.TRIANGLES);else if(K.isLine){let Nn=j.linewidth;Nn===void 0&&(Nn=1),Re.setLineWidth(Nn*Ft()),K.isLineSegments?jt.setMode(G.LINES):K.isLineLoop?jt.setMode(G.LINE_LOOP):jt.setMode(G.LINE_STRIP)}else K.isPoints?jt.setMode(G.POINTS):K.isSprite&&jt.setMode(G.TRIANGLES);if(K.isBatchedMesh)if(vt.get("WEBGL_multi_draw"))jt.renderMultiDraw(K._multiDrawStarts,K._multiDrawCounts,K._multiDrawCount);else{const Nn=K._multiDrawStarts,je=K._multiDrawCounts,Jt=K._multiDrawCount,lt=ze?I.get(ze).bytesPerElement:1,es=st.get(j).currentProgram.getUniforms();for(let Tn=0;Tn<Jt;Tn++)es.setValue(G,"_gl_DrawID",Tn),jt.render(Nn[Tn]/lt,je[Tn])}else if(K.isInstancedMesh)jt.renderInstances(Ze,vn,K.count);else if(te.isInstancedBufferGeometry){const Nn=te._maxInstanceCount!==void 0?te._maxInstanceCount:1/0,je=Math.min(te.instanceCount,Nn);jt.renderInstances(Ze,vn,je)}else jt.render(Ze,vn)};function vs(L,V,te,j){W!==null&&L.isNodeMaterial&&W.setObject(j,L),ye===!0&&oe.setState(L,te,!1),L.transparent===!0&&L.side===Di&&L.forceSinglePass===!1?(L.side=Vn,L.needsUpdate=!0,Ti(L,V,j),L.side=Sr,L.needsUpdate=!0,Ti(L,V,j),L.side=Di):Ti(L,V,j)}this.compile=function(L,V,te=null){te===null&&(te=L),W!==null&&W.renderStart(L,V,te),P=ae.get(te),P.init(V),C.push(P),te.traverseVisible(function(K){K.isLight&&K.layers.test(V.layers)&&(P.pushLight(K),K.castShadow&&P.pushShadow(K))}),L!==te&&L.traverseVisible(function(K){K.isLight&&K.layers.test(V.layers)&&(P.pushLight(K),K.castShadow&&P.pushShadow(K))}),P.setupLights(),W!==null&&W.updateLights(P.state.lightsArray),ke=this.localClippingEnabled,ye=oe.init(this.clippingPlanes,ke),ye===!0&&oe.setGlobalState(this.clippingPlanes,V),W!==null&&Ie.render(P.state.shadowsArray,te,V);const j=new Set;return L.traverse(function(K){if(!(K.isMesh||K.isPoints||K.isLine||K.isSprite))return;const Me=K.material;if(Me)if(Array.isArray(Me))for(let Oe=0;Oe<Me.length;Oe++){const Ee=Me[Oe];vs(Ee,te,V,K),j.add(Ee)}else vs(Me,te,V,K),j.add(Me)}),P=C.pop(),W!==null&&W.renderEnd(),j},this.compileAsync=function(L,V,te=null){const j=this.compile(L,V,te);return new Promise(K=>{function Me(){if(j.forEach(function(Oe){const ze=st.get(Oe).currentProgram;(ze===void 0||ze.isReady())&&j.delete(Oe)}),j.size===0){K(L);return}setTimeout(Me,10)}vt.get("KHR_parallel_shader_compile")!==null?Me():setTimeout(Me,10)})};let Ar=null;function lu(L){Ar&&Ar(L)}function aa(){_s.stop()}function oa(){_s.start()}const _s=new AS;_s.setAnimationLoop(lu),typeof self<"u"&&_s.setContext(self),this.setAnimationLoop=function(L){Ar=L,ve.setAnimationLoop(L),L===null?_s.stop():_s.start()},ve.addEventListener("sessionstart",aa),ve.addEventListener("sessionend",oa),this.render=function(L,V){if(V!==void 0&&V.isCamera!==!0){it("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(B===!0)return;W!==null&&W.renderStart(L,V);const te=ve.enabled===!0&&ve.isPresenting===!0,j=F!==null&&(fe===null||te)&&F.begin(D,fe);if(L.matrixWorldAutoUpdate===!0&&L.updateMatrixWorld(),V.parent===null&&V.matrixWorldAutoUpdate===!0&&V.updateMatrixWorld(),ve.enabled===!0&&ve.isPresenting===!0&&(F===null||F.isCompositing()===!1)&&(ve.cameraAutoUpdate===!0&&ve.updateCamera(V),V=ve.getCamera()),L.isScene===!0&&L.onBeforeRender(D,L,V,fe),P=ae.get(L,C.length),P.init(V),P.state.textureUnits=ot.getTextureUnits(),C.push(P),Ne.multiplyMatrices(V.projectionMatrix,V.matrixWorldInverse),V.isArrayCamera?we.setFromArrayCamera(V):de.setFromProjectionMatrix(Ne,Ki,V.reversedDepth),ke=this.localClippingEnabled,ye=oe.init(this.clippingPlanes,ke),N=Le.get(L,T.length),N.init(),T.push(N),this.info.render.frame++,ve.enabled===!0&&ve.isPresenting===!0){const Oe=D.xr.getDepthSensingMesh();Oe!==null&&xs(Oe,V,-1/0,D.sortObjects)}xs(L,V,0,D.sortObjects),N.finish(),W!==null&&W.updateLights(P.state.lightsArray),D.sortObjects===!0&&N.sort(tt,kt),Tt=ve.enabled===!1||ve.isPresenting===!1||ve.hasDepthSensing()===!1,Tt&&H.addToRenderList(N,L),this.info.autoReset===!0&&this.info.reset(),ye===!0&&oe.beginShadows();const K=P.state.shadowsArray;if(Ie.render(K,L,V),ye===!0&&oe.endShadows(),(j&&F.hasRenderPass())===!1){const Oe=N.opaque,Ee=N.transmissive;if(P.setupLights(),V.isArrayCamera){const ze=V.cameras;if(Ee.length>0)for(let Ke=0,Ye=ze.length;Ke<Ye;Ke++){const At=ze[Ke];la(Oe,Ee,L,At)}Tt&&H.render(L);for(let Ke=0,Ye=ze.length;Ke<Ye;Ke++){const At=ze[Ke];Tl(N,L,At,At.viewport)}}else Ee.length>0&&la(Oe,Ee,L,V),Tt&&H.render(L),Tl(N,L,V)}fe!==null&&q===0&&(ot.updateMultisampleRenderTarget(fe),ot.updateRenderTargetMipmap(fe)),j&&F.end(D),L.isScene===!0&&L.onAfterRender(D,L,V),Te.resetDefaultState(),Y=-1,he=null,C.pop(),C.length>0?(P=C[C.length-1],ot.setTextureUnits(P.state.textureUnits),ye===!0&&oe.setGlobalState(D.clippingPlanes,P.state.camera)):P=null,T.pop(),T.length>0?N=T[T.length-1]:N=null,W!==null&&W.renderEnd()};function xs(L,V,te,j){if(L.visible===!1)return;if(L.layers.test(V.layers)){if(L.isGroup)te=L.renderOrder;else if(L.isLOD)L.autoUpdate===!0&&L.update(V);else if(L.isLight)P.pushLight(L),L.castShadow&&P.pushShadow(L);else if(L.isSprite){const Oe=V.isArrayCamera?we:de;if(!L.frustumCulled||L.intersectsFrustum(Oe)){j&&$e.setFromMatrixPosition(L.matrixWorld).applyMatrix4(Ne);const Ee=ge.update(L),ze=L.material;ze.visible&&N.push(L,Ee,ze,te,$e.z,null,V)}}else if(L.isMesh||L.isLine||L.isPoints){const Oe=V.isArrayCamera?we:de;if(!L.frustumCulled||L.intersectsFrustum(Oe)){const Ee=ge.update(L),ze=L.material;if(j&&(L.boundingSphere!==void 0?(L.boundingSphere===null&&L.computeBoundingSphere(),$e.copy(L.boundingSphere.center)):(Ee.boundingSphere===null&&Ee.computeBoundingSphere(),$e.copy(Ee.boundingSphere.center)),$e.applyMatrix4(L.matrixWorld).applyMatrix4(Ne)),Array.isArray(ze)){const Ke=Ee.groups;for(let Ye=0,At=Ke.length;Ye<At;Ye++){const Ze=Ke[Ye],Ct=ze[Ze.materialIndex];Ct&&Ct.visible&&N.push(L,Ee,Ct,te,$e.z,Ze,V)}}else ze.visible&&N.push(L,Ee,ze,te,$e.z,null,V)}}}const Me=L.children;for(let Oe=0,Ee=Me.length;Oe<Ee;Oe++)xs(Me[Oe],V,te,j)}function Tl(L,V,te,j){const{opaque:K,transmissive:Me,transparent:Oe}=L;P.setupLightsView(te),ye===!0&&oe.setGlobalState(D.clippingPlanes,te),j&&Re.viewport(pe.copy(j)),K.length>0&&Cr(K,V,te),Me.length>0&&Cr(Me,V,te),Oe.length>0&&Cr(Oe,V,te),Re.buffers.depth.setTest(!0),Re.buffers.depth.setMask(!0),Re.buffers.color.setMask(!0),Re.setPolygonOffset(!1)}function la(L,V,te,j){if((te.isScene===!0?te.overrideMaterial:null)!==null)return;if(P.state.transmissionRenderTarget[j.id]===void 0){const Ze=vt.has("EXT_color_buffer_half_float")||vt.has("EXT_color_buffer_float");P.state.transmissionRenderTarget[j.id]=new gn(1,1,{generateMipmaps:!0,type:Ze?ps:Mn,minFilter:Ps,samples:Math.max(4,xt.samples),stencilBuffer:o,resolveDepthBuffer:!1,resolveStencilBuffer:!1,storeMultisampledDepthBuffer:!1,storeMultisampledStencilBuffer:!1,colorSpace:Lt.workingColorSpace})}const Me=P.state.transmissionRenderTarget[j.id],Oe=j.viewport||pe;Me.setSize(Oe.z*D.transmissionResolutionScale,Oe.w*D.transmissionResolutionScale);const Ee=D.getRenderTarget(),ze=D.getActiveCubeFace(),Ke=D.getActiveMipmapLevel();D.setRenderTarget(Me),D.getClearColor(ie),xe=D.getClearAlpha(),xe<1&&D.setClearColor(16777215,.5),D.clear(),Tt&&H.render(te);const Ye=D.toneMapping;D.toneMapping=Qi;const At=j.viewport;if(j.viewport!==void 0&&(j.viewport=void 0),P.setupLightsView(j),ye===!0&&oe.setGlobalState(D.clippingPlanes,j),Cr(L,te,j),ot.updateMultisampleRenderTarget(Me),ot.updateRenderTargetMipmap(Me),vt.has("WEBGL_multisampled_render_to_texture")===!1){let Ze=!1;for(let Ct=0,vn=V.length;Ct<vn;Ct++){const nn=V[Ct],{object:jt,geometry:Nn,material:je,group:Jt}=nn;if(je.side===Di&&jt.layers.test(j.layers)){const lt=je.side;je.side=Vn,je.needsUpdate=!0,no(jt,te,j,Nn,je,Jt),je.side=lt,je.needsUpdate=!0,Ze=!0}}Ze===!0&&(ot.updateMultisampleRenderTarget(Me),ot.updateRenderTargetMipmap(Me))}D.setRenderTarget(Ee,ze,Ke),D.setClearColor(ie,xe),At!==void 0&&(j.viewport=At),D.toneMapping=Ye}function Cr(L,V,te){const j=V.isScene===!0?V.overrideMaterial:null;for(let K=0,Me=L.length;K<Me;K++){const Oe=L[K],{object:Ee,geometry:ze,group:Ke}=Oe;let Ye=Oe.material;Ye.allowOverride===!0&&j!==null&&(Ye=j),Ee.layers.test(te.layers)&&no(Ee,V,te,ze,Ye,Ke)}}function no(L,V,te,j,K,Me){W!==null&&K.isNodeMaterial&&W.setObject(L,K),L.onBeforeRender(D,V,te,j,K,Me),L.modelViewMatrix.multiplyMatrices(te.matrixWorldInverse,L.matrixWorld),L.normalMatrix.getNormalMatrix(L.modelViewMatrix),K.onBeforeRender(D,V,te,j,L,Me),K.transparent===!0&&K.side===Di&&K.forceSinglePass===!1?(K.side=Vn,K.needsUpdate=!0,D.renderBufferDirect(te,V,j,K,L,Me),K.side=Sr,K.needsUpdate=!0,D.renderBufferDirect(te,V,j,K,L,Me),K.side=Di):D.renderBufferDirect(te,V,j,K,L,Me),L.onAfterRender(D,V,te,j,K,Me)}function ys(L){let V=0;for(const te of L)te.texture!==null&&V++;return V}function Ti(L,V,te){V.isScene!==!0&&(V=mt);const j=st.get(L),K=P.state.lights,Me=P.state.shadowsArray,Oe=K.state.version,Ee=ce.getParameters(L,K.state,Me,V,te,P.state.lightProbeGridArray),ze=ce.getProgramCacheKey(Ee);let Ke=j.programs;j.environment=L.isMeshStandardMaterial||L.isMeshLambertMaterial||L.isMeshPhongMaterial?V.environment:null,j.fog=V.fog;const Ye=L.isMeshStandardMaterial||L.isMeshLambertMaterial&&!L.envMap||L.isMeshPhongMaterial&&!L.envMap;j.envMap=U.get(L.envMap||j.environment,Ye),j.envMapRotation=j.environment!==null&&L.envMap===null?V.environmentRotation:L.envMapRotation,Ke===void 0&&(L.addEventListener("dispose",Xt),Ke=new Map,j.programs=Ke,j.programVariants=new Map);let At=Ke.get(ze);if(At!==void 0){if(j.currentProgram===At&&j.lightsStateVersion===Oe)return Rr(L,Ee),At}else Ee.uniforms=ce.getUniforms(L),W!==null&&L.isNodeMaterial&&W.build(L,te,Ee),L.onBeforeCompile(Ee,D),At=ce.acquireProgram(Ee,ze),Ke.set(ze,At),j.uniforms=Ee.uniforms;const Ze=j.uniforms;return(!L.isShaderMaterial&&!L.isRawShaderMaterial||L.clipping===!0)&&(Ze.clippingPlanes=oe.uniform),Rr(L,Ee),j.needsLights=uu(L),j.lightsStateVersion=Oe,j.needsLights&&(Ze.ambientLightColor.value=K.state.ambient,Ze.lightProbe.value=K.state.probe,Ze.sunLights.value=K.state.sun,Ze.sunLightShadows.value=K.state.sunShadow,Ze.directionalLights.value=K.state.directional,Ze.directionalLightShadows.value=K.state.directionalShadow,Ze.spotLights.value=K.state.spot,Ze.spotLightShadows.value=K.state.spotShadow,Ze.rectAreaLights.value=K.state.rectArea,Ze.ltc_1.value=K.state.rectAreaLTC1,Ze.ltc_2.value=K.state.rectAreaLTC2,Ze.pointLights.value=K.state.point,Ze.pointLightShadows.value=K.state.pointShadow,Ze.hemisphereLights.value=K.state.hemi,Ze.sunShadowMatrix.value=K.state.sunShadowMatrix,Ze.sunShadowCascade.value=K.state.sunShadowCascade,Ze.directionalShadowMatrix.value=K.state.directionalShadowMatrix,Ze.spotLightMatrix.value=K.state.spotLightMatrix,Ze.spotLightMap.value=K.state.spotLightMap,Ze.pointShadowMatrix.value=K.state.pointShadowMatrix),j.numLightProbeGrids=ys(P.state.lightProbeGridArray),j.currentProgram=At,j.uniformsList=null,At}function ca(L,V,te,j,K){const Me=st.get(L),Oe=Me.currentProgram.id+","+j+","+K;let Ee=Me.programVariants.get(Oe);return Ee===void 0?(Ee=Ti(L,V,te),Me.programVariants.set(Oe,Ee)):(Me.currentProgram=Ee,Me.uniformsList=null,Me.outputColorSpace=j,Me.toneMapping=K),Ee}function io(L){if(L.uniformsList===null){const V=L.currentProgram.getUniforms();L.uniformsList=nf.seqWithValue(V.seq,L.uniforms)}return L.uniformsList}function Rr(L,V){const te=st.get(L);te.outputColorSpace=V.outputColorSpace,te.batching=V.batching,te.batchingColor=V.batchingColor,te.instancing=V.instancing,te.instancingColor=V.instancingColor,te.instancingMorph=V.instancingMorph,te.skinning=V.skinning,te.morphTargets=V.morphTargets,te.morphNormals=V.morphNormals,te.morphColors=V.morphColors,te.morphTargetsCount=V.morphTargetsCount,te.numClippingPlanes=V.numClippingPlanes,te.numIntersection=V.numClipIntersection,te.vertexAlphas=V.vertexAlphas,te.vertexTangents=V.vertexTangents,te.toneMapping=V.toneMapping}function ua(L,V,te,j,K){V.isScene!==!0&&(V=mt),ot.resetTextureUnits();const Me=V.fog,Oe=j.isMeshStandardMaterial||j.isMeshLambertMaterial||j.isMeshPhongMaterial?V.environment:null,Ee=fe===null?D.outputColorSpace:fe.isXRRenderTarget===!0?fe.texture.colorSpace:Lt.workingColorSpace,ze=j.isMeshStandardMaterial||j.isMeshLambertMaterial&&!j.envMap||j.isMeshPhongMaterial&&!j.envMap,Ke=U.get(j.envMap||Oe,ze),Ye=j.vertexColors===!0&&!!te.attributes.color&&te.attributes.color.itemSize===4,At=!!te.attributes.tangent&&(!!j.normalMap||j.anisotropy>0),Ze=!!te.morphAttributes.position,Ct=!!te.morphAttributes.normal,vn=!!te.morphAttributes.color;let nn=Qi;j.toneMapped&&(fe===null||fe.isXRRenderTarget===!0)&&(nn=D.toneMapping);const jt=te.morphAttributes.position||te.morphAttributes.normal||te.morphAttributes.color,Nn=jt!==void 0?jt.length:0,je=st.get(j),Jt=P.state.lights;if(ye===!0&&(ke===!0||L!==he)){const ln=L===he&&j.id===Y;oe.setState(j,L,ln)}let lt=!1,es=!1;j.version===je.__version?je.needsLights&&je.lightsStateVersion!==Jt.state.version||K.isBatchedMesh&&je.batching===!1||!K.isBatchedMesh&&je.batching===!0||K.isBatchedMesh&&je.batchingColor===!0&&K._colorsTexture===null||K.isBatchedMesh&&je.batchingColor===!1&&K._colorsTexture!==null||K.isInstancedMesh&&je.instancing===!1||!K.isInstancedMesh&&je.instancing===!0||K.isSkinnedMesh&&je.skinning===!1||!K.isSkinnedMesh&&je.skinning===!0||K.isInstancedMesh&&je.instancingColor===!0&&K.instanceColor===null||K.isInstancedMesh&&je.instancingColor===!1&&K.instanceColor!==null||K.isInstancedMesh&&je.instancingMorph===!0&&K.morphTexture===null||K.isInstancedMesh&&je.instancingMorph===!1&&K.morphTexture!==null||je.envMap!==Ke||j.fog===!0&&je.fog!==Me||je.numClippingPlanes!==void 0&&(je.numClippingPlanes!==oe.numPlanes||je.numIntersection!==oe.numIntersection)||je.vertexAlphas!==Ye||je.vertexTangents!==At||je.morphTargets!==Ze||je.morphNormals!==Ct||je.morphColors!==vn||je.morphTargetsCount!==Nn||je.numLightProbeGrids!==ys(P.state.lightProbeGridArray)?lt=!0:(je.outputColorSpace!==Ee||je.toneMapping!==nn)&&(es=!0):(lt=!0,je.__version=j.version);let Tn=je.currentProgram;(lt===!0||es===!0)&&(Tn=es===!0?ca(j,V,K,Ee,nn):Ti(j,V,K),W&&j.isNodeMaterial&&W.onUpdateProgram(j,Tn,je));let tr=!1,ts=!1,ei=!1;const It=Tn.getUniforms(),In=je.uniforms;if(Re.useProgram(Tn.program)&&(tr=!0,ts=!0,ei=!0),j.id!==Y&&(Y=j.id,ts=!0),tr||he!==L){Re.buffers.depth.getReversed()&&L.reversedDepth!==!0&&(L._reversedDepth=!0,L.updateProjectionMatrix()),It.setValue(G,"projectionMatrix",L.projectionMatrix),It.setValue(G,"viewMatrix",L.matrixWorldInverse);const Pn=It.map.cameraPosition;Pn!==void 0&&Pn.setValue(G,ht.setFromMatrixPosition(L.matrixWorld)),xt.logarithmicDepthBuffer&&It.setValue(G,"logDepthBufFC",2/(Math.log(L.far+1)/Math.LN2)),(j.isMeshPhongMaterial||j.isMeshToonMaterial||j.isMeshLambertMaterial||j.isMeshBasicMaterial||j.isMeshStandardMaterial||j.isShaderMaterial)&&It.setValue(G,"isOrthographic",L.isOrthographicCamera===!0),he!==L&&(he=L,ts=!0,ei=!0)}if(je.needsLights&&(Jt.state.sunShadowMap.length>0&&It.setValue(G,"sunShadowMap",Jt.state.sunShadowMap,ot),Jt.state.directionalShadowMap.length>0&&It.setValue(G,"directionalShadowMap",Jt.state.directionalShadowMap,ot),Jt.state.spotShadowMap.length>0&&It.setValue(G,"spotShadowMap",Jt.state.spotShadowMap,ot),Jt.state.pointShadowMap.length>0&&It.setValue(G,"pointShadowMap",Jt.state.pointShadowMap,ot)),K.isSkinnedMesh){It.setOptional(G,K,"bindMatrix"),It.setOptional(G,K,"bindMatrixInverse");const ln=K.skeleton;ln&&(ln.boneTexture===null&&ln.computeBoneTexture(),It.setValue(G,"boneTexture",ln.boneTexture,ot))}K.isBatchedMesh&&(It.setOptional(G,K,"batchingTexture"),It.setValue(G,"batchingTexture",K._matricesTexture,ot),It.setOptional(G,K,"batchingIdTexture"),It.setValue(G,"batchingIdTexture",K._indirectTexture,ot),It.setOptional(G,K,"batchingColorTexture"),K._colorsTexture!==null&&It.setValue(G,"batchingColorTexture",K._colorsTexture,ot));const xi=te.morphAttributes;if((xi.position!==void 0||xi.normal!==void 0||xi.color!==void 0)&&le.update(K,te,Tn),(ts||je.receiveShadow!==K.receiveShadow)&&(je.receiveShadow=K.receiveShadow,It.setValue(G,"receiveShadow",K.receiveShadow)),(j.isMeshStandardMaterial||j.isMeshLambertMaterial||j.isMeshPhongMaterial)&&j.envMap===null&&V.environment!==null&&(In.envMapIntensity.value=V.environmentIntensity),In.dfgLUT!==void 0&&(In.dfgLUT.value=kC()),ts){if(It.setValue(G,"toneMappingExposure",D.toneMappingExposure),je.needsLights&&cu(In,ei),Me&&j.fog===!0&&Ae.refreshFogUniforms(In,Me),Ae.refreshMaterialUniforms(In,j,Ce,et,P.state.transmissionRenderTarget[L.id]),je.needsLights&&je.numLightProbeGrids>0){const ln=E;let Pn=0;for(const ns of P.state.lightProbeGridArray)ns.texture!==null&&(ln.textures[Pn]=ns.texture,ln.min[Pn]=ns.boundingBox.min,ln.max[Pn]=ns.boundingBox.max,ln.resolution[Pn]=ns.resolution,Pn++);for(const ns in ln)ln[ns].length=Pn;In.probesSH.value=ln.textures,In.probesMin.value=ln.min,In.probesMax.value=ln.max,In.probesResolution.value=ln.resolution}nf.upload(G,io(je),In,ot)}if(j.isShaderMaterial&&j.uniformsNeedUpdate===!0&&(nf.upload(G,io(je),In,ot),j.uniformsNeedUpdate=!1),j.isSpriteMaterial&&It.setValue(G,"center",K.center),It.setValue(G,"modelViewMatrix",K.modelViewMatrix),It.setValue(G,"normalMatrix",K.normalMatrix),It.setValue(G,"modelMatrix",K.matrixWorld),j.uniformsGroups!==void 0){const ln=j.uniformsGroups;for(let Pn=0,ns=ln.length;Pn<ns;Pn++){const Al=ln[Pn];Qe.update(Al,Tn),Qe.bind(Al,Tn)}}return Tn}function cu(L,V){L.ambientLightColor.needsUpdate=V,L.lightProbe.needsUpdate=V,L.sunLights.needsUpdate=V,L.sunLightShadows.needsUpdate=V,L.directionalLights.needsUpdate=V,L.directionalLightShadows.needsUpdate=V,L.pointLights.needsUpdate=V,L.pointLightShadows.needsUpdate=V,L.spotLights.needsUpdate=V,L.spotLightShadows.needsUpdate=V,L.rectAreaLights.needsUpdate=V,L.hemisphereLights.needsUpdate=V}function uu(L){return L.isMeshLambertMaterial||L.isMeshToonMaterial||L.isMeshPhongMaterial||L.isMeshStandardMaterial||L.isShadowMaterial||L.isShaderMaterial&&L.lights===!0}this.getActiveCubeFace=function(){return Q},this.getActiveMipmapLevel=function(){return q},this.getRenderTarget=function(){return fe},this.setRenderTargetTextures=function(L,V,te){const j=st.get(L);j.__autoAllocateDepthBuffer=L.resolveDepthBuffer===!1,j.__autoAllocateDepthBuffer===!1&&(j.__useRenderToTexture=!1),st.get(L.texture).__webglTexture=V,st.get(L.depthTexture).__webglTexture=j.__autoAllocateDepthBuffer?void 0:te,j.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(L,V){const te=st.get(L);te.__webglFramebuffer=V,te.__useDefaultFramebuffer=V===void 0},this.setRenderTarget=function(L,V=0,te=0){fe=L,Q=V,q=te;let j=null,K=!1,Me=!1;if(L){const Ee=st.get(L);if(Ee.__useDefaultFramebuffer!==void 0){Re.bindFramebuffer(G.FRAMEBUFFER,Ee.__webglFramebuffer),pe.copy(L.viewport),We.copy(L.scissor),qe=L.scissorTest,Re.viewport(pe),Re.scissor(We),Re.setScissorTest(qe),Y=-1;return}else if(Ee.__webglFramebuffer===void 0)ot.setupRenderTarget(L);else if(Ee.__hasExternalTextures)ot.rebindTextures(L,st.get(L.texture).__webglTexture,st.get(L.depthTexture).__webglTexture);else if(L.depthBuffer){const Ye=L.depthTexture;if(Ee.__boundDepthTexture!==Ye){if(Ye!==null&&st.has(Ye)&&(L.width!==Ye.image.width||L.height!==Ye.image.height))throw new Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");ot.setupDepthRenderbuffer(L)}}const ze=L.texture;(ze.isData3DTexture||ze.isDataArrayTexture||ze.isCompressedArrayTexture)&&(Me=!0);const Ke=st.get(L).__webglFramebuffer;L.isWebGLCubeRenderTarget?(Array.isArray(Ke[V])?j=Ke[V][te]:j=Ke[V],K=!0):L.samples>0&&ot.useMultisampledRTT(L)===!1?j=st.get(L).__webglMultisampledFramebuffer:Array.isArray(Ke)?j=Ke[te]:j=Ke,pe.copy(L.viewport),We.copy(L.scissor),qe=L.scissorTest}else pe.copy(at).multiplyScalar(Ce).floor(),We.copy(yt).multiplyScalar(Ce).floor(),qe=pt;if(te!==0&&(j=Z),Re.bindFramebuffer(G.FRAMEBUFFER,j)&&Re.drawBuffers(L,j),Re.viewport(pe),Re.scissor(We),Re.setScissorTest(qe),K){const Ee=st.get(L.texture);G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_CUBE_MAP_POSITIVE_X+V,Ee.__webglTexture,te)}else if(Me){const Ee=V;for(let ze=0;ze<L.textures.length;ze++){const Ke=st.get(L.textures[ze]);G.framebufferTextureLayer(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0+ze,Ke.__webglTexture,te,Ee)}}else if(L!==null&&te!==0){const Ee=st.get(L.texture);G.framebufferTexture2D(G.FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,Ee.__webglTexture,te)}Y=-1};function El(L){const V=st.get(L);return(V.__readFormat!==L.format||V.__readType!==L.type)&&(V.__readFormat=L.format,V.__readType=L.type,V.__formatReadable=xt.textureFormatReadable(L.format),V.__typeReadable=xt.textureTypeReadable(L.type)),V}this.readRenderTargetPixels=function(L,V,te,j,K,Me,Oe,Ee=0){if(!(L&&L.isWebGLRenderTarget)){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ze=st.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&Oe!==void 0&&(ze=ze[Oe],Array.isArray(ze)&&(ze=ze[0])),ze){Re.bindFramebuffer(G.FRAMEBUFFER,ze);try{const Ke=L.textures[Ee],Ye=Ke.format,At=Ke.type;L.textures.length>1&&G.readBuffer(G.COLOR_ATTACHMENT0+Ee);const Ze=El(Ke);if(Ze.__formatReadable===!1){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(Ze.__typeReadable===!1){it("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}V>=0&&V<=L.width-j&&te>=0&&te<=L.height-K&&G.readPixels(V,te,j,K,be.convert(Ye),be.convert(At),Me)}finally{const Ke=fe!==null?st.get(fe).__webglFramebuffer:null;Re.bindFramebuffer(G.FRAMEBUFFER,Ke)}}},this.readRenderTargetPixelsAsync=async function(L,V,te,j,K,Me,Oe,Ee=0){if(!(L&&L.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ze=st.get(L).__webglFramebuffer;if(L.isWebGLCubeRenderTarget&&Oe!==void 0&&(ze=ze[Oe],Array.isArray(ze)&&(ze=ze[0])),ze)if(V>=0&&V<=L.width-j&&te>=0&&te<=L.height-K){Re.bindFramebuffer(G.FRAMEBUFFER,ze);const Ke=L.textures[Ee],Ye=Ke.format,At=Ke.type;L.textures.length>1&&G.readBuffer(G.COLOR_ATTACHMENT0+Ee);const Ze=El(Ke);if(Ze.__formatReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(Ze.__typeReadable===!1)throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Ct=G.createBuffer();G.bindBuffer(G.PIXEL_PACK_BUFFER,Ct),G.bufferData(G.PIXEL_PACK_BUFFER,Me.byteLength,G.STREAM_READ),G.readPixels(V,te,j,K,be.convert(Ye),be.convert(At),0),G.bindBuffer(G.PIXEL_PACK_BUFFER,null);const vn=fe!==null?st.get(fe).__webglFramebuffer:null;Re.bindFramebuffer(G.FRAMEBUFFER,vn);const nn=G.fenceSync(G.SYNC_GPU_COMMANDS_COMPLETE,0);return G.flush(),await Yw(G,nn,4),G.bindBuffer(G.PIXEL_PACK_BUFFER,Ct),G.getBufferSubData(G.PIXEL_PACK_BUFFER,0,Me),G.bindBuffer(G.PIXEL_PACK_BUFFER,null),G.deleteBuffer(Ct),G.deleteSync(nn),Me}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(L,V=null,te=0){const j=Math.pow(2,-te),K=Math.floor(L.image.width*j),Me=Math.floor(L.image.height*j),Oe=V!==null?V.x:0,Ee=V!==null?V.y:0;ot.setTexture2D(L,0),G.copyTexSubImage2D(G.TEXTURE_2D,te,0,0,Oe,Ee,K,Me),Re.unbindTexture()},this.copyTextureToTexture=function(L,V,te=null,j=null,K=0,Me=0){let Oe,Ee,ze,Ke,Ye,At,Ze,Ct,vn;const nn=L.isCompressedTexture?L.mipmaps[Me]:L.image;if(te!==null)Oe=te.max.x-te.min.x,Ee=te.max.y-te.min.y,ze=te.isBox3?te.max.z-te.min.z:1,Ke=te.min.x,Ye=te.min.y,At=te.isBox3?te.min.z:0;else{const It=Math.pow(2,-K);Oe=Math.floor(nn.width*It),Ee=Math.floor(nn.height*It),L.isDataArrayTexture?ze=nn.depth:L.isData3DTexture?ze=Math.floor(nn.depth*It):ze=1,Ke=0,Ye=0,At=0}j!==null?(Ze=j.x,Ct=j.y,vn=j.z):(Ze=0,Ct=0,vn=0);const jt=be.convert(V.format),Nn=be.convert(V.type);let je;V.isData3DTexture?(ot.setTexture3D(V,0),je=G.TEXTURE_3D):V.isDataArrayTexture||V.isCompressedArrayTexture?(ot.setTexture2DArray(V,0),je=G.TEXTURE_2D_ARRAY):(ot.setTexture2D(V,0),je=G.TEXTURE_2D),Re.activeTexture(G.TEXTURE0),Re.pixelStorei(G.UNPACK_FLIP_Y_WEBGL,V.flipY),Re.pixelStorei(G.UNPACK_PREMULTIPLY_ALPHA_WEBGL,V.premultiplyAlpha),Re.pixelStorei(G.UNPACK_ALIGNMENT,V.unpackAlignment);const Jt=Re.getParameter(G.UNPACK_ROW_LENGTH),lt=Re.getParameter(G.UNPACK_IMAGE_HEIGHT),es=Re.getParameter(G.UNPACK_SKIP_PIXELS),Tn=Re.getParameter(G.UNPACK_SKIP_ROWS),tr=Re.getParameter(G.UNPACK_SKIP_IMAGES);Re.pixelStorei(G.UNPACK_ROW_LENGTH,nn.width),Re.pixelStorei(G.UNPACK_IMAGE_HEIGHT,nn.height),Re.pixelStorei(G.UNPACK_SKIP_PIXELS,Ke),Re.pixelStorei(G.UNPACK_SKIP_ROWS,Ye),Re.pixelStorei(G.UNPACK_SKIP_IMAGES,At);const ts=L.isDataArrayTexture||L.isData3DTexture,ei=V.isDataArrayTexture||V.isData3DTexture;if(L.isDepthTexture){const It=st.get(L),In=st.get(V),xi=st.get(It.__renderTarget),ln=st.get(In.__renderTarget);Re.bindFramebuffer(G.READ_FRAMEBUFFER,xi.__webglFramebuffer),Re.bindFramebuffer(G.DRAW_FRAMEBUFFER,ln.__webglFramebuffer);for(let Pn=0;Pn<ze;Pn++)ts&&(G.framebufferTextureLayer(G.READ_FRAMEBUFFER,G.COLOR_ATTACHMENT0,st.get(L).__webglTexture,K,At+Pn),G.framebufferTextureLayer(G.DRAW_FRAMEBUFFER,G.COLOR_ATTACHMENT0,st.get(V).__webglTexture,Me,vn+Pn)),G.blitFramebuffer(Ke,Ye,Ke+Oe,Ye+Ee,Ze,Ct,Ze+Oe,Ct+Ee,G.DEPTH_BUFFER_BIT,G.NEAREST);Re.bindFramebuffer(G.READ_FRAMEBUFFER,null),Re.bindFramebuffer(G.DRAW_FRAMEBUFFER,null)}else if(K!==0||L.isRenderTargetTexture||st.has(L)){const It=st.get(L),In=st.get(V);Re.bindFramebuffer(G.READ_FRAMEBUFFER,z),Re.bindFramebuffer(G.DRAW_FRAMEBUFFER,X);for(let xi=0;xi<ze;xi++)ts?G.framebufferTextureLayer(G.READ_FRAMEBUFFER,G.COLOR_ATTACHMENT0,It.__webglTexture,K,At+xi):G.framebufferTexture2D(G.READ_FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,It.__webglTexture,K),ei?G.framebufferTextureLayer(G.DRAW_FRAMEBUFFER,G.COLOR_ATTACHMENT0,In.__webglTexture,Me,vn+xi):G.framebufferTexture2D(G.DRAW_FRAMEBUFFER,G.COLOR_ATTACHMENT0,G.TEXTURE_2D,In.__webglTexture,Me),K!==0?G.blitFramebuffer(Ke,Ye,Ke+Oe,Ye+Ee,Ze,Ct,Ze+Oe,Ct+Ee,G.COLOR_BUFFER_BIT,G.NEAREST):ei?G.copyTexSubImage3D(je,Me,Ze,Ct,vn+xi,Ke,Ye,Oe,Ee):G.copyTexSubImage2D(je,Me,Ze,Ct,Ke,Ye,Oe,Ee);Re.bindFramebuffer(G.READ_FRAMEBUFFER,null),Re.bindFramebuffer(G.DRAW_FRAMEBUFFER,null)}else ei?L.isDataTexture||L.isData3DTexture?G.texSubImage3D(je,Me,Ze,Ct,vn,Oe,Ee,ze,jt,Nn,nn.data):V.isCompressedArrayTexture?G.compressedTexSubImage3D(je,Me,Ze,Ct,vn,Oe,Ee,ze,jt,nn.data):G.texSubImage3D(je,Me,Ze,Ct,vn,Oe,Ee,ze,jt,Nn,nn):L.isDataTexture?G.texSubImage2D(G.TEXTURE_2D,Me,Ze,Ct,Oe,Ee,jt,Nn,nn.data):L.isCompressedTexture?G.compressedTexSubImage2D(G.TEXTURE_2D,Me,Ze,Ct,nn.width,nn.height,jt,nn.data):G.texSubImage2D(G.TEXTURE_2D,Me,Ze,Ct,Oe,Ee,jt,Nn,nn);Re.pixelStorei(G.UNPACK_ROW_LENGTH,Jt),Re.pixelStorei(G.UNPACK_IMAGE_HEIGHT,lt),Re.pixelStorei(G.UNPACK_SKIP_PIXELS,es),Re.pixelStorei(G.UNPACK_SKIP_ROWS,Tn),Re.pixelStorei(G.UNPACK_SKIP_IMAGES,tr),Me===0&&V.generateMipmaps===!0&&V.mipmapsAutoUpdate===!0&&G.generateMipmap(je),Re.unbindTexture()},this.initRenderTarget=function(L){st.get(L).__webglFramebuffer===void 0&&ot.setupRenderTarget(L)},this.initTexture=function(L){L.isCubeTexture?ot.setTextureCube(L,0):L.isData3DTexture?ot.setTexture3D(L,0):L.isDataArrayTexture||L.isCompressedArrayTexture?ot.setTexture2DArray(L,0):ot.setTexture2D(L,0),Re.unbindTexture()},this.resetState=function(){Q=0,q=0,fe=null,Re.reset(),Te.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ki}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=Lt._getDrawingBufferColorSpace(e),t.unpackColorSpace=Lt._getUnpackColorSpace()}}const HC=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:td,AddEquation:Fa,AddOperation:l3,AdditiveAnimationBlendMode:tg,AdditiveBlending:xm,AgXToneMapping:qm,AlphaFormat:Qm,AlwaysCompare:sg,AlwaysDepth:Ic,AlwaysStencilFunc:p3,AmbientLight:dS,AnimationAction:bS,AnimationClip:Xc,AnimationLoader:VE,AnimationMixer:_5,AnimationObjectGroup:g5,AnimationUtils:FE,ArcCurve:F3,ArrayCamera:_S,ArrowHelper:H5,AttachedBindMode:bm,Audio:yS,AudioAnalyser:a5,AudioContext:Ig,AudioListener:i5,AudioLoader:QE,AxesHelper:V5,BackSide:Vn,BasicDepthPacking:ia,BasicShadowMap:Vy,BatchedMesh:P3,BezierInterpolant:rS,Bone:ug,BooleanKeyframeTrack:Qa,Box2:TS,Box3:gi,Box3Helper:z5,BoxGeometry:Ka,BoxHelper:B5,BufferAttribute:on,BufferGeometry:bt,BufferGeometryLoader:vS,ByteType:Zm,Cache:Ks,Camera:Ud,CameraHelper:O5,CanvasTexture:tE,CapsuleGeometry:xd,CatmullRomCurve3:O3,CineonToneMapping:Wm,CircleGeometry:yd,ClampToEdgeWrapping:Fi,Clock:wS,Color:Ge,ColorKeyframeTrack:Eg,ColorManagement:Lt,Compatibility:Vw,CompressedArrayTexture:QT,CompressedCubeTexture:eE,CompressedTexture:_d,CompressedTextureLoader:GE,ConeGeometry:nu,ConstantAlphaFactor:r3,ConstantColorFactor:i3,Controls:W5,CubeCamera:qf,CubeDepthTexture:fg,CubeReflectionMapping:br,CubeRefractionMapping:qa,CubeTexture:eu,CubeTextureLoader:WE,CubicBezierCurve:mg,CubicBezierCurve3:B3,CubicInterpolant:iS,CullFaceBack:_m,CullFaceFront:Hy,CullFaceFrontBack:ew,CullFaceNone:ky,Curve:Ds,CurvePath:k3,CustomBlending:Gy,CustomToneMapping:Xm,CylinderGeometry:tu,Cylindrical:T5,Data3DTexture:dd,DataArrayTexture:fd,DataTexture:fs,DataTextureLoader:XE,DataUtils:TT,DecrementStencilOp:xw,DecrementWrapStencilOp:Sw,DefaultLoadingManager:lS,DepthFormat:Mr,DepthStencilFormat:js,DepthTexture:Qs,DetachedBindMode:c3,DirectionalLight:fS,DirectionalLightHelper:F5,DiscreteInterpolant:sS,DodecahedronGeometry:Sd,DoubleSide:Di,DstAlphaFactor:Ky,DstColorFactor:e3,DynamicCopyUsage:Fw,DynamicDrawUsage:Iw,DynamicReadUsage:Nw,EdgesGeometry:U3,EllipseCurve:bd,EqualCompare:v3,EqualDepth:of,EqualStencilFunc:Tw,EquirectangularReflectionMapping:vc,EquirectangularRefractionMapping:_c,Euler:Ns,EventDispatcher:Bi,ExternalTexture:dg,ExtrudeGeometry:Md,FileLoader:Er,Float16BufferAttribute:LT,Float32BufferAttribute:Je,FloatType:oi,Fog:md,FogExp2:pd,FramebufferTexture:KT,FrontSide:Sr,Frustum:Za,FrustumArray:Qc,GLBufferAttribute:M5,GLSL1:Bw,GLSL3:wm,GreaterCompare:_3,GreaterDepth:cf,GreaterEqualCompare:ig,GreaterEqualDepth:lf,GreaterEqualStencilFunc:Rw,GreaterStencilFunc:Aw,GridHelper:D5,Group:sl,HTMLTexture:nE,HalfFloatType:ps,HemisphereLight:cS,HemisphereLightHelper:N5,IcosahedronGeometry:wd,ImageBitmapLoader:KE,ImageLoader:qc,ImageUtils:w3,IncrementStencilOp:_w,IncrementWrapStencilOp:yw,InstancedBufferAttribute:ml,InstancedBufferGeometry:gS,InstancedInterleavedBuffer:b5,InstancedMesh:I3,Int16BufferAttribute:IT,Int32BufferAttribute:PT,Int8BufferAttribute:AT,IntType:id,InterleavedBuffer:gd,InterleavedBufferAttribute:Ya,Interpolant:Sl,InterpolateBezier:Mm,InterpolateDiscrete:Uc,InterpolateLinear:Hf,InterpolateSmooth:Qh,InterpolationSamplingMode:Hw,InterpolationSamplingType:kw,InvertStencilOp:bw,KeepStencilOp:ef,KeyframeTrack:gs,LOD:C3,LatheGeometry:Td,Layers:pl,LessCompare:g3,LessDepth:af,LessEqualCompare:ng,LessEqualDepth:hl,LessEqualStencilFunc:Ew,LessStencilFunc:ww,Light:ra,LightProbe:mS,LightShadow:Dd,Line:Tr,Line3:C5,LineBasicMaterial:vi,LineCurve:gg,LineCurve3:z3,LineDashedMaterial:eS,LineLoop:L3,LineSegments:er,LinearFilter:an,LinearInterpolant:Tg,LinearMipMapLinearFilter:rw,LinearMipMapNearestFilter:sw,LinearMipmapLinearFilter:Ps,LinearMipmapNearestFilter:xc,LinearSRGBColorSpace:ta,LinearToneMapping:Vm,LinearTransfer:Oc,Loader:zi,LoaderUtils:Rm,LoadingManager:Cg,LoopOnce:u3,LoopPingPong:f3,LoopRepeat:h3,MOUSE:K4,Material:Gn,MaterialBlending:tw,MaterialLoader:Fd,MathUtils:Vf,Matrix2:Pm,Matrix3:_t,Matrix4:gt,MaxEquation:$y,Mesh:Wn,MeshBasicMaterial:Ja,MeshDepthMaterial:Mg,MeshDistanceMaterial:wg,MeshLambertMaterial:K3,MeshMatcapMaterial:Q3,MeshNormalMaterial:bg,MeshPhongMaterial:j3,MeshPhysicalMaterial:Z3,MeshStandardMaterial:Sg,MeshToonMaterial:J3,MinEquation:qy,MirroredRepeatWrapping:Lc,MixOperation:o3,MultiplyBlending:Sm,MultiplyOperation:Jc,NearestFilter:dn,NearestMipMapLinearFilter:iw,NearestMipMapNearestFilter:nw,NearestMipmapLinearFilter:nl,NearestMipmapNearestFilter:Ym,NeutralToneMapping:$m,NeverCompare:m3,NeverDepth:rf,NeverStencilFunc:Mw,NoBlending:Oi,NoColorSpace:Is,NoNormalPacking:dw,NoToneMapping:Qi,NormalAnimationBlendMode:cd,NormalBlending:ll,NormalGAPacking:mw,NormalRGPacking:pw,NotEqualCompare:x3,NotEqualDepth:uf,NotEqualStencilFunc:Cw,NumberKeyframeTrack:Ld,Object3D:Wt,ObjectLoader:jE,ObjectSpaceNormalMap:d3,OctahedronGeometry:su,OneFactor:Zy,OneMinusConstantAlphaFactor:a3,OneMinusConstantColorFactor:s3,OneMinusDstAlphaFactor:Qy,OneMinusDstColorFactor:t3,OneMinusSrcAlphaFactor:Hm,OneMinusSrcColorFactor:Jy,OrthographicCamera:bl,PCFShadowMap:ol,PCFSoftShadowMap:gc,PMREMGenerator:$c,Path:Hc,PerspectiveCamera:Kn,Plane:gr,PlaneGeometry:yl,PlaneHelper:k5,PointLight:hS,PointLightHelper:P5,Points:N3,PointsMaterial:hg,PolarGridHelper:U5,PolyhedronGeometry:sa,PositionalAudio:r5,PropertyBinding:Gt,PropertyMixer:SS,QuadraticBezierCurve:vg,QuadraticBezierCurve3:_g,Quaternion:wi,QuaternionKeyframeTrack:Nd,QuaternionLinearInterpolant:oS,R11_EAC_Format:_f,RED_GREEN_RGTC2_Format:Dc,RED_RGTC1_Format:Bf,REVISION:_l,RG11_EAC_Format:Nc,RGBADepthPacking:uw,RGBAFormat:Mi,RGBAIntegerFormat:ld,RGBA_ASTC_10x10_Format:Lf,RGBA_ASTC_10x5_Format:Rf,RGBA_ASTC_10x6_Format:If,RGBA_ASTC_10x8_Format:Pf,RGBA_ASTC_12x10_Format:Nf,RGBA_ASTC_12x12_Format:Df,RGBA_ASTC_4x4_Format:Sf,RGBA_ASTC_5x4_Format:bf,RGBA_ASTC_5x5_Format:Mf,RGBA_ASTC_6x5_Format:wf,RGBA_ASTC_6x6_Format:Tf,RGBA_ASTC_8x5_Format:Ef,RGBA_ASTC_8x6_Format:Af,RGBA_ASTC_8x8_Format:Cf,RGBA_BPTC_Format:Uf,RGBA_ETC2_EAC_Format:vf,RGBA_PVRTC_2BPPV1_Format:pf,RGBA_PVRTC_4BPPV1_Format:df,RGBA_S3TC_DXT1_Format:Sc,RGBA_S3TC_DXT3_Format:bc,RGBA_S3TC_DXT5_Format:Mc,RGBDepthPacking:hw,RGBFormat:eg,RGBIntegerFormat:aw,RGB_BPTC_SIGNED_Format:Ff,RGB_BPTC_UNSIGNED_Format:Of,RGB_ETC1_Format:mf,RGB_ETC2_Format:gf,RGB_PVRTC_2BPPV1_Format:ff,RGB_PVRTC_4BPPV1_Format:hf,RGB_S3TC_DXT1_Format:yc,RGDepthPacking:fw,RGFormat:ea,RGIntegerFormat:od,RawShaderMaterial:yg,Ray:xl,Raycaster:MS,RectAreaLight:pS,RedFormat:ad,RedIntegerFormat:Kc,ReinhardToneMapping:Gm,RenderObjectRefreshType:Gw,RenderTarget:ag,RenderTarget3D:x5,RepeatWrapping:Pc,ReplaceStencilOp:vw,ReverseSubtractEquation:Xy,RingGeometry:Ed,SIGNED_R11_EAC_Format:xf,SIGNED_RED_GREEN_RGTC2_Format:kf,SIGNED_RED_RGTC1_Format:zf,SIGNED_RG11_EAC_Format:yf,SRGBColorSpace:Zt,SRGBTransfer:en,Scene:kc,ShaderChunk:Et,ShaderLib:Rs,ShaderMaterial:Qn,ShadowMaterial:q3,Shape:iu,ShapeGeometry:Ad,ShapePath:G5,ShapeUtils:Ls,ShortType:jm,Skeleton:vd,SkeletonHelper:I5,SkinnedMesh:R3,Source:dT,Sphere:li,SphereGeometry:ru,Spherical:w5,SphericalHarmonics3:Rg,SplineCurve:xg,SpotLight:uS,SpotLightHelper:R5,Sprite:A3,SpriteMaterial:cg,SrcAlphaFactor:km,SrcAlphaSaturateFactor:n3,SrcColorFactor:jy,StaticCopyUsage:Uw,StaticDrawUsage:ud,StaticReadUsage:Lw,StereoCamera:e5,StreamCopyUsage:Ow,StreamDrawUsage:Pw,StreamReadUsage:Dw,StringKeyframeTrack:eo,SubtractEquation:Wy,SubtractiveBlending:ym,TOUCH:Q4,TangentSpaceNormalMap:wr,TetrahedronGeometry:Cd,Texture:pn,TextureLoader:qE,TextureSource:Js,TextureUtils:Z5,Timer:xS,TimestampQuery:zw,TorusGeometry:Rd,TorusKnotGeometry:Id,Triangle:Ui,TriangleFanDrawMode:cw,TriangleStripDrawMode:lw,TrianglesDrawMode:ow,TubeGeometry:Pd,UVMapping:nd,Uint16BufferAttribute:og,Uint32BufferAttribute:lg,Uint8BufferAttribute:CT,Uint8ClampedBufferAttribute:RT,Uniform:zt,UniformsGroup:S5,UniformsLib:He,UniformsUtils:Y3,UnsignedByteType:Mn,UnsignedInt101111Type:Km,UnsignedInt248Type:Qr,UnsignedInt5999Type:Jm,UnsignedIntType:ds,UnsignedShort4444Type:sd,UnsignedShort5551Type:rd,UnsignedShortType:fl,VSMShadowMap:Ba,Vector2:ue,Vector3:O,Vector4:Kt,VectorKeyframeTrack:Ag,VideoFrameTexture:JT,VideoTexture:D3,WebGL3DRenderTarget:gT,WebGLArrayRenderTarget:mT,WebGLCoordinateSystem:Ki,WebGLCubeRenderTarget:Od,WebGLRenderTarget:gn,WebGLRenderer:zS,WebGLUtils:OS,WebGPUCoordinateSystem:$a,WebXRController:tf,WireframeGeometry:X3,WrapAroundEnding:Fc,ZeroCurvatureEnding:za,ZeroFactor:Yy,ZeroSlopeEnding:ka,ZeroStencilOp:gw,createCanvasElement:S3,error:it,getConsoleFunction:$w,log:zc,setConsoleFunction:qw,warn:Fe,warnOnce:xr},Symbol.toStringTag,{value:"Module"})),uy=i=>{let e;const t=new Set,n=(d,p)=>{const g=typeof d=="function"?d(e):d;if(!Object.is(g,e)){const v=e;e=p??(typeof g!="object"||g===null)?g:Object.assign({},e,g),t.forEach(_=>_(e,v))}},r=()=>e,c={setState:n,getState:r,getInitialState:()=>h,subscribe:d=>(t.add(d),()=>t.delete(d))},h=e=i(n,r,c);return c},VC=(i=>i?uy(i):uy),{useSyncExternalStoreWithSelector:GC}=J4,WC=i=>i;function XC(i,e=WC,t){const n=GC(i.subscribe,i.getState,i.getInitialState,e,t);return fn.useDebugValue(n),n}const hy=(i,e)=>{const t=VC(i),n=(r,o=e)=>XC(t,r,o);return Object.assign(n,t),n},qC=((i,e)=>i?hy(i,e):hy);(()=>{var i,e;return typeof window<"u"&&(((i=window.document)==null?void 0:i.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative")})()?fn.useLayoutEffect:fn.useEffect;function kd(i,e,t){if(!i)return;if(t(i)===!0)return i;let n=e?i.return:i.child;for(;n;){const r=kd(n,e,t);if(r)return r;n=e?null:n.sibling}}function kS(i){try{return Object.defineProperties(i,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return i}}const Ng=kS(fn.createContext(null));class HS extends fn.Component{render(){return fn.createElement(Ng.Provider,{value:this._reactInternals},this.props.children)}}function Dg(){const i=fn.useContext(Ng);if(i===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=fn.useId();return fn.useMemo(()=>{for(const t of[i,i==null?void 0:i.alternate]){if(!t)continue;const n=kd(t,!1,r=>{let o=r.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(n)return n}},[i,e])}const $C=Symbol.for("react.context"),YC=i=>i!==null&&typeof i=="object"&&"$$typeof"in i&&i.$$typeof===$C;function ZC(){const i=Dg(),[e]=fn.useState(()=>new Map);e.clear();let t=i;for(;t;){const n=t.type;YC(n)&&n!==Ng&&!e.has(n)&&e.set(n,fn.use(kS(n))),t=t.return}return e}function jC(){const i=ZC();return fn.useMemo(()=>Array.from(i.keys()).reduce((e,t)=>n=>fn.createElement(e,null,fn.createElement(t.Provider,{...n,value:i.get(t)})),e=>fn.createElement(HS,{...e})),[i])}function JC(i){if(typeof requestAnimationFrame=="function"){const t=requestAnimationFrame(i);return()=>cancelAnimationFrame(t)}const e=setTimeout(i,16);return()=>clearTimeout(e)}function KC(){if(!fn.Activity)throw new Error("its-fine: useActivityBridge requires React 19.2 or later!");const i=Dg(),[e]=fn.useState(()=>{const t=[];let n=!1;kd(i,!0,h=>{var d,p;if(h.elementType===fn.Activity){const g=((d=h.child)==null?void 0:d.tag)===22?h.child.stateNode:null;if(typeof(g==null?void 0:g._visibility)!="number")throw new Error("its-fine: unsupported React Activity internals!");t.push(g)}else h.tag===22&&((p=h.return)==null?void 0:p.elementType)!==fn.Activity&&(n=!0)});let r="hidden";const o=new Set;let l;const c={mounted:!1,connected:!1,subscribe(h){return o.add(h),()=>{o.delete(h)}},sync(h){c.mounted&&!c.connected&&n&&t.length>0?l||(l=JC(()=>{l=void 0,c.sync(!0)})):(l==null||l(),l=void 0);let d=r;if(c.mounted?c.connected?d="visible":h&&(d=t.every(p=>(p._visibility&1)!==0)?"visible":"hidden"):d="hidden",r!==d){r=d;for(const p of o)p()}},Bridge({children:h}){return fn.createElement(fn.Activity,{mode:fn.useSyncExternalStore(c.subscribe,()=>r,()=>"hidden")},h)}};return c});return fn.useInsertionEffect(()=>(e.mounted=!0,queueMicrotask(()=>e.sync(!1)),()=>{e.mounted=!1,queueMicrotask(()=>e.sync(!1))}),[e]),fn.useLayoutEffect(()=>(e.connected=!0,e.sync(!1),()=>{e.connected=!1,e.sync(!0)}),[e]),e.Bridge}var vr=Z4();const QC=j4(vr),wl=((i,e)=>typeof window<"u"&&(((i=window.document)==null?void 0:i.createElement)||((e=window.navigator)==null?void 0:e.product)==="ReactNative"))()?Ve.useLayoutEffect:Ve.useEffect;function VS(i){const e=Ve.useRef(i);return wl(()=>void(e.current=i),[i]),e}function eR({promise:i,onSettled:e}){return Ve.use(i),wl(e,[e]),null}function tR(){const[i,e]=Ve.useState(null),t=Ve.useCallback(()=>e(null),[]),n=Ve.useCallback(o=>e(l=>l??Promise.resolve(o).then(()=>{},()=>{})),[]);return[i?nt.jsx(Ve.Suspense,{fallback:null,children:nt.jsx(eR,{promise:i,onSettled:t})}):null,n]}const nR=Ve.Activity?KC:()=>Ve.Fragment;function iR(){const i=Dg(),e=jC(),t=nR();return Ve.useMemo(()=>({children:n})=>{const o=!!kd(i,!0,l=>l.type===Ve.StrictMode)?Ve.StrictMode:Ve.Fragment;return nt.jsx(o,{children:nt.jsx(t,{children:nt.jsx(e,{children:n})})})},[i,e,t])}function sR({set:i}){return wl(()=>(i(new Promise(()=>null)),()=>i(!1)),[i]),null}const rR=(i=>(i=class extends Ve.Component{constructor(...t){super(...t),this.state={error:!1}}componentDidCatch(t){this.props.set(t)}render(){return this.state.error?null:this.props.children}},i.getDerivedStateFromError=()=>({error:!0}),i))();function Ug(i){let e=i.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const GS=i=>i&&i.isOrthographicCamera,aR=i=>i&&i.hasOwnProperty("current"),oR=i=>i!=null&&(typeof i=="string"||typeof i=="number"||i.isColor),fy=()=>{};function Fg(i){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(i)?Math.min(Math.max(i[0],t),i[1]):i}function lR(i){if(typeof window>"u"||typeof window.matchMedia!="function"||!window.devicePixelRatio)return()=>{};let e;const t=()=>{try{var o,l;e=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),typeof((o=e)==null?void 0:o.addEventListener)=="function"?e.addEventListener("change",r):(l=e)==null||l.addListener==null||l.addListener(r)}catch{e=void 0}},n=()=>{var o,l;typeof((o=e)==null?void 0:o.removeEventListener)=="function"?e.removeEventListener("change",r):(l=e)==null||l.removeListener==null||l.removeListener(r),e=void 0},r=()=>{n(),t(),i()};return t(),n}function el(i){var e;return(e=i.__r3f)==null?void 0:e.root.getState()}const zn={obj:i=>i===Object(i)&&!zn.arr(i)&&typeof i!="function",fun:i=>typeof i=="function",str:i=>typeof i=="string",num:i=>typeof i=="number",boo:i=>typeof i=="boolean",und:i=>i===void 0,nul:i=>i===null,arr:i=>Array.isArray(i),equ(i,e,{arrays:t="shallow",objects:n="reference",strict:r=!0}={}){if(typeof i!=typeof e||!!i!=!!e)return!1;if(zn.str(i)||zn.num(i)||zn.boo(i))return i===e;const o=zn.obj(i);if(o&&n==="reference")return i===e;const l=zn.arr(i);if(l&&t==="reference")return i===e;if((l||o)&&i===e)return!0;let c;for(c in i)if(!(c in e))return!1;if(o&&t==="shallow"&&n==="shallow"){for(c in r?e:i)if(!zn.equ(i[c],e[c],{strict:r,objects:"reference"}))return!1}else for(c in r?e:i)if(i[c]!==e[c])return!1;if(zn.und(c)){if(l&&i.length===0&&e.length===0||o&&Object.keys(i).length===0&&Object.keys(e).length===0)return!0;if(i!==e)return!1}return!0}};function cR(i){i.type!=="Scene"&&(i.dispose==null||i.dispose());for(const e in i){const t=i[e];(t==null?void 0:t.type)!=="Scene"&&(t==null||t.dispose==null||t.dispose())}}const WS=["children","key","ref"];function Dm(i){const e={};for(const t in i)WS.includes(t)||(e[t]=i[t]);return e}function $f(i,e,t,n){const r=i;let o=r==null?void 0:r.__r3f;return o||(o={root:e,type:t,parent:null,children:[],props:Dm(n),object:r,eventCount:0,handlers:{},previousVisible:void 0,isHidden:!1},r&&(r.__r3f=o)),o}function Yc(i,e){if(!e.includes("-"))return{root:i,key:e,target:i[e]};if(e in i)return{root:i,key:e,target:i[e]};let t=i;const n=e.split("-");for(const r of n){if(typeof t!="object"||t===null){if(t!==void 0){const o=n.slice(n.indexOf(r)).join("-");return{root:t,key:o,target:void 0}}return{root:i,key:e,target:void 0}}e=r,i=t,t=t[e]}return{root:i,key:e,target:t}}const dy=/-\d+$/;function Yf(i,e){if(zn.str(e.props.attach)){if(dy.test(e.props.attach)){const r=e.props.attach.replace(dy,""),{root:o,key:l}=Yc(i.object,r);Array.isArray(o[l])||(o[l]=[])}const{root:t,key:n}=Yc(i.object,e.props.attach);e.previousAttach=t[n],t[n]=e.object}else zn.fun(e.props.attach)&&(e.previousAttach=e.props.attach(i.object,e.object))}function Zf(i,e){if(zn.str(e.props.attach)){const{root:t,key:n}=Yc(i.object,e.props.attach),r=e.previousAttach;r===void 0?delete t[n]:t[n]=r}else e.previousAttach==null||e.previousAttach(i.object,e.object);delete e.previousAttach}const Um=[...WS,"args","dispose","attach","object","onUpdate","dispose"],py=new Map;function uR(i){let e=py.get(i.constructor);try{e||(e=new i.constructor,py.set(i.constructor,e))}catch{}return e}function hR(i,e){const t={};for(const n in e)if(!Um.includes(n)&&!zn.equ(e[n],i.props[n])){t[n]=e[n];for(const r in e)r.startsWith(`${n}-`)&&(t[r]=e[r])}for(const n in i.props){if(Um.includes(n)||e.hasOwnProperty(n))continue;const{root:r,key:o}=Yc(i.object,n);if(r.constructor&&r.constructor.length===0){const l=uR(r);zn.und(l)||(t[n]=l[o])}else t[n]=0}return t}const fR=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],dR=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function Va(i,e){var t;const n=i.__r3f,r=n&&Ug(n).getState(),o=n==null?void 0:n.eventCount;for(const c in e){let h=e[c];if(Um.includes(c))continue;if(n&&dR.test(c)){typeof h=="function"?n.handlers[c]=h:delete n.handlers[c],n.eventCount=Object.keys(n.handlers).length;continue}if(h===void 0)continue;if(c==="visible"&&n!=null&&n.isHidden&&n.previousVisible!==void 0){n.previousVisible=h;continue}let{root:d,key:p,target:g}=Yc(i,c);if(g===void 0&&(typeof d!="object"||d===null))throw Error(`R3F: Cannot set "${c}". Ensure it is an object before setting "${p}".`);if(g instanceof pl&&h instanceof pl)g.mask=h.mask;else if(g instanceof Ge&&oR(h))g.set(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof g.copy=="function"&&h!=null&&h.constructor&&g.constructor===h.constructor)g.copy(h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&Array.isArray(h))typeof g.fromArray=="function"?g.fromArray(h):g.set(...h);else if(g!==null&&typeof g=="object"&&typeof g.set=="function"&&typeof h=="number")typeof g.setScalar=="function"?g.setScalar(h):g.set(h);else if(d instanceof Qn&&p==="uniforms"&&zn.obj(h)){zn.obj(d.uniforms)||(d.uniforms={});const v=d.uniforms,_=h;for(const y in _){const w=_[y],b=v[y];b?Object.assign(b,w):v[y]={...w}}}else{var l;d[p]=h,r&&!r.linear&&fR.includes(p)&&(l=d[p])!=null&&l.isTexture&&d[p].format===Mi&&d[p].type===Mn&&(d[p].colorSpace=Zt)}}if(n!=null&&n.parent&&r!=null&&r.internal&&(t=n.object)!=null&&t.isObject3D&&o!==n.eventCount){const c=n.object,h=r.internal.interaction.indexOf(c);h>-1&&r.internal.interaction.splice(h,1),n.eventCount&&c.raycast!==null&&r.internal.interaction.push(c)}return n&&n.props.attach===void 0&&(n.object.isBufferGeometry?n.props.attach="geometry":n.object.isMaterial&&(n.props.attach="material")),n&&ou(n),i}function ou(i){var e;if(!i.parent)return;i.props.onUpdate==null||i.props.onUpdate(i.object);const t=(e=i.root)==null||e.getState==null?void 0:e.getState();t&&t.internal.frames===0&&t.invalidate()}function pR(i,e){i.manual||(GS(i)?(i.left=e.width/-2,i.right=e.width/2,i.top=e.height/2,i.bottom=e.height/-2):i.aspect=e.width/e.height,i.updateProjectionMatrix())}const Ni=i=>i==null?void 0:i.isObject3D;function pc(i){return(i.eventObject||i.object).uuid+"/"+i.index+i.instanceId}function XS(i,e,t,n){const r=t.get(e);r&&(t.delete(e),t.size===0&&(i.delete(n),r.target.releasePointerCapture(n)))}function mR(i,e,t){const{internal:n}=i.getState();for(let r=0;r<n.interaction.length;r++)n.interaction[r]===e&&(n.interaction[r]=t);for(let r=0;r<n.initialHits.length;r++)n.initialHits[r]===e&&(n.initialHits[r]=t);n.hovered.forEach((r,o)=>{if(r.eventObject===e||r.object===e){n.hovered.delete(o);const l={...r,eventObject:r.eventObject===e?t:r.eventObject,object:r.object===e?t:r.object};n.hovered.set(pc(l),l)}}),n.capturedMap.forEach(r=>{for(const[o,l]of Array.from(r)){const{intersection:c}=l;o!==e&&c.object!==e&&c.eventObject!==e||(o===e&&r.delete(o),r.set(o===e?t:o,{...l,intersection:{...c,object:c.object===e?t:c.object,eventObject:c.eventObject===e?t:c.eventObject}}))}})}function gR(i,e){const{internal:t}=i.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,r)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((n,r)=>{XS(t.capturedMap,e,n,r)})}function vR(i){function e(h){const{internal:d}=i.getState(),p=h.offsetX-d.initialClick[0],g=h.offsetY-d.initialClick[1];return Math.round(Math.sqrt(p*p+g*g))}function t(h){return h.filter(d=>["Move","Over","Enter","Out","Leave"].some(p=>{var g;return(g=d.__r3f)==null?void 0:g.handlers["onPointer"+p]}))}function n(h,d){const p=i.getState(),g=new Set,v=[],_=d?d(p.internal.interaction):p.internal.interaction;for(let S=0;S<_.length;S++){const M=el(_[S]);M&&(M.raycaster.camera=void 0)}p.previousRoot||p.events.compute==null||p.events.compute(h,p);function y(S){const M=el(S);if(!M||!M.events.enabled||M.raycaster.camera===null)return[];if(M.raycaster.camera===void 0){var A;M.events.compute==null||M.events.compute(h,M,(A=M.previousRoot)==null?void 0:A.getState()),M.raycaster.camera===void 0&&(M.raycaster.camera=null)}return M.raycaster.camera?M.raycaster.intersectObject(S,!0):[]}let w=_.flatMap(y).sort((S,M)=>{const A=el(S.object),E=el(M.object);return!A||!E?S.distance-M.distance:E.events.priority-A.events.priority||S.distance-M.distance}).filter(S=>{const M=pc(S);return g.has(M)?!1:(g.add(M),!0)});p.events.filter&&(w=p.events.filter(w,p));for(const S of w){let M=S.object;for(;M;){var b;(b=M.__r3f)!=null&&b.eventCount&&v.push({...S,eventObject:M}),M=M.parent}}if("pointerId"in h&&p.internal.capturedMap.has(h.pointerId))for(let S of p.internal.capturedMap.get(h.pointerId).values())g.has(pc(S.intersection))||v.push(S.intersection);return v}function r(h,d,p,g){if(h.length){const v={stopped:!1};for(const _ of h){let y=el(_.object);if(y||_.object.traverseAncestors(w=>{const b=el(w);if(b)return y=b,!1}),y){const{raycaster:w,pointer:b,camera:S,internal:M}=y,A=new O(b.x,b.y,0).unproject(S),E=F=>{var D,B;return(D=(B=M.capturedMap.get(F))==null?void 0:B.has(_.eventObject))!=null?D:!1},N=F=>{const D={intersection:_,target:d.target};M.capturedMap.has(F)?M.capturedMap.get(F).set(_.eventObject,D):M.capturedMap.set(F,new Map([[_.eventObject,D]])),d.target.setPointerCapture(F)},P=F=>{const D=M.capturedMap.get(F);D&&XS(M.capturedMap,_.eventObject,D,F)};let T={};for(let F in d){let D=d[F];typeof D!="function"&&(T[F]=D)}let C={..._,...T,pointer:b,intersections:h,stopped:v.stopped,delta:p,unprojectedPoint:A,ray:w.ray,camera:S,stopPropagation(){const F="pointerId"in d&&M.capturedMap.get(d.pointerId);if((!F||F.has(_.eventObject))&&(C.stopped=v.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(D=>D.eventObject===_.eventObject))){const D=h.slice(0,h.indexOf(_));o([...D,_])}},target:{hasPointerCapture:E,setPointerCapture:N,releasePointerCapture:P},currentTarget:{hasPointerCapture:E,setPointerCapture:N,releasePointerCapture:P},nativeEvent:d};if(g(C),v.stopped===!0)break}}}return h}function o(h){const{internal:d}=i.getState();for(const p of d.hovered.values())if(!h.length||!h.find(g=>g.object===p.object&&g.index===p.index&&g.instanceId===p.instanceId)){const v=p.eventObject.__r3f;if(d.hovered.delete(pc(p)),v!=null&&v.eventCount){const _=v.handlers,y={...p,intersections:h};_.onPointerOut==null||_.onPointerOut(y),_.onPointerLeave==null||_.onPointerLeave(y)}}}function l(h,d){for(let p=0;p<d.length;p++){const g=d[p].__r3f;g==null||g.handlers.onPointerMissed==null||g.handlers.onPointerMissed(h)}}function c(h){switch(h){case"onPointerLeave":case"onPointerCancel":return()=>o([]);case"onLostPointerCapture":return d=>{const{internal:p}=i.getState();"pointerId"in d&&p.capturedMap.has(d.pointerId)&&requestAnimationFrame(()=>{p.capturedMap.has(d.pointerId)&&(p.capturedMap.delete(d.pointerId),o([]))})}}return function(p){const{onPointerMissed:g,internal:v}=i.getState();v.lastEvent.current=p;const _=h==="onPointerMove",y=h==="onClick"||h==="onContextMenu"||h==="onDoubleClick",b=n(p,_?t:void 0),S=y?e(p):0;h==="onPointerDown"&&(v.initialClick=[p.offsetX,p.offsetY],v.initialHits=b.map(A=>A.eventObject)),y&&!b.length&&S<=2&&(l(p,v.interaction),g&&g(p)),_&&o(b);function M(A){const E=A.eventObject,N=E.__r3f;if(!(N!=null&&N.eventCount))return;const P=N.handlers;if(_){if(P.onPointerOver||P.onPointerEnter||P.onPointerOut||P.onPointerLeave){const T=pc(A),C=v.hovered.get(T);C?C.stopped&&A.stopPropagation():(v.hovered.set(T,A),P.onPointerOver==null||P.onPointerOver(A),P.onPointerEnter==null||P.onPointerEnter(A))}P.onPointerMove==null||P.onPointerMove(A)}else{const T=P[h];T?(!y||v.initialHits.includes(E))&&(l(p,v.interaction.filter(C=>!v.initialHits.includes(C))),T(A)):y&&v.initialHits.includes(E)&&l(p,v.interaction.filter(C=>!v.initialHits.includes(C)))}}r(b,p,S,M)}}return{handlePointer:c}}const Og=i=>typeof(i==null?void 0:i.then)=="function",_R=i=>Object.assign(Promise.resolve(i),{status:"fulfilled",value:i}),xR=i=>{const e=Promise.reject(i);return e.catch(()=>{}),Object.assign(e,{status:"rejected",reason:i})},yR=()=>{let i,e;const t=new Promise((n,r)=>{i=o=>{Object.assign(t,{status:"fulfilled",value:o}),n(o)},e=o=>{Object.assign(t,{status:"rejected",reason:o}),r(o)}});return t.status="pending",t.catch(()=>{}),{promise:t,resolve:i,reject:e}},Bg=i=>!!(i!=null&&i.render);function SR(i,e){const t={canvas:i,powerPreference:"high-performance",antialias:!0,alpha:!0};return typeof e=="function"?e(t):Bg(e)?e:new zS({...t,...e})}function bR(i){if((i.hasInitialized==null?void 0:i.hasInitialized())===!1)return;const e=Ac(()=>{var t;return i.dispose?i.dispose():(t=i.renderLists)==null||t.dispose==null?void 0:t.dispose()});if(Og(e))return Promise.resolve(e).catch(t=>console.warn("[R3F] Error disposing renderer",t)).then(()=>Ac(()=>i.forceContextLoss==null?void 0:i.forceContextLoss()));Ac(()=>i.forceContextLoss==null?void 0:i.forceContextLoss())}function MR(i,e){if(i){if(e)return bR(i);Ac(()=>{var t;return(t=i.renderLists)==null||t.dispose==null?void 0:t.dispose()}),Ac(()=>i.forceContextLoss==null?void 0:i.forceContextLoss())}}function Ac(i){try{return i()}catch(e){console.warn("[R3F] Error while unmounting root; teardown may be incomplete:",e)}}const qS=Ve.createContext(null),wR=(i,e)=>{const t=qC((c,h)=>{const d=new O,p=new O,g=new O;function v(S=h().camera,M=p,A=h().size){const{width:E,height:N,top:P,left:T}=A,C=E/N;M.isVector3?g.copy(M):g.set(...M);const F=S.getWorldPosition(d).distanceTo(g);if(GS(S))return{width:E/S.zoom,height:N/S.zoom,top:P,left:T,factor:1,distance:F,aspect:C};{const D=S.fov*Math.PI/180,B=2*Math.tan(D/2)*F,W=B*(E/N);return{width:W,height:B,top:P,left:T,factor:E/W,distance:F,aspect:C}}}let _;const y=S=>c(M=>({performance:{...M.performance,current:S}})),w=new ue;return{set:c,get:h,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(S=1)=>i(h(),S),advance:(S,M)=>e(S,M,h()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new wS,pointer:w,mouse:w,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const S=h();_&&clearTimeout(_),S.performance.current!==S.performance.min&&y(S.performance.min),_=setTimeout(()=>y(h().performance.max),S.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:v},setEvents:S=>c(M=>({...M,events:{...M.events,...S}})),setSize:(S,M,A=0,E=0)=>{const N=h().camera,P={width:S,height:M,top:A,left:E};c(T=>({size:P,viewport:{...T.viewport,...v(N,p,P)}}))},setDpr:S=>c(M=>{const A=Fg(S);return{viewport:{...M.viewport,dpr:A,initialDpr:M.viewport.initialDpr||A}}}),setFrameloop:(S="always")=>{const M=h().clock;M.stop(),M.elapsedTime=0,S!=="never"&&(M.start(),M.elapsedTime=0),c(()=>({frameloop:S}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:Ve.createRef(),active:!1,frames:0,priority:0,subscribe:(S,M,A)=>{const E=h().internal;return E.priority=E.priority+(M>0?1:0),E.subscribers.push({ref:S,priority:M,store:A}),E.subscribers=E.subscribers.sort((N,P)=>N.priority-P.priority),()=>{const N=h().internal;N!=null&&N.subscribers&&(N.priority=N.priority-(M>0?1:0),N.subscribers=N.subscribers.filter(P=>P.ref!==S))}}}}}),n=t.getState();let r=n.size,o=n.viewport.dpr,l=n.camera;return t.subscribe(()=>{const{camera:c,size:h,viewport:d,gl:p,set:g}=t.getState();if(h.width!==r.width||h.height!==r.height||d.dpr!==o){r=h,o=d.dpr,pR(c,h),d.dpr>0&&p.setPixelRatio(d.dpr);const v=typeof HTMLCanvasElement<"u"&&p.domElement instanceof HTMLCanvasElement;p.setSize(h.width,h.height,v)}c!==l&&(l=c,g(v=>({viewport:{...v.viewport,...v.viewport.getCurrentViewport(c)}})))}),t.subscribe(c=>i(c)),t};function $S(){const i=Ve.useContext(qS);if(!i)throw new Error("R3F: Hooks can only be used within the Canvas component!");return i}function Hd(i=t=>t,e){return $S()(i,e)}function to(i,e=0){const t=$S(),n=t.getState().internal.subscribe,r=VS(i);return wl(()=>n(r,e,t),[e,n,t]),null}/**
 * @license React
 * react-reconciler-constants.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */const TR=1,my=8,sf=32,gy=2,ER=268435456,AR={objects:"shallow"};function CR(i,e){if(!e&&typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement&&i.parentElement){const{width:t,height:n,top:r,left:o}=i.parentElement.getBoundingClientRect();return{width:t,height:n,top:r,left:o}}else if(!e&&typeof OffscreenCanvas<"u"&&i instanceof OffscreenCanvas)return{width:i.width,height:i.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...e}}function RR({store:i,configuration:e},t,n){const{gl:r,scene:o,camera:l,shadows:c=!1,linear:h=!1,flat:d=!1,legacy:p=!1,frameloop:g="always",dpr:v=[1,2],performance:_,onPointerMissed:y}=n,w=CR(t,n.size),b={...n,shadows:c,linear:h,flat:d,legacy:p,frameloop:g,size:w},S=i.getState(),M=S.gl,A=e.previous,E=D=>!A||!zn.equ(b[D],A[D],AR);e.previous=void 0;let N=S.raycaster;if(N||S.set({raycaster:N=new MS}),E("raycaster")){var P;const{params:D,...B}=(P=n.raycaster)!=null?P:{};Va(N,{...B,params:{...N.params,...D}})}if(!S.camera||S.camera===e.camera&&E("camera")){e.camera=l;const D=l==null?void 0:l.isCamera,B=D?l:n.orthographic?new bl(0,0,0,0,.1,1e3):new Kn(75,0,.1,1e3);D||(B.position.z=5,l&&(Va(B,l),B.manual||("aspect"in l||"left"in l||"right"in l||"bottom"in l||"top"in l)&&(B.manual=!0,B.updateProjectionMatrix())),!S.camera&&!(l!=null&&l.rotation)&&B.lookAt(0,0,0)),S.set({camera:B}),N.camera=B}if(!S.scene){let D;o!=null&&o.isScene?(D=o,$f(D,i,"",{})):(D=new kc,$f(D,i,"",{}),o&&Va(D,o)),S.set({scene:D})}if(n.events&&!S.events.handlers&&S.set({events:n.events(i)}),E("size")&&S.setSize(w.width,w.height,w.top,w.left),S.viewport.dpr!==Fg(v)&&S.setDpr(v),E("frameloop")&&S.setFrameloop(g),E("onPointerMissed")&&S.set({onPointerMissed:y}),_&&E("performance")&&S.set(D=>({performance:{...D.performance,..._}})),!S.xr){var T;const D=(Z,z)=>{const X=i.getState();X.frameloop!=="never"&&eb(Z,!0,X,z)},B=()=>{const Z=i.getState();Z.gl.xr.enabled=Z.gl.xr.isPresenting,Z.gl.xr.setAnimationLoop(Z.gl.xr.isPresenting?D:null),Z.gl.xr.isPresenting||Hg(Z)},W={connect(){const Z=i.getState().gl;Z.xr.addEventListener("sessionstart",B),Z.xr.addEventListener("sessionend",B)},disconnect(){const Z=i.getState().gl;Z.xr.removeEventListener("sessionstart",B),Z.xr.removeEventListener("sessionend",B)}};typeof((T=M.xr)==null?void 0:T.addEventListener)=="function"&&W.connect(),S.set({xr:W})}if(M.shadowMap&&E("shadows")){const D=M.shadowMap.enabled,B=M.shadowMap.type;if(M.shadowMap.enabled=!!c,zn.boo(c))M.shadowMap.type=gc;else if(zn.str(c)){var C;const W={basic:Vy,percentage:ol,soft:gc,variance:Ba};M.shadowMap.type=(C=W[c])!=null?C:gc}else zn.obj(c)&&Object.assign(M.shadowMap,c);(D!==M.shadowMap.enabled||B!==M.shadowMap.type)&&(M.shadowMap.needsUpdate=!0)}const F=r&&!zn.fun(r)&&!Bg(r)?r:void 0;E("legacy")&&(Lt.enabled=!p,S.set({legacy:p})),E("linear")&&((F==null?void 0:F.outputColorSpace)===void 0&&(M.outputColorSpace=h?ta:Zt),S.set({linear:h})),E("flat")&&((F==null?void 0:F.toneMapping)===void 0&&(M.toneMapping=d?Qi:td),S.set({flat:d})),F&&E("gl")&&Va(M,F),e.previous=b}function IR(i){const e=()=>{var r;return(r=i.store.getState().gl)==null?void 0:r.xr},t=()=>{var r,o,l,c;const h=i.store.getState();if((r=e())!=null&&r.isPresenting||(o=e())!=null&&o.getSession!=null&&o.getSession()){e().addEventListener("sessionend",t);return}(l=e())==null||l.removeEventListener==null||l.removeEventListener("sessionend",t);const d=i.configuration.previous;if(!d)return;const p=(c=d.dpr)!=null?c:[1,2];h.viewport.dpr!==Fg(p)&&h.setDpr(p)},n=lR(t);return()=>{var r;n(),(r=e())==null||r.removeEventListener==null||r.removeEventListener("sessionend",t)}}var PR={version:"9.8.2"};function LR(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var vy={exports:{}},_y={exports:{}},xy;function NR(){return xy||(xy=1,(function(i){i.exports=function(e){function t(s,a,u,f){return new Bb(s,a,u,f)}function n(){}function r(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(s){for(var a=s,u=a;u&&!u.alternate;)a=u,(a.flags&4098)!==0&&(s=a.return),u=a.return;for(;a.return;)a=a.return;return a.tag===3?s:null}function l(s){if(o(s)!==s)throw Error(r(188))}function c(s){var a=s.alternate;if(!a){if(a=o(s),a===null)throw Error(r(188));return a!==s?null:s}for(var u=s,f=a;;){var m=u.return;if(m===null)break;var x=m.alternate;if(x===null){if(f=m.return,f!==null){u=f;continue}break}if(m.child===x.child){for(x=m.child;x;){if(x===u)return l(m),s;if(x===f)return l(m),a;x=x.sibling}throw Error(r(188))}if(u.return!==f.return)u=m,f=x;else{for(var R=!1,k=m.child;k;){if(k===u){R=!0,u=m,f=x;break}if(k===f){R=!0,f=m,u=x;break}k=k.sibling}if(!R){for(k=x.child;k;){if(k===u){R=!0,u=x,f=m;break}if(k===f){R=!0,f=x,u=m;break}k=k.sibling}if(!R)throw Error(r(189))}}if(u.alternate!==f)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?s:a}function h(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=h(s),a!==null)return a;s=s.sibling}return null}function d(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(s.tag!==4&&(a=d(s),a!==null))return a;s=s.sibling}return null}function p(s){return s===null||typeof s!="object"?null:(s=Xv&&s[Xv]||s["@@iterator"],typeof s=="function"?s:null)}function g(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===Xb?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case po:return"Fragment";case Hp:return"Profiler";case Gv:return"StrictMode";case Gp:return"Suspense";case Wp:return"SuspenseList";case qp:return"Activity";case $p:return"ViewTransition"}if(typeof s=="object")switch(s.$$typeof){case fo:return"Portal";case sr:return s.displayName||"Context";case Wv:return(s._context.displayName||"Context")+".Consumer";case Vp:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case Xp:return a=s.displayName||null,a!==null?a:g(s.type)||"Memo";case Dr:a=s._payload,s=s._init;try{return g(s(a))}catch{}}return null}function v(s){return{current:s}}function _(s){0>vo||(s.current=t0[vo],t0[vo]=null,vo--)}function y(s,a){vo++,t0[vo]=s.current,s.current=a}function w(s){return s>>>=0,s===0?32:31-(P4(s)/L4|0)|0}function b(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&-s;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function S(s,a,u){var f=s.pendingLanes;if(f===0)return 0;var m=0,x=s.suspendedLanes,R=s.pingedLanes;s=s.warmLanes;var k=f&134217727;return k!==0?(f=k&~x,f!==0?m=b(f):(R&=k,R!==0?m=b(R):u||(u=k&~s,u!==0&&(m=b(u))))):(k=f&~x,k!==0?m=b(k):R!==0?m=b(R):u||(u=f&~s,u!==0&&(m=b(u)))),m===0?0:a!==0&&a!==m&&(a&x)===0&&(x=m&-m,u=a&-a,x>=u||x===32&&(u&4194048)!==0)?a:m}function M(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function A(s,a){(a&8)!==0&&(a|=a&32);var u=s.entangledLanes;if(u!==0)for(s=s.entanglements,u&=a;0<u;){var f=31-Wi(u),m=1<<f;a|=s[f],u&=~m}return a}function E(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function N(){var s=Ou;return Ou<<=1,(Ou&62914560)===0&&(Ou=4194304),s}function P(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function T(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function C(s,a,u,f,m,x){var R=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var k=s.entanglements,ne=s.expirationTimes,me=s.hiddenUpdates;for(u=R&~u;0<u;){var _e=31-Wi(u),Ue=1<<_e;k[_e]=0,ne[_e]=-1;var Xe=me[_e];if(Xe!==null)for(me[_e]=null,_e=0;_e<Xe.length;_e++){var Pt=Xe[_e];Pt!==null&&(Pt.lane&=-536870913)}u&=~Ue}f!==0&&F(s,f,0),x!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=x&~(R&~a))}function F(s,a,u){s.pendingLanes|=a,s.suspendedLanes&=~a;var f=31-Wi(a);s.entangledLanes|=a,s.entanglements[f]=s.entanglements[f]|1073741824|u&261930}function D(s,a){var u=s.entangledLanes|=a;for(s=s.entanglements;u;){var f=31-Wi(u),m=1<<f;m&a|s[f]&a&&(s[f]|=a),u&=~m}}function B(s,a){var u=a&-a;return u=(u&42)!==0?1:W(u),(u&(s.suspendedLanes|a))!==0?0:u}function W(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Z(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function z(s){if(typeof O4=="function"&&B4(s),Xi&&typeof Xi.setStrictMode=="function")try{Xi.setStrictMode(kl,s)}catch{}}function X(s,a){if(s.name!=null&&s.name!=="auto")return s.name;if(a.autoName!==null)return a.autoName;s=ws.identifierPrefix;var u=z4++;return s="_"+s+"t_"+u.toString(32)+"_",a.autoName=s}function Q(s){var a;if(s==null||typeof s=="string")return s;var u=null,f=No;if(f!==null)for(var m=0;m<f.length;m++){var x=s[f[m]];if(x!=null){if(x==="none")return"none";u=u==null?x:u+(" "+x)}}return(a=u)!=null?a:s.default}function q(s,a){return s=Q(s),a=Q(a),a==null?s==="auto"?null:s:a==="auto"?null:a}function fe(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}function Y(s){if(s0===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);s0=a&&a[1]||"",y_=-1<u.stack.indexOf(`
    at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
`+s0+s+y_}function he(s,a){if(!s||r0)return"";r0=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(a){var Ue=function(){throw Error()};if(Object.defineProperty(Ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ue,[])}catch(Vt){var Xe=Vt}Reflect.construct(s,[],Ue)}else{try{Ue.call()}catch(Vt){Xe=Vt}Ue=!1;try{var Pt=Object.getOwnPropertyDescriptor(s.prototype,"props");Object.defineProperty(s.prototype,"props",{configurable:!0,set:function(){throw Error()}}),Ue=!0,new s}finally{Ue&&(Pt!==void 0?Object.defineProperty(s.prototype,"props",Pt):delete s.prototype.props)}}}else{try{throw Error()}catch(Vt){Xe=Vt}(Ue=s())&&typeof Ue.catch=="function"&&Ue.catch(function(){})}}catch(Vt){if(Vt&&Xe&&typeof Vt.stack=="string")return[Vt.stack,Xe.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=f.DetermineComponentFrameRoot(),R=x[0],k=x[1];if(R&&k){var ne=R.split(`
`),me=k.split(`
`);for(m=f=0;f<ne.length&&!ne[f].includes("DetermineComponentFrameRoot");)f++;for(;m<me.length&&!me[m].includes("DetermineComponentFrameRoot");)m++;if(f===ne.length||m===me.length)for(f=ne.length-1,m=me.length-1;1<=f&&0<=m&&ne[f]!==me[m];)m--;for(;1<=f&&0<=m;f--,m--)if(ne[f]!==me[m]){if(f!==1||m!==1)do if(f--,m--,0>m||ne[f]!==me[m]){var _e=`
`+ne[f].replace(" at new "," at ");return s.displayName&&_e.includes("<anonymous>")&&(_e=_e.replace("<anonymous>",s.displayName)),_e}while(1<=f&&0<=m);break}}}finally{r0=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?Y(u):""}function pe(s,a){switch(s.tag){case 26:case 27:case 5:return Y(s.type);case 16:return Y("Lazy");case 13:return s.child!==a&&a!==null?Y("Suspense Fallback"):Y("Suspense");case 19:return Y("SuspenseList");case 0:case 15:return he(s.type,!1);case 11:return he(s.type.render,!1);case 1:return he(s.type,!0);case 31:return Y("Activity");case 30:return Y("ViewTransition");default:return""}}function We(s){try{var a="",u=null;do a+=pe(s,u),u=s,s=s.return;while(s);return a}catch(f){return`
Error generating stack: `+f.message+`
`+f.stack}}function qe(s,a){if(typeof s=="object"&&s!==null){var u=S_.get(s);return u!==void 0?u:(a={value:s,source:a,stack:We(a)},S_.set(s,a),a)}return{value:s,source:a,stack:We(a)}}function ie(s,a){xo[yo++]=Hl,xo[yo++]=zu,zu=s,Hl=a}function xe(s,a,u){rs[as++]=ks,rs[as++]=Hs,rs[as++]=Ur,Ur=s;var f=ks;s=Hs;var m=32-Wi(f)-1;f&=~(1<<m),u+=1;var x=32-Wi(a)+m;if(30<x){var R=m-m%5;x=(f&(1<<R)-1).toString(32),f>>=R,m-=R,ks=1<<32-Wi(a)+m|u<<m|f,Hs=x+s}else ks=1<<x|u<<m|f,Hs=s}function Be(s){s.return!==null&&(ie(s,1),xe(s,1,0))}function et(s){for(;s===zu;)zu=xo[--yo],xo[yo]=null,Hl=xo[--yo],xo[yo]=null;for(;s===Ur;)Ur=rs[--as],rs[as]=null,Hs=rs[--as],rs[as]=null,ks=rs[--as],rs[as]=null}function Ce(s,a){rs[as++]=ks,rs[as++]=Hs,rs[as++]=Ur,ks=a.id,Hs=a.overflow,Ur=s}function tt(s,a){y(Fr,a),y(Vl,s),y(si,null),s=Yb(a),_(si),y(si,s)}function kt(){_(si),_(Vl),_(Fr)}function at(s){var a=s.memoizedState;a!==null&&(a=a.memoizedState,Bs?ar._currentValue=a:ar._currentValue2=a,y(ku,s)),a=si.current;var u=Zb(a,s.type);a!==u&&(y(Vl,s),y(si,u))}function yt(s){Vl.current===s&&(_(si),_(Vl)),ku.current===s&&(_(ku),Bs?ar._currentValue=mo:ar._currentValue2=mo)}function pt(s){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ht(qe(a,s)),a0}function de(s,a){if(!ii)throw Error(r(175));l4(s.stateNode,s.type,s.memoizedProps,a,s)||pt(s,!0)}function we(s){for(Yn=s.return;Yn;)switch(Yn.tag){case 5:case 31:case 13:os=!1;return;case 27:case 3:os=!0;return;default:Yn=Yn.return}}function ye(s){if(!ii||s!==Yn)return!1;if(!Rt)return we(s),Rt=!0,!1;var a=s.tag;if(xn?a!==3&&a!==27&&(a!==5||l_(s.type)&&!Lu(s.type,s.memoizedProps))&&mn&&pt(s):a!==3&&(a!==5||l_(s.type)&&!Lu(s.type,s.memoizedProps))&&mn&&pt(s),we(s),a===13){if(!ii)throw Error(r(316));if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));mn=d4(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));mn=f4(s)}else mn=xn&&a===27?KM(s.type,mn):Yn?o_(s.stateNode):null;return!0}function ke(){ii&&(mn=Yn=null,Rt=!1)}function Ne(){var s=Or;return s!==null&&(Ii===null?Ii=s:Ii.push.apply(Ii,s),Or=null),s}function ht(s){Or===null?Or=[s]:Or.push(s)}function $e(s,a,u){Bs?(y(Hu,a._currentValue),a._currentValue=u):(y(Hu,a._currentValue2),a._currentValue2=u)}function mt(s){var a=Hu.current;Bs?s._currentValue=a:s._currentValue2=a,_(Hu)}function Tt(s,a,u){for(;s!==null;){var f=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),s===u)break;s=s.return}}function Ft(s,a,u,f){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var x=m.dependencies;if(x!==null){var R=m.child;x=x.firstContext;e:for(;x!==null;){var k=x;x=m;for(var ne=0;ne<a.length;ne++)if(k.context===a[ne]){x.lanes|=u,k=x.alternate,k!==null&&(k.lanes|=u),Tt(x.return,u,s),f||(R=null);break e}x=k.next}}else if(m.tag===18){if(R=m.return,R===null)throw Error(r(341));R.lanes|=u,x=R.alternate,x!==null&&(x.lanes|=u),Tt(R,u,s),R=null}else m.tag===13&&m.memoizedState!==null&&m.memoizedState.dehydrated===null?(m.lanes|=u,R=m.alternate,R!==null&&(R.lanes|=u),Tt(m.return,u,s),R=m.child,R=R!==null?R.sibling:null):R=m.child;if(R!==null)R.return=m;else for(R=m;R!==null;){if(R===s){R=null;break}if(m=R.sibling,m!==null){m.return=R.return,R=m;break}R=R.return}m=R}}function G(s,a,u,f){s=null;for(var m=a,x=!1;m!==null;){if(!x){if((m.flags&524288)!==0)x=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var R=m.alternate;if(R===null)throw Error(r(387));if(R=R.memoizedProps,R!==null){var k=m.type;qi(m.pendingProps.value,R.value)||(s!==null?s.push(k):s=[k])}}else if(m===ku.current){if(R=m.alternate,R===null)throw Error(r(387));R.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(ar):s=[ar])}m=m.return}return s!==null&&Ft(a,s,u,f),a.flags|=262144,s!==null}function un(s){for(s=s.firstContext;s!==null;){var a=s.context;if(!qi(Bs?a._currentValue:a._currentValue2,s.memoizedValue))return!0;s=s.next}return!1}function vt(s){pa=s,or=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function xt(s){return hn(pa,s)}function Re(s,a){return pa===null&&vt(s),hn(s,a)}function hn(s,a){var u=Bs?a._currentValue:a._currentValue2;if(a={context:a,memoizedValue:u,next:null},or===null){if(s===null)throw Error(r(308));or=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else or=or.next=a;return u}function st(){return{controller:new H4,data:new Map,refCount:0}}function ot(s){s.refCount--,s.refCount===0&&V4(G4,function(){s.controller.abort()})}function U(s,a){if((s.pendingLanes&4194048)!==0){var u=s.transitionTypes;for(u===null&&(u=s.transitionTypes=[]),s=0;s<a.length;s++){var f=a[s];u.indexOf(f)===-1&&u.push(f)}}}function I(s){var a=s.transitionTypes;return s.transitionTypes=null,a}function J(){}function ge(s){s!==bo&&s.next===null&&(bo===null?So=bo=s:bo=bo.next=s),Vu=!0,o0||(o0=!0,H())}function ce(s,a){if(!l0&&Vu){l0=!0;do for(var u=!1,f=So;f!==null;){if(s!==0){var m=f.pendingLanes;if(m===0)var x=0;else{var R=f.suspendedLanes,k=f.pingedLanes;x=(1<<31-Wi(42|s)+1)-1,x&=m&~(R&~k),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(u=!0,Ie(f,x))}else x=Ot,x=S(f,f===rn?x:0,f.cancelPendingCommit!==null||f.timeoutHandle!==da),(x&3)===0||M(f,x)||(u=!0,Ie(f,x));f=f.next}while(u);l0=!1}}function Ae(){Le()}function Le(){Vu=o0=!1;var s=0;ma!==0&&sM()&&(s=ma);for(var a=Ai(),u=null,f=So;f!==null;){var m=f.next,x=ae(f,a);x===0?(f.next=null,u===null?So=m:u.next=m,m===null&&(bo=u)):(u=f,(s!==0||(x&3)!==0)&&(Vu=!0)),f=m}Sn!==0&&Sn!==5||ce(s),ma!==0&&(ma=0)}function ae(s,a){for(var u=s.suspendedLanes,f=s.pingedLanes,m=s.expirationTimes,x=s.pendingLanes&-62914561;0<x;){var R=31-Wi(x),k=1<<R,ne=m[R];ne===-1?((k&u)===0||(k&f)!==0)&&(m[R]=E(k,a)):ne<=a&&(s.expiredLanes|=k),x&=~k}if(a=rn,u=Ot,u=S(s,s===a?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==da),f=s.callbackNode,u===0||s===a&&(tn===2||tn===9)||s.cancelPendingCommit!==null)return f!==null&&f!==null&&n0(f),s.callbackNode=null,s.callbackPriority=0;if((u&3)===0||M(s,u)){if(a=u&-u,a===s.callbackPriority)return a;switch(f!==null&&n0(f),Z(u)){case 2:case 8:u=U4;break;case 32:u=i0;break;case 268435456:u=F4;break;default:u=i0}return f=oe.bind(null,s),u=Bu(u,f),s.callbackPriority=a,s.callbackNode=u,a}return f!==null&&f!==null&&n0(f),s.callbackPriority=2,s.callbackNode=null,2}function oe(s,a){if(Sn!==0&&Sn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var u=s.callbackNode;if(Fl()&&s.callbackNode!==u)return null;var f=Ot;return f=S(s,s===rn?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==da),f===0?null:(bv(s,f,a),ae(s,Ai()),s.callbackNode!=null&&s.callbackNode===u?oe.bind(null,s):null)}function Ie(s,a){if(Fl())return null;bv(s,a,!0)}function H(){fM?dM(function(){(Dt&6)!==0?Bu(__,Ae):Le()}):Bu(__,Ae)}function le(){if(ma===0){var s=ga;s===0&&(s=Uu,Uu<<=1,(Uu&261888)===0&&(Uu=256)),ma=s}return ma}function re(s,a){if(Wl===null){var u=Wl=[];c0=0,ga=le(),Mo={status:"pending",value:void 0,then:function(f){u.push(f)}}}return c0++,a.then(Pe,Pe),a}function Pe(){if(--c0===0&&(Gl=null,Wl!==null)){Mo!==null&&(Mo.status="fulfilled");var s=Wl;Wl=null,ga=0,Mo=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function be(s,a){var u=[],f={status:"pending",value:null,reason:null,then:function(m){u.push(m)}};return s.then(function(){f.status="fulfilled",f.value=a;for(var m=0;m<u.length;m++)(0,u[m])(a)},function(m){for(f.status="rejected",f.reason=m,m=0;m<u.length;m++)(0,u[m])(void 0)}),f}function Te(){var s=va.current;return s!==null?s:rn.pooledCache}function Qe(s,a){a===null?y(va,va.current):y(va,a.pool)}function Mt(){var s=Te();return s===null?null:{parent:Bs?yn._currentValue:yn._currentValue2,pool:s}}function ve(s,a){if(qi(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var u=Object.keys(s),f=Object.keys(a);if(u.length!==f.length)return!1;for(f=0;f<u.length;f++){var m=u[f];if(!k4.call(a,m)||!qi(s[m],a[m]))return!1}return!0}function rt(s){return s=s.status,s==="fulfilled"||s==="rejected"}function St(s,a,u){switch(u=s[u],u===void 0?s.push(a):u!==a&&(a.then(J,J),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Rn(s),s===void 0&&!("reason"in a)?Error(r(600)):s;default:if(typeof a.status=="string")a.then(J,J);else{if(s=rn,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=a,s.status="pending",s.then(function(f){if(a.status==="pending"){var m=a;m.status="fulfilled",m.value=f}},function(f){if(a.status==="pending"){var m=a;m.status="rejected",m.reason=f}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Rn(s),s}throw _a=a,wo}}function De(s){try{var a=s._init;return a(s._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(_a=u,wo):u}}function Xt(){if(_a===null)throw Error(r(459));var s=_a;return _a=null,s}function Rn(s){if(s===wo||s===Gu)throw Error(r(483))}function ki(s){var a=Xl;return Xl+=1,To===null&&(To=[]),St(To,s,a)}function vs(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function Ar(s,a){throw a.$$typeof===Hb?Error(r(525)):(s=Object.prototype.toString.call(a),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function lu(s){function a(ee,$){if(s){var se=ee.deletions;se===null?(ee.deletions=[$],ee.flags|=16):se.push($)}}function u(ee,$){if(!s)return null;for(;$!==null;)a(ee,$),$=$.sibling;return null}function f(ee){for(var $=new Map;ee!==null;)ee.key===null?$.set(ee.index,ee):$.set(ee.key,ee),ee=ee.sibling;return $}function m(ee,$){return ee=ir(ee,$),ee.index=0,ee.sibling=null,ee}function x(ee,$,se){return ee.index=se,s?(se=ee.alternate,se!==null?(se=se.index,se<$?(ee.flags|=2,$):se):(ee.flags|=134217730,$)):(ee.flags|=1048576,$)}function R(ee){return s&&ee.alternate===null&&(ee.flags|=134217730),ee}function k(ee,$,se,Se){return $===null||$.tag!==6?($=Op(se,ee.mode,Se),$.return=ee,$):($=m($,se),$.return=ee,$)}function ne(ee,$,se,Se){var ut=se.type;return ut===po?(ee=_e(ee,$,se.props.children,Se,se.key),vs(ee,se),ee):$!==null&&($.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===Dr&&De(ut)===$.type)?($=m($,se.props),vs($,se),$.return=ee,$):($=Ru(se.type,se.key,se.props,null,ee.mode,Se),vs($,se),$.return=ee,$)}function me(ee,$,se,Se){return $===null||$.tag!==4||$.stateNode.containerInfo!==se.containerInfo||$.stateNode.implementation!==se.implementation?($=Bp(se,ee.mode,Se),$.return=ee,$):($=m($,se.children||[]),$.return=ee,$)}function _e(ee,$,se,Se,ut){return $===null||$.tag!==7?($=fa(se,ee.mode,Se,ut),$.return=ee,$):($=m($,se),$.return=ee,$)}function Ue(ee,$,se){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=Op(""+$,ee.mode,se),$.return=ee,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case Iu:return se=Ru($.type,$.key,$.props,null,ee.mode,se),vs(se,$),se.return=ee,se;case fo:return $=Bp($,ee.mode,se),$.return=ee,$;case Dr:return $=De($),Ue(ee,$,se)}if(Pu($)||p($))return $=fa($,ee.mode,se,null),$.return=ee,$;if(typeof $.then=="function")return Ue(ee,ki($),se);if($.$$typeof===sr)return Ue(ee,Re(ee,$),se);Ar(ee,$)}return null}function Xe(ee,$,se,Se){var ut=$!==null?$.key:null;if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return ut!==null?null:k(ee,$,""+se,Se);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case Iu:return se.key===ut?ne(ee,$,se,Se):null;case fo:return se.key===ut?me(ee,$,se,Se):null;case Dr:return se=De(se),Xe(ee,$,se,Se)}if(Pu(se)||p(se))return ut!==null?null:_e(ee,$,se,Se,null);if(typeof se.then=="function")return Xe(ee,$,ki(se),Se);if(se.$$typeof===sr)return Xe(ee,$,Re(ee,se),Se);Ar(ee,se)}return null}function Pt(ee,$,se,Se,ut){if(typeof Se=="string"&&Se!==""||typeof Se=="number"||typeof Se=="bigint")return ee=ee.get(se)||null,k($,ee,""+Se,ut);if(typeof Se=="object"&&Se!==null){switch(Se.$$typeof){case Iu:return ee=ee.get(Se.key===null?se:Se.key)||null,ne($,ee,Se,ut);case fo:return ee=ee.get(Se.key===null?se:Se.key)||null,me($,ee,Se,ut);case Dr:return Se=De(Se),Pt(ee,$,se,Se,ut)}if(Pu(Se)||p(Se))return ee=ee.get(se)||null,_e($,ee,Se,ut,null);if(typeof Se.then=="function")return Pt(ee,$,se,ki(Se),ut);if(Se.$$typeof===sr)return Pt(ee,$,se,Re($,Se),ut);Ar($,Se)}return null}function Vt(ee,$,se,Se){for(var ut=null,bn=null,dt=$,$t=$=0,On=null;dt!==null&&$t<se.length;$t++){dt.index>$t?(On=dt,dt=null):On=dt.sibling;var Ht=Xe(ee,dt,se[$t],Se);if(Ht===null){dt===null&&(dt=On);break}s&&dt&&Ht.alternate===null&&a(ee,dt),$=x(Ht,$,$t),bn===null?ut=Ht:bn.sibling=Ht,bn=Ht,dt=On}if($t===se.length)return u(ee,dt),Rt&&ie(ee,$t),ut;if(dt===null){for(;$t<se.length;$t++)dt=Ue(ee,se[$t],Se),dt!==null&&($=x(dt,$,$t),bn===null?ut=dt:bn.sibling=dt,bn=dt);return Rt&&ie(ee,$t),ut}for(dt=f(dt);$t<se.length;$t++)On=Pt(dt,ee,$t,se[$t],Se),On!==null&&(s&&(Ht=On.alternate,Ht!==null&&dt.delete(Ht.key===null?$t:Ht.key)),$=x(On,$,$t),bn===null?ut=On:bn.sibling=On,bn=On);return s&&dt.forEach(function(Wr){return a(ee,Wr)}),Rt&&ie(ee,$t),ut}function Gr(ee,$,se,Se){if(se==null)throw Error(r(151));for(var ut=null,bn=null,dt=$,$t=$=0,On=null,Ht=se.next();dt!==null&&!Ht.done;$t++,Ht=se.next()){dt.index>$t?(On=dt,dt=null):On=dt.sibling;var Wr=Xe(ee,dt,Ht.value,Se);if(Wr===null){dt===null&&(dt=On);break}s&&dt&&Wr.alternate===null&&a(ee,dt),$=x(Wr,$,$t),bn===null?ut=Wr:bn.sibling=Wr,bn=Wr,dt=On}if(Ht.done)return u(ee,dt),Rt&&ie(ee,$t),ut;if(dt===null){for(;!Ht.done;$t++,Ht=se.next())Ht=Ue(ee,Ht.value,Se),Ht!==null&&($=x(Ht,$,$t),bn===null?ut=Ht:bn.sibling=Ht,bn=Ht);return Rt&&ie(ee,$t),ut}for(dt=f(dt);!Ht.done;$t++,Ht=se.next())Ht=Pt(dt,ee,$t,Ht.value,Se),Ht!==null&&(s&&(On=Ht.alternate,On!==null&&dt.delete(On.key===null?$t:On.key)),$=x(Ht,$,$t),bn===null?ut=Ht:bn.sibling=Ht,bn=Ht);return s&&dt.forEach(function(Y4){return a(ee,Y4)}),Rt&&ie(ee,$t),ut}function wa(ee,$,se,Se){if(typeof se=="object"&&se!==null&&se.type===po&&se.key===null&&se.props.ref===void 0&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case Iu:e:{for(var ut=se.key;$!==null;){if($.key===ut){if(ut=se.type,ut===po){if($.tag===7){u(ee,$.sibling),Se=m($,se.props.children),vs(Se,se),Se.return=ee,ee=Se;break e}}else if($.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===Dr&&De(ut)===$.type){u(ee,$.sibling),Se=m($,se.props),vs(Se,se),Se.return=ee,ee=Se;break e}u(ee,$);break}else a(ee,$);$=$.sibling}se.type===po?(Se=fa(se.props.children,ee.mode,Se,se.key),vs(Se,se),Se.return=ee,ee=Se):(Se=Ru(se.type,se.key,se.props,null,ee.mode,Se),vs(Se,se),Se.return=ee,ee=Se)}return R(ee);case fo:e:{for(ut=se.key;$!==null;){if($.key===ut)if($.tag===4&&$.stateNode.containerInfo===se.containerInfo&&$.stateNode.implementation===se.implementation){u(ee,$.sibling),Se=m($,se.children||[]),Se.return=ee,ee=Se;break e}else{u(ee,$);break}else a(ee,$);$=$.sibling}Se=Bp(se,ee.mode,Se),Se.return=ee,ee=Se}return R(ee);case Dr:return se=De(se),wa(ee,$,se,Se)}if(Pu(se))return Vt(ee,$,se,Se);if(p(se)){if(ut=p(se),typeof ut!="function")throw Error(r(150));return se=ut.call(se),Gr(ee,$,se,Se)}if(typeof se.then=="function")return wa(ee,$,ki(se),Se);if(se.$$typeof===sr)return wa(ee,$,Re(ee,se),Se);Ar(ee,se)}return typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint"?(se=""+se,$!==null&&$.tag===6?(u(ee,$.sibling),Se=m($,se),Se.return=ee,ee=Se):(u(ee,$),Se=Op(se,ee.mode,Se),Se.return=ee,ee=Se),R(ee)):u(ee,$)}return function(ee,$,se,Se){try{Xl=0;var ut=wa(ee,$,se,Se);return To=null,ut}catch(dt){if(dt===wo||dt===Gu)throw dt;var bn=t(29,dt,null,ee.mode);return bn.lanes=Se,bn.return=ee,bn}finally{}}}function aa(){for(var s=Eo,a=h0=Eo=0;a<s;){var u=ls[a];ls[a++]=null;var f=ls[a];ls[a++]=null;var m=ls[a];ls[a++]=null;var x=ls[a];if(ls[a++]=null,f!==null&&m!==null){var R=f.pending;R===null?m.next=m:(m.next=R.next,R.next=m),f.pending=m}x!==0&&Tl(u,m,x)}}function oa(s,a,u,f){ls[Eo++]=s,ls[Eo++]=a,ls[Eo++]=u,ls[Eo++]=f,h0|=f,s.lanes|=f,s=s.alternate,s!==null&&(s.lanes|=f)}function _s(s,a,u,f){return oa(s,a,u,f),la(s)}function xs(s,a){return oa(s,null,null,a),la(s)}function Tl(s,a,u){s.lanes|=u;var f=s.alternate;f!==null&&(f.lanes|=u);for(var m=!1,x=s.return;x!==null;)x.childLanes|=u,f=x.alternate,f!==null&&(f.childLanes|=u),x.tag===22&&(s=x.stateNode,s===null||s._visibility&1||(m=!0)),s=x,x=x.return;return s.tag===3?(x=s.stateNode,m&&a!==null&&(m=31-Wi(u),s=x.hiddenUpdates,f=s[m],f===null?s[m]=[a]:f.push(a),a.lane=u|536870912),x):null}function la(s){if(50<Jl)throw Jl=0,sh=null,Error(r(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}function Cr(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function no(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function ys(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Ti(s,a,u){var f=s.updateQueue;if(f===null)return null;if(f=f.shared,(Dt&2)!==0){var m=f.pending;return m===null?a.next=a:(a.next=m.next,m.next=a),f.pending=a,a=la(s),Tl(s,null,u),a}return oa(s,f,a,u),la(s)}function ca(s,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var f=a.lanes;f&=s.pendingLanes,u|=f,a.lanes=u,D(s,u)}}function io(s,a){var u=s.updateQueue,f=s.alternate;if(f!==null&&(f=f.updateQueue,u===f)){var m=null,x=null;if(u=u.firstBaseUpdate,u!==null){do{var R={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};x===null?m=x=R:x=x.next=R,u=u.next}while(u!==null);x===null?m=x=a:x=x.next=a}else m=x=a;u={baseState:f.baseState,firstBaseUpdate:m,lastBaseUpdate:x,shared:f.shared,callbacks:f.callbacks},s.updateQueue=u;return}s=u.lastBaseUpdate,s===null?u.firstBaseUpdate=a:s.next=a,u.lastBaseUpdate=a}function Rr(){if(f0){var s=Mo;if(s!==null)throw s}}function ua(s,a,u,f){f0=!1;var m=s.updateQueue;Br=!1;var x=m.firstBaseUpdate,R=m.lastBaseUpdate,k=m.shared.pending;if(k!==null){m.shared.pending=null;var ne=k,me=ne.next;ne.next=null,R===null?x=me:R.next=me,R=ne;var _e=s.alternate;_e!==null&&(_e=_e.updateQueue,k=_e.lastBaseUpdate,k!==R&&(k===null?_e.firstBaseUpdate=me:k.next=me,_e.lastBaseUpdate=ne))}if(x!==null){var Ue=m.baseState;R=0,_e=me=ne=null,k=x;do{var Xe=k.lane&-536870913,Pt=Xe!==k.lane;if(Pt?(Ot&Xe)===Xe:(f&Xe)===Xe){Xe!==0&&Xe===ga&&(f0=!0),_e!==null&&(_e=_e.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var Vt=s,Gr=k;Xe=a;var wa=u;switch(Gr.tag){case 1:if(Vt=Gr.payload,typeof Vt=="function"){Ue=Vt.call(wa,Ue,Xe);break e}Ue=Vt;break e;case 3:Vt.flags=Vt.flags&-65537|128;case 0:if(Vt=Gr.payload,Xe=typeof Vt=="function"?Vt.call(wa,Ue,Xe):Vt,Xe==null)break e;Ue=kp({},Ue,Xe);break e;case 2:Br=!0}}Xe=k.callback,Xe!==null&&(s.flags|=64,Pt&&(s.flags|=8192),Pt=m.callbacks,Pt===null?m.callbacks=[Xe]:Pt.push(Xe))}else Pt={lane:Xe,tag:k.tag,payload:k.payload,callback:k.callback,next:null},_e===null?(me=_e=Pt,ne=Ue):_e=_e.next=Pt,R|=Xe;if(k=k.next,k===null){if(k=m.shared.pending,k===null)break;Pt=k,k=Pt.next,Pt.next=null,m.lastBaseUpdate=Pt,m.shared.pending=null}}while(!0);_e===null&&(ne=Ue),m.baseState=ne,m.firstBaseUpdate=me,m.lastBaseUpdate=_e,x===null&&(m.shared.lanes=0),Hr|=R,s.lanes=R,s.memoizedState=Ue}}function cu(s,a){if(typeof s!="function")throw Error(r(191,s));s.call(a)}function uu(s,a){var u=s.callbacks;if(u!==null)for(s.callbacks=null,s=0;s<u.length;s++)cu(u[s],a)}function El(s,a){s=cr,y(Xu,s),y(zr,a),cr=s|a.baseLanes}function L(){y(Xu,cr),y(zr,zr.current)}function V(){cr=Xu.current,_(zr),_(Xu)}function te(s){var a=s.alternate;y(ai,ai.current&1),y(ri,s),yi===null&&(a===null||zr.current!==null||a.memoizedState!==null)&&(yi=s)}function j(s){y(ai,ai.current),y(ri,s),yi===null&&(yi=s)}function K(s){s.tag===22?(y(ai,ai.current),y(ri,s),yi===null&&(yi=s)):Me()}function Me(){y(ai,ai.current),y(ri,ri.current)}function Oe(s){_(ri),yi===s&&(yi=null),_(ai)}function Ee(s,a){y(ri,ri.current),y(ai,a)}function ze(s){_(ai),_(ri),yi===s&&(yi=null)}function Ke(s){for(var a=s;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||Jp(u)||Kp(u)))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!=="independent"){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}function Ye(){throw Error(r(321))}function At(s,a){if(a===null)return!1;for(var u=0;u<a.length&&u<s.length;u++)if(!qi(s[u],a[u]))return!1;return!0}function Ze(s,a,u,f,m,x){return lr=x,wt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,ct.H=s===null||s.memoizedState===null?w_:T_,ya=!1,x=u(f,m),ya=!1,Ao&&(x=vn(a,u,f,m)),Ct(s),x}function Ct(s){ct.H=Yu;var a=sn!==null&&sn.next!==null;if(lr=0,Dn=sn=wt=null,qu=!1,ql=0,Co=null,a)throw Error(r(300));s===null||Un||(s=s.dependencies,s!==null&&un(s)&&(Un=!0))}function vn(s,a,u,f){wt=s;var m=0;do{if(Ao&&(Co=null),ql=0,Ao=!1,25<=m)throw Error(r(301));if(m+=1,Dn=sn=null,s.updateQueue!=null){var x=s.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}ct.H=X4,x=a(u,f)}while(Ao);return x}function nn(){var s=ct.H,a=s.useState()[0];return a=typeof a.then=="function"?Tn(a):a,s=s.useState()[0],(sn!==null?sn.memoizedState:null)!==s&&(wt.flags|=1024),a}function jt(){var s=$u!==0;return $u=0,s}function Nn(s,a,u){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~u}function je(s){if(qu){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}qu=!1}lr=0,Dn=sn=wt=null,Ao=!1,ql=$u=0,Co=null}function Jt(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Dn===null?wt.memoizedState=Dn=s:Dn=Dn.next=s,Dn}function lt(){if(sn===null){var s=wt.alternate;s=s!==null?s.memoizedState:null}else s=sn.next;var a=Dn===null?wt.memoizedState:Dn.next;if(a!==null)Dn=a,sn=s;else{if(s===null)throw wt.alternate===null?Error(r(467)):Error(r(310));sn=s,s={memoizedState:sn.memoizedState,baseState:sn.baseState,baseQueue:sn.baseQueue,queue:sn.queue,next:null},Dn===null?wt.memoizedState=Dn=s:Dn=Dn.next=s}return Dn}function es(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Tn(s){var a=ql;return ql+=1,Co===null&&(Co=[]),s=St(Co,s,a),a=wt,(Dn===null?a.memoizedState:Dn.next)===null&&(a=a.alternate,ct.H=a===null||a.memoizedState===null?w_:T_),s}function tr(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Tn(s);if(s.$$typeof===Wb)return;if(s.$$typeof===sr)return xt(s)}throw Error(r(438,String(s)))}function ts(s){var a=null,u=wt.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var f=wt.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(a={data:f.data.map(function(m){return m.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=es(),wt.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(s),f=0;f<s;f++)u[f]=Gb;return a.index++,u}function ei(s,a){return typeof a=="function"?a(s):a}function It(s){var a=lt();return In(a,sn,s)}function In(s,a,u){var f=s.queue;if(f===null)throw Error(r(311));f.lastRenderedReducer=u;var m=s.baseQueue,x=f.pending;if(x!==null){if(m!==null){var R=m.next;m.next=x.next,x.next=R}a.baseQueue=m=x,f.pending=null}if(x=s.baseState,m===null)s.memoizedState=x;else{a=m.next;var k=R=null,ne=null,me=a,_e=!1;do{var Ue=me.lane&-536870913;if(Ue!==me.lane?(Ot&Ue)===Ue:(lr&Ue)===Ue){var Xe=me.revertLane;if(Xe===0)ne!==null&&(ne=ne.next={lane:0,revertLane:0,gesture:null,action:me.action,hasEagerState:me.hasEagerState,eagerState:me.eagerState,next:null}),Ue===ga&&(_e=!0);else if((lr&Xe)===Xe){me=me.next,Xe===ga&&(_e=!0);continue}else Ue={lane:0,revertLane:me.revertLane,gesture:null,action:me.action,hasEagerState:me.hasEagerState,eagerState:me.eagerState,next:null},ne===null?(k=ne=Ue,R=x):ne=ne.next=Ue,wt.lanes|=Xe,Hr|=Xe;Ue=me.action,ya&&u(x,Ue),x=me.hasEagerState?me.eagerState:u(x,Ue)}else Xe={lane:Ue,revertLane:me.revertLane,gesture:me.gesture,action:me.action,hasEagerState:me.hasEagerState,eagerState:me.eagerState,next:null},ne===null?(k=ne=Xe,R=x):ne=ne.next=Xe,wt.lanes|=Ue,Hr|=Ue;me=me.next}while(me!==null&&me!==a);if(ne===null?R=x:ne.next=k,!qi(x,s.memoizedState)&&(Un=!0,_e&&(u=Mo,u!==null)))throw u;s.memoizedState=x,s.baseState=R,s.baseQueue=ne,f.lastRenderedState=x}return m===null&&(f.lanes=0),[s.memoizedState,f.dispatch]}function xi(s){var a=lt(),u=a.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=s;var f=u.dispatch,m=u.pending,x=a.memoizedState;if(m!==null){u.pending=null;var R=m=m.next;do x=s(x,R.action),R=R.next;while(R!==m);qi(x,a.memoizedState)||(Un=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),u.lastRenderedState=x}return[x,f]}function ln(s,a,u){var f=wt,m=lt(),x=Rt;if(x){if(u===void 0)throw Error(r(407));u=u()}else u=a();var R=!qi((sn||m).memoizedState,u);if(R&&(m.memoizedState=u,Un=!0),m=m.queue,Xd(Al.bind(null,f,m,s),[s]),s=m.getSnapshot!==a||R||Dn!==null&&(Dn.memoizedState.tag&1)!==0,so(s?9:8,{destroy:void 0},ns.bind(null,f,m,u,a),null),s){if(f.flags|=2048,rn===null)throw Error(r(349));x||(lr&127)!==0||Pn(f,a,u)}return u}function Pn(s,a,u){s.flags|=16384,s={getSnapshot:a,value:u},a=wt.updateQueue,a===null?(a=es(),wt.updateQueue=a,a.stores=[s]):(u=a.stores,u===null?a.stores=[s]:u.push(s))}function ns(s,a,u,f){a.value=u,a.getSnapshot=f,Zg(a)&&jg(s)}function Al(s,a,u){return u(function(){Zg(a)&&jg(s)})}function Zg(s){var a=s.getSnapshot;s=s.value;try{var u=a();return!qi(s,u)}catch{return!0}}function jg(s){var a=xs(s,2);a!==null&&Ei(a,s,2)}function Gd(s){var a=Jt();if(typeof s=="function"){var u=s;if(s=u(),ya){z(!0);try{u()}finally{z(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:s},a}function Jg(s,a,u,f){return s.baseState=u,In(s,sn,typeof f=="function"?f:ei)}function pb(s,a,u,f,m){if(du(s))throw Error(r(485));if(s=a.action,s!==null){var x={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(R){x.listeners.push(R)}};ct.T!==null?u(!0):x.isTransition=!1,f(x),u=a.pending,u===null?(x.next=a.pending=x,Kg(a,x)):(x.next=u.next,a.pending=u.next=x)}}function Kg(s,a){var u=a.action,f=a.payload,m=s.state;if(a.isTransition){var x=ct.T,R={};R.types=x!==null?x.types:null,ct.T=R;try{var k=u(m,f),ne=ct.S;ne!==null&&ne(R,k),Qg(s,a,k)}catch(me){Wd(s,a,me)}finally{x!==null&&R.types!==null&&(x.types=R.types),ct.T=x}}else try{x=u(m,f),Qg(s,a,x)}catch(me){Wd(s,a,me)}}function Qg(s,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(f){e1(s,a,f)},function(f){return Wd(s,a,f)}):e1(s,a,u)}function e1(s,a,u){a.status="fulfilled",a.value=u,t1(a),s.state=u,a=s.pending,a!==null&&(u=a.next,u===a?s.pending=null:(u=u.next,a.next=u,Kg(s,u)))}function Wd(s,a,u){var f=s.pending;if(s.pending=null,f!==null){f=f.next;do a.status="rejected",a.reason=u,t1(a),a=a.next;while(a!==f)}s.action=null}function t1(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function n1(s,a){return a}function i1(s,a){if(Rt){var u=rn.formState;if(u!==null){e:{var f=wt;if(Rt){if(mn){var m=jM(mn,os);if(m){mn=o_(m),f=JM(m);break e}}pt(f)}f=!1}f&&(a=u[0])}}u=Jt(),u.memoizedState=u.baseState=a,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n1,lastRenderedState:a},u.queue=f,u=S1.bind(null,wt,f),f.dispatch=u,f=Gd(!1);var x=Zd.bind(null,wt,!1,f.queue);return f=Jt(),m={state:a,dispatch:null,action:s,pending:null},f.queue=m,u=pb.bind(null,wt,m,x,u),m.dispatch=u,f.memoizedState=s,[a,u,!1]}function s1(s){var a=lt();return r1(a,sn,s)}function r1(s,a,u){if(a=In(s,a,n1)[0],s=It(ei)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var f=Tn(a)}catch(R){throw R===wo?Gu:R}else f=a;a=lt();var m=a.queue,x=m.dispatch;return u!==a.memoizedState&&(wt.flags|=2048,so(9,{destroy:void 0},mb.bind(null,m,u),null)),[f,x,s]}function mb(s,a){s.action=a}function a1(s){var a=lt(),u=sn;if(u!==null)return r1(a,u,s);lt(),a=a.memoizedState,u=lt();var f=u.queue.dispatch;return u.memoizedState=s,[a,f,!1]}function so(s,a,u,f){return s={tag:s,create:u,deps:f,inst:a,next:null},a=wt.updateQueue,a===null&&(a=es(),wt.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=s.next=s:(f=u.next,u.next=s,s.next=f,a.lastEffect=s),s}function o1(){return lt().memoizedState}function hu(s,a,u,f){var m=Jt();wt.flags|=s,m.memoizedState=so(1|a,{destroy:void 0},u,f===void 0?null:f)}function fu(s,a,u,f){var m=lt();f=f===void 0?null:f;var x=m.memoizedState.inst;sn!==null&&f!==null&&At(f,sn.memoizedState.deps)?m.memoizedState=so(a,x,u,f):(wt.flags|=s,m.memoizedState=so(1|a,x,u,f))}function l1(s,a){hu(8390656,8,s,a)}function Xd(s,a){fu(2048,8,s,a)}function gb(s){wt.flags|=4;var a=wt.updateQueue;if(a===null)a=es(),wt.updateQueue=a,a.events=[s];else{var u=a.events;u===null?a.events=[s]:u.push(s)}}function c1(s){var a=lt().memoizedState;return gb({ref:a,nextImpl:s}),function(){if((Dt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function u1(s,a){return fu(4,2,s,a)}function h1(s,a){return fu(4,4,s,a)}function f1(s,a){if(typeof a=="function"){s=s();var u=a(s);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function d1(s,a,u){u=u!=null?u.concat([s]):null,fu(4,4,f1.bind(null,a,s),u)}function qd(){}function p1(s,a){var u=lt();a=a===void 0?null:a;var f=u.memoizedState;return a!==null&&At(a,f[1])?f[0]:(u.memoizedState=[s,a],s)}function m1(s,a){var u=lt();a=a===void 0?null:a;var f=u.memoizedState;if(a!==null&&At(a,f[1]))return f[0];if(f=s(),ya){z(!0);try{s()}finally{z(!1)}}return u.memoizedState=[f,a],f}function $d(s,a,u){return u===void 0||(lr&1073741824)!==0&&(Ot&261930)===0?s.memoizedState=a:(s.memoizedState=u,s=Sv(),wt.lanes|=s,Hr|=s,u)}function g1(s,a,u,f){return qi(u,a)?u:zr.current!==null?(s=$d(s,u,f),qi(s,a)||(Un=!0),s):(lr&106)===0||(lr&1073741824)!==0&&(Ot&261930)===0?(Un=!0,s.memoizedState=u):(s=Sv(),wt.lanes|=s,Hr|=s,a)}function v1(s,a,u,f,m){var x=rr();$n(x!==0&&8>x?x:8);var R=ct.T,k={};k.types=R!==null?R.types:null,ct.T=k,Zd(s,!1,a,u);try{var ne=m(),me=ct.S;if(me!==null&&me(k,ne),ne!==null&&typeof ne=="object"&&typeof ne.then=="function"){var _e=be(ne,f);Cl(s,a,_e,Vi(s))}else Cl(s,a,f,Vi(s))}catch(Ue){Cl(s,a,{then:function(){},status:"rejected",reason:Ue},Vi())}finally{$n(x),R!==null&&k.types!==null&&(R.types=k.types),ct.T=R}}function _1(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:mo,baseState:mo,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:mo},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function Yd(){return xt(ar)}function x1(){return lt().memoizedState}function y1(){return lt().memoizedState}function vb(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=Vi();s=ys(u);var f=Ti(a,s,u);f!==null&&(Ei(f,a,u),ca(f,a,u)),a={cache:st()},s.payload=a;return}a=a.return}}function _b(s,a,u){var f=Vi();u={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},du(s)?b1(a,u):(u=_s(s,a,u,f),u!==null&&(Ei(u,s,f),M1(u,a,f)))}function S1(s,a,u){var f=Vi();Cl(s,a,u,f)}function Cl(s,a,u,f){var m={lane:f,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(du(s))b1(a,m);else{var x=s.alternate;if(s.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var R=a.lastRenderedState,k=x(R,u);if(m.hasEagerState=!0,m.eagerState=k,qi(k,R))return oa(s,a,m,0),rn===null&&aa(),!1}catch{}finally{}if(u=_s(s,a,m,f),u!==null)return Ei(u,s,f),M1(u,a,f),!0}return!1}function Zd(s,a,u,f){if(f={lane:2,revertLane:le(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},du(s)){if(a)throw Error(r(479))}else a=_s(s,u,f,2),a!==null&&Ei(a,s,2)}function du(s){var a=s.alternate;return s===wt||a!==null&&a===wt}function b1(s,a){Ao=qu=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function M1(s,a,u){if((u&4194048)!==0){var f=a.lanes;f&=s.pendingLanes,u|=f,a.lanes=u,D(s,u)}}function jd(s,a,u,f){a=s.memoizedState,u=u(f,a),u=u==null?a:kp({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}function w1(s,a,u,f,m,x,R){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(f,x,R):a.prototype&&a.prototype.isPureReactComponent?!ve(u,f)||!ve(m,x):!0}function T1(s,a,u,f){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,f),a.state!==s&&d0.enqueueReplaceState(a,a.state,null)}function ha(s,a){var u=a;if("ref"in a){u={};for(var f in a)f!=="ref"&&(u[f]=a[f])}if(s=s.defaultProps){u===a&&(u=kp({},u));for(var m in s)u[m]===void 0&&(u[m]=s[m])}return u}function pu(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(f){setTimeout(function(){throw f})}}function E1(s,a,u){try{var f=s.onCaughtError;f(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function Jd(s,a,u){return u=ys(u),u.tag=3,u.payload={element:null},u.callback=function(){pu(s,a)},u}function A1(s){return s=ys(s),s.tag=3,s}function C1(s,a,u,f){var m=u.type.getDerivedStateFromError;if(typeof m=="function"){var x=f.value;s.payload=function(){return m(x)},s.callback=function(){E1(a,u,f)}}var R=u.stateNode;R!==null&&typeof R.componentDidCatch=="function"&&(s.callback=function(){E1(a,u,f),typeof m!="function"&&(Vr===null?Vr=new Set([this]):Vr.add(this));var k=f.stack;this.componentDidCatch(f.value,{componentStack:k!==null?k:""})})}function xb(s,a,u,f,m){if(u.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(a=u.alternate,a!==null&&G(a,u,m,!0),u=ri.current,u!==null){switch(u.tag){case 31:case 13:case 19:return yi===null?Au():u.alternate===null&&En===0&&(En=3),u.flags&=-257,u.flags|=65536,u.lanes=m,f===Wu?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([f]):a.add(f),Up(s,f,m)),!1;case 22:return u.flags|=65536,f===Wu?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([f])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([f]):u.add(f)),Up(s,f,m)),!1}throw Error(r(435,u.tag))}return Up(s,f,m),Au(),!1}if(Rt)return a=ri.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=m,f!==a0&&(s=Error(r(422),{cause:f}),ht(qe(s,u)))):(f!==a0&&(a=Error(r(423),{cause:f}),ht(qe(a,u))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,f=qe(f,u),m=Jd(s.stateNode,f,m),io(s,m),En!==4&&(En=2)),!1;var x=Error(r(520),{cause:f});if(x=qe(x,u),Zl===null?Zl=[x]:Zl.push(x),En!==4&&(En=2),a===null)return!0;f=qe(f,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=m&-m,u.lanes|=s,s=Jd(u.stateNode,f,s),io(u,s),!1;case 1:if(a=u.type,x=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Vr===null||!Vr.has(x))))return u.flags|=65536,m&=-m,u.lanes|=m,m=A1(m),C1(m,s,u,f),io(u,m),!1;break;case 22:if(u.memoizedState!==null)return u.flags|=65536,!1}u=u.return}while(u!==null);return!1}function kn(s,a,u,f){a.child=s===null?M_(a,null,u,f):xa(a,s.child,u,f)}function R1(s,a,u,f,m){u=u.render;var x=a.ref;if("ref"in f){var R={};for(var k in f)k!=="ref"&&(R[k]=f[k])}else R=f;return vt(a),f=Ze(s,a,u,R,x,m),k=jt(),s!==null&&!Un?(Nn(s,a,m),nr(s,a,m)):(Rt&&k&&Be(a),a.flags|=1,kn(s,a,f,m),a.child)}function I1(s,a,u,f,m){if(s===null){var x=u.type;return typeof x=="function"&&!Fp(x)&&x.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=x,P1(s,a,x,f,m)):(s=Ru(u.type,null,f,a,a.mode,m),s.ref=a.ref,s.return=a,a.child=s)}if(x=s.child,!sp(s,m)){var R=x.memoizedProps;if(u=u.compare,u=u!==null?u:ve,u(R,f)&&s.ref===a.ref)return nr(s,a,m)}return a.flags|=1,s=ir(x,f),s.ref=a.ref,s.return=a,a.child=s}function P1(s,a,u,f,m){if(s!==null){var x=s.memoizedProps;if(ve(x,f)&&s.ref===a.ref)if(Un=!1,a.pendingProps=f=x,sp(s,m))(s.flags&131072)!==0&&(Un=!0);else return a.lanes=s.lanes,nr(s,a,m)}return Kd(s,a,u,f,m)}function L1(s,a,u,f){var m=f.children,x=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|u:u,s!==null){for(f=a.child=s.child,m=0;f!==null;)m=m|f.lanes|f.childLanes,f=f.sibling;f=m&~x}else f=0,a.child=null;return N1(s,a,x,u,f)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Qe(a,x!==null?x.cachePool:null),x!==null?El(a,x):L(),K(a);else return f=a.lanes=536870912,N1(s,a,x!==null?x.baseLanes|u:u,u,f)}else x!==null?(Qe(a,x.cachePool),El(a,x),Me(),a.memoizedState=null):(s!==null&&Qe(a,null),L(),Me());return kn(s,a,m,u),a.child}function Rl(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function N1(s,a,u,f,m){var x=Te();return x=x===null?null:{parent:Bs?yn._currentValue:yn._currentValue2,pool:x},a.memoizedState={baseLanes:u,cachePool:x},s!==null&&Qe(a,null),L(),K(a),s!==null&&G(s,a,f,!0),a.childLanes=m,null}function mu(s,a){return a=gu({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function D1(s,a,u){return xa(a,s.child,null,u),s=mu(a,a.pendingProps),s.flags|=2,Oe(a),a.memoizedState=null,s}function yb(s,a,u){var f=a.pendingProps,m=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(Rt){if(f.mode==="hidden")return s=mu(a,f),a.lanes=536870912,s.memoizedState={baseLanes:0,cachePool:null},Rl(null,s);if(j(a),(s=mn)?(s=a4(s,os),s!==null&&(a.memoizedState={dehydrated:s,treeContext:Ur!==null?{id:ks,overflow:Hs}:null,retryLane:536870912,hydrationErrors:null},u=Ov(s),u.return=a,a.child=u,Yn=a,mn=null)):s=null,s===null)throw pt(a);return a.lanes=536870912,null}return mu(a,f)}var x=s.memoizedState;if(x!==null){var R=x.dehydrated;if(j(a),m)if(a.flags&256)a.flags&=-257,a=D1(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(r(558));else if(Un||G(s,a,u,!1),m=(u&s.childLanes)!==0,Un||m){if(zr.current===null){if(f=rn,f!==null&&(R=B(f,u),R!==0&&R!==x.retryLane))throw x.retryLane=R,xs(s,R),Ei(f,s,R),p0;Au()}a=D1(s,a,u)}else s=x.treeContext,ii&&(mn=t4(R),Yn=a,Rt=!0,Or=null,os=!1,s!==null&&Ce(a,s)),a=mu(a,f),a.flags|=134221824;return a}return s=ir(s.child,{mode:f.mode,children:f.children}),s.ref=a.ref,a.child=s,s.return=a,s}function ro(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function Kd(s,a,u,f,m){return vt(a),u=Ze(s,a,u,f,void 0,m),f=jt(),s!==null&&!Un?(Nn(s,a,m),nr(s,a,m)):(Rt&&f&&Be(a),a.flags|=1,kn(s,a,u,m),a.child)}function U1(s,a,u,f,m,x){return vt(a),a.updateQueue=null,u=vn(a,f,u,m),Ct(s),f=jt(),s!==null&&!Un?(Nn(s,a,x),nr(s,a,x)):(Rt&&f&&Be(a),a.flags|=1,kn(s,a,u,x),a.child)}function F1(s,a,u,f,m){if(vt(a),a.stateNode===null){var x=_o,R=u.contextType;typeof R=="object"&&R!==null&&(x=xt(R)),x=new u(f,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=d0,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=f,x.state=a.memoizedState,x.refs={},Cr(a),R=u.contextType,x.context=typeof R=="object"&&R!==null?xt(R):_o,x.state=a.memoizedState,R=u.getDerivedStateFromProps,typeof R=="function"&&(jd(a,u,R,f),x.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(R=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),R!==x.state&&d0.enqueueReplaceState(x,x.state,null),ua(a,f,x,m),Rr(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),f=!0}else if(s===null){x=a.stateNode;var k=a.memoizedProps,ne=ha(u,k);x.props=ne;var me=x.context,_e=u.contextType;R=_o,typeof _e=="object"&&_e!==null&&(R=xt(_e));var Ue=u.getDerivedStateFromProps;_e=typeof Ue=="function"||typeof x.getSnapshotBeforeUpdate=="function",k=a.pendingProps!==k,_e||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(k||me!==R)&&T1(a,x,f,R),Br=!1;var Xe=a.memoizedState;x.state=Xe,ua(a,f,x,m),Rr(),me=a.memoizedState,k||Xe!==me||Br?(typeof Ue=="function"&&(jd(a,u,Ue,f),me=a.memoizedState),(ne=Br||w1(a,u,ne,f,Xe,me,R))?(_e||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=me),x.props=f,x.state=me,x.context=R,f=ne):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{x=a.stateNode,no(s,a),R=a.memoizedProps,_e=ha(u,R),x.props=_e,Ue=a.pendingProps,Xe=x.context,me=u.contextType,ne=_o,typeof me=="object"&&me!==null&&(ne=xt(me)),k=u.getDerivedStateFromProps,(me=typeof k=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(R!==Ue||Xe!==ne)&&T1(a,x,f,ne),Br=!1,Xe=a.memoizedState,x.state=Xe,ua(a,f,x,m),Rr();var Pt=a.memoizedState;R!==Ue||Xe!==Pt||Br||s!==null&&s.dependencies!==null&&un(s.dependencies)?(typeof k=="function"&&(jd(a,u,k,f),Pt=a.memoizedState),(_e=Br||w1(a,u,_e,f,Xe,Pt,ne)||s!==null&&s.dependencies!==null&&un(s.dependencies))?(me||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(f,Pt,ne),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(f,Pt,ne)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||R===s.memoizedProps&&Xe===s.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||R===s.memoizedProps&&Xe===s.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=Pt),x.props=f,x.state=Pt,x.context=ne,f=_e):(typeof x.componentDidUpdate!="function"||R===s.memoizedProps&&Xe===s.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||R===s.memoizedProps&&Xe===s.memoizedState||(a.flags|=1024),f=!1)}return x=f,ro(s,a),f=(a.flags&128)!==0,x||f?(x=a.stateNode,u=f&&typeof u.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,s!==null&&f?(a.child=xa(a,s.child,null,m),a.child=xa(a,null,u,m)):kn(s,a,u,m),a.memoizedState=x.state,s=a.child):s=nr(s,a,m),s}function O1(s,a,u,f){return ke(),a.flags|=256,kn(s,a,u,f),a.child}function Qd(s){return{baseLanes:s,cachePool:Mt()}}function ep(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=Zi),s}function B1(s,a,u){var f=a.pendingProps,m=!1,x=(a.flags&128)!==0,R;if((R=x)||(R=s!==null&&s.memoizedState===null?!1:(ai.current&2)!==0),R&&(m=!0,a.flags&=-129),R=(a.flags&32)!==0,a.flags&=-33,s===null){if(Rt){if(m?te(a):Me(),(s=mn)?(s=o4(s,os),s!==null&&(a.memoizedState={dehydrated:s,treeContext:Ur!==null?{id:ks,overflow:Hs}:null,retryLane:536870912,hydrationErrors:null},u=Ov(s),u.return=a,a.child=u,Yn=a,mn=null)):s=null,s===null)throw pt(a);return Kp(s)?a.lanes=32:a.lanes=536870912,null}return x=f.children,f=f.fallback,m?(Me(),m=a.mode,x=gu({mode:"hidden",children:x},m),f=fa(f,m,u,null),x.return=a,f.return=a,x.sibling=f,a.child=x,f=a.child,f.memoizedState=Qd(u),f.childLanes=ep(s,R,u),a.memoizedState=m0,Rl(null,f)):(te(a),tp(a,x))}var k=s.memoizedState;if(k!==null){var ne=k.dehydrated;if(ne!==null)return Sb(s,a,x,R,f,ne,k,u)}return m?(Me(),m=f.fallback,x=a.mode,k=s.child,ne=k.sibling,f=ir(k,{mode:"hidden",children:f.children}),f.subtreeFlags=k.subtreeFlags&1206910976,ne!==null?m=ir(ne,m):(m=fa(m,x,u,null),m.flags|=2),m.return=a,f.return=a,f.sibling=m,a.child=f,Rl(null,f),f=a.child,m=s.child.memoizedState,m===null?m=Qd(u):(x=m.cachePool,x!==null?(k=Bs?yn._currentValue:yn._currentValue2,x=x.parent!==k?{parent:k,pool:k}:x):x=Mt(),m={baseLanes:m.baseLanes|u,cachePool:x}),f.memoizedState=m,f.childLanes=ep(s,R,u),a.memoizedState=m0,Rl(s.child,f)):(te(a),u=s.child,s=u.sibling,u=ir(u,{mode:"visible",children:f.children}),u.return=a,u.sibling=null,s!==null&&(R=a.deletions,R===null?(a.deletions=[s],a.flags|=16):R.push(s)),a.child=u,a.memoizedState=null,u)}function tp(s,a){return a=gu({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function gu(s,a){return s=t(22,s,null,a),s.lanes=0,s}function vu(s,a,u){return xa(a,s.child,null,u),s=tp(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function Sb(s,a,u,f,m,x,R,k){if(u)return a.flags&256?(te(a),a.flags&=-257,vu(s,a,k)):a.memoizedState!==null?(Me(),a.child=s.child,a.flags|=128,null):(Me(),x=m.fallback,R=a.mode,m=gu({mode:"visible",children:m.children},R),x=fa(x,R,k,null),x.flags|=2,m.return=a,x.return=a,m.sibling=x,a.child=m,xa(a,s.child,null,k),m=a.child,m.memoizedState=Qd(k),m.childLanes=ep(s,f,k),a.memoizedState=m0,Rl(null,m));if(te(a),Kp(x))return f=YM(x).digest,f!==""&&(m=Error(r(419)),m.stack="",m.digest=f,ht({value:m,source:null,stack:null})),vu(s,a,k);if(Un||G(s,a,k,!1),f=(k&s.childLanes)!==0,Un||f){if(zr.current!==null)return vu(s,a,k);if(f=rn,f!==null&&(m=B(f,k),m!==0&&m!==R.retryLane))throw R.retryLane=m,xs(s,m),Ei(f,s,m),p0;return Jp(x)||Au(),vu(s,a,k)}return Jp(x)?(a.flags|=192,a.child=s.child,null):(s=R.treeContext,ii&&(mn=n4(x),Yn=a,Rt=!0,Or=null,os=!1,s!==null&&Ce(a,s)),a=tp(a,m.children),a.flags|=134221824,a)}function z1(s,a,u){s.lanes|=a;var f=s.alternate;f!==null&&(f.lanes|=a),Tt(s.return,a,u)}function k1(s){for(var a=null;s!==null;){var u=s.alternate;u!==null&&Ke(u)===null&&(a=s),s=s.sibling}return a}function _u(s,a,u,f,m,x){var R=s.memoizedState;R===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:u,tailMode:m,treeForkCount:x}:(R.isBackwards=a,R.rendering=null,R.renderingStartTime=0,R.last=f,R.tail=u,R.tailMode=m,R.treeForkCount=x)}function np(s){var a=s.child;for(s.child=null;a!==null;){var u=a.sibling;a.sibling=s.child,s.child=a,a=u}}function ip(s,a,u){var f=a.pendingProps,m=f.revealOrder,x=f.tail;f=f.children;var R=ai.current;if(a.flags&128)return Ee(a,R),null;var k=(R&2)!==0;if(k?(R=R&1|2,a.flags|=128):R&=1,Ee(a,R),m==="backwards"&&s!==null?(np(s),kn(s,a,f,u),np(s)):kn(s,a,f,u),f=Rt?Hl:0,!k&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&z1(s,u,a);else if(s.tag===19)z1(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(m){case"backwards":u=k1(a.child),u===null?(m=a.child,a.child=null):(m=u.sibling,u.sibling=null,np(a)),_u(a,!0,m,null,x,f);break;case"unstable_legacy-backwards":for(u=null,m=a.child,a.child=null;m!==null;){if(s=m.alternate,s!==null&&Ke(s)===null){a.child=m;break}s=m.sibling,m.sibling=u,u=m,m=s}_u(a,!0,u,null,x,f);break;case"together":_u(a,!1,null,null,void 0,f);break;case"independent":a.memoizedState=null;break;default:u=k1(a.child),u===null?(m=a.child,a.child=null):(m=u.sibling,u.sibling=null),_u(a,!1,m,u,x,f)}return a.child}function H1(s,a,u){var f=a.pendingProps;return $e(a,a.type,f.value),kn(s,a,f.children,u),a.child}function nr(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),Hr|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(G(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(r(153));if(a.child!==null){for(s=a.child,u=ir(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=ir(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function sp(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&un(s)))}function bb(s,a,u){switch(a.tag){case 3:tt(a,a.stateNode.containerInfo),$e(a,yn,s.memoizedState.cache),ke();break;case 27:case 5:at(a);break;case 4:tt(a,a.stateNode.containerInfo);break;case 10:$e(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,j(a),null;break;case 13:var f=a.memoizedState;if(f!==null){if(f.dehydrated!==null)return te(a),a.flags|=128,null;f=G(s,a,u,!1);var m=a.child.childLanes;return f||(u&m)!==0?B1(s,a,u):(te(a),s=nr(s,a,u),s!==null?s.sibling:null)}te(a);break;case 19:if(a.flags&128)return ip(s,a,u);if(m=(s.flags&128)!==0,f=(u&a.childLanes)!==0,f||(G(s,a,u,!1),f=(u&a.childLanes)!==0),m){if(f)return ip(s,a,u);a.flags|=128}if(m=a.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),Ee(a,ai.current),f)break;return null;case 22:return a.lanes=0,L1(s,a,u,a.pendingProps);case 24:$e(a,yn,s.memoizedState.cache)}return nr(s,a,u)}function V1(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)Un=!0;else{if(!sp(s,u)&&(a.flags&128)===0)return Un=!1,bb(s,a,u);Un=(s.flags&131072)!==0}else Un=!1,Rt&&(a.flags&1048576)!==0&&xe(a,Hl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var f=a.pendingProps;if(s=De(a.elementType),a.type=s,typeof s=="function")Fp(s)?(f=ha(s,f),a.tag=1,a=F1(null,a,s,f,u)):(a.tag=0,a=Kd(null,a,s,f,u));else{if(s!=null){var m=s.$$typeof;if(m===Vp){a.tag=11,a=R1(null,a,s,f,u);break e}else if(m===Xp){a.tag=14,a=I1(null,a,s,f,u);break e}else if(m===sr){a.tag=10,a.type=s,a=H1(null,a,u);break e}}throw a=g(s)||s,Error(r(306,a,""))}}return a;case 0:return Kd(s,a,a.type,a.pendingProps,u);case 1:return f=a.type,m=ha(f,a.pendingProps),F1(s,a,f,m,u);case 3:e:{if(tt(a,a.stateNode.containerInfo),s===null)throw Error(r(387));var x=a.pendingProps;m=a.memoizedState,f=m.element,no(s,a),ua(a,x,null,u);var R=a.memoizedState;if(x=R.cache,$e(a,yn,x),x!==m.cache&&Ft(a,[yn],u,!0),Rr(),x=R.element,ii&&m.isDehydrated)if(m={element:x,isDehydrated:!1,cache:R.cache},a.updateQueue.baseState=m,a.memoizedState=m,a.flags&256){a=O1(s,a,x,u);break e}else if(x!==f){f=qe(Error(r(424)),a),ht(f),a=O1(s,a,x,u);break e}else for(ii&&(mn=e4(a.stateNode.containerInfo),Yn=a,Rt=!0,Or=null,os=!0),u=M_(a,null,x,u),a.child=u;u;)u.flags=u.flags&-3|134221824,u=u.sibling;else{if(ke(),x===f){a=nr(s,a,u);break e}kn(s,a,x,u)}a=a.child}return a;case 26:if(ss)return ro(s,a),s===null?(u=u_(a.type,null,a.pendingProps,null))?a.memoizedState=u:Rt||(a.stateNode=d_(a.type,a.pendingProps,Fr.current,a)):a.memoizedState=u_(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:if(xn)return at(a),s===null&&xn&&Rt&&(f=a.stateNode=m_(a.type,a.pendingProps,Fr.current,si.current,!1),Yn=a,os=!0,mn=i4(a.type,f,mn)),kn(s,a,a.pendingProps.children,u),ro(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&Rt&&(w4(a.type,a.pendingProps,si.current),(m=f=mn)&&(f=s4(f,a.type,a.pendingProps,os),f!==null?(a.stateNode=f,Yn=a,mn=QM(f),os=!1,m=!0):m=!1),m||pt(a)),at(a),m=a.type,x=a.pendingProps,R=s!==null?s.memoizedProps:null,f=x.children,Lu(m,x)?f=null:R!==null&&Lu(m,R)&&(a.flags|=32),a.memoizedState!==null&&(m=Ze(s,a,nn,null,null,u),Bs?ar._currentValue=m:ar._currentValue2=m),ro(s,a),kn(s,a,f,u),a.child;case 6:return s===null&&Rt&&(T4(a.pendingProps,si.current),(s=u=mn)&&(u=r4(u,a.pendingProps,os),u!==null?(a.stateNode=u,Yn=a,mn=null,s=!0):s=!1),s||pt(a)),null;case 13:return B1(s,a,u);case 4:return tt(a,a.stateNode.containerInfo),f=a.pendingProps,s===null?a.child=xa(a,null,f,u):kn(s,a,f,u),a.child;case 11:return R1(s,a,a.type,a.pendingProps,u);case 7:return f=a.pendingProps,ro(s,a),kn(s,a,f,u),a.child;case 8:return kn(s,a,a.pendingProps.children,u),a.child;case 12:return kn(s,a,a.pendingProps.children,u),a.child;case 10:return H1(s,a,u);case 9:return m=a.type._context,f=a.pendingProps.children,vt(a),m=xt(m),f=f(m),a.flags|=1,kn(s,a,f,u),a.child;case 14:return I1(s,a,a.type,a.pendingProps,u);case 15:return P1(s,a,a.type,a.pendingProps,u);case 19:return ip(s,a,u);case 31:return yb(s,a,u);case 22:return L1(s,a,u,a.pendingProps);case 24:return vt(a),f=xt(yn),s===null?(m=Te(),m===null&&(m=rn,x=st(),m.pooledCache=x,x.refCount++,x!==null&&(m.pooledCacheLanes|=u),m=x),a.memoizedState={parent:f,cache:m},Cr(a),$e(a,yn,m)):((s.lanes&u)!==0&&(no(s,a),ua(a,null,null,u),Rr()),m=s.memoizedState,x=a.memoizedState,m.parent!==f?(m={parent:f,cache:f},a.memoizedState=m,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=m),$e(a,yn,f)):(f=x.cache,$e(a,yn,f),f!==m.cache&&Ft(a,[yn],u,!0))),kn(s,a,a.pendingProps.children,u),a.child;case 30:return a.stateNode===null&&(a.stateNode={autoName:null,paired:null,clones:null,ref:null}),f=a.pendingProps,f.name!=null&&f.name!=="auto"?a.flags|=s===null?18882560:18874368:Rt&&Be(a),s!==null&&s.memoizedProps.name!==f.name?a.flags|=4194816:ro(s,a),kn(s,a,f.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Ss(s){s.flags|=4}function xu(s){zs&&(s.flags|=8)}function G1(s,a){if(s!==null&&s.child===a.child)return!1;if((a.flags&16)!==0)return!0;for(s=a.child;s!==null;){if((s.flags&8218)!==0||(s.subtreeFlags&8218)!==0)return!0;s=s.sibling}return!1}function rp(s,a,u,f){if(_n)for(u=a.child;u!==null;){if(u.tag===5||u.tag===6)Yp(s,u.stateNode);else if(!(u.tag===4||xn&&u.tag===27)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}else if(zs)for(var m=a.child;m!==null;){if(m.tag===5){var x=m.stateNode;u&&f&&(x=r_(x,m.type,m.memoizedProps)),Yp(s,x)}else if(m.tag===6)x=m.stateNode,u&&f&&(x=a_(x,m.memoizedProps)),Yp(s,x);else if(m.tag!==4){if(m.tag===22&&m.memoizedState!==null)x=m.child,x!==null&&(x.return=m),rp(s,m,!0,!0);else if(m.child!==null){m.child.return=m,m=m.child;continue}}if(m===a)break;for(;m.sibling===null;){if(m.return===null||m.return===a)return;m=m.return}m.sibling.return=m.return,m=m.sibling}}function W1(s,a,u,f){var m=!1;if(zs)for(var x=a.child;x!==null;){if(x.tag===5){var R=x.stateNode;u&&f&&(R=r_(R,x.type,x.memoizedProps)),i_(s,R)}else if(x.tag===6)R=x.stateNode,u&&f&&(R=a_(R,x.memoizedProps)),i_(s,R);else if(x.tag!==4){if(x.tag===22&&x.memoizedState!==null)m=x.child,m!==null&&(m.return=x),W1(s,x,!0,!0),m=!0;else if(x.child!==null){x.child.return=x,x=x.child;continue}}if(x===a)break;for(;x.sibling===null;){if(x.return===null||x.return===a)return m;x=x.return}x.sibling.return=x.return,x=x.sibling}return m}function X1(s,a){if(zs&&G1(s,a)){s=a.stateNode;var u=s.containerInfo,f=n_();W1(f,a,!1,!1),s.pendingChildren=f,Ss(a),$M(u,f)}}function ap(s,a,u,f){if(_n)s.memoizedProps!==f&&Ss(a);else if(zs){var m=s.stateNode,x=s.memoizedProps;if((s=G1(s,a))||x!==f){var R=si.current;x=qM(m,u,x,f,!s,null),x===m?a.stateNode=m:(xu(a),Yv(x,u,f,R)&&Ss(a),a.stateNode=x,s&&rp(x,a,!1,!1))}else a.stateNode=m}}function op(s,a,u,f,m){if((s.mode&32)!==0&&(u===null?aM(a,f):oM(a,u,f))){if(s.flags|=16777216,(m&335544128)===m||Zp(a,f))if(jv(s.stateNode,a,f))s.flags|=8192;else if(Ev())s.flags|=8192;else throw _a=Wu,u0}else s.flags&=-16777217}function q1(s,a){if(C4(a)){if(s.flags|=16777216,!p_(a))if(Ev())s.flags|=8192;else throw _a=Wu,u0}else s.flags&=-16777217}function yu(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?N():536870912,s.lanes|=a,Io|=a)}function Il(s,a){if(!Rt)switch(s.tailMode){case"visible":break;case"collapsed":for(var u=s.tail,f=null;u!==null;)u.alternate!==null&&(f=u),u=u.sibling;f===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:f.sibling=null;break;default:for(a=s.tail,u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null}}function cn(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,f=0;if(a)for(var m=s.child;m!==null;)u|=m.lanes|m.childLanes,f|=m.subtreeFlags&1206910976,f|=m.flags&1206910976,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)u|=m.lanes|m.childLanes,f|=m.subtreeFlags,f|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=f,s.childLanes=u,a}function Mb(s,a,u){var f=a.pendingProps;switch(et(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cn(a),null;case 1:return cn(a),null;case 3:return u=a.stateNode,f=null,s!==null&&(f=s.memoizedState.cache),a.memoizedState.cache!==f&&(a.flags|=2048),mt(yn),kt(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(ye(a)?Ss(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Ne())),X1(s,a),cn(a),null;case 26:if(ss){var m=a.type,x=a.memoizedState;return s===null?(Ss(a),x!==null?(cn(a),q1(a,x)):(cn(a),op(a,m,null,f,u))):x?x!==s.memoizedState?(Ss(a),cn(a),q1(a,x)):(cn(a),a.flags&=-16777217):(x=s.memoizedProps,_n?x!==f&&Ss(a):ap(s,a,m,f),cn(a),op(a,m,x,f,u)),null}case 27:if(xn){if(yt(a),u=Fr.current,m=a.type,s!==null&&a.stateNode!=null)_n?s.memoizedProps!==f&&Ss(a):ap(s,a,m,f);else{if(!f){if(a.stateNode===null)throw Error(r(166));return cn(a),a.subtreeFlags&=-33554433,null}s=si.current,ye(a)?de(a,s):(s=m_(m,f,u,s,!0),a.stateNode=s,Ss(a))}return cn(a),a.subtreeFlags&=-33554433,null}case 5:if(yt(a),m=a.type,s!==null&&a.stateNode!=null)ap(s,a,m,f);else{if(!f){if(a.stateNode===null)throw Error(r(166));return cn(a),a.subtreeFlags&=-33554433,null}if(x=si.current,ye(a))de(a,x),_4(a.stateNode,m,f,x)&&(a.flags|=64);else{var R=Kb(m,f,Fr.current,x,a);xu(a),rp(R,a,!1,!1),a.stateNode=R,Yv(R,m,f,x)&&Ss(a)}}return cn(a),a.subtreeFlags&=-33554433,op(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)u=s.memoizedProps,_n?u!==f&&Ss(a):zs&&(u!==f?(s=Fr.current,u=si.current,xu(a),a.stateNode=Zv(f,s,u,a)):a.stateNode=s.stateNode);else{if(typeof f!="string"&&a.stateNode===null)throw Error(r(166));if(s=Fr.current,u=si.current,ye(a)){if(!ii)throw Error(r(176));if(s=a.stateNode,u=a.memoizedProps,f=null,m=Yn,m!==null)switch(m.tag){case 27:case 5:f=m.memoizedProps}c4(s,u,a,f)||pt(a,!0)}else xu(a),a.stateNode=Zv(f,s,u,a)}return cn(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(f=ye(a),u!==null){if(s===null){if(!f)throw Error(r(318));if(!ii)throw Error(r(556));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));u4(s,a)}else ke(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;cn(a),s=!1}else u=Ne(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(Oe(a),a):(Oe(a),null);if((a.flags&128)!==0)throw Error(r(558))}return cn(a),null;case 13:if(f=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=ye(a),f!==null&&f.dehydrated!==null){if(s===null){if(!m)throw Error(r(318));if(!ii)throw Error(r(344));if(m=a.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(r(317));h4(m,a)}else ke(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;cn(a),m=!1}else m=Ne(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return a.flags&256?(Oe(a),a):(Oe(a),null)}return Oe(a),(a.flags&128)!==0?(a.lanes=u,a):(u=f!==null,s=s!==null&&s.memoizedState!==null,u&&(f=a.child,m=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(m=f.alternate.memoizedState.cachePool.pool),x=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(x=f.memoizedState.cachePool.pool),x!==m&&(f.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),yu(a,a.updateQueue),cn(a),null);case 4:return kt(),X1(s,a),s===null&&nM(a.stateNode.containerInfo),a.flags|=67108864,cn(a),null;case 10:return mt(a.type),cn(a),null;case 19:if(ze(a),f=a.memoizedState,f===null)return cn(a),null;if(m=(a.flags&128)!==0,x=f.rendering,x===null)if(m)Il(f,!1);else{if(En!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(x=Ke(s),x!==null){for(a.flags|=128,Il(f,!1),s=x.updateQueue,a.updateQueue=s,yu(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)Fv(u,s),u=u.sibling;return Ee(a,ai.current&1|2),Rt&&ie(a,f.treeForkCount),a.child}s=s.sibling}f.tail!==null&&Ai()>jl&&(a.flags|=128,m=!0,Il(f,!1),a.lanes=4194304)}else{if(!m)if(s=Ke(x),s!==null){if(a.flags|=128,m=!0,s=s.updateQueue,a.updateQueue=s,yu(a,s),Il(f,!0),f.tail===null&&f.tailMode!=="collapsed"&&f.tailMode!=="visible"&&!x.alternate&&!Rt)return cn(a),null}else 2*Ai()-f.renderingStartTime>jl&&u!==536870912&&(a.flags|=128,m=!0,Il(f,!1),a.lanes=4194304);f.isBackwards?(x.sibling=a.child,a.child=x):(s=f.last,s!==null?s.sibling=x:a.child=x,f.last=x)}if(f.tail!==null){s=f.tail;e:{for(u=s;u!==null;){if(u.alternate!==null){u=!1;break e}u=u.sibling}u=!0}return f.rendering=s,f.tail=s.sibling,f.renderingStartTime=Ai(),s.sibling=null,x=ai.current,x=m?x&1|2:x&1,f.tailMode==="visible"||f.tailMode==="collapsed"||!u||Rt?Ee(a,x):(u=x,y(ri,a),y(ai,u),yi===null&&(yi=a)),Rt&&ie(a,f.treeForkCount),s}return cn(a),null;case 22:case 23:return Oe(a),V(),f=a.memoizedState!==null,s!==null?s.memoizedState!==null!==f&&(a.flags|=8192):f&&(a.flags|=8192),f?(u&536870912)!==0&&(a.flags&128)===0&&(cn(a),a.subtreeFlags&6&&(a.flags|=8192)):cn(a),u=a.updateQueue,u!==null&&yu(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),f=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),f!==u&&(a.flags|=2048),s!==null&&_(va),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),mt(yn),cn(a),null;case 25:return null;case 30:return a.flags|=33554432,cn(a),null}throw Error(r(156,a.tag))}function wb(s,a){switch(et(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return mt(yn),kt(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return yt(a),null;case 31:if(a.memoizedState!==null){if(Oe(a),a.alternate===null)throw Error(r(340));ke()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Oe(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(r(340));ke()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return ze(a),s=a.flags,s&65536?(a.flags=s&-65537|128,s=a.memoizedState,s!==null&&(s.rendering=null,s.tail=null),a.flags|=4,a):null;case 4:return kt(),null;case 10:return mt(a.type),null;case 22:case 23:return Oe(a),V(),s!==null&&_(va),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return mt(yn),null;case 25:return null;default:return null}}function $1(s,a){switch(et(a),a.tag){case 3:mt(yn),kt();break;case 26:case 27:case 5:yt(a);break;case 4:kt();break;case 31:a.memoizedState!==null&&Oe(a);break;case 13:Oe(a);break;case 19:ze(a);break;case 10:mt(a.type);break;case 22:case 23:Oe(a),V(),s!==null&&_(va);break;case 24:mt(yn)}}function Pl(s,a){try{var u=a.updateQueue,f=u!==null?u.lastEffect:null;if(f!==null){var m=f.next;u=m;do{if((u.tag&s)===s){f=void 0;var x=u.create,R=u.inst;f=x(),R.destroy=f}u=u.next}while(u!==m)}}catch(k){qt(a,a.return,k)}}function Ir(s,a,u){try{var f=a.updateQueue,m=f!==null?f.lastEffect:null;if(m!==null){var x=m.next;f=x;do{if((f.tag&s)===s){var R=f.inst,k=R.destroy;if(k!==void 0){R.destroy=void 0,m=a;var ne=u,me=k;try{me()}catch(_e){qt(m,ne,_e)}}}f=f.next}while(f!==x)}}catch(_e){qt(a,a.return,_e)}}function Y1(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{uu(a,u)}catch(f){qt(s,s.return,f)}}}function Z1(s,a,u){u.props=ha(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(f){qt(s,a,f)}}function Us(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var f=Ol(s.stateNode);break;case 30:var m=s.stateNode,x=X(s.memoizedProps,m);(m.ref===null||m.ref.name!==x)&&(m.ref=e_(x)),f=m.ref;break;case 7:s.stateNode===null&&(s.stateNode=GM(s)),f=s.stateNode;break;default:f=s.stateNode}typeof u=="function"?s.refCleanup=u(f):u.current=f}}catch(R){qt(s,a,R)}}function ti(s,a){var u=s.ref,f=s.refCleanup;if(u!==null)if(typeof f=="function")try{f()}catch(m){qt(s,a,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(m){qt(s,a,m)}else u.current=null}function j1(){var s=ui;return ui=!1,s}function Ll(s,a){if((s.tag===5||s.tag===27||s.tag===6)&&s.alternate===null&&a!==null)for(var u=0;u<a.length;u++)t_(s.stateNode,a[u])}function J1(s){for(var a=s.return;a!==null&&(cp(a)&&t_(s.stateNode,a.stateNode),!lp(a));)a=a.return}function Nl(s){for(var a=s.return;a!==null&&(cp(a)&&XM(s.stateNode,a.stateNode),!lp(a));)a=a.return}function lp(s){return s.tag===5||s.tag===3||(xn?s.tag===27:!1)}function cp(s){return s&&s.tag===7&&s.stateNode!==null}function up(s){var a=s.type,u=s.memoizedProps,f=s.stateNode;try{MM(f,a,u,s)}catch(m){qt(s,s.return,m)}}function hp(s,a,u){try{wM(s.stateNode,s.type,u,a,s)}catch(f){qt(s,s.return,f)}}function K1(s){return s.tag===5||s.tag===3||(ss?s.tag===26:!1)||(xn?s.tag===27&&go(s.type):!1)||s.tag===4}function fp(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||K1(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(xn&&s.tag===27&&go(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function dp(s,a,u,f){var m=s.tag;if(m===5||m===6)m=s.stateNode,a?EM(u,m,a):SM(u,m),Ll(s,f),ui=!0;else if(m!==4&&(xn&&m===27&&(Ll(s,f),f=null,go(s.type)&&(u=s.stateNode,a=null)),s=s.child,s!==null))for(dp(s,a,u,f),s=s.sibling;s!==null;)dp(s,a,u,f),s=s.sibling}function Su(s,a,u,f){var m=s.tag;if(m===5||m===6)m=s.stateNode,a?TM(u,m,a):yM(u,m),Ll(s,f),ui=!0;else if(m!==4&&(xn&&m===27&&(Ll(s,f),f=null,go(s.type)&&(u=s.stateNode)),s=s.child,s!==null))for(Su(s,a,u,f),s=s.sibling;s!==null;)Su(s,a,u,f),s=s.sibling}function pp(s,a){if(s.tag===5||xn&&s.tag===27)Ll(s,a);else if(s.tag!==4&&(s=s.child,s!==null))for(pp(s,a),s=s.sibling;s!==null;)pp(s,a),s=s.sibling}function Q1(s,a,u){s=s.containerInfo;try{s_(s,u)}catch(f){qt(a,a.return,f)}}function ev(s){var a=s.stateNode,u=s.memoizedProps;try{I4(s.type,u,a,s)}catch(f){qt(s,s.return,f)}}function tv(s){(s.tag===30||(s.subtreeFlags&33554432)!==0)&&(Zu=!0)}function nv(){var s=Vs;return Vs=null,s}function ao(s,a,u,f,m){return Ci=0,iv(s.child,a,u,f,m)}function iv(s,a,u,f,m){if(!_n)return!1;for(var x=!1;s!==null;){if(s.tag===5){var R=s.stateNode;if(f!==null){var k=jp(R);f.push(k),Nu(k)&&(x=!0)}else x||Nu(jp(R))&&(x=!0);Zu=!0,Qv(R,Ci===0?a:a+"_"+Ci,u),Ci++}else(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&m||iv(s.child,a,u,f,m)&&(x=!0));s=s.sibling}return x}function Fs(s,a){if(_n)for(;s!==null;)s.tag===5?NM(s.stateNode,s.memoizedProps):(s.tag!==22||s.memoizedState===null)&&(s.tag===30&&a||Fs(s.child,a)),s=s.sibling}function bu(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if((s.tag!==22||s.memoizedState===null)&&(bu(s),s.tag===30&&(s.flags&18874368)!==0&&s.stateNode.paired)){var a=s.memoizedProps;if(a.name==null||a.name==="auto")throw Error(r(544));var u=a.name;a=q(a.default,a.share),a!=="none"&&(ao(s,u,a,null,!1)||Fs(s.child,!1))}s=s.sibling}}function mp(s,a){if(s.tag===30){var u=s.stateNode,f=s.memoizedProps,m=X(f,u),x=q(f.default,u.paired?f.share:f.enter);x!=="none"?ao(s,m,x,null,!1)?(bu(s),u.paired||a||co(s,f.onEnter)):Fs(s.child,!1):bu(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)mp(s,a),s=s.sibling;else bu(s)}function gp(s){if($i!==null&&$i.size!==0){var a=$i;if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if(s.tag!==22||s.memoizedState===null){if(s.tag===30&&(s.flags&18874368)!==0){var u=s.memoizedProps,f=u.name;if(f!=null&&f!=="auto"){var m=a.get(f);if(m!==void 0){var x=q(u.default,u.share);if(x!=="none"&&(ao(s,f,x,null,!1)?(x=s.stateNode,m.paired=x,x.paired=m,co(s,u.onShare)):Fs(s.child,!1)),a.delete(f),a.size===0)break}}}gp(s)}s=s.sibling}}}function vp(s){if(s.tag===30){var a=s.memoizedProps,u=X(a,s.stateNode),f=$i!==null?$i.get(u):void 0,m=q(a.default,f!==void 0?a.share:a.exit);m!=="none"&&(ao(s,u,m,null,!1)?f!==void 0?(m=s.stateNode,f.paired=m,m.paired=f,$i.delete(u),co(s,a.onShare)):co(s,a.onExit):Fs(s.child,!1)),$i!==null&&gp(s)}else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)vp(s),s=s.sibling;else $i!==null&&gp(s)}function sv(s){for(s=s.child;s!==null;){if(s.tag===30){var a=s.memoizedProps,u=X(a,s.stateNode);a=q(a.default,a.update),s.flags&=-5,a!=="none"&&ao(s,u,a,s.memoizedState=[],!1)}else(s.subtreeFlags&33554432)!==0&&sv(s);s=s.sibling}}function _p(s){if((s.subtreeFlags&18874368)!==0)for(s=s.child;s!==null;){if(s.tag!==22||s.memoizedState===null){if(s.tag===30&&(s.flags&18874368)!==0){var a=s.stateNode;a.paired!==null&&(a.paired=null,Fs(s.child,!1))}_p(s)}s=s.sibling}}function Mu(s){if(s.tag===30)s.stateNode.paired=null,Fs(s.child,!1),_p(s);else if((s.subtreeFlags&33554432)!==0)for(s=s.child;s!==null;)Mu(s),s=s.sibling;else _p(s)}function rv(s){for(s=s.child;s!==null;)s.tag===30?Fs(s.child,!1):(s.subtreeFlags&33554432)!==0&&rv(s),s=s.sibling}function xp(s,a,u,f,m,x,R){if(!_n)return!1;for(var k=!1;a!==null;){if(a.tag===5){var ne=a.stateNode;if(x!==null&&Ci<x.length){var me=x[Ci],_e=jp(ne);(Nu(me)||Nu(_e))&&(k=!0),(s.flags&4)===0&&OM(me,_e)&&(s.flags|=4),BM(me,_e)&&(s.flags|=32)}else s.flags|=32;(s.flags&4)!==0&&Qv(ne,Ci===0?u:u+"_"+Ci,m),k&&(s.flags&4)!==0||(Vs===null&&(Vs=[]),Vs.push(ne,Ci===0?f:f+"_"+Ci,a.memoizedProps)),Ci++}else(a.tag!==22||a.memoizedState===null)&&(a.tag===30&&R?s.flags|=a.flags&32:xp(s,a.child,u,f,m,x,R)&&(k=!0));a=a.sibling}return k}function av(s,a){for(s=s.child;s!==null;){if(s.tag===30){var u=s.memoizedProps,f=s.stateNode,m=X(u,f),x=q(u.default,u.update),R;R=s.memoizedState,s.memoizedState=null,f=s;var k=s.child;Ci=0,m=xp(f,k,m,m,x,R,!1),(s.flags&4)!==0&&m&&co(s,u.onUpdate)}else(s.subtreeFlags&33554432)!==0&&av(s);s=s.sibling}}function Tb(s,a,u){for(jb(s.containerInfo),s=(u&335544064)===u,jn=a,a=s?9270:1024;jn!==null;){if(u=jn,s){var f=u.deletions;if(f!==null)for(var m=0;m<f.length;m++)s&&vp(f[m])}if(u.alternate===null&&(u.flags&2)!==0)s&&tv(u),wu(s);else{if(u.tag===22){if(f=u.alternate,u.memoizedState!==null){f!==null&&f.memoizedState===null&&s&&vp(f),wu(s);continue}else if(f!==null&&f.memoizedState!==null){s&&tv(u),wu(s);continue}}f=u.child,(u.subtreeFlags&a)!==0&&f!==null?(f.return=u,jn=f):(s&&sv(u),wu(s))}}$i=null}function wu(s){for(;jn!==null;){var a=jn,u=s,f=a.alternate,m=a.flags;switch(a.tag){case 0:case 11:case 15:break;case 1:if((m&1024)!==0&&f!==null){u=void 0,m=f.memoizedProps,f=f.memoizedState;var x=a.stateNode;try{var R=ha(a.type,m);u=x.getSnapshotBeforeUpdate(R,f),x.__reactInternalSnapshotBeforeUpdate=u}catch(k){qt(a,a.return,k)}}break;case 3:(m&1024)!==0&&_n&&VM(a.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:u&&f!==null&&(u=X(f.memoizedProps,f.stateNode),m=a.memoizedProps,m=q(m.default,m.update),m!=="none"&&ao(f,u,m,f.memoizedState=[],!0));break;default:if((m&1024)!==0)throw Error(r(163))}if(f=a.sibling,f!==null){f.return=a.return,jn=f;break}jn=a.return}}function ov(s,a,u){var f=u.flags;switch(u.tag){case 0:case 11:case 15:Os(s,u),f&4&&Pl(5,u);break;case 1:if(Os(s,u),f&4)if(s=u.stateNode,a===null)try{s.componentDidMount()}catch(R){qt(u,u.return,R)}else{var m=ha(u.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(m,a,s.__reactInternalSnapshotBeforeUpdate)}catch(R){qt(u,u.return,R)}}f&64&&Y1(u),f&512&&Us(u,u.return);break;case 3:if(Os(s,u),f&64&&(f=u.updateQueue,f!==null)){if(s=null,u.child!==null)switch(u.child.tag){case 27:case 5:s=Ol(u.child.stateNode);break;case 1:s=u.child.stateNode}try{uu(f,s)}catch(R){qt(u,u.return,R)}}break;case 27:xn&&a===null&&f&4&&ev(u);case 26:case 5:if(Os(s,u),a===null){if(f&4)up(u);else if(f&64){s=u.type,a=u.memoizedProps,m=u.stateNode;try{p4(m,s,a,u)}catch(R){qt(u,u.return,R)}}}f&512&&Us(u,u.return);break;case 12:Os(s,u);break;case 31:Os(s,u),f&4&&uv(s,u);break;case 13:Os(s,u),f&4&&hv(s,u),f&64&&(f=u.memoizedState,f!==null&&(f=f.dehydrated,f!==null&&(u=Ub.bind(null,u),ZM(f,u))));break;case 22:if(f=u.memoizedState!==null||Zn,!f){var x=a!==null&&a.memoizedState!==null||Qt;a=Zn,m=Qt,Zn=f,(Qt=x)&&!m?(f=xn?2:0,(u.subtreeFlags&8772)!==0&&(f|=1),bs(s,u,f)):Os(s,u),Zn=a,Qt=m}break;case 30:Os(s,u),f&512&&Us(u,u.return);break;case 7:f&512&&Us(u,u.return);default:Os(s,u)}}function yp(s,a){if(_n)for(s=s.child;s!==null;)lv(s,a),s=s.sibling}function lv(s,a){if(_n)switch(s.tag){case 5:case 26:try{var u=s.stateNode;a?RM(u):PM(s.stateNode,s.memoizedProps)}catch(x){qt(s,s.return,x)}Sp(s,a);break;case 6:try{var f=s.stateNode;a?IM(f):LM(f,s.memoizedProps),ui=!0}catch(x){qt(s,s.return,x)}break;case 18:try{var m=s.stateNode;a?b4(m):M4(s.stateNode)}catch(x){qt(s,s.return,x)}break;case 22:case 23:s.memoizedState===null&&yp(s,a);break;default:yp(s,a)}}function Sp(s,a){if(_n&&s.subtreeFlags&67108864)for(s=s.child;s!==null;){var u=s,f=a;if(_n)switch(u.tag){case 4:lv(u,f);break;case 22:u.memoizedState===null&&Sp(u,f);break;default:Sp(u,f)}s=s.sibling}}function cv(s){var a=s.alternate;a!==null&&(s.alternate=null,cv(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&rM(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function Hi(s,a,u){for(u=u.child;u!==null;)bp(s,a,u),u=u.sibling}function bp(s,a,u){if(Xi&&typeof Xi.onCommitFiberUnmount=="function")try{Xi.onCommitFiberUnmount(kl,u)}catch{}switch(u.tag){case 26:if(ss){Qt||ti(u,a),Hi(s,a,u),u.memoizedState?f_(u.memoizedState):u.stateNode&&(Qt||e0(u.stateNode));break}case 27:if(xn){Qt||ti(u,a),Nl(u);var f=Fn,m=Ri;go(u.type)&&(Fn=u.stateNode,Ri=!1),Hi(s,a,u),g_(u.stateNode,u.type,u.memoizedProps),Fn=f,Ri=m;break}case 5:Qt||ti(u,a),Nl(u);case 6:if(u.tag===6&&Nl(u),_n){if(f=Fn,m=Ri,Fn=null,Hi(s,a,u),Fn=f,Ri=m,Fn!==null)if(Ri)try{CM(Fn,u.stateNode),ui=!0}catch(x){qt(u,a,x)}else try{AM(Fn,u.stateNode),ui=!0}catch(x){qt(u,a,x)}}else Hi(s,a,u);break;case 18:_n&&Fn!==null&&(Ri?S4(Fn,u.stateNode):y4(Fn,u.stateNode));break;case 4:_n?(f=Fn,m=Ri,Fn=u.stateNode.containerInfo,Ri=!0,Hi(s,a,u),Fn=f,Ri=m):(zs&&Q1(u.stateNode,u,n_()),Hi(s,a,u));break;case 0:case 11:case 14:case 15:Ir(2,u,a),Qt||Ir(4,u,a),Hi(s,a,u);break;case 1:Qt||(ti(u,a),f=u.stateNode,typeof f.componentWillUnmount=="function"&&Z1(u,a,f)),Hi(s,a,u);break;case 21:Hi(s,a,u);break;case 22:Qt=(f=Qt)||u.memoizedState!==null,Hi(s,a,u),Qt=f;break;case 30:ti(u,a),Hi(s,a,u);break;case 7:Qt||ti(u,a),Hi(s,a,u);break;default:Hi(s,a,u)}}function uv(s,a){if(ii&&a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{g4(s)}catch(u){qt(a,a.return,u)}}}function hv(s,a){if(ii&&a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{v4(s)}catch(u){qt(a,a.return,u)}}function Eb(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new E_),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new E_),a;default:throw Error(r(435,s.tag))}}function Tu(s,a){var u=Eb(s);a.forEach(function(f){if(!u.has(f)){u.add(f);var m=Fb.bind(null,s,f);f.then(m,m)}})}function ni(s,a,u){var f=a.deletions;if(f!==null)for(var m=0;m<f.length;m++){var x=f[m],R=s,k=a;if(_n){var ne=k;e:for(;ne!==null;){switch(ne.tag){case 27:if(xn){if(go(ne.type)){Fn=ne.stateNode,Ri=!1;break e}break}case 5:Fn=ne.stateNode,Ri=!1;break e;case 3:case 4:Fn=ne.stateNode.containerInfo,Ri=!0;break e}ne=ne.return}if(Fn===null)throw Error(r(160));bp(R,k,x),Fn=null,Ri=!1}else bp(R,k,x);R=x.alternate,R!==null&&(R.return=null),x.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)fv(a,s,u),a=a.sibling}function fv(s,a,u){var f=s.alternate,m=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(m&4&&(f=s.updateQueue,f=f!==null?f.events:null,f!==null))for(var x=0;x<f.length;x++){var R=f[x];R.ref.impl=R.nextImpl}ni(a,s,u),ci(s),m&4&&(Ir(3,s,s.return),Pl(3,s),Ir(5,s,s.return));break;case 1:ni(a,s,u),ci(s),m&512&&(Qt||f===null||ti(f,f.return)),m&64&&Zn&&(s=s.updateQueue,s!==null&&(a=s.callbacks,a!==null&&(m=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=m===null?a:m.concat(a))));break;case 26:if(ss){x=Ms,ni(a,s,u),ci(s),m&512&&(Qt||f===null||ti(f,f.return)),m&4&&(u=f!==null?f.memoizedState:null,m=s.memoizedState,f===null?m===null?s.stateNode===null?s.stateNode=Zn?d_(s.type,s.memoizedProps,a.containerInfo,s):E4(x,s.type,s.memoizedProps,s):Zn||Qp(x,s.type,s.stateNode):s.stateNode=h_(x,m,s.memoizedProps):u!==m?(u===null?(a=f.stateNode,a===null||Qt||e0(a)):f_(u),m===null?Zn||Qp(x,s.type,s.stateNode):h_(x,m,s.memoizedProps)):m===null&&s.stateNode!==null&&hp(s,s.memoizedProps,f.memoizedProps));break}case 27:if(xn){ni(a,s,u),ci(s),m&512&&(Qt||f===null||ti(f,f.return)),f!==null&&m&4&&hp(s,s.memoizedProps,f.memoizedProps);break}case 5:if(x=Gs,Gs=!1,ni(a,s,u),Gs=x,ci(s),m&512&&(Qt||f===null||ti(f,f.return)),_n){if(s.flags&32){a=s.stateNode;try{Kv(a),ui=!0}catch(_e){qt(s,s.return,_e)}}m&4&&s.stateNode!=null&&(a=s.memoizedProps,hp(s,a,f!==null?f.memoizedProps:a)),m&1024&&(g0=!0)}else zs&&s.alternate!==null&&(s.alternate.stateNode=s.stateNode);break;case 6:if(ni(a,s,u),ci(s),m&4&&_n){if(s.stateNode===null)throw Error(r(162));a=s.memoizedProps,m=f!==null?f.memoizedProps:a,u=s.stateNode;try{bM(u,m,a),ui=!0}catch(_e){qt(s,s.return,_e)}}break;case 3:if(ui=!1,ss?(A4(),x=Ms,Ms=Du(a.containerInfo),ni(a,s,u),Ms=x):ni(a,s,u),ci(s),m&4){if(_n&&ii&&f!==null&&f.memoizedState.isDehydrated)try{m4(a.containerInfo)}catch(_e){qt(s,s.return,_e)}if(zs){m=a.containerInfo,a=a.pendingChildren;try{s_(m,a),ui=!0}catch(_e){qt(s,s.return,_e)}}}g0&&(g0=!1,dv(s)),ui=!1;break;case 4:f=Gs,Gs=Zn,x=j1(),ss?(R=Ms,Ms=Du(s.stateNode.containerInfo),ni(a,s,u),ci(s),Ms=R):(ni(a,s,u),ci(s)),ui&&$l&&(ju=!0),ui=x,Gs=f,m&4&&zs&&Q1(s.stateNode,s,s.stateNode.pendingChildren);break;case 12:ni(a,s,u),ci(s);break;case 31:ni(a,s,u),ci(s),m&4&&(a=s.updateQueue,a!==null&&(s.updateQueue=null,Tu(s,a)));break;case 13:ni(a,s,u),ci(s),s.child.flags&8192&&s.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(nh=Ai()),m&4&&(a=s.updateQueue,a!==null&&(s.updateQueue=null,Tu(s,a)));break;case 22:x=s.memoizedState!==null,R=f!==null&&f.memoizedState!==null;var k=Zn,ne=Qt,me=Gs;Zn=k||x,Gs=me||x,Qt=ne||R,ni(a,s,u),Qt=ne,Gs=me,Zn=k,ci(s),m&8192&&(a=s.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,!x||f===null||R||Zn||Qt||(a=xn?2:0,u=R||Qt,f=Zn,R=Qt,Zn=x||Zn,Qt=u,Pr(s,a),Zn=f,Qt=R),_n&&(x||!Gs)&&yp(s,x)),m&4&&(a=s.updateQueue,a!==null&&(m=a.retryQueue,m!==null&&(a.retryQueue=null,Tu(s,m))));break;case 19:ni(a,s,u),ci(s),m&4&&(a=s.updateQueue,a!==null&&(s.updateQueue=null,Tu(s,a)));break;case 30:m&512&&(Qt||f===null||ti(f,f.return)),m=j1(),x=$l,R=(u&335544064)===u,k=s.memoizedProps,$l=R&&q(k.default,k.update)!=="none",ni(a,s,u),ci(s),R&&f!==null&&ui&&(s.flags|=4),$l=x,ui=m;break;case 21:break;case 7:m&512&&(Qt||f===null||ti(f,f.return)),f&&f.stateNode!==null&&WM(s,f.stateNode);default:ni(a,s,u),ci(s)}}function ci(s){var a=s.flags;if(a&2){try{for(var u,f=s.return;f!==null;){if(K1(f)){u=f;break}f=f.return}f=null;for(var m=s.return;m!==null;){if(cp(m)){var x=m.stateNode;f===null?f=[x]:f.push(x)}if(lp(m))break;m=m.return}var R=f;if(_n){if(u==null)throw Error(r(160));switch(u.tag){case 27:if(xn){var k=u.stateNode,ne=fp(s);Su(s,ne,k,R);break}case 5:var me=u.stateNode;u.flags&32&&(Kv(me),u.flags&=-33);var _e=fp(s);Su(s,_e,me,R);break;case 3:case 4:var Ue=u.stateNode.containerInfo,Xe=fp(s);dp(s,Xe,Ue,R);break;default:throw Error(r(161))}}else pp(s,R)}catch(Pt){qt(s,s.return,Pt)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function dv(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;dv(a),a.tag===5&&a.flags&1024&&hM(a.stateNode),s=s.sibling}}function oo(s,a){if(a.subtreeFlags&9270)for(a=a.child;a!==null;)pv(a,s),a=a.sibling;else av(a)}function pv(s,a){var u=s.alternate;if(u===null)mp(s,!1);else switch(s.tag){case 3:if(v0=Ws=!1,nv(),oo(a,s),!Ws&&!ju){if(s=Vs,s!==null)for(var f=0;f<s.length;f+=3)DM(s[f],s[f+1],s[f+2]);UM(a.containerInfo),v0=!0}Vs=null;break;case 5:oo(a,s);break;case 4:f=Ws,Ws=!1,oo(a,s),Ws&&(ju=!0),Ws=f;break;case 22:s.memoizedState===null&&(u.memoizedState!==null?mp(s,!1):oo(a,s));break;case 30:f=Ws;var m=nv();Ws=!1,oo(a,s),Ws&&(s.flags|=4);var x=s.memoizedProps,R=s.stateNode;a=X(x,R),R=X(u.memoizedProps,R);var k=q(x.default,x.update);k==="none"?u=!1:(x=u.memoizedState,u.memoizedState=null,u=s.child,Ci=0,u=xp(s,u,a,R,k,x,!0),Ci!==(x===null?0:x.length)&&(s.flags|=32)),(s.flags&4)!==0&&u?(co(s,s.memoizedProps.onUpdate),Vs=m):m!==null&&(m.push.apply(m,Vs),Vs=m),Ws=(s.flags&32)!==0?!0:f;break;default:oo(a,s)}}function Os(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)ov(s,a.alternate,a),a=a.sibling}function Pr(s,a){for(s=s.child;s!==null;){var u=s,f=a;switch(u.tag){case 0:case 11:case 14:case 15:Ir(4,u,u.return),Pr(u,f);break;case 1:ti(u,u.return);var m=u.stateNode;typeof m.componentWillUnmount=="function"&&Z1(u,u.return,m),Pr(u,f);break;case 27:xn&&(f&2)!==0&&g_(u.stateNode,u.type,u.memoizedProps);case 5:ti(u,u.return),u.tag!==5&&u.tag!==27||Nl(u),Pr(u,f);break;case 6:Nl(u);break;case 26:ti(u,u.return),ss&&(m=u.stateNode,u.memoizedState!==null||m===null||Qt||e0(m)),Pr(u,f);break;case 22:u.memoizedState===null&&Pr(u,f);break;case 30:ti(u,u.return),Pr(u,f);break;case 7:ti(u,u.return);default:Pr(u,f)}s=s.sibling}}function bs(s,a,u){for(u=(a.subtreeFlags&8772)!==0?u:u&-2,a=a.child;a!==null;){var f=a.alternate,m=s,x=a,R=x.flags,k=(u&1)!==0;switch(x.tag){case 0:case 11:case 15:bs(m,x,u),Pl(4,x);break;case 1:if(bs(m,x,u),f=x,m=f.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(_e){qt(f,f.return,_e)}if(f=x,m=f.updateQueue,m!==null){var ne=f.stateNode;try{var me=m.shared.hiddenCallbacks;if(me!==null)for(m.shared.hiddenCallbacks=null,m=0;m<me.length;m++)cu(me[m],ne)}catch(_e){qt(f,f.return,_e)}}k&&R&64&&Y1(x),Us(x,x.return);break;case 27:xn&&(u&2)!==0&&ev(x);case 5:x.tag!==5&&x.tag!==27||J1(x),bs(m,x,u),k&&f===null&&R&4&&up(x),Us(x,x.return);break;case 6:J1(x);break;case 26:ss&&(ne=x.stateNode,x.memoizedState!==null||ne===null||Zn||Qp(Du(ne.ownerDocument),x.type,ne)),bs(m,x,u),k&&f===null&&R&4&&up(x),Us(x,x.return);break;case 12:bs(m,x,u);break;case 31:bs(m,x,u),k&&R&4&&uv(m,x);break;case 13:bs(m,x,u),k&&R&4&&hv(m,x);break;case 22:x.memoizedState===null&&bs(m,x,u),Us(x,x.return);break;case 30:bs(m,x,u),Us(x,x.return);break;case 7:Us(x,x.return);default:bs(m,x,u)}a=a.sibling}}function Mp(s,a){var u=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==u&&(s!=null&&s.refCount++,u!=null&&ot(u))}function wp(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&ot(s))}function is(s,a,u,f){var m=(u&335544064)===u;if(a.subtreeFlags&(m?10262:10256))for(a=a.child;a!==null;)mv(s,a,u,f),a=a.sibling;else m&&rv(a)}function mv(s,a,u,f){var m=(u&335544064)===u;m&&a.alternate===null&&a.return!==null&&a.return.alternate!==null&&Mu(a);var x=a.flags;switch(a.tag){case 0:case 11:case 15:is(s,a,u,f),x&2048&&Pl(9,a);break;case 1:is(s,a,u,f);break;case 3:is(s,a,u,f),m&&_n&&v0&&FM(s.containerInfo),x&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&ot(s)));break;case 12:if(x&2048){is(s,a,u,f),s=a.stateNode;try{var R=a.memoizedProps,k=R.id,ne=R.onPostCommit;typeof ne=="function"&&ne(k,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(me){qt(a,a.return,me)}}else is(s,a,u,f);break;case 31:is(s,a,u,f);break;case 13:is(s,a,u,f);break;case 23:break;case 22:R=a.stateNode,k=a.alternate,a.memoizedState!==null?(m&&k!==null&&k.memoizedState===null&&Mu(k),R._visibility&2?is(s,a,u,f):Dl(s,a)):(m&&k!==null&&k.memoizedState!==null&&Mu(a),R._visibility&2?is(s,a,u,f):(R._visibility|=2,lo(s,a,u,f,(a.subtreeFlags&10256)!==0||!1))),x&2048&&Mp(k,a);break;case 24:is(s,a,u,f),x&2048&&wp(a.alternate,a);break;case 30:m&&(m=a.alternate,m!==null&&(Fs(m.child,!0),Fs(a.child,!0))),is(s,a,u,f);break;default:is(s,a,u,f)}}function lo(s,a,u,f,m){for(m=m&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=s,R=a,k=u,ne=f,me=R.flags;switch(R.tag){case 0:case 11:case 15:lo(x,R,k,ne,m),Pl(8,R);break;case 23:break;case 22:var _e=R.stateNode;R.memoizedState!==null?_e._visibility&2?lo(x,R,k,ne,m):Dl(x,R):(_e._visibility|=2,lo(x,R,k,ne,m)),m&&me&2048&&Mp(R.alternate,R);break;case 24:lo(x,R,k,ne,m),m&&me&2048&&wp(R.alternate,R);break;default:lo(x,R,k,ne,m)}a=a.sibling}}function Dl(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=s,f=a,m=f.flags;switch(f.tag){case 22:Dl(u,f),m&2048&&Mp(f.alternate,f);break;case 24:Dl(u,f),m&2048&&wp(f.alternate,f);break;default:Dl(u,f)}a=a.sibling}}function Lr(s,a,u){if(s.subtreeFlags&Sa)for(s=s.child;s!==null;)gv(s,a,u),s=s.sibling}function gv(s,a,u){switch(s.tag){case 26:if(Lr(s,a,u),s.flags&Sa)if(s.memoizedState!==null)R4(u,Ms,s.memoizedState,s.memoizedProps);else{var f=s.stateNode,m=s.type;s=s.memoizedProps,((a&335544128)===a||Zp(m,s))&&Jv(u,f,m,s)}break;case 5:Lr(s,a,u),s.flags&Sa&&(f=s.stateNode,m=s.type,s=s.memoizedProps,((a&335544128)===a||Zp(m,s))&&Jv(u,f,m,s));break;case 3:case 4:ss?(f=Ms,Ms=Du(s.stateNode.containerInfo),Lr(s,a,u),Ms=f):Lr(s,a,u);break;case 22:s.memoizedState===null&&(f=s.alternate,f!==null&&f.memoizedState!==null?(f=Sa,Sa=16777216,Lr(s,a,u),Sa=f):Lr(s,a,u));break;case 30:(s.flags&Sa)!==0&&(f=s.memoizedProps.name,f!=null&&f!=="auto"&&(m=s.stateNode,m.paired=null,$i===null&&($i=new Map),$i.set(f,m))),Lr(s,a,u);break;default:Lr(s,a,u)}}function vv(s){var a=s.alternate;if(a!==null&&(s=a.child,s!==null)){a.child=null;do a=s.sibling,s.sibling=null,s=a;while(s!==null)}}function Ul(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var f=a[u];jn=f,xv(f,s)}vv(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)_v(s),s=s.sibling}function _v(s){switch(s.tag){case 0:case 11:case 15:Ul(s),s.flags&2048&&Ir(9,s,s.return);break;case 3:Ul(s);break;case 12:Ul(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,Eu(s)):Ul(s);break;default:Ul(s)}}function Eu(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var f=a[u];jn=f,xv(f,s)}vv(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:Ir(8,a,a.return),Eu(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,Eu(a));break;default:Eu(a)}s=s.sibling}}function xv(s,a){for(;jn!==null;){var u=jn;switch(u.tag){case 0:case 11:case 15:Ir(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var f=u.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:ot(u.memoizedState.cache)}if(f=u.child,f!==null)f.return=u,jn=f;else e:for(u=s;jn!==null;){f=jn;var m=f.sibling,x=f.return;if(cv(f),f===u){jn=null;break e}if(m!==null){m.return=x,jn=m;break e}jn=x}}}function Tp(s){var a=tM(s);if(a!=null){if(typeof a.memoizedProps["data-testname"]!="string")throw Error(r(364));return a}if(s=pM(s),s===null)throw Error(r(362));return s.stateNode.current}function Ep(s,a){var u=s.tag;switch(a.$$typeof){case Ju:if(s.type===a.value)return!0;break;case Ku:e:{for(a=a.value,s=[s,0],u=0;u<s.length;){var f=s[u++],m=f.tag,x=s[u++],R=a[x];if(m!==5&&m!==26&&m!==27||!zl(f)){for(;R!=null&&Ep(f,R);)x++,R=a[x];if(x===a.length){a=!0;break e}else for(f=f.child;f!==null;)s.push(f,x),f=f.sibling}}a=!1}return a;case Qu:if((u===5||u===26||u===27)&&vM(s.stateNode,a.value))return!0;break;case th:if((u===5||u===6||u===26||u===27)&&(s=gM(s),s!==null&&0<=s.indexOf(a.value)))return!0;break;case eh:if((u===5||u===26||u===27)&&(s=s.memoizedProps["data-testname"],typeof s=="string"&&s.toLowerCase()===a.value.toLowerCase()))return!0;break;default:throw Error(r(365))}return!1}function Ap(s){switch(s.$$typeof){case Ju:return"<"+(g(s.value)||"Unknown")+">";case Ku:return":has("+(Ap(s)||"")+")";case Qu:return'[role="'+s.value+'"]';case th:return'"'+s.value+'"';case eh:return'[data-testname="'+s.value+'"]';default:throw Error(r(365))}}function yv(s,a){var u=[];s=[s,0];for(var f=0;f<s.length;){var m=s[f++],x=m.tag,R=s[f++],k=a[R];if(x!==5&&x!==26&&x!==27||!zl(m)){for(;k!=null&&Ep(m,k);)R++,k=a[R];if(R===a.length)u.push(m);else for(m=m.child;m!==null;)s.push(m,R),m=m.sibling}}return u}function Cp(s,a){if(!Bl)throw Error(r(363));s=Tp(s),s=yv(s,a),a=[],s=Array.from(s);for(var u=0;u<s.length;){var f=s[u++],m=f.tag;if(m===5||m===26||m===27)zl(f)||a.push(f.stateNode);else for(f=f.child;f!==null;)s.push(f),f=f.sibling}return a}function Vi(){return(Dt&2)!==0&&Ot!==0?Ot&-Ot:ct.T!==null?le():iM()}function Sv(){if(Zi===0)if((Ot&536870912)===0||Rt){var s=Fu;Fu<<=1,(Fu&3932160)===0&&(Fu=262144),Zi=s}else Zi=536870912;return s=ri.current,s!==null&&(s.flags|=32),Zi}function co(s,a){if(a!=null){var u=s.stateNode,f=u.ref;f===null&&(f=u.ref=e_(X(s.memoizedProps,u))),Lo===null&&(Lo=[]),Lo.push(a.bind(null,f))}}function Ei(s,a,u){(s===rn&&(tn===2||tn===9)||s.cancelPendingCommit!==null)&&(uo(s,0),Nr(s,Ot,Zi,!1)),T(s,u),((Dt&2)===0||s!==rn)&&(s===rn&&((Dt&2)===0&&(ba|=u),En===4&&Nr(s,Ot,Zi,!1)),ge(s))}function bv(s,a,u){if((Dt&6)!==0)throw Error(r(327));var f=!u&&(a&127)===0&&(a&s.expiredLanes)===0||M(s,a),m=f?Rb(s,a):Ip(s,a,!0),x=f;do{if(m===0){Ro&&!f&&Nr(s,a,0,!1);break}else{if(u=s.current.alternate,x&&!Ab(u)){m=Ip(s,a,!1),x=!1;continue}if(m===2){if(x=a,s.errorRecoveryDisabledLanes&x)var R=0;else R=s.pendingLanes&-536870913,R=R!==0?R:R&536870912?536870912:0;if(R!==0){a=R;e:{var k=s;m=Zl;var ne=ii&&k.current.memoizedState.isDehydrated;if(ne&&(uo(k,R).flags|=256),R=Ip(k,R,!1),R!==2&&R!==6){if(_0&&!ne){k.errorRecoveryDisabledLanes|=x,ba|=x,m=4;break e}x=Ii,Ii=m,x!==null&&(Ii===null?Ii=x:Ii.push.apply(Ii,x))}m=R}if(x=!1,m!==2)continue}}if(m===1){uo(s,0),Nr(s,a,0,!0);break}e:{switch(f=s,x=m,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a&&(a&62914560)!==a)break;case 6:Nr(f,a,Zi,!kr);break e;case 2:Ii=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(m=nh+300-Ai(),10<m)){if(Nr(f,a,Zi,!kr),S(f,0,!0)!==0)break e;Xs=a,f.timeoutHandle=Qb(Mv.bind(null,f,u,Ii,ih,y0,a,Zi,ba,Io,kr,x,"Throttled",-0,0),m);break e}Mv(f,u,Ii,ih,y0,a,Zi,ba,Io,kr,x,null,-0,0)}}break}while(!0);ge(s)}function Mv(s,a,u,f,m,x,R,k,ne,me,_e,Ue,Xe,Pt){s.timeoutHandle=da;var Vt=a.subtreeFlags,Gr=(x&335544064)===x;if(Ue=null,(Gr||Vt&8192||(Vt&16785408)===16785408)&&(Ue=lM(),$i=null,gv(a,x,Ue),Gr&&cM(Ue,s.containerInfo),Vt=(x&62914560)===x?nh-Ai():(x&4194048)===x?A_-Ai():0,Vt=uM(Ue,Vt),Vt!==null)){Xs=x,s.cancelPendingCommit=Vt(Lv.bind(null,s,a,x,u,f,m,R,k,ne,me,_e,Ue,null,Xe,Pt)),Nr(s,x,R,!me);return}Lv(s,a,x,u,f,m,R,k,ne,me,_e,Ue)}function Ab(s){for(var a=s;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var f=0;f<u.length;f++){var m=u[f],x=m.getSnapshot;m=m.value;try{if(!qi(x(),m))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Nr(s,a,u,f){a=A(s,a),a&=~x0,a&=~ba,s.suspendedLanes|=a,s.pingedLanes&=~a,f&&(s.warmLanes|=a),f=s.expirationTimes;for(var m=a;0<m;){var x=31-Wi(m),R=1<<x;f[x]=-1,m&=~R}u!==0&&F(s,u,a)}function wv(){return(Dt&6)===0?(ce(0),!1):!0}function Rp(){if(Ut!==null){if(tn===0)var s=Ut.return;else s=Ut,or=pa=null,je(s),To=null,Xl=0,s=Ut;for(;s!==null;)$1(s.alternate,s),s=s.return;Ut=null}}function uo(s,a){var u=s.timeoutHandle;return u!==da&&(s.timeoutHandle=da,eM(u)),u=s.cancelPendingCommit,u!==null&&(s.cancelPendingCommit=null,u()),Xs=0,Rp(),rn=s,Ut=u=ir(s.current,null),Ot=a,tn=0,Yi=null,kr=!1,Ro=M(s,a),_0=!1,Io=Zi=x0=ba=Hr=En=0,Ii=Zl=null,y0=!1,cr=A(s,a),aa(),u}function Tv(s,a){wt=null,ct.H=Yu,a===wo||a===Gu?(a=Xt(),tn=3):a===u0?(a=Xt(),tn=4):tn=a===p0?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Yi=a,Ut===null&&(En=1,pu(s,qe(a,s.current)))}function Ev(){var s=ri.current;return s===null?!0:(Ot&4194048)===Ot?yi===null:(Ot&62914560)===Ot||(Ot&536870912)!==0?s===yi:!1}function Av(){var s=ct.H;return ct.H=Yu,s===null?Yu:s}function Cv(){var s=ct.A;return ct.A=q4,s}function Au(){En=4,kr||(Ot&4194048)!==Ot&&ri.current!==null||(Ro=!0),(Hr&134217727)===0&&(ba&134217727)===0||rn===null||Nr(rn,Ot,Zi,!1)}function Ip(s,a,u){var f=Dt;Dt|=2;var m=Av(),x=Cv();(rn!==s||Ot!==a)&&(ih=null,uo(s,a)),a=!1;var R=En;e:do try{if(tn!==0&&Ut!==null){var k=Ut,ne=Yi;switch(tn){case 8:Rp(),R=6;break e;case 3:case 2:case 9:case 6:ri.current===null&&(a=!0);var me=tn;if(tn=0,Yi=null,ho(s,k,ne,me),u&&Ro){R=0;break e}break;default:me=tn,tn=0,Yi=null,ho(s,k,ne,me)}}Cb(),R=En;break}catch(_e){Tv(s,_e)}while(!0);return a&&s.shellSuspendCounter++,or=pa=null,Dt=f,ct.H=m,ct.A=x,Ut===null&&(rn=null,Ot=0,aa()),R}function Cb(){for(;Ut!==null;)Rv(Ut)}function Rb(s,a){var u=Dt;Dt|=2;var f=Av(),m=Cv();rn!==s||Ot!==a?(ih=null,jl=Ai()+500,uo(s,a)):Ro=M(s,a);e:do try{if(tn!==0&&Ut!==null){a=Ut;var x=Yi;t:switch(tn){case 1:tn=0,Yi=null,ho(s,a,x,1);break;case 2:case 9:if(rt(x)){tn=0,Yi=null,Iv(a);break}a=function(){tn!==2&&tn!==9||rn!==s||(tn=7),ge(s)},x.then(a,a);break e;case 3:tn=7;break e;case 4:tn=5;break e;case 7:rt(x)?(tn=0,Yi=null,Iv(a)):(tn=0,Yi=null,ho(s,a,x,7));break;case 5:var R=null;switch(Ut.tag){case 26:R=Ut.memoizedState;case 5:case 27:var k=Ut,ne=k.type,me=k.pendingProps;if(R?p_(R):jv(k.stateNode,ne,me)){tn=0,Yi=null;var _e=k.sibling;if(_e!==null)Ut=_e;else{var Ue=k.return;Ue!==null?(Ut=Ue,Cu(Ue)):Ut=null}break t}}tn=0,Yi=null,ho(s,a,x,5);break;case 6:tn=0,Yi=null,ho(s,a,x,6);break;case 8:Rp(),En=6;break e;default:throw Error(r(462))}}Ib();break}catch(Xe){Tv(s,Xe)}while(!0);return or=pa=null,ct.H=f,ct.A=m,Dt=u,Ut!==null?0:(rn=null,Ot=0,aa(),En)}function Ib(){for(;Ut!==null&&!N4();)Rv(Ut)}function Rv(s){var a=V1(s.alternate,s,cr);s.memoizedProps=s.pendingProps,a===null?Cu(s):Ut=a}function Iv(s){var a=s,u=a.alternate;switch(a.tag){case 15:case 0:a=U1(u,a,a.pendingProps,a.type,void 0,Ot);break;case 11:a=U1(u,a,a.pendingProps,a.type.render,a.ref,Ot);break;case 5:je(a);var f=a;ii&&f===Yn&&(Rt?(we(f),f.tag===5&&f.stateNode!=null&&(mn=f.stateNode)):(we(f),Rt=!0));default:$1(u,a),a=Ut=Fv(a,cr),a=V1(u,a,cr)}s.memoizedProps=s.pendingProps,a===null?Cu(s):Ut=a}function ho(s,a,u,f){or=pa=null,je(a),To=null,Xl=0;var m=a.return;try{if(xb(s,m,a,u,Ot)){En=1,pu(s,qe(u,s.current)),Ut=null;return}}catch(x){if(m!==null)throw Ut=m,x;En=1,pu(s,qe(u,s.current)),Ut=null;return}a.flags&32768?(Rt||f===1?s=!0:Ro||(Ot&536870912)!==0?s=!1:(kr=s=!0,(f===2||f===9||f===3||f===6)&&(f=ri.current,f!==null&&f.tag===13&&(f.flags|=16384))),Pv(a,s)):Cu(a)}function Cu(s){var a=s;do{if((a.flags&32768)!==0){Pv(a,kr);return}s=a.return;var u=Mb(a.alternate,a,cr);if(u!==null){Ut=u;return}if(a=a.sibling,a!==null){Ut=a;return}Ut=a=s}while(a!==null);En===0&&(En=5)}function Pv(s,a){do{var u=wb(s.alternate,s);if(u!==null){u.flags&=32767,Ut=u;return}if(u=s.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(s=s.sibling,s!==null)){Ut=s;return}Ut=s=u}while(s!==null);En=6,Ut=null}function Lv(s,a,u,f,m,x,R,k,ne,me,_e,Ue){s.cancelPendingCommit=null;do Fl();while(Sn!==0);if((Dt&6)!==0)throw Error(r(327));if(a!==null){if(a===s.current)throw Error(r(177));s===rn&&(Ut=rn=null,Ot=0),Ma=a,ws=s,Xs=u,b0=m,C_=f,Pb(s,a,u,R,k,ne,Ue)}}function Pb(s,a,u,f,m,x,R){var k=a.lanes|a.childLanes;if(S0=k,k|=h0,C(s,u,k,f,m,x),Lo=null,(u&335544064)===u?(No=I(s),f=10262):(No=null,f=10256),(a.subtreeFlags&f)!==0||(a.flags&f)!==0?(s.callbackNode=null,s.callbackPriority=0,Ob(i0,function(){return Dp(),null})):(s.callbackNode=null,s.callbackPriority=0),Zu=!1,f=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||f){f=ct.T,ct.T=null,m=rr(),$n(2),x=Dt,Dt|=4;try{Tb(s,a,u)}finally{Dt=x,$n(m),ct.T=f}}Sn=1,Zu?Po=zM(R,s.containerInfo,No,Pp,Lp,Nb,Np,Dp,Lb,null,null):(Pp(),Lp(),Np())}function Lb(s){if(Sn!==0){var a=ws.onRecoverableError;a(s,{componentStack:null})}}function Nb(){Sn===3&&(Sn=0,pv(Ma,ws),Sn=4)}function Pp(){if(Sn===1){Sn=0;var s=ws,a=Ma,u=Xs,f=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||f){f=ct.T,ct.T=null;var m=rr();$n(2);var x=Dt;Dt|=4;try{$l=ju=!1,fv(a,s,u),Jb(s.containerInfo)}finally{Dt=x,$n(m),ct.T=f}}s.current=a,Sn=2}}function Lp(){if(Sn===2){Sn=0;var s=ws,a=Ma,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=ct.T,ct.T=null;var f=rr();$n(2);var m=Dt;Dt|=4;try{ov(s,a.alternate,a)}finally{Dt=m,$n(f),ct.T=u}}Sn=3}}function Np(){if(Sn===4||Sn===3){Sn=0;var s=Po;Po=null,D4();var a=ws,u=Ma,f=Xs,m=C_,x=(f&335544064)===f?10262:10256;if((u.subtreeFlags&x)!==0||(u.flags&x)!==0?Sn=5:(Sn=0,Ma=ws=null,Nv(a,a.pendingLanes)),x=a.pendingLanes,x===0&&(Vr=null),Z(f),u=u.stateNode,Xi&&typeof Xi.onCommitFiberRoot=="function")try{Xi.onCommitFiberRoot(kl,u,void 0,(u.current.flags&128)===128)}catch{}if(m!==null){u=ct.T,x=rr(),$n(2),ct.T=null;try{for(var R=a.onRecoverableError,k=0;k<m.length;k++){var ne=m[k];R(ne.value,{componentStack:ne.stack})}}finally{ct.T=u,$n(x)}}if(m=Lo,R=No,No=null,m!==null&&(Lo=null,R===null&&(R=[]),s!==null))for(ne=0;ne<m.length;ne++)u=(0,m[ne])(R),u!==void 0&&HM(s,u);(Xs&3)!==0&&Fl(),ge(a),x=a.pendingLanes,(f&261930)!==0&&(x&42)!==0?a===sh?Jl++:(Jl=0,sh=a):(Jl=0,sh=null),ii&&x4(),ce(0)}}function Nv(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,ot(a)))}function Fl(){return Po!==null&&(kM(Po),Po=null),Pp(),Lp(),Np(),Dp()}function Dp(){if(Sn!==5)return!1;var s=ws,a=S0;S0=0;var u=Z(Xs),f=32>u?32:u;u=ct.T;var m=rr();try{$n(f),ct.T=null,f=b0,b0=null;var x=ws,R=Xs;if(Sn=0,Ma=ws=null,Xs=0,(Dt&6)!==0)throw Error(r(331));var k=Dt;if(Dt|=4,_v(x.current),mv(x,x.current,R,f),Dt=k,ce(0,!1),Xi&&typeof Xi.onPostCommitFiberRoot=="function")try{Xi.onPostCommitFiberRoot(kl,x)}catch{}return!0}finally{$n(m),ct.T=u,Nv(s,a)}}function Dv(s,a,u){a=qe(u,a),a=Jd(s.stateNode,a,2),s=Ti(s,a,2),s!==null&&(T(s,2),ge(s))}function qt(s,a,u){if(s.tag===3)Dv(s,s,u);else for(;a!==null;){if(a.tag===3){Dv(a,s,u);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Vr===null||!Vr.has(f))){s=qe(u,s),u=A1(2),f=Ti(a,u,2),f!==null&&(C1(u,f,a,s),T(f,2),ge(f));break}}a=a.return}}function Up(s,a,u){var f=s.pingCache;if(f===null){f=s.pingCache=new $4;var m=new Set;f.set(a,m)}else m=f.get(a),m===void 0&&(m=new Set,f.set(a,m));m.has(u)||(_0=!0,m.add(u),s=Db.bind(null,s,a,u),a.then(s,s))}function Db(s,a,u){var f=s.pingCache;f!==null&&f.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,rn===s&&(Ot&u)===u&&((En===4||En===3&&(Ot&62914560)===Ot&&300>Ai()-nh)&&(Dt&2)===0?uo(s,0):x0|=u,Io===Ot&&(Io=0)),ge(s)}function Uv(s,a){a===0&&(a=N()),s=xs(s,a),s!==null&&(T(s,a),ge(s))}function Ub(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),Uv(s,u)}function Fb(s,a){var u=0;switch(s.tag){case 31:case 13:var f=s.stateNode,m=s.memoizedState;m!==null&&(u=m.retryLane);break;case 19:f=s.stateNode;break;case 22:f=s.stateNode._retryCache;break;default:throw Error(r(314))}f!==null&&f.delete(a),Uv(s,u)}function Ob(s,a){return Bu(s,a)}function Bb(s,a,u,f){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Fp(s){return s=s.prototype,!(!s||!s.isReactComponent)}function ir(s,a){var u=s.alternate;return u===null?(u=t(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&1206910976,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function Fv(s,a){s.flags&=1206910978;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function Ru(s,a,u,f,m,x){var R=0;if(f=s,typeof f=="function")Fp(f)&&(R=1);else if(typeof f=="string")R=ss&&xn?c_(s,u,si.current)?26:v_(s)?27:5:ss?c_(s,u,si.current)?26:5:xn&&v_(s)?27:5;else e:switch(f){case qp:return s=t(31,u,a,m),s.elementType=qp,s.lanes=x,s;case po:return fa(u.children,m,x,a);case Gv:R=8,m|=24;break;case Hp:return s=t(12,u,a,m|2),s.elementType=Hp,s.lanes=x,s;case Gp:return s=t(13,u,a,m),s.elementType=Gp,s.lanes=x,s;case Wp:return s=t(19,u,a,m),s.elementType=Wp,s.lanes=x,s;case Vb:case $p:return s=m|32,s=t(30,u,a,s),s.elementType=$p,s.lanes=x,s.stateNode={autoName:null,paired:null,clones:null,ref:null},s;default:if(typeof f=="object"&&f!==null)switch(f.$$typeof){case sr:R=10;break e;case Wv:R=9;break e;case Vp:R=11;break e;case Xp:R=14;break e;case Dr:R=16,f=null;break e}R=29,u=Error(r(130,s===null?"null":typeof s,"")),f=null}return a=t(R,u,a,m),a.elementType=s,a.type=f,a.lanes=x,a}function fa(s,a,u,f){return s=t(7,s,f,a),s.lanes=u,s}function Op(s,a,u){return s=t(6,s,null,a),s.lanes=u,s}function Ov(s){var a=t(18,null,null,0);return a.stateNode=s,a}function Bp(s,a,u){return a=t(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}function zb(s,a,u,f,m,x,R,k,ne){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=da,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=P(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=P(0),this.hiddenUpdates=P(null),this.identifierPrefix=f,this.onUncaughtError=m,this.onCaughtError=x,this.onRecoverableError=R,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=ne,this.transitionTypes=null,this.incompleteTransitions=new Map}function Bv(s,a,u,f,m,x,R,k,ne,me,_e,Ue){return s=new zb(s,a,u,R,ne,me,_e,Ue,k),a=1,x===!0&&(a|=24),x=t(3,null,null,a),s.current=x,x.stateNode=s,a=st(),a.refCount++,s.pooledCache=a,a.refCount++,x.memoizedState={element:f,isDehydrated:u,cache:a},Cr(x),s}function zv(s){return s?(s=_o,s):_o}function kv(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=c(a),s=s!==null?h(s):null,s===null?null:Ol(s.stateNode)}function Hv(s,a,u,f,m,x){m=zv(m),f.context===null?f.context=m:f.pendingContext=m,f=ys(a),f.payload={element:u},x=x===void 0?null:x,x!==null&&(f.callback=x),u=Ti(s,f,a),u!==null&&(Ei(u,s,a),ca(u,s,a))}function Vv(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u<a?u:a}}function zp(s,a){Vv(s,a),(s=s.alternate)&&Vv(s,a)}var Nt={},kb=fn,Gi=QC,kp=Object.assign,Hb=Symbol.for("react.element"),Iu=Symbol.for("react.transitional.element"),fo=Symbol.for("react.portal"),po=Symbol.for("react.fragment"),Gv=Symbol.for("react.strict_mode"),Hp=Symbol.for("react.profiler"),Wv=Symbol.for("react.consumer"),sr=Symbol.for("react.context"),Vp=Symbol.for("react.forward_ref"),Gp=Symbol.for("react.suspense"),Wp=Symbol.for("react.suspense_list"),Xp=Symbol.for("react.memo"),Dr=Symbol.for("react.lazy"),qp=Symbol.for("react.activity"),Vb=Symbol.for("react.legacy_hidden"),Gb=Symbol.for("react.memo_cache_sentinel"),$p=Symbol.for("react.view_transition"),Wb=Symbol.for("react.recoverable"),Xv=Symbol.iterator,qv=Symbol.for("react.optimistic_key"),Xb=Symbol.for("react.client.reference"),Pu=Array.isArray,ct=kb.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,qb=e.rendererVersion,$b=e.rendererPackageName,$v=e.extraDevToolsConfig,Ol=e.getPublicInstance,Yb=e.getRootHostContext,Zb=e.getChildHostContext,jb=e.prepareForCommit,Jb=e.resetAfterCommit,Kb=e.createInstance;e.cloneMutableInstance;var Yp=e.appendInitialChild,Yv=e.finalizeInitialChildren,Lu=e.shouldSetTextContent,Zv=e.createTextInstance;e.cloneMutableTextInstance;var Qb=e.scheduleTimeout,eM=e.cancelTimeout,da=e.noTimeout,Bs=e.isPrimaryRenderer;e.warnsIfNotActing;var _n=e.supportsMutation,zs=e.supportsPersistence,ii=e.supportsHydration,tM=e.getInstanceFromNode;e.beforeActiveInstanceBlur;var nM=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var $n=e.setCurrentUpdatePriority,rr=e.getCurrentUpdatePriority,iM=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var sM=e.shouldAttemptEagerTransition,rM=e.detachDeletedInstance;e.requestPostPaintCallback;var aM=e.maySuspendCommit,oM=e.maySuspendCommitOnUpdate,Zp=e.maySuspendCommitInSyncRender,jv=e.preloadInstance,lM=e.startSuspendingCommit,Jv=e.suspendInstance,cM=e.suspendOnActiveViewTransition,uM=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var mo=e.NotPendingTransition,ar=e.HostTransitionContext,hM=e.resetFormInstance;e.bindToConsole;var fM=e.supportsMicrotasks,dM=e.scheduleMicrotask,Bl=e.supportsTestSelectors,pM=e.findFiberRoot,mM=e.getBoundingRect,gM=e.getTextContent,zl=e.isHiddenSubtree,vM=e.matchAccessibilityRole,_M=e.setFocusIfFocusable,xM=e.setupIntersectionObserver,yM=e.appendChild,SM=e.appendChildToContainer,bM=e.commitTextUpdate,MM=e.commitMount,wM=e.commitUpdate,TM=e.insertBefore,EM=e.insertInContainerBefore,AM=e.removeChild,CM=e.removeChildFromContainer,Kv=e.resetTextContent,RM=e.hideInstance,IM=e.hideTextInstance,PM=e.unhideInstance,LM=e.unhideTextInstance,Qv=e.applyViewTransitionName,NM=e.restoreViewTransitionName,DM=e.cancelViewTransitionName,UM=e.cancelRootViewTransitionName,FM=e.restoreRootViewTransitionName;e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone;var jp=e.measureInstance;e.measureClonedInstance;var Nu=e.wasInstanceInViewport,OM=e.hasInstanceChanged,BM=e.hasInstanceAffectedParent,zM=e.startViewTransition;e.startGestureTransition;var kM=e.stopViewTransition,HM=e.addViewTransitionFinishedListener;e.getCurrentGestureOffset;var e_=e.createViewTransitionInstance,VM=e.clearContainer,GM=e.createFragmentInstance,WM=e.updateFragmentInstanceFiber,t_=e.commitNewChildToFragmentInstance,XM=e.deleteChildFromFragmentInstance,qM=e.cloneInstance,n_=e.createContainerChildSet,i_=e.appendChildToContainerChildSet,$M=e.finalizeContainerChildren,s_=e.replaceContainerChildren,r_=e.cloneHiddenInstance,a_=e.cloneHiddenTextInstance,Jp=e.isSuspenseInstancePending,Kp=e.isSuspenseInstanceFallback,YM=e.getSuspenseInstanceFallbackErrorDetails,ZM=e.registerSuspenseInstanceRetry,jM=e.canHydrateFormStateMarker,JM=e.isFormStateMarkerMatching,o_=e.getNextHydratableSibling,KM=e.getNextHydratableSiblingAfterSingleton,QM=e.getFirstHydratableChild,e4=e.getFirstHydratableChildWithinContainer,t4=e.getFirstHydratableChildWithinActivityInstance,n4=e.getFirstHydratableChildWithinSuspenseInstance,i4=e.getFirstHydratableChildWithinSingleton,s4=e.canHydrateInstance,r4=e.canHydrateTextInstance,a4=e.canHydrateActivityInstance,o4=e.canHydrateSuspenseInstance,l4=e.hydrateInstance,c4=e.hydrateTextInstance,u4=e.hydrateActivityInstance,h4=e.hydrateSuspenseInstance,f4=e.getNextHydratableInstanceAfterActivityInstance,d4=e.getNextHydratableInstanceAfterSuspenseInstance,p4=e.commitHydratedInstance,m4=e.commitHydratedContainer,g4=e.commitHydratedActivityInstance,v4=e.commitHydratedSuspenseInstance,_4=e.finalizeHydratedChildren,x4=e.flushHydrationEvents;e.clearActivityBoundary;var y4=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var S4=e.clearSuspenseBoundaryFromContainer,b4=e.hideDehydratedBoundary,M4=e.unhideDehydratedBoundary,l_=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var w4=e.validateHydratableInstance,T4=e.validateHydratableTextInstance,ss=e.supportsResources,c_=e.isHostHoistableType,Du=e.getHoistableRoot,u_=e.getResource,h_=e.acquireResource,f_=e.releaseResource,E4=e.hydrateHoistable,Qp=e.mountHoistable,e0=e.unmountHoistable,d_=e.createHoistableInstance,A4=e.prepareToCommitHoistables,C4=e.mayResourceSuspendCommit,p_=e.preloadResource,R4=e.suspendResource,xn=e.supportsSingletons,m_=e.resolveSingletonInstance,I4=e.acquireSingletonInstance,g_=e.releaseSingletonInstance,v_=e.isHostSingletonType,go=e.isSingletonScope,t0=[],vo=-1,_o={},Wi=Math.clz32?Math.clz32:w,P4=Math.log,L4=Math.LN2,Uu=256,Fu=262144,Ou=4194304,Bu=Gi.unstable_scheduleCallback,n0=Gi.unstable_cancelCallback,N4=Gi.unstable_shouldYield,D4=Gi.unstable_requestPaint,Ai=Gi.unstable_now,__=Gi.unstable_ImmediatePriority,U4=Gi.unstable_UserBlockingPriority,i0=Gi.unstable_NormalPriority,F4=Gi.unstable_IdlePriority,O4=Gi.log,B4=Gi.unstable_setDisableYieldValue,kl=null,Xi=null,z4=0,qi=typeof Object.is=="function"?Object.is:fe,x_=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},k4=Object.prototype.hasOwnProperty,s0,y_,r0=!1,S_=new WeakMap,xo=[],yo=0,zu=null,Hl=0,rs=[],as=0,Ur=null,ks=1,Hs="",si=v(null),Vl=v(null),Fr=v(null),ku=v(null),Yn=null,mn=null,Rt=!1,Or=null,os=!1,a0=Error(r(519)),Hu=v(null),pa=null,or=null,H4=typeof AbortController<"u"?AbortController:function(){var s=[],a=this.signal={aborted:!1,addEventListener:function(u,f){s.push(f)}};this.abort=function(){a.aborted=!0,s.forEach(function(u){return u()})}},V4=Gi.unstable_scheduleCallback,G4=Gi.unstable_NormalPriority,yn={$$typeof:sr,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Gl=null,So=null,bo=null,o0=!1,Vu=!1,l0=!1,ma=0,Wl=null,c0=0,ga=0,Mo=null,b_=ct.S;ct.S=function(s,a){if(A_=Ai(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&re(s,a),Gl!==null)for(var u=So;u!==null;)U(u,Gl),u=u.next;if(u=s.types,u!=null){for(var f=So;f!==null;)U(f,u),f=f.next;if(ga!==0){f=Gl,f===null&&(f=Gl=[]);for(var m=0;m<u.length;m++){var x=u[m];f.indexOf(x)===-1&&f.push(x)}}}b_!==null&&b_(s,a)};var va=v(null),wo=Error(r(460)),u0=Error(r(474)),Gu=Error(r(542)),Wu={then:function(){}},_a=null,To=null,Xl=0,xa=lu(!0),M_=lu(!1),ls=[],Eo=0,h0=0,Br=!1,f0=!1,zr=v(null),Xu=v(0),ri=v(null),yi=null,ai=v(0),lr=0,wt=null,sn=null,Dn=null,qu=!1,Ao=!1,ya=!1,$u=0,ql=0,Co=null,W4=0,Yu={readContext:xt,use:tr,useCallback:Ye,useContext:Ye,useEffect:Ye,useImperativeHandle:Ye,useLayoutEffect:Ye,useInsertionEffect:Ye,useMemo:Ye,useReducer:Ye,useRef:Ye,useState:Ye,useDebugValue:Ye,useDeferredValue:Ye,useTransition:Ye,useSyncExternalStore:Ye,useId:Ye,useHostTransitionStatus:Ye,useFormState:Ye,useActionState:Ye,useOptimistic:Ye,useMemoCache:Ye,useCacheRefresh:Ye,useEffectEvent:Ye},w_={readContext:xt,use:tr,useCallback:function(s,a){return Jt().memoizedState=[s,a===void 0?null:a],s},useContext:xt,useEffect:l1,useImperativeHandle:function(s,a,u){u=u!=null?u.concat([s]):null,hu(4194308,4,f1.bind(null,a,s),u)},useLayoutEffect:function(s,a){return hu(4194308,4,s,a)},useInsertionEffect:function(s,a){hu(4,2,s,a)},useMemo:function(s,a){var u=Jt();a=a===void 0?null:a;var f=s();if(ya){z(!0);try{s()}finally{z(!1)}}return u.memoizedState=[f,a],f},useReducer:function(s,a,u){var f=Jt();if(u!==void 0){var m=u(a);if(ya){z(!0);try{u(a)}finally{z(!1)}}}else m=a;return f.memoizedState=f.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},f.queue=s,s=s.dispatch=_b.bind(null,wt,s),[f.memoizedState,s]},useRef:function(s){var a=Jt();return s={current:s},a.memoizedState=s},useState:function(s){s=Gd(s);var a=s.queue,u=S1.bind(null,wt,a);return a.dispatch=u,[s.memoizedState,u]},useDebugValue:qd,useDeferredValue:function(s,a){var u=Jt();return $d(u,s,a)},useTransition:function(){var s=Gd(!1);return s=v1.bind(null,wt,s.queue,!0,!1),Jt().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,u){var f=wt,m=Jt();if(Rt){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),rn===null)throw Error(r(349));(Ot&127)!==0||Pn(f,a,u)}m.memoizedState=u;var x={value:u,getSnapshot:a};return m.queue=x,l1(Al.bind(null,f,x,s),[s]),f.flags|=2048,so(9,{destroy:void 0},ns.bind(null,f,x,u,a),null),u},useId:function(){var s=Jt(),a=rn.identifierPrefix;if(Rt){var u=Hs,f=ks;u=(f&~(1<<32-Wi(f)-1)).toString(32)+u,a="_"+a+"R_"+u,u=$u++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=W4++,a="_"+a+"r_"+u.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:Yd,useFormState:i1,useActionState:i1,useOptimistic:function(s){var a=Jt();a.memoizedState=a.baseState=s;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=Zd.bind(null,wt,!0,u),u.dispatch=a,[s,a]},useMemoCache:ts,useCacheRefresh:function(){return Jt().memoizedState=vb.bind(null,wt)},useEffectEvent:function(s){var a=Jt(),u={impl:s};return a.memoizedState=u,function(){if((Dt&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},T_={readContext:xt,use:tr,useCallback:p1,useContext:xt,useEffect:Xd,useImperativeHandle:d1,useInsertionEffect:u1,useLayoutEffect:h1,useMemo:m1,useReducer:It,useRef:o1,useState:function(){return It(ei)},useDebugValue:qd,useDeferredValue:function(s,a){var u=lt();return g1(u,sn.memoizedState,s,a)},useTransition:function(){var s=It(ei)[0],a=lt().memoizedState;return[typeof s=="boolean"?s:Tn(s),a]},useSyncExternalStore:ln,useId:x1,useHostTransitionStatus:Yd,useFormState:s1,useActionState:s1,useOptimistic:function(s,a){var u=lt();return Jg(u,sn,s,a)},useMemoCache:ts,useCacheRefresh:y1,useEffectEvent:c1},X4={readContext:xt,use:tr,useCallback:p1,useContext:xt,useEffect:Xd,useImperativeHandle:d1,useInsertionEffect:u1,useLayoutEffect:h1,useMemo:m1,useReducer:xi,useRef:o1,useState:function(){return xi(ei)},useDebugValue:qd,useDeferredValue:function(s,a){var u=lt();return sn===null?$d(u,s,a):g1(u,sn.memoizedState,s,a)},useTransition:function(){var s=xi(ei)[0],a=lt().memoizedState;return[typeof s=="boolean"?s:Tn(s),a]},useSyncExternalStore:ln,useId:x1,useHostTransitionStatus:Yd,useFormState:a1,useActionState:a1,useOptimistic:function(s,a){var u=lt();return sn!==null?Jg(u,sn,s,a):(u.baseState=s,[s,u.queue.dispatch])},useMemoCache:ts,useCacheRefresh:y1,useEffectEvent:c1},d0={enqueueSetState:function(s,a,u){s=s._reactInternals;var f=Vi(),m=ys(f);m.payload=a,u!=null&&(m.callback=u),a=Ti(s,m,f),a!==null&&(Ei(a,s,f),ca(a,s,f))},enqueueReplaceState:function(s,a,u){s=s._reactInternals;var f=Vi(),m=ys(f);m.tag=1,m.payload=a,u!=null&&(m.callback=u),a=Ti(s,m,f),a!==null&&(Ei(a,s,f),ca(a,s,f))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var u=Vi(),f=ys(u);f.tag=2,a!=null&&(f.callback=a),a=Ti(s,f,u),a!==null&&(Ei(a,s,u),ca(a,s,u))}},p0=Error(r(461)),Un=!1,m0={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},ui=!1,Zu=!1,$i=null,Vs=null,Ci=0,Zn=!1,Qt=!1,Gs=!1,g0=!1,E_=typeof WeakSet=="function"?WeakSet:Set,jn=null,Ws=!1,$l=!1,ju=!1,v0=!1,Fn=null,Ri=!1,Ms=null,Sa=8192,q4={getCacheForType:function(s){var a=xt(yn),u=a.data.get(s);return u===void 0&&(u=s(),a.data.set(s,u)),u},cacheSignal:function(){return xt(yn).controller.signal}},Ju=0,Ku=1,Qu=2,eh=3,th=4;if(typeof Symbol=="function"&&Symbol.for){var Yl=Symbol.for;Ju=Yl("selector.component"),Ku=Yl("selector.has_pseudo_class"),Qu=Yl("selector.role"),eh=Yl("selector.test_id"),th=Yl("selector.text")}var $4=typeof WeakMap=="function"?WeakMap:Map,Dt=0,rn=null,Ut=null,Ot=0,tn=0,Yi=null,kr=!1,Ro=!1,_0=!1,cr=0,En=0,Hr=0,ba=0,x0=0,Zi=0,Io=0,Zl=null,Ii=null,y0=!1,nh=0,A_=0,jl=1/0,ih=null,Vr=null,Sn=0,ws=null,Ma=null,Xs=0,S0=0,b0=null,C_=null,Po=null,Lo=null,No=null,Jl=0,sh=null;return Nt.attemptContinuousHydration=function(s){if(s.tag===13||s.tag===31){var a=xs(s,67108864);a!==null&&Ei(a,s,67108864),zp(s,67108864)}},Nt.attemptHydrationAtCurrentPriority=function(s){if(s.tag===13||s.tag===31){var a=Vi();a=W(a);var u=xs(s,a);u!==null&&Ei(u,s,a),zp(s,a)}},Nt.attemptSynchronousHydration=function(s){switch(s.tag){case 3:if(s=s.stateNode,s.current.memoizedState.isDehydrated){var a=b(s.pendingLanes);if(a!==0){for(s.pendingLanes|=2,s.entangledLanes|=2;a;){var u=1<<31-Wi(a);s.entanglements[1]|=u,a&=~u}ge(s),(Dt&6)===0&&(jl=Ai()+500,ce(0))}}break;case 31:case 13:a=xs(s,2),a!==null&&Ei(a,s,2),wv(),zp(s,2)}},Nt.batchedUpdates=function(s,a){return s(a)},Nt.createComponentSelector=function(s){return{$$typeof:Ju,value:s}},Nt.createContainer=function(s,a,u,f,m,x,R,k,ne,me){return Bv(s,a,!1,null,u,f,x,null,R,k,ne,me)},Nt.createHasPseudoClassSelector=function(s){return{$$typeof:Ku,value:s}},Nt.createHydrationContainer=function(s,a,u,f,m,x,R,k,ne,me,_e,Ue,Xe,Pt){var Vt;return s=Bv(u,f,!0,s,m,x,k,Pt,ne,me,_e,Ue),s.context=zv(null),u=s.current,f=Vi(),f=W(f),m=ys(f),m.callback=(Vt=a)!=null?Vt:null,Ti(u,m,f),a=f,s.current.lanes=a,T(s,a),ge(s),s},Nt.createPortal=function(s,a,u){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:fo,key:f==null?null:f===qv?qv:""+f,children:s,containerInfo:a,implementation:u}},Nt.createRoleSelector=function(s){return{$$typeof:Qu,value:s}},Nt.createTestNameSelector=function(s){return{$$typeof:eh,value:s}},Nt.createTextSelector=function(s){return{$$typeof:th,value:s}},Nt.defaultOnCaughtError=function(s){console.error(s)},Nt.defaultOnRecoverableError=function(s){x_(s)},Nt.defaultOnUncaughtError=function(s){x_(s)},Nt.deferredUpdates=function(s){var a=ct.T,u=rr();try{return $n(32),ct.T=null,s()}finally{$n(u),ct.T=a}},Nt.discreteUpdates=function(s,a,u,f,m){var x=ct.T,R=rr();try{return $n(2),ct.T=null,s(a,u,f,m)}finally{$n(R),ct.T=x,Dt===0&&(jl=Ai()+500)}},Nt.findAllNodes=Cp,Nt.findBoundingRects=function(s,a){if(!Bl)throw Error(r(363));a=Cp(s,a),s=[];for(var u=0;u<a.length;u++)s.push(mM(a[u]));for(a=s.length-1;0<a;a--){u=s[a];for(var f=u.x,m=f+u.width,x=u.y,R=x+u.height,k=a-1;0<=k;k--)if(a!==k){var ne=s[k],me=ne.x,_e=me+ne.width,Ue=ne.y,Xe=Ue+ne.height;if(f>=me&&x>=Ue&&m<=_e&&R<=Xe){s.splice(a,1);break}else if(f!==me||u.width!==ne.width||Xe<x||Ue>R){if(!(x!==Ue||u.height!==ne.height||_e<f||me>m)){me>f&&(ne.width+=me-f,ne.x=f),_e<m&&(ne.width=m-me),s.splice(a,1);break}}else{Ue>x&&(ne.height+=Ue-x,ne.y=x),Xe<R&&(ne.height=R-Ue),s.splice(a,1);break}}}return s},Nt.findHostInstance=kv,Nt.findHostInstanceWithNoPortals=function(s){return s=c(s),s=s!==null?d(s):null,s===null?null:Ol(s.stateNode)},Nt.findHostInstanceWithWarning=function(s){return kv(s)},Nt.flushPassiveEffects=Fl,Nt.flushSyncFromReconciler=function(s){var a=Dt;Dt|=1;var u=ct.T,f=rr();try{if($n(2),ct.T=null,s)return s()}finally{$n(f),ct.T=u,Dt=a,(Dt&6)===0&&ce(0)}},Nt.flushSyncWork=wv,Nt.focusWithin=function(s,a){if(!Bl)throw Error(r(363));for(s=Tp(s),a=yv(s,a),a=Array.from(a),s=0;s<a.length;){var u=a[s++],f=u.tag;if(!zl(u)){if((f===5||f===26||f===27)&&_M(u.stateNode))return!0;for(u=u.child;u!==null;)a.push(u),u=u.sibling}}return!1},Nt.getFindAllNodesFailureDescription=function(s,a){if(!Bl)throw Error(r(363));var u=0,f=[];s=[Tp(s),0];for(var m=0;m<s.length;){var x=s[m++],R=x.tag,k=s[m++],ne=a[k];if((R!==5&&R!==26&&R!==27||!zl(x))&&(Ep(x,ne)&&(f.push(Ap(ne)),k++,k>u&&(u=k)),k<a.length))for(x=x.child;x!==null;)s.push(x,k),x=x.sibling}if(u<a.length){for(s=[];u<a.length;u++)s.push(Ap(a[u]));return`findAllNodes was able to match part of the selector:
  `+(f.join(" > ")+`

No matching component was found for:
  `)+s.join(" > ")}return null},Nt.getPublicRootInstance=function(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 27:case 5:return Ol(s.child.stateNode);default:return s.child.stateNode}},Nt.injectIntoDevTools=function(){var s={bundleType:0,version:qb,rendererPackageName:$b,currentDispatcherRef:ct,reconcilerVersion:"19.3.0"};if($v!==null&&(s.rendererConfig=$v),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")s=!1;else{var a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(a.isDisabled||!a.supportsFiber)s=!0;else{try{kl=a.inject(s),Xi=a}catch{}s=!!a.checkDCE}}return s},Nt.isAlreadyRendering=function(){return(Dt&6)!==0},Nt.observeVisibleRects=function(s,a,u,f){if(!Bl)throw Error(r(363));s=Cp(s,a);var m=xM(s,u,f).disconnect;return{disconnect:function(){m()}}},Nt.shouldError=function(){return null},Nt.shouldSuspend=function(){return!1},Nt.startHostTransition=function(s,a,u,f){if(s.tag!==5)throw Error(r(476));var m=_1(s).queue;v1(s,m,a,mo,u===null?n:function(){var x=_1(s);return x.next===null&&(x=s.alternate.memoizedState),Cl(s,x.next.queue,{},Vi()),u(f)})},Nt.updateContainer=function(s,a,u,f){var m=a.current,x=Vi();return Hv(m,x,s,a,u,f),x},Nt.updateContainerSync=function(s,a,u,f){return Hv(a.current,2,s,a,u,f),2},Nt},i.exports.default=i.exports,Object.defineProperty(i.exports,"__esModule",{value:!0})})(_y)),_y.exports}var yy;function DR(){return yy||(yy=1,vy.exports=NR()),vy.exports}var UR=DR();const FR=LR(UR),jf={};let OR=0;const Vd=i=>`${i[0].toUpperCase()}${i.slice(1)}`;function BR(i){return i in jf}function zg(i){return jf[i]}function YS(i){if(typeof i=="function"){const e=`${OR++}`;return jf[e]=i,e}else Object.assign(jf,i)}function zR(i){const e=FR(i);return e.injectIntoDevTools(),e}const ZS=0,kR=/^three(?=[A-Z])/;function jS(i,e){const t=Vd(i),n=zg(t);if(i!=="primitive"&&!n)throw new Error(`R3F: ${t} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(i==="primitive"&&!e.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(e.args!==void 0&&!Array.isArray(e.args))throw new Error("R3F: The args prop must be an array!")}function HR(i,e,t){var n;return i=BR(Vd(i))?i:i.replace(kR,""),jS(i,e),i==="primitive"&&(n=e.object)!=null&&n.__r3f&&delete e.object.__r3f,$f(e.object,t,i,e)}function VR(i){if(!i.isHidden){var e;i.props.attach&&(e=i.parent)!=null&&e.object?Zf(i.parent,i):Ni(i.object)&&(i.previousVisible=i.object.visible,i.object.visible=!1),i.isHidden=!0,ou(i)}}function JS(i){if(i.isHidden){var e;if(i.props.attach&&(e=i.parent)!=null&&e.object)Yf(i.parent,i);else if(Ni(i.object)){var t;i.object.visible=(t=i.previousVisible)!=null?t:!0}i.previousVisible=void 0,i.isHidden=!1,ou(i)}}function kg(i,e,t){const n=e.root.getState();if(!(!i.parent&&i.object!==n.scene)){if(!e.object){var r,o;const l=zg(Vd(e.type));e.object=(r=e.props.object)!=null?r:new l(...(o=e.props.args)!=null?o:[]),e.object.__r3f=e}if(Va(e.object,e.props),e.props.attach)Yf(i,e);else if(Ni(e.object)&&Ni(i.object)){const l=i.object.children.indexOf(t==null?void 0:t.object);if(t&&l!==-1){const c=i.object.children.indexOf(e.object);if(c!==-1){i.object.children.splice(c,1);const h=c<l?l-1:l;i.object.children.splice(h,0,e.object)}else e.object.parent=i.object,i.object.children.splice(l,0,e.object),e.object.dispatchEvent({type:"added"}),i.object.dispatchEvent({type:"childadded",child:e.object})}else i.object.add(e.object)}for(const l of e.children)kg(e,l);ou(e)}}function lm(i,e){if(e){if(e.parent===i){const t=i.children.indexOf(e);t!==-1&&i.children.splice(t,1)}e.parent=i,i.children.push(e),kg(i,e)}}function Sy(i,e,t){if(!e||!t)return;if(e.parent===i){const r=i.children.indexOf(e);r!==-1&&i.children.splice(r,1)}e.parent=i;const n=i.children.indexOf(t);n!==-1?i.children.splice(n,0,e):i.children.push(e),kg(i,e,t)}function KS(i){if(typeof i.dispose=="function"){const e=()=>{try{i.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?e():vr.unstable_scheduleCallback(vr.unstable_IdlePriority,e)}}function Fm(i,e,t){if(!e)return;const n=!!e.parent;e.parent=null;const r=i.children.indexOf(e);r!==-1&&i.children.splice(r,1),e.props.attach?Zf(i,e):Ni(e.object)&&Ni(i.object)&&(i.object.remove(e.object),gR(Ug(e),e.object));const o=e.props.dispose!==null&&t!==!1;for(let c=e.children.length-1;c>=0;c--){const h=e.children[c];Fm(e,h,o)}if(e.children.length=0,delete e.object.__r3f,o&&e.type!=="primitive"&&e.object.type!=="Scene"&&KS(e.object),t===void 0&&n){var l;const c=(l=e.root)==null||l.getState==null?void 0:l.getState();c&&c.internal.frames===0&&c.invalidate()}}function GR(i,e){for(const t of[i,i.alternate])if(t!==null)if(typeof t.ref=="function"){t.refCleanup==null||t.refCleanup();const n=t.ref(e);typeof n=="function"&&(t.refCleanup=n)}else t.ref&&(t.ref.current=e)}const Zc=[];function WR(){if(Zc.length!==0)try{XR()}finally{Zc.length=0}}function XR(){for(const[t]of Zc){const n=t.parent;if(n){t.props.attach?Zf(n,t):Ni(t.object)&&Ni(n.object)&&n.object.remove(t.object);for(const r of t.children)r.props.attach?Zf(t,r):Ni(r.object)&&Ni(t.object)&&t.object.remove(r.object)}t.isHidden&&JS(t),t.object.__r3f&&delete t.object.__r3f,t.type!=="primitive"&&KS(t.object)}for(const[t,n,r]of Zc){t.props=n;const o=t.parent;if(o){var i,e;const l=zg(Vd(t.type)),c=t.object;t.object=(i=t.props.object)!=null?i:new l(...(e=t.props.args)!=null?e:[]),t.object.__r3f=t,GR(r,t.object),mR(Ug(t),c,t.object),Va(t.object,t.props),t.props.attach?Yf(o,t):Ni(t.object)&&Ni(o.object)&&o.object.add(t.object);for(const h of t.children)h.props.attach?Yf(t,h):Ni(h.object)&&Ni(t.object)&&t.object.add(h.object);ou(t)}}}const cm=()=>{},by={};let jh=ZS;function qR(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return gy;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return my;case"message":switch(vr.unstable_getCurrentPriorityLevel()){case vr.unstable_ImmediatePriority:return gy;case vr.unstable_UserBlockingPriority:return my;case vr.unstable_NormalPriority:case vr.unstable_LowPriority:return sf;case vr.unstable_IdlePriority:return ER;default:return sf}default:return sf}}function $R(i){typeof queueMicrotask=="function"?queueMicrotask(i):typeof Promise<"u"?Promise.resolve().then(i).catch(e=>{setTimeout(()=>{throw e})}):setTimeout(i)}const al=zR({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:HR,removeChild:Fm,appendChild:lm,appendInitialChild:lm,insertBefore:Sy,appendChildToContainer(i,e){const t=i.getState().scene.__r3f;!e||!t||lm(t,e)},removeChildFromContainer(i,e){const t=i.getState().scene.__r3f;!e||!t||Fm(t,e)},insertInContainerBefore(i,e,t){const n=i.getState().scene.__r3f;!e||!t||!n||Sy(n,e,t)},getRootHostContext:()=>by,getChildHostContext:()=>by,commitUpdate(i,e,t,n,r){var o,l,c;jS(e,n);let h=!1;if((i.type==="primitive"&&t.object!==n.object||((o=n.args)==null?void 0:o.length)!==((l=t.args)==null?void 0:l.length)||(c=n.args)!=null&&c.some((d,p)=>{var g;return d!==((g=t.args)==null?void 0:g[p])}))&&(h=!0),h)Zc.push([i,Dm(n),r]);else{const d=hR(i,n),p=i.props.attach;i.props=Dm(n),p!==void 0?i.props.attach=p:delete i.props.attach,Object.keys(d).length&&Va(i.object,d)}},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:i=>i==null?void 0:i.object,prepareForCommit:()=>null,preparePortalMount:i=>$f(i.getState().scene,i,"",{}),resetAfterCommit:WR,shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:VR,unhideInstance:JS,createTextInstance:cm,hideTextInstance:cm,unhideTextInstance:cm,supportsMicrotasks:!0,scheduleMicrotask:$R,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:Ve.createContext(null),setCurrentUpdatePriority(i){jh=i},getCurrentUpdatePriority(){return jh},resolveUpdatePriority(){var i;if(jh!==ZS)return jh;const e=typeof window<"u"?(i=window.event)==null?void 0:i.type:void 0;return e===void 0?sf:qR(e)},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:PR.version,applyViewTransitionName(i,e,t){},restoreViewTransitionName(i,e){},cancelViewTransitionName(i,e,t){},cancelRootViewTransitionName(i){},restoreRootViewTransitionName(i){},InstanceMeasurement:null,measureInstance:i=>null,wasInstanceInViewport:i=>!0,hasInstanceChanged:(i,e)=>!1,hasInstanceAffectedParent:(i,e)=>!1,suspendOnActiveViewTransition(i,e){},startViewTransition(i,e,t,n,r,o,l,c,h,d,p){return n(),r(),p==null||p(),l(),null},startGestureTransition(i,e,t,n,r,o,l,c,h,d){return l(),c(),d==null||d(),null},stopViewTransition(i){},addViewTransitionFinishedListener(i,e){e()},createViewTransitionInstance:i=>null,getCurrentGestureOffset(i){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance(i,e){return i},cloneMutableTextInstance(i){return i},cloneRootViewTransitionContainer(i){throw new Error("Not implemented.")},removeRootViewTransitionClone(i,e){throw new Error("Not implemented.")},createFragmentInstance:i=>null,updateFragmentInstanceFiber(i,e){},commitNewChildToFragmentInstance(i,e){},deleteChildFromFragmentInstance(i,e){},measureClonedInstance:i=>null,maySuspendCommitOnUpdate:(i,e,t)=>!1,maySuspendCommitInSyncRender:(i,e)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(i,e)=>null}),Kr=new Map;function Jf(i,e){const t=i.state;switch(e.type){case"use":return t.status==="disposed"?!1:(i.state={status:"open"},!0);case"unmount":return t.status==="disposed"?!1:(i.state={status:"closing",token:e.token},!0);case"dispose":return t.status!=="closing"||t.token!==e.token?!1:(i.state={status:"disposed"},!0)}}function YR(i){const e=Kr.get(i),t=e==null?void 0:e.fiber,n=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,o=n||wR(Hg,eb),l=t||al.createContainer(o,TR,null,!1,null,"",r,r,r,null),c=e||{fiber:l,store:o,state:{status:"open"},ready:_R(void 0),configuration:{},ownsRenderer:!1};e||Kr.set(i,c);let h=!1;return{get ready(){return c.ready},configure(d={}){if(!Jf(c,{type:"use"}))return xR(new Error("R3F: Cannot configure a root after disposal has started."));const p=c.ready,{promise:g,resolve:v,reject:_}=yR();c.ready=g;const y=b=>{const S=o.getState();S.gl||(c.ownsRenderer=!Bg(d.gl),S.set({gl:b})),RR(c,i,d),!c.unwatchDpr&&(d.dpr===void 0||Array.isArray(d.dpr))&&(c.unwatchDpr=IR(c)),v(this)},w=()=>{try{var b;const S=(b=o.getState().gl)!=null?b:SR(i,d.gl);Og(S)?Promise.resolve(S).then(y).catch(_):y(S)}catch(S){_(S)}};return p.status==="pending"?p.then(w,_):w(),g},render(d){if(!Jf(c,{type:"use"}))return o;if(!o.getState().gl&&c.ready.status==="fulfilled"&&this.configure(),c.ready.status==="rejected")throw c.ready.reason;const p=()=>{var g;if(c.state.status!=="open"||c.ready.status==="rejected")return;if(c.ready.status==="pending"){c.ready.then(p,r);return}const v=(g=c.configuration.previous)==null?void 0:g.onCreated,_=nt.jsx(ZR,{store:o,children:d,onCreated:v,rootElement:i});if(h){al.updateContainer(_,l,null,fy);return}h=!0,al.updateContainerSync(_,l,null,fy),al.flushSyncWork()};return p(),o},unmount(){Kr.get(i)===c&&jR(i)}}}function ZR({store:i,children:e,onCreated:t,rootElement:n}){return wl(()=>{const r=i.getState();r.set(o=>({internal:{...o.internal,active:!0}})),t&&t(r),i.getState().events.connected||r.events.connect==null||r.events.connect(n)},[]),nt.jsx(qS.Provider,{value:i,children:e})}function uc(i){try{return i()}catch(e){console.warn("[R3F] Error while unmounting root; teardown may be incomplete:",e)}}function jR(i,e){const t=Kr.get(i),n=Symbol("unmount");if(!t||!Jf(t,{type:"unmount",token:n}))return;const r=()=>{var o;if(t.ready.status==="pending"){t.ready.then(r,r);return}if(!Jf(t,{type:"dispose",token:n}))return;Kr.delete(i);const l=t.store.getState();l.internal.active=!1,uc(()=>t.unwatchDpr==null?void 0:t.unwatchDpr()),uc(()=>l.events.disconnect==null?void 0:l.events.disconnect()),(o=l.gl)!=null&&o.xr&&uc(()=>l.xr.disconnect()),l.scene&&uc(()=>cR(l.scene));const c=uc(()=>MR(l.gl,t.ownsRenderer));Og(c)&&c.then(()=>{})};al.updateContainer(null,t.fiber,null,()=>{t.state.status!=="closing"||t.state.token!==n||al.updateContainer(null,t.fiber,null,r)})}const JR=new Set,KR=new Set,QR=new Set;function um(i,e){if(i.size)for(const{callback:t}of i.values())t(e)}function Cc(i,e){switch(i){case"before":return um(JR,e);case"after":return um(KR,e);case"tail":return um(QR,e)}}let hm,fm;function Om(i,e,t){let n=e.clock.getDelta();e.frameloop==="never"&&typeof i=="number"&&(n=i-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=i),hm=e.internal.subscribers;for(let r=0;r<hm.length;r++)fm=hm[r],fm.ref.current(fm.store.getState(),n,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}let Kf=!1,Bm=!1,dm,My,tl;function QS(i){My=requestAnimationFrame(QS),Kf=!0,dm=0,Cc("before",i),Bm=!0;for(const t of Kr.values()){var e;tl=t.store.getState(),tl.internal.active&&(tl.frameloop==="always"||tl.internal.frames>0)&&!((e=tl.gl.xr)!=null&&e.isPresenting)&&(dm+=Om(i,tl))}if(Bm=!1,Cc("after",i),dm===0)return Cc("tail",i),Kf=!1,cancelAnimationFrame(My)}function Hg(i,e=1){var t;if(!i)return Kr.forEach(n=>Hg(n.store.getState(),e));(t=i.gl.xr)!=null&&t.isPresenting||!i.internal.active||i.frameloop==="never"||(e>1?i.internal.frames=Math.min(60,i.internal.frames+e):Bm?i.internal.frames=2:i.internal.frames=1,Kf||(Kf=!0,requestAnimationFrame(QS)))}function eb(i,e=!0,t,n){if(e&&Cc("before",i),t)Om(i,t,n);else for(const r of Kr.values())Om(i,r.store.getState());e&&Cc("after",i)}const pm={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function e9(i){const{handlePointer:e}=vR(i);return{priority:1,enabled:!0,compute(t,n,r){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(pm).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:r}=i.getState();(t=r.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{const{set:n,events:r}=i.getState();if(r.disconnect==null||r.disconnect(),n(o=>({events:{...o.events,connected:t}})),r.handlers)for(const o in r.handlers){const l=r.handlers[o],[c,h]=pm[o];t.addEventListener(c,l,{passive:h})}},disconnect:()=>{const{set:t,events:n}=i.getState();if(n.connected){if(n.handlers)for(const r in n.handlers){const o=n.handlers[r],[l]=pm[r];n.connected.removeEventListener(l,o)}t(r=>({events:{...r.events,connected:void 0}}))}}}}function wy(i,e){let t;return(...n)=>{window.clearTimeout(t),t=window.setTimeout(()=>i(...n),e)}}function t9({debounce:i,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const r=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!r)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,l]=Ve.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=Ve.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o,orientationHandler:null}),h=i?typeof i=="number"?i:i.scroll:null,d=i?typeof i=="number"?i:i.resize:null,p=Ve.useRef(!1);Ve.useEffect(()=>(p.current=!0,()=>void(p.current=!1)));const[g,v,_]=Ve.useMemo(()=>{const S=()=>{if(!c.current.element)return;const{left:M,top:A,width:E,height:N,bottom:P,right:T,x:C,y:F}=c.current.element.getBoundingClientRect(),D={left:M,top:A,width:E,height:N,bottom:P,right:T,x:C,y:F};c.current.element instanceof HTMLElement&&n&&(D.height=c.current.element.offsetHeight,D.width=c.current.element.offsetWidth),Object.freeze(D),p.current&&!r9(c.current.lastBounds,D)&&l(c.current.lastBounds=D)};return[S,d?wy(S,d):S,h?wy(S,h):S]},[l,n,h,d]);function y(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(S=>S.removeEventListener("scroll",_,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function w(){c.current.element&&(c.current.resizeObserver=new r(_),c.current.resizeObserver.observe(c.current.element),e&&c.current.scrollContainers&&c.current.scrollContainers.forEach(S=>S.addEventListener("scroll",_,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{_()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}const b=S=>{!S||S===c.current.element||(y(),c.current.element=S,c.current.scrollContainers=tb(S),w())};return i9(_,!!e),n9(v),Ve.useEffect(()=>{y(),w()},[e,_,v]),Ve.useEffect(()=>y,[]),[b,o,g]}function n9(i){Ve.useEffect(()=>{const e=i;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[i])}function i9(i,e){Ve.useEffect(()=>{if(e){const t=i;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[i,e])}function tb(i){const e=[];if(!i||i===document.body)return e;const{overflow:t,overflowX:n,overflowY:r}=window.getComputedStyle(i);return[t,n,r].some(o=>o==="auto"||o==="scroll")&&e.push(i),[...e,...tb(i.parentElement)]}const s9=["x","y","top","bottom","left","right","width","height"],r9=(i,e)=>s9.every(t=>i[t]===e[t]);function a9({ref:i,children:e,fallback:t,resize:n,style:r,gl:o,events:l=e9,eventSource:c,eventPrefix:h,shadows:d,linear:p,flat:g,legacy:v,orthographic:_,frameloop:y,dpr:w,performance:b,raycaster:S,camera:M,scene:A,onPointerMissed:E,onCreated:N,...P}){Ve.useMemo(()=>YS(HC),[]);const T=iR(),[C,F]=t9({scroll:!0,debounce:{scroll:50,resize:0},...n}),D=Ve.useRef(null),B=Ve.useRef(null);Ve.useImperativeHandle(i,()=>D.current);const W=VS(E),Z=Ve.useCallback(ie=>W.current==null?void 0:W.current(ie),[W]),[z,X]=Ve.useState(!1),[Q,q]=Ve.useState(!1);if(z)throw z;if(Q)throw Q;const fe=Ve.useRef(null),[Y,he]=tR(),pe=Ve.useRef(null),We=()=>c?aR(c)?c.current:c:B.current;Ve.useInsertionEffect(()=>()=>{const ie=fe.current;fe.current=null,ie==null||ie.unmount()},[]),wl(()=>{const ie=D.current;F.width>0&&F.height>0&&ie&&(fe.current||(fe.current=YR(ie)),fe.current.configure({gl:o,scene:A,events:l,shadows:d,linear:p,flat:g,legacy:v,orthographic:_,frameloop:y,dpr:w,performance:b,raycaster:S,camera:M,size:F,onPointerMissed:Z,onCreated:xe=>{var Be;pe.current=xe,xe.events.connect==null||xe.events.connect((Be=We())!=null?Be:B.current),h&&xe.setEvents({compute:(et,Ce)=>{const tt=et[h+"X"],kt=et[h+"Y"];Ce.pointer.set(tt/Ce.size.width*2-1,-(kt/Ce.size.height)*2+1),Ce.raycaster.setFromCamera(Ce.pointer,Ce.camera)}}),N==null||N(xe)}}).catch(q),fe.current.ready.status==="fulfilled"?fe.current.render(nt.jsx(T,{children:nt.jsx(rR,{set:q,children:nt.jsx(Ve.Suspense,{fallback:nt.jsx(sR,{set:X}),children:e??null})})})):fe.current.ready.status==="pending"&&he(fe.current.ready))}),Ve.useEffect(()=>{var ie;const xe=(ie=pe.current)==null?void 0:ie.get(),Be=We();xe&&Be&&xe.events.connected!==Be&&(xe.events.connect==null||xe.events.connect(Be))}),Ve.useEffect(()=>{const ie=D.current;return()=>{var xe;ie.isConnected||(xe=fe.current)==null||xe.unmount()}},[]);const qe=c?"none":"auto";return nt.jsxs("div",{ref:B,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:qe,...r},...P,children:[nt.jsx("div",{ref:C,style:{width:"100%",height:"100%"},children:nt.jsx("canvas",{ref:D,style:{display:"block"},children:t})}),Y]})}function o9(i){return nt.jsx(HS,{children:nt.jsx(a9,{...i})})}function Rc(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function nb(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}var us=function i(e,t,n){var r=this;nb(this,i),Rc(this,"dot2",function(o,l){return r.x*o+r.y*l}),Rc(this,"dot3",function(o,l,c){return r.x*o+r.y*l+r.z*c}),this.x=e,this.y=t,this.z=n},l9=[new us(1,1,0),new us(-1,1,0),new us(1,-1,0),new us(-1,-1,0),new us(1,0,1),new us(-1,0,1),new us(1,0,-1),new us(-1,0,-1),new us(0,1,1),new us(0,-1,1),new us(0,1,-1),new us(0,-1,-1)],Ty=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180],Ey=new Array(512),Ay=new Array(512),c9=function(e){e>0&&e<1&&(e*=65536),e=Math.floor(e),e<256&&(e|=e<<8);for(var t=0;t<256;t++){var n;t&1?n=Ty[t]^e&255:n=Ty[t]^e>>8&255,Ey[t]=Ey[t+256]=n,Ay[t]=Ay[t+256]=l9[n%12]}};c9(0);function u9(i){if(typeof i=="number")i=Math.abs(i);else if(typeof i=="string"){var e=i;i=0;for(var t=0;t<e.length;t++)i=(i+(t+1)*(e.charCodeAt(t)%96))%2147483647}return i===0&&(i=311),i}function Cy(i){var e=u9(i);return function(){var t=e*48271%2147483647;return e=t,t/2147483647}}var h9=function i(e){var t=this;nb(this,i),Rc(this,"seed",0),Rc(this,"init",function(n){t.seed=n,t.value=Cy(n)}),Rc(this,"value",Cy(this.seed)),this.init(e)};new h9(Math.random());const f9=Ve.forwardRef(({children:i,enabled:e=!0,speed:t=1,rotationIntensity:n=1,floatIntensity:r=1,floatingRange:o=[-.1,.1],autoInvalidate:l=!1,...c},h)=>{const d=Ve.useRef(null);Ve.useImperativeHandle(h,()=>d.current,[]);const p=Ve.useRef(Math.random()*1e4);return to(g=>{var v,_;if(!e||t===0)return;l&&g.invalidate();const y=p.current+g.clock.elapsedTime;d.current.rotation.x=Math.cos(y/4*t)/8*n,d.current.rotation.y=Math.sin(y/4*t)/8*n,d.current.rotation.z=Math.sin(y/4*t)/20*n;let w=Math.sin(y/4*t)/10;w=Vf.mapLinear(w,-.1,.1,(v=o==null?void 0:o[0])!==null&&v!==void 0?v:-.1,(_=o==null?void 0:o[1])!==null&&_!==void 0?_:.1),d.current.position.y=w*r,d.current.updateMatrix()}),Ve.createElement("group",c,Ve.createElement("group",{ref:d,matrixAutoUpdate:!1},i))});/**
 * postprocessing v6.39.6 build Sun Nov 01 2026
 * https://github.com/pmndrs/postprocessing
 * Copyright 2015-2026 Raoul van Rüschen
 * @license Zlib
 */var d9=(()=>{const i=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),e=new Float32Array([0,0,2,0,0,2]),t=new bt;return t.setAttribute("position",new on(i,3)),t.setAttribute("uv",new on(e,2)),t})(),_i=class zm{static get fullscreenGeometry(){return d9}constructor(e="Pass",t=new kc,n=new bl){this.name=e,this.renderer=null,this.scene=t,this.camera=n,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthBlit=!1,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){const t=this.fullscreenMaterial;t!==null&&(t.needsUpdate=!0),this.rtt=!e}}set mainScene(e){}set mainCamera(e){}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return this.screen!==null?this.screen.material:null}set fullscreenMaterial(e){let t=this.screen;t!==null?t.material=e:(t=new Wn(zm.fullscreenGeometry,e),t.frustumCulled=!1,this.scene===null&&(this.scene=new kc),this.scene.add(t),this.screen=t)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e,t=ia){}render(e,t,n,r,o){throw new Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,n){}dispose(){for(const e of Object.keys(this)){const t=this[e];(t instanceof gn||t instanceof Gn||t instanceof pn||t instanceof zm)&&this[e].dispose()}this.fullscreenMaterial!==null&&this.fullscreenMaterial.dispose()}},p9=class extends _i{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(i,e,t,n,r){const o=i.state.buffers.stencil;o.setLocked(!1),o.setTest(!1)}},m9=`#ifdef COLOR_WRITE
#include <common>
#include <dithering_pars_fragment>
#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
#endif
#ifdef DEPTH_WRITE
#include <packing>
#ifdef GL_FRAGMENT_PRECISION_HIGH
uniform highp sampler2D depthBuffer;
#else
uniform mediump sampler2D depthBuffer;
#endif
float readDepth(const in vec2 uv){
#if DEPTH_PACKING == 3201
return unpackRGBAToDepth(texture2D(depthBuffer,uv));
#else
return texture2D(depthBuffer,uv).r;
#endif
}
#endif
#ifdef USE_WEIGHTS
uniform vec4 channelWeights;
#endif
uniform float opacity;varying vec2 vUv;void main(){
#ifdef COLOR_WRITE
vec4 texel=texture2D(inputBuffer,vUv);
#ifdef USE_WEIGHTS
texel*=channelWeights;
#endif
gl_FragColor=opacity*texel;
#ifdef COLOR_SPACE_CONVERSION
#include <colorspace_fragment>
#endif
#include <dithering_fragment>
#else
gl_FragColor=vec4(0.0);
#endif
#ifdef DEPTH_WRITE
gl_FragDepth=readDepth(vUv);
#endif
}`,ib="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",sb=class extends Qn{constructor(){super({name:"CopyMaterial",defines:{COLOR_SPACE_CONVERSION:"1",DEPTH_PACKING:"0",COLOR_WRITE:"1"},uniforms:{inputBuffer:new zt(null),depthBuffer:new zt(null),channelWeights:new zt(null),opacity:new zt(1)},blending:Oi,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:m9,vertexShader:ib}),this.depthFunc=Ic}get inputBuffer(){return this.uniforms.inputBuffer.value}set inputBuffer(i){const e=i!==null;this.colorWrite!==e&&(e?this.defines.COLOR_WRITE=!0:delete this.defines.COLOR_WRITE,this.colorWrite=e,this.needsUpdate=!0),this.uniforms.inputBuffer.value=i}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(i){const e=i!==null;this.depthWrite!==e&&(e?this.defines.DEPTH_WRITE=!0:delete this.defines.DEPTH_WRITE,this.depthTest=e,this.depthWrite=e,this.needsUpdate=!0),this.uniforms.depthBuffer.value=i}set depthPacking(i){this.defines.DEPTH_PACKING=i.toFixed(0),this.needsUpdate=!0}get colorSpaceConversion(){return this.defines.COLOR_SPACE_CONVERSION!==void 0}set colorSpaceConversion(i){this.colorSpaceConversion!==i&&(i?this.defines.COLOR_SPACE_CONVERSION=!0:delete this.defines.COLOR_SPACE_CONVERSION,this.needsUpdate=!0)}get channelWeights(){return this.uniforms.channelWeights.value}set channelWeights(i){i!==null?(this.defines.USE_WEIGHTS="1",this.uniforms.channelWeights.value=i):delete this.defines.USE_WEIGHTS,this.needsUpdate=!0}setInputBuffer(i){this.uniforms.inputBuffer.value=i}getOpacity(i){return this.uniforms.opacity.value}setOpacity(i){this.uniforms.opacity.value=i}},rb=class extends _i{constructor(i,e=!0){super("CopyPass"),this.fullscreenMaterial=new sb,this.needsSwap=!1,this.renderTarget=i,i===void 0&&(this.renderTarget=new gn(1,1,{minFilter:an,magFilter:an,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=e}get resize(){return this.autoResize}set resize(i){this.autoResize=i}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(i){this.autoResize=i}render(i,e,t,n,r){this.fullscreenMaterial.inputBuffer=e.texture,i.setRenderTarget(this.renderToScreen?null:this.renderTarget),i.render(this.scene,this.camera)}setSize(i,e){this.autoResize&&this.renderTarget.setSize(i,e)}initialize(i,e,t){t!==void 0&&(this.renderTarget.texture.type=t,t!==Mn?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":i!==null&&i.outputColorSpace===Zt&&(this.renderTarget.texture.colorSpace=Zt))}},Ry=new Ge,ab=class extends _i{constructor(i=!0,e=!0,t=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=i,this.depth=e,this.stencil=t,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(i,e,t){this.color=i,this.depth=e,this.stencil=t}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(i){this.overrideClearColor=i}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(i){this.overrideClearAlpha=i}render(i,e,t,n,r){const o=this.overrideClearColor,l=this.overrideClearAlpha,c=i.getClearAlpha(),h=o!==null,d=l>=0;h?(i.getClearColor(Ry),i.setClearColor(o,d?l:c)):d&&i.setClearAlpha(l),i.setRenderTarget(this.renderToScreen?null:e),i.clear(this.color,this.depth,this.stencil),h?i.setClearColor(Ry,c):d&&i.setClearAlpha(c)}},g9=class extends _i{constructor(i,e){super("MaskPass",i,e),this.needsSwap=!1,this.clearPass=new ab(!1,!1,!0),this.inverse=!1}set mainScene(i){this.scene=i}set mainCamera(i){this.camera=i}get inverted(){return this.inverse}set inverted(i){this.inverse=i}get clear(){return this.clearPass.enabled}set clear(i){this.clearPass.enabled=i}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(i){this.inverted=i}render(i,e,t,n,r){const o=i.getContext(),l=i.state.buffers,c=this.scene,h=this.camera,d=this.clearPass,p=this.inverted?0:1,g=1-p;l.color.setMask(!1),l.depth.setMask(!1),l.color.setLocked(!0),l.depth.setLocked(!0),l.stencil.setTest(!0),l.stencil.setOp(o.REPLACE,o.REPLACE,o.REPLACE),l.stencil.setFunc(o.ALWAYS,p,4294967295),l.stencil.setClear(g),l.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?d.render(i,null):(d.render(i,e),d.render(i,t))),this.renderToScreen?(i.setRenderTarget(null),i.render(c,h)):(i.setRenderTarget(e),i.render(c,h),i.setRenderTarget(t),i.render(c,h)),l.color.setLocked(!1),l.depth.setLocked(!1),l.stencil.setLocked(!1),l.stencil.setFunc(o.EQUAL,1,4294967295),l.stencil.setOp(o.KEEP,o.KEEP,o.KEEP),l.stencil.setLocked(!0)}};function v9(i,e){const t=i.getContext();if(e<=0||typeof t.renderbufferStorageMultisample!="function")return 0;const n=t.getParameter(t.MAX_SAMPLES),r=Math.min(e,n);if(r<=0)return 0;const o=t.getParameter(t.RENDERBUFFER_BINDING),l=t.createRenderbuffer();try{return t.bindRenderbuffer(t.RENDERBUFFER,l),t.renderbufferStorageMultisample(t.RENDERBUFFER,r,t.RGBA8,1,1),r}catch{return 0}finally{t.bindRenderbuffer(t.RENDERBUFFER,o),t.deleteRenderbuffer(l)}}var mm=1/1e3,_9=1e3,x9=class{constructor(){this.startTime=performance.now(),this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}get autoReset(){return this._autoReset}set autoReset(i){typeof document<"u"&&document.hidden!==void 0&&(i?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=i)}get delta(){return this._delta*mm}get fixedDelta(){return this._fixedDelta*mm}set fixedDelta(i){this._fixedDelta=i*_9}get elapsed(){return this._elapsed*mm}update(i){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=(i!==void 0?i:performance.now())-this.startTime,this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()-this.startTime}getDelta(){return this.delta}getElapsed(){return this.elapsed}handleEvent(i){document.hidden||(this.currentTime=performance.now()-this.startTime)}dispose(){this.autoReset=!1}},y9=class{constructor(e=null,{depthBuffer:t=!0,stencilBuffer:n=!1,multisampling:r=0,frameBufferType:o=Mn}={}){this.renderer=null,this.inputBuffer=this.createBuffer(t,n,o,r),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new rb,this.depthRenderTarget=null,this.passes=[],this.timer=new x9,this.autoRenderToScreen=!0,this.setRenderer(e)}get stableDepthTexture(){return this.depthRenderTarget===null?null:this.depthRenderTarget.depthTexture}get multisampling(){return this.inputBuffer.samples}set multisampling(e){const t=this.renderer===null?e:v9(this.renderer,e);this.multisampling!==t&&(this.inputBuffer.samples=t,this.outputBuffer.samples=t,this.inputBuffer.dispose(),this.outputBuffer.dispose())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,e!==null){const t=e.getSize(new ue),n=e.getContext().getContextAttributes().alpha,r=this.inputBuffer.texture.type;r===Mn&&e.outputColorSpace===Zt&&(this.inputBuffer.texture.colorSpace=Zt,this.outputBuffer.texture.colorSpace=Zt,this.inputBuffer.dispose(),this.outputBuffer.dispose());const o=this.multisampling;this.multisampling=o,e.autoClear=!1,this.setSize(t.width,t.height);for(const l of this.passes)l.initialize(e,n,r)}}replaceRenderer(e,t=!0){const n=this.renderer,r=n.domElement.parentNode;return this.setRenderer(e),t&&r!==null&&(r.removeChild(n.domElement),r.appendChild(e.domElement)),n}createDepthTexture(){const e=new Qs;e.name="EffectComposer.InputDepth",this.inputBuffer.stencilBuffer?(e.format=js,e.type=Qr):e.type=oi;const t=new Qs;t.format=e.format,t.type=e.type,t.name="EffectComposer.OutputDepth";const n=new Qs;n.format=e.format,n.type=e.type,n.name="EffectComposer.StableDepth",this.inputBuffer.depthTexture=e,this.outputBuffer.depthTexture=t,this.inputBuffer.dispose(),this.outputBuffer.dispose();const{width:r,height:o}=this.inputBuffer;this.depthRenderTarget=new gn(r,o,{depthBuffer:!0,stencilBuffer:this.inputBuffer.stencilBuffer,depthTexture:n})}blitDepthBuffer(e){const t=this.renderer,n=this.depthRenderTarget,r=t.properties,o=t.getContext();t.setRenderTarget(n);const l=r.get(e).__webglFramebuffer,c=r.get(n).__webglFramebuffer,h=e.stencilBuffer?o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT:o.DEPTH_BUFFER_BIT;o.bindFramebuffer(o.READ_FRAMEBUFFER,l),o.bindFramebuffer(o.DRAW_FRAMEBUFFER,c),o.blitFramebuffer(0,0,e.width,e.height,0,0,n.width,n.height,h,o.NEAREST),o.bindFramebuffer(o.READ_FRAMEBUFFER,null),o.bindFramebuffer(o.DRAW_FRAMEBUFFER,null),t.setRenderTarget(null)}deleteDepthTexture(){const e=this.stableDepthTexture;for(const t of this.passes)t.getDepthTexture()===e&&t.setDepthTexture(null);this.depthRenderTarget!==null&&(this.depthRenderTarget.dispose(),this.depthRenderTarget=null),this.inputBuffer.depthTexture!==null&&(this.inputBuffer.depthTexture.dispose(),this.inputBuffer.depthTexture=null),this.outputBuffer.depthTexture!==null&&(this.outputBuffer.depthTexture.dispose(),this.outputBuffer.depthTexture=null)}createBuffer(e,t,n,r){const o=this.renderer,l=o===null?new ue:o.getDrawingBufferSize(new ue),c=new gn(l.width,l.height,{minFilter:an,magFilter:an,samples:r,stencilBuffer:t,depthBuffer:e,type:n});return n===Mn&&o!==null&&o.outputColorSpace===Zt&&(c.texture.colorSpace=Zt),c.texture.name="EffectComposer.Buffer",c.texture.generateMipmaps=!1,c}setMainScene(e){for(const t of this.passes)t.mainScene=e}setMainCamera(e){for(const t of this.passes)t.mainCamera=e}addPass(e,t){const n=this.passes,r=this.renderer,o=r.getDrawingBufferSize(new ue),l=r.getContext().getContextAttributes().alpha,c=this.inputBuffer.texture.type;if(e.renderer=r,e.setSize(o.width,o.height),e.initialize(r,l,c),this.autoRenderToScreen&&(n.length>0&&(n[n.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),t!==void 0?n.splice(t,0,e):n.push(e),this.autoRenderToScreen&&(n[n.length-1].renderToScreen=!0),e.needsDepthTexture||this.depthRenderTarget!==null)if(this.depthRenderTarget===null){this.createDepthTexture();for(const h of n)h.setDepthTexture(this.stableDepthTexture)}else e.setDepthTexture(this.stableDepthTexture)}removePass(e){const t=this.passes,n=t.indexOf(e);if(n!==-1&&t.splice(n,1).length>0){const l=this.stableDepthTexture;if(l!==null){const c=(d,p)=>d||p.needsDepthTexture;t.reduce(c,!1)||(e.getDepthTexture()===l&&e.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&n===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0))}}removeAllPasses(){const e=this.passes;this.deleteDepthTexture(),e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){const t=this.renderer,n=this.copyPass;let r=this.inputBuffer,o=this.outputBuffer,l,c=!1;e===void 0&&(this.timer.update(),e=this.timer.getDelta());for(const h of this.passes)if(h.enabled){if(h.render(t,r,o,e,c),h.needsDepthBlit&&this.depthRenderTarget!==null&&this.blitDepthBuffer(r),h.needsSwap){if(c){n.renderToScreen=h.renderToScreen;const d=t.getContext(),p=t.state.buffers.stencil;p.setFunc(d.NOTEQUAL,1,4294967295),n.render(t,r,o,e,c),p.setFunc(d.EQUAL,1,4294967295)}l=r,r=o,o=l}h instanceof g9?c=!0:h instanceof p9&&(c=!1)}}setSize(e,t,n){const r=this.renderer,o=r.getSize(new ue);(e===void 0||t===void 0)&&(e=o.width,t=o.height),(o.width!==e||o.height!==t)&&r.setSize(e,t,n);const l=r.getDrawingBufferSize(new ue);this.inputBuffer.setSize(l.width,l.height),this.outputBuffer.setSize(l.width,l.height),this.depthRenderTarget!==null&&this.depthRenderTarget.setSize(l.width,l.height);for(const c of this.passes)c.setSize(l.width,l.height)}reset(){this.dispose(),this.autoRenderToScreen=!0}dispose(){for(const e of this.passes)e.dispose();this.deleteDepthTexture(),this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.copyPass.dispose(),this.timer.dispose(),this.passes=[],_i.fullscreenGeometry.dispose()}},Wa={NONE:0,DEPTH:1,CONVOLUTION:2},Yt={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},S9=class{constructor(){this.shaderParts=new Map([[Yt.FRAGMENT_HEAD,null],[Yt.FRAGMENT_MAIN_UV,null],[Yt.FRAGMENT_MAIN_IMAGE,null],[Yt.VERTEX_HEAD,null],[Yt.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=Wa.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=ta}},gm=!1,Iy=class{constructor(i=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(i),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case Di:t=this.materialsFlatShadedDoubleSide;break;case Vn:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded;break}else switch(e.material.side){case Di:t=this.materialsDoubleSide;break;case Vn:t=this.materialsBackSide;break;default:t=this.materials;break}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}cloneMaterial(i){if(!(i instanceof Qn))return i.clone();const e=i.uniforms,t=new Map;for(const r in e){const o=e[r].value;o.isRenderTargetTexture&&(e[r].value=null,t.set(r,o))}const n=i.clone();for(const r of t)e[r[0]].value=r[1],n.uniforms[r[0]].value=r[1];return n}setMaterial(i){if(this.disposeMaterials(),this.material=i,i!==null){const e=this.materials=[this.cloneMaterial(i),this.cloneMaterial(i),this.cloneMaterial(i)];for(const t of e)t.uniforms=Object.assign({},i.uniforms),t.side=Sr;e[2].skinning=!0,this.materialsBackSide=e.map(t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},i.uniforms),n.side=Vn,n}),this.materialsDoubleSide=e.map(t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},i.uniforms),n.side=Di,n}),this.materialsFlatShaded=e.map(t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},i.uniforms),n.flatShading=!0,n}),this.materialsFlatShadedBackSide=e.map(t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},i.uniforms),n.flatShading=!0,n.side=Vn,n}),this.materialsFlatShadedDoubleSide=e.map(t=>{const n=this.cloneMaterial(t);return n.uniforms=Object.assign({},i.uniforms),n.flatShading=!0,n.side=Di,n})}}render(i,e,t){const n=i.shadowMap.enabled;if(i.shadowMap.enabled=!1,gm){const r=this.originalMaterials;this.meshCount=0,e.traverse(this.replaceMaterial),i.render(e,t);for(const o of r)o[0].material=o[1];this.meshCount!==r.size&&r.clear()}else{const r=e.overrideMaterial;e.overrideMaterial=this.material,i.render(e,t),e.overrideMaterial=r}i.shadowMap.enabled=n}disposeMaterials(){if(this.material!==null){const i=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const e of i)e.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return gm}static set workaroundEnabled(i){gm=i}},Jr=-1,mi=class extends Bi{constructor(i=null,e=Jr,t=Jr,n=1){super(),i!==null&&this.addEventListener("change",()=>i.setSize(this.baseSize.width,this.baseSize.height)),this.baseSize=new ue(1,1),this.preferredSize=new ue(e,t),this.target=this.preferredSize,this.s=n,this.effectiveSize=new ue,this.addEventListener("change",()=>this.updateEffectiveSize()),this.updateEffectiveSize()}updateEffectiveSize(){const i=this.baseSize,e=this.preferredSize,t=this.effectiveSize,n=this.scale;e.width!==Jr?t.width=e.width:e.height!==Jr?t.width=Math.round(e.height*(i.width/Math.max(i.height,1))):t.width=Math.round(i.width*n),e.height!==Jr?t.height=e.height:e.width!==Jr?t.height=Math.round(e.width/Math.max(i.width/Math.max(i.height,1),1)):t.height=Math.round(i.height*n)}get width(){return this.effectiveSize.width}set width(i){this.preferredWidth=i}get height(){return this.effectiveSize.height}set height(i){this.preferredHeight=i}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(i){this.s!==i&&(this.s=i,this.preferredSize.setScalar(Jr),this.dispatchEvent({type:"change"}))}getScale(){return this.scale}setScale(i){this.scale=i}get baseWidth(){return this.baseSize.width}set baseWidth(i){this.baseSize.width!==i&&(this.baseSize.width=i,this.dispatchEvent({type:"change"}))}getBaseWidth(){return this.baseWidth}setBaseWidth(i){this.baseWidth=i}get baseHeight(){return this.baseSize.height}set baseHeight(i){this.baseSize.height!==i&&(this.baseSize.height=i,this.dispatchEvent({type:"change"}))}getBaseHeight(){return this.baseHeight}setBaseHeight(i){this.baseHeight=i}setBaseSize(i,e){(this.baseSize.width!==i||this.baseSize.height!==e)&&(this.baseSize.set(i,e),this.dispatchEvent({type:"change"}))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(i){this.preferredSize.width!==i&&(this.preferredSize.width=i,this.dispatchEvent({type:"change"}))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(i){this.preferredWidth=i}get preferredHeight(){return this.preferredSize.height}set preferredHeight(i){this.preferredSize.height!==i&&(this.preferredSize.height=i,this.dispatchEvent({type:"change"}))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(i){this.preferredHeight=i}setPreferredSize(i,e){(this.preferredSize.width!==i||this.preferredSize.height!==e)&&(this.preferredSize.set(i,e),this.dispatchEvent({type:"change"}))}copy(i){this.s=i.scale,this.baseSize.set(i.baseWidth,i.baseHeight),this.preferredSize.set(i.preferredWidth,i.preferredHeight),this.dispatchEvent({type:"change"})}static get AUTO_SIZE(){return Jr}},Bt={ADD:0,ALPHA:1,AVERAGE:2,COLOR:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,DIVIDE:8,DST:9,EXCLUSION:10,HARD_LIGHT:11,HARD_MIX:12,HUE:13,INVERT:14,INVERT_RGB:15,LIGHTEN:16,LINEAR_BURN:17,LINEAR_DODGE:18,LINEAR_LIGHT:19,LUMINOSITY:20,MULTIPLY:21,NEGATION:22,NORMAL:23,OVERLAY:24,PIN_LIGHT:25,REFLECT:26,SATURATION:27,SCREEN:28,SOFT_LIGHT:29,SRC:30,SUBTRACT:31,VIVID_LIGHT:32},b9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",M9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,src.a*opacity);}",w9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=(dst.rgb+src.rgb)*0.5;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",T9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(b.xy,a.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",E9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=dst.rgb,b=src.rgb;vec3 c=mix(step(0.0,b)*(1.0-min(vec3(1.0),(1.0-a)/max(b,1e-9))),vec3(1.0),step(1.0,a));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",A9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=dst.rgb,b=src.rgb;vec3 c=step(0.0,a)*mix(min(vec3(1.0),a/max(1.0-b,1e-9)),vec3(1.0),step(1.0,b));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",C9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=min(dst.rgb,src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",R9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=abs(dst.rgb-src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",I9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb/max(src.rgb,1e-9);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",P9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb-2.0*dst.rgb*src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",L9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=min(dst.rgb,1.0);vec3 b=min(src.rgb,1.0);vec3 c=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,b));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",N9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=step(1.0,dst.rgb+src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",D9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(b.x,a.yz));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",U9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(1.0-src.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",F9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=src.rgb*max(1.0-dst.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",O9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(dst.rgb,src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",B9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=clamp(src.rgb+dst.rgb-1.0,0.0,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",z9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=min(dst.rgb+src.rgb,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",k9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=clamp(2.0*src.rgb+dst.rgb-1.0,0.0,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",H9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(a.xy,b.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",V9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb*src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",G9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(1.0-abs(1.0-dst.rgb-src.rgb),0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",W9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,opacity);}",X9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=2.0*src.rgb*dst.rgb;vec3 b=1.0-2.0*(1.0-src.rgb)*(1.0-dst.rgb);vec3 c=mix(a,b,step(0.5,dst.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",q9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 src2=2.0*src.rgb;vec3 c=mix(mix(src2,dst.rgb,step(0.5*dst.rgb,src.rgb)),max(src2-1.0,vec3(0.0)),step(dst.rgb,src2-1.0));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",$9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=min(dst.rgb*dst.rgb/max(1.0-src.rgb,1e-9),1.0);vec3 c=mix(a,src.rgb,step(1.0,src.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Y9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(a.x,b.y,a.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Z9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb-min(dst.rgb*src.rgb,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",j9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 src2=2.0*src.rgb;vec3 d=dst.rgb+(src2-1.0);vec3 w=step(0.5,src.rgb);vec3 a=dst.rgb-(1.0-src2)*dst.rgb*(1.0-dst.rgb);vec3 b=mix(d*(sqrt(dst.rgb)-dst.rgb),d*dst.rgb*((16.0*dst.rgb-12.0)*dst.rgb+3.0),w*(1.0-step(0.25,dst.rgb)));vec3 c=mix(a,b,w);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",J9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return src;}",K9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(dst.rgb-src.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",Q9="vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=mix(max(1.0-min((1.0-dst.rgb)/(2.0*src.rgb),1.0),0.0),min(dst.rgb/(2.0*(1.0-src.rgb)),1.0),step(0.5,src.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}",eI=new Map([[Bt.ADD,b9],[Bt.ALPHA,M9],[Bt.AVERAGE,w9],[Bt.COLOR,T9],[Bt.COLOR_BURN,E9],[Bt.COLOR_DODGE,A9],[Bt.DARKEN,C9],[Bt.DIFFERENCE,R9],[Bt.DIVIDE,I9],[Bt.DST,null],[Bt.EXCLUSION,P9],[Bt.HARD_LIGHT,L9],[Bt.HARD_MIX,N9],[Bt.HUE,D9],[Bt.INVERT,U9],[Bt.INVERT_RGB,F9],[Bt.LIGHTEN,O9],[Bt.LINEAR_BURN,B9],[Bt.LINEAR_DODGE,z9],[Bt.LINEAR_LIGHT,k9],[Bt.LUMINOSITY,H9],[Bt.MULTIPLY,V9],[Bt.NEGATION,G9],[Bt.NORMAL,W9],[Bt.OVERLAY,X9],[Bt.PIN_LIGHT,q9],[Bt.REFLECT,$9],[Bt.SATURATION,Y9],[Bt.SCREEN,Z9],[Bt.SOFT_LIGHT,j9],[Bt.SRC,J9],[Bt.SUBTRACT,K9],[Bt.VIVID_LIGHT,Q9]]),tI=class extends Bi{constructor(i,e=1){super(),this._blendFunction=i,this.opacity=new zt(e)}getOpacity(){return this.opacity.value}setOpacity(i){this.opacity.value=i}get blendFunction(){return this._blendFunction}set blendFunction(i){this._blendFunction=i,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(i){this.blendFunction=i}getShaderCode(){return eI.get(this.blendFunction)}},Qf=class extends Bi{constructor(i,e,{attributes:t=Wa.NONE,blendFunction:n=Bt.NORMAL,defines:r=new Map,uniforms:o=new Map,extensions:l=null,vertexShader:c=null}={}){super(),this.name=i,this.renderer=null,this.attributes=t,this.fragmentShader=e,this.vertexShader=c,this.defines=r,this.uniforms=o,this.extensions=l,this.blendMode=new tI(n),this.blendMode.addEventListener("change",h=>this.setChanged()),this._inputColorSpace=ta,this._outputColorSpace=Is}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(i){this._inputColorSpace=i,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(i){this._outputColorSpace=i,this.setChanged()}set mainScene(i){}set mainCamera(i){}getName(){return this.name}setRenderer(i){this.renderer=i}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(i){this.attributes=i,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(i){this.fragmentShader=i,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(i){this.vertexShader=i,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(i,e=ia){}update(i,e,t){}setSize(i,e){}initialize(i,e,t){}dispose(){for(const i of Object.keys(this)){const e=this[i];(e instanceof gn||e instanceof Gn||e instanceof pn||e instanceof _i)&&this[i].dispose()}}},Vg={MEDIUM:2,LARGE:3},nI=`#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25;
#include <colorspace_fragment>
}`,iI="uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}",sI=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],rI=class extends Qn{constructor(i=new Kt){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new zt(null),texelSize:new zt(new Kt),scale:new zt(1),kernel:new zt(0)},blending:Oi,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:nI,vertexShader:iI}),this.setTexelSize(i.x,i.y),this.kernelSize=Vg.MEDIUM}set inputBuffer(i){this.uniforms.inputBuffer.value=i}setInputBuffer(i){this.inputBuffer=i}get kernelSequence(){return sI[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(i){this.uniforms.scale.value=i}getScale(){return this.uniforms.scale.value}setScale(i){this.uniforms.scale.value=i}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(i){this.uniforms.kernel.value=i}setKernel(i){this.kernel=i}setTexelSize(i,e){this.uniforms.texelSize.value.set(i,e,i*.5,e*.5)}setSize(i,e){const t=1/i,n=1/e;this.uniforms.texelSize.value.set(t,n,t*.5,n*.5)}},aI=class extends _i{constructor({kernelSize:i=Vg.MEDIUM,resolutionScale:e=.5,width:t=mi.AUTO_SIZE,height:n=mi.AUTO_SIZE,resolutionX:r=t,resolutionY:o=n}={}){super("KawaseBlurPass"),this.renderTargetA=new gn(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const l=this.resolution=new mi(this,r,o,e);l.addEventListener("change",c=>this.setSize(l.baseWidth,l.baseHeight)),this._blurMaterial=new rI,this._blurMaterial.kernelSize=i,this.copyMaterial=new sb}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(i){this._blurMaterial=i}get dithering(){return this.copyMaterial.dithering}set dithering(i){this.copyMaterial.dithering=i}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(i){this.blurMaterial.kernelSize=i}get width(){return this.resolution.width}set width(i){this.resolution.preferredWidth=i}get height(){return this.resolution.height}set height(i){this.resolution.preferredHeight=i}get scale(){return this.blurMaterial.scale}set scale(i){this.blurMaterial.scale=i}getScale(){return this.blurMaterial.scale}setScale(i){this.blurMaterial.scale=i}getKernelSize(){return this.kernelSize}setKernelSize(i){this.kernelSize=i}getResolutionScale(){return this.resolution.scale}setResolutionScale(i){this.resolution.scale=i}render(i,e,t,n,r){const o=this.scene,l=this.camera,c=this.renderTargetA,h=this.renderTargetB,d=this.blurMaterial,p=d.kernelSequence;let g=e;this.fullscreenMaterial=d;for(let v=0,_=p.length;v<_;++v){const y=(v&1)===0?c:h;d.kernel=p[v],d.inputBuffer=g.texture,i.setRenderTarget(y),i.render(o,l),g=y}this.fullscreenMaterial=this.copyMaterial,this.copyMaterial.inputBuffer=g.texture,i.setRenderTarget(this.renderToScreen?null:t),i.render(o,l)}setSize(i,e){const t=this.resolution;t.setBaseSize(i,e);const n=t.width,r=t.height;this.renderTargetA.setSize(n,r),this.renderTargetB.setSize(n,r),this.blurMaterial.setSize(i,e)}initialize(i,e,t){t!==void 0&&(this.renderTargetA.texture.type=t,this.renderTargetB.texture.type=t,t!==Mn?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.copyMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):i!==null&&i.outputColorSpace===Zt&&(this.renderTargetA.texture.colorSpace=Zt,this.renderTargetB.texture.colorSpace=Zt))}static get AUTO_SIZE(){return mi.AUTO_SIZE}},oI=`#include <common>
#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
#ifdef RANGE
uniform vec2 range;
#elif defined(THRESHOLD)
uniform float threshold;uniform float smoothing;
#endif
varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);float mask=1.0;
#ifdef RANGE
float low=step(range.x,l);float high=step(l,range.y);mask=low*high;
#elif defined(THRESHOLD)
mask=smoothstep(threshold,threshold+smoothing,l);
#endif
#ifdef COLOR
gl_FragColor=texel*mask;
#else
gl_FragColor=vec4(l*mask);
#endif
}`,lI=class extends Qn{constructor(i=!1,e=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:_l.replace(/\D+/g,"")},uniforms:{inputBuffer:new zt(null),threshold:new zt(0),smoothing:new zt(1),range:new zt(null)},blending:Oi,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:oI,vertexShader:ib}),this.colorOutput=i,this.luminanceRange=e}set inputBuffer(i){this.uniforms.inputBuffer.value=i}setInputBuffer(i){this.uniforms.inputBuffer.value=i}get threshold(){return this.uniforms.threshold.value}set threshold(i){this.smoothing>0||i>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=i}getThreshold(){return this.threshold}setThreshold(i){this.threshold=i}get smoothing(){return this.uniforms.smoothing.value}set smoothing(i){this.threshold>0||i>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=i}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(i){this.smoothing=i}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(i){}get colorOutput(){return this.defines.COLOR!==void 0}set colorOutput(i){i?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(i){return this.colorOutput}setColorOutputEnabled(i){this.colorOutput=i}get useRange(){return this.luminanceRange!==null}set useRange(i){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(i){i!==null?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=i,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(i){this.luminanceRange=i}},cI=class extends _i{constructor({renderTarget:i,luminanceRange:e,colorOutput:t,resolutionScale:n=1,width:r=mi.AUTO_SIZE,height:o=mi.AUTO_SIZE,resolutionX:l=r,resolutionY:c=o}={}){super("LuminancePass"),this.fullscreenMaterial=new lI(t,e),this.needsSwap=!1,this.renderTarget=i,this.renderTarget===void 0&&(this.renderTarget=new gn(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target");const h=this.resolution=new mi(this,l,c,n);h.addEventListener("change",d=>this.setSize(h.baseWidth,h.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(i,e,t,n,r){const o=this.fullscreenMaterial;o.inputBuffer=e.texture,i.setRenderTarget(this.renderToScreen?null:this.renderTarget),i.render(this.scene,this.camera)}setSize(i,e){const t=this.resolution;t.setBaseSize(i,e),this.renderTarget.setSize(t.width,t.height)}initialize(i,e,t){t!==void 0&&t!==Mn&&(this.renderTarget.texture.type=t,this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},uI=`#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
#define WEIGHT_INNER 0.125
#define WEIGHT_OUTER 0.05556
varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;float clampToBorder(const in vec2 uv){return float(uv.s>=0.0&&uv.s<=1.0&&uv.t>=0.0&&uv.t<=1.0);}void main(){vec4 c=vec4(0.0);vec4 w=WEIGHT_INNER*vec4(clampToBorder(vUv00),clampToBorder(vUv01),clampToBorder(vUv02),clampToBorder(vUv03));c+=w.x*texture2D(inputBuffer,vUv00);c+=w.y*texture2D(inputBuffer,vUv01);c+=w.z*texture2D(inputBuffer,vUv02);c+=w.w*texture2D(inputBuffer,vUv03);w=WEIGHT_OUTER*vec4(clampToBorder(vUv04),clampToBorder(vUv05),clampToBorder(vUv06),clampToBorder(vUv07));c+=w.x*texture2D(inputBuffer,vUv04);c+=w.y*texture2D(inputBuffer,vUv05);c+=w.z*texture2D(inputBuffer,vUv06);c+=w.w*texture2D(inputBuffer,vUv07);w=WEIGHT_OUTER*vec4(clampToBorder(vUv08),clampToBorder(vUv09),clampToBorder(vUv10),clampToBorder(vUv11));c+=w.x*texture2D(inputBuffer,vUv08);c+=w.y*texture2D(inputBuffer,vUv09);c+=w.z*texture2D(inputBuffer,vUv10);c+=w.w*texture2D(inputBuffer,vUv11);c+=WEIGHT_OUTER*texture2D(inputBuffer,vUv);gl_FragColor=c;
#include <colorspace_fragment>
}`,hI="uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;void main(){vUv=position.xy*0.5+0.5;vUv00=vUv+texelSize*vec2(-1.0,1.0);vUv01=vUv+texelSize*vec2(1.0,1.0);vUv02=vUv+texelSize*vec2(-1.0,-1.0);vUv03=vUv+texelSize*vec2(1.0,-1.0);vUv04=vUv+texelSize*vec2(-2.0,2.0);vUv05=vUv+texelSize*vec2(0.0,2.0);vUv06=vUv+texelSize*vec2(2.0,2.0);vUv07=vUv+texelSize*vec2(-2.0,0.0);vUv08=vUv+texelSize*vec2(2.0,0.0);vUv09=vUv+texelSize*vec2(-2.0,-2.0);vUv10=vUv+texelSize*vec2(0.0,-2.0);vUv11=vUv+texelSize*vec2(2.0,-2.0);gl_Position=vec4(position.xy,1.0,1.0);}",fI=class extends Qn{constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new zt(null),texelSize:new zt(new ue)},blending:Oi,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:uI,vertexShader:hI})}set inputBuffer(i){this.uniforms.inputBuffer.value=i}setSize(i,e){this.uniforms.texelSize.value.set(1/i,1/e)}},dI=`#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer;
#else
uniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer;
#endif
uniform float radius;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vec4 c=vec4(0.0);c+=texture2D(inputBuffer,vUv0)*0.0625;c+=texture2D(inputBuffer,vUv1)*0.125;c+=texture2D(inputBuffer,vUv2)*0.0625;c+=texture2D(inputBuffer,vUv3)*0.125;c+=texture2D(inputBuffer,vUv)*0.25;c+=texture2D(inputBuffer,vUv4)*0.125;c+=texture2D(inputBuffer,vUv5)*0.0625;c+=texture2D(inputBuffer,vUv6)*0.125;c+=texture2D(inputBuffer,vUv7)*0.0625;vec4 baseColor=texture2D(supportBuffer,vUv);gl_FragColor=mix(baseColor,c,radius);
#include <colorspace_fragment>
}`,pI="uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,1.0);vUv1=vUv+texelSize*vec2(0.0,1.0);vUv2=vUv+texelSize*vec2(1.0,1.0);vUv3=vUv+texelSize*vec2(-1.0,0.0);vUv4=vUv+texelSize*vec2(1.0,0.0);vUv5=vUv+texelSize*vec2(-1.0,-1.0);vUv6=vUv+texelSize*vec2(0.0,-1.0);vUv7=vUv+texelSize*vec2(1.0,-1.0);gl_Position=vec4(position.xy,1.0,1.0);}",mI=class extends Qn{constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new zt(null),supportBuffer:new zt(null),texelSize:new zt(new ue),radius:new zt(.85)},blending:Oi,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:dI,vertexShader:pI})}set inputBuffer(i){this.uniforms.inputBuffer.value=i}set supportBuffer(i){this.uniforms.supportBuffer.value=i}get radius(){return this.uniforms.radius.value}set radius(i){this.uniforms.radius.value=i}setSize(i,e){this.uniforms.texelSize.value.set(1/i,1/e)}},gI=class extends _i{constructor(){super("MipmapBlurPass"),this.needsSwap=!1,this.renderTarget=new gn(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Upsampling.Mipmap0",this.downsamplingMipmaps=[],this.upsamplingMipmaps=[],this.downsamplingMaterial=new fI,this.upsamplingMaterial=new mI,this.resolution=new ue}get texture(){return this.renderTarget.texture}get levels(){return this.downsamplingMipmaps.length}set levels(i){if(this.levels!==i){const e=this.renderTarget;this.dispose(),this.downsamplingMipmaps=[],this.upsamplingMipmaps=[];for(let t=0;t<i;++t){const n=e.clone();n.texture.name="Downsampling.Mipmap"+t,this.downsamplingMipmaps.push(n)}this.upsamplingMipmaps.push(e);for(let t=1,n=i-1;t<n;++t){const r=e.clone();r.texture.name="Upsampling.Mipmap"+t,this.upsamplingMipmaps.push(r)}this.setSize(this.resolution.x,this.resolution.y)}}get radius(){return this.upsamplingMaterial.radius}set radius(i){this.upsamplingMaterial.radius=i}render(i,e,t,n,r){const{scene:o,camera:l}=this,{downsamplingMaterial:c,upsamplingMaterial:h}=this,{downsamplingMipmaps:d,upsamplingMipmaps:p}=this;let g=e;this.fullscreenMaterial=c;for(let v=0,_=d.length;v<_;++v){const y=d[v];c.setSize(g.width,g.height),c.inputBuffer=g.texture,i.setRenderTarget(y),i.render(o,l),g=y}this.fullscreenMaterial=h;for(let v=p.length-1;v>=0;--v){const _=p[v];h.setSize(g.width,g.height),h.inputBuffer=g.texture,h.supportBuffer=d[v].texture,i.setRenderTarget(_),i.render(o,l),g=_}}setSize(i,e){const t=this.resolution;t.set(i,e);let n=t.width,r=t.height;for(let o=0,l=this.downsamplingMipmaps.length;o<l;++o)n=Math.round(n*.5),r=Math.round(r*.5),this.downsamplingMipmaps[o].setSize(n,r),o<this.upsamplingMipmaps.length&&this.upsamplingMipmaps[o].setSize(n,r)}initialize(i,e,t){if(t!==void 0){const n=this.downsamplingMipmaps.concat(this.upsamplingMipmaps);for(const r of n)r.texture.type=t;if(t!==Mn)this.downsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.upsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1";else if(i!==null&&i.outputColorSpace===Zt)for(const r of n)r.texture.colorSpace=Zt}}dispose(){super.dispose();for(const i of this.downsamplingMipmaps.concat(this.upsamplingMipmaps))i.dispose()}},vI=`#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D map;
#else
uniform lowp sampler2D map;
#endif
uniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=texture2D(map,uv)*intensity;}`,_I=class extends Qf{constructor({blendFunction:i=Bt.SCREEN,luminanceThreshold:e=1,luminanceSmoothing:t=.03,mipmapBlur:n=!0,intensity:r=1,radius:o=.85,levels:l=8,kernelSize:c=Vg.LARGE,resolutionScale:h=.5,width:d=mi.AUTO_SIZE,height:p=mi.AUTO_SIZE,resolutionX:g=d,resolutionY:v=p}={}){super("BloomEffect",vI,{blendFunction:i,uniforms:new Map([["map",new zt(null)],["intensity",new zt(r)]])}),this.renderTarget=new gn(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.blurPass=new aI({kernelSize:c}),this.luminancePass=new cI({colorOutput:!0}),this.luminanceMaterial.threshold=e,this.luminanceMaterial.smoothing=t,this.mipmapBlurPass=new gI,this.mipmapBlurPass.enabled=n,this.mipmapBlurPass.radius=o,this.mipmapBlurPass.levels=l,this.uniforms.get("map").value=n?this.mipmapBlurPass.texture:this.renderTarget.texture;const _=this.resolution=new mi(this,g,v,h);_.addEventListener("change",y=>this.setSize(_.baseWidth,_.baseHeight))}get texture(){return this.mipmapBlurPass.enabled?this.mipmapBlurPass.texture:this.renderTarget.texture}getTexture(){return this.texture}getResolution(){return this.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(i){this.resolution.preferredWidth=i}get height(){return this.resolution.height}set height(i){this.resolution.preferredHeight=i}get dithering(){return this.blurPass.dithering}set dithering(i){this.blurPass.dithering=i}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(i){this.blurPass.kernelSize=i}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(i){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(i){this.uniforms.get("intensity").value=i}getIntensity(){return this.intensity}setIntensity(i){this.intensity=i}getResolutionScale(){return this.resolution.scale}setResolutionScale(i){this.resolution.scale=i}update(i,e,t){const n=this.renderTarget,r=this.luminancePass;r.enabled?(r.render(i,e),this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(i,r.renderTarget):this.blurPass.render(i,r.renderTarget,n)):this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(i,e):this.blurPass.render(i,e,n)}setSize(i,e){const t=this.resolution;t.setBaseSize(i,e),this.renderTarget.setSize(t.width,t.height),this.blurPass.resolution.copy(t),this.luminancePass.setSize(i,e),this.mipmapBlurPass.setSize(i,e)}initialize(i,e,t){this.blurPass.initialize(i,e,t),this.luminancePass.initialize(i,e,t),this.mipmapBlurPass.initialize(i,e,t),t!==void 0&&(this.renderTarget.texture.type=t,i!==null&&i.outputColorSpace===Zt&&(this.renderTarget.texture.colorSpace=Zt))}},ob=class extends _i{constructor(i,e,t=null){super("RenderPass",i,e),this.needsSwap=!1,this.needsDepthBlit=!0,this.clearPass=new ab,this.overrideMaterialManager=t===null?null:new Iy(t),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(i){this.scene=i}set mainCamera(i){this.camera=i}get renderToScreen(){return super.renderToScreen}set renderToScreen(i){super.renderToScreen=i,this.clearPass.renderToScreen=i}get overrideMaterial(){const i=this.overrideMaterialManager;return i!==null?i.material:null}set overrideMaterial(i){const e=this.overrideMaterialManager;i!==null?e!==null?e.setMaterial(i):this.overrideMaterialManager=new Iy(i):e!==null&&(e.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(i){this.overrideMaterial=i}get clear(){return this.clearPass.enabled}set clear(i){this.clearPass.enabled=i}getSelection(){return this.selection}setSelection(i){this.selection=i}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(i){this.ignoreBackground=i}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(i){this.skipShadowMapUpdate=i}getClearPass(){return this.clearPass}render(i,e,t,n,r){const o=this.scene,l=this.camera,c=this.selection,h=l.layers.mask,d=o.background,p=i.shadowMap.autoUpdate,g=this.renderToScreen?null:e;c!==null&&l.layers.set(c.getLayer()),this.skipShadowMapUpdate&&(i.shadowMap.autoUpdate=!1),(this.ignoreBackground||this.clearPass.overrideClearColor!==null)&&(o.background=null),this.clearPass.enabled&&this.clearPass.render(i,e),i.setRenderTarget(g),this.overrideMaterialManager!==null?this.overrideMaterialManager.render(i,o,l):i.render(o,l),l.layers.mask=h,o.background=d,i.shadowMap.autoUpdate=p}},xI=`#include <packing>
#ifdef GL_FRAGMENT_PRECISION_HIGH
uniform highp sampler2D depthBuffer;
#else
uniform mediump sampler2D depthBuffer;
#endif
#ifdef DOWNSAMPLE_NORMALS
uniform lowp sampler2D normalBuffer;
#endif
varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;float readDepth(const in vec2 uv){
#if DEPTH_PACKING == 3201
return unpackRGBAToDepth(texture2D(depthBuffer,uv));
#else
return texture2D(depthBuffer,uv).r;
#endif
}int findBestDepth(const in float samples[4]){float c=(samples[0]+samples[1]+samples[2]+samples[3])*0.25;float distances[4];distances[0]=abs(c-samples[0]);distances[1]=abs(c-samples[1]);distances[2]=abs(c-samples[2]);distances[3]=abs(c-samples[3]);float maxDistance=max(max(distances[0],distances[1]),max(distances[2],distances[3]));int remaining[3];int rejected[3];int i,j,k;for(i=0,j=0,k=0;i<4;++i){if(distances[i]<maxDistance){remaining[j++]=i;}else{rejected[k++]=i;}}for(;j<3;++j){remaining[j]=rejected[--k];}vec3 s=vec3(samples[remaining[0]],samples[remaining[1]],samples[remaining[2]]);c=(s.x+s.y+s.z)/3.0;distances[0]=abs(c-s.x);distances[1]=abs(c-s.y);distances[2]=abs(c-s.z);float minDistance=min(distances[0],min(distances[1],distances[2]));for(i=0;i<3;++i){if(distances[i]==minDistance){break;}}return remaining[i];}void main(){float d[4];d[0]=readDepth(vUv0);d[1]=readDepth(vUv1);d[2]=readDepth(vUv2);d[3]=readDepth(vUv3);int index=findBestDepth(d);
#ifdef DOWNSAMPLE_NORMALS
vec3 n[4];n[0]=texture2D(normalBuffer,vUv0).rgb;n[1]=texture2D(normalBuffer,vUv1).rgb;n[2]=texture2D(normalBuffer,vUv2).rgb;n[3]=texture2D(normalBuffer,vUv3).rgb;
#else
vec3 n[4];n[0]=vec3(0.0);n[1]=vec3(0.0);n[2]=vec3(0.0);n[3]=vec3(0.0);
#endif
gl_FragColor=vec4(n[index],d[index]);}`,yI="uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=uv;vUv1=vec2(uv.x,uv.y+texelSize.y);vUv2=vec2(uv.x+texelSize.x,uv.y);vUv3=uv+texelSize;gl_Position=vec4(position.xy,1.0,1.0);}",SI=class extends Qn{constructor(){super({name:"DepthDownsamplingMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new zt(null),normalBuffer:new zt(null),texelSize:new zt(new ue)},blending:Oi,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:xI,vertexShader:yI})}set depthBuffer(i){this.uniforms.depthBuffer.value=i}set depthPacking(i){this.defines.DEPTH_PACKING=i.toFixed(0),this.needsUpdate=!0}setDepthBuffer(i,e=ia){this.depthBuffer=i,this.depthPacking=e}set normalBuffer(i){this.uniforms.normalBuffer.value=i,i!==null?this.defines.DOWNSAMPLE_NORMALS="1":delete this.defines.DOWNSAMPLE_NORMALS,this.needsUpdate=!0}setNormalBuffer(i){this.normalBuffer=i}setTexelSize(i,e){this.uniforms.texelSize.value.set(i,e)}setSize(i,e){this.uniforms.texelSize.value.set(1/i,1/e)}},bI=class extends _i{constructor({normalBuffer:i=null,resolutionScale:e=.5,width:t=mi.AUTO_SIZE,height:n=mi.AUTO_SIZE,resolutionX:r=t,resolutionY:o=n}={}){super("DepthDownsamplingPass");const l=new SI;l.normalBuffer=i,this.fullscreenMaterial=l,this.needsDepthTexture=!0,this.needsSwap=!1,this.renderTarget=new gn(1,1,{minFilter:dn,magFilter:dn,depthBuffer:!1,type:oi}),this.renderTarget.texture.name="DepthDownsamplingPass.Target",this.renderTarget.texture.generateMipmaps=!1;const c=this.resolution=new mi(this,r,o,e);c.addEventListener("change",h=>this.setSize(c.baseWidth,c.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}setDepthTexture(i,e=ia){this.fullscreenMaterial.depthBuffer=i,this.fullscreenMaterial.depthPacking=e}render(i,e,t,n,r){i.setRenderTarget(this.renderToScreen?null:this.renderTarget),i.render(this.scene,this.camera)}setSize(i,e){const t=this.resolution;t.setBaseSize(i,e),this.renderTarget.setSize(t.width,t.height),this.fullscreenMaterial.setSize(i,e)}initialize(i,e,t){const n=i.getContext();if(!(n.getExtension("EXT_color_buffer_float")||n.getExtension("EXT_color_buffer_half_float")))throw new Error("Rendering to float texture is not supported.")}},MI=`#include <common>
#include <packing>
#include <dithering_pars_fragment>
#define packFloatToRGBA(v) packDepthToRGBA(v)
#define unpackRGBAToFloat(v) unpackRGBAToDepth(v)
#ifdef FRAMEBUFFER_PRECISION_HIGH
uniform mediump sampler2D inputBuffer;
#else
uniform lowp sampler2D inputBuffer;
#endif
#if DEPTH_PACKING == 3201
uniform lowp sampler2D depthBuffer;
#elif defined(GL_FRAGMENT_PRECISION_HIGH)
uniform highp sampler2D depthBuffer;
#else
uniform mediump sampler2D depthBuffer;
#endif
uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;vec4 sRGBToLinear(const in vec4 value){return vec4(mix(pow(value.rgb*0.9478672986+vec3(0.0521327014),vec3(2.4)),value.rgb*0.0773993808,vec3(lessThanEqual(value.rgb,vec3(0.04045)))),value.a);}float readDepth(const in vec2 uv){
#if DEPTH_PACKING == 3201
float depth=unpackRGBAToDepth(texture2D(depthBuffer,uv));
#else
float depth=texture2D(depthBuffer,uv).r;
#endif
#if defined(USE_LOGARITHMIC_DEPTH_BUFFER) || defined(LOG_DEPTH)
float d=pow(2.0,depth*log2(cameraFar+1.0))-1.0;float a=cameraFar/(cameraFar-cameraNear);float b=cameraFar*cameraNear/(cameraNear-cameraFar);depth=a+b/d;
#elif defined(USE_REVERSED_DEPTH_BUFFER)
depth=1.0-depth;
#endif
return depth;}float getViewZ(const in float depth){
#ifdef PERSPECTIVE_CAMERA
return perspectiveDepthToViewZ(depth,cameraNear,cameraFar);
#else
return orthographicDepthToViewZ(depth,cameraNear,cameraFar);
#endif
}vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEAD void main(){FRAGMENT_MAIN_UV vec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGE color0.a=clamp(color0.a,0.0,1.0);gl_FragColor=color0;
#ifdef ENCODE_OUTPUT
#include <colorspace_fragment>
#endif
#include <dithering_fragment>
}`,wI="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEAD void main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORT gl_Position=vec4(position.xy,1.0,1.0);}",TI=class extends Qn{constructor(i,e,t,n,r=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:_l.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new zt(null),depthBuffer:new zt(null),resolution:new zt(new ue),texelSize:new zt(new ue),cameraNear:new zt(.3),cameraFar:new zt(1e3),aspect:new zt(1),time:new zt(0)},blending:Oi,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:r}),i&&this.setShaderParts(i),e&&this.setDefines(e),t&&this.setUniforms(t),this.copyCameraSettings(n)}set inputBuffer(i){this.uniforms.inputBuffer.value=i}setInputBuffer(i){this.uniforms.inputBuffer.value=i}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(i){this.uniforms.depthBuffer.value=i}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(i){this.defines.DEPTH_PACKING=i.toFixed(0),this.needsUpdate=!0}setDepthBuffer(i,e=ia){this.depthBuffer=i,this.depthPacking=e}setShaderData(i){this.setShaderParts(i.shaderParts),this.setDefines(i.defines),this.setUniforms(i.uniforms),this.setExtensions(i.extensions)}setShaderParts(i){return this.fragmentShader=MI.replace(Yt.FRAGMENT_HEAD,i.get(Yt.FRAGMENT_HEAD)||"").replace(Yt.FRAGMENT_MAIN_UV,i.get(Yt.FRAGMENT_MAIN_UV)||"").replace(Yt.FRAGMENT_MAIN_IMAGE,i.get(Yt.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader=wI.replace(Yt.VERTEX_HEAD,i.get(Yt.VERTEX_HEAD)||"").replace(Yt.VERTEX_MAIN_SUPPORT,i.get(Yt.VERTEX_MAIN_SUPPORT)||""),this.needsUpdate=!0,this}setDefines(i){for(const e of i.entries())this.defines[e[0]]=e[1];return this.needsUpdate=!0,this}setUniforms(i){for(const e of i.entries())this.uniforms[e[0]]=e[1];return this}setExtensions(i){this.extensions={};for(const e of i)this.extensions[e]=!0;return this}get encodeOutput(){return this.defines.ENCODE_OUTPUT!==void 0}set encodeOutput(i){this.encodeOutput!==i&&(i?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(i){return this.encodeOutput}setOutputEncodingEnabled(i){this.encodeOutput=i}get time(){return this.uniforms.time.value}set time(i){this.uniforms.time.value=i}setDeltaTime(i){this.uniforms.time.value+=i}adoptCameraSettings(i){this.copyCameraSettings(i)}copyCameraSettings(i){i&&(this.uniforms.cameraNear.value=i.near,this.uniforms.cameraFar.value=i.far,i instanceof Kn?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(i,e){const t=this.uniforms;t.resolution.value.set(i,e),t.texelSize.value.set(1/i,1/e),t.aspect.value=i/e}static get Section(){return Yt}};function Py(i,e,t){for(const n of e){const r="$1"+i+n.charAt(0).toUpperCase()+n.slice(1),o=new RegExp("([^\\.])(\\b"+n+"\\b)","g");for(const l of t.entries())l[1]!==null&&t.set(l[0],l[1].replace(o,r))}}function EI(i,e,t){let n=e.getFragmentShader(),r=e.getVertexShader();const o=n!==void 0&&/mainImage/.test(n),l=n!==void 0&&/mainUv/.test(n);if(t.attributes|=e.getAttributes(),n===void 0)throw new Error(`Missing fragment shader (${e.name})`);if(l&&(t.attributes&Wa.CONVOLUTION)!==0)throw new Error(`Effects that transform UVs are incompatible with convolution effects (${e.name})`);if(!o&&!l)throw new Error(`Could not find mainImage or mainUv function (${e.name})`);{const c=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,h=t.shaderParts;let d=h.get(Yt.FRAGMENT_HEAD)||"",p=h.get(Yt.FRAGMENT_MAIN_UV)||"",g=h.get(Yt.FRAGMENT_MAIN_IMAGE)||"",v=h.get(Yt.VERTEX_HEAD)||"",_=h.get(Yt.VERTEX_MAIN_SUPPORT)||"";const y=new Set,w=new Set;if(l&&(p+=`	${i}MainUv(UV);
`,t.uvTransformation=!0),r!==null&&/mainSupport/.test(r)){const M=/mainSupport *\([\w\s]*?uv\s*?\)/.test(r);_+=`	${i}MainSupport(`,_+=M?`vUv);
`:`);
`;for(const A of r.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const E of A[1].split(/\s*,\s*/))t.varyings.add(E),y.add(E),w.add(E);for(const A of r.matchAll(c))w.add(A[1])}for(const M of n.matchAll(c))w.add(M[1]);for(const M of e.defines.keys())w.add(M.replace(/\([\w\s,]*\)/g,""));for(const M of e.uniforms.keys())w.add(M);w.delete("while"),w.delete("for"),w.delete("if"),e.uniforms.forEach((M,A)=>t.uniforms.set(i+A.charAt(0).toUpperCase()+A.slice(1),M)),e.defines.forEach((M,A)=>t.defines.set(i+A.charAt(0).toUpperCase()+A.slice(1),M));const b=new Map([["fragment",n],["vertex",r]]);Py(i,w,t.defines),Py(i,w,b),n=b.get("fragment"),r=b.get("vertex");const S=e.blendMode;if(t.blendModes.set(S.blendFunction,S),o){e.inputColorSpace!==null&&e.inputColorSpace!==t.colorSpace&&(g+=e.inputColorSpace===Zt?`color0 = sRGBTransferOETF(color0);
	`:`color0 = sRGBToLinear(color0);
	`),e.outputColorSpace!==Is?t.colorSpace=e.outputColorSpace:e.inputColorSpace!==null&&(t.colorSpace=e.inputColorSpace);const M=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;g+=`${i}MainImage(color0, UV, `,(t.attributes&Wa.DEPTH)!==0&&M.test(n)&&(g+="depth, ",t.readDepth=!0),g+=`color1);
	`;const A=i+"BlendOpacity";t.uniforms.set(A,S.opacity),g+=`color0 = blend${S.blendFunction}(color0, color1, ${A});

	`,d+=`uniform float ${A};

`}if(d+=n+`
`,r!==null&&(v+=r+`
`),h.set(Yt.FRAGMENT_HEAD,d),h.set(Yt.FRAGMENT_MAIN_UV,p),h.set(Yt.FRAGMENT_MAIN_IMAGE,g),h.set(Yt.VERTEX_HEAD,v),h.set(Yt.VERTEX_MAIN_SUPPORT,_),e.extensions!==null)for(const M of e.extensions)t.extensions.add(M)}}var lb=class extends _i{constructor(i,...e){super("EffectPass"),this.fullscreenMaterial=new TI(null,null,null,i),this.listener=t=>this.handleEvent(t),this.effects=[],this.setEffects(e),this.skipRendering=!1,this.minTime=1,this.maxTime=Number.POSITIVE_INFINITY,this.timeScale=1}set mainScene(i){for(const e of this.effects)e.mainScene=i}set mainCamera(i){this.fullscreenMaterial.copyCameraSettings(i);for(const e of this.effects)e.mainCamera=i}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(i){this.fullscreenMaterial.encodeOutput=i}get dithering(){return this.fullscreenMaterial.dithering}set dithering(i){const e=this.fullscreenMaterial;e.dithering=i,e.needsUpdate=!0}setEffects(i){for(const e of this.effects)e.removeEventListener("change",this.listener);this.effects=i.sort((e,t)=>t.attributes-e.attributes);for(const e of this.effects)e.addEventListener("change",this.listener)}updateMaterial(){const i=new S9;let e=0;for(const l of this.effects)if(l.blendMode.blendFunction===Bt.DST)i.attributes|=l.getAttributes()&Wa.DEPTH;else{if((i.attributes&l.getAttributes()&Wa.CONVOLUTION)!==0)throw new Error(`Convolution effects cannot be merged (${l.name})`);EI("e"+e++,l,i)}let t=i.shaderParts.get(Yt.FRAGMENT_HEAD),n=i.shaderParts.get(Yt.FRAGMENT_MAIN_IMAGE),r=i.shaderParts.get(Yt.FRAGMENT_MAIN_UV);const o=/\bblend\b/g;for(const l of i.blendModes.values())t+=l.getShaderCode().replace(o,`blend${l.blendFunction}`)+`
`;(i.attributes&Wa.DEPTH)!==0?(i.readDepth&&(n=`float depth = readDepth(UV);

	`+n),this.needsDepthTexture=this.getDepthTexture()===null):this.needsDepthTexture=!1,i.colorSpace===Zt&&(n+=`color0 = sRGBToLinear(color0);
	`),i.uvTransformation?(r=`vec2 transformedUv = vUv;
`+r,i.defines.set("UV","transformedUv")):i.defines.set("UV","vUv"),i.shaderParts.set(Yt.FRAGMENT_HEAD,t),i.shaderParts.set(Yt.FRAGMENT_MAIN_IMAGE,n),i.shaderParts.set(Yt.FRAGMENT_MAIN_UV,r);for(const[l,c]of i.shaderParts)c!==null&&i.shaderParts.set(l,c.trim().replace(/^#/,`
#`));this.skipRendering=e===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(i)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(i,e=ia){this.fullscreenMaterial.depthBuffer=i,this.fullscreenMaterial.depthPacking=e;for(const t of this.effects)t.setDepthTexture(i,e)}render(i,e,t,n,r){for(const o of this.effects)o.update(i,e,n);if(!this.skipRendering||this.renderToScreen){const o=this.fullscreenMaterial;o.inputBuffer=e.texture,o.time+=n*this.timeScale,i.setRenderTarget(this.renderToScreen?null:t),i.render(this.scene,this.camera)}}setSize(i,e){this.fullscreenMaterial.setSize(i,e);for(const t of this.effects)t.setSize(i,e)}initialize(i,e,t){this.renderer=i;for(const n of this.effects)n.initialize(i,e,t);this.updateMaterial(),t!==void 0&&t!==Mn&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const i of this.effects)i.removeEventListener("change",this.listener),i.dispose()}handleEvent(i){switch(i.type){case"change":this.recompile();break}}},AI=class extends _i{constructor(i,e,{renderTarget:t,resolutionScale:n=1,width:r=mi.AUTO_SIZE,height:o=mi.AUTO_SIZE,resolutionX:l=r,resolutionY:c=o}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new ob(i,e,new bg);const h=this.renderPass;h.ignoreBackground=!0,h.skipShadowMapUpdate=!0;const d=h.getClearPass();d.overrideClearColor=new Ge(7829503),d.overrideClearAlpha=1,this.renderTarget=t,this.renderTarget===void 0&&(this.renderTarget=new gn(1,1,{minFilter:dn,magFilter:dn}),this.renderTarget.texture.name="NormalPass.Target");const p=this.resolution=new mi(this,l,c,n);p.addEventListener("change",g=>this.setSize(p.baseWidth,p.baseHeight))}set mainScene(i){this.renderPass.mainScene=i}set mainCamera(i){this.renderPass.mainCamera=i}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(i){this.resolution.scale=i}render(i,e,t,n,r){const o=this.renderToScreen?null:this.renderTarget;this.renderPass.render(i,o,o)}setSize(i,e){const t=this.resolution;t.setBaseSize(i,e),this.renderTarget.setSize(t.width,t.height)}};function Cn(i){return i&&i.__esModule?i.default:i}var cb={};cb=JSON.parse('{"architecture":"attention-v3-pilot","attention":"softmax","dynamicQueries":true,"formatVersion":5,"globalBias":[0.43783164,0.390473098,-0.366750836,0.457545847,1.24783957,0.00699784793],"globalFeatureInverseStandardDeviation":[10.7762499,1.88629949,1.64968634,3.29934478,3.21772695,4.03633451],"globalFeatureMean":[0.919787943,-0.511195958,0.0420053862,-0.00501916651,0.605369925,0.619415224],"globalWeights":[-0.498237908,0.00670673652,0.00152060343,0.00128561188,0.00402788538,0.00678816251,-0.0771772712,-0.0279826578,0.0977897272,0.00205942709,-0.0353725255,-0.182206243,0.190576792,-0.0336237699,-0.00070780341,0.0742666349,0.173491925,0.145801112,-0.329374939,-0.0119222291,-0.0662056282,0.0013825919,0.00677041663,0.0263287611,0.0992663652,0.0201859679,0.0383115783,-0.000026359543,-0.00154593715,-0.0176638458,0.0704428256,0.0043666712,0.0124633005,-0.0001957161,0.0172951035,0.0125593673],"headBias":[-0.18811132,0.0948965773,-0.150786236,-0.428572297,-0.00361282472,-0.0960760415],"headWeights":[-0.349779695,-0.677614272,-3.78093934,1.48417652,1.78316295,0.60994488,-0.288706988,0.444337457,-3.04828668,0.999919236,0.297454536,2.67425728,1.08167505,-0.211544037,1.94777036,-2.04720473,-1.61533034,-1.81531906,-0.268871456,-1.20682883,0.586696744,0.227941558,1.23713028,-0.84190625,0.180674821,0.381884187,0.599859357,0.418890119,-0.745973527,0.140275851,0.912337899,-0.469980091,-1.29117024,-0.33387661,-0.44176051,-0.569980681,-0.0321310423,-0.940412164,1.12141001,0.311931401,-0.0938786566,-0.372619629,-0.846192956,1.06840897,0.411292642,-0.28959462,0.549422562,0.665704966,-1.43473649,-0.926213086,-3.85320234,2.13647246,4.16946936,2.28430319,0.588012576,0.62458235,0.94133085,-0.169601411,0.492336214,-0.474020123,1.69022059,-0.638055801,-1.68348992,-1.15128028,-2.47793055,-1.34734607,0.529119134,-1.73358035,0.523224115,-0.403759301,3.13058639,0.303418279,-0.56067276,-1.78167748,-2.9246037,1.78488731,2.90296459,0.368824869,0.331644475,0.83219707,-0.573884368,-0.00551610626,-0.354529232,1.12002647,0.302889019,0.321854949,-2.37430382,-0.667644799,-1.48869014,-0.385823399,0.0377837978,-1.04985082,1.54539227,0.000523873721,2.00845528,-0.349108458,-0.870733619,-0.272413194,-1.36521316,1.2990303,1.95638001,-0.188038722,2.37597728,-0.85083878,4.10536909,-2.24729896,-2.61444163,-2.2991221,0.985709906,-0.822150469,1.76610732,0.471102774,-0.672168076,2.13004088,-2.19398046,1.77379632,-2.80547023,0.770871639,0.179960966,0.744262457,-0.174077839,-2.23472333,-0.768576086,1.2851423,0.0923231766,3.01212621,-3.76283717,0.036338076,-1.36663747,1.42400813,-0.524636805,1.24904919,3.52172256,0.470047891,4.02753925,-2.8899672,-0.43113178,-1.76285839,1.62054408,0.93694371,-0.310192972,-0.37270534,-0.217828333,-1.79468119],"headWidth":6,"keyProjectionWeights":[-3.33902812,-0.536267698,2.01714158,1.52569818,0.234675318,-0.0199190751,-0.522996366,0.777009666,-2.96427703,-1.68269777,-1.74668443,-1.21742725,-0.149665803,-0.253768742,-0.130375057,-2.44589424,2.78267646,0.564957738,-0.106041111,1.34391129,2.39121079,-1.09815037,-0.0162310768,-0.94102025,0.592346966,-0.877611339,0.822100461,-0.396209598,1.37087905,0.662701786,-0.33238855,1.07927334,1.17617404,2.15566349,0.447210789,-1.01478684],"name":"frame-invariant-w6-10m","outputBias":-0.000645435241,"outputWeights":[-0.372818261,-0.117125496,-0.0229131225,0.205260545,0.0575807579,0.0352538787],"queryCount":4,"queryFromFirstPassAO":true,"queryProjectionWeights":[0.975692391,-0.855476856,-2.6112597,-1.33616245,0.3828471,3.75650811,-3.08311939,-0.183637097,0.799926639,5.05472469,-0.380684286,1.42757761,-0.550761044,-0.420882851,-2.77289224,0.530017316,0.332260936,6.08533239,-0.96134764,-0.0830586925,-3.43319321,1.98897922,0.527699769,10.3556395,3.0345726,-3.55960488,-1.13525546,-3.76720428,1.21770573,12.4426403,-2.60355425,-2.64093018,0.656545401,4.99599934,1.86864853,-6.22469091,-1.83889711,-0.437748134,0.187218606,4.74110746,2.51226878,8.91660213,-3.11046505,-0.588799357,-0.207253695,2.83699632,0.271253496,18.6212864,1.72839391,-1.38337183,1.96843684,-2.33901262,2.90269828,-1.4839524,-1.8591361,2.04251933,1.77161074,5.4193306,-1.36599183,-3.14757466,-0.182765603,1.29674315,-1.05521429,2.25401402,-0.206811205,-0.963144422,5.71507502,-5.14344263,-0.273849398,-4.3076787,6.69000673,3.99203897,0.315123528,-1.32465971,-3.10114861,-0.0378758125,1.19637573,4.44451952,-3.18032098,1.86546385,-2.12358069,4.2800293,-0.502741039,2.31843925,-6.06618166,2.66684651,4.63418913,9.45241642,-1.13186729,-1.45928359,4.54390574,-3.34962153,4.75198603,-6.77375507,2.47302985,12.7788935,3.34261918,-0.862356305,-1.74229538,-4.1722517,1.20036793,11.4210844,-0.552534938,0.389627963,3.99119306,2.24200583,-0.331534415,-5.28202963,0.189935967,0.173227698,2.12633395,0.24529539,-0.0643746853,3.959975,2.03217721,-1.84745824,0.705346525,-1.83792317,0.959801376,-2.78693771,1.99272621,-1.12983501,1.57759488,-5.68606377,0.390426129,1.56775129,-4.77044725,1.86877048,-1.27339029,8.22656536,-2.00721741,4.65022182,-0.240057006,-1.57647789,0.402640164,1.49630237,1.89653265,-2.45852304,1.37989998,-3.74320769,2.44625449,-2.83335567,6.08127356,-1.23896909],"summaryQueries":[0.105387516,0.454028875,-0.430081159,-0.00702179037,0.264354616,-0.228132203,-0.205108106,-0.776229739,-0.466881812,-0.23857826,0.0964843929,-0.13933751,-0.360518366,-0.146551028,0.245282218,0.021966394,0.156582892,-0.213874325,-0.596480668,-0.122390099,0.559692681,-0.455402851,-0.391503394,0.411942124],"supportedAOSamples":[4,64],"supportedDenoiseSamples":[2,16],"tapCountFeature":false,"tapEncoder":"linear-relu","tapFeatureInverseStandardDeviation":[0.804488063,0.790003598,2.48642254,10.2363062,0.122284018],"tapFeatureMean":[0.467297286,0.156966567,0.804100096,0.919606507,1.74726188],"tapFeatureVersion":5,"tapInputBias":[0.0971546993,-0.196101248,-0.284570098,-0.523338139,0.00586045114,0.0224223025],"tapInputWeights":[0.00661610765,-0.472614795,-0.0546437837,-0.533988655,-1.52223134,-3.41688681,10.5672903,-0.0541227944,0.0142248608,-3.16285706,-0.262887836,-0.757909834,0.036780443,-0.0345010608,-2.91157413,-0.578761101,0.264023542,0.585413754,-0.157820433,-1.02857625,0.0244998131,0.0972569212,0.384179115,0.0317516029,-1.87528634,-2.34754252,11.6873474,-0.0754929557,-0.0365382731,-3.03491616],"tokenWidth":6,"valueProjectionWeights":[1.72991586,0.549711049,-3.3594563,-2.85523748,0.253419191,-1.82095242,1.27579415,0.107942834,-2.52012038,-1.24624097,-0.0739918947,1.59550142,0.0109700505,-0.268934995,0.866448998,0.158989862,0.0336840302,1.64906037,0.925075948,0.61349386,-3.0673039,-2.29413342,0.776243091,-0.186843738,0.648555934,-0.561347127,0.0298922714,-0.641319573,0.356067508,1.07836664,-0.447507739,-0.293157369,0.91070205,0.472602487,-1.01833785,0.504232585],"viewFeatures":true}');var ub={};ub=JSON.parse('{"aoCountFeature":true,"architecture":"attention-v3-pilot","attention":"softmax","dynamicQueries":true,"formatVersion":5,"globalBias":[-0.23487520217895508,0.48950883746147156,-0.30546849966049194,0.3173615634441376,0.40140286087989807,0.13670527935028076],"globalFeatureInverseStandardDeviation":[10.773446083068848,1.9641679525375366,1.6521402597427368,3.2980902194976807,3.2336764335632324,4.083446502685547,2.738823413848877],"globalFeatureMean":[0.9217362403869629,-0.4923144578933716,0.025043003261089325,-0.005237828008830547,0.6033159494400024,0.6232529282569885,2.4497241973876953],"globalWeights":[0.0254850871860981,-0.005317260976880789,-0.007180850952863693,-0.011134599335491657,0.16255147755146027,0.09508438408374786,-0.03838718682527542,-0.3525480031967163,-0.0013057778123766184,-0.16403229534626007,-0.0007288795313797891,0.037009816616773605,-0.009373570792376995,-0.01332339271903038,0.014168626628816128,-0.017612656578421593,-0.03153218328952789,-0.06766011565923691,0.0719003677368164,0.15814851224422455,0.0037323313299566507,-0.07866669446229935,0.06905446946620941,0.19048629701137543,0.02467098832130432,0.16497652232646942,-0.14165738224983215,0.09195740520954132,-0.35943859815597534,0.008146993815898895,0.0015961445169523358,0.0015487642958760262,0.01159310806542635,0.06655143946409225,0.005057391710579395,0.018260549753904343,0.033460550010204315,0.02979891747236252,0.0037130878772586584,0.04297925531864166,0.17526447772979736,0.009302761405706406],"headBias":[-0.49185827374458313,0.01934732310473919,0.0871024876832962,-0.21218806505203247,-0.602699875831604,-0.12136935442686081],"headWeights":[1.1111266613006592,-0.22586572170257568,0.7198730707168579,-1.0440499782562256,0.6581113338470459,-0.5818682909011841,-0.6787620186805725,-0.23400487005710602,1.6469072103500366,0.49851536750793457,-0.30568569898605347,-0.9663941264152527,0.5640100836753845,0.6568309664726257,-1.4944493770599365,-0.6121277809143066,0.026223815977573395,1.0962004661560059,-0.2954123020172119,-0.7416629195213318,-1.0015654563903809,0.1011672243475914,-0.2750880718231201,0.18900208175182343,1.8824331760406494,-0.26637592911720276,1.5055253505706787,-1.4948325157165527,0.7318506240844727,0.6958283185958862,-2.680665969848633,0.649141788482666,-0.4300307631492615,2.736664295196533,-2.1459434032440186,-0.18622294068336487,-0.15705765783786774,0.1756553202867508,-0.8836584687232971,-1.3167157173156738,0.48064854741096497,0.24636563658714294,0.8171942830085754,-0.96866375207901,-0.12311527878046036,0.08907859772443771,1.195731520652771,-0.6010469794273376,-0.31442177295684814,0.06256319582462311,-1.1403552293777466,1.0083950757980347,-0.576816201210022,-0.25378674268722534,0.6654301285743713,0.16491831839084625,-0.6477665305137634,-0.08394690603017807,-1.187951922416687,2.8633618354797363,-1.0537290573120117,-0.6821820735931396,-0.27677592635154724,-0.4933861494064331,0.21415925025939941,-0.6251292824745178,1.0035784244537354,0.8126304745674133,1.3597149848937988,-0.7649092674255371,1.516508936882019,-1.4109125137329102,-0.7758139967918396,-0.0921848714351654,-0.44705119729042053,0.5487695932388306,-0.3681693375110626,-0.3481566309928894,-3.7185323238372803,1.2142832279205322,-0.9279266595840454,2.0219886302948,0.7140060663223267,2.4866034984588623,2.372790575027466,-0.6958968639373779,0.3724961578845978,-0.9226368069648743,-1.1621181964874268,-1.0456132888793945,-0.3726767897605896,-0.6010353565216064,-0.5882084369659424,0.04617524892091751,-1.1128591299057007,-0.7252252697944641,0.13949793577194214,0.21132798492908478,-0.0711992084980011,-0.9696488380432129,0.810234785079956,-0.2613503932952881,-1.744551420211792,-1.3586777448654175,0.23254269361495972,2.1415467262268066,-1.0351390838623047,1.022532343864441,1.313363790512085,0.4526016414165497,-0.748141348361969,-1.034693956375122,0.25396692752838135,-0.07268429547548294,0.5651341676712036,0.349802166223526,0.82906174659729,-0.6540957689285278,1.0928452014923096,-0.6196309924125671,-2.2302732467651367,0.3302135467529297,-2.3436026573181152,2.132598876953125,-0.9235839247703552,-0.6759827136993408,2.1004369258880615,-1.3787437677383423,1.6141383647918701,-3.3350090980529785,3.1086294651031494,0.2884121239185333,0.6482406854629517,-0.13405828177928925,0.6876323819160461,1.7825440168380737,-0.6432068943977356,-0.7366701364517212,0.15928620100021362,1.4169843196868896,0.14321061968803406,-0.9000707268714905,-1.8254214525222778,0.9403988122940063],"headWidth":6,"keyProjectionWeights":[1.968758225440979,0.06029555946588516,1.6496589183807373,0.1969003528356552,0.5812652707099915,-0.49263983964920044,-1.4162286520004272,0.6467267870903015,0.9389017820358276,-0.5666568279266357,0.09210626035928726,0.0154453469440341,1.9790271520614624,-0.6524197459220886,0.3852829337120056,-1.0139862298965454,1.4543485641479492,-1.4742259979248047,0.8402373790740967,-1.6299901008605957,0.5867784023284912,0.180627703666687,0.055871233344078064,-0.4523128867149353,-0.5280774235725403,1.2441636323928833,-1.3873804807662964,0.446940541267395,-1.6125956773757935,0.6829583644866943,-0.19958287477493286,0.5077139139175415,1.8004628419876099,-1.0888164043426514,-2.082960844039917,1.764892339706421],"name":"low-end-ao4-8-taps2-8-w6-10m","outputBias":-0.00394976744428277,"outputWeights":[0.09832457453012466,-0.1482764333486557,-0.08873635530471802,-0.403469443321228,-0.07190576940774918,0.09040576219558716],"queryCount":4,"queryFromFirstPassAO":true,"queryProjectionWeights":[-0.7426049709320068,-0.5719303488731384,-3.193450927734375,-0.9577654600143433,0.40415704250335693,-6.56830358505249,-1.1922619342803955,2.4809250831604004,1.2940878868103027,3.264608383178711,-3.5458452701568604,1.3190993070602417,0.7067117691040039,0.32265281677246094,3.1459200382232666,-2.2284884452819824,1.82660710811615,-2.1711184978485107,-2.0983083248138428,-1.545684814453125,-0.24569042026996613,0.03336392343044281,-0.7557753324508667,-4.336874008178711,0.7772427201271057,1.1340705156326294,0.39808061718940735,-0.6557901501655579,-0.717821478843689,0.36376991868019104,-4.532812595367432,2.2300631999969482,-2.299959421157837,-0.1159333810210228,-1.139514684677124,2.038274049758911,-2.1567769050598145,-1.2255606651306152,-2.2613525390625,-0.06955213844776154,0.686713695526123,-2.4105632305145264,1.5480830669403076,0.08907312154769897,2.8444554805755615,0.7416970729827881,-0.2882023751735687,-0.07773427665233612,1.5392664670944214,1.045050024986267,1.26668119430542,-0.4849325120449066,0.35273799300193787,-0.03617783635854721,-0.13010932505130768,-1.1637448072433472,0.429253488779068,0.06385817378759384,0.2689800560474396,-1.339846134185791,-0.4639604985713959,1.805208683013916,0.8485044836997986,0.4042709171772003,-2.134558916091919,0.14060381054878235,0.7928856015205383,-0.014814537018537521,-0.7591497898101807,-0.09340336173772812,0.33959105610847473,0.3742930293083191,-1.9727059602737427,-0.8598183393478394,-1.752785086631775,0.2700415551662445,1.018426537513733,-2.5465080738067627,0.39994364976882935,-0.2866238057613373,1.853872537612915,-0.18617753684520721,0.3271365165710449,-0.4264972507953644,0.15499892830848694,0.7698414325714111,-2.9017550945281982,-0.3716241717338562,-0.46667245030403137,0.051073987036943436,0.25917312502861023,-0.4696865975856781,-1.3365131616592407,0.13455919921398163,0.09333230555057526,-0.7994267344474792,-1.4478063583374023,1.7429078817367554,0.47980016469955444,0.34636157751083374,-1.822554588317871,-1.5870182514190674,-0.9792371988296509,-0.2771056294441223,-3.4887828826904297,0.16184262931346893,0.11151053011417389,0.016441740095615387,0.4298795163631439,-0.012944431975483894,-2.3875114917755127,0.1880328208208084,-0.6474562883377075,-2.384657621383667,0.10586823523044586,0.09706966578960419,2.174907922744751,0.2628093659877777,-0.39121437072753906,0.8147315382957458,-0.21277876198291779,-0.3848346173763275,2.1808743476867676,-0.6166099309921265,1.595718502998352,0.0595792680978775,-0.6556687951087952,-1.1998558044433594,-1.393308401107788,0.17007943987846375,0.4996064305305481,0.14873987436294556,0.3305904269218445,0.3763549327850342,2.4247405529022217,-0.1099848523736,-0.4249989688396454,-1.2989078760147095,-0.6244494318962097,-0.6966514587402344,-3.378746509552002,-0.09526723623275757,0.9617002606391907,0.18756191432476044],"summaryQueries":[-1.3059139251708984,0.4513107240200043,-2.322615385055542,-0.4083015024662018,0.5291218757629395,-0.4556257128715515,-1.1942349672317505,0.32890892028808594,-0.21246710419654846,0.02615520730614662,0.20038092136383057,-0.6428561210632324,-0.34424054622650146,-0.26338937878608704,-0.0962071642279625,-0.018075427040457726,1.3589818477630615,-0.06518024206161499,-0.22449712455272675,0.1584227979183197,-0.4284190237522125,-0.6464412808418274,-0.17804966866970062,-0.6673154830932617],"supportedAOSamples":[4,8],"supportedDenoiseSamples":[2,8],"tapCountFeature":false,"tapEncoder":"linear-relu","tapFeatureInverseStandardDeviation":[0.8376936316490173,0.8167747855186462,2.484034538269043,10.07677173614502,0.11785588413476944],"tapFeatureMean":[0.46911320090293884,0.15568889677524567,0.8032788038253784,0.9206308126449585,1.809395432472229],"tapFeatureVersion":5,"tapInputBias":[0.5654292702674866,0.7262413501739502,-1.026995301246643,-0.14545153081417084,0.08620049804449081,-0.32537832856178284],"tapInputWeights":[0.017292853444814682,0.769314169883728,-0.2591651678085327,-0.15575125813484192,0.7818280458450317,-0.8210893869400024,0.4458440840244293,-0.06454126536846161,0.030049528926610947,-0.8847028017044067,-0.10588371008634567,-7.126821517944336,0.036367520689964294,0.034571573138237,-1.8666346073150635,-2.680792808532715,2.527808666229248,0.06735005229711533,-0.004615016747266054,1.3495070934295654,-0.0020523848943412304,-2.1540005207061768,-0.04858970269560814,-0.7296149730682373,-1.3557016849517822,-1.03042733669281,-0.8479847311973572,-0.07003267109394073,-0.9329867959022522,-2.451733350753784],"tokenWidth":6,"valueProjectionWeights":[0.8635621070861816,-0.3634067177772522,1.4282466173171997,-0.16784507036209106,0.8722880482673645,-0.7474117279052734,-1.572554349899292,0.011807848699390888,0.14296934008598328,0.8244637250900269,-0.1024855449795723,0.3010793924331665,0.21295760571956635,-0.36780381202697754,1.778749942779541,0.27103766798973083,-0.1235288754105568,0.37399497628211975,1.1257693767547607,-0.9169410467147827,3.380439043045044,0.12439541518688202,-0.1989397555589676,-0.15462400019168854,1.5927190780639648,0.41355714201927185,-0.569654643535614,0.8420050144195557,-0.8163355588912964,0.333870530128479,1.0588184595108032,-1.1987265348434448,0.4775378108024597,-0.05230499058961868,1.1195310354232788,-0.7227171063423157],"viewFeatures":true}');var hb={};hb=JSON.parse('{"aoCountFeature":false,"architecture":"attention-v3-pilot","attention":"softmax","dynamicQueries":true,"formatVersion":5,"globalBias":[0.3415367603302002,0.4082188010215759,-0.16684558987617493,-0.09623096138238907,0.40162110328674316,0.6870759725570679],"globalFeatureInverseStandardDeviation":[14.32778263092041,1.884121298789978,1.652080774307251,3.365184783935547,3.1075286865234375,4.699100494384766],"globalFeatureMean":[0.9555400013923645,-0.5114423036575317,0.04568067193031311,0.001569038606248796,0.5547776818275452,0.6745914220809937],"globalWeights":[-0.22830034792423248,-0.051094744354486465,-0.344512015581131,0.007089327555149794,-0.043348051607608795,-0.09276396036148071,-0.05486375093460083,0.18106424808502197,0.1694583147764206,-0.023197153583168983,0.09547806531190872,0.05922706425189972,-0.15566955506801605,0.0845736637711525,0.11941134184598923,-0.01296475250273943,-0.09078185260295868,-0.4673057794570923,-0.07078322023153305,0.03164277970790863,0.02300436422228813,0.007936311885714531,0.031124748289585114,0.6225715279579163,0.1750756949186325,0.10866374522447586,0.08524356782436371,0.00658439751714468,-0.0668456107378006,-0.13015305995941162,0.3342185914516449,0.1907544583082199,0.20439626276493073,-0.018428325653076172,0.18159537017345428,0.22900885343551636],"halfResolution":true,"headBias":[-0.11416810005903244,0.07964055985212326,-0.06806863099336624,0.0038501343224197626,0.040354009717702866,0.06674038618803024],"headWeights":[-0.4640994369983673,0.018926702439785004,-0.13533449172973633,-0.22938643395900726,0.009525771252810955,-0.3001689016819,0.02202548086643219,0.2453767955303192,0.2933403551578522,0.24952922761440277,-0.7516289949417114,-0.01392917800694704,0.9657450914382935,1.0238590240478516,-0.36432692408561707,-0.06545613706111908,-0.16991490125656128,-0.4894498586654663,-0.3495199680328369,-0.6644460558891296,0.053451452404260635,-0.14739912748336792,0.14740459620952606,1.1581701040267944,-0.9495205879211426,0.30856919288635254,-0.8731852769851685,-0.5671781897544861,0.13287201523780823,-0.2512269616127014,1.2776426076889038,-0.07583127170801163,0.8658038973808289,0.6850570440292358,-0.47873616218566895,0.5940101146697998,-0.3332737684249878,0.5447549819946289,-0.559345543384552,-0.4433456063270569,-0.08191245049238205,-0.4857386350631714,0.235487699508667,-0.7909494042396545,0.661185622215271,-0.09463835507631302,0.4860266149044037,0.06314943730831146,-0.9830819964408875,0.06097106263041496,-0.3883771300315857,-1.0524128675460815,-0.0041238171979784966,-0.5205481052398682,-0.12415190041065216,0.1452372521162033,0.023789944127202034,1.2265452146530151,-0.43104827404022217,-0.2516288161277771,0.15755632519721985,0.11786606907844543,0.20667603611946106,-1.383582353591919,-0.1548992246389389,-0.26000967621803284,0.9690282940864563,-0.5563746094703674,0.43293341994285583,0.9071518778800964,0.69586580991745,0.49070027470588684,0.7428987622261047,-0.08652815222740173,0.7734517455101013,0.4622238278388977,-0.40358197689056396,-0.156002014875412,-0.7825685739517212,-0.23884020745754242,-0.5168832540512085,-0.5263991355895996,0.47761040925979614,0.6888848543167114,1.8525972366333008,0.40238267183303833,-0.10582409799098969,-1.480552315711975,1.047361135482788,-0.19110719859600067,-1.2935211658477783,0.14398373663425446,-0.24178177118301392,0.9450215101242065,-1.0469677448272705,-0.36496612429618835,0.15291893482208252,-0.23055820167064667,0.32076141238212585,-0.0033461370039731264,0.08584912866353989,-0.028479479253292084,-0.7471737265586853,-0.05064994469285011,0.3379823863506317,-0.25828948616981506,-0.6537284851074219,-0.694736123085022,0.4832485318183899,0.840389609336853,-0.45775526762008667,0.10633621364831924,-0.06729532778263092,-0.48524561524391174,0.08653950691223145,-0.44572219252586365,-0.10908707976341248,-0.03414439037442207,0.4199244976043701,1.0342738628387451,0.7314791679382324,-0.13269861042499542,0.4169081747531891,0.5329394340515137,0.0542592778801918,0.1498338282108307,-1.1465983390808105,0.09329517930746078,-0.9296138286590576,-1.5018470287322998,0.35964053869247437,-0.13306088745594025,0.21683169901371002,0.001978742890059948,-0.003005517413839698,0.08595708012580872,0.10927268117666245,0.14567796885967255,0.4596860706806183,-0.017128631472587585,0.4522404074668884,0.40431687235832214,-0.2267376035451889,-0.15480786561965942],"headWidth":6,"keyProjectionWeights":[1.0743968486785889,-0.31522753834724426,-0.13789422810077667,-0.6588653326034546,-0.07561295479536057,-0.9335454702377319,-0.01487213745713234,-1.3802809715270996,0.8195410370826721,1.102952241897583,-0.8498378396034241,0.706190288066864,-1.966288447380066,1.1210136413574219,-0.5516120791435242,-1.0897433757781982,1.0223802328109741,-1.3140889406204224,0.20167534053325653,0.9976780414581299,0.4491519331932068,-0.40820834040641785,0.8151915669441223,-0.7031775116920471,-0.23721280694007874,0.008917578496038914,-1.076572060585022,0.03306635841727257,-0.2085762768983841,-0.43795111775398254,0.09096845239400864,0.8193746209144592,0.09645097702741623,-0.5284878015518188,-0.6070249676704407,0.952181339263916],"name":"halfres-r24-w6-10m","outputBias":-0.001141887973062694,"outputWeights":[-0.08033348619937897,-0.11312445253133774,0.05444560572504997,0.05276890844106674,-0.06606808304786682,0.07891061902046204],"queryCount":4,"queryFromFirstPassAO":true,"queryProjectionWeights":[-0.8364990949630737,-3.0233566761016846,-0.3442854583263397,-1.083615779876709,1.6908210515975952,-0.9886903166770935,1.1950870752334595,0.6742460131645203,-0.6858260035514832,1.6143404245376587,3.0980851650238037,4.898868560791016,0.5032519102096558,-2.0328736305236816,0.0007768122013658285,-0.1973840743303299,2.993817090988159,-0.18793244659900665,-0.6154602766036987,-1.5944818258285522,0.3907843828201294,2.5655364990234375,-1.063948631286621,1.5036771297454834,-1.1844741106033325,-1.8838146924972534,0.6615119576454163,0.5850620269775391,-3.0083751678466797,0.9452061057090759,1.6498812437057495,-0.04793442785739899,-0.6147639155387878,-4.572556018829346,5.464226722717285,1.0062377452850342,0.6215742826461792,-0.7856212854385376,0.41761279106140137,0.1742991805076599,-1.1416757106781006,0.5232507586479187,1.8533458709716797,-0.46134254336357117,-0.436107337474823,0.508152186870575,2.248513698577881,1.1985458135604858,0.44868004322052,-0.4089008867740631,0.447164386510849,0.03767639771103859,0.8541422486305237,0.5278031826019287,0.561639130115509,-1.3058439493179321,0.24192160367965698,0.24033910036087036,0.5725159645080566,1.3959643840789795,-1.3122018575668335,0.684934675693512,0.3693007230758667,-0.02337006852030754,-0.002009764313697815,0.2245292216539383,1.8006508350372314,-0.9181729555130005,0.7256668210029602,-0.5521589517593384,-0.770067572593689,0.5162780284881592,-0.0628119558095932,-0.3567149341106415,0.4567009210586548,-0.09375373274087906,-1.1909592151641846,0.2829681932926178,0.3646962642669678,-0.35244184732437134,-0.7048134803771973,0.274361789226532,1.7396624088287354,0.9223706126213074,-0.07499420642852783,-0.06437613070011139,0.07612618058919907,-0.35587361454963684,-0.9122102856636047,0.38134026527404785,0.00507856672629714,-0.47192129492759705,-0.17764882743358612,-0.5668477416038513,1.3999978303909302,0.4975797235965729,-0.2864972651004791,0.28085026144981384,0.1488514244556427,-0.5350532531738281,-0.4610328674316406,0.3033447265625,1.2363266944885254,-0.5562520027160645,-0.666741132736206,-0.12524576485157013,0.530405580997467,0.3076270520687103,-0.25928106904029846,0.20386068522930145,0.11411076039075851,0.356564998626709,-1.474789023399353,-0.0022542462684214115,0.769967794418335,-0.21853111684322357,-0.16907602548599243,1.2655582427978516,2.348046064376831,0.9514631628990173,-0.002333088079467416,0.2552780508995056,0.07524729520082474,0.3060106039047241,-1.007356882095337,0.39073076844215393,-0.3431692123413086,-0.7208309769630432,-0.07652191072702408,0.8514524698257446,1.5842790603637695,0.7932853102684021,-0.49217814207077026,0.11068519949913025,0.4871797263622284,0.05158176273107529,1.0105245113372803,0.7907965779304504,-0.16744866967201233,0.20696884393692017,-1.7004191875457764,0.5724795460700989,-0.28956687450408936,-0.38299575448036194],"summaryQueries":[-0.6831215620040894,0.6311867833137512,-0.8240194320678711,-0.21020881831645966,0.37452322244644165,0.7811359763145447,-0.8128119111061096,-0.037001919001340866,0.6393308043479919,-0.30988550186157227,-0.293872594833374,-0.6090259552001953,-0.42756932973861694,0.12270799279212952,0.09413067996501923,0.13644303381443024,0.6673937439918518,-0.06420466303825378,-0.04550953954458237,0.7849200963973999,0.11615078151226044,-0.8335475325584412,-0.18970483541488647,-0.8479589223861694],"supportedAOSamples":[4,64],"supportedDenoiseSamples":[2,16],"tapCountFeature":false,"tapEncoder":"linear-relu","tapFeatureInverseStandardDeviation":[1.129726529121399,1.0906636714935303,3.25871205329895,13.365403175354004,0.169048473238945],"tapFeatureMean":[0.393989235162735,0.02706373855471611,0.8846182823181152,0.9539855718612671,0.9779379367828369],"tapFeatureVersion":5,"tapInputBias":[-0.05968135967850685,0.40128645300865173,0.3676106631755829,0.43632081151008606,0.2667112648487091,-0.28360697627067566],"tapInputWeights":[0.1367875188589096,-0.11661709100008011,-0.3707384467124939,-0.08733858168125153,1.951775312423706,-2.295248031616211,3.7642486095428467,-0.14622488617897034,0.2124585211277008,-1.09938383102417,0.27411553263664246,-0.9121370315551758,0.2122669517993927,0.15696923434734344,-4.478344917297363,-3.043544054031372,1.72374427318573,-0.17449459433555603,0.22755563259124756,-1.3451639413833618,0.16430269181728363,-0.37391841411590576,-0.014916449785232544,-0.625052809715271,-1.0245423316955566,-0.9597188234329224,1.5213099718093872,0.1632615476846695,-0.42775213718414307,-0.5722843408584595],"tokenWidth":6,"valueProjectionWeights":[-0.5791106224060059,-0.5383517742156982,-0.42644476890563965,0.8547752499580383,0.13658058643341064,-0.6452930569648743,-0.34030798077583313,0.16021066904067993,-1.0805267095565796,0.5308062434196472,0.2891160547733307,-0.295070081949234,-0.30386441946029663,0.5528252124786377,0.3455732464790344,-0.6142981648445129,-0.011208402924239635,-0.3313365876674652,1.2750017642974854,-0.15464529395103455,0.45798465609550476,0.015851326286792755,-1.2394341230392456,1.51675283908844,0.7760326862335205,-1.568787693977356,0.698053240776062,0.8221307992935181,-0.3420703709125519,0.5127549171447754,-0.6207800507545471,0.027017507702112198,0.4534338414669037,-0.22769692540168762,-0.43250134587287903,0.6465526223182678],"viewFeatures":true}');var fb={};fb=JSON.parse('{"aoCountFeature":true,"architecture":"attention-v3-pilot","attention":"softmax","dynamicQueries":true,"formatVersion":5,"globalBias":[-0.3198130428791046,0.4621964693069458,0.11979507654905319,-0.3362836241722107,-0.03246693313121796,0.36117494106292725],"globalFeatureInverseStandardDeviation":[13.75318431854248,1.9015464782714844,1.5972281694412231,3.3482253551483154,3.1128716468811035,4.714102745056152,2.82527494430542],"globalFeatureMean":[0.9555054903030396,-0.5014526844024658,0.02391631156206131,0.002844449831172824,0.5547052025794983,0.6744586825370789,2.4688093662261963],"globalWeights":[-0.011659174226224422,0.03575826436281204,0.0659068375825882,-0.005945529788732529,0.09485199302434921,0.7067717909812927,-0.013656503520905972,0.10924661159515381,-0.0021182671189308167,0.0011400303337723017,-0.0005970761412754655,-0.014494558796286583,-0.05558965355157852,-0.009519142098724842,0.13093283772468567,-0.0008799858624115586,-0.06892896443605423,0.006082552019506693,-0.021069327369332314,-0.008815400302410126,-0.031907256692647934,1.0449752807617188,-0.06077992171049118,0.018840966746211052,-0.0030590512324124575,-0.02545272558927536,-0.06604462116956711,-0.01738095097243786,-0.3082149922847748,-0.12470187246799469,-0.3938072621822357,-0.006867499090731144,-0.0894615650177002,-0.1576204150915146,-0.06304008513689041,-0.02727997489273548,-0.09531105309724808,0.16344937682151794,-0.0011814470635727048,-0.11285676062107086,-0.20248013734817505,0.007925343699753284],"halfResolution":true,"headBias":[-0.005491150077432394,0.09067370742559433,0.38472336530685425,0.3219999670982361,-0.3463800251483917,0.1648607850074768],"headWeights":[0.12697002291679382,1.486151933670044,-0.6321180462837219,1.0358647108078003,0.19681382179260254,1.0987634658813477,-2.400468349456787,2.185788869857788,0.3948235809803009,-0.07627931237220764,1.1911675930023193,2.200221300125122,0.6626771092414856,-0.37286797165870667,-1.6102510690689087,0.040450505912303925,-0.7545972466468811,-2.2289867401123047,1.1527806520462036,-0.26928940415382385,0.6136049032211304,-1.1754579544067383,-0.4376399517059326,-0.5459316372871399,0.0010903991060331464,0.6588382124900818,-0.34718120098114014,-0.37239518761634827,0.024124285206198692,0.6609070301055908,-0.710561990737915,0.21747325360774994,0.6900713443756104,0.4795707166194916,0.3859097361564636,0.06570284813642502,0.3022500276565552,0.011044642888009548,-0.07519306242465973,-0.217575803399086,-0.7890531420707703,-0.7999507188796997,0.5893385410308838,-0.840714693069458,-0.12399818748235703,0.07027088850736618,0.12362434715032578,0.1724563091993332,-0.16638433933258057,0.479497492313385,-0.1266680806875229,0.07807710021734238,0.19778770208358765,0.9826390147209167,0.0045632487162947655,-0.9945358037948608,0.4166831076145172,-0.6617562174797058,0.435362845659256,-0.4251214265823364,0.042026881128549576,1.0004266500473022,-0.42482319474220276,0.10521756112575531,-0.6241959929466248,-0.08027149736881256,-0.029701415449380875,-0.001538985874503851,-0.032443657517433167,0.20462368428707123,0.01400839164853096,-0.07756165415048599,-0.35733434557914734,-0.07182656973600388,-0.03510478883981705,-0.03367917984724045,-0.6418298482894897,-0.16706225275993347,0.009849101305007935,0.7374500632286072,-1.7371770143508911,-0.9573900103569031,-1.595025897026062,-0.32510197162628174,0.21796202659606934,-0.061913639307022095,-0.04327717050909996,0.4143458902835846,1.2904736995697021,0.38356146216392517,-0.568250834941864,0.1093679741024971,0.6875637173652649,-0.020610814914107323,0.5238576531410217,0.7289501428604126,-0.09038779139518738,0.7243658900260925,-0.5790347456932068,-0.05818081647157669,-0.21121671795845032,0.2240002304315567,-0.5271614193916321,-0.6503554582595825,0.13784991204738617,0.083452507853508,0.20016145706176758,0.17993955314159393,0.08826418966054916,0.4003436863422394,-0.104472815990448,-0.17553770542144775,-0.38760995864868164,0.03262068331241608,0.8973648548126221,-0.4956895112991333,0.23113630712032318,0.2059357762336731,0.16896586120128632,-0.4677483141422272,0.21322685480117798,-0.19283628463745117,0.4886004626750946,0.2877121567726135,0.229716956615448,-0.4374759793281555,0.43165263533592224,-0.14368227124214172,-0.8074246048927307,0.03832073509693146,0.8028852343559265,-0.4065983295440674,-0.9018722772598267,0.5889996290206909,1.1141420602798462,-0.8406279683113098,-0.581637442111969,1.268032431602478,0.21262231469154358,-0.0448884479701519,-0.5887182354927063,0.20177946984767914,-0.4357456862926483,-0.7045614123344421],"headWidth":6,"keyProjectionWeights":[0.3196025788784027,0.41115787625312805,0.5520728826522827,1.5160213708877563,-0.1650206744670868,-0.6802523136138916,-0.6249227523803711,-0.8044249415397644,0.8723970651626587,-0.1537444293498993,0.978257954120636,0.5356707572937012,0.38293805718421936,-0.7429642081260681,-0.14657729864120483,-0.8046625256538391,0.5713147521018982,-1.272758960723877,-0.8102282881736755,0.2579136788845062,1.8006619215011597,-3.361179828643799,-0.12005804479122162,-0.5009894967079163,-1.1810256242752075,-0.3583584427833557,-0.0739733874797821,0.15955999493598938,0.40309274196624756,-0.37445375323295593,0.3187107741832733,0.6644556522369385,-0.07355386018753052,-1.1062809228897095,0.08947483450174332,0.08639319241046906],"name":"halfres-lowend-ao4-8-taps2-8-r24-w6-10m","outputBias":-0.008064254187047482,"outputWeights":[0.05921441689133644,-0.11912118643522263,0.12144560366868973,0.07663485407829285,-0.15401549637317657,0.08530080318450928],"queryCount":4,"queryFromFirstPassAO":true,"queryProjectionWeights":[0.9439855813980103,0.2634672522544861,-2.798868179321289,1.28986394405365,0.015298767015337944,-1.0957112312316895,0.22253455221652985,-0.9855132102966309,-0.11677511036396027,-0.7050121426582336,-0.5463969111442566,0.36258527636528015,0.404987096786499,0.8095003366470337,-0.3161497712135315,1.5516482591629028,0.3189839720726013,-0.519627571105957,-0.43169212341308594,-2.062901020050049,2.0220491886138916,-2.6193349361419678,-0.5738628506660461,-0.007839156314730644,0.20730368793010712,0.3266517221927643,1.0123913288116455,1.2757887840270996,0.7285013794898987,-1.5216072797775269,-0.18242749571800232,-0.1601787954568863,-0.3352344334125519,1.1276977062225342,0.22801077365875244,-0.19539566338062286,-0.14803293347358704,-2.357962131500244,-2.9891157150268555,0.5116599202156067,-0.505539059638977,-0.28880056738853455,0.14494404196739197,-0.9457935690879822,-2.6363792419433594,-0.03499924764037132,-0.20277877151966095,-0.40832045674324036,0.7324828505516052,0.5909420251846313,0.05086839199066162,0.7301332354545593,0.4303695857524872,0.016722282394766808,-0.8610791563987732,-1.8339946269989014,1.310667634010315,-1.5207628011703491,-0.009985758922994137,0.4485096335411072,-0.04359700158238411,-0.6340705156326294,2.8351168632507324,-0.012090243399143219,0.48313698172569275,-0.5672005414962769,0.2623421251773834,-1.9412641525268555,-4.415369033813477,1.308350920677185,0.34898725152015686,-1.304937720298767,-0.7426295876502991,0.9071046113967896,1.6402188539505005,-0.8991245031356812,-0.5255399346351624,0.2967768609523773,0.17994362115859985,1.6290701627731323,-1.4749226570129395,-0.3682224154472351,0.053420890122652054,-0.5845384001731873,0.8563029170036316,-1.2358616590499878,-0.5046566724777222,0.7880385518074036,0.25138530135154724,0.05738065391778946,-0.46602511405944824,-0.43377381563186646,0.24630382657051086,-0.9830443859100342,0.1665915995836258,0.6318179965019226,-0.5698667168617249,-1.0392647981643677,1.8079851865768433,0.24400252103805542,0.3969854414463043,0.0694936141371727,-0.2979617416858673,-0.1347111314535141,0.014600541442632675,0.20383712649345398,0.4279293417930603,-0.056503064930438995,-0.12996114790439606,-1.782130241394043,-0.10443630814552307,1.2110345363616943,-0.0820847675204277,-0.36476296186447144,0.39254459738731384,0.09328363090753555,-2.6527786254882812,0.05625227466225624,0.027634616941213608,-1.1020320653915405,0.29280638694763184,0.6204910278320312,-1.8372011184692383,0.5345343947410583,0.11145419627428055,0.40972527861595154,0.26381367444992065,0.40174195170402527,0.5196073651313782,-1.3149847984313965,0.133244127035141,-0.14544466137886047,0.18221737444400787,-0.2907179594039917,2.59808611869812,1.2028559446334839,0.16173136234283447,-0.04112636297941208,-0.577499508857727,-0.349185585975647,0.9895521998405457,0.07286140322685242,0.13262540102005005,0.728203296661377],"summaryQueries":[-0.6004841923713684,0.4441118538379669,-0.5248870849609375,-0.4831331670284271,0.3529265820980072,0.4784294664859772,-0.26624274253845215,0.47364991903305054,0.20335544645786285,-0.34292635321617126,0.2609531283378601,-0.9677605628967285,-0.5737055540084839,0.28534114360809326,0.161922886967659,0.3595702052116394,0.8298744559288025,-0.25901392102241516,-0.26474785804748535,0.6882280111312866,0.2539561688899994,-0.7672181725502014,-0.335147887468338,-0.7452542185783386],"supportedAOSamples":[4,8],"supportedDenoiseSamples":[2,8],"tapCountFeature":false,"tapEncoder":"linear-relu","tapFeatureInverseStandardDeviation":[1.1515717506408691,1.0871944427490234,3.143930435180664,12.819302558898926,0.16889989376068115],"tapFeatureMean":[0.4169483482837677,0.027962181717157364,0.8749999403953552,0.9536586403846741,1.0255751609802246],"tapFeatureVersion":5,"tapInputBias":[0.19159507751464844,0.6269030570983887,0.6338620781898499,0.5564900636672974,0.35316258668899536,-0.2602163851261139],"tapInputWeights":[0.896274209022522,-6.723811626434326,-0.5586385726928711,0.18324045836925507,1.0927767753601074,0.07140769809484482,5.00568151473999,-0.27998945116996765,-0.13933396339416504,1.2269103527069092,0.6970008611679077,-5.501674175262451,0.18685966730117798,0.044365085661411285,-1.9498289823532104,0.12290377169847488,-0.9575690627098083,0.41391539573669434,0.32891175150871277,-1.7544350624084473,-3.2326886653900146,5.646435737609863,-0.16970933973789215,-0.040028393268585205,-1.3030297756195068,-5.924145221710205,-0.22688867151737213,-0.05720207467675209,0.27684393525123596,-2.4887847900390625],"tokenWidth":6,"valueProjectionWeights":[-0.17890113592147827,0.035887137055397034,-0.6631529331207275,0.7090420126914978,0.5978066325187683,-0.21369442343711853,-0.248879536986351,-0.4442882537841797,-0.3240104913711548,-0.08670275658369064,0.12696222960948944,0.08949488401412964,-0.6833963990211487,0.1935519278049469,1.2395929098129272,-0.8060399889945984,-0.37402594089508057,-0.0259151142090559,-0.17773492634296417,0.5507774949073792,-0.18875859677791595,0.38419610261917114,-0.5286281704902649,0.39932018518447876,0.47954198718070984,-0.21882106363773346,-0.3402658998966217,0.9642471075057983,-0.10009662806987762,-0.1036665216088295,-0.06740610301494598,0.10254493355751038,-0.5368606448173523,0.5164257884025574,-0.0014515522634610534,-0.30093300342559814],"viewFeatures":true}');const jc=[Cn(ub),Cn(cb),Cn(fb),Cn(hb)],vm=5,CI=6,RI=i=>{const e=i.tokenWidth,t=i.queryCount*e,n=CI+(i.aoCountFeature?1:0);return[["tapInputWeights",e*vm],["tapInputBias",e],["tapFeatureMean",vm],["tapFeatureInverseStandardDeviation",vm],["globalWeights",e*n],["globalBias",e],["globalFeatureMean",n],["globalFeatureInverseStandardDeviation",n],["summaryQueries",t],["queryProjectionWeights",t*e],["keyProjectionWeights",e*e],["valueProjectionWeights",e*e],["headWeights",i.headWidth*t],["headBias",i.headWidth],["outputWeights",i.headWidth]]},Ly=i=>(i==null?void 0:i.length)===2&&i.every(Number.isInteger)&&i[0]>=1&&i[0]<=i[1];for(const i of jc)if(i.architecture!=="attention-v3-pilot"||i.formatVersion!==5||i.halfResolution!==void 0&&typeof i.halfResolution!="boolean"||!Ly(i.supportedAOSamples)||!Ly(i.supportedDenoiseSamples)||i.supportedDenoiseSamples[1]>16||!i.dynamicQueries||!i.queryFromFirstPassAO||!i.viewFeatures||i.tapCountFeature||i.tapFeatureVersion!==5||i.tapEncoder!=="linear-relu"||i.attention!=="softmax"||![i.tokenWidth,i.queryCount,i.headWidth].every(e=>Number.isInteger(e)&&e>0)||!Number.isFinite(i.outputBias)||RI(i).some(([e,t])=>{var n;return((n=i[e])==null?void 0:n.length)!==t||i[e].some(r=>!Number.isFinite(r))}))throw new Error(`The bundled N8AO neural denoise model ${i.name} has an unsupported layout.`);Math.min(...jc.map(i=>i.supportedAOSamples[0])),Math.max(...jc.map(i=>i.supportedAOSamples[1]));Math.min(...jc.map(i=>i.supportedDenoiseSamples[0])),Math.max(...jc.map(i=>i.supportedDenoiseSamples[1]));var Hn={};Hn=JSON.parse('{"architecture":"upsample-attention","featureInverseStandardDeviation":[2.15287184715271,2.1782360076904297,1.764146089553833,2.1500561237335205,1.5223102569580078,1.5223102569580078],"featureMean":[0.2157563716173172,-0.009060523472726345,0.4620492160320282,0.2185668796300888,-0.00004641203850042075,-0.00017390046559739858],"features":["neighbour AO","signed log1p height / half-res pixel","log1p in-plane distance / half-res pixel","normal agreement (neighbour z rebuilt from x, y)","screen offset x (half-res pixels)","screen offset y (half-res pixels, image-down)"],"formatVersion":1,"headBias":[-0.49836212396621704,-0.43638864159584045,-0.3448403477668762,0.0033751260489225388],"headWeights":[-0.23859690129756927,-0.2528063654899597,0.22717684507369995,0.08138161152601242,-0.062013860791921616,-0.01890455186367035,0.2710539996623993,-0.27808088064193726,0.3076658844947815,-1.5691200494766235,0.026774078607559204,0.38608577847480774,-0.5885924100875854,-0.40551555156707764,-0.17834876477718353,-0.5946246981620789],"headWidth":4,"logitBias":0.08565108478069305,"logitWeights":[-3.3090972900390625,-1.2691282033920288,-1.1384304761886597,-1.8641293048858643],"name":"upsample-attn-4-4-rebuilt-z-9.6m","outputBias":0.0016174089396372437,"outputWeights":[0.04738158732652664,-0.06951392441987991,-0.3849789500236511,-0.11321425437927246],"tokenBias":[2.5444843769073486,1.410379409790039,0.4129602015018463,-0.38071635365486145],"tokenWeights":[0.3278087079524994,0.14286136627197266,0.2755000591278076,-1.5989429950714111,-0.02162809856235981,0.01151680201292038,-0.4501010775566101,-0.6712762117385864,0.30405083298683167,-0.4180987775325775,0.05493999272584915,-0.054325446486473083,0.28790152072906494,0.27217385172843933,-0.9258096814155579,-0.31214186549186707,0.06527978926897049,0.08434554189443588,0.8333116769790649,-0.9605820178985596,-0.5541027188301086,-0.638063371181488,-0.0674639567732811,0.020165318623185158],"tokenWidth":4,"trainedOn":"600 scenes at half resolution, 4-64 AO samples, 2-16 denoise samples, shipped neural denoisers"}');const Xa=6,hs=Cn(Hn).tokenWidth,ul=Cn(Hn).headWidth,II=[["featureMean",Xa],["featureInverseStandardDeviation",Xa],["tokenWeights",hs*Xa],["tokenBias",hs],["logitWeights",hs],["headWeights",ul*hs],["headBias",ul],["outputWeights",ul]];if(Cn(Hn).architecture!=="upsample-attention"||Cn(Hn).formatVersion!==1||![hs,ul].every(i=>Number.isInteger(i)&&i>0)||!Number.isFinite(Cn(Hn).logitBias)||!Number.isFinite(Cn(Hn).outputBias)||II.some(([i,e])=>{var t;return((t=Cn(Hn)[i])==null?void 0:t.length)!==e||Cn(Hn)[i].some(n=>!Number.isFinite(n))}))throw new Error("The bundled N8AO neural upsample model has an unsupported layout.");const mc=i=>{if(i===0)return"0.0";const e=Math.fround(i).toPrecision(9).replace(/\.?0+(e|$)/,"$1");return/[.eE]/.test(e)?e:`${e}.0`},Jh=(i,e)=>i===0?null:`${mc(i)} * ${e}`,Kh=i=>i.filter(Boolean).join(" + ")||"0.0",Oa=i=>Array.from({length:i},(e,t)=>t),PI=Oa(hs).map(i=>{let e=Cn(Hn).tokenBias[i];const t=Oa(Xa).map(n=>{const r=Cn(Hn).tokenWeights[i*Xa+n]*Cn(Hn).featureInverseStandardDeviation[n];return e-=r*Cn(Hn).featureMean[n],r});return{offset:e,coefficients:t}}),LI=i=>`float[${i}](${new Array(i).fill("0.0").join(", ")})`;`${hs}${LI(hs)}${Xa}${Xa}${PI.map(({offset:i,coefficients:e},t)=>`                float token${t} = max(${Kh([mc(i),...e.map((n,r)=>Jh(n,`f[${r}]`))])}, 0.0);`).join(`
`)}${Kh([mc(Cn(Hn).logitBias),...Oa(hs).map(i=>Jh(Cn(Hn).logitWeights[i],`token${i}`))])}${Oa(hs).map(i=>`                summary[${i}] += weight * token${i};`).join(`
`)}${Oa(ul).map(i=>`        float head${i} = max(${Kh([mc(Cn(Hn).headBias[i]),...Oa(hs).map(e=>Jh(Cn(Hn).headWeights[i*hs+e],`summary[${e}] * inverseTotal`))])}, 0.0);`).join(`
`)}${Kh([mc(Cn(Hn).outputBias),...Oa(ul).map(i=>Jh(Cn(Hn).outputWeights[i],`head${i}`))])}`;var NI=i=>typeof i=="object"&&i!=null&&"current"in i?i.current:i;function DI(i,e){return Ve.useCallback(t=>{if(i.current=t,typeof e!="function"){e&&(e.current=t);return}const n=e(t);if(typeof n=="function")return()=>{i.current=null,n()}},[i,e])}function UI(i,e){const t=i.__r3f;return t?t.children.map(n=>n.object).filter(e):[]}function FI(i,e){const t=i.current;return e.length===t.length&&e.every((n,r)=>n===t[r])?!1:(i.current=e,!0)}function OI(i,e){let t=i;for(const n of e.split("-")){if(t==null)return;t=t[n]}return t}function BI(i,e,t){const n=e.split("-");let r=i;for(let o=0;o<n.length-1;o++){if(r==null)return;r=r[n[o]]}r!=null&&(r[n[n.length-1]]=t)}function zI(i,e,t,n=OI,r=BI){const o=Ve.useRef(null),l=Hd(c=>c.invalidate);Ve.useLayoutEffect(()=>{var g;const c=NI(i);if(!c)return;((g=o.current)==null?void 0:g.instance)!==c&&(o.current={instance:c,defaults:new Map,applied:new Map});const{defaults:h,applied:d}=o.current;let p=!1;for(const v of t){if(!h.has(v)){const y=n(c,v);h.set(v,y),d.set(v,y)}const _=e[v]!==void 0?e[v]:h.get(v);Object.is(d.get(v),_)||(r(c,v,_),d.set(v,_),p=!0)}p&&l()})}var Ny=new WeakMap,kI=0,HI=["blendMode-blendFunction","blendMode-opacity-value"];function VI(i){return function({blendFunction:t,opacity:n,ref:r,...o}){let l=Ny.get(i);if(!l){const p=`@react-three/postprocessing/${i.name}-${kI++}`;YS({[p]:i}),Ny.set(i,l=p)}const c=Hd(p=>p.camera),h=Ve.useRef(null),d=DI(h,r);return zI(h,{"blendMode-blendFunction":t,"blendMode-opacity-value":n},HI),nt.jsx(l,{ref:d,camera:c,...o})}}var GI=Ve.createContext(null),Dy=i=>(i.getAttributes()&2)===2,Uy=i=>/mainUv/.test(i.getFragmentShader()??"");function db(i){const e=new WeakMap;return{acquire(t,n){const r=e.get(t);r?(r.count++,r.forcedValue=n):e.set(t,{count:1,original:t[i],forcedValue:n})},release(t){const n=e.get(t);n&&--n.count<=0&&(t[i]===n.forcedValue&&(t[i]=n.original),e.delete(t))}}}var Fy=db("autoClear"),Oy=db("toneMapping"),Zs=new ue,WI=(i,e)=>new ob(i,e),Gg=new WeakSet,XI=new WeakSet;function qI(i){i instanceof lb&&i.setEffects([]),_i.prototype.dispose.call(i)}function By(i){Gg.has(i)&&qI(i)}function $I(i,e,t){const n=[];for(let r=0;r<i.length;r++){const o=i[r];if(o instanceof Qf){const l=[o];let c=Dy(o),h=Uy(o);if(t!=="none"){let p;for(;(p=i[r+1])instanceof Qf;){const g=Dy(p),v=Uy(p);if(t==="auto"&&(c&&g||c&&v||h&&g))break;l.push(p),c||(c=g),h||(h=v),r++}}const d=new lb(e,...l);Gg.add(d),n.push(d)}else o instanceof _i&&n.push(o)}return n}var YI=Ve.memo(function({children:e,camera:t,scene:n,resolutionScale:r,enabled:o=!0,renderPriority:l=1,autoClear:c=!0,autoRenderToScreen:h=!0,depthBuffer:d,enableNormalPass:p,stencilBuffer:g,multisampling:v=4,frameBufferType:_=ps,renderPass:y=WI,mergeMode:w="auto",ref:b}){const{gl:S,scene:M,camera:A}=Hd(),E=n||M,N=t||A;S.getSize(Zs);const[P,T]=Ve.useState(null),[,C]=Ve.useReducer(X=>X+1,0);Ve.useEffect(()=>{Fy.acquire(S,!1);const X=new y9(S,{depthBuffer:d,stencilBuffer:g,multisampling:v,frameBufferType:_});X.autoRenderToScreen=h,X.addPass(y(E,N));let Q=null,q=null;p&&(Q=new AI(E,N),Q.enabled=!1,X.addPass(Q),r!==void 0&&(q=new bI({normalBuffer:Q.texture,resolutionScale:r}),q.enabled=!1,X.addPass(q))),X.setSize(Zs.width,Zs.height);const fe=new Set(X.passes);return T({composer:X,normalPass:Q,downSamplingPass:q}),()=>{for(const Y of[...X.passes])fe.has(Y)||(X.removePass(Y),By(Y));X.dispose(),Fy.release(S)}},[N,S,d,g,v,_,h,y,E,p,r]);const F=Ve.useRef({width:-1,height:-1,pixelRatio:-1});to((X,Q)=>{if(!o||!P)return;const{composer:q}=P;S.getSize(Zs);const fe=S.getPixelRatio(),Y=F.current;(Zs.width!==Y.width||Zs.height!==Y.height||fe!==Y.pixelRatio)&&(q.setSize(Zs.width,Zs.height),Y.width=Zs.width,Y.height=Zs.height,Y.pixelRatio=fe);const he=S.autoClear;S.autoClear=c,g&&!c&&S.clearStencil(),q.render(Q),S.autoClear=he},o?l:0);const D=Ve.useRef(null),B=Ve.useRef([]),[W,Z]=Ve.useState(0);Ve.useLayoutEffect(()=>{if(!P)return;const X=UI(D.current,Q=>Q instanceof Qf||Q instanceof _i);FI(B,X)&&Z(Q=>Q+1)}),Ve.useLayoutEffect(()=>{if(!P)return;const{composer:X,normalPass:Q,downSamplingPass:q}=P,fe=$I(B.current,N,w);if(fe.some(Y=>XI.has(Y))){const Y=new rb;Gg.add(Y),fe.push(Y)}for(const Y of fe)X.addPass(Y);return fe.length&&(Q&&(Q.enabled=!0),q&&(q.enabled=!0)),()=>{for(const Y of fe)X.removePass(Y),By(Y);Q&&(Q.enabled=!1),q&&(q.enabled=!1)}},[P,W,N,w]),Ve.useEffect(()=>(Oy.acquire(S,Qi),S.toneMapping=Qi,()=>{Oy.release(S)}),[S]);const z=Ve.useMemo(()=>P?{composer:P.composer,normalPass:P.normalPass,downSamplingPass:P.downSamplingPass,resolutionScale:r,camera:N,scene:E,requestRebuild:C,autoClear:c}:null,[P,r,N,E,C,c]);return Ve.useImperativeHandle(b,()=>P==null?void 0:P.composer,[P]),z?nt.jsx(GI.Provider,{value:z,children:nt.jsx("group",{ref:D,children:e})}):null}),ZI=VI(_I);function jI({blendFunction:i=0,luminanceThreshold:e,luminanceSmoothing:t,mipmapBlur:n,radius:r,levels:o,resolutionScale:l,resolutionX:c,resolutionY:h,...d}){const p=Ve.useMemo(()=>[{luminanceThreshold:e,luminanceSmoothing:t,mipmapBlur:n,radius:r,levels:o,resolutionScale:l,resolutionX:c,resolutionY:h}],[e,t,n,r,o,l,c,h]);return nt.jsx(ZI,{blendFunction:i,args:p,...d})}function JI(i,e=3.2,t=7){const n=new Float32Array(i*3);for(let r=0;r<i;r++){const o=e+Math.random()*(t-e),l=Math.random()*Math.PI*2,c=Math.acos(2*Math.random()-1);n[r*3]=o*Math.sin(c)*Math.cos(l),n[r*3+1]=o*Math.sin(c)*Math.sin(l),n[r*3+2]=o*Math.cos(c)}return n}function KI(){const{camera:i,pointer:e}=Hd();return to((t,n)=>{const r=Math.min(1,n*2.2);i.position.x=Vf.lerp(i.position.x,e.x*.9,r),i.position.y=Vf.lerp(i.position.y,e.y*.6,r),i.lookAt(0,0,0)}),null}function QI({positions:i}){const e=Ve.useRef(null);return to((t,n)=>{e.current&&(e.current.rotation.y+=n*.028,e.current.rotation.x+=n*.008)}),nt.jsxs("points",{ref:e,frustumCulled:!1,children:[nt.jsx("bufferGeometry",{children:nt.jsx("bufferAttribute",{attach:"attributes-position",args:[i,3]})}),nt.jsx("pointsMaterial",{size:.05,color:"#60a5fa",transparent:!0,opacity:.5,sizeAttenuation:!0,depthWrite:!1})]})}function eP({positions:i}){const e=Ve.useMemo(()=>{const t=Math.min(200,i.length/3),n=1.05,r=[];for(let o=0;o<t;o++)for(let l=o+1;l<t;l++){const c=i[o*3]-i[l*3],h=i[o*3+1]-i[l*3+1],d=i[o*3+2]-i[l*3+2];c*c+h*h+d*d<n*n&&r.push(i[o*3],i[o*3+1],i[o*3+2],i[l*3],i[l*3+1],i[l*3+2])}return new Float32Array(r)},[i]);return e.length===0?null:nt.jsxs("lineSegments",{frustumCulled:!1,children:[nt.jsx("bufferGeometry",{children:nt.jsx("bufferAttribute",{attach:"attributes-position",args:[e,3]})}),nt.jsx("lineBasicMaterial",{color:"#3b82f6",transparent:!0,opacity:.12,depthWrite:!1})]})}function tP(){const i=Ve.useRef(null);return to(({clock:e},t)=>{if(!i.current)return;i.current.rotation.x+=t*.08,i.current.rotation.y+=t*.12;const n=1+Math.sin(e.elapsedTime*.9)*.035;i.current.scale.setScalar(n)}),nt.jsx(f9,{speed:1.2,rotationIntensity:.5,floatIntensity:.9,children:nt.jsxs("mesh",{ref:i,children:[nt.jsx("torusKnotGeometry",{args:[1.2,.32,180,28]}),nt.jsx("meshBasicMaterial",{color:"#3b82f6",wireframe:!0,transparent:!0,opacity:.38})]})})}function nP(){const i=Ve.useRef(null);return to(({clock:e})=>{i.current&&(i.current.opacity=.5+Math.sin(e.elapsedTime*1.1)*.15)}),nt.jsxs("mesh",{children:[nt.jsx("sphereGeometry",{args:[.45,32,32]}),nt.jsx("meshBasicMaterial",{ref:i,color:"#60a5fa",transparent:!0,opacity:.5})]})}function zy({radius:i,tilt:e,color:t}){const n=Ve.useMemo(()=>{const o=[];for(let h=0;h<=160;h++){const d=h/160*Math.PI*2;o.push(new O(Math.cos(d)*i,0,Math.sin(d)*i))}const l=new bt().setFromPoints(o),c=new vi({color:t,transparent:!0,opacity:.16,depthWrite:!1});return new Tr(l,c)},[i,t]);return nt.jsx("group",{rotation:[e,0,0],children:nt.jsx("primitive",{object:n})})}function iP({count:i=6}){const e=Ve.useRef(null);to((n,r)=>{e.current&&(e.current.rotation.y+=r*.3)});const t=Ve.useMemo(()=>Array.from({length:i},(n,r)=>{const o=r/i*Math.PI*2;return{x:Math.cos(o)*2.85,y:r%2===0?.28:-.28,z:Math.sin(o)*2.85}}),[i]);return nt.jsx("group",{rotation:[.4,0,0],ref:e,children:t.map((n,r)=>nt.jsxs("mesh",{position:[n.x,n.y,n.z],children:[nt.jsx("sphereGeometry",{args:[.07,16,16]}),nt.jsx("meshBasicMaterial",{color:r%2===0?"#60a5fa":"#93c5fd"})]},r))})}function cP(){const i=Ve.useMemo(()=>JI(900),[]);return nt.jsx("div",{className:"pointer-events-none absolute inset-0",children:nt.jsxs(o9,{dpr:[1,1.5],camera:{position:[0,0,7],fov:45},gl:{antialias:!0,alpha:!0},style:{background:"transparent"},children:[nt.jsx("ambientLight",{intensity:.55}),nt.jsx("pointLight",{position:[5,5,5],intensity:1.3,color:"#3b82f6"}),nt.jsx("pointLight",{position:[-5,-3,3],intensity:.6,color:"#60a5fa"}),nt.jsx(KI,{}),nt.jsx(Ve.Suspense,{fallback:null,children:nt.jsx(YI,{children:nt.jsx(jI,{intensity:.75,luminanceThreshold:.25,luminanceSmoothing:.9,mipmapBlur:!0})})}),nt.jsx(QI,{positions:i}),nt.jsx(eP,{positions:i}),nt.jsxs("group",{position:[-1.6,0,0],children:[nt.jsx(zy,{radius:2.85,tilt:.4,color:"#3b82f6"}),nt.jsx(zy,{radius:3.75,tilt:-.5,color:"#60a5fa"}),nt.jsx(tP,{}),nt.jsx(nP,{}),nt.jsx(iP,{})]})]})})}export{cP as default};

Zerion Mini Shell 1.0